@kaitranntt/ccs 7.67.0-dev.2 → 7.67.0-dev.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cliproxy/catalog-routing.d.ts +12 -0
- package/dist/cliproxy/catalog-routing.d.ts.map +1 -0
- package/dist/cliproxy/catalog-routing.js +19 -0
- package/dist/cliproxy/catalog-routing.js.map +1 -0
- package/dist/cliproxy/managed-model-prefixes.d.ts +7 -0
- package/dist/cliproxy/managed-model-prefixes.d.ts.map +1 -0
- package/dist/cliproxy/managed-model-prefixes.js +116 -0
- package/dist/cliproxy/managed-model-prefixes.js.map +1 -0
- package/dist/commands/cliproxy/catalog-subcommand.d.ts.map +1 -1
- package/dist/commands/cliproxy/catalog-subcommand.js +60 -6
- package/dist/commands/cliproxy/catalog-subcommand.js.map +1 -1
- package/dist/commands/cliproxy/help-subcommand.d.ts.map +1 -1
- package/dist/commands/cliproxy/help-subcommand.js +3 -2
- package/dist/commands/cliproxy/help-subcommand.js.map +1 -1
- package/dist/commands/cliproxy/variant-subcommand.d.ts.map +1 -1
- package/dist/commands/cliproxy/variant-subcommand.js +44 -3
- package/dist/commands/cliproxy/variant-subcommand.js.map +1 -1
- package/dist/shared/cliproxy-model-routing.d.ts +45 -0
- package/dist/shared/cliproxy-model-routing.d.ts.map +1 -0
- package/dist/shared/cliproxy-model-routing.js +144 -0
- package/dist/shared/cliproxy-model-routing.js.map +1 -0
- package/dist/ui/assets/{accounts-ls0hXYZ9.js → accounts-BirblKLa.js} +1 -1
- package/dist/ui/assets/{alert-dialog-DJMw_zyc.js → alert-dialog-CQmQZ1y3.js} +1 -1
- package/dist/ui/assets/{api-Dz2nP1bN.js → api-LVqV99Nz.js} +1 -1
- package/dist/ui/assets/{auth-section-BD8XqTiz.js → auth-section-BMn1esJw.js} +1 -1
- package/dist/ui/assets/{backups-section-COOSGu9k.js → backups-section-B8wrrRfb.js} +1 -1
- package/dist/ui/assets/{channels-AGHzxMPw.js → channels-Cx8l_iAz.js} +1 -1
- package/dist/ui/assets/{checkbox-pojB3pE7.js → checkbox-Dv9xTnq3.js} +1 -1
- package/dist/ui/assets/{claude-extension-4b8gXOo_.js → claude-extension-CaExxaVo.js} +1 -1
- package/dist/ui/assets/cliproxy-BPz8xkw8.js +3 -0
- package/dist/ui/assets/{cliproxy-ai-providers-BXE0HGLt.js → cliproxy-ai-providers-DhvPIxcM.js} +1 -1
- package/dist/ui/assets/{cliproxy-control-panel-ZnCfRS9l.js → cliproxy-control-panel-BPtg1qLn.js} +1 -1
- package/dist/ui/assets/{codex-B9uBYmnm.js → codex-C7dolHY0.js} +1 -1
- package/dist/ui/assets/{confirm-dialog-DwPqRjyW.js → confirm-dialog-U1BGotGi.js} +1 -1
- package/dist/ui/assets/{copilot-CSWApqyO.js → copilot-BPu8vxGx.js} +1 -1
- package/dist/ui/assets/{cursor-DYbVB4gp.js → cursor-BwXetRW-.js} +1 -1
- package/dist/ui/assets/{droid-BAovZe7o.js → droid-CT8nD2Qf.js} +1 -1
- package/dist/ui/assets/{globalenv-section-CHHZbjD8.js → globalenv-section-aYqRDIyW.js} +1 -1
- package/dist/ui/assets/{health-Jp7o0exN.js → health-DQ8L0h2J.js} +1 -1
- package/dist/ui/assets/{index-VluKB6dO.js → index-B18snjj_.js} +1 -1
- package/dist/ui/assets/{index--j-jJwzV.js → index-BD8yfpL3.js} +1 -1
- package/dist/ui/assets/{index-C5iouJJ2.js → index-C_Zs3pk_.js} +1 -1
- package/dist/ui/assets/{index-Du97tqVQ.js → index-Cp06bK_W.js} +28 -28
- package/dist/ui/assets/{index-CpkWv5tW.js → index-Do2ZsEpH.js} +1 -1
- package/dist/ui/assets/{index-C5uQdep3.js → index-yp9ZGNLI.js} +1 -1
- package/dist/ui/assets/{logs-BDbHSujh.js → logs-CAnlrq9M.js} +1 -1
- package/dist/ui/assets/{masked-input-BcJDHDE6.js → masked-input-B29X-0_y.js} +1 -1
- package/dist/ui/assets/{proxy-status-widget-DQWsa532.js → proxy-status-widget-Dl9GeAR9.js} +1 -1
- package/dist/ui/assets/{raw-json-settings-editor-panel-Cbn2O4rk.js → raw-json-settings-editor-panel-BWwCu2Cn.js} +1 -1
- package/dist/ui/assets/{searchable-select-fldXYfY4.js → searchable-select-Bj6tEvKU.js} +1 -1
- package/dist/ui/assets/{separator-Dd3ktLxa.js → separator-B9KvGyx-.js} +1 -1
- package/dist/ui/assets/{shared-CdAn8E3x.js → shared-B3kOgryU.js} +1 -1
- package/dist/ui/assets/{table-CCf__Q_I.js → table-634XhANR.js} +1 -1
- package/dist/ui/assets/{updates-DfoGG8Jl.js → updates-BjE910La.js} +1 -1
- package/dist/ui/index.html +1 -1
- package/dist/web-server/index.d.ts.map +1 -1
- package/dist/web-server/index.js +9 -0
- package/dist/web-server/index.js.map +1 -1
- package/dist/web-server/routes/catalog-routes.d.ts.map +1 -1
- package/dist/web-server/routes/catalog-routes.js +3 -2
- package/dist/web-server/routes/catalog-routes.js.map +1 -1
- package/dist/web-server/routes/cliproxy-auth-routes.d.ts.map +1 -1
- package/dist/web-server/routes/cliproxy-auth-routes.js +23 -2
- package/dist/web-server/routes/cliproxy-auth-routes.js.map +1 -1
- package/package.json +1 -1
- package/dist/ui/assets/cliproxy-BFEBo-pc.js +0 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t}from"./radix-ui-Zb8sVEtn.js";import{g as Ve,r as S}from"./react-vendor-CNOkPC89.js";import{bu as ye,bv as be,bw as je,bx as Pe,by as z,bz as te,bA as L,bB as $e,bC as We,c as W,B as H,d as Y,a as Oe,bt as _e,aW as De,bD as Ie,bE as Re,bF as Fe,bG as Le,bH as Ue,bI as ze,bJ as qe,aJ as Me,M as Be,O as He,r as Ke,s as Ye,t as Ze,v as Ge,w as Je,T as Qe,p as Xe,q as et,Y as tt}from"./index-Du97tqVQ.js";import{A as st,a as nt,b as rt,c as at,d as it,e as ot,f as lt,g as ct}from"./alert-dialog-DJMw_zyc.js";import{u as ve,a as ut,b as dt,h as mt}from"./tanstack-CrmUhA7Z.js";import{t as se}from"./notifications-B2HqRBj7.js";import{bc as me,R as K,t as pt,s as xt,u as gt,A as ft,bd as ht,be as yt,bf as bt,X as jt,e as vt,bg as Nt,bh as St,U as wt,v as Ct,m as kt,w as At,aB as Et,T as ne,aL as Tt}from"./icons-DfENUzBo.js";var re,pe;function Vt(){return pe||(pe=1,re={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}),re}var Pt=Vt();const $t=Ve(Pt);var Wt=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function xe(e){var s={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},n=e.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(s.name=n[1],($t[n[1]]||e.charAt(e.length-2)==="/")&&(s.voidElement=!0),s.name.startsWith("!--"))){var r=e.indexOf("-->");return{type:"comment",comment:r!==-1?e.slice(4,r):""}}for(var a=new RegExp(Wt),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("=")),s.attrs[c[0]]=c[1],a.lastIndex--}else i[2]&&(s.attrs[i[2]]=i[3].trim().substring(1,i[3].length-1));return s}var Ot=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,_t=/^\s*$/,Dt=Object.create(null);function Ne(e,s){switch(s.type){case"text":return e+s.content;case"tag":return e+="<"+s.name+(s.attrs?(function(n){var r=[];for(var a in n)r.push(a+'="'+n[a]+'"');return r.length?" "+r.join(" "):""})(s.attrs):"")+(s.voidElement?"/>":">"),s.voidElement?e:e+s.children.reduce(Ne,"")+"</"+s.name+">";case"comment":return e+"<!--"+s.comment+"-->"}}var It={parse:function(e,s){s||(s={}),s.components||(s.components=Dt);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(Ot,function(d,m){if(o){if(d!=="</"+n.name+">")return;o=!1}var p,w=d.charAt(1)!=="/",A=d.startsWith("<!--"),g=m+d.length,x=e.charAt(g);if(A){var v=xe(d);return i<0?(r.push(v),r):((p=a[i]).children.push(v),r)}if(w&&(i++,(n=xe(d)).type==="tag"&&s.components[n.name]&&(n.type="component",o=!0),n.voidElement||o||!x||x==="<"||n.children.push({type:"text",content:e.slice(g,e.indexOf("<",g))}),i===0&&r.push(n),(p=a[i-1])&&p.children.push(n),a[i]=n),(!w||n.voidElement)&&(i>-1&&(n.voidElement||n.name===d.slice(2,-1))&&(i--,n=i===-1?r:a[i]),!o&&x!=="<"&&x)){p=i===-1?r:a[i].children;var u=e.indexOf("<",g),h=e.slice(g,u===-1?void 0:u);_t.test(h)&&(h=" "),(u>-1&&i+p.length>=0||h!==" ")&&p.push({type:"text",content:h})}}),r},stringify:function(e){return e.reduce(function(s,n){return s+Ne("",n)},"")}};const G=(e,s)=>{if(!e)return!1;const n=e.props?.children??e.children;return s?n.length>0:!!n},J=e=>{if(!e)return[];const s=e.props?.children??e.children;return e.props?.i18nIsDynamicList?U(s):s},Rt=e=>Array.isArray(e)&&e.every(S.isValidElement),U=e=>Array.isArray(e)?e:[e],Ft=(e,s)=>{const n={...s};return n.props={...s.props,...e.props},n},Lt=e=>{const s={};if(!e)return s;const n=r=>{U(r).forEach(i=>{z(i)||(G(i)?n(J(i)):L(i)&&!S.isValidElement(i)&&Object.assign(s,i))})};return n(e),s},Se=(e,s,n,r)=>{if(!e)return"";let a="";const i=U(e),o=s?.transSupportBasicHtmlNodes?s.transKeepBasicHtmlNodesFor??[]:[];return i.forEach((c,d)=>{if(z(c)){a+=`${c}`;return}if(S.isValidElement(c)){const{props:m,type:p}=c,w=Object.keys(m).length,A=o.indexOf(p)>-1,g=m.children;if(!g&&A&&!w){a+=`<${p}/>`;return}if(!g&&(!A||w)||m.i18nIsDynamicList){a+=`<${d}></${d}>`;return}if(A&&w===1&&z(g)){a+=`<${p}>${g}</${p}>`;return}const x=Se(g,s,n,r);a+=`<${d}>${x}</${d}>`;return}if(c===null){te(n,"TRANS_NULL_VALUE","Passed in a null value as child",{i18nKey:r});return}if(L(c)){const{format:m,...p}=c,w=Object.keys(p);if(w.length===1){const A=m?`${w[0]}, ${m}`:w[0];a+=`{{${A}}}`;return}te(n,"TRANS_INVALID_OBJ","Invalid child - Object should only have keys {{ value, format }} (format is optional).",{i18nKey:r,child:c});return}te(n,"TRANS_INVALID_VAR","Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.",{i18nKey:r,child:c})}),a},Ut=(e,s=[],n={})=>{if(!e)return e;const r=Object.keys(n),a=[...s,...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 m=d[1];(/^\d+$/.test(m)||a.includes(m))&&(c=!0,i+=d[0],o+=d[0].length)}if(!c){const m=e.slice(o).match(/^<(\d+|[a-zA-Z][a-zA-Z0-9_-]*)(\s+[\w-]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?)*\s*(\/)?>/);if(m){const p=m[1];(/^\d+$/.test(p)||a.includes(p))&&(c=!0,i+=m[0],o+=m[0].length)}}c||(i+="<",o+=1)}else i+=e[o],o+=1;return i},zt=(e,s,n,r,a,i,o)=>{if(n==="")return[];const c=a.transKeepBasicHtmlNodesFor||[],d=n&&new RegExp(c.map(b=>`<${b}`).join("|")).test(n);if(!e&&!s&&!d&&!o)return[n];const m=s??{},p=b=>{U(b).forEach(k=>{z(k)||(G(k)?p(J(k)):L(k)&&!S.isValidElement(k)&&Object.assign(m,k))})};p(e);const w=Ut(n,c,m),A=It.parse(`<0>${w}</0>`),g={...m,...i},x=(b,C,k)=>{const E=J(b),$=u(E,C.children,k);return Rt(E)&&$.length===0||b.props?.i18nIsDynamicList?E:$},v=(b,C,k,E,$)=>{b.dummy?(b.children=C,k.push(S.cloneElement(b,{key:E},$?void 0:C))):k.push(...S.Children.map([b],f=>{const l="data-i18n-is-dynamic-list",V={key:E,[l]:void 0};return f&&f.props&&Object.keys(f.props).forEach(T=>{T==="ref"||T==="children"||T==="i18nIsDynamicList"||T===l||(V[T]=f.props[T])}),S.cloneElement(f,V,$?null:C)}))},u=(b,C,k)=>{const E=U(b);return U(C).reduce((f,l,V)=>{const T=l.children?.[0]?.content&&r.services.interpolator.interpolate(l.children[0].content,g,r.language);if(l.type==="tag"){let P=E[parseInt(l.name,10)];!P&&s&&(P=s[l.name]),k.length===1&&!P&&(P=k[0][l.name]),P||(P={});const O={...l.attrs};o&&Object.keys(O).forEach(y=>{const F=O[y];z(F)&&(O[y]=$e(F))});const j=Object.keys(O).length!==0?Ft({props:O},P):P,_=S.isValidElement(j),D=_&&G(l,!0)&&!l.voidElement,R=d&&L(j)&&j.dummy&&!_,q=L(s)&&Object.hasOwnProperty.call(s,l.name);if(z(j)){const y=r.services.interpolator.interpolate(j,g,r.language);f.push(y)}else if(G(j)||D){const y=x(j,l,k);v(j,y,f,V)}else if(R){const y=u(E,l.children,k);v(j,y,f,V)}else if(Number.isNaN(parseFloat(l.name)))if(q){const y=x(j,l,k);v(j,y,f,V,l.voidElement)}else if(a.transSupportBasicHtmlNodes&&c.indexOf(l.name)>-1)if(l.voidElement)f.push(S.createElement(l.name,{key:`${l.name}-${V}`}));else{const y=u(E,l.children,k);f.push(S.createElement(l.name,{key:`${l.name}-${V}`},y))}else if(l.voidElement)f.push(`<${l.name} />`);else{const y=u(E,l.children,k);f.push(`<${l.name}>${y}</${l.name}>`)}else if(L(j)&&!_){const y=l.children[0]?T:null;y&&f.push(y)}else v(j,T,f,V,l.children.length!==1||!T)}else if(l.type==="text"){const P=a.transWrapTextNodes,O=typeof a.unescape=="function"?a.unescape:je().unescape,j=o?O(r.services.interpolator.interpolate(l.content,g,r.language)):r.services.interpolator.interpolate(l.content,g,r.language);P?f.push(S.createElement(P,{key:`${l.name}-${V}`},j)):f.push(j)}return f},[])},h=u([{dummy:!0,children:e||[]}],A,U(e||[]));return J(h[0])},we=(e,s,n)=>{const r=e.key||s,a=S.cloneElement(e,{key:r});if(!a.props||!a.props.children||n.indexOf(`${s}/>`)<0&&n.indexOf(`${s} />`)<0)return a;function i(){return S.createElement(S.Fragment,null,a)}return S.createElement(i,{key:r})},qt=(e,s)=>e.map((n,r)=>we(n,r,s)),Mt=(e,s)=>{const n={};return Object.keys(e).forEach(r=>{Object.assign(n,{[r]:we(e[r],r,s)})}),n},Bt=(e,s,n,r)=>e?Array.isArray(e)?qt(e,s):L(e)?Mt(e,s):(ye(n,"TRANS_INVALID_COMPONENTS",'<Trans /> "components" prop expects an object or array',{i18nKey:r}),null):null,Ht=e=>!L(e)||Array.isArray(e)?!1:Object.keys(e).reduce((s,n)=>s&&Number.isNaN(Number.parseFloat(n)),!0);function Kt({children:e,count:s,parent:n,i18nKey:r,context:a,tOptions:i={},values:o,defaults:c,components:d,ns:m,i18n:p,t:w,shouldUnescape:A,...g}){const x=p||be();if(!x)return ye(x,"NO_I18NEXT_INSTANCE","Trans: You need to pass in an i18next instance using i18nextReactModule",{i18nKey:r}),e;const v=w||x.t.bind(x)||(M=>M),u={...je(),...x.options?.react};let h=m||v.ns||x.options?.defaultNS;h=z(h)?[h]:h||["translation"];const{transDefaultProps:b}=u,C=b?.tOptions?{...b.tOptions,...i}:i,k=A??b?.shouldUnescape,E=b?.values?{...b.values,...o}:o,$=b?.components?{...b.components,...d}:d,f=Se(e,u,x,r),l=c||C?.defaultValue||f||u.transEmptyNodeValue||(typeof r=="function"?Pe(r):r),{hashTransKey:V}=u,T=r||(V?V(f||l):f||l);x.options?.interpolation?.defaultVariables?o=E&&Object.keys(E).length>0?{...E,...x.options.interpolation.defaultVariables}:{...x.options.interpolation.defaultVariables}:o=E;const P=Lt(e);P&&typeof P.count=="number"&&s===void 0&&(s=P.count);const O=o||s!==void 0&&!x.options?.interpolation?.alwaysFormat||!e?C.interpolation:{interpolation:{...C.interpolation,prefix:"#$?",suffix:"?$#"}},j={...C,context:a||C.context,count:s,...o,...O,defaultValue:l,ns:h};let _=T?v(T,j):l;_===T&&l&&(_=l);const D=Bt($,_,x,r);let R=D||e,q=null;Ht(D)&&(q=D,R=e);const y=zt(R,q,_,x,u,j,k),F=n??u.defaultTransParent;return F?S.createElement(F,g,y):y}function ge({children:e,count:s,parent:n,i18nKey:r,context:a,tOptions:i={},values:o,defaults:c,components:d,ns:m,i18n:p,t:w,shouldUnescape:A,...g}){const{i18n:x,defaultNS:v}=S.useContext(We)||{},u=p||x||be(),h=w||u?.t.bind(u);return Kt({children:e,count:s,parent:n,i18nKey:r,context:a,tOptions:i,values:o,defaults:c,components:d,ns:m||h?.ns||v||u?.options?.defaultNS,i18n:u,t:w,shouldUnescape:A,...g})}async function Yt(){const e=await fetch("/api/cliproxy/sync/status");if(!e.ok){let s="Failed to fetch sync status";try{const n=await e.json();s=n.error||n.message||s}catch{}throw new Error(s)}return e.json()}async function Zt(){const e=new AbortController,s=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(s)}}function Gt(){return ve({queryKey:["cliproxy-sync-status"],queryFn:Yt,refetchInterval:3e4,retry:1,staleTime:1e4})}function Jt(){const e=ut();return dt({mutationFn:Zt,onSuccess:s=>{e.invalidateQueries({queryKey:["cliproxy-sync-status"]}),e.invalidateQueries({queryKey:["cliproxy-sync-preview"]}),s.syncedCount===0?se.info("No profiles to sync"):se.success(`Synced ${s.syncedCount} profile${s.syncedCount===1?"":"s"} to CLIProxy`)},onError:s=>{se.error(`Sync failed: ${s.message}`)}})}function fe(e){return e.replace(/-\d+$/,"").split(".").map(Number)}function le(e,s){const n=fe(e),r=fe(s);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 ae(e,s){return le(e,s)>0}function ie(e,s,n){return le(e,s)>=0&&le(e,n)<=0}const oe={"round-robin":{title:"Round Robin",description:"Spread requests across matching accounts for even usage."},"fill-first":{title:"Fill First",description:"Drain one healthy account first and keep backups untouched until needed."}};function he({className:e,compact:s=!1,state:n,isLoading:r,isSaving:a,error:i,onApply:o}){const c=n?.strategy??"round-robin",[d,m]=S.useState(c),[p,w]=S.useState(!1),A=n?.source==="live"?"Live CLIProxy":"Saved startup default",g=r||a||!n||d===c,x=p?"Hide details":"Show details";if(s){const v=u=>{m(u),u!==c&&o(u)};return t.jsxs("div",{className:W("group/routing flex items-center justify-between mt-1 p-1 -mx-1 rounded-lg transition-colors hover:bg-primary/5",e),children:[t.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-foreground",children:[t.jsxs("div",{className:"relative flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-background border border-border/60 text-muted-foreground shadow-sm overflow-hidden transition-all duration-300 group-hover/routing:border-primary/40 group-hover/routing:text-primary group-hover/routing:shadow-[0_0_12px_rgba(59,130,246,0.15)] dark:group-hover/routing:shadow-[0_0_12px_rgba(59,130,246,0.1)]",children:[t.jsx("div",{className:"absolute inset-0 bg-primary/10 translate-y-full group-hover/routing:translate-y-0 transition-transform duration-300 ease-out"}),t.jsx(me,{className:"relative z-10 h-3.5 w-3.5 transition-transform duration-300 group-hover/routing:scale-110"})]}),t.jsx("span",{className:"tracking-tight transition-colors duration-300 group-hover/routing:text-primary group-hover/routing:font-semibold",children:"Routing"}),a&&t.jsx(K,{className:"ml-1 h-3 w-3 shrink-0 animate-spin text-primary"})]}),t.jsxs("div",{className:"relative grid grid-cols-2 p-0.5 gap-0.5 rounded-lg border border-border/60 bg-muted/30 shadow-[inset_0_1px_2px_rgba(0,0,0,0.05)] dark:shadow-[inset_0_1px_3px_rgba(0,0,0,0.2)] transition-colors duration-300 group-hover/routing:border-primary/20 group-hover/routing:bg-primary/5",children:[t.jsx("div",{className:W("absolute inset-y-0.5 left-0.5 w-[calc(50%-0.1875rem)] rounded bg-background shadow-[0_1px_3px_rgba(0,0,0,0.1),0_1px_2px_rgba(0,0,0,0.06)] ring-1 ring-black/5 dark:ring-white/10 transition-all duration-300",d==="fill-first"?"translate-x-[calc(100%+0.125rem)]":"translate-x-0","group-hover/routing:shadow-[0_0_8px_rgba(59,130,246,0.15)] dark:group-hover/routing:shadow-[0_0_8px_rgba(59,130,246,0.1)] group-hover/routing:ring-primary/30"),style:{transitionTimingFunction:"cubic-bezier(0.175, 0.885, 0.32, 1.275)"}}),Object.entries(oe).map(([u,h])=>{const b=d===u;return t.jsx("button",{type:"button",className:W("relative z-10 flex items-center justify-center rounded px-2.5 py-0.5 text-[10px] font-medium whitespace-nowrap transition-colors duration-200",b?"text-foreground group-hover/routing:text-primary":"text-muted-foreground/70 hover:text-foreground/90 group-hover/routing:text-muted-foreground/90"),onClick:()=>v(u),disabled:r||a||!!i,title:h.description,children:h.title},u)})]})]})}return t.jsx("section",{className:W("rounded-xl border border-border/70 bg-background",e),children:t.jsxs("div",{className:"grid gap-3 px-4 py-3 xl:grid-cols-[minmax(0,1fr)_auto] xl:items-start",children:[t.jsxs("div",{className:"min-w-0 space-y-2",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("div",{className:"inline-flex h-7 w-7 items-center justify-center rounded-lg bg-muted text-primary",children:t.jsx(me,{className:"h-4 w-4"})}),t.jsx("div",{className:"text-sm font-medium",children:"Routing strategy"}),t.jsx(H,{variant:"secondary",children:c}),n?t.jsx(H,{variant:"outline",children:A}):null,n?t.jsx(H,{variant:"outline",children:n.target}):null]}),t.jsx("p",{className:"max-w-3xl text-xs leading-5 text-muted-foreground",children:"Proxy-wide account rotation. CCS keeps round-robin as the default until you explicitly change it."})]}),t.jsxs("div",{className:"flex flex-col gap-2 xl:items-end",children:[t.jsx("div",{className:"inline-flex flex-wrap rounded-lg border border-border/70 bg-muted/35 p-1",children:Object.entries(oe).map(([v,u])=>{const h=d===v;return t.jsx("button",{type:"button",className:W("rounded-md px-3 py-1.5 text-sm font-medium transition-colors",h?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),onClick:()=>m(v),disabled:r||a||!!i,children:u.title},v)})}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsxs(Y,{type:"button",variant:"ghost",size:"sm",className:"h-8 px-2 text-xs text-muted-foreground",onClick:()=>w(v=>!v),children:[p?t.jsx(pt,{className:"mr-1 h-3.5 w-3.5"}):t.jsx(xt,{className:"mr-1 h-3.5 w-3.5"}),x]}),t.jsx(Y,{size:"sm",onClick:()=>o(d),disabled:g||!!i,children:a?"Saving...":`Use ${d}`})]})]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-muted-foreground xl:col-span-2",children:[t.jsx("span",{children:"Round robin spreads usage."}),t.jsx("span",{className:"hidden text-border sm:inline",children:"•"}),t.jsx("span",{children:"Fill first keeps backup accounts cold until they are needed."})]}),i?t.jsx("div",{className:"rounded-lg border border-destructive/25 bg-destructive/5 px-3 py-2 text-sm xl:col-span-2",children:i.message}):null,!i&&n?.message?t.jsx("div",{className:"rounded-lg border border-border/70 bg-muted/35 px-3 py-2 text-xs text-muted-foreground xl:col-span-2",children:n.message}):null,p?t.jsx("div",{className:"grid gap-4 border-t border-border/60 pt-3 md:grid-cols-2 xl:col-span-2",children:Object.entries(oe).map(([v,u])=>{const h=c===v;return t.jsxs("div",{className:"space-y-1",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("div",{className:"text-sm font-medium",children:u.title}),h?t.jsx(H,{variant:"secondary",children:"Current"}):null]}),t.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:u.description})]},v)})}):null]})})}function Qt(e){if(!e)return"";const s=new Date(e).getTime(),r=Date.now()-s,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 Xt(e,s){if(!e)return"";const n=Date.now()-e,r=Math.floor(n/(1e3*60)),a=Math.floor(n/(1e3*60*60));return r<1?s("proxyStatusWidget.justNow"):r<60?s("proxyStatusWidget.minutesAgo",{count:r}):s("proxyStatusWidget.hoursAgo",{count:a})}function Z({icon:e,tooltip:s,onClick:n,disabled:r,isPending:a,className:i,variant:o="ghost"}){return t.jsxs(Qe,{children:[t.jsx(Xe,{asChild:!0,children:t.jsx(Y,{variant:o==="destructive-ghost"?"ghost":o,size:"sm",className:W("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?t.jsx(K,{className:"w-3.5 h-3.5 animate-spin"}):t.jsx(e,{className:"w-3.5 h-3.5"})})}),t.jsx(et,{side:"bottom",className:"text-xs",children:s})]})}function os(){const{t:e}=Oe(),{data:s,isLoading:n}=_e(),{data:r}=De(),{data:a,isLoading:i}=Ie(),{data:o,isLoading:c,error:d}=Re(),m=Fe(),p=Le(),w=Ue(),A=ze(),g=qe(),{data:x}=Gt(),{mutate:v,isPending:u}=Jt(),[h,b]=S.useState(!1),[C,k]=S.useState(""),[E,$]=S.useState(!1),[f,l]=S.useState(null),[V,T]=S.useState(null),{data:P}=ve({queryKey:["cliproxy-server-config"],queryFn:()=>tt.cliproxyServer.get(),staleTime:3e4}),O=mt({mutationKey:["update-backend"]})>0,j=P?.remote,_=j?.enabled&&j?.host,D=s?.running??!1,R=p.isPending||w.isPending||A.isPending||g.isPending||O||u,q=r?.hasUpdate??!1,y=r?.isStable===!1,F=r?.currentVersion,M=x?.configured??!1,Ce=e(M?"proxyStatusWidget.syncReady":"proxyStatusWidget.noConfig"),Q=y?r?.maxStableVersion||a?.latestStable:r?.latestVersion,ce=a?.maxStableVersion||r?.maxStableVersion||"6.6.80",B=a?.faultyRange,ke=B&&`${B.min.replace(/-\d+$/,"")}-${B.max.replace(/-\d+$/,"")}`,X=(N,I)=>{l(N),T(I),$(!0)},ue=async N=>{if(!N)return;const I=ae(N,ce);if(B!==void 0&&ie(N,B.min,B.max)){X(N,"faulty");return}if(I){X(N,"experimental");return}try{const de=await g.mutateAsync({version:N});de.requiresConfirmation&&X(N,de.isFaulty?"faulty":"experimental")}catch{}},Ae=()=>{f&&g.mutate({version:f,force:!0}),$(!1),l(null),T(null)},Ee=()=>{$(!1),l(null),T(null)},Te=_?(()=>{const N=j.protocol||"http",I=j.port||(N==="https"?443:80);return N==="https"&&I===443||N==="http"&&I===80?j.host:`${j.host}:${I}`})():null;return _?t.jsxs("div",{className:W("rounded-lg border p-3 transition-colors","border-blue-500/30 bg-blue-500/5"),children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(gt,{className:"w-4 h-4 text-blue-500"}),t.jsx("span",{className:"text-sm font-medium",children:e("proxyStatusWidget.remoteProxy")}),t.jsx(H,{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")})]}),t.jsx(ft,{className:"w-3 h-3 text-blue-600"})]}),t.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:[t.jsx("div",{className:"flex items-center gap-1 mb-1",children:t.jsx("span",{className:"font-mono",children:Te})}),t.jsx("p",{className:"text-[10px] text-muted-foreground/70 leading-tight",children:e("proxyStatusWidget.trafficAutoRouted")})]}),t.jsx(he,{compact:!0,className:"mt-3",state:o,isLoading:c,isSaving:m.isPending,error:d instanceof Error?d:null,onApply:N=>m.mutate(N)},`remote:${o?.strategy??"round-robin"}`)]}):t.jsx(Me,{delayDuration:300,children:t.jsxs("div",{className:W("rounded-lg border p-3 transition-colors",D?"border-green-500/30 bg-green-500/5":"border-muted bg-muted/30"),children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:W("w-2 h-2 rounded-full",D?"bg-green-500 animate-pulse":"bg-muted-foreground/30")}),t.jsx("span",{className:"text-sm font-medium",children:r?.backendLabel??"CLIProxy"})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[n?t.jsx(K,{className:"w-3 h-3 animate-spin text-muted-foreground"}):D?t.jsxs(t.Fragment,{children:[t.jsx(Z,{icon:u?K:ht,tooltip:e("proxyStatusWidget.tooltipSync"),onClick:()=>v(),disabled:!M||R,isPending:u}),t.jsx(Z,{icon:yt,tooltip:e("proxyStatusWidget.tooltipRestart"),onClick:()=>A.mutate(),disabled:R,isPending:A.isPending}),t.jsx(Z,{icon:bt,tooltip:e("proxyStatusWidget.tooltipStop"),onClick:()=>w.mutate(),disabled:R,isPending:w.isPending,variant:"destructive-ghost"})]}):null,t.jsx(Z,{icon:h?jt:vt,tooltip:e(h?"proxyStatusWidget.tooltipClose":"proxyStatusWidget.tooltipVersionSettings"),onClick:()=>b(!h),className:h?"bg-muted":void 0})]})]}),F&&t.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[t.jsxs("span",{className:W("text-xs font-mono text-muted-foreground",y&&"text-amber-600 dark:text-amber-400"),children:["v",F]}),(q||y)&&Q&&t.jsxs(H,{variant:"secondary",className:W("text-[10px] h-4 px-1.5 gap-0.5 cursor-pointer transition-colors",y?"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 ue(Q),title:e(y?"proxyStatusWidget.clickToDowngrade":"proxyStatusWidget.clickToUpdate"),children:[y?t.jsx(Nt,{className:"w-2.5 h-2.5"}):t.jsx(St,{className:"w-2.5 h-2.5"}),Q]})]}),D&&s&&t.jsxs("div",{className:"mt-2 flex items-center gap-4 text-xs text-muted-foreground",children:[t.jsx("span",{className:"flex items-center gap-1",children:e("proxyStatusWidget.port",{port:s.port})}),s.sessionCount!==void 0&&s.sessionCount>0&&t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(wt,{className:"w-3 h-3"}),e("proxyStatusWidget.sessionCount",{count:s.sessionCount})]}),s.startedAt&&t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(Ct,{className:"w-3 h-3"}),Qt(s.startedAt)]})]}),t.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-xs",children:[M?t.jsx(kt,{className:"w-3 h-3 text-green-600 dark:text-green-400"}):t.jsx(At,{className:"w-3 h-3 text-muted-foreground"}),t.jsx("span",{className:W("text-xs",M?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:Ce})]}),t.jsx(he,{compact:!0,className:"mt-3",state:o,isLoading:c,isSaving:m.isPending,error:d instanceof Error?d:null,onApply:N=>m.mutate(N)},`local:${o?.strategy??"round-robin"}`),t.jsx(Be,{open:h,onOpenChange:b,children:t.jsxs(He,{className:"mt-3 pt-3 border-t border-muted",children:[t.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-3",children:e("proxyStatusWidget.versionManagement")}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs(Ke,{value:C,onValueChange:k,disabled:i,children:[t.jsx(Ye,{className:"h-8 text-xs flex-1",children:t.jsx(Ze,{placeholder:e("proxyStatusWidget.selectVersionPlaceholder")})}),t.jsx(Ge,{children:a?.versions.slice(0,20).map(N=>{const I=a?.maxStableVersion&&ae(N,a.maxStableVersion),ee=a?.faultyRange&&ie(N,a.faultyRange.min,a.faultyRange.max);return t.jsx(Je,{value:N,className:"text-xs",children:t.jsxs("span",{className:"flex items-center gap-2",children:["v",N,N===a.latestStable&&t.jsx("span",{className:"text-green-600 dark:text-green-400",children:e("proxyStatusWidget.stable")}),(ee||I)&&t.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:"⚠"})]})},N)})})]}),t.jsxs(Y,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1.5 px-3",onClick:()=>void ue(C),disabled:g.isPending||!C,children:[g.isPending?t.jsx(K,{className:"w-3.5 h-3.5 animate-spin"}):t.jsx(Et,{className:"w-3.5 h-3.5"}),e("proxyStatusWidget.install")]})]}),C&&a?.maxStableVersion&&ae(C,a.maxStableVersion)&&t.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-amber-600 dark:text-amber-400",children:[t.jsx(ne,{className:"w-3.5 h-3.5 flex-shrink-0"}),t.jsx("span",{children:e("proxyStatusWidget.versionsAboveUnstable",{version:a.maxStableVersion})})]}),C&&a?.faultyRange&&ie(C,a.faultyRange.min,a.faultyRange.max)&&t.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-amber-600 dark:text-amber-400",children:[t.jsx(ne,{className:"w-3.5 h-3.5 flex-shrink-0"}),t.jsx("span",{children:e("proxyStatusWidget.versionsKnownIssues",{version:C})})]}),r?.checkedAt&&t.jsx("div",{className:"mt-2 text-[10px] text-muted-foreground/60",children:e("proxyStatusWidget.lastChecked",{time:Xt(r.checkedAt,e)})})]})}),!D&&t.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:e("proxyStatusWidget.notRunning")}),t.jsxs(Y,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>p.mutate(),disabled:p.isPending,children:[p.isPending?t.jsx(K,{className:"w-3 h-3 animate-spin"}):t.jsx(Tt,{className:"w-3 h-3"}),e("proxyStatusWidget.start")]})]}),t.jsx(st,{open:E,onOpenChange:$,children:t.jsxs(nt,{children:[t.jsxs(rt,{children:[t.jsxs(at,{className:"flex items-center gap-2",children:[t.jsx(ne,{className:"w-5 h-5 text-amber-500"}),e(V==="faulty"?"proxyStatusWidget.installFaultyTitle":"proxyStatusWidget.installUnstableTitle")]}),t.jsxs(it,{className:"space-y-2",children:[V==="faulty"?t.jsx("p",{children:t.jsx(ge,{i18nKey:"proxyStatusWidget.installFaultyDesc",values:{version:f??"",range:ke||""},components:{strong:t.jsx("strong",{})}})}):t.jsx("p",{children:t.jsx(ge,{i18nKey:"proxyStatusWidget.installUnstableDesc",values:{version:f??"",maxStable:ce},components:{strong:t.jsx("strong",{})}})}),t.jsx("p",{className:"text-amber-600 dark:text-amber-400",children:e(V==="faulty"?"proxyStatusWidget.installFaultyWarning":"proxyStatusWidget.installUnstableWarning")}),t.jsx("p",{children:e("proxyStatusWidget.installUnstableConfirm")})]})]}),t.jsxs(ot,{children:[t.jsx(lt,{onClick:Ee,children:e("proxyStatusWidget.cancel")}),t.jsx(ct,{onClick:Ae,className:"bg-amber-500 hover:bg-amber-600 text-white",children:e("proxyStatusWidget.installAnyway")})]})]})})]})})}export{os as P};
|
|
1
|
+
import{j as t}from"./radix-ui-Zb8sVEtn.js";import{g as Ve,r as S}from"./react-vendor-CNOkPC89.js";import{bu as ye,bv as be,bw as je,bx as Pe,by as z,bz as te,bA as L,bB as $e,bC as We,c as W,B as H,d as Y,a as Oe,bt as _e,aW as De,bD as Ie,bE as Re,bF as Fe,bG as Le,bH as Ue,bI as ze,bJ as qe,aJ as Me,M as Be,O as He,r as Ke,s as Ye,t as Ze,v as Ge,w as Je,T as Qe,p as Xe,q as et,Y as tt}from"./index-Cp06bK_W.js";import{A as st,a as nt,b as rt,c as at,d as it,e as ot,f as lt,g as ct}from"./alert-dialog-CQmQZ1y3.js";import{u as ve,a as ut,b as dt,h as mt}from"./tanstack-CrmUhA7Z.js";import{t as se}from"./notifications-B2HqRBj7.js";import{bc as me,R as K,t as pt,s as xt,u as gt,A as ft,bd as ht,be as yt,bf as bt,X as jt,e as vt,bg as Nt,bh as St,U as wt,v as Ct,m as kt,w as At,aB as Et,T as ne,aL as Tt}from"./icons-DfENUzBo.js";var re,pe;function Vt(){return pe||(pe=1,re={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}),re}var Pt=Vt();const $t=Ve(Pt);var Wt=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function xe(e){var s={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},n=e.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(s.name=n[1],($t[n[1]]||e.charAt(e.length-2)==="/")&&(s.voidElement=!0),s.name.startsWith("!--"))){var r=e.indexOf("-->");return{type:"comment",comment:r!==-1?e.slice(4,r):""}}for(var a=new RegExp(Wt),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("=")),s.attrs[c[0]]=c[1],a.lastIndex--}else i[2]&&(s.attrs[i[2]]=i[3].trim().substring(1,i[3].length-1));return s}var Ot=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,_t=/^\s*$/,Dt=Object.create(null);function Ne(e,s){switch(s.type){case"text":return e+s.content;case"tag":return e+="<"+s.name+(s.attrs?(function(n){var r=[];for(var a in n)r.push(a+'="'+n[a]+'"');return r.length?" "+r.join(" "):""})(s.attrs):"")+(s.voidElement?"/>":">"),s.voidElement?e:e+s.children.reduce(Ne,"")+"</"+s.name+">";case"comment":return e+"<!--"+s.comment+"-->"}}var It={parse:function(e,s){s||(s={}),s.components||(s.components=Dt);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(Ot,function(d,m){if(o){if(d!=="</"+n.name+">")return;o=!1}var p,w=d.charAt(1)!=="/",A=d.startsWith("<!--"),g=m+d.length,x=e.charAt(g);if(A){var v=xe(d);return i<0?(r.push(v),r):((p=a[i]).children.push(v),r)}if(w&&(i++,(n=xe(d)).type==="tag"&&s.components[n.name]&&(n.type="component",o=!0),n.voidElement||o||!x||x==="<"||n.children.push({type:"text",content:e.slice(g,e.indexOf("<",g))}),i===0&&r.push(n),(p=a[i-1])&&p.children.push(n),a[i]=n),(!w||n.voidElement)&&(i>-1&&(n.voidElement||n.name===d.slice(2,-1))&&(i--,n=i===-1?r:a[i]),!o&&x!=="<"&&x)){p=i===-1?r:a[i].children;var u=e.indexOf("<",g),h=e.slice(g,u===-1?void 0:u);_t.test(h)&&(h=" "),(u>-1&&i+p.length>=0||h!==" ")&&p.push({type:"text",content:h})}}),r},stringify:function(e){return e.reduce(function(s,n){return s+Ne("",n)},"")}};const G=(e,s)=>{if(!e)return!1;const n=e.props?.children??e.children;return s?n.length>0:!!n},J=e=>{if(!e)return[];const s=e.props?.children??e.children;return e.props?.i18nIsDynamicList?U(s):s},Rt=e=>Array.isArray(e)&&e.every(S.isValidElement),U=e=>Array.isArray(e)?e:[e],Ft=(e,s)=>{const n={...s};return n.props={...s.props,...e.props},n},Lt=e=>{const s={};if(!e)return s;const n=r=>{U(r).forEach(i=>{z(i)||(G(i)?n(J(i)):L(i)&&!S.isValidElement(i)&&Object.assign(s,i))})};return n(e),s},Se=(e,s,n,r)=>{if(!e)return"";let a="";const i=U(e),o=s?.transSupportBasicHtmlNodes?s.transKeepBasicHtmlNodesFor??[]:[];return i.forEach((c,d)=>{if(z(c)){a+=`${c}`;return}if(S.isValidElement(c)){const{props:m,type:p}=c,w=Object.keys(m).length,A=o.indexOf(p)>-1,g=m.children;if(!g&&A&&!w){a+=`<${p}/>`;return}if(!g&&(!A||w)||m.i18nIsDynamicList){a+=`<${d}></${d}>`;return}if(A&&w===1&&z(g)){a+=`<${p}>${g}</${p}>`;return}const x=Se(g,s,n,r);a+=`<${d}>${x}</${d}>`;return}if(c===null){te(n,"TRANS_NULL_VALUE","Passed in a null value as child",{i18nKey:r});return}if(L(c)){const{format:m,...p}=c,w=Object.keys(p);if(w.length===1){const A=m?`${w[0]}, ${m}`:w[0];a+=`{{${A}}}`;return}te(n,"TRANS_INVALID_OBJ","Invalid child - Object should only have keys {{ value, format }} (format is optional).",{i18nKey:r,child:c});return}te(n,"TRANS_INVALID_VAR","Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.",{i18nKey:r,child:c})}),a},Ut=(e,s=[],n={})=>{if(!e)return e;const r=Object.keys(n),a=[...s,...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 m=d[1];(/^\d+$/.test(m)||a.includes(m))&&(c=!0,i+=d[0],o+=d[0].length)}if(!c){const m=e.slice(o).match(/^<(\d+|[a-zA-Z][a-zA-Z0-9_-]*)(\s+[\w-]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?)*\s*(\/)?>/);if(m){const p=m[1];(/^\d+$/.test(p)||a.includes(p))&&(c=!0,i+=m[0],o+=m[0].length)}}c||(i+="<",o+=1)}else i+=e[o],o+=1;return i},zt=(e,s,n,r,a,i,o)=>{if(n==="")return[];const c=a.transKeepBasicHtmlNodesFor||[],d=n&&new RegExp(c.map(b=>`<${b}`).join("|")).test(n);if(!e&&!s&&!d&&!o)return[n];const m=s??{},p=b=>{U(b).forEach(k=>{z(k)||(G(k)?p(J(k)):L(k)&&!S.isValidElement(k)&&Object.assign(m,k))})};p(e);const w=Ut(n,c,m),A=It.parse(`<0>${w}</0>`),g={...m,...i},x=(b,C,k)=>{const E=J(b),$=u(E,C.children,k);return Rt(E)&&$.length===0||b.props?.i18nIsDynamicList?E:$},v=(b,C,k,E,$)=>{b.dummy?(b.children=C,k.push(S.cloneElement(b,{key:E},$?void 0:C))):k.push(...S.Children.map([b],f=>{const l="data-i18n-is-dynamic-list",V={key:E,[l]:void 0};return f&&f.props&&Object.keys(f.props).forEach(T=>{T==="ref"||T==="children"||T==="i18nIsDynamicList"||T===l||(V[T]=f.props[T])}),S.cloneElement(f,V,$?null:C)}))},u=(b,C,k)=>{const E=U(b);return U(C).reduce((f,l,V)=>{const T=l.children?.[0]?.content&&r.services.interpolator.interpolate(l.children[0].content,g,r.language);if(l.type==="tag"){let P=E[parseInt(l.name,10)];!P&&s&&(P=s[l.name]),k.length===1&&!P&&(P=k[0][l.name]),P||(P={});const O={...l.attrs};o&&Object.keys(O).forEach(y=>{const F=O[y];z(F)&&(O[y]=$e(F))});const j=Object.keys(O).length!==0?Ft({props:O},P):P,_=S.isValidElement(j),D=_&&G(l,!0)&&!l.voidElement,R=d&&L(j)&&j.dummy&&!_,q=L(s)&&Object.hasOwnProperty.call(s,l.name);if(z(j)){const y=r.services.interpolator.interpolate(j,g,r.language);f.push(y)}else if(G(j)||D){const y=x(j,l,k);v(j,y,f,V)}else if(R){const y=u(E,l.children,k);v(j,y,f,V)}else if(Number.isNaN(parseFloat(l.name)))if(q){const y=x(j,l,k);v(j,y,f,V,l.voidElement)}else if(a.transSupportBasicHtmlNodes&&c.indexOf(l.name)>-1)if(l.voidElement)f.push(S.createElement(l.name,{key:`${l.name}-${V}`}));else{const y=u(E,l.children,k);f.push(S.createElement(l.name,{key:`${l.name}-${V}`},y))}else if(l.voidElement)f.push(`<${l.name} />`);else{const y=u(E,l.children,k);f.push(`<${l.name}>${y}</${l.name}>`)}else if(L(j)&&!_){const y=l.children[0]?T:null;y&&f.push(y)}else v(j,T,f,V,l.children.length!==1||!T)}else if(l.type==="text"){const P=a.transWrapTextNodes,O=typeof a.unescape=="function"?a.unescape:je().unescape,j=o?O(r.services.interpolator.interpolate(l.content,g,r.language)):r.services.interpolator.interpolate(l.content,g,r.language);P?f.push(S.createElement(P,{key:`${l.name}-${V}`},j)):f.push(j)}return f},[])},h=u([{dummy:!0,children:e||[]}],A,U(e||[]));return J(h[0])},we=(e,s,n)=>{const r=e.key||s,a=S.cloneElement(e,{key:r});if(!a.props||!a.props.children||n.indexOf(`${s}/>`)<0&&n.indexOf(`${s} />`)<0)return a;function i(){return S.createElement(S.Fragment,null,a)}return S.createElement(i,{key:r})},qt=(e,s)=>e.map((n,r)=>we(n,r,s)),Mt=(e,s)=>{const n={};return Object.keys(e).forEach(r=>{Object.assign(n,{[r]:we(e[r],r,s)})}),n},Bt=(e,s,n,r)=>e?Array.isArray(e)?qt(e,s):L(e)?Mt(e,s):(ye(n,"TRANS_INVALID_COMPONENTS",'<Trans /> "components" prop expects an object or array',{i18nKey:r}),null):null,Ht=e=>!L(e)||Array.isArray(e)?!1:Object.keys(e).reduce((s,n)=>s&&Number.isNaN(Number.parseFloat(n)),!0);function Kt({children:e,count:s,parent:n,i18nKey:r,context:a,tOptions:i={},values:o,defaults:c,components:d,ns:m,i18n:p,t:w,shouldUnescape:A,...g}){const x=p||be();if(!x)return ye(x,"NO_I18NEXT_INSTANCE","Trans: You need to pass in an i18next instance using i18nextReactModule",{i18nKey:r}),e;const v=w||x.t.bind(x)||(M=>M),u={...je(),...x.options?.react};let h=m||v.ns||x.options?.defaultNS;h=z(h)?[h]:h||["translation"];const{transDefaultProps:b}=u,C=b?.tOptions?{...b.tOptions,...i}:i,k=A??b?.shouldUnescape,E=b?.values?{...b.values,...o}:o,$=b?.components?{...b.components,...d}:d,f=Se(e,u,x,r),l=c||C?.defaultValue||f||u.transEmptyNodeValue||(typeof r=="function"?Pe(r):r),{hashTransKey:V}=u,T=r||(V?V(f||l):f||l);x.options?.interpolation?.defaultVariables?o=E&&Object.keys(E).length>0?{...E,...x.options.interpolation.defaultVariables}:{...x.options.interpolation.defaultVariables}:o=E;const P=Lt(e);P&&typeof P.count=="number"&&s===void 0&&(s=P.count);const O=o||s!==void 0&&!x.options?.interpolation?.alwaysFormat||!e?C.interpolation:{interpolation:{...C.interpolation,prefix:"#$?",suffix:"?$#"}},j={...C,context:a||C.context,count:s,...o,...O,defaultValue:l,ns:h};let _=T?v(T,j):l;_===T&&l&&(_=l);const D=Bt($,_,x,r);let R=D||e,q=null;Ht(D)&&(q=D,R=e);const y=zt(R,q,_,x,u,j,k),F=n??u.defaultTransParent;return F?S.createElement(F,g,y):y}function ge({children:e,count:s,parent:n,i18nKey:r,context:a,tOptions:i={},values:o,defaults:c,components:d,ns:m,i18n:p,t:w,shouldUnescape:A,...g}){const{i18n:x,defaultNS:v}=S.useContext(We)||{},u=p||x||be(),h=w||u?.t.bind(u);return Kt({children:e,count:s,parent:n,i18nKey:r,context:a,tOptions:i,values:o,defaults:c,components:d,ns:m||h?.ns||v||u?.options?.defaultNS,i18n:u,t:w,shouldUnescape:A,...g})}async function Yt(){const e=await fetch("/api/cliproxy/sync/status");if(!e.ok){let s="Failed to fetch sync status";try{const n=await e.json();s=n.error||n.message||s}catch{}throw new Error(s)}return e.json()}async function Zt(){const e=new AbortController,s=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(s)}}function Gt(){return ve({queryKey:["cliproxy-sync-status"],queryFn:Yt,refetchInterval:3e4,retry:1,staleTime:1e4})}function Jt(){const e=ut();return dt({mutationFn:Zt,onSuccess:s=>{e.invalidateQueries({queryKey:["cliproxy-sync-status"]}),e.invalidateQueries({queryKey:["cliproxy-sync-preview"]}),s.syncedCount===0?se.info("No profiles to sync"):se.success(`Synced ${s.syncedCount} profile${s.syncedCount===1?"":"s"} to CLIProxy`)},onError:s=>{se.error(`Sync failed: ${s.message}`)}})}function fe(e){return e.replace(/-\d+$/,"").split(".").map(Number)}function le(e,s){const n=fe(e),r=fe(s);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 ae(e,s){return le(e,s)>0}function ie(e,s,n){return le(e,s)>=0&&le(e,n)<=0}const oe={"round-robin":{title:"Round Robin",description:"Spread requests across matching accounts for even usage."},"fill-first":{title:"Fill First",description:"Drain one healthy account first and keep backups untouched until needed."}};function he({className:e,compact:s=!1,state:n,isLoading:r,isSaving:a,error:i,onApply:o}){const c=n?.strategy??"round-robin",[d,m]=S.useState(c),[p,w]=S.useState(!1),A=n?.source==="live"?"Live CLIProxy":"Saved startup default",g=r||a||!n||d===c,x=p?"Hide details":"Show details";if(s){const v=u=>{m(u),u!==c&&o(u)};return t.jsxs("div",{className:W("group/routing flex items-center justify-between mt-1 p-1 -mx-1 rounded-lg transition-colors hover:bg-primary/5",e),children:[t.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-foreground",children:[t.jsxs("div",{className:"relative flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-background border border-border/60 text-muted-foreground shadow-sm overflow-hidden transition-all duration-300 group-hover/routing:border-primary/40 group-hover/routing:text-primary group-hover/routing:shadow-[0_0_12px_rgba(59,130,246,0.15)] dark:group-hover/routing:shadow-[0_0_12px_rgba(59,130,246,0.1)]",children:[t.jsx("div",{className:"absolute inset-0 bg-primary/10 translate-y-full group-hover/routing:translate-y-0 transition-transform duration-300 ease-out"}),t.jsx(me,{className:"relative z-10 h-3.5 w-3.5 transition-transform duration-300 group-hover/routing:scale-110"})]}),t.jsx("span",{className:"tracking-tight transition-colors duration-300 group-hover/routing:text-primary group-hover/routing:font-semibold",children:"Routing"}),a&&t.jsx(K,{className:"ml-1 h-3 w-3 shrink-0 animate-spin text-primary"})]}),t.jsxs("div",{className:"relative grid grid-cols-2 p-0.5 gap-0.5 rounded-lg border border-border/60 bg-muted/30 shadow-[inset_0_1px_2px_rgba(0,0,0,0.05)] dark:shadow-[inset_0_1px_3px_rgba(0,0,0,0.2)] transition-colors duration-300 group-hover/routing:border-primary/20 group-hover/routing:bg-primary/5",children:[t.jsx("div",{className:W("absolute inset-y-0.5 left-0.5 w-[calc(50%-0.1875rem)] rounded bg-background shadow-[0_1px_3px_rgba(0,0,0,0.1),0_1px_2px_rgba(0,0,0,0.06)] ring-1 ring-black/5 dark:ring-white/10 transition-all duration-300",d==="fill-first"?"translate-x-[calc(100%+0.125rem)]":"translate-x-0","group-hover/routing:shadow-[0_0_8px_rgba(59,130,246,0.15)] dark:group-hover/routing:shadow-[0_0_8px_rgba(59,130,246,0.1)] group-hover/routing:ring-primary/30"),style:{transitionTimingFunction:"cubic-bezier(0.175, 0.885, 0.32, 1.275)"}}),Object.entries(oe).map(([u,h])=>{const b=d===u;return t.jsx("button",{type:"button",className:W("relative z-10 flex items-center justify-center rounded px-2.5 py-0.5 text-[10px] font-medium whitespace-nowrap transition-colors duration-200",b?"text-foreground group-hover/routing:text-primary":"text-muted-foreground/70 hover:text-foreground/90 group-hover/routing:text-muted-foreground/90"),onClick:()=>v(u),disabled:r||a||!!i,title:h.description,children:h.title},u)})]})]})}return t.jsx("section",{className:W("rounded-xl border border-border/70 bg-background",e),children:t.jsxs("div",{className:"grid gap-3 px-4 py-3 xl:grid-cols-[minmax(0,1fr)_auto] xl:items-start",children:[t.jsxs("div",{className:"min-w-0 space-y-2",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("div",{className:"inline-flex h-7 w-7 items-center justify-center rounded-lg bg-muted text-primary",children:t.jsx(me,{className:"h-4 w-4"})}),t.jsx("div",{className:"text-sm font-medium",children:"Routing strategy"}),t.jsx(H,{variant:"secondary",children:c}),n?t.jsx(H,{variant:"outline",children:A}):null,n?t.jsx(H,{variant:"outline",children:n.target}):null]}),t.jsx("p",{className:"max-w-3xl text-xs leading-5 text-muted-foreground",children:"Proxy-wide account rotation. CCS keeps round-robin as the default until you explicitly change it."})]}),t.jsxs("div",{className:"flex flex-col gap-2 xl:items-end",children:[t.jsx("div",{className:"inline-flex flex-wrap rounded-lg border border-border/70 bg-muted/35 p-1",children:Object.entries(oe).map(([v,u])=>{const h=d===v;return t.jsx("button",{type:"button",className:W("rounded-md px-3 py-1.5 text-sm font-medium transition-colors",h?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),onClick:()=>m(v),disabled:r||a||!!i,children:u.title},v)})}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsxs(Y,{type:"button",variant:"ghost",size:"sm",className:"h-8 px-2 text-xs text-muted-foreground",onClick:()=>w(v=>!v),children:[p?t.jsx(pt,{className:"mr-1 h-3.5 w-3.5"}):t.jsx(xt,{className:"mr-1 h-3.5 w-3.5"}),x]}),t.jsx(Y,{size:"sm",onClick:()=>o(d),disabled:g||!!i,children:a?"Saving...":`Use ${d}`})]})]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-muted-foreground xl:col-span-2",children:[t.jsx("span",{children:"Round robin spreads usage."}),t.jsx("span",{className:"hidden text-border sm:inline",children:"•"}),t.jsx("span",{children:"Fill first keeps backup accounts cold until they are needed."})]}),i?t.jsx("div",{className:"rounded-lg border border-destructive/25 bg-destructive/5 px-3 py-2 text-sm xl:col-span-2",children:i.message}):null,!i&&n?.message?t.jsx("div",{className:"rounded-lg border border-border/70 bg-muted/35 px-3 py-2 text-xs text-muted-foreground xl:col-span-2",children:n.message}):null,p?t.jsx("div",{className:"grid gap-4 border-t border-border/60 pt-3 md:grid-cols-2 xl:col-span-2",children:Object.entries(oe).map(([v,u])=>{const h=c===v;return t.jsxs("div",{className:"space-y-1",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("div",{className:"text-sm font-medium",children:u.title}),h?t.jsx(H,{variant:"secondary",children:"Current"}):null]}),t.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:u.description})]},v)})}):null]})})}function Qt(e){if(!e)return"";const s=new Date(e).getTime(),r=Date.now()-s,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 Xt(e,s){if(!e)return"";const n=Date.now()-e,r=Math.floor(n/(1e3*60)),a=Math.floor(n/(1e3*60*60));return r<1?s("proxyStatusWidget.justNow"):r<60?s("proxyStatusWidget.minutesAgo",{count:r}):s("proxyStatusWidget.hoursAgo",{count:a})}function Z({icon:e,tooltip:s,onClick:n,disabled:r,isPending:a,className:i,variant:o="ghost"}){return t.jsxs(Qe,{children:[t.jsx(Xe,{asChild:!0,children:t.jsx(Y,{variant:o==="destructive-ghost"?"ghost":o,size:"sm",className:W("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?t.jsx(K,{className:"w-3.5 h-3.5 animate-spin"}):t.jsx(e,{className:"w-3.5 h-3.5"})})}),t.jsx(et,{side:"bottom",className:"text-xs",children:s})]})}function os(){const{t:e}=Oe(),{data:s,isLoading:n}=_e(),{data:r}=De(),{data:a,isLoading:i}=Ie(),{data:o,isLoading:c,error:d}=Re(),m=Fe(),p=Le(),w=Ue(),A=ze(),g=qe(),{data:x}=Gt(),{mutate:v,isPending:u}=Jt(),[h,b]=S.useState(!1),[C,k]=S.useState(""),[E,$]=S.useState(!1),[f,l]=S.useState(null),[V,T]=S.useState(null),{data:P}=ve({queryKey:["cliproxy-server-config"],queryFn:()=>tt.cliproxyServer.get(),staleTime:3e4}),O=mt({mutationKey:["update-backend"]})>0,j=P?.remote,_=j?.enabled&&j?.host,D=s?.running??!1,R=p.isPending||w.isPending||A.isPending||g.isPending||O||u,q=r?.hasUpdate??!1,y=r?.isStable===!1,F=r?.currentVersion,M=x?.configured??!1,Ce=e(M?"proxyStatusWidget.syncReady":"proxyStatusWidget.noConfig"),Q=y?r?.maxStableVersion||a?.latestStable:r?.latestVersion,ce=a?.maxStableVersion||r?.maxStableVersion||"6.6.80",B=a?.faultyRange,ke=B&&`${B.min.replace(/-\d+$/,"")}-${B.max.replace(/-\d+$/,"")}`,X=(N,I)=>{l(N),T(I),$(!0)},ue=async N=>{if(!N)return;const I=ae(N,ce);if(B!==void 0&&ie(N,B.min,B.max)){X(N,"faulty");return}if(I){X(N,"experimental");return}try{const de=await g.mutateAsync({version:N});de.requiresConfirmation&&X(N,de.isFaulty?"faulty":"experimental")}catch{}},Ae=()=>{f&&g.mutate({version:f,force:!0}),$(!1),l(null),T(null)},Ee=()=>{$(!1),l(null),T(null)},Te=_?(()=>{const N=j.protocol||"http",I=j.port||(N==="https"?443:80);return N==="https"&&I===443||N==="http"&&I===80?j.host:`${j.host}:${I}`})():null;return _?t.jsxs("div",{className:W("rounded-lg border p-3 transition-colors","border-blue-500/30 bg-blue-500/5"),children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(gt,{className:"w-4 h-4 text-blue-500"}),t.jsx("span",{className:"text-sm font-medium",children:e("proxyStatusWidget.remoteProxy")}),t.jsx(H,{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")})]}),t.jsx(ft,{className:"w-3 h-3 text-blue-600"})]}),t.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:[t.jsx("div",{className:"flex items-center gap-1 mb-1",children:t.jsx("span",{className:"font-mono",children:Te})}),t.jsx("p",{className:"text-[10px] text-muted-foreground/70 leading-tight",children:e("proxyStatusWidget.trafficAutoRouted")})]}),t.jsx(he,{compact:!0,className:"mt-3",state:o,isLoading:c,isSaving:m.isPending,error:d instanceof Error?d:null,onApply:N=>m.mutate(N)},`remote:${o?.strategy??"round-robin"}`)]}):t.jsx(Me,{delayDuration:300,children:t.jsxs("div",{className:W("rounded-lg border p-3 transition-colors",D?"border-green-500/30 bg-green-500/5":"border-muted bg-muted/30"),children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:W("w-2 h-2 rounded-full",D?"bg-green-500 animate-pulse":"bg-muted-foreground/30")}),t.jsx("span",{className:"text-sm font-medium",children:r?.backendLabel??"CLIProxy"})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[n?t.jsx(K,{className:"w-3 h-3 animate-spin text-muted-foreground"}):D?t.jsxs(t.Fragment,{children:[t.jsx(Z,{icon:u?K:ht,tooltip:e("proxyStatusWidget.tooltipSync"),onClick:()=>v(),disabled:!M||R,isPending:u}),t.jsx(Z,{icon:yt,tooltip:e("proxyStatusWidget.tooltipRestart"),onClick:()=>A.mutate(),disabled:R,isPending:A.isPending}),t.jsx(Z,{icon:bt,tooltip:e("proxyStatusWidget.tooltipStop"),onClick:()=>w.mutate(),disabled:R,isPending:w.isPending,variant:"destructive-ghost"})]}):null,t.jsx(Z,{icon:h?jt:vt,tooltip:e(h?"proxyStatusWidget.tooltipClose":"proxyStatusWidget.tooltipVersionSettings"),onClick:()=>b(!h),className:h?"bg-muted":void 0})]})]}),F&&t.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[t.jsxs("span",{className:W("text-xs font-mono text-muted-foreground",y&&"text-amber-600 dark:text-amber-400"),children:["v",F]}),(q||y)&&Q&&t.jsxs(H,{variant:"secondary",className:W("text-[10px] h-4 px-1.5 gap-0.5 cursor-pointer transition-colors",y?"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 ue(Q),title:e(y?"proxyStatusWidget.clickToDowngrade":"proxyStatusWidget.clickToUpdate"),children:[y?t.jsx(Nt,{className:"w-2.5 h-2.5"}):t.jsx(St,{className:"w-2.5 h-2.5"}),Q]})]}),D&&s&&t.jsxs("div",{className:"mt-2 flex items-center gap-4 text-xs text-muted-foreground",children:[t.jsx("span",{className:"flex items-center gap-1",children:e("proxyStatusWidget.port",{port:s.port})}),s.sessionCount!==void 0&&s.sessionCount>0&&t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(wt,{className:"w-3 h-3"}),e("proxyStatusWidget.sessionCount",{count:s.sessionCount})]}),s.startedAt&&t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(Ct,{className:"w-3 h-3"}),Qt(s.startedAt)]})]}),t.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-xs",children:[M?t.jsx(kt,{className:"w-3 h-3 text-green-600 dark:text-green-400"}):t.jsx(At,{className:"w-3 h-3 text-muted-foreground"}),t.jsx("span",{className:W("text-xs",M?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:Ce})]}),t.jsx(he,{compact:!0,className:"mt-3",state:o,isLoading:c,isSaving:m.isPending,error:d instanceof Error?d:null,onApply:N=>m.mutate(N)},`local:${o?.strategy??"round-robin"}`),t.jsx(Be,{open:h,onOpenChange:b,children:t.jsxs(He,{className:"mt-3 pt-3 border-t border-muted",children:[t.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-3",children:e("proxyStatusWidget.versionManagement")}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs(Ke,{value:C,onValueChange:k,disabled:i,children:[t.jsx(Ye,{className:"h-8 text-xs flex-1",children:t.jsx(Ze,{placeholder:e("proxyStatusWidget.selectVersionPlaceholder")})}),t.jsx(Ge,{children:a?.versions.slice(0,20).map(N=>{const I=a?.maxStableVersion&&ae(N,a.maxStableVersion),ee=a?.faultyRange&&ie(N,a.faultyRange.min,a.faultyRange.max);return t.jsx(Je,{value:N,className:"text-xs",children:t.jsxs("span",{className:"flex items-center gap-2",children:["v",N,N===a.latestStable&&t.jsx("span",{className:"text-green-600 dark:text-green-400",children:e("proxyStatusWidget.stable")}),(ee||I)&&t.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:"⚠"})]})},N)})})]}),t.jsxs(Y,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1.5 px-3",onClick:()=>void ue(C),disabled:g.isPending||!C,children:[g.isPending?t.jsx(K,{className:"w-3.5 h-3.5 animate-spin"}):t.jsx(Et,{className:"w-3.5 h-3.5"}),e("proxyStatusWidget.install")]})]}),C&&a?.maxStableVersion&&ae(C,a.maxStableVersion)&&t.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-amber-600 dark:text-amber-400",children:[t.jsx(ne,{className:"w-3.5 h-3.5 flex-shrink-0"}),t.jsx("span",{children:e("proxyStatusWidget.versionsAboveUnstable",{version:a.maxStableVersion})})]}),C&&a?.faultyRange&&ie(C,a.faultyRange.min,a.faultyRange.max)&&t.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-amber-600 dark:text-amber-400",children:[t.jsx(ne,{className:"w-3.5 h-3.5 flex-shrink-0"}),t.jsx("span",{children:e("proxyStatusWidget.versionsKnownIssues",{version:C})})]}),r?.checkedAt&&t.jsx("div",{className:"mt-2 text-[10px] text-muted-foreground/60",children:e("proxyStatusWidget.lastChecked",{time:Xt(r.checkedAt,e)})})]})}),!D&&t.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:e("proxyStatusWidget.notRunning")}),t.jsxs(Y,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>p.mutate(),disabled:p.isPending,children:[p.isPending?t.jsx(K,{className:"w-3 h-3 animate-spin"}):t.jsx(Tt,{className:"w-3 h-3"}),e("proxyStatusWidget.start")]})]}),t.jsx(st,{open:E,onOpenChange:$,children:t.jsxs(nt,{children:[t.jsxs(rt,{children:[t.jsxs(at,{className:"flex items-center gap-2",children:[t.jsx(ne,{className:"w-5 h-5 text-amber-500"}),e(V==="faulty"?"proxyStatusWidget.installFaultyTitle":"proxyStatusWidget.installUnstableTitle")]}),t.jsxs(it,{className:"space-y-2",children:[V==="faulty"?t.jsx("p",{children:t.jsx(ge,{i18nKey:"proxyStatusWidget.installFaultyDesc",values:{version:f??"",range:ke||""},components:{strong:t.jsx("strong",{})}})}):t.jsx("p",{children:t.jsx(ge,{i18nKey:"proxyStatusWidget.installUnstableDesc",values:{version:f??"",maxStable:ce},components:{strong:t.jsx("strong",{})}})}),t.jsx("p",{className:"text-amber-600 dark:text-amber-400",children:e(V==="faulty"?"proxyStatusWidget.installFaultyWarning":"proxyStatusWidget.installUnstableWarning")}),t.jsx("p",{children:e("proxyStatusWidget.installUnstableConfirm")})]})]}),t.jsxs(ot,{children:[t.jsx(lt,{onClick:Ee,children:e("proxyStatusWidget.cancel")}),t.jsx(ct,{onClick:Ae,className:"bg-amber-500 hover:bg-amber-600 text-white",children:e("proxyStatusWidget.installAnyway")})]})]})})]})})}export{os as P};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-Zb8sVEtn.js";import{r as y}from"./react-vendor-CNOkPC89.js";import{t as k}from"./notifications-B2HqRBj7.js";import{B as R,d as a,c as E,b5 as z,W as S}from"./index-
|
|
1
|
+
import{j as e}from"./radix-ui-Zb8sVEtn.js";import{r as y}from"./react-vendor-CNOkPC89.js";import{t as k}from"./notifications-B2HqRBj7.js";import{B as R,d as a,c as E,b5 as z,W as S}from"./index-Cp06bK_W.js";import{aT as T,L as m,at as B,o as L,R as P}from"./icons-DfENUzBo.js";function F({title:c,pathLabel:x,loading:t,parseWarning:r,readWarning:i,value:s,dirty:n,readOnly:h=!1,saving:f,saveDisabled:j,onChange:p,onSave:u,onRefresh:b,onDiscard:l,language:v="json",loadingLabel:N="Loading settings.json...",parseWarningLabel:g="Parse warning",ownershipNotice:d}){const[w,o]=y.useState(!1),C=async()=>{s&&(await navigator.clipboard.writeText(s),o(!0),k.success(S.t("commonToast.settingsCopied")),window.setTimeout(()=>o(!1),1500))};return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"p-4 border-b bg-background flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("h2",{className:"font-semibold flex items-center gap-2",children:[e.jsx(T,{className:"h-4 w-4 text-primary"}),c,n&&e.jsx(R,{variant:"secondary",className:"text-[10px]",children:"Unsaved"})]}),e.jsx("p",{className:"text-xs text-muted-foreground font-mono truncate",children:x})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(a,{size:"sm",onClick:u,disabled:j,children:[f?e.jsx(m,{className:"h-4 w-4 mr-1 animate-spin"}):e.jsx(B,{className:"h-4 w-4 mr-1"}),"Save"]}),l?e.jsx(a,{variant:"outline",size:"sm",onClick:l,disabled:!n||t,children:"Discard"}):null,e.jsxs(a,{variant:"outline",size:"sm",onClick:C,disabled:!s,children:[e.jsx(L,{className:"h-4 w-4 mr-1"}),w?"Copied":"Copy"]}),e.jsx(a,{variant:"outline",size:"sm",onClick:b,"aria-label":"Refresh raw config",children:e.jsx(P,{className:E("h-4 w-4",t?"animate-spin":"")})})]})]}),e.jsx("div",{className:"flex-1 overflow-auto",children:t?e.jsxs("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:[e.jsx(m,{className:"h-5 w-5 animate-spin mr-2"}),N]}):e.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[d&&e.jsx("div",{className:"mx-4 mt-4",children:d}),r&&e.jsxs("div",{className:"mx-4 mt-4 rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-sm text-amber-800 dark:bg-amber-950/20 dark:text-amber-300",children:[g,": ",r]}),i&&e.jsxs("div",{className:"mx-4 mt-4 rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-sm text-destructive",children:["Read-only: ",i]}),e.jsx("div",{className:"min-h-0 flex-1 p-4 pt-3",children:e.jsx("div",{className:"h-full rounded-md border overflow-hidden bg-background",children:e.jsx(z,{value:s,onChange:p,language:v,readonly:h,minHeight:"100%",heightMode:"fill-parent"})})})]})})]})}const A=F;export{F as R,A as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as n}from"./radix-ui-Zb8sVEtn.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}from"./index-
|
|
1
|
+
import{j as n}from"./radix-ui-Zb8sVEtn.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}from"./index-Cp06bK_W.js";import{aN as H,au as L,m as V}from"./icons-DfENUzBo.js";function S(o){return o.trim().toLowerCase()}function M(o,h){return`${o}-option-${h.replace(/[^a-z0-9_-]+/gi,"-")}`}function Z({value:o,onChange:h,options:f,groups:g,placeholder:j,searchPlaceholder:k,emptyText:E,disabled:F,className:q,triggerClassName:K,contentClassName:R}){const[l,T]=a.useState(!1),[y,N]=a.useState(""),[i,c]=a.useState(),m=a.useId(),A=a.useRef(null),I=a.useRef({}),O=a.useMemo(()=>f.find(e=>e.value===o),[f,o]),d=a.useMemo(()=>{const e=S(y);return e?f.filter(t=>[t.searchText,...t.keywords??[]].some(u=>S(u).includes(e))):f},[f,y]),z=a.useMemo(()=>{const e=new Map((g??[]).map(r=>[r.key,r])),t=d.filter(r=>!r.groupKey||!e.has(r.groupKey)),u=(g??[]).map(r=>({...r,options:d.filter(x=>x.groupKey===r.key)})).filter(r=>r.options.length>0);return t.length===0?u:[{key:"__default",options:t},...u]},[d,g]),s=a.useMemo(()=>d.filter(e=>!e.disabled),[d]),D=O?.triggerContent??O?.itemContent,v=e=>{T(e),e||(N(""),c(void 0))},b=()=>A.current?.focus();a.useEffect(()=>{if(l){if(s.length===0){c(void 0);return}c(e=>e&&s.some(t=>t.value===e)?e:s.find(t=>t.value===o)?.value??s[0]?.value)}},[s,l,o]),a.useEffect(()=>{!l||!i||I.current[i]?.scrollIntoView({block:"nearest"})},[i,l]);const p=e=>{if(s.length===0)return;if(e==="first"){c(s[0]?.value);return}if(e==="last"){c(s.at(-1)?.value);return}const t=s.findIndex(_=>_.value===i),u=e==="next"?-1:s.length,r=t>=0?t:u,x=e==="next"?Math.min(r+1,s.length-1):Math.max(r-1,0);c(s[x]?.value)},C=e=>{h(e),v(!1)},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,!D&&"text-muted-foreground"),children:[n.jsx("div",{className:"min-w-0 flex-1 text-left",children:D??n.jsx("span",{children:j})}),n.jsx(H,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),n.jsxs(B,{align:"start",className:w("w-[var(--radix-popover-trigger-width)] p-0",R),onOpenAutoFocus:e=>{if(e.preventDefault(),typeof requestAnimationFrame=="function"){requestAnimationFrame(b);return}setTimeout(b,0)},children:[n.jsx("div",{className:"border-b p-2",children:n.jsxs("div",{className:"relative",children:[n.jsx(L,{className:"text-muted-foreground absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2"}),n.jsx(G,{ref:A,value:y,onChange:e=>N(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("div",{"data-slot":"searchable-select-scroll-container","data-testid":"searchable-select-scroll-container",className:"max-h-72 overflow-y-auto overscroll-contain",children:d.length===0?n.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:E}):n.jsx("div",{id:m,role:"listbox","aria-label":j,className:"p-1",children:z.map(e=>n.jsxs("div",{children:[e.label&&n.jsx("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:e.label}),e.options.map(t=>{const u=t.value===i,r=t.value===o;return n.jsxs("button",{id:M(m,t.value),type:"button",role:"option","aria-selected":r,disabled:t.disabled,tabIndex:-1,ref:x=>{I.current[t.value]=x},onMouseMove:()=>{t.disabled||c(t.value)},onFocus:()=>{t.disabled||c(t.value)},onClick:()=>C(t.value),className:w("hover:bg-accent hover:text-accent-foreground flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm outline-none","focus-visible:ring-ring focus-visible:ring-1",u&&"bg-accent text-accent-foreground",r&&"bg-accent text-accent-foreground",t.disabled&&"pointer-events-none opacity-50"),children:[n.jsx("div",{className:"min-w-0 flex-1",children:t.itemContent}),r&&n.jsx(V,{className:"h-4 w-4 shrink-0"})]},t.value)})]},e.key))})})]})]})}export{Z as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as i,a0 as n}from"./radix-ui-Zb8sVEtn.js";import"./react-vendor-CNOkPC89.js";import{c as e}from"./index-
|
|
1
|
+
import{j as i,a0 as n}from"./radix-ui-Zb8sVEtn.js";import"./react-vendor-CNOkPC89.js";import{c as e}from"./index-Cp06bK_W.js";function m({className:t,orientation:a="horizontal",decorative:o=!0,...r}){return i.jsx(n,{"data-slot":"separator",decorative:o,orientation:a,className:e("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",t),...r})}export{m as S};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-Zb8sVEtn.js";import{r as j}from"./react-vendor-CNOkPC89.js";import{a as Q,bi as ee,bj as se,bk as te,Q as ae,R as re,U as ne,B as $,ba as S,bb as M,bc as L,d as I,I as le,n as B,c as U,C as ie,b as de}from"./index-Du97tqVQ.js";import{a3 as ce,aa as oe,b5 as me,T as E,R as T,F as he,au as ue,w as xe}from"./icons-DfENUzBo.js";import"./tanstack-CrmUhA7Z.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";function Se(){const{t:s}=Q(),[a,l]=j.useState("commands"),t={commands:s("sharedPage.commands"),skills:s("sharedPage.skills"),agents:s("sharedPage.agents")},[r,d]=j.useState(""),[n,o]=j.useState(null),{data:c,isError:h,error:p,refetch:w}=ee(),{data:m,isLoading:x,isFetching:y,isError:g,error:q,refetch:D}=se(a),N=m?.items??[],C=r.trim().toLowerCase(),b=r.trim(),u=j.useMemo(()=>{const i=m?.items??[];return C?i.filter(v=>[v.name,v.description,v.path].some(Y=>Y.toLowerCase().includes(C))):i},[m,C]),f=j.useMemo(()=>u.length===0?null:n?u.find(i=>i.path===n)??u[0]:u[0],[u,n]),{data:P,isLoading:O,isError:_,error:W,refetch:V}=te(a,f?.path??null),z=[{id:"commands",label:t.commands,icon:ce,count:c?.commands??0},{id:"skills",label:t.skills,icon:oe,count:c?.skills??0},{id:"agents",label:t.agents,icon:me,count:c?.agents??0}],H=z.reduce((i,v)=>i+v.count,0),K=!x&&!g&&N.length===0,Z=!x&&!g&&N.length>0&&u.length===0,G=A(p,"Shared item totals could not be loaded. Listing still works."),J=A(q,`Unable to fetch shared ${a}. Please try again.`),X=A(W,`Unable to load content for ${f?.name??"selected item"}.`);return e.jsxs("div",{className:"h-full overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"p-6 pb-4 space-y-3",children:[e.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-end lg:justify-between",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:s("sharedPage.title")}),e.jsx("p",{className:"text-muted-foreground",children:s("sharedPage.subtitle")})]}),e.jsx(ae,{value:a,onValueChange:i=>{l(i),d(""),o(null)},children:e.jsx(re,{className:"h-auto flex-wrap justify-start",children:z.map(i=>e.jsxs(ne,{value:i.id,className:"flex items-center gap-2",children:[e.jsx(i.icon,{className:"w-4 h-4"}),e.jsx("span",{children:i.label}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",i.count,")"]})]},i.id))})})]}),e.jsxs("div",{className:"flex flex-col gap-2 lg:items-end",children:[e.jsxs("div",{className:"grid w-full gap-2 sm:w-auto sm:min-w-[340px] sm:grid-cols-3",children:[e.jsx(F,{label:s("sharedPage.totalShared"),value:H}),e.jsx(F,{label:t[a],value:N.length}),e.jsx(F,{label:s("sharedPage.visible"),value:u.length})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx($,{variant:"secondary",children:s("sharedPage.markdownDetail")}),b?e.jsxs($,{variant:"outline",children:[s("sharedPage.filterPrefix")," ",b]}):null]})]})]}),c&&!c.symlinkStatus.valid&&e.jsxs(S,{variant:"warning",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx(M,{children:s("sharedPage.configurationRequired")}),e.jsxs(L,{children:[c.symlinkStatus.message,". Run `ccs sync` to configure."]})]}),h&&e.jsxs(S,{variant:"info",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx(M,{children:s("sharedPage.countsUnavailable")}),e.jsxs(L,{children:[e.jsx("p",{children:G}),e.jsx("div",{className:"mt-3",children:e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>{w()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retryCounts")]})})]})]})]}),e.jsx("div",{className:"flex-1 min-h-0 px-6 pb-6",children:e.jsx("div",{className:"h-full rounded-lg border overflow-hidden bg-background",children:e.jsxs("div",{className:"grid h-full min-h-0 lg:grid-cols-[320px_minmax(0,1fr)]",children:[e.jsxs("div",{className:"min-h-0 border-b lg:border-b-0 lg:border-r flex flex-col bg-muted/30",children:[e.jsxs("div",{className:"p-4 border-b bg-background space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(he,{className:"w-4 h-4 text-primary shrink-0"}),e.jsx("h2",{className:"font-semibold truncate",children:t[a]})]}),!x&&!g&&e.jsxs($,{variant:"outline",className:"text-[10px] h-5",children:[u.length,"/",N.length]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(ue,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(le,{value:r,onChange:i=>d(i.target.value),placeholder:s("sharedPage.filterPlaceholder",{tab:a}),"aria-label":s("sharedPage.filterPlaceholder",{tab:a}),className:"pl-8 h-9"})]}),!x&&!g&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s("sharedPage.showing",{visible:u.length,total:N.length,tab:a}),b?s("sharedPage.showingQuery",{query:b}):"",y?s("sharedPage.refreshing"):""]})]}),e.jsx(B,{className:"flex-1 min-h-0",children:x?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.loadingShared",{tab:a})}):g?e.jsx("div",{className:"p-4 text-center",children:e.jsxs("div",{className:"space-y-3 py-8",children:[e.jsx(xe,{className:"w-10 h-10 mx-auto text-destructive/50"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:s("sharedPage.failedLoadShared",{tab:a})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:J})]}),e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>{D()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retry")]})]})}):K?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.noSharedFound",{tab:a})}):Z?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.noMatch",{tab:a,query:b})}):e.jsx("div",{className:"p-2 space-y-1",children:u.map(i=>e.jsxs("button",{type:"button",onClick:()=>o(i.path),className:U("w-full text-left p-3 rounded-md border transition-colors",f?.path===i.path?"bg-primary/10 border-primary/30":"bg-background hover:bg-muted border-transparent"),children:[e.jsx("p",{className:"text-sm font-medium truncate",children:i.name}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:i.description}),e.jsx("p",{className:"text-[11px] text-muted-foreground/90 mt-2 font-mono truncate",children:i.path})]},`${i.type}:${i.path}`))})})]}),e.jsx("div",{className:"min-w-0 min-h-0 flex flex-col bg-muted/20",children:f?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-4 py-3 border-b bg-background",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-base font-semibold truncate",children:f.name}),e.jsx($,{variant:"outline",className:"uppercase text-[10px]",children:f.type})]})}),e.jsxs("div",{className:"p-4 space-y-4 min-h-0 flex-1 flex flex-col",children:[e.jsx("div",{className:"rounded-md border bg-muted/35 p-3",children:e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-3",children:[e.jsx(R,{label:s("sharedPage.pathLabel"),value:f.path,mono:!0}),P?.contentPath&&P.contentPath!==f.path&&e.jsx(R,{label:s("sharedPage.resolvedSource"),value:P.contentPath,mono:!0})]})}),e.jsx(ie,{className:"min-h-0 flex-1",children:e.jsx(de,{className:"p-0 h-full",children:e.jsx(B,{className:"h-full px-5 py-4",children:O?e.jsx("p",{className:"text-sm text-muted-foreground",children:s("sharedPage.loadingMarkdown")}):_?e.jsxs(S,{variant:"destructive",className:"max-w-2xl",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx(M,{children:s("sharedPage.failedLoadContent")}),e.jsxs(L,{children:[e.jsx("p",{children:X}),e.jsx("div",{className:"mt-3",children:e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>{V()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retryContent")]})})]})]}):e.jsx(pe,{content:P?.content??""})})})})]})]}):e.jsx("div",{className:"min-h-[320px] flex items-center justify-center p-6 text-center text-muted-foreground",children:s("sharedPage.selectOne",{tab:a.slice(0,-1)})})})]})})})]})}function F({label:s,value:a}){return e.jsxs("div",{className:"rounded-md border bg-muted/30 px-3 py-2",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:s}),e.jsx("p",{className:"text-lg font-semibold leading-tight mt-1",children:a})]})}function R({label:s,value:a,mono:l=!1}){return e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:s}),e.jsx("p",{className:U("text-xs mt-1 break-words",l?"font-mono":"text-sm"),children:a})]})}function A(s,a){if(!(s instanceof Error))return a;const l=s.message.toLowerCase();return l.includes("failed to fetch")||l.includes("network")?"Connection to dashboard server lost or restarting. Keep `ccs config` running, then retry.":s.message||a}function pe({content:s}){const{t:a}=Q(),l=j.useMemo(()=>fe(s),[s]);return l.blocks.length===0&&l.frontmatter.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:a("sharedPage.noMarkdown")}):e.jsxs("div",{className:"space-y-5",children:[l.frontmatter.length>0?e.jsx("div",{className:"rounded-md border bg-muted/35 p-3",children:e.jsx("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-3",children:l.frontmatter.map(t=>e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:ge(t.key)}),e.jsx("p",{className:"text-xs mt-1 break-words",children:t.value})]},`${t.key}:${t.value}`))})}):null,l.blocks.map((t,r)=>{if(t.type==="heading"){const d=t.level<=1?"text-xl font-semibold":t.level===2?"text-lg font-semibold":"text-base font-semibold";return e.jsx("h3",{className:d,children:k(t.text,`heading-${r}`)},`heading-${r}`)}return t.type==="paragraph"?e.jsx("p",{className:"text-sm leading-6 whitespace-pre-wrap",children:k(t.text,`paragraph-${r}`)},`paragraph-${r}`):t.type==="unordered-list"?e.jsx("ul",{className:"list-disc pl-5 space-y-1 text-sm leading-6",children:t.items.map((d,n)=>e.jsx("li",{children:k(d,`ul-item-${r}-${n}`)},`ul-item-${r}-${n}`))},`ul-${r}`):t.type==="ordered-list"?e.jsx("ol",{className:"list-decimal pl-5 space-y-1 text-sm leading-6",children:t.items.map((d,n)=>e.jsx("li",{children:k(d,`ol-item-${r}-${n}`)},`ol-item-${r}-${n}`))},`ol-${r}`):e.jsxs("div",{className:"rounded-md border bg-muted/60 p-3 font-mono text-xs leading-5 overflow-x-auto",children:[t.language&&e.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground mb-2",children:t.language}),e.jsx("pre",{className:"whitespace-pre-wrap break-words m-0",children:t.content})]},`code-${r}`)})]})}function ge(s){return s.replace(/[-_]/g," ")}function k(s,a){const l=/(\*\*([^*]+)\*\*|`([^`]+)`|\*([^*]+)\*|\[([^\]]+)\]\(([^)]+)\))/g,t=[];let r=0,d=0;for(const n of s.matchAll(l)){const o=n[0],c=n.index??0;if(c>r&&t.push(s.slice(r,c)),n[2])t.push(e.jsx("strong",{className:"font-semibold",children:n[2]},`${a}-strong-${d}`));else if(n[3])t.push(e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[0.82em]",children:n[3]},`${a}-code-${d}`));else if(n[4])t.push(e.jsx("em",{className:"italic",children:n[4]},`${a}-em-${d}`));else if(n[5]&&n[6]){const h=n[6].trim();/^(https?:\/\/|mailto:)/i.test(h)?t.push(e.jsx("a",{href:h,target:"_blank",rel:"noreferrer",className:"text-primary underline underline-offset-2 hover:opacity-90",children:n[5]},`${a}-link-${d}`)):t.push(n[5])}else t.push(o);r=c+o.length,d+=1}return r<s.length&&t.push(s.slice(r)),t.length===0?[s]:t}function fe(s){const a=s.replace(/\r\n/g,`
|
|
1
|
+
import{j as e}from"./radix-ui-Zb8sVEtn.js";import{r as j}from"./react-vendor-CNOkPC89.js";import{a as Q,bi as ee,bj as se,bk as te,Q as ae,R as re,U as ne,B as $,ba as S,bb as M,bc as L,d as I,I as le,n as B,c as U,C as ie,b as de}from"./index-Cp06bK_W.js";import{a3 as ce,aa as oe,b5 as me,T as E,R as T,F as he,au as ue,w as xe}from"./icons-DfENUzBo.js";import"./tanstack-CrmUhA7Z.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";function Se(){const{t:s}=Q(),[a,l]=j.useState("commands"),t={commands:s("sharedPage.commands"),skills:s("sharedPage.skills"),agents:s("sharedPage.agents")},[r,d]=j.useState(""),[n,o]=j.useState(null),{data:c,isError:h,error:p,refetch:w}=ee(),{data:m,isLoading:x,isFetching:y,isError:g,error:q,refetch:D}=se(a),N=m?.items??[],C=r.trim().toLowerCase(),b=r.trim(),u=j.useMemo(()=>{const i=m?.items??[];return C?i.filter(v=>[v.name,v.description,v.path].some(Y=>Y.toLowerCase().includes(C))):i},[m,C]),f=j.useMemo(()=>u.length===0?null:n?u.find(i=>i.path===n)??u[0]:u[0],[u,n]),{data:P,isLoading:O,isError:_,error:W,refetch:V}=te(a,f?.path??null),z=[{id:"commands",label:t.commands,icon:ce,count:c?.commands??0},{id:"skills",label:t.skills,icon:oe,count:c?.skills??0},{id:"agents",label:t.agents,icon:me,count:c?.agents??0}],H=z.reduce((i,v)=>i+v.count,0),K=!x&&!g&&N.length===0,Z=!x&&!g&&N.length>0&&u.length===0,G=A(p,"Shared item totals could not be loaded. Listing still works."),J=A(q,`Unable to fetch shared ${a}. Please try again.`),X=A(W,`Unable to load content for ${f?.name??"selected item"}.`);return e.jsxs("div",{className:"h-full overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"p-6 pb-4 space-y-3",children:[e.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-end lg:justify-between",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:s("sharedPage.title")}),e.jsx("p",{className:"text-muted-foreground",children:s("sharedPage.subtitle")})]}),e.jsx(ae,{value:a,onValueChange:i=>{l(i),d(""),o(null)},children:e.jsx(re,{className:"h-auto flex-wrap justify-start",children:z.map(i=>e.jsxs(ne,{value:i.id,className:"flex items-center gap-2",children:[e.jsx(i.icon,{className:"w-4 h-4"}),e.jsx("span",{children:i.label}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",i.count,")"]})]},i.id))})})]}),e.jsxs("div",{className:"flex flex-col gap-2 lg:items-end",children:[e.jsxs("div",{className:"grid w-full gap-2 sm:w-auto sm:min-w-[340px] sm:grid-cols-3",children:[e.jsx(F,{label:s("sharedPage.totalShared"),value:H}),e.jsx(F,{label:t[a],value:N.length}),e.jsx(F,{label:s("sharedPage.visible"),value:u.length})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx($,{variant:"secondary",children:s("sharedPage.markdownDetail")}),b?e.jsxs($,{variant:"outline",children:[s("sharedPage.filterPrefix")," ",b]}):null]})]})]}),c&&!c.symlinkStatus.valid&&e.jsxs(S,{variant:"warning",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx(M,{children:s("sharedPage.configurationRequired")}),e.jsxs(L,{children:[c.symlinkStatus.message,". Run `ccs sync` to configure."]})]}),h&&e.jsxs(S,{variant:"info",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx(M,{children:s("sharedPage.countsUnavailable")}),e.jsxs(L,{children:[e.jsx("p",{children:G}),e.jsx("div",{className:"mt-3",children:e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>{w()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retryCounts")]})})]})]})]}),e.jsx("div",{className:"flex-1 min-h-0 px-6 pb-6",children:e.jsx("div",{className:"h-full rounded-lg border overflow-hidden bg-background",children:e.jsxs("div",{className:"grid h-full min-h-0 lg:grid-cols-[320px_minmax(0,1fr)]",children:[e.jsxs("div",{className:"min-h-0 border-b lg:border-b-0 lg:border-r flex flex-col bg-muted/30",children:[e.jsxs("div",{className:"p-4 border-b bg-background space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(he,{className:"w-4 h-4 text-primary shrink-0"}),e.jsx("h2",{className:"font-semibold truncate",children:t[a]})]}),!x&&!g&&e.jsxs($,{variant:"outline",className:"text-[10px] h-5",children:[u.length,"/",N.length]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(ue,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(le,{value:r,onChange:i=>d(i.target.value),placeholder:s("sharedPage.filterPlaceholder",{tab:a}),"aria-label":s("sharedPage.filterPlaceholder",{tab:a}),className:"pl-8 h-9"})]}),!x&&!g&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s("sharedPage.showing",{visible:u.length,total:N.length,tab:a}),b?s("sharedPage.showingQuery",{query:b}):"",y?s("sharedPage.refreshing"):""]})]}),e.jsx(B,{className:"flex-1 min-h-0",children:x?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.loadingShared",{tab:a})}):g?e.jsx("div",{className:"p-4 text-center",children:e.jsxs("div",{className:"space-y-3 py-8",children:[e.jsx(xe,{className:"w-10 h-10 mx-auto text-destructive/50"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:s("sharedPage.failedLoadShared",{tab:a})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:J})]}),e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>{D()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retry")]})]})}):K?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.noSharedFound",{tab:a})}):Z?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.noMatch",{tab:a,query:b})}):e.jsx("div",{className:"p-2 space-y-1",children:u.map(i=>e.jsxs("button",{type:"button",onClick:()=>o(i.path),className:U("w-full text-left p-3 rounded-md border transition-colors",f?.path===i.path?"bg-primary/10 border-primary/30":"bg-background hover:bg-muted border-transparent"),children:[e.jsx("p",{className:"text-sm font-medium truncate",children:i.name}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:i.description}),e.jsx("p",{className:"text-[11px] text-muted-foreground/90 mt-2 font-mono truncate",children:i.path})]},`${i.type}:${i.path}`))})})]}),e.jsx("div",{className:"min-w-0 min-h-0 flex flex-col bg-muted/20",children:f?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-4 py-3 border-b bg-background",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-base font-semibold truncate",children:f.name}),e.jsx($,{variant:"outline",className:"uppercase text-[10px]",children:f.type})]})}),e.jsxs("div",{className:"p-4 space-y-4 min-h-0 flex-1 flex flex-col",children:[e.jsx("div",{className:"rounded-md border bg-muted/35 p-3",children:e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-3",children:[e.jsx(R,{label:s("sharedPage.pathLabel"),value:f.path,mono:!0}),P?.contentPath&&P.contentPath!==f.path&&e.jsx(R,{label:s("sharedPage.resolvedSource"),value:P.contentPath,mono:!0})]})}),e.jsx(ie,{className:"min-h-0 flex-1",children:e.jsx(de,{className:"p-0 h-full",children:e.jsx(B,{className:"h-full px-5 py-4",children:O?e.jsx("p",{className:"text-sm text-muted-foreground",children:s("sharedPage.loadingMarkdown")}):_?e.jsxs(S,{variant:"destructive",className:"max-w-2xl",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx(M,{children:s("sharedPage.failedLoadContent")}),e.jsxs(L,{children:[e.jsx("p",{children:X}),e.jsx("div",{className:"mt-3",children:e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>{V()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retryContent")]})})]})]}):e.jsx(pe,{content:P?.content??""})})})})]})]}):e.jsx("div",{className:"min-h-[320px] flex items-center justify-center p-6 text-center text-muted-foreground",children:s("sharedPage.selectOne",{tab:a.slice(0,-1)})})})]})})})]})}function F({label:s,value:a}){return e.jsxs("div",{className:"rounded-md border bg-muted/30 px-3 py-2",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:s}),e.jsx("p",{className:"text-lg font-semibold leading-tight mt-1",children:a})]})}function R({label:s,value:a,mono:l=!1}){return e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:s}),e.jsx("p",{className:U("text-xs mt-1 break-words",l?"font-mono":"text-sm"),children:a})]})}function A(s,a){if(!(s instanceof Error))return a;const l=s.message.toLowerCase();return l.includes("failed to fetch")||l.includes("network")?"Connection to dashboard server lost or restarting. Keep `ccs config` running, then retry.":s.message||a}function pe({content:s}){const{t:a}=Q(),l=j.useMemo(()=>fe(s),[s]);return l.blocks.length===0&&l.frontmatter.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:a("sharedPage.noMarkdown")}):e.jsxs("div",{className:"space-y-5",children:[l.frontmatter.length>0?e.jsx("div",{className:"rounded-md border bg-muted/35 p-3",children:e.jsx("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-3",children:l.frontmatter.map(t=>e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:ge(t.key)}),e.jsx("p",{className:"text-xs mt-1 break-words",children:t.value})]},`${t.key}:${t.value}`))})}):null,l.blocks.map((t,r)=>{if(t.type==="heading"){const d=t.level<=1?"text-xl font-semibold":t.level===2?"text-lg font-semibold":"text-base font-semibold";return e.jsx("h3",{className:d,children:k(t.text,`heading-${r}`)},`heading-${r}`)}return t.type==="paragraph"?e.jsx("p",{className:"text-sm leading-6 whitespace-pre-wrap",children:k(t.text,`paragraph-${r}`)},`paragraph-${r}`):t.type==="unordered-list"?e.jsx("ul",{className:"list-disc pl-5 space-y-1 text-sm leading-6",children:t.items.map((d,n)=>e.jsx("li",{children:k(d,`ul-item-${r}-${n}`)},`ul-item-${r}-${n}`))},`ul-${r}`):t.type==="ordered-list"?e.jsx("ol",{className:"list-decimal pl-5 space-y-1 text-sm leading-6",children:t.items.map((d,n)=>e.jsx("li",{children:k(d,`ol-item-${r}-${n}`)},`ol-item-${r}-${n}`))},`ol-${r}`):e.jsxs("div",{className:"rounded-md border bg-muted/60 p-3 font-mono text-xs leading-5 overflow-x-auto",children:[t.language&&e.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground mb-2",children:t.language}),e.jsx("pre",{className:"whitespace-pre-wrap break-words m-0",children:t.content})]},`code-${r}`)})]})}function ge(s){return s.replace(/[-_]/g," ")}function k(s,a){const l=/(\*\*([^*]+)\*\*|`([^`]+)`|\*([^*]+)\*|\[([^\]]+)\]\(([^)]+)\))/g,t=[];let r=0,d=0;for(const n of s.matchAll(l)){const o=n[0],c=n.index??0;if(c>r&&t.push(s.slice(r,c)),n[2])t.push(e.jsx("strong",{className:"font-semibold",children:n[2]},`${a}-strong-${d}`));else if(n[3])t.push(e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[0.82em]",children:n[3]},`${a}-code-${d}`));else if(n[4])t.push(e.jsx("em",{className:"italic",children:n[4]},`${a}-em-${d}`));else if(n[5]&&n[6]){const h=n[6].trim();/^(https?:\/\/|mailto:)/i.test(h)?t.push(e.jsx("a",{href:h,target:"_blank",rel:"noreferrer",className:"text-primary underline underline-offset-2 hover:opacity-90",children:n[5]},`${a}-link-${d}`)):t.push(n[5])}else t.push(o);r=c+o.length,d+=1}return r<s.length&&t.push(s.slice(r)),t.length===0?[s]:t}function fe(s){const a=s.replace(/\r\n/g,`
|
|
2
2
|
`).trim();if(!a)return{blocks:[],frontmatter:[]};let l=a;const t=[];if(l.startsWith(`---
|
|
3
3
|
`)){const r=l.indexOf(`
|
|
4
4
|
---
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t}from"./radix-ui-Zb8sVEtn.js";import"./react-vendor-CNOkPC89.js";import{c as l}from"./index-
|
|
1
|
+
import{j as t}from"./radix-ui-Zb8sVEtn.js";import"./react-vendor-CNOkPC89.js";import{c as l}from"./index-Cp06bK_W.js";function n({className:a,...e}){return t.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:t.jsx("table",{"data-slot":"table",className:l("w-full caption-bottom text-sm",a),...e})})}function c({className:a,...e}){return t.jsx("thead",{"data-slot":"table-header",className:l("[&_tr]:border-b",a),...e})}function d({className:a,...e}){return t.jsx("tbody",{"data-slot":"table-body",className:l("[&_tr:last-child]:border-0",a),...e})}function b({className:a,...e}){return t.jsx("tr",{"data-slot":"table-row",className:l("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",a),...e})}function i({className:a,...e}){return t.jsx("th",{"data-slot":"table-head",className:l("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",a),...e})}function m({className:a,...e}){return t.jsx("td",{"data-slot":"table-cell",className:l("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",a),...e})}export{n as T,c as a,b,i as c,d,m as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-Zb8sVEtn.js";import{L as P,r as o}from"./react-vendor-CNOkPC89.js";import{a as p,B as y,c as k,d as x,x as E,bl as M,C as g,j,k as N,_ as w,b as v,n as b,bm as U,bn as $,I as z,bo as B}from"./index-Du97tqVQ.js";import{a1 as L,$ as Q,b6 as q,x as G,E as J,Q as V,aa as Y,C as F,b7 as H,au as K}from"./icons-DfENUzBo.js";import"./tanstack-CrmUhA7Z.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";const W={new:"border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-900/50 dark:bg-blue-900/20 dark:text-blue-300",stable:"border-green-200 bg-green-50 text-green-700 dark:border-green-900/50 dark:bg-green-900/20 dark:text-green-300",planned:"border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-900/50 dark:bg-amber-900/20 dark:text-amber-300"};function X({status:s,className:a}){const{t}=p(),d={new:t("updates.statusNew"),stable:t("updates.statusStable"),planned:t("updates.statusPlanned")};return e.jsx(y,{variant:"outline",className:k("font-medium",W[s],a),children:d[s]})}const I="ccs:updates:notice-progress:v1";function Z(s){return s==="new"?"new":"seen"}function u(s,a){return a[s.id]??Z(s.status)}function A(s){return s!=="done"&&s!=="dismissed"}function ee(){if(typeof window>"u")return{};try{const s=window.localStorage.getItem(I);if(!s)return{};const a=JSON.parse(s);if(!a||typeof a!="object"||Array.isArray(a))return{};const t={};for(const[d,l]of Object.entries(a))typeof d=="string"&&(l==="new"||l==="seen"||l==="done"||l==="dismissed")&&(t[d]=l);return t}catch{return{}}}function se(s){typeof window>"u"||window.localStorage.setItem(I,JSON.stringify(s))}function R({state:s,className:a}){const{t}=p(),d={new:{label:t("updates.progressNeedsAction"),className:"border-amber-300/70 bg-amber-100/70 text-amber-800 dark:border-amber-500/40 dark:bg-amber-500/15 dark:text-amber-300",showDot:!0},seen:{label:t("updates.progressInReview"),className:"border-blue-300/70 bg-blue-100/70 text-blue-800 dark:border-blue-500/40 dark:bg-blue-500/15 dark:text-blue-300"},done:{label:t("updates.progressDone"),className:"border-emerald-300/70 bg-emerald-100/70 text-emerald-800 dark:border-emerald-500/40 dark:bg-emerald-500/15 dark:text-emerald-300"},dismissed:{label:t("updates.progressDismissed"),className:"border-muted-foreground/20 bg-muted text-muted-foreground dark:border-muted-foreground/30"}}[s];return e.jsxs(y,{variant:"outline",className:k("gap-1.5 border text-[10px] font-medium",d.className,a),children:[d.showDot&&e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-current"}),d.label]})}function ae({action:s}){const{t:a}=p();return e.jsxs("div",{className:"rounded-md border bg-muted/20 p-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 space-y-0.5",children:[e.jsx("p",{className:"text-sm font-medium",children:s.label}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.description})]}),s.type==="route"&&s.path&&e.jsx(x,{size:"sm",asChild:!0,children:e.jsxs(P,{to:s.path,children:[a("updates.open"),e.jsx(L,{className:"h-3.5 w-3.5"})]})})]}),s.type==="command"&&s.command&&e.jsxs("div",{className:"mt-2 flex items-center gap-2 rounded-md border bg-background px-2 py-1.5",children:[e.jsx(Q,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("code",{className:"min-w-0 flex-1 truncate text-[11px]",children:s.command}),e.jsx(E,{value:s.command})]})]})}function re({notice:s,progress:a,relatedEntries:t,onUpdateProgress:d}){const{t:l}=p();return s?e.jsxs("div",{className:"flex-1 min-w-0 bg-background grid grid-rows-[auto_minmax(0,1fr)] overflow-hidden",children:[e.jsxs("div",{className:"border-b bg-background px-4 py-3",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("h2",{className:"text-base font-semibold leading-tight",children:s.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.summary})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[a&&e.jsx(R,{state:a}),e.jsx(X,{status:s.status})]})]}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(q,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:l("updates.published",{date:M(s.publishedAt)})})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsxs(x,{size:"sm",onClick:()=>d("done"),children:[e.jsx(G,{className:"h-4 w-4"}),l("updates.markDone")]}),e.jsxs(x,{size:"sm",variant:"outline",onClick:()=>d("dismissed"),children:[e.jsx(J,{className:"h-4 w-4"}),l("updates.dismiss")]}),e.jsxs(x,{size:"sm",variant:"ghost",onClick:()=>d("new"),children:[e.jsx(V,{className:"h-4 w-4"}),l("updates.reopen")]})]})]}),e.jsx("div",{className:"min-h-0 p-4",children:e.jsxs("div",{className:"grid h-full gap-4 xl:grid-cols-[minmax(0,1.5fr)_minmax(320px,1fr)] overflow-hidden",children:[e.jsxs(g,{className:"h-full overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Y,{className:"h-4 w-4 text-primary"}),e.jsx(N,{className:"text-base",children:l("updates.doNext")})]}),e.jsx(w,{children:s.primaryAction})]}),e.jsx(v,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("div",{className:"space-y-3",children:s.actions.map(n=>e.jsx(ae,{action:n},`${s.id}-${n.id}`))})})})]}),e.jsxs("div",{className:"grid h-full grid-rows-[minmax(0,1fr)_minmax(0,1fr)] gap-4 overflow-hidden",children:[e.jsxs(g,{className:"overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsx(N,{className:"text-base",children:l("updates.impactedIntegrations")}),e.jsx(w,{children:l("updates.impactedDesc")})]}),e.jsx(v,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("div",{className:"space-y-2",children:t.map(n=>e.jsxs("div",{className:"rounded-md border bg-muted/20 p-2.5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("p",{className:"min-w-0 truncate text-sm font-medium",children:n.name}),e.jsx(y,{variant:"outline",className:"h-5 px-1.5 text-[10px]",children:U[n.scope]})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[n.routes[0]&&e.jsx(x,{size:"sm",variant:"outline",asChild:!0,children:e.jsx(P,{to:n.routes[0].path,children:n.routes[0].label})}),n.commands[0]&&e.jsxs("div",{className:"ml-auto flex min-w-0 items-center gap-1.5",children:[e.jsx("code",{className:"truncate rounded bg-background px-1.5 py-0.5 text-[11px]",children:n.commands[0]}),e.jsx(E,{value:n.commands[0]})]})]})]},n.id))})})})]}),e.jsxs(g,{className:"overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsx(N,{className:"text-base",children:l("updates.whyMatters")}),e.jsx(w,{children:l("updates.whyMattersDesc")})]}),e.jsx(v,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("ul",{className:"space-y-2 text-sm text-muted-foreground",children:s.highlights.map(n=>e.jsxs("li",{children:["- ",n]},`${s.id}-${n}`))})})})]})]})]})})]}):e.jsx("div",{className:"flex h-full items-center justify-center rounded-lg border border-dashed bg-muted/20 p-6",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:l("updates.noUpdates")})})}function te({notice:s,progress:a,selected:t,onSelect:d}){return e.jsxs("button",{type:"button",onClick:d,className:k("w-full rounded-lg border px-3 py-3 text-left transition-colors",t?"border-primary/30 bg-primary/10":"border-transparent bg-background/40 hover:border-border hover:bg-muted/70"),children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("p",{className:"truncate text-sm font-medium",children:s.title}),e.jsx("p",{className:"line-clamp-2 text-xs text-muted-foreground",children:s.primaryAction})]}),e.jsx(F,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"})]}),e.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-[11px] text-muted-foreground",children:M(s.publishedAt)}),e.jsx(R,{state:a})]})]})}function de(s,a){return a?[s.title,s.summary,s.primaryAction,...s.highlights,...s.commands,...s.actions.map(d=>`${d.label} ${d.description} ${d.command||""}`),...s.routes.map(d=>d.label)].join(" ").toLowerCase().includes(a):!0}function be(){const{t:s}=p(),a=o.useMemo(()=>[...$].sort((r,i)=>i.publishedAt.localeCompare(r.publishedAt)),[]),[t,d]=o.useState("inbox"),[l,n]=o.useState(""),[c,C]=o.useState(()=>ee()),[S,T]=o.useState(null);o.useEffect(()=>{se(c)},[c]);const h=o.useMemo(()=>{const r=l.trim().toLowerCase();return a.filter(i=>{const f=u(i,c);return de(i,r)?t==="done"?f==="done":t==="inbox"?A(f):!0:!1})},[a,c,l,t]),m=o.useMemo(()=>{const r=t==="all"?a:h;return r.find(i=>i.id===S)??r[0]??null},[a,S,t,h]),D=r=>{T(r.id),C(i=>u(r,i)!=="new"?i:{...i,[r.id]:"seen"})},O=o.useMemo(()=>a.filter(r=>A(u(r,c))).length,[a,c]),_=o.useMemo(()=>a.filter(r=>u(r,c)==="done").length,[a,c]);return e.jsxs("div",{className:"flex h-full min-h-0 overflow-hidden",children:[e.jsxs("div",{className:"w-80 border-r bg-muted/30 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b bg-background space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{className:"h-5 w-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:s("updates.inboxTitle")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("updates.inboxSubtitle")})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxs("div",{className:"rounded-md border bg-background px-2 py-1.5",children:[e.jsx("p",{className:"text-muted-foreground",children:s("updates.needsAction")}),e.jsx("p",{className:"text-base font-semibold",children:O})]}),e.jsxs("div",{className:"rounded-md border bg-background px-2 py-1.5",children:[e.jsx("p",{className:"text-muted-foreground",children:s("updates.doneCount")}),e.jsx("p",{className:"text-base font-semibold",children:_})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(K,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(z,{value:l,onChange:r=>n(r.target.value),placeholder:s("updates.searchPlaceholder"),className:"h-9 pl-8"})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:[{id:"inbox",label:s("updates.actionRequired")},{id:"done",label:s("updates.done")},{id:"all",label:s("updates.all")}].map(r=>e.jsx(x,{size:"sm",variant:t===r.id?"default":"outline",onClick:()=>d(r.id),children:r.label},r.id))})]}),e.jsx(b,{className:"flex-1",children:e.jsx("div",{className:"space-y-2 p-2",children:h.length===0?e.jsx("div",{className:"rounded-md border border-dashed p-3 text-xs text-muted-foreground",children:s("updates.noNotices")}):h.map(r=>e.jsx(te,{notice:r,progress:u(r,c),selected:m?.id===r.id,onSelect:()=>D(r)},r.id))})})]}),e.jsx(re,{notice:m,progress:m?u(m,c):null,relatedEntries:m?B(m):[],onUpdateProgress:r=>{m&&C(i=>({...i,[m.id]:r}))}})]})}export{be as UpdatesPage};
|
|
1
|
+
import{j as e}from"./radix-ui-Zb8sVEtn.js";import{L as P,r as o}from"./react-vendor-CNOkPC89.js";import{a as p,B as y,c as k,d as x,x as E,bl as M,C as g,j,k as N,_ as w,b as v,n as b,bm as U,bn as $,I as z,bo as B}from"./index-Cp06bK_W.js";import{a1 as L,$ as Q,b6 as q,x as G,E as J,Q as V,aa as Y,C as F,b7 as H,au as K}from"./icons-DfENUzBo.js";import"./tanstack-CrmUhA7Z.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";const W={new:"border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-900/50 dark:bg-blue-900/20 dark:text-blue-300",stable:"border-green-200 bg-green-50 text-green-700 dark:border-green-900/50 dark:bg-green-900/20 dark:text-green-300",planned:"border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-900/50 dark:bg-amber-900/20 dark:text-amber-300"};function X({status:s,className:a}){const{t}=p(),d={new:t("updates.statusNew"),stable:t("updates.statusStable"),planned:t("updates.statusPlanned")};return e.jsx(y,{variant:"outline",className:k("font-medium",W[s],a),children:d[s]})}const I="ccs:updates:notice-progress:v1";function Z(s){return s==="new"?"new":"seen"}function u(s,a){return a[s.id]??Z(s.status)}function A(s){return s!=="done"&&s!=="dismissed"}function ee(){if(typeof window>"u")return{};try{const s=window.localStorage.getItem(I);if(!s)return{};const a=JSON.parse(s);if(!a||typeof a!="object"||Array.isArray(a))return{};const t={};for(const[d,l]of Object.entries(a))typeof d=="string"&&(l==="new"||l==="seen"||l==="done"||l==="dismissed")&&(t[d]=l);return t}catch{return{}}}function se(s){typeof window>"u"||window.localStorage.setItem(I,JSON.stringify(s))}function R({state:s,className:a}){const{t}=p(),d={new:{label:t("updates.progressNeedsAction"),className:"border-amber-300/70 bg-amber-100/70 text-amber-800 dark:border-amber-500/40 dark:bg-amber-500/15 dark:text-amber-300",showDot:!0},seen:{label:t("updates.progressInReview"),className:"border-blue-300/70 bg-blue-100/70 text-blue-800 dark:border-blue-500/40 dark:bg-blue-500/15 dark:text-blue-300"},done:{label:t("updates.progressDone"),className:"border-emerald-300/70 bg-emerald-100/70 text-emerald-800 dark:border-emerald-500/40 dark:bg-emerald-500/15 dark:text-emerald-300"},dismissed:{label:t("updates.progressDismissed"),className:"border-muted-foreground/20 bg-muted text-muted-foreground dark:border-muted-foreground/30"}}[s];return e.jsxs(y,{variant:"outline",className:k("gap-1.5 border text-[10px] font-medium",d.className,a),children:[d.showDot&&e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-current"}),d.label]})}function ae({action:s}){const{t:a}=p();return e.jsxs("div",{className:"rounded-md border bg-muted/20 p-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 space-y-0.5",children:[e.jsx("p",{className:"text-sm font-medium",children:s.label}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.description})]}),s.type==="route"&&s.path&&e.jsx(x,{size:"sm",asChild:!0,children:e.jsxs(P,{to:s.path,children:[a("updates.open"),e.jsx(L,{className:"h-3.5 w-3.5"})]})})]}),s.type==="command"&&s.command&&e.jsxs("div",{className:"mt-2 flex items-center gap-2 rounded-md border bg-background px-2 py-1.5",children:[e.jsx(Q,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("code",{className:"min-w-0 flex-1 truncate text-[11px]",children:s.command}),e.jsx(E,{value:s.command})]})]})}function re({notice:s,progress:a,relatedEntries:t,onUpdateProgress:d}){const{t:l}=p();return s?e.jsxs("div",{className:"flex-1 min-w-0 bg-background grid grid-rows-[auto_minmax(0,1fr)] overflow-hidden",children:[e.jsxs("div",{className:"border-b bg-background px-4 py-3",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("h2",{className:"text-base font-semibold leading-tight",children:s.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.summary})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[a&&e.jsx(R,{state:a}),e.jsx(X,{status:s.status})]})]}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(q,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:l("updates.published",{date:M(s.publishedAt)})})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsxs(x,{size:"sm",onClick:()=>d("done"),children:[e.jsx(G,{className:"h-4 w-4"}),l("updates.markDone")]}),e.jsxs(x,{size:"sm",variant:"outline",onClick:()=>d("dismissed"),children:[e.jsx(J,{className:"h-4 w-4"}),l("updates.dismiss")]}),e.jsxs(x,{size:"sm",variant:"ghost",onClick:()=>d("new"),children:[e.jsx(V,{className:"h-4 w-4"}),l("updates.reopen")]})]})]}),e.jsx("div",{className:"min-h-0 p-4",children:e.jsxs("div",{className:"grid h-full gap-4 xl:grid-cols-[minmax(0,1.5fr)_minmax(320px,1fr)] overflow-hidden",children:[e.jsxs(g,{className:"h-full overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Y,{className:"h-4 w-4 text-primary"}),e.jsx(N,{className:"text-base",children:l("updates.doNext")})]}),e.jsx(w,{children:s.primaryAction})]}),e.jsx(v,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("div",{className:"space-y-3",children:s.actions.map(n=>e.jsx(ae,{action:n},`${s.id}-${n.id}`))})})})]}),e.jsxs("div",{className:"grid h-full grid-rows-[minmax(0,1fr)_minmax(0,1fr)] gap-4 overflow-hidden",children:[e.jsxs(g,{className:"overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsx(N,{className:"text-base",children:l("updates.impactedIntegrations")}),e.jsx(w,{children:l("updates.impactedDesc")})]}),e.jsx(v,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("div",{className:"space-y-2",children:t.map(n=>e.jsxs("div",{className:"rounded-md border bg-muted/20 p-2.5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("p",{className:"min-w-0 truncate text-sm font-medium",children:n.name}),e.jsx(y,{variant:"outline",className:"h-5 px-1.5 text-[10px]",children:U[n.scope]})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[n.routes[0]&&e.jsx(x,{size:"sm",variant:"outline",asChild:!0,children:e.jsx(P,{to:n.routes[0].path,children:n.routes[0].label})}),n.commands[0]&&e.jsxs("div",{className:"ml-auto flex min-w-0 items-center gap-1.5",children:[e.jsx("code",{className:"truncate rounded bg-background px-1.5 py-0.5 text-[11px]",children:n.commands[0]}),e.jsx(E,{value:n.commands[0]})]})]})]},n.id))})})})]}),e.jsxs(g,{className:"overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsx(N,{className:"text-base",children:l("updates.whyMatters")}),e.jsx(w,{children:l("updates.whyMattersDesc")})]}),e.jsx(v,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("ul",{className:"space-y-2 text-sm text-muted-foreground",children:s.highlights.map(n=>e.jsxs("li",{children:["- ",n]},`${s.id}-${n}`))})})})]})]})]})})]}):e.jsx("div",{className:"flex h-full items-center justify-center rounded-lg border border-dashed bg-muted/20 p-6",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:l("updates.noUpdates")})})}function te({notice:s,progress:a,selected:t,onSelect:d}){return e.jsxs("button",{type:"button",onClick:d,className:k("w-full rounded-lg border px-3 py-3 text-left transition-colors",t?"border-primary/30 bg-primary/10":"border-transparent bg-background/40 hover:border-border hover:bg-muted/70"),children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("p",{className:"truncate text-sm font-medium",children:s.title}),e.jsx("p",{className:"line-clamp-2 text-xs text-muted-foreground",children:s.primaryAction})]}),e.jsx(F,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"})]}),e.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-[11px] text-muted-foreground",children:M(s.publishedAt)}),e.jsx(R,{state:a})]})]})}function de(s,a){return a?[s.title,s.summary,s.primaryAction,...s.highlights,...s.commands,...s.actions.map(d=>`${d.label} ${d.description} ${d.command||""}`),...s.routes.map(d=>d.label)].join(" ").toLowerCase().includes(a):!0}function be(){const{t:s}=p(),a=o.useMemo(()=>[...$].sort((r,i)=>i.publishedAt.localeCompare(r.publishedAt)),[]),[t,d]=o.useState("inbox"),[l,n]=o.useState(""),[c,C]=o.useState(()=>ee()),[S,T]=o.useState(null);o.useEffect(()=>{se(c)},[c]);const h=o.useMemo(()=>{const r=l.trim().toLowerCase();return a.filter(i=>{const f=u(i,c);return de(i,r)?t==="done"?f==="done":t==="inbox"?A(f):!0:!1})},[a,c,l,t]),m=o.useMemo(()=>{const r=t==="all"?a:h;return r.find(i=>i.id===S)??r[0]??null},[a,S,t,h]),D=r=>{T(r.id),C(i=>u(r,i)!=="new"?i:{...i,[r.id]:"seen"})},O=o.useMemo(()=>a.filter(r=>A(u(r,c))).length,[a,c]),_=o.useMemo(()=>a.filter(r=>u(r,c)==="done").length,[a,c]);return e.jsxs("div",{className:"flex h-full min-h-0 overflow-hidden",children:[e.jsxs("div",{className:"w-80 border-r bg-muted/30 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b bg-background space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{className:"h-5 w-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:s("updates.inboxTitle")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("updates.inboxSubtitle")})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxs("div",{className:"rounded-md border bg-background px-2 py-1.5",children:[e.jsx("p",{className:"text-muted-foreground",children:s("updates.needsAction")}),e.jsx("p",{className:"text-base font-semibold",children:O})]}),e.jsxs("div",{className:"rounded-md border bg-background px-2 py-1.5",children:[e.jsx("p",{className:"text-muted-foreground",children:s("updates.doneCount")}),e.jsx("p",{className:"text-base font-semibold",children:_})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(K,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(z,{value:l,onChange:r=>n(r.target.value),placeholder:s("updates.searchPlaceholder"),className:"h-9 pl-8"})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:[{id:"inbox",label:s("updates.actionRequired")},{id:"done",label:s("updates.done")},{id:"all",label:s("updates.all")}].map(r=>e.jsx(x,{size:"sm",variant:t===r.id?"default":"outline",onClick:()=>d(r.id),children:r.label},r.id))})]}),e.jsx(b,{className:"flex-1",children:e.jsx("div",{className:"space-y-2 p-2",children:h.length===0?e.jsx("div",{className:"rounded-md border border-dashed p-3 text-xs text-muted-foreground",children:s("updates.noNotices")}):h.map(r=>e.jsx(te,{notice:r,progress:u(r,c),selected:m?.id===r.id,onSelect:()=>D(r)},r.id))})})]}),e.jsx(re,{notice:m,progress:m?u(m,c):null,relatedEntries:m?B(m):[],onUpdateProgress:r=>{m&&C(i=>({...i,[m.id]:r}))}})]})}export{be as UpdatesPage};
|
package/dist/ui/index.html
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap"
|
|
25
25
|
rel="stylesheet"
|
|
26
26
|
/>
|
|
27
|
-
<script type="module" crossorigin src="/assets/index-
|
|
27
|
+
<script type="module" crossorigin src="/assets/index-Cp06bK_W.js"></script>
|
|
28
28
|
<link rel="modulepreload" crossorigin href="/assets/react-vendor-CNOkPC89.js">
|
|
29
29
|
<link rel="modulepreload" crossorigin href="/assets/radix-ui-Zb8sVEtn.js">
|
|
30
30
|
<link rel="modulepreload" crossorigin href="/assets/tanstack-CrmUhA7Z.js">
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/web-server/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAGH,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/web-server/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAGH,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,IAAI,CAAC;AAUrC,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;IACpB,GAAG,EAAE,eAAe,CAAC;IACrB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAID;;GAEG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,CA2IjF"}
|
package/dist/web-server/index.js
CHANGED
|
@@ -41,6 +41,8 @@ const ws_1 = require("ws");
|
|
|
41
41
|
const websocket_1 = require("./websocket");
|
|
42
42
|
const auth_middleware_1 = require("./middleware/auth-middleware");
|
|
43
43
|
const request_logging_middleware_1 = require("./middleware/request-logging-middleware");
|
|
44
|
+
const managed_model_prefixes_1 = require("../cliproxy/managed-model-prefixes");
|
|
45
|
+
const proxy_target_resolver_1 = require("../cliproxy/proxy-target-resolver");
|
|
44
46
|
const sync_1 = require("../cliproxy/sync");
|
|
45
47
|
const aggregator_1 = require("./usage/aggregator");
|
|
46
48
|
const logging_1 = require("../services/logging");
|
|
@@ -113,6 +115,13 @@ async function startServer(options) {
|
|
|
113
115
|
const { cleanup: wsCleanup } = (0, websocket_1.setupWebSocket)(wss);
|
|
114
116
|
// Start auto-sync watcher (if enabled in config)
|
|
115
117
|
(0, sync_1.startAutoSyncWatcher)();
|
|
118
|
+
if (!(0, proxy_target_resolver_1.getProxyTarget)().isRemote) {
|
|
119
|
+
void (0, managed_model_prefixes_1.ensureManagedModelPrefixes)().catch((error) => {
|
|
120
|
+
logger.warn('cliproxy.prefix_sync_failed', 'Managed model prefix repair failed', {
|
|
121
|
+
error: error instanceof Error ? error.message : String(error),
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
}
|
|
116
125
|
// Combined cleanup function
|
|
117
126
|
const cleanup = () => {
|
|
118
127
|
wsCleanup();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/web-server/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,sDAA8B;AAC9B,gDAAwB;AACxB,gDAAwB;AACxB,2BAAqC;AACrC,2CAA6C;AAC7C,kEAAuF;AACvF,wFAAmF;AACnF,2CAA6E;AAC7E,mDAA6D;AAC7D,iDAAmD;AAenD,MAAM,MAAM,GAAG,IAAA,sBAAY,EAAC,YAAY,CAAC,CAAC;AAE1C;;GAEG;AACI,KAAK,UAAU,WAAW,CAAC,OAAsB;IACtD,MAAM,GAAG,GAAG,IAAA,iBAAO,GAAE,CAAC;IACtB,MAAM,MAAM,GAAG,cAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IACtC,MAAM,GAAG,GAAG,IAAI,oBAAe,CAAC;QAC9B,MAAM;QACN,IAAI,EAAE,KAAK;QACX,UAAU,EAAE,IAAI,GAAG,IAAI,EAAE,gCAAgC;QACzD,iBAAiB,EAAE,KAAK,EAAE,2BAA2B;KACtD,CAAC,CAAC;IAEH,0DAA0D;IAC1D,GAAG,CAAC,GAAG,CAAC,iBAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IACxB,GAAG,CAAC,GAAG,CACL,CACE,GAA+C,EAC/C,IAAqB,EACrB,GAAqB,EACrB,IAA0B,EAC1B,EAAE;QACF,IAAI,GAAG,YAAY,WAAW,IAAI,GAAG,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OAAO,kBAAkB,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC;IAC5E,CAAC;IAED,OAAO,KAAK,CAAC,OAAO,CAAC;AACvB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog-routes.d.ts","sourceRoot":"","sources":["../../../src/web-server/routes/catalog-routes.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,MAAM,4CAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"catalog-routes.d.ts","sourceRoot":"","sources":["../../../src/web-server/routes/catalog-routes.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,MAAM,4CAAW,CAAC;AAuBxB,eAAe,MAAM,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const express_1 = require("express");
|
|
4
|
-
const
|
|
4
|
+
const catalog_routing_1 = require("../../cliproxy/catalog-routing");
|
|
5
5
|
const router = (0, express_1.Router)();
|
|
6
6
|
/**
|
|
7
7
|
* GET /api/cliproxy/catalog - Get merged model catalogs
|
|
@@ -9,9 +9,10 @@ const router = (0, express_1.Router)();
|
|
|
9
9
|
*/
|
|
10
10
|
router.get('/', async (_req, res) => {
|
|
11
11
|
try {
|
|
12
|
-
const snapshot = await (0,
|
|
12
|
+
const snapshot = await (0, catalog_routing_1.getCatalogRoutingSnapshot)();
|
|
13
13
|
res.json({
|
|
14
14
|
catalogs: snapshot.catalogs,
|
|
15
|
+
routing: snapshot.routing,
|
|
15
16
|
source: snapshot.source,
|
|
16
17
|
cache: {
|
|
17
18
|
synced: snapshot.source !== 'static' || snapshot.cacheAge !== null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog-routes.js","sourceRoot":"","sources":["../../../src/web-server/routes/catalog-routes.ts"],"names":[],"mappings":";;AAAA,qCAAoD;AACpD,
|
|
1
|
+
{"version":3,"file":"catalog-routes.js","sourceRoot":"","sources":["../../../src/web-server/routes/catalog-routes.ts"],"names":[],"mappings":";;AAAA,qCAAoD;AACpD,oEAA2E;AAE3E,MAAM,MAAM,GAAG,IAAA,gBAAM,GAAE,CAAC;AAExB;;;GAGG;AACH,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,IAAa,EAAE,GAAa,EAAiB,EAAE;IACpE,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,IAAA,2CAAyB,GAAE,CAAC;QACnD,GAAG,CAAC,IAAI,CAAC;YACP,QAAQ,EAAE,QAAQ,CAAC,QAAQ;YAC3B,OAAO,EAAE,QAAQ,CAAC,OAAO;YACzB,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,KAAK,EAAE;gBACL,MAAM,EAAE,QAAQ,CAAC,MAAM,KAAK,QAAQ,IAAI,QAAQ,CAAC,QAAQ,KAAK,IAAI;gBAClE,GAAG,EAAE,QAAQ,CAAC,QAAQ;aACvB;SACF,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAG,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;IAC5D,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,kBAAe,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cliproxy-auth-routes.d.ts","sourceRoot":"","sources":["../../../src/web-server/routes/cliproxy-auth-routes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cliproxy-auth-routes.d.ts","sourceRoot":"","sources":["../../../src/web-server/routes/cliproxy-auth-routes.ts"],"names":[],"mappings":"AA4CA,OAAO,EAOL,cAAc,EAIf,MAAM,gCAAgC,CAAC;AAExC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAS7D,QAAA,MAAM,MAAM,4CAAW,CAAC;AA6JxB,wBAAgB,8BAA8B,CAAC,OAAO,EAAE;IACtD,UAAU,EAAE,cAAc,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAiBzC;AAED,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,CAAC,EAAE;IAAE,UAAU,CAAC,EAAE,cAAc,CAAA;CAAE,GACxC,MAAM,GAAG,IAAI,CAmBf;AAED,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,gBAAgB,GAAG,MAAM,CAK7E;AASD,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,gBAAgB,EAC1B,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,gBAAgB,EAAE,KAAK,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,EAC1D,sBAAsB,CAAC,EAAE,MAAM,GAC9B;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,kBAAkB,GAAG,iBAAiB,CAAA;CAAE,GAAG,IAAI,CAqBxE;AAg5BD,eAAe,MAAM,CAAC"}
|
|
@@ -9,6 +9,7 @@ const stats_fetcher_1 = require("../../cliproxy/stats-fetcher");
|
|
|
9
9
|
const account_manager_1 = require("../../cliproxy/account-manager");
|
|
10
10
|
const proxy_target_resolver_1 = require("../../cliproxy/proxy-target-resolver");
|
|
11
11
|
const remote_auth_fetcher_1 = require("../../cliproxy/remote-auth-fetcher");
|
|
12
|
+
const managed_model_prefixes_1 = require("../../cliproxy/managed-model-prefixes");
|
|
12
13
|
const unified_config_loader_1 = require("../../config/unified-config-loader");
|
|
13
14
|
const kiro_import_1 = require("../../cliproxy/auth/kiro-import");
|
|
14
15
|
const token_manager_1 = require("../../cliproxy/auth/token-manager");
|
|
@@ -517,6 +518,12 @@ router.post('/:provider/start', async (req, res) => {
|
|
|
517
518
|
noIncognito, // Kiro: use normal browser if enabled
|
|
518
519
|
});
|
|
519
520
|
if (account) {
|
|
521
|
+
try {
|
|
522
|
+
await (0, managed_model_prefixes_1.ensureManagedModelPrefixes)([account.provider]);
|
|
523
|
+
}
|
|
524
|
+
catch {
|
|
525
|
+
// Keep OAuth success path non-fatal when prefix repair cannot run.
|
|
526
|
+
}
|
|
520
527
|
res.json({
|
|
521
528
|
success: true,
|
|
522
529
|
account: {
|
|
@@ -789,7 +796,12 @@ router.get('/:provider/status', async (req, res) => {
|
|
|
789
796
|
});
|
|
790
797
|
return;
|
|
791
798
|
}
|
|
792
|
-
|
|
799
|
+
try {
|
|
800
|
+
await (0, managed_model_prefixes_1.ensureManagedModelPrefixes)([account.provider]);
|
|
801
|
+
}
|
|
802
|
+
catch {
|
|
803
|
+
// Keep manual callback success path non-fatal when prefix repair cannot run.
|
|
804
|
+
}
|
|
793
805
|
res.json({
|
|
794
806
|
status: 'ok',
|
|
795
807
|
account: {
|
|
@@ -800,6 +812,7 @@ router.get('/:provider/status', async (req, res) => {
|
|
|
800
812
|
isDefault: account.isDefault,
|
|
801
813
|
},
|
|
802
814
|
});
|
|
815
|
+
pendingManualAuthState.delete(state);
|
|
803
816
|
return;
|
|
804
817
|
}
|
|
805
818
|
res.json(data);
|
|
@@ -911,7 +924,12 @@ router.post('/:provider/submit-callback', async (req, res) => {
|
|
|
911
924
|
return;
|
|
912
925
|
}
|
|
913
926
|
if (parsed.state) {
|
|
914
|
-
|
|
927
|
+
try {
|
|
928
|
+
await (0, managed_model_prefixes_1.ensureManagedModelPrefixes)([account.provider]);
|
|
929
|
+
}
|
|
930
|
+
catch {
|
|
931
|
+
// Keep manual callback success path non-fatal when prefix repair cannot run.
|
|
932
|
+
}
|
|
915
933
|
}
|
|
916
934
|
res.json({
|
|
917
935
|
success: true,
|
|
@@ -923,6 +941,9 @@ router.post('/:provider/submit-callback', async (req, res) => {
|
|
|
923
941
|
isDefault: account.isDefault,
|
|
924
942
|
},
|
|
925
943
|
});
|
|
944
|
+
if (parsed.state) {
|
|
945
|
+
pendingManualAuthState.delete(parsed.state);
|
|
946
|
+
}
|
|
926
947
|
return;
|
|
927
948
|
}
|
|
928
949
|
const account = (0, token_manager_1.registerAccountFromToken)(localProvider, (0, token_manager_1.getProviderTokenDir)(localProvider), undefined, false, undefined);
|