@kaitranntt/ccs 7.68.1-dev.4 → 7.68.1-dev.5

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.
Files changed (88) hide show
  1. package/dist/commands/command-catalog.d.ts +1 -1
  2. package/dist/commands/command-catalog.d.ts.map +1 -1
  3. package/dist/commands/cursor-command-display.d.ts +2 -0
  4. package/dist/commands/cursor-command-display.d.ts.map +1 -1
  5. package/dist/commands/cursor-command-display.js +24 -3
  6. package/dist/commands/cursor-command-display.js.map +1 -1
  7. package/dist/commands/cursor-command.d.ts.map +1 -1
  8. package/dist/commands/cursor-command.js +31 -1
  9. package/dist/commands/cursor-command.js.map +1 -1
  10. package/dist/cursor/constants.d.ts +1 -1
  11. package/dist/cursor/constants.d.ts.map +1 -1
  12. package/dist/cursor/constants.js +1 -0
  13. package/dist/cursor/constants.js.map +1 -1
  14. package/dist/cursor/cursor-auth.d.ts +1 -0
  15. package/dist/cursor/cursor-auth.d.ts.map +1 -1
  16. package/dist/cursor/cursor-auth.js +154 -32
  17. package/dist/cursor/cursor-auth.js.map +1 -1
  18. package/dist/cursor/cursor-executor.d.ts +1 -1
  19. package/dist/cursor/cursor-executor.d.ts.map +1 -1
  20. package/dist/cursor/cursor-executor.js +295 -160
  21. package/dist/cursor/cursor-executor.js.map +1 -1
  22. package/dist/cursor/cursor-protobuf-decoder.d.ts.map +1 -1
  23. package/dist/cursor/cursor-protobuf-decoder.js +1 -3
  24. package/dist/cursor/cursor-protobuf-decoder.js.map +1 -1
  25. package/dist/cursor/cursor-protobuf-schema.d.ts +12 -3
  26. package/dist/cursor/cursor-protobuf-schema.d.ts.map +1 -1
  27. package/dist/cursor/cursor-protobuf-schema.js +23 -5
  28. package/dist/cursor/cursor-protobuf-schema.js.map +1 -1
  29. package/dist/cursor/cursor-protobuf.d.ts +1 -1
  30. package/dist/cursor/cursor-protobuf.d.ts.map +1 -1
  31. package/dist/cursor/cursor-protobuf.js +2 -4
  32. package/dist/cursor/cursor-protobuf.js.map +1 -1
  33. package/dist/cursor/cursor-runtime-probe.d.ts +12 -0
  34. package/dist/cursor/cursor-runtime-probe.d.ts.map +1 -0
  35. package/dist/cursor/cursor-runtime-probe.js +220 -0
  36. package/dist/cursor/cursor-runtime-probe.js.map +1 -0
  37. package/dist/cursor/cursor-stream-parser.d.ts +10 -0
  38. package/dist/cursor/cursor-stream-parser.d.ts.map +1 -1
  39. package/dist/cursor/cursor-stream-parser.js +106 -10
  40. package/dist/cursor/cursor-stream-parser.js.map +1 -1
  41. package/dist/cursor/index.d.ts +1 -0
  42. package/dist/cursor/index.d.ts.map +1 -1
  43. package/dist/cursor/index.js +3 -1
  44. package/dist/cursor/index.js.map +1 -1
  45. package/dist/cursor/types.d.ts +6 -0
  46. package/dist/cursor/types.d.ts.map +1 -1
  47. package/dist/ui/assets/{accounts-4Wxzh1pD.js → accounts-BohTElIQ.js} +1 -1
  48. package/dist/ui/assets/{alert-dialog-DGxGdNKD.js → alert-dialog-DnnexfUF.js} +1 -1
  49. package/dist/ui/assets/{api-DDTb78NK.js → api-DK9aBvwF.js} +1 -1
  50. package/dist/ui/assets/{auth-section-r5XbRAUy.js → auth-section-D1IqH1kL.js} +1 -1
  51. package/dist/ui/assets/{backups-section-CfhkSFYu.js → backups-section-Cizi6jcJ.js} +1 -1
  52. package/dist/ui/assets/{channels-CUNcGH3S.js → channels-1FDViA_G.js} +1 -1
  53. package/dist/ui/assets/{checkbox-Dhabke8C.js → checkbox-BrsI6T5h.js} +1 -1
  54. package/dist/ui/assets/{claude-extension-B7woSTcR.js → claude-extension-B_YasQSe.js} +1 -1
  55. package/dist/ui/assets/{cliproxy-0UypW7So.js → cliproxy-BGV6RvKO.js} +1 -1
  56. package/dist/ui/assets/{cliproxy-ai-providers-n7M1sRek.js → cliproxy-ai-providers-DOg-95GU.js} +1 -1
  57. package/dist/ui/assets/{cliproxy-control-panel-BfElGwOQ.js → cliproxy-control-panel-DrH2SYCZ.js} +1 -1
  58. package/dist/ui/assets/{codex-CP1dPOyh.js → codex-DHCsIPxy.js} +1 -1
  59. package/dist/ui/assets/{confirm-dialog-vhsQSaZ6.js → confirm-dialog-DW9epM6P.js} +1 -1
  60. package/dist/ui/assets/{copilot-DUTtEVYH.js → copilot-CKDZ98ee.js} +1 -1
  61. package/dist/ui/assets/cursor-BHg_ETJF.js +1 -0
  62. package/dist/ui/assets/{droid-mrP_PnYz.js → droid-CWS4dH8h.js} +1 -1
  63. package/dist/ui/assets/{globalenv-section-Gh2BxqVn.js → globalenv-section-DS-1Qpmy.js} +1 -1
  64. package/dist/ui/assets/{health-TGXaQNZq.js → health-DUOeRP2U.js} +1 -1
  65. package/dist/ui/assets/{index-CQIjTCyk.js → index-BFj6rbo3.js} +1 -1
  66. package/dist/ui/assets/{index-DSM3luVm.js → index-BzucrQW1.js} +15 -15
  67. package/dist/ui/assets/{index-DRXqBE1w.js → index-CZ74sbc0.js} +1 -1
  68. package/dist/ui/assets/{index-CaRCgIIp.js → index-CmO-DVIW.js} +1 -1
  69. package/dist/ui/assets/index-Cu6e0-ev.css +1 -0
  70. package/dist/ui/assets/{index-wYHVuydD.js → index-HX0cLD64.js} +1 -1
  71. package/dist/ui/assets/{index-CRAY9dRC.js → index-S2moP4X0.js} +1 -1
  72. package/dist/ui/assets/{logs-5mpClyQ2.js → logs-l8NsPQKy.js} +1 -1
  73. package/dist/ui/assets/{masked-input-DhWU9sNj.js → masked-input-ROSbNEnd.js} +1 -1
  74. package/dist/ui/assets/{proxy-status-widget-C1IFaC6c.js → proxy-status-widget-CXjMNmf4.js} +1 -1
  75. package/dist/ui/assets/{raw-json-settings-editor-panel-tK2P1u12.js → raw-json-settings-editor-panel-Baama5zh.js} +1 -1
  76. package/dist/ui/assets/{searchable-select-CNH0YBur.js → searchable-select-g1nEPDRJ.js} +1 -1
  77. package/dist/ui/assets/{separator-CJd089R0.js → separator-B019oPsV.js} +1 -1
  78. package/dist/ui/assets/{shared-DxH1omaN.js → shared-DNazuV_W.js} +1 -1
  79. package/dist/ui/assets/{table-lWkyktS-.js → table-DBOKGrcQ.js} +1 -1
  80. package/dist/ui/assets/{updates-nm2PIK8k.js → updates-B11W_hg3.js} +1 -1
  81. package/dist/ui/index.html +2 -2
  82. package/dist/web-server/routes/cursor-routes.d.ts +2 -0
  83. package/dist/web-server/routes/cursor-routes.d.ts.map +1 -1
  84. package/dist/web-server/routes/cursor-routes.js +44 -2
  85. package/dist/web-server/routes/cursor-routes.js.map +1 -1
  86. package/package.json +1 -1
  87. package/dist/ui/assets/cursor-ThAyj_tQ.js +0 -1
  88. package/dist/ui/assets/index-teLjoh2T.css +0 -1
@@ -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{by as ye,bz as be,bA as je,bB as Pe,bC as z,bD as te,bE as L,bF as $e,bG as We,c as W,B as H,d as Y,a as Oe,bx as _e,aW as De,bH as Ie,bI as Re,bJ as Fe,bK as Le,bL as Ue,bM as ze,bN 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-DSM3luVm.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-DGxGdNKD.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{bd as me,R as K,t as pt,s as xt,u as gt,A as ft,be as ht,bf as yt,bg as bt,X as jt,e as vt,bh as Nt,bi as St,U as wt,v as Ct,m as kt,w as At,aE as Et,T as ne,aO as Tt}from"./icons-KVCk4_U8.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+="&lt;",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{by as ye,bz as be,bA as je,bB as Pe,bC as z,bD as te,bE as L,bF as $e,bG as We,c as W,B as H,d as Y,a as Oe,bx as _e,aW as De,bH as Ie,bI as Re,bJ as Fe,bK as Le,bL as Ue,bM as ze,bN 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-BzucrQW1.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-DnnexfUF.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{bd as me,R as K,t as pt,s as xt,u as gt,A as ft,be as ht,bf as yt,bg as bt,X as jt,e as vt,bh as Nt,bi as St,U as wt,v as Ct,m as kt,w as At,aE as Et,T as ne,aO as Tt}from"./icons-KVCk4_U8.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+="&lt;",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,b8 as z,W as S}from"./index-DSM3luVm.js";import{aW as B,L as m,at as L,o as P,R as T}from"./icons-KVCk4_U8.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(B,{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(L,{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(P,{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(T,{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
+ 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,b8 as z,W as S}from"./index-BzucrQW1.js";import{aW as B,L as m,at as L,o as P,R as T}from"./icons-KVCk4_U8.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(B,{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(L,{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(P,{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(T,{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 _,f as P,d as $,c as w,g as B,I as G}from"./index-DSM3luVm.js";import{aQ as H,au as L,m as V}from"./icons-KVCk4_U8.js";function S(o){return o.trim().toLowerCase()}function M(o,h){return`${o}-option-${h.replace(/[^a-z0-9_-]+/gi,"-")}`}function Z({value:o,onChange:h,options:f,groups:g,placeholder:j,searchPlaceholder:k,emptyText:E,disabled:F,className:q,triggerClassName:K,contentClassName:R}){const[l,T]=a.useState(!1),[y,A]=a.useState(""),[i,c]=a.useState(),m=a.useId(),I=a.useRef(null),N=a.useRef({}),O=a.useMemo(()=>f.find(e=>e.value===o),[f,o]),d=a.useMemo(()=>{const e=S(y);return e?f.filter(t=>[t.searchText,...t.keywords??[]].some(u=>S(u).includes(e))):f},[f,y]),z=a.useMemo(()=>{const e=new Map((g??[]).map(r=>[r.key,r])),t=d.filter(r=>!r.groupKey||!e.has(r.groupKey)),u=(g??[]).map(r=>({...r,options:d.filter(x=>x.groupKey===r.key)})).filter(r=>r.options.length>0);return t.length===0?u:[{key:"__default",options:t},...u]},[d,g]),s=a.useMemo(()=>d.filter(e=>!e.disabled),[d]),D=O?.triggerContent??O?.itemContent,v=e=>{T(e),e||(A(""),c(void 0))},b=()=>I.current?.focus();a.useEffect(()=>{if(l){if(s.length===0){c(void 0);return}c(e=>e&&s.some(t=>t.value===e)?e:s.find(t=>t.value===o)?.value??s[0]?.value)}},[s,l,o]),a.useEffect(()=>{!l||!i||N.current[i]?.scrollIntoView({block:"nearest"})},[i,l]);const p=e=>{if(s.length===0)return;if(e==="first"){c(s[0]?.value);return}if(e==="last"){c(s.at(-1)?.value);return}const t=s.findIndex(U=>U.value===i),u=e==="next"?-1:s.length,r=t>=0?t:u,x=e==="next"?Math.min(r+1,s.length-1):Math.max(r-1,0);c(s[x]?.value)},C=e=>{h(e),v(!1)},Q=()=>{if(!i)return;const e=s.find(t=>t.value===i);e&&C(e.value)};return n.jsxs(_,{open:l,onOpenChange:v,children:[n.jsx(P,{asChild:!0,children:n.jsxs($,{type:"button",variant:"outline","aria-expanded":l,"aria-controls":l?m:void 0,"aria-haspopup":"dialog",disabled:F,onKeyDown:e=>{if(e.key!=="ArrowDown"&&e.key!=="ArrowUp")return;e.preventDefault(),v(!0);const t=()=>{b(),p(e.key==="ArrowDown"?"first":"last")};if(typeof requestAnimationFrame=="function"){requestAnimationFrame(t);return}setTimeout(t,0)},className:w("w-full justify-between font-normal",q,K,!D&&"text-muted-foreground"),children:[n.jsx("div",{className:"min-w-0 flex-1 text-left",children:D??n.jsx("span",{children:j})}),n.jsx(H,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),n.jsxs(B,{align:"start",className:w("w-[var(--radix-popover-trigger-width)] p-0",R),onOpenAutoFocus:e=>{if(e.preventDefault(),typeof requestAnimationFrame=="function"){requestAnimationFrame(b);return}setTimeout(b,0)},children:[n.jsx("div",{className:"border-b p-2",children:n.jsxs("div",{className:"relative",children:[n.jsx(L,{className:"text-muted-foreground absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2"}),n.jsx(G,{ref:I,value:y,onChange:e=>A(e.target.value),role:"combobox","aria-label":k,"aria-autocomplete":"list","aria-expanded":l,"aria-controls":m,"aria-activedescendant":i?M(m,i):void 0,onKeyDown:e=>{if(e.key==="ArrowDown"){e.preventDefault(),p("next");return}if(e.key==="ArrowUp"){e.preventDefault(),p("previous");return}if(e.key==="Home"){e.preventDefault(),p("first");return}if(e.key==="End"){e.preventDefault(),p("last");return}if(e.key==="Enter"){e.preventDefault(),Q();return}e.key==="Escape"&&(e.preventDefault(),v(!1))},placeholder:k,className:"pl-8"})]})}),n.jsx("div",{"data-slot":"searchable-select-scroll-container","data-testid":"searchable-select-scroll-container",className:"max-h-72 overflow-y-auto overscroll-contain",children:d.length===0?n.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:E}):n.jsx("div",{id:m,role:"listbox","aria-label":j,className:"p-1",children:z.map(e=>n.jsxs("div",{children:[e.label&&n.jsx("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:e.label}),e.options.map(t=>{const u=t.value===i,r=t.value===o;return n.jsxs("button",{id:M(m,t.value),type:"button",role:"option","aria-selected":r,disabled:t.disabled,tabIndex:-1,ref:x=>{N.current[t.value]=x},onMouseMove:()=>{t.disabled||c(t.value)},onFocus:()=>{t.disabled||c(t.value)},onClick:()=>C(t.value),className:w("hover:bg-accent hover:text-accent-foreground flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm outline-none","focus-visible:ring-ring focus-visible:ring-1",u&&"bg-accent text-accent-foreground",r&&"bg-accent text-accent-foreground",t.disabled&&"pointer-events-none opacity-50"),children:[n.jsx("div",{className:"min-w-0 flex-1",children:t.itemContent}),r&&n.jsx(V,{className:"h-4 w-4 shrink-0"})]},t.value)})]},e.key))})})]})]})}export{Z as S};
1
+ import{j as n}from"./radix-ui-Zb8sVEtn.js";import{r as a}from"./react-vendor-CNOkPC89.js";import{e as _,f as P,d as $,c as w,g as B,I as G}from"./index-BzucrQW1.js";import{aQ as H,au as L,m as V}from"./icons-KVCk4_U8.js";function S(o){return o.trim().toLowerCase()}function M(o,h){return`${o}-option-${h.replace(/[^a-z0-9_-]+/gi,"-")}`}function Z({value:o,onChange:h,options:f,groups:g,placeholder:j,searchPlaceholder:k,emptyText:E,disabled:F,className:q,triggerClassName:K,contentClassName:R}){const[l,T]=a.useState(!1),[y,A]=a.useState(""),[i,c]=a.useState(),m=a.useId(),I=a.useRef(null),N=a.useRef({}),O=a.useMemo(()=>f.find(e=>e.value===o),[f,o]),d=a.useMemo(()=>{const e=S(y);return e?f.filter(t=>[t.searchText,...t.keywords??[]].some(u=>S(u).includes(e))):f},[f,y]),z=a.useMemo(()=>{const e=new Map((g??[]).map(r=>[r.key,r])),t=d.filter(r=>!r.groupKey||!e.has(r.groupKey)),u=(g??[]).map(r=>({...r,options:d.filter(x=>x.groupKey===r.key)})).filter(r=>r.options.length>0);return t.length===0?u:[{key:"__default",options:t},...u]},[d,g]),s=a.useMemo(()=>d.filter(e=>!e.disabled),[d]),D=O?.triggerContent??O?.itemContent,v=e=>{T(e),e||(A(""),c(void 0))},b=()=>I.current?.focus();a.useEffect(()=>{if(l){if(s.length===0){c(void 0);return}c(e=>e&&s.some(t=>t.value===e)?e:s.find(t=>t.value===o)?.value??s[0]?.value)}},[s,l,o]),a.useEffect(()=>{!l||!i||N.current[i]?.scrollIntoView({block:"nearest"})},[i,l]);const p=e=>{if(s.length===0)return;if(e==="first"){c(s[0]?.value);return}if(e==="last"){c(s.at(-1)?.value);return}const t=s.findIndex(U=>U.value===i),u=e==="next"?-1:s.length,r=t>=0?t:u,x=e==="next"?Math.min(r+1,s.length-1):Math.max(r-1,0);c(s[x]?.value)},C=e=>{h(e),v(!1)},Q=()=>{if(!i)return;const e=s.find(t=>t.value===i);e&&C(e.value)};return n.jsxs(_,{open:l,onOpenChange:v,children:[n.jsx(P,{asChild:!0,children:n.jsxs($,{type:"button",variant:"outline","aria-expanded":l,"aria-controls":l?m:void 0,"aria-haspopup":"dialog",disabled:F,onKeyDown:e=>{if(e.key!=="ArrowDown"&&e.key!=="ArrowUp")return;e.preventDefault(),v(!0);const t=()=>{b(),p(e.key==="ArrowDown"?"first":"last")};if(typeof requestAnimationFrame=="function"){requestAnimationFrame(t);return}setTimeout(t,0)},className:w("w-full justify-between font-normal",q,K,!D&&"text-muted-foreground"),children:[n.jsx("div",{className:"min-w-0 flex-1 text-left",children:D??n.jsx("span",{children:j})}),n.jsx(H,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),n.jsxs(B,{align:"start",className:w("w-[var(--radix-popover-trigger-width)] p-0",R),onOpenAutoFocus:e=>{if(e.preventDefault(),typeof requestAnimationFrame=="function"){requestAnimationFrame(b);return}setTimeout(b,0)},children:[n.jsx("div",{className:"border-b p-2",children:n.jsxs("div",{className:"relative",children:[n.jsx(L,{className:"text-muted-foreground absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2"}),n.jsx(G,{ref:I,value:y,onChange:e=>A(e.target.value),role:"combobox","aria-label":k,"aria-autocomplete":"list","aria-expanded":l,"aria-controls":m,"aria-activedescendant":i?M(m,i):void 0,onKeyDown:e=>{if(e.key==="ArrowDown"){e.preventDefault(),p("next");return}if(e.key==="ArrowUp"){e.preventDefault(),p("previous");return}if(e.key==="Home"){e.preventDefault(),p("first");return}if(e.key==="End"){e.preventDefault(),p("last");return}if(e.key==="Enter"){e.preventDefault(),Q();return}e.key==="Escape"&&(e.preventDefault(),v(!1))},placeholder:k,className:"pl-8"})]})}),n.jsx("div",{"data-slot":"searchable-select-scroll-container","data-testid":"searchable-select-scroll-container",className:"max-h-72 overflow-y-auto overscroll-contain",children:d.length===0?n.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:E}):n.jsx("div",{id:m,role:"listbox","aria-label":j,className:"p-1",children:z.map(e=>n.jsxs("div",{children:[e.label&&n.jsx("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:e.label}),e.options.map(t=>{const u=t.value===i,r=t.value===o;return n.jsxs("button",{id:M(m,t.value),type:"button",role:"option","aria-selected":r,disabled:t.disabled,tabIndex:-1,ref:x=>{N.current[t.value]=x},onMouseMove:()=>{t.disabled||c(t.value)},onFocus:()=>{t.disabled||c(t.value)},onClick:()=>C(t.value),className:w("hover:bg-accent hover:text-accent-foreground flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm outline-none","focus-visible:ring-ring focus-visible:ring-1",u&&"bg-accent text-accent-foreground",r&&"bg-accent text-accent-foreground",t.disabled&&"pointer-events-none opacity-50"),children:[n.jsx("div",{className:"min-w-0 flex-1",children:t.itemContent}),r&&n.jsx(V,{className:"h-4 w-4 shrink-0"})]},t.value)})]},e.key))})})]})]})}export{Z as S};
@@ -1 +1 @@
1
- import{j as i,a0 as n}from"./radix-ui-Zb8sVEtn.js";import"./react-vendor-CNOkPC89.js";import{c as e}from"./index-DSM3luVm.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
+ import{j as i,a0 as n}from"./radix-ui-Zb8sVEtn.js";import"./react-vendor-CNOkPC89.js";import{c as e}from"./index-BzucrQW1.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,bm as ee,bn as se,bo as te,Q as ae,R as re,U as ne,B as $,be as S,bf as M,bg as L,d as I,I as le,n as B,c as U,C as ie,b as de}from"./index-DSM3luVm.js";import{a3 as ce,aa as oe,b7 as me,T as E,R as T,F as he,au as ue,w as xe}from"./icons-KVCk4_U8.js";import"./tanstack-CrmUhA7Z.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";function Se(){const{t:s}=Q(),[a,l]=j.useState("commands"),t={commands:s("sharedPage.commands"),skills:s("sharedPage.skills"),agents:s("sharedPage.agents")},[r,d]=j.useState(""),[n,o]=j.useState(null),{data:c,isError:h,error:p,refetch:w}=ee(),{data:m,isLoading:x,isFetching:y,isError:g,error:q,refetch:D}=se(a),N=m?.items??[],C=r.trim().toLowerCase(),b=r.trim(),u=j.useMemo(()=>{const i=m?.items??[];return C?i.filter(v=>[v.name,v.description,v.path].some(Y=>Y.toLowerCase().includes(C))):i},[m,C]),f=j.useMemo(()=>u.length===0?null:n?u.find(i=>i.path===n)??u[0]:u[0],[u,n]),{data:P,isLoading:O,isError:_,error:W,refetch:V}=te(a,f?.path??null),z=[{id:"commands",label:t.commands,icon:ce,count:c?.commands??0},{id:"skills",label:t.skills,icon:oe,count:c?.skills??0},{id:"agents",label:t.agents,icon:me,count:c?.agents??0}],H=z.reduce((i,v)=>i+v.count,0),K=!x&&!g&&N.length===0,Z=!x&&!g&&N.length>0&&u.length===0,G=A(p,"Shared item totals could not be loaded. Listing still works."),J=A(q,`Unable to fetch shared ${a}. Please try again.`),X=A(W,`Unable to load content for ${f?.name??"selected item"}.`);return e.jsxs("div",{className:"h-full overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"p-6 pb-4 space-y-3",children:[e.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-end lg:justify-between",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:s("sharedPage.title")}),e.jsx("p",{className:"text-muted-foreground",children:s("sharedPage.subtitle")})]}),e.jsx(ae,{value:a,onValueChange:i=>{l(i),d(""),o(null)},children:e.jsx(re,{className:"h-auto flex-wrap justify-start",children:z.map(i=>e.jsxs(ne,{value:i.id,className:"flex items-center gap-2",children:[e.jsx(i.icon,{className:"w-4 h-4"}),e.jsx("span",{children:i.label}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",i.count,")"]})]},i.id))})})]}),e.jsxs("div",{className:"flex flex-col gap-2 lg:items-end",children:[e.jsxs("div",{className:"grid w-full gap-2 sm:w-auto sm:min-w-[340px] sm:grid-cols-3",children:[e.jsx(F,{label:s("sharedPage.totalShared"),value:H}),e.jsx(F,{label:t[a],value:N.length}),e.jsx(F,{label:s("sharedPage.visible"),value:u.length})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx($,{variant:"secondary",children:s("sharedPage.markdownDetail")}),b?e.jsxs($,{variant:"outline",children:[s("sharedPage.filterPrefix")," ",b]}):null]})]})]}),c&&!c.symlinkStatus.valid&&e.jsxs(S,{variant:"warning",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx(M,{children:s("sharedPage.configurationRequired")}),e.jsxs(L,{children:[c.symlinkStatus.message,". Run `ccs sync` to configure."]})]}),h&&e.jsxs(S,{variant:"info",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx(M,{children:s("sharedPage.countsUnavailable")}),e.jsxs(L,{children:[e.jsx("p",{children:G}),e.jsx("div",{className:"mt-3",children:e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>{w()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retryCounts")]})})]})]})]}),e.jsx("div",{className:"flex-1 min-h-0 px-6 pb-6",children:e.jsx("div",{className:"h-full rounded-lg border overflow-hidden bg-background",children:e.jsxs("div",{className:"grid h-full min-h-0 lg:grid-cols-[320px_minmax(0,1fr)]",children:[e.jsxs("div",{className:"min-h-0 border-b lg:border-b-0 lg:border-r flex flex-col bg-muted/30",children:[e.jsxs("div",{className:"p-4 border-b bg-background space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(he,{className:"w-4 h-4 text-primary shrink-0"}),e.jsx("h2",{className:"font-semibold truncate",children:t[a]})]}),!x&&!g&&e.jsxs($,{variant:"outline",className:"text-[10px] h-5",children:[u.length,"/",N.length]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(ue,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(le,{value:r,onChange:i=>d(i.target.value),placeholder:s("sharedPage.filterPlaceholder",{tab:a}),"aria-label":s("sharedPage.filterPlaceholder",{tab:a}),className:"pl-8 h-9"})]}),!x&&!g&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s("sharedPage.showing",{visible:u.length,total:N.length,tab:a}),b?s("sharedPage.showingQuery",{query:b}):"",y?s("sharedPage.refreshing"):""]})]}),e.jsx(B,{className:"flex-1 min-h-0",children:x?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.loadingShared",{tab:a})}):g?e.jsx("div",{className:"p-4 text-center",children:e.jsxs("div",{className:"space-y-3 py-8",children:[e.jsx(xe,{className:"w-10 h-10 mx-auto text-destructive/50"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:s("sharedPage.failedLoadShared",{tab:a})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:J})]}),e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>{D()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retry")]})]})}):K?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.noSharedFound",{tab:a})}):Z?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.noMatch",{tab:a,query:b})}):e.jsx("div",{className:"p-2 space-y-1",children:u.map(i=>e.jsxs("button",{type:"button",onClick:()=>o(i.path),className:U("w-full text-left p-3 rounded-md border transition-colors",f?.path===i.path?"bg-primary/10 border-primary/30":"bg-background hover:bg-muted border-transparent"),children:[e.jsx("p",{className:"text-sm font-medium truncate",children:i.name}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:i.description}),e.jsx("p",{className:"text-[11px] text-muted-foreground/90 mt-2 font-mono truncate",children:i.path})]},`${i.type}:${i.path}`))})})]}),e.jsx("div",{className:"min-w-0 min-h-0 flex flex-col bg-muted/20",children:f?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-4 py-3 border-b bg-background",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-base font-semibold truncate",children:f.name}),e.jsx($,{variant:"outline",className:"uppercase text-[10px]",children:f.type})]})}),e.jsxs("div",{className:"p-4 space-y-4 min-h-0 flex-1 flex flex-col",children:[e.jsx("div",{className:"rounded-md border bg-muted/35 p-3",children:e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-3",children:[e.jsx(R,{label:s("sharedPage.pathLabel"),value:f.path,mono:!0}),P?.contentPath&&P.contentPath!==f.path&&e.jsx(R,{label:s("sharedPage.resolvedSource"),value:P.contentPath,mono:!0})]})}),e.jsx(ie,{className:"min-h-0 flex-1",children:e.jsx(de,{className:"p-0 h-full",children:e.jsx(B,{className:"h-full px-5 py-4",children:O?e.jsx("p",{className:"text-sm text-muted-foreground",children:s("sharedPage.loadingMarkdown")}):_?e.jsxs(S,{variant:"destructive",className:"max-w-2xl",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx(M,{children:s("sharedPage.failedLoadContent")}),e.jsxs(L,{children:[e.jsx("p",{children:X}),e.jsx("div",{className:"mt-3",children:e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>{V()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retryContent")]})})]})]}):e.jsx(pe,{content:P?.content??""})})})})]})]}):e.jsx("div",{className:"min-h-[320px] flex items-center justify-center p-6 text-center text-muted-foreground",children:s("sharedPage.selectOne",{tab:a.slice(0,-1)})})})]})})})]})}function F({label:s,value:a}){return e.jsxs("div",{className:"rounded-md border bg-muted/30 px-3 py-2",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:s}),e.jsx("p",{className:"text-lg font-semibold leading-tight mt-1",children:a})]})}function R({label:s,value:a,mono:l=!1}){return e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:s}),e.jsx("p",{className:U("text-xs mt-1 break-words",l?"font-mono":"text-sm"),children:a})]})}function A(s,a){if(!(s instanceof Error))return a;const l=s.message.toLowerCase();return l.includes("failed to fetch")||l.includes("network")?"Connection to dashboard server lost or restarting. Keep `ccs config` running, then retry.":s.message||a}function pe({content:s}){const{t:a}=Q(),l=j.useMemo(()=>fe(s),[s]);return l.blocks.length===0&&l.frontmatter.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:a("sharedPage.noMarkdown")}):e.jsxs("div",{className:"space-y-5",children:[l.frontmatter.length>0?e.jsx("div",{className:"rounded-md border bg-muted/35 p-3",children:e.jsx("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-3",children:l.frontmatter.map(t=>e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:ge(t.key)}),e.jsx("p",{className:"text-xs mt-1 break-words",children:t.value})]},`${t.key}:${t.value}`))})}):null,l.blocks.map((t,r)=>{if(t.type==="heading"){const d=t.level<=1?"text-xl font-semibold":t.level===2?"text-lg font-semibold":"text-base font-semibold";return e.jsx("h3",{className:d,children:k(t.text,`heading-${r}`)},`heading-${r}`)}return t.type==="paragraph"?e.jsx("p",{className:"text-sm leading-6 whitespace-pre-wrap",children:k(t.text,`paragraph-${r}`)},`paragraph-${r}`):t.type==="unordered-list"?e.jsx("ul",{className:"list-disc pl-5 space-y-1 text-sm leading-6",children:t.items.map((d,n)=>e.jsx("li",{children:k(d,`ul-item-${r}-${n}`)},`ul-item-${r}-${n}`))},`ul-${r}`):t.type==="ordered-list"?e.jsx("ol",{className:"list-decimal pl-5 space-y-1 text-sm leading-6",children:t.items.map((d,n)=>e.jsx("li",{children:k(d,`ol-item-${r}-${n}`)},`ol-item-${r}-${n}`))},`ol-${r}`):e.jsxs("div",{className:"rounded-md border bg-muted/60 p-3 font-mono text-xs leading-5 overflow-x-auto",children:[t.language&&e.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground mb-2",children:t.language}),e.jsx("pre",{className:"whitespace-pre-wrap break-words m-0",children:t.content})]},`code-${r}`)})]})}function ge(s){return s.replace(/[-_]/g," ")}function k(s,a){const l=/(\*\*([^*]+)\*\*|`([^`]+)`|\*([^*]+)\*|\[([^\]]+)\]\(([^)]+)\))/g,t=[];let r=0,d=0;for(const n of s.matchAll(l)){const o=n[0],c=n.index??0;if(c>r&&t.push(s.slice(r,c)),n[2])t.push(e.jsx("strong",{className:"font-semibold",children:n[2]},`${a}-strong-${d}`));else if(n[3])t.push(e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[0.82em]",children:n[3]},`${a}-code-${d}`));else if(n[4])t.push(e.jsx("em",{className:"italic",children:n[4]},`${a}-em-${d}`));else if(n[5]&&n[6]){const h=n[6].trim();/^(https?:\/\/|mailto:)/i.test(h)?t.push(e.jsx("a",{href:h,target:"_blank",rel:"noreferrer",className:"text-primary underline underline-offset-2 hover:opacity-90",children:n[5]},`${a}-link-${d}`)):t.push(n[5])}else t.push(o);r=c+o.length,d+=1}return r<s.length&&t.push(s.slice(r)),t.length===0?[s]:t}function fe(s){const a=s.replace(/\r\n/g,`
1
+ import{j as e}from"./radix-ui-Zb8sVEtn.js";import{r as j}from"./react-vendor-CNOkPC89.js";import{a as Q,bm as ee,bn as se,bo as te,Q as ae,R as re,U as ne,B as $,be as S,bf as M,bg as L,d as I,I as le,n as B,c as U,C as ie,b as de}from"./index-BzucrQW1.js";import{a3 as ce,aa as oe,b7 as me,T as E,R as T,F as he,au as ue,w as xe}from"./icons-KVCk4_U8.js";import"./tanstack-CrmUhA7Z.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";function Se(){const{t:s}=Q(),[a,l]=j.useState("commands"),t={commands:s("sharedPage.commands"),skills:s("sharedPage.skills"),agents:s("sharedPage.agents")},[r,d]=j.useState(""),[n,o]=j.useState(null),{data:c,isError:h,error:p,refetch:w}=ee(),{data:m,isLoading:x,isFetching:y,isError:g,error:q,refetch:D}=se(a),N=m?.items??[],C=r.trim().toLowerCase(),b=r.trim(),u=j.useMemo(()=>{const i=m?.items??[];return C?i.filter(v=>[v.name,v.description,v.path].some(Y=>Y.toLowerCase().includes(C))):i},[m,C]),f=j.useMemo(()=>u.length===0?null:n?u.find(i=>i.path===n)??u[0]:u[0],[u,n]),{data:P,isLoading:O,isError:_,error:W,refetch:V}=te(a,f?.path??null),z=[{id:"commands",label:t.commands,icon:ce,count:c?.commands??0},{id:"skills",label:t.skills,icon:oe,count:c?.skills??0},{id:"agents",label:t.agents,icon:me,count:c?.agents??0}],H=z.reduce((i,v)=>i+v.count,0),K=!x&&!g&&N.length===0,Z=!x&&!g&&N.length>0&&u.length===0,G=A(p,"Shared item totals could not be loaded. Listing still works."),J=A(q,`Unable to fetch shared ${a}. Please try again.`),X=A(W,`Unable to load content for ${f?.name??"selected item"}.`);return e.jsxs("div",{className:"h-full overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"p-6 pb-4 space-y-3",children:[e.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-end lg:justify-between",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:s("sharedPage.title")}),e.jsx("p",{className:"text-muted-foreground",children:s("sharedPage.subtitle")})]}),e.jsx(ae,{value:a,onValueChange:i=>{l(i),d(""),o(null)},children:e.jsx(re,{className:"h-auto flex-wrap justify-start",children:z.map(i=>e.jsxs(ne,{value:i.id,className:"flex items-center gap-2",children:[e.jsx(i.icon,{className:"w-4 h-4"}),e.jsx("span",{children:i.label}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",i.count,")"]})]},i.id))})})]}),e.jsxs("div",{className:"flex flex-col gap-2 lg:items-end",children:[e.jsxs("div",{className:"grid w-full gap-2 sm:w-auto sm:min-w-[340px] sm:grid-cols-3",children:[e.jsx(F,{label:s("sharedPage.totalShared"),value:H}),e.jsx(F,{label:t[a],value:N.length}),e.jsx(F,{label:s("sharedPage.visible"),value:u.length})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx($,{variant:"secondary",children:s("sharedPage.markdownDetail")}),b?e.jsxs($,{variant:"outline",children:[s("sharedPage.filterPrefix")," ",b]}):null]})]})]}),c&&!c.symlinkStatus.valid&&e.jsxs(S,{variant:"warning",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx(M,{children:s("sharedPage.configurationRequired")}),e.jsxs(L,{children:[c.symlinkStatus.message,". Run `ccs sync` to configure."]})]}),h&&e.jsxs(S,{variant:"info",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx(M,{children:s("sharedPage.countsUnavailable")}),e.jsxs(L,{children:[e.jsx("p",{children:G}),e.jsx("div",{className:"mt-3",children:e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>{w()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retryCounts")]})})]})]})]}),e.jsx("div",{className:"flex-1 min-h-0 px-6 pb-6",children:e.jsx("div",{className:"h-full rounded-lg border overflow-hidden bg-background",children:e.jsxs("div",{className:"grid h-full min-h-0 lg:grid-cols-[320px_minmax(0,1fr)]",children:[e.jsxs("div",{className:"min-h-0 border-b lg:border-b-0 lg:border-r flex flex-col bg-muted/30",children:[e.jsxs("div",{className:"p-4 border-b bg-background space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(he,{className:"w-4 h-4 text-primary shrink-0"}),e.jsx("h2",{className:"font-semibold truncate",children:t[a]})]}),!x&&!g&&e.jsxs($,{variant:"outline",className:"text-[10px] h-5",children:[u.length,"/",N.length]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(ue,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(le,{value:r,onChange:i=>d(i.target.value),placeholder:s("sharedPage.filterPlaceholder",{tab:a}),"aria-label":s("sharedPage.filterPlaceholder",{tab:a}),className:"pl-8 h-9"})]}),!x&&!g&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s("sharedPage.showing",{visible:u.length,total:N.length,tab:a}),b?s("sharedPage.showingQuery",{query:b}):"",y?s("sharedPage.refreshing"):""]})]}),e.jsx(B,{className:"flex-1 min-h-0",children:x?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.loadingShared",{tab:a})}):g?e.jsx("div",{className:"p-4 text-center",children:e.jsxs("div",{className:"space-y-3 py-8",children:[e.jsx(xe,{className:"w-10 h-10 mx-auto text-destructive/50"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:s("sharedPage.failedLoadShared",{tab:a})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:J})]}),e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>{D()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retry")]})]})}):K?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.noSharedFound",{tab:a})}):Z?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.noMatch",{tab:a,query:b})}):e.jsx("div",{className:"p-2 space-y-1",children:u.map(i=>e.jsxs("button",{type:"button",onClick:()=>o(i.path),className:U("w-full text-left p-3 rounded-md border transition-colors",f?.path===i.path?"bg-primary/10 border-primary/30":"bg-background hover:bg-muted border-transparent"),children:[e.jsx("p",{className:"text-sm font-medium truncate",children:i.name}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:i.description}),e.jsx("p",{className:"text-[11px] text-muted-foreground/90 mt-2 font-mono truncate",children:i.path})]},`${i.type}:${i.path}`))})})]}),e.jsx("div",{className:"min-w-0 min-h-0 flex flex-col bg-muted/20",children:f?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-4 py-3 border-b bg-background",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-base font-semibold truncate",children:f.name}),e.jsx($,{variant:"outline",className:"uppercase text-[10px]",children:f.type})]})}),e.jsxs("div",{className:"p-4 space-y-4 min-h-0 flex-1 flex flex-col",children:[e.jsx("div",{className:"rounded-md border bg-muted/35 p-3",children:e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-3",children:[e.jsx(R,{label:s("sharedPage.pathLabel"),value:f.path,mono:!0}),P?.contentPath&&P.contentPath!==f.path&&e.jsx(R,{label:s("sharedPage.resolvedSource"),value:P.contentPath,mono:!0})]})}),e.jsx(ie,{className:"min-h-0 flex-1",children:e.jsx(de,{className:"p-0 h-full",children:e.jsx(B,{className:"h-full px-5 py-4",children:O?e.jsx("p",{className:"text-sm text-muted-foreground",children:s("sharedPage.loadingMarkdown")}):_?e.jsxs(S,{variant:"destructive",className:"max-w-2xl",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx(M,{children:s("sharedPage.failedLoadContent")}),e.jsxs(L,{children:[e.jsx("p",{children:X}),e.jsx("div",{className:"mt-3",children:e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>{V()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retryContent")]})})]})]}):e.jsx(pe,{content:P?.content??""})})})})]})]}):e.jsx("div",{className:"min-h-[320px] flex items-center justify-center p-6 text-center text-muted-foreground",children:s("sharedPage.selectOne",{tab:a.slice(0,-1)})})})]})})})]})}function F({label:s,value:a}){return e.jsxs("div",{className:"rounded-md border bg-muted/30 px-3 py-2",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:s}),e.jsx("p",{className:"text-lg font-semibold leading-tight mt-1",children:a})]})}function R({label:s,value:a,mono:l=!1}){return e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:s}),e.jsx("p",{className:U("text-xs mt-1 break-words",l?"font-mono":"text-sm"),children:a})]})}function A(s,a){if(!(s instanceof Error))return a;const l=s.message.toLowerCase();return l.includes("failed to fetch")||l.includes("network")?"Connection to dashboard server lost or restarting. Keep `ccs config` running, then retry.":s.message||a}function pe({content:s}){const{t:a}=Q(),l=j.useMemo(()=>fe(s),[s]);return l.blocks.length===0&&l.frontmatter.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:a("sharedPage.noMarkdown")}):e.jsxs("div",{className:"space-y-5",children:[l.frontmatter.length>0?e.jsx("div",{className:"rounded-md border bg-muted/35 p-3",children:e.jsx("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-3",children:l.frontmatter.map(t=>e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:ge(t.key)}),e.jsx("p",{className:"text-xs mt-1 break-words",children:t.value})]},`${t.key}:${t.value}`))})}):null,l.blocks.map((t,r)=>{if(t.type==="heading"){const d=t.level<=1?"text-xl font-semibold":t.level===2?"text-lg font-semibold":"text-base font-semibold";return e.jsx("h3",{className:d,children:k(t.text,`heading-${r}`)},`heading-${r}`)}return t.type==="paragraph"?e.jsx("p",{className:"text-sm leading-6 whitespace-pre-wrap",children:k(t.text,`paragraph-${r}`)},`paragraph-${r}`):t.type==="unordered-list"?e.jsx("ul",{className:"list-disc pl-5 space-y-1 text-sm leading-6",children:t.items.map((d,n)=>e.jsx("li",{children:k(d,`ul-item-${r}-${n}`)},`ul-item-${r}-${n}`))},`ul-${r}`):t.type==="ordered-list"?e.jsx("ol",{className:"list-decimal pl-5 space-y-1 text-sm leading-6",children:t.items.map((d,n)=>e.jsx("li",{children:k(d,`ol-item-${r}-${n}`)},`ol-item-${r}-${n}`))},`ol-${r}`):e.jsxs("div",{className:"rounded-md border bg-muted/60 p-3 font-mono text-xs leading-5 overflow-x-auto",children:[t.language&&e.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground mb-2",children:t.language}),e.jsx("pre",{className:"whitespace-pre-wrap break-words m-0",children:t.content})]},`code-${r}`)})]})}function ge(s){return s.replace(/[-_]/g," ")}function k(s,a){const l=/(\*\*([^*]+)\*\*|`([^`]+)`|\*([^*]+)\*|\[([^\]]+)\]\(([^)]+)\))/g,t=[];let r=0,d=0;for(const n of s.matchAll(l)){const o=n[0],c=n.index??0;if(c>r&&t.push(s.slice(r,c)),n[2])t.push(e.jsx("strong",{className:"font-semibold",children:n[2]},`${a}-strong-${d}`));else if(n[3])t.push(e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[0.82em]",children:n[3]},`${a}-code-${d}`));else if(n[4])t.push(e.jsx("em",{className:"italic",children:n[4]},`${a}-em-${d}`));else if(n[5]&&n[6]){const h=n[6].trim();/^(https?:\/\/|mailto:)/i.test(h)?t.push(e.jsx("a",{href:h,target:"_blank",rel:"noreferrer",className:"text-primary underline underline-offset-2 hover:opacity-90",children:n[5]},`${a}-link-${d}`)):t.push(n[5])}else t.push(o);r=c+o.length,d+=1}return r<s.length&&t.push(s.slice(r)),t.length===0?[s]:t}function fe(s){const a=s.replace(/\r\n/g,`
2
2
  `).trim();if(!a)return{blocks:[],frontmatter:[]};let l=a;const t=[];if(l.startsWith(`---
3
3
  `)){const r=l.indexOf(`
4
4
  ---
@@ -1 +1 @@
1
- import{j as t}from"./radix-ui-Zb8sVEtn.js";import"./react-vendor-CNOkPC89.js";import{c as l}from"./index-DSM3luVm.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
+ import{j as t}from"./radix-ui-Zb8sVEtn.js";import"./react-vendor-CNOkPC89.js";import{c as l}from"./index-BzucrQW1.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,bp as M,C as g,j,k as N,_ as w,b as v,n as b,bq as U,br as $,I as z,bs as B}from"./index-DSM3luVm.js";import{a1 as L,$ as Q,b8 as q,x as G,E as J,Q as V,aa as Y,C as F,b9 as H,au as K}from"./icons-KVCk4_U8.js";import"./tanstack-CrmUhA7Z.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";const W={new:"border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-900/50 dark:bg-blue-900/20 dark:text-blue-300",stable:"border-green-200 bg-green-50 text-green-700 dark:border-green-900/50 dark:bg-green-900/20 dark:text-green-300",planned:"border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-900/50 dark:bg-amber-900/20 dark:text-amber-300"};function X({status:s,className:a}){const{t}=p(),d={new:t("updates.statusNew"),stable:t("updates.statusStable"),planned:t("updates.statusPlanned")};return e.jsx(y,{variant:"outline",className:k("font-medium",W[s],a),children:d[s]})}const I="ccs:updates:notice-progress:v1";function Z(s){return s==="new"?"new":"seen"}function u(s,a){return a[s.id]??Z(s.status)}function A(s){return s!=="done"&&s!=="dismissed"}function ee(){if(typeof window>"u")return{};try{const s=window.localStorage.getItem(I);if(!s)return{};const a=JSON.parse(s);if(!a||typeof a!="object"||Array.isArray(a))return{};const t={};for(const[d,l]of Object.entries(a))typeof d=="string"&&(l==="new"||l==="seen"||l==="done"||l==="dismissed")&&(t[d]=l);return t}catch{return{}}}function se(s){typeof window>"u"||window.localStorage.setItem(I,JSON.stringify(s))}function R({state:s,className:a}){const{t}=p(),d={new:{label:t("updates.progressNeedsAction"),className:"border-amber-300/70 bg-amber-100/70 text-amber-800 dark:border-amber-500/40 dark:bg-amber-500/15 dark:text-amber-300",showDot:!0},seen:{label:t("updates.progressInReview"),className:"border-blue-300/70 bg-blue-100/70 text-blue-800 dark:border-blue-500/40 dark:bg-blue-500/15 dark:text-blue-300"},done:{label:t("updates.progressDone"),className:"border-emerald-300/70 bg-emerald-100/70 text-emerald-800 dark:border-emerald-500/40 dark:bg-emerald-500/15 dark:text-emerald-300"},dismissed:{label:t("updates.progressDismissed"),className:"border-muted-foreground/20 bg-muted text-muted-foreground dark:border-muted-foreground/30"}}[s];return e.jsxs(y,{variant:"outline",className:k("gap-1.5 border text-[10px] font-medium",d.className,a),children:[d.showDot&&e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-current"}),d.label]})}function ae({action:s}){const{t:a}=p();return e.jsxs("div",{className:"rounded-md border bg-muted/20 p-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 space-y-0.5",children:[e.jsx("p",{className:"text-sm font-medium",children:s.label}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.description})]}),s.type==="route"&&s.path&&e.jsx(x,{size:"sm",asChild:!0,children:e.jsxs(P,{to:s.path,children:[a("updates.open"),e.jsx(L,{className:"h-3.5 w-3.5"})]})})]}),s.type==="command"&&s.command&&e.jsxs("div",{className:"mt-2 flex items-center gap-2 rounded-md border bg-background px-2 py-1.5",children:[e.jsx(Q,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("code",{className:"min-w-0 flex-1 truncate text-[11px]",children:s.command}),e.jsx(E,{value:s.command})]})]})}function re({notice:s,progress:a,relatedEntries:t,onUpdateProgress:d}){const{t:l}=p();return s?e.jsxs("div",{className:"flex-1 min-w-0 bg-background grid grid-rows-[auto_minmax(0,1fr)] overflow-hidden",children:[e.jsxs("div",{className:"border-b bg-background px-4 py-3",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("h2",{className:"text-base font-semibold leading-tight",children:s.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.summary})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[a&&e.jsx(R,{state:a}),e.jsx(X,{status:s.status})]})]}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(q,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:l("updates.published",{date:M(s.publishedAt)})})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsxs(x,{size:"sm",onClick:()=>d("done"),children:[e.jsx(G,{className:"h-4 w-4"}),l("updates.markDone")]}),e.jsxs(x,{size:"sm",variant:"outline",onClick:()=>d("dismissed"),children:[e.jsx(J,{className:"h-4 w-4"}),l("updates.dismiss")]}),e.jsxs(x,{size:"sm",variant:"ghost",onClick:()=>d("new"),children:[e.jsx(V,{className:"h-4 w-4"}),l("updates.reopen")]})]})]}),e.jsx("div",{className:"min-h-0 p-4",children:e.jsxs("div",{className:"grid h-full gap-4 xl:grid-cols-[minmax(0,1.5fr)_minmax(320px,1fr)] overflow-hidden",children:[e.jsxs(g,{className:"h-full overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Y,{className:"h-4 w-4 text-primary"}),e.jsx(N,{className:"text-base",children:l("updates.doNext")})]}),e.jsx(w,{children:s.primaryAction})]}),e.jsx(v,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("div",{className:"space-y-3",children:s.actions.map(n=>e.jsx(ae,{action:n},`${s.id}-${n.id}`))})})})]}),e.jsxs("div",{className:"grid h-full grid-rows-[minmax(0,1fr)_minmax(0,1fr)] gap-4 overflow-hidden",children:[e.jsxs(g,{className:"overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsx(N,{className:"text-base",children:l("updates.impactedIntegrations")}),e.jsx(w,{children:l("updates.impactedDesc")})]}),e.jsx(v,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("div",{className:"space-y-2",children:t.map(n=>e.jsxs("div",{className:"rounded-md border bg-muted/20 p-2.5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("p",{className:"min-w-0 truncate text-sm font-medium",children:n.name}),e.jsx(y,{variant:"outline",className:"h-5 px-1.5 text-[10px]",children:U[n.scope]})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[n.routes[0]&&e.jsx(x,{size:"sm",variant:"outline",asChild:!0,children:e.jsx(P,{to:n.routes[0].path,children:n.routes[0].label})}),n.commands[0]&&e.jsxs("div",{className:"ml-auto flex min-w-0 items-center gap-1.5",children:[e.jsx("code",{className:"truncate rounded bg-background px-1.5 py-0.5 text-[11px]",children:n.commands[0]}),e.jsx(E,{value:n.commands[0]})]})]})]},n.id))})})})]}),e.jsxs(g,{className:"overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsx(N,{className:"text-base",children:l("updates.whyMatters")}),e.jsx(w,{children:l("updates.whyMattersDesc")})]}),e.jsx(v,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("ul",{className:"space-y-2 text-sm text-muted-foreground",children:s.highlights.map(n=>e.jsxs("li",{children:["- ",n]},`${s.id}-${n}`))})})})]})]})]})})]}):e.jsx("div",{className:"flex h-full items-center justify-center rounded-lg border border-dashed bg-muted/20 p-6",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:l("updates.noUpdates")})})}function te({notice:s,progress:a,selected:t,onSelect:d}){return e.jsxs("button",{type:"button",onClick:d,className:k("w-full rounded-lg border px-3 py-3 text-left transition-colors",t?"border-primary/30 bg-primary/10":"border-transparent bg-background/40 hover:border-border hover:bg-muted/70"),children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("p",{className:"truncate text-sm font-medium",children:s.title}),e.jsx("p",{className:"line-clamp-2 text-xs text-muted-foreground",children:s.primaryAction})]}),e.jsx(F,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"})]}),e.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-[11px] text-muted-foreground",children:M(s.publishedAt)}),e.jsx(R,{state:a})]})]})}function de(s,a){return a?[s.title,s.summary,s.primaryAction,...s.highlights,...s.commands,...s.actions.map(d=>`${d.label} ${d.description} ${d.command||""}`),...s.routes.map(d=>d.label)].join(" ").toLowerCase().includes(a):!0}function be(){const{t:s}=p(),a=o.useMemo(()=>[...$].sort((r,i)=>i.publishedAt.localeCompare(r.publishedAt)),[]),[t,d]=o.useState("inbox"),[l,n]=o.useState(""),[c,C]=o.useState(()=>ee()),[S,T]=o.useState(null);o.useEffect(()=>{se(c)},[c]);const h=o.useMemo(()=>{const r=l.trim().toLowerCase();return a.filter(i=>{const f=u(i,c);return de(i,r)?t==="done"?f==="done":t==="inbox"?A(f):!0:!1})},[a,c,l,t]),m=o.useMemo(()=>{const r=t==="all"?a:h;return r.find(i=>i.id===S)??r[0]??null},[a,S,t,h]),D=r=>{T(r.id),C(i=>u(r,i)!=="new"?i:{...i,[r.id]:"seen"})},O=o.useMemo(()=>a.filter(r=>A(u(r,c))).length,[a,c]),_=o.useMemo(()=>a.filter(r=>u(r,c)==="done").length,[a,c]);return e.jsxs("div",{className:"flex h-full min-h-0 overflow-hidden",children:[e.jsxs("div",{className:"w-80 border-r bg-muted/30 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b bg-background space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{className:"h-5 w-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:s("updates.inboxTitle")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("updates.inboxSubtitle")})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxs("div",{className:"rounded-md border bg-background px-2 py-1.5",children:[e.jsx("p",{className:"text-muted-foreground",children:s("updates.needsAction")}),e.jsx("p",{className:"text-base font-semibold",children:O})]}),e.jsxs("div",{className:"rounded-md border bg-background px-2 py-1.5",children:[e.jsx("p",{className:"text-muted-foreground",children:s("updates.doneCount")}),e.jsx("p",{className:"text-base font-semibold",children:_})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(K,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(z,{value:l,onChange:r=>n(r.target.value),placeholder:s("updates.searchPlaceholder"),className:"h-9 pl-8"})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:[{id:"inbox",label:s("updates.actionRequired")},{id:"done",label:s("updates.done")},{id:"all",label:s("updates.all")}].map(r=>e.jsx(x,{size:"sm",variant:t===r.id?"default":"outline",onClick:()=>d(r.id),children:r.label},r.id))})]}),e.jsx(b,{className:"flex-1",children:e.jsx("div",{className:"space-y-2 p-2",children:h.length===0?e.jsx("div",{className:"rounded-md border border-dashed p-3 text-xs text-muted-foreground",children:s("updates.noNotices")}):h.map(r=>e.jsx(te,{notice:r,progress:u(r,c),selected:m?.id===r.id,onSelect:()=>D(r)},r.id))})})]}),e.jsx(re,{notice:m,progress:m?u(m,c):null,relatedEntries:m?B(m):[],onUpdateProgress:r=>{m&&C(i=>({...i,[m.id]:r}))}})]})}export{be as UpdatesPage};
1
+ import{j as e}from"./radix-ui-Zb8sVEtn.js";import{L as P,r as o}from"./react-vendor-CNOkPC89.js";import{a as p,B as y,c as k,d as x,x as E,bp as M,C as g,j,k as N,_ as w,b as v,n as b,bq as U,br as $,I as z,bs as B}from"./index-BzucrQW1.js";import{a1 as L,$ as Q,b8 as q,x as G,E as J,Q as V,aa as Y,C as F,b9 as H,au as K}from"./icons-KVCk4_U8.js";import"./tanstack-CrmUhA7Z.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";const W={new:"border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-900/50 dark:bg-blue-900/20 dark:text-blue-300",stable:"border-green-200 bg-green-50 text-green-700 dark:border-green-900/50 dark:bg-green-900/20 dark:text-green-300",planned:"border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-900/50 dark:bg-amber-900/20 dark:text-amber-300"};function X({status:s,className:a}){const{t}=p(),d={new:t("updates.statusNew"),stable:t("updates.statusStable"),planned:t("updates.statusPlanned")};return e.jsx(y,{variant:"outline",className:k("font-medium",W[s],a),children:d[s]})}const I="ccs:updates:notice-progress:v1";function Z(s){return s==="new"?"new":"seen"}function u(s,a){return a[s.id]??Z(s.status)}function A(s){return s!=="done"&&s!=="dismissed"}function ee(){if(typeof window>"u")return{};try{const s=window.localStorage.getItem(I);if(!s)return{};const a=JSON.parse(s);if(!a||typeof a!="object"||Array.isArray(a))return{};const t={};for(const[d,l]of Object.entries(a))typeof d=="string"&&(l==="new"||l==="seen"||l==="done"||l==="dismissed")&&(t[d]=l);return t}catch{return{}}}function se(s){typeof window>"u"||window.localStorage.setItem(I,JSON.stringify(s))}function R({state:s,className:a}){const{t}=p(),d={new:{label:t("updates.progressNeedsAction"),className:"border-amber-300/70 bg-amber-100/70 text-amber-800 dark:border-amber-500/40 dark:bg-amber-500/15 dark:text-amber-300",showDot:!0},seen:{label:t("updates.progressInReview"),className:"border-blue-300/70 bg-blue-100/70 text-blue-800 dark:border-blue-500/40 dark:bg-blue-500/15 dark:text-blue-300"},done:{label:t("updates.progressDone"),className:"border-emerald-300/70 bg-emerald-100/70 text-emerald-800 dark:border-emerald-500/40 dark:bg-emerald-500/15 dark:text-emerald-300"},dismissed:{label:t("updates.progressDismissed"),className:"border-muted-foreground/20 bg-muted text-muted-foreground dark:border-muted-foreground/30"}}[s];return e.jsxs(y,{variant:"outline",className:k("gap-1.5 border text-[10px] font-medium",d.className,a),children:[d.showDot&&e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-current"}),d.label]})}function ae({action:s}){const{t:a}=p();return e.jsxs("div",{className:"rounded-md border bg-muted/20 p-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 space-y-0.5",children:[e.jsx("p",{className:"text-sm font-medium",children:s.label}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.description})]}),s.type==="route"&&s.path&&e.jsx(x,{size:"sm",asChild:!0,children:e.jsxs(P,{to:s.path,children:[a("updates.open"),e.jsx(L,{className:"h-3.5 w-3.5"})]})})]}),s.type==="command"&&s.command&&e.jsxs("div",{className:"mt-2 flex items-center gap-2 rounded-md border bg-background px-2 py-1.5",children:[e.jsx(Q,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("code",{className:"min-w-0 flex-1 truncate text-[11px]",children:s.command}),e.jsx(E,{value:s.command})]})]})}function re({notice:s,progress:a,relatedEntries:t,onUpdateProgress:d}){const{t:l}=p();return s?e.jsxs("div",{className:"flex-1 min-w-0 bg-background grid grid-rows-[auto_minmax(0,1fr)] overflow-hidden",children:[e.jsxs("div",{className:"border-b bg-background px-4 py-3",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("h2",{className:"text-base font-semibold leading-tight",children:s.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.summary})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[a&&e.jsx(R,{state:a}),e.jsx(X,{status:s.status})]})]}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(q,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:l("updates.published",{date:M(s.publishedAt)})})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsxs(x,{size:"sm",onClick:()=>d("done"),children:[e.jsx(G,{className:"h-4 w-4"}),l("updates.markDone")]}),e.jsxs(x,{size:"sm",variant:"outline",onClick:()=>d("dismissed"),children:[e.jsx(J,{className:"h-4 w-4"}),l("updates.dismiss")]}),e.jsxs(x,{size:"sm",variant:"ghost",onClick:()=>d("new"),children:[e.jsx(V,{className:"h-4 w-4"}),l("updates.reopen")]})]})]}),e.jsx("div",{className:"min-h-0 p-4",children:e.jsxs("div",{className:"grid h-full gap-4 xl:grid-cols-[minmax(0,1.5fr)_minmax(320px,1fr)] overflow-hidden",children:[e.jsxs(g,{className:"h-full overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Y,{className:"h-4 w-4 text-primary"}),e.jsx(N,{className:"text-base",children:l("updates.doNext")})]}),e.jsx(w,{children:s.primaryAction})]}),e.jsx(v,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("div",{className:"space-y-3",children:s.actions.map(n=>e.jsx(ae,{action:n},`${s.id}-${n.id}`))})})})]}),e.jsxs("div",{className:"grid h-full grid-rows-[minmax(0,1fr)_minmax(0,1fr)] gap-4 overflow-hidden",children:[e.jsxs(g,{className:"overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsx(N,{className:"text-base",children:l("updates.impactedIntegrations")}),e.jsx(w,{children:l("updates.impactedDesc")})]}),e.jsx(v,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("div",{className:"space-y-2",children:t.map(n=>e.jsxs("div",{className:"rounded-md border bg-muted/20 p-2.5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("p",{className:"min-w-0 truncate text-sm font-medium",children:n.name}),e.jsx(y,{variant:"outline",className:"h-5 px-1.5 text-[10px]",children:U[n.scope]})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[n.routes[0]&&e.jsx(x,{size:"sm",variant:"outline",asChild:!0,children:e.jsx(P,{to:n.routes[0].path,children:n.routes[0].label})}),n.commands[0]&&e.jsxs("div",{className:"ml-auto flex min-w-0 items-center gap-1.5",children:[e.jsx("code",{className:"truncate rounded bg-background px-1.5 py-0.5 text-[11px]",children:n.commands[0]}),e.jsx(E,{value:n.commands[0]})]})]})]},n.id))})})})]}),e.jsxs(g,{className:"overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsx(N,{className:"text-base",children:l("updates.whyMatters")}),e.jsx(w,{children:l("updates.whyMattersDesc")})]}),e.jsx(v,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("ul",{className:"space-y-2 text-sm text-muted-foreground",children:s.highlights.map(n=>e.jsxs("li",{children:["- ",n]},`${s.id}-${n}`))})})})]})]})]})})]}):e.jsx("div",{className:"flex h-full items-center justify-center rounded-lg border border-dashed bg-muted/20 p-6",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:l("updates.noUpdates")})})}function te({notice:s,progress:a,selected:t,onSelect:d}){return e.jsxs("button",{type:"button",onClick:d,className:k("w-full rounded-lg border px-3 py-3 text-left transition-colors",t?"border-primary/30 bg-primary/10":"border-transparent bg-background/40 hover:border-border hover:bg-muted/70"),children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("p",{className:"truncate text-sm font-medium",children:s.title}),e.jsx("p",{className:"line-clamp-2 text-xs text-muted-foreground",children:s.primaryAction})]}),e.jsx(F,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"})]}),e.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-[11px] text-muted-foreground",children:M(s.publishedAt)}),e.jsx(R,{state:a})]})]})}function de(s,a){return a?[s.title,s.summary,s.primaryAction,...s.highlights,...s.commands,...s.actions.map(d=>`${d.label} ${d.description} ${d.command||""}`),...s.routes.map(d=>d.label)].join(" ").toLowerCase().includes(a):!0}function be(){const{t:s}=p(),a=o.useMemo(()=>[...$].sort((r,i)=>i.publishedAt.localeCompare(r.publishedAt)),[]),[t,d]=o.useState("inbox"),[l,n]=o.useState(""),[c,C]=o.useState(()=>ee()),[S,T]=o.useState(null);o.useEffect(()=>{se(c)},[c]);const h=o.useMemo(()=>{const r=l.trim().toLowerCase();return a.filter(i=>{const f=u(i,c);return de(i,r)?t==="done"?f==="done":t==="inbox"?A(f):!0:!1})},[a,c,l,t]),m=o.useMemo(()=>{const r=t==="all"?a:h;return r.find(i=>i.id===S)??r[0]??null},[a,S,t,h]),D=r=>{T(r.id),C(i=>u(r,i)!=="new"?i:{...i,[r.id]:"seen"})},O=o.useMemo(()=>a.filter(r=>A(u(r,c))).length,[a,c]),_=o.useMemo(()=>a.filter(r=>u(r,c)==="done").length,[a,c]);return e.jsxs("div",{className:"flex h-full min-h-0 overflow-hidden",children:[e.jsxs("div",{className:"w-80 border-r bg-muted/30 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b bg-background space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{className:"h-5 w-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:s("updates.inboxTitle")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("updates.inboxSubtitle")})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxs("div",{className:"rounded-md border bg-background px-2 py-1.5",children:[e.jsx("p",{className:"text-muted-foreground",children:s("updates.needsAction")}),e.jsx("p",{className:"text-base font-semibold",children:O})]}),e.jsxs("div",{className:"rounded-md border bg-background px-2 py-1.5",children:[e.jsx("p",{className:"text-muted-foreground",children:s("updates.doneCount")}),e.jsx("p",{className:"text-base font-semibold",children:_})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(K,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(z,{value:l,onChange:r=>n(r.target.value),placeholder:s("updates.searchPlaceholder"),className:"h-9 pl-8"})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:[{id:"inbox",label:s("updates.actionRequired")},{id:"done",label:s("updates.done")},{id:"all",label:s("updates.all")}].map(r=>e.jsx(x,{size:"sm",variant:t===r.id?"default":"outline",onClick:()=>d(r.id),children:r.label},r.id))})]}),e.jsx(b,{className:"flex-1",children:e.jsx("div",{className:"space-y-2 p-2",children:h.length===0?e.jsx("div",{className:"rounded-md border border-dashed p-3 text-xs text-muted-foreground",children:s("updates.noNotices")}):h.map(r=>e.jsx(te,{notice:r,progress:u(r,c),selected:m?.id===r.id,onSelect:()=>D(r)},r.id))})})]}),e.jsx(re,{notice:m,progress:m?u(m,c):null,relatedEntries:m?B(m):[],onUpdateProgress:r=>{m&&C(i=>({...i,[m.id]:r}))}})]})}export{be as UpdatesPage};
@@ -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-DSM3luVm.js"></script>
27
+ <script type="module" crossorigin src="/assets/index-BzucrQW1.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">
@@ -33,7 +33,7 @@
33
33
  <link rel="modulepreload" crossorigin href="/assets/utils-CzKF5WmX.js">
34
34
  <link rel="modulepreload" crossorigin href="/assets/form-utils-Bcoyqxpq.js">
35
35
  <link rel="modulepreload" crossorigin href="/assets/code-highlight-BRUf_pqB.js">
36
- <link rel="stylesheet" crossorigin href="/assets/index-teLjoh2T.css">
36
+ <link rel="stylesheet" crossorigin href="/assets/index-Cu6e0-ev.css">
37
37
  </head>
38
38
  <body>
39
39
  <div id="root"></div>
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Cursor Routes - Cursor IDE integration via cursor proxy daemon
3
3
  */
4
+ import { autoDetectTokens } from '../../cursor';
4
5
  declare const router: import("express-serve-static-core").Router;
5
6
  interface DaemonStartPreconditionInput {
6
7
  enabled: boolean;
@@ -11,6 +12,7 @@ interface DaemonStartPreconditionError {
11
12
  status: number;
12
13
  error: string;
13
14
  }
15
+ export declare function getAutoDetectFailureStatus(reason?: ReturnType<typeof autoDetectTokens>['reason']): number;
14
16
  export declare function getDaemonStartPreconditionError(input: DaemonStartPreconditionInput): DaemonStartPreconditionError | null;
15
17
  export default router;
16
18
  //# sourceMappingURL=cursor-routes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cursor-routes.d.ts","sourceRoot":"","sources":["../../../src/web-server/routes/cursor-routes.ts"],"names":[],"mappings":"AAAA;;GAEG;AAiBH,QAAA,MAAM,MAAM,4CAAW,CAAC;AAExB,UAAU,4BAA4B;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,UAAU,4BAA4B;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,4BAA4B,GAClC,4BAA4B,GAAG,IAAI,CAuBrC;AAiJD,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"cursor-routes.d.ts","sourceRoot":"","sources":["../../../src/web-server/routes/cursor-routes.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAML,gBAAgB,EAIjB,MAAM,cAAc,CAAC;AAItB,QAAA,MAAM,MAAM,4CAAW,CAAC;AAExB,UAAU,4BAA4B;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,UAAU,4BAA4B;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,0BAA0B,CACxC,MAAM,CAAC,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC,QAAQ,CAAC,GACrD,MAAM,CAWR;AAeD,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,4BAA4B,GAClC,4BAA4B,GAAG,IAAI,CAuBrC;AAkKD,eAAe,MAAM,CAAC"}
@@ -6,12 +6,37 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
6
6
  return (mod && mod.__esModule) ? mod : { "default": mod };
7
7
  };
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.getDaemonStartPreconditionError = void 0;
9
+ exports.getDaemonStartPreconditionError = exports.getAutoDetectFailureStatus = void 0;
10
10
  const express_1 = require("express");
11
11
  const cursor_1 = require("../../cursor");
12
12
  const unified_config_loader_1 = require("../../config/unified-config-loader");
13
13
  const cursor_settings_routes_1 = __importDefault(require("./cursor-settings-routes"));
14
14
  const router = (0, express_1.Router)();
15
+ function getAutoDetectFailureStatus(reason) {
16
+ switch (reason) {
17
+ case 'sqlite_unavailable':
18
+ return 503;
19
+ case 'db_query_failed':
20
+ return 500;
21
+ case 'invalid_token_format':
22
+ return 400;
23
+ default:
24
+ return 404;
25
+ }
26
+ }
27
+ exports.getAutoDetectFailureStatus = getAutoDetectFailureStatus;
28
+ function getPublicAutoDetectError(result) {
29
+ switch (result.reason) {
30
+ case 'db_not_found':
31
+ return 'Cursor state database not found on this host.';
32
+ case 'sqlite_unavailable':
33
+ return 'Cursor state database was found, but sqlite3 is not available in PATH.';
34
+ case 'db_query_failed':
35
+ return 'Cursor state database was found, but CCS could not query it.';
36
+ default:
37
+ return result.error ?? 'Token not found';
38
+ }
39
+ }
15
40
  function getDaemonStartPreconditionError(input) {
16
41
  if (!input.enabled) {
17
42
  return {
@@ -95,7 +120,11 @@ router.post('/auth/auto-detect', async (_req, res) => {
95
120
  try {
96
121
  const result = (0, cursor_1.autoDetectTokens)();
97
122
  if (!result.found || !result.accessToken || !result.machineId) {
98
- res.status(404).json({ error: result.error ?? 'Token not found' });
123
+ const status = getAutoDetectFailureStatus(result.reason);
124
+ res.status(status).json({
125
+ error: getPublicAutoDetectError(result),
126
+ reason: result.reason ?? null,
127
+ });
99
128
  return;
100
129
  }
101
130
  // Save credentials
@@ -124,6 +153,19 @@ router.get('/models', async (_req, res) => {
124
153
  res.status(500).json({ error: error.message });
125
154
  }
126
155
  });
156
+ /**
157
+ * POST /api/cursor/probe - Run a live authenticated runtime probe
158
+ */
159
+ router.post('/probe', async (_req, res) => {
160
+ try {
161
+ const cursorConfig = (0, unified_config_loader_1.getCursorConfig)();
162
+ const result = await (0, cursor_1.probeCursorRuntime)(cursorConfig);
163
+ res.status(result.status).json(result);
164
+ }
165
+ catch (error) {
166
+ res.status(500).json({ error: error.message });
167
+ }
168
+ });
127
169
  /**
128
170
  * POST /api/cursor/daemon/start - Start cursor proxy daemon
129
171
  * Path matches copilot convention: /api/{provider}/daemon/{action}
@@ -1 +1 @@
1
- {"version":3,"file":"cursor-routes.js","sourceRoot":"","sources":["../../../src/web-server/routes/cursor-routes.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;AAGH,qCAAiC;AACjC,yCASsB;AACtB,8EAAqE;AACrE,sFAA4D;AAE5D,MAAM,MAAM,GAAG,IAAA,gBAAM,GAAE,CAAC;AAaxB,SAAgB,+BAA+B,CAC7C,KAAmC;IAEnC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACnB,OAAO;YACL,MAAM,EAAE,GAAG;YACX,KAAK,EAAE,mEAAmE;SAC3E,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;QACzB,OAAO;YACL,MAAM,EAAE,GAAG;YACX,KAAK,EAAE,4EAA4E;SACpF,CAAC;IACJ,CAAC;IAED,IAAI,KAAK,CAAC,YAAY,EAAE,CAAC;QACvB,OAAO;YACL,MAAM,EAAE,GAAG;YACX,KAAK,EAAE,qEAAqE;SAC7E,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAzBD,0EAyBC;AAED,4BAA4B;AAC5B,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,gCAAoB,CAAC,CAAC;AAE9C;;GAEG;AACH,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,EAAE,IAAa,EAAE,GAAa,EAAiB,EAAE;IAC1E,IAAI,CAAC;QACH,MAAM,YAAY,GAAG,IAAA,uCAAe,GAAE,CAAC;QACvC,MAAM,UAAU,GAAG,IAAA,wBAAe,GAAE,CAAC;QACrC,MAAM,YAAY,GAAG,MAAM,IAAA,wBAAe,EAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QAE9D,GAAG,CAAC,IAAI,CAAC;YACP,OAAO,EAAE,YAAY,CAAC,OAAO;YAC7B,aAAa,EAAE,UAAU,CAAC,aAAa;YACvC,WAAW,EAAE,UAAU,CAAC,WAAW,EAAE,UAAU,IAAI,IAAI;YACvD,SAAS,EAAE,UAAU,CAAC,QAAQ,IAAI,IAAI;YACtC,aAAa,EAAE,UAAU,CAAC,OAAO,IAAI,KAAK;YAC1C,cAAc,EAAE,YAAY,CAAC,OAAO;YACpC,IAAI,EAAE,YAAY,CAAC,IAAI;YACvB,UAAU,EAAE,YAAY,CAAC,UAAU;YACnC,UAAU,EAAE,YAAY,CAAC,UAAU;SACpC,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;;GAEG;AACH,MAAM,CAAC,IAAI,CAAC,cAAc,EAAE,KAAK,EAAE,GAAY,EAAE,GAAa,EAAiB,EAAE;IAC/E,IAAI,CAAC;QACH,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC;QAC5C,IAAI,CAAC,WAAW,IAAI,CAAC,SAAS,EAAE,CAAC;YAC/B,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,kCAAkC,EAAE,CAAC,CAAC;YACpE,OAAO;QACT,CAAC;QAED,wBAAwB;QACxB,IAAI,CAAC,IAAA,sBAAa,EAAC,WAAW,EAAE,SAAS,CAAC,EAAE,CAAC;YAC3C,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,oCAAoC,EAAE,CAAC,CAAC;YACtE,OAAO;QACT,CAAC;QAED,mBAAmB;QACnB,IAAA,wBAAe,EAAC;YACd,WAAW;YACX,SAAS;YACT,UAAU,EAAE,QAAQ;YACpB,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACrC,CAAC,CAAC;QAEH,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,6BAA6B,EAAE,CAAC,CAAC;IACtE,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;;GAEG;AACH,MAAM,CAAC,IAAI,CAAC,mBAAmB,EAAE,KAAK,EAAE,IAAa,EAAE,GAAa,EAAiB,EAAE;IACrF,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAA,yBAAgB,GAAE,CAAC;QAElC,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,WAAW,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;YAC9D,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,iBAAiB,EAAE,CAAC,CAAC;YACnE,OAAO;QACT,CAAC;QAED,mBAAmB;QACnB,IAAA,wBAAe,EAAC;YACd,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,UAAU,EAAE,aAAa;YACzB,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACrC,CAAC,CAAC;QAEH,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,kCAAkC,EAAE,CAAC,CAAC;IAC3E,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;;GAEG;AACH,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,EAAE,IAAa,EAAE,GAAa,EAAiB,EAAE;IAC1E,IAAI,CAAC;QACH,MAAM,YAAY,GAAG,IAAA,uCAAe,GAAE,CAAC;QACvC,MAAM,MAAM,GAAG,MAAM,IAAA,2BAAkB,EAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QAC3D,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,CAAC,KAAK,EAAE,CAAC,CAAC;IACpD,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;;;GAGG;AACH,MAAM,CAAC,IAAI,CAAC,eAAe,EAAE,KAAK,EAAE,IAAa,EAAE,GAAa,EAAiB,EAAE;IACjF,IAAI,CAAC;QACH,MAAM,YAAY,GAAG,IAAA,uCAAe,GAAE,CAAC;QACvC,MAAM,UAAU,GAAG,IAAA,wBAAe,GAAE,CAAC;QACrC,MAAM,iBAAiB,GAAG,+BAA+B,CAAC;YACxD,OAAO,EAAE,YAAY,CAAC,OAAO;YAC7B,aAAa,EAAE,UAAU,CAAC,aAAa;YACvC,YAAY,EAAE,UAAU,CAAC,OAAO,IAAI,KAAK;SAC1C,CAAC,CAAC;QAEH,IAAI,iBAAiB,EAAE,CAAC;YACtB,GAAG,CAAC,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC;gBACxC,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,iBAAiB,CAAC,KAAK;aAC/B,CAAC,CAAC;YACH,OAAO;QACT,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,IAAA,oBAAW,EAAC;YAC/B,IAAI,EAAE,YAAY,CAAC,IAAI;YACvB,UAAU,EAAE,YAAY,CAAC,UAAU;SACpC,CAAC,CAAC;QACH,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACnB,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;;;GAGG;AACH,MAAM,CAAC,IAAI,CAAC,cAAc,EAAE,KAAK,EAAE,IAAa,EAAE,GAAa,EAAiB,EAAE;IAChF,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,IAAA,mBAAU,GAAE,CAAC;QAClC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACnB,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
+ {"version":3,"file":"cursor-routes.js","sourceRoot":"","sources":["../../../src/web-server/routes/cursor-routes.ts"],"names":[],"mappings":"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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaitranntt/ccs",
3
- "version": "7.68.1-dev.4",
3
+ "version": "7.68.1-dev.5",
4
4
  "description": "Claude Code Switch - Instant profile switching between Claude, GLM, Kimi, and more",
5
5
  "keywords": [
6
6
  "cli",
@@ -1 +0,0 @@
1
- import{j as e}from"./radix-ui-Zb8sVEtn.js";import{r as j}from"./react-vendor-CNOkPC89.js";import{t as o}from"./notifications-B2HqRBj7.js";import{bb as N,bc as Ze,a as Se,B as M,d as f,c as oe,n as E,Q as $e,R as Ye,U as Y,V as ee,L as _,I as se,aF as ye,bh as es,ag as ss,ah as as,ai as ts,aj as rs,ak as ns,aC as os,bd as is}from"./index-DSM3luVm.js";import{a as cs,u as z,b as D}from"./tanstack-CrmUhA7Z.js";import{D as ke}from"./default-ports-1QQSffYX.js";import{S as ls}from"./separator-CJd089R0.js";import{S as ds}from"./searchable-select-CNH0YBur.js";import{R as be,T as us,ah as ms,K as q,ad as hs,aP as Ce,aO as gs,L as A,J as xs,at as fs,aa as ps,Z as ae,aw as js,x as vs,I as ws}from"./icons-KVCk4_U8.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";async function Ps(){const s=await fetch(N("/cursor/status"));if(!s.ok)throw new Error("Failed to fetch cursor status");return s.json()}async function Ns(){const s=await fetch(N("/cursor/settings"));if(!s.ok)throw new Error("Failed to fetch cursor config");return s.json()}async function ys(){const s=await fetch(N("/cursor/models"));if(!s.ok)throw new Error("Failed to fetch cursor models");return s.json()}async function bs(){const s=await fetch(N("/cursor/settings/raw"));if(!s.ok)throw new Error("Failed to fetch cursor raw settings");return s.json()}async function Cs(s){const t=await fetch(N("/cursor/settings"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!t.ok)throw new Error("Failed to update cursor config");return t.json()}async function Ss(s){const t=await fetch(N("/cursor/settings/raw"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(t.status===409)throw new Ze("Cursor raw settings changed externally");if(!t.ok)throw new Error("Failed to save cursor raw settings");return t.json()}async function ks(){const s=await fetch(N("/cursor/auth/auto-detect"),{method:"POST"});if(!s.ok){const t=await s.json().catch(()=>({error:"Auto-detect failed"}));throw new Error(t.error||"Auto-detect failed")}return s.json()}async function Ms(s){const t=await fetch(N("/cursor/auth/import"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!t.ok){const l=await t.json().catch(()=>({error:"Manual import failed"}));throw new Error(l.error||"Manual import failed")}return t.json()}async function Ds(){const s=await fetch(N("/cursor/daemon/start"),{method:"POST"});if(!s.ok)throw new Error("Failed to start cursor daemon");return s.json()}async function As(){const s=await fetch(N("/cursor/daemon/stop"),{method:"POST"});if(!s.ok)throw new Error("Failed to stop cursor daemon");return s.json()}function _s(){const s=cs(),t=z({queryKey:["cursor-status"],queryFn:Ps,refetchInterval:5e3}),l=z({queryKey:["cursor-config"],queryFn:Ns}),u=z({queryKey:["cursor-models"],queryFn:ys}),g=z({queryKey:["cursor-raw-settings"],queryFn:bs}),m=()=>{s.invalidateQueries({queryKey:["cursor-status"]}),s.invalidateQueries({queryKey:["cursor-config"]}),s.invalidateQueries({queryKey:["cursor-models"]}),s.invalidateQueries({queryKey:["cursor-raw-settings"]})},h=D({mutationFn:Cs,onSuccess:m}),r=D({mutationFn:Ss,onSuccess:m}),d=D({mutationFn:ks,onSuccess:m}),p=D({mutationFn:Ms,onSuccess:m}),i=D({mutationFn:Ds,onSuccess:m}),c=D({mutationFn:As,onSuccess:m});return j.useMemo(()=>({status:t.data,statusLoading:t.isLoading,statusError:t.error,refetchStatus:t.refetch,config:l.data,configLoading:l.isLoading,models:u.data?.models??[],currentModel:u.data?.current??null,modelsLoading:u.isLoading,rawSettings:g.data,rawSettingsLoading:g.isLoading,refetchRawSettings:g.refetch,updateConfig:h.mutate,updateConfigAsync:h.mutateAsync,isUpdatingConfig:h.isPending,saveRawSettings:r.mutate,saveRawSettingsAsync:r.mutateAsync,isSavingRawSettings:r.isPending,autoDetectAuth:d.mutate,autoDetectAuthAsync:d.mutateAsync,isAutoDetectingAuth:d.isPending,autoDetectAuthResult:d.data,importManualAuth:p.mutate,importManualAuthAsync:p.mutateAsync,isImportingManualAuth:p.isPending,manualAuthResult:p.data,startDaemon:i.mutate,startDaemonAsync:i.mutateAsync,isStartingDaemon:i.isPending,stopDaemon:c.mutate,stopDaemonAsync:c.mutateAsync,isStoppingDaemon:c.isPending}),[t.data,t.isLoading,t.error,t.refetch,l.data,l.isLoading,u.data,u.isLoading,g.data,g.isLoading,g.refetch,h.mutate,h.mutateAsync,h.isPending,r.mutate,r.mutateAsync,r.isPending,d.mutate,d.mutateAsync,d.isPending,d.data,p.mutate,p.mutateAsync,p.isPending,p.data,i.mutate,i.mutateAsync,i.isPending,c.mutate,c.mutateAsync,c.isPending])}function te(s){return{port:String(s?.port??ke),auto_start:s?.auto_start??!1,ghost_mode:s?.ghost_mode??!0,model:s?.model?.trim()||"gpt-5.3-codex",opus_model:s?.opus_model?.trim()||"",sonnet_model:s?.sonnet_model?.trim()||"",haiku_model:s?.haiku_model?.trim()||""}}function y(s,t,l){return s.find(g=>t.some(m=>m.test(g.id)))?.id??l}function re(s){return s.toLowerCase().replace(/[^a-z0-9]/g,"")}function b(s,t,l){const u=new Set(t.map(re)),g=s.find(h=>u.has(re(h.id)));if(g)return g.id;const m=s.find(h=>u.has(re(h.name)));return m?m.id:l}function Ts(s){try{const t=JSON.parse(s||"{}");return!t||typeof t!="object"||Array.isArray(t)?{isValid:!1,error:"Raw settings must be a JSON object"}:{isValid:!0,settings:t}}catch(t){return{isValid:!1,error:t.message||"Invalid JSON"}}}function G({label:s,description:t,value:l,models:u,disabled:g,allowDefaultFallback:m=!1,onChange:h}){const{t:r}=Se(),d=l||(m?"__default":""),p=j.useMemo(()=>{const i=u.map(c=>({value:c.id,groupKey:"models",searchText:`${c.name||c.id} ${c.id}`,keywords:[c.provider],triggerContent:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:c.name||c.id}),c.provider&&e.jsx(M,{variant:"outline",className:"text-[9px] h-4 px-1 capitalize",children:c.provider})]}),itemContent:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate text-xs font-mono",children:c.name||c.id}),e.jsx(M,{variant:"outline",className:"text-[9px] h-4 px-1 capitalize",children:c.provider})]})}));return m?[{value:"__default",groupKey:"models",searchText:r("cursorPage.useDefaultModel"),triggerContent:e.jsx("span",{className:"truncate font-mono text-xs",children:r("cursorPage.useDefaultModel")}),itemContent:e.jsx("span",{children:r("cursorPage.useDefaultModel")})},...i]:i},[m,u,r]);return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{children:[e.jsx(_,{className:"text-xs font-medium",children:s}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:t})]}),e.jsx(ds,{value:d||void 0,onChange:i=>{if(m&&i==="__default"){h("");return}h(i)},disabled:g,placeholder:r("cursorPage.selectModel"),searchPlaceholder:r("searchableSelect.searchModels"),emptyText:r("searchableSelect.noResults"),triggerClassName:"h-9",groups:[{key:"models",label:r("cursorPage.availableModelCount",{count:u.length})}],options:p})]})}function ne({icon:s,label:t,ok:l,detail:u}){return e.jsxs("div",{className:"flex items-center gap-3 rounded-lg bg-muted/50 px-3 py-2",children:[e.jsx(s,{className:"h-4 w-4 text-muted-foreground shrink-0"}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("p",{className:"text-sm",children:t})}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[l?e.jsx(vs,{className:"h-4 w-4 text-green-500"}):e.jsx(ws,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:oe("text-xs",l?"text-green-500":"text-muted-foreground"),title:u,children:u})]})]})}function Js(){const{t:s}=Se(),{status:t,statusLoading:l,refetchStatus:u,config:g,updateConfigAsync:m,isUpdatingConfig:h,models:r,modelsLoading:d,currentModel:p,rawSettings:i,rawSettingsLoading:c,refetchRawSettings:Me,saveRawSettingsAsync:De,isSavingRawSettings:ie,autoDetectAuthAsync:Ae,isAutoDetectingAuth:ce,importManualAuthAsync:_e,isImportingManualAuth:le,startDaemonAsync:Te,isStartingDaemon:Fe,stopDaemonAsync:Re,isStoppingDaemon:de}=_s(),[k,ue]=j.useState(()=>te()),[v,me]=j.useState(!1),[he,Ie]=j.useState("{}"),[T,K]=j.useState(!1),[Le,I]=j.useState(!1),[U,ge]=j.useState(""),[B,xe]=j.useState(""),C=te(g),fe=v?k.port:C.port,J=v?k.auto_start:C.auto_start,Q=v?k.ghost_mode:C.ghost_mode,w=v?k.model:C.model,H=v?k.opus_model:C.opus_model,V=v?k.sonnet_model:C.sonnet_model,W=v?k.haiku_model:C.haiku_model,X=T?he:JSON.stringify(i?.settings??{},null,2),pe=!!i,F=j.useMemo(()=>Ts(X),[X]),je=F.isValid,ve=v||T,Oe=!T||pe&&je,L=j.useMemo(()=>{const a=new Set,n=[...r].sort((S,$)=>S.name.localeCompare($.name)),x=n.filter(S=>a.has(S.id)?!1:(a.add(S.id),!0));return w&&!n.some(S=>S.id===w)?[{id:w,name:w,provider:"custom"},...x]:x},[r,w]),P=a=>{ue(n=>a(v?n:C)),me(!0)},Ee=!!(t?.enabled&&t?.authenticated&&!t?.token_expired),ze=j.useMemo(()=>t?.enabled?e.jsx(M,{children:s("cursorPage.enabled")}):e.jsx(M,{variant:"secondary",children:s("cursorPage.disabled")}),[t?.enabled,s]),qe=async({suppressSuccessToast:a=!1}={})=>{const n=Number(fe);if(!Number.isInteger(n)||n<1||n>65535)return o.error(s("cursorPage.invalidPort")),!1;if(!w.trim())return o.error(s("cursorPage.defaultModelRequired")),!1;try{return await m({port:n,auto_start:J,ghost_mode:Q,model:w,opus_model:H||void 0,sonnet_model:V||void 0,haiku_model:W||void 0}),me(!1),ue(te({port:n,auto_start:J,ghost_mode:Q,model:w,opus_model:H||void 0,sonnet_model:V||void 0,haiku_model:W||void 0})),a||o.success(s("cursorPage.savedConfig")),!0}catch(x){return o.error(x.message||s("cursorPage.failedSaveConfig")),!1}},Z=a=>{if(d){o.error(s("cursorPage.modelsLoadingWait"));return}if(r.length===0){o.error(s("cursorPage.noModelsAvailable"));return}const n=w||p||r[0]?.id||"gpt-5.3-codex",x=b(r,["gpt-5.3-codex","gpt53codex","GPT-5.3 Codex"],y(r,[/gpt[-.]?5.*codex/i],n)),S=b(r,["gpt-5.1-codex-max","gpt51codexmax","GPT-5.1 Codex Max"],y(r,[/gpt[-.]?5.*codex.*max/i],x)),$=b(r,["gpt-5-fast","gpt5fast","GPT-5 Fast"],y(r,[/gpt[-.]?5.*fast/i],x)),Ve=b(r,["gpt-5-mini","gpt5mini","GPT-5 Mini"],y(r,[/gpt[-.]?5.*mini/i],$)),Pe=b(r,["claude-4.6-opus","claude46opus","Claude 4.6 Opus"],y(r,[/claude[-.]?4\.?6.*opus/i,/claude.*opus/i],x)),Ne=b(r,["claude-4.5-sonnet","claude45sonnet","Claude 4.5 Sonnet"],y(r,[/claude[-.]?4\.?5.*sonnet/i,/claude.*sonnet/i],x)),We=b(r,["claude-4.5-haiku","claude45haiku","Claude 4.5 Haiku"],y(r,[/claude[-.]?4\.?5.*haiku/i,/haiku/i],Ne)),O=b(r,["gemini-3-pro","gemini3pro","Gemini 3 Pro"],y(r,[/gemini[-.]?3.*pro/i],x)),Xe=b(r,["gemini-3-flash","gemini3flash","Gemini 3 Flash"],y(r,[/gemini[-.]?3.*flash/i,/gemini[-.]?2\.?5.*flash/i],O));if(a==="codex53"){P(R=>({...R,model:x,opus_model:S,sonnet_model:x,haiku_model:Ve})),o.success(s("cursorPage.appliedCodexPreset"));return}if(a==="claude46"){P(R=>({...R,model:Pe,opus_model:Pe,sonnet_model:Ne,haiku_model:We})),o.success(s("cursorPage.appliedClaudePreset"));return}P(R=>({...R,model:O,opus_model:O,sonnet_model:O,haiku_model:Xe})),o.success(s("cursorPage.appliedGeminiPreset"))},we=async a=>{try{await m({enabled:a}),o.success(s(a?"cursorPage.integrationEnabled":"cursorPage.integrationDisabled"))}catch(n){o.error(n.message||s("cursorPage.failedUpdateIntegration"))}},Ge=async()=>{try{await Ae(),o.success(s("cursorPage.credentialsImported"))}catch(a){o.error(a.message||s("cursorPage.autoDetectFailed"))}},Ke=async()=>{if(!U.trim()||!B.trim()){o.error(s("cursorPage.manualRequired"));return}try{await _e({accessToken:U.trim(),machineId:B.trim()}),o.success(s("cursorPage.credentialsImported")),I(!1),ge(""),xe("")}catch(a){o.error(a.message||s("cursorPage.manualImportFailed"))}},Ue=async()=>{try{const a=await Te();if(!a.success){o.error(a.error||s("cursorPage.failedStartDaemon"));return}o.success(a.pid?s("cursorPage.daemonStartedWithPid",{pid:a.pid}):s("cursorPage.daemonStarted"))}catch(a){o.error(a.message||s("cursorPage.failedStartDaemon"))}},Be=async()=>{try{const a=await Re();if(!a.success){o.error(a.error||s("cursorPage.failedStopDaemon"));return}o.success(s("cursorPage.daemonStopped"))}catch(a){o.error(a.message||s("cursorPage.failedStopDaemon"))}},Je=async({suppressSuccessToast:a=!1}={})=>{if(!pe)return o.error(s("cursorPage.rawLoading")),!1;if(!F.isValid||!F.settings)return o.error(F.error||s("cursorPage.invalidJson")),!1;try{return await De({settings:F.settings,expectedMtime:i?.mtime}),K(!1),a||o.success(s("cursorPage.rawSaved")),!0}catch(n){return is(n)?o.error(s("cursorPage.rawChanged")):o.error(n.message||s("cursorPage.failedSaveRaw")),!1}},Qe=async()=>{if(!ve)return;const a=v,n=T;a&&!await qe({suppressSuccessToast:n})||n&&!await Je({suppressSuccessToast:a})||a&&n&&o.success(s("cursorPage.savedAll"))},He=()=>{K(!1),u(),Me()};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex h-full min-h-0 overflow-hidden",children:[e.jsxs("div",{className:"w-80 border-r flex flex-col bg-muted/30 shrink-0",children:[e.jsxs("div",{className:"p-4 border-b bg-background",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("img",{src:"/assets/sidebar/cursor.svg",alt:"",className:"w-5 h-5 object-contain shrink-0"}),e.jsx("h1",{className:"font-semibold",children:s("cursorPage.title")}),e.jsx(M,{variant:"outline",className:"h-5 border-amber-500/60 bg-amber-500/10 px-1.5 text-[10px] font-semibold uppercase tracking-wide text-amber-800 dark:text-amber-300",children:s("cursorPage.beta")}),ze]}),e.jsx(f,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>u(),disabled:l,children:e.jsx(be,{className:oe("w-4 h-4",l&&"animate-spin")})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("cursorPage.subtitle")})]}),e.jsx(E,{className:"flex-1",children:e.jsxs("div",{className:"p-3 space-y-4",children:[e.jsxs("div",{className:"rounded-md border border-yellow-500/50 bg-yellow-500/15 p-3 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(us,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-400 shrink-0"}),e.jsx("span",{className:"text-xs font-semibold text-yellow-800 dark:text-yellow-200",children:s("cursorPage.unofficialTitle")})]}),e.jsxs("ul",{className:"text-[11px] text-yellow-700 dark:text-yellow-300 space-y-0.5 pl-6 list-disc",children:[e.jsx("li",{children:s("cursorPage.unofficialItem1")}),e.jsx("li",{children:s("cursorPage.unofficialItem2")}),e.jsx("li",{children:s("cursorPage.unofficialItem3")})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ne,{icon:ms,label:s("cursorPage.integration"),ok:!!t?.enabled,detail:t?.enabled?s("cursorPage.enabled"):s("cursorPage.disabled")}),e.jsx(ne,{icon:q,label:s("cursorPage.authentication"),ok:!!(t?.authenticated&&!t?.token_expired),detail:t?.authenticated?t?.token_expired?s("cursorPage.expired"):t.auth_method??s("cursorPage.connected"):s("cursorPage.notConnected")}),e.jsx(ne,{icon:hs,label:s("cursorPage.daemon"),ok:!!t?.daemon_running,detail:t?.daemon_running?s("cursorPage.running"):s("cursorPage.stopped")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:s("cursorPage.actions")}),t?.enabled?e.jsxs(f,{variant:"outline",size:"sm",className:"w-full",onClick:()=>we(!1),disabled:h,children:[e.jsx(Ce,{className:"w-3.5 h-3.5 mr-1.5"}),s("cursorPage.disableIntegration")]}):e.jsxs(f,{size:"sm",className:"w-full",onClick:()=>we(!0),disabled:h,children:[e.jsx(gs,{className:"w-3.5 h-3.5 mr-1.5"}),s("cursorPage.enableIntegration")]}),e.jsxs(f,{variant:"outline",size:"sm",className:"w-full",onClick:Ge,disabled:ce,children:[ce?e.jsx(A,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}):e.jsx(q,{className:"w-3.5 h-3.5 mr-1.5"}),s("cursorPage.autoDetectAuth")]}),e.jsxs(f,{variant:"outline",size:"sm",className:"w-full",onClick:()=>I(!0),children:[e.jsx(q,{className:"w-3.5 h-3.5 mr-1.5"}),s("cursorPage.manualAuthImport")]}),t?.daemon_running?e.jsxs(f,{variant:"outline",size:"sm",className:"w-full",onClick:Be,disabled:de,children:[de?e.jsx(A,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}):e.jsx(Ce,{className:"w-3.5 h-3.5 mr-1.5"}),s("cursorPage.stopDaemon")]}):e.jsxs(f,{size:"sm",className:"w-full",onClick:Ue,disabled:!Ee,children:[Fe?e.jsx(A,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}):e.jsx(xs,{className:"w-3.5 h-3.5 mr-1.5"}),s("cursorPage.startDaemon")]})]})]})}),e.jsx("div",{className:"p-3 border-t bg-background text-xs text-muted-foreground",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{children:s("cursorPage.port")}),e.jsx("span",{children:t?.port??g?.port??ke})]})})]}),e.jsx("div",{className:"flex-1 flex flex-col min-w-0 bg-background overflow-hidden",children:e.jsxs("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-4 border-b bg-background flex items-center justify-between shrink-0",children:[e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-lg font-semibold",children:s("cursorPage.configuration")}),i&&e.jsx(M,{variant:"outline",className:"text-xs",children:"cursor.settings.json"})]}),i&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[s("cursorPage.lastModified")," ",i.exists?new Date(i.mtime).toLocaleString():s("cursorPage.neverSaved")]})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(f,{variant:"ghost",size:"sm",onClick:He,disabled:l||c,children:e.jsx(be,{className:oe("w-4 h-4",(l||c)&&"animate-spin")})}),e.jsx(f,{size:"sm",onClick:Qe,disabled:h||ie||!ve||!Oe,children:h||ie?e.jsxs(e.Fragment,{children:[e.jsx(A,{className:"w-4 h-4 mr-1 animate-spin"}),s("cursorPage.saving")]}):e.jsxs(e.Fragment,{children:[e.jsx(fs,{className:"w-4 h-4 mr-1"}),s("cursorPage.save")]})})]})]}),e.jsxs("div",{className:"flex-1 min-h-0 flex divide-x overflow-hidden",children:[e.jsx("div",{className:"w-[540px] shrink-0 flex flex-col min-h-0 overflow-hidden bg-muted/5",children:e.jsxs($e,{defaultValue:"config",className:"h-full flex flex-col",children:[e.jsx("div",{className:"px-4 pt-4 shrink-0",children:e.jsxs(Ye,{className:"w-full",children:[e.jsx(Y,{value:"config",className:"flex-1",children:s("cursorPage.modelConfig")}),e.jsx(Y,{value:"settings",className:"flex-1",children:s("cursorPage.settings")}),e.jsx(Y,{value:"info",className:"flex-1",children:s("cursorPage.info")})]})}),e.jsxs("div",{className:"flex-1 min-h-0 overflow-hidden flex flex-col",children:[e.jsx(ee,{value:"config",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(E,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[e.jsx(ps,{className:"w-4 h-4"}),s("cursorPage.presets")]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:s("cursorPage.presetsDesc")}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(f,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>Z("codex53"),disabled:d||r.length===0,title:"OpenAI-only mapping: GPT-5.3 Codex / Codex Max / GPT-5 Mini",children:[e.jsx(ae,{className:"w-3 h-3"}),"GPT-5.3 Codex"]}),e.jsxs(f,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>Z("claude46"),disabled:d||r.length===0,title:"Claude-first mapping: Opus 4.6 / Sonnet 4.5 / Haiku 4.5",children:[e.jsx(ae,{className:"w-3 h-3"}),"Claude 4.6"]}),e.jsxs(f,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>Z("gemini3"),disabled:d||r.length===0,title:"Gemini-first mapping: Gemini 3 Pro + Gemini 3 Flash",children:[e.jsx(ae,{className:"w-3 h-3"}),"Gemini 3 Pro"]})]})]}),e.jsx(ls,{}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-2",children:s("cursorPage.modelMapping")}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:s("cursorPage.modelMappingDesc")}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(G,{label:s("cursorPage.defaultModel"),description:s("cursorPage.defaultModelDesc"),value:w,models:L,disabled:d,onChange:a=>{P(n=>({...n,model:a}))}}),e.jsx(G,{label:s("cursorPage.opusModel"),description:s("cursorPage.opusModelDesc"),value:H,models:L,disabled:d,allowDefaultFallback:!0,onChange:a=>{P(n=>({...n,opus_model:a}))}}),e.jsx(G,{label:s("cursorPage.sonnetModel"),description:s("cursorPage.sonnetModelDesc"),value:V,models:L,disabled:d,allowDefaultFallback:!0,onChange:a=>{P(n=>({...n,sonnet_model:a}))}}),e.jsx(G,{label:s("cursorPage.haikuModel"),description:s("cursorPage.haikuModelDesc"),value:W,models:L,disabled:d,allowDefaultFallback:!0,onChange:a=>{P(n=>({...n,haiku_model:a}))}})]})]})]})})}),e.jsx(ee,{value:"settings",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(E,{className:"flex-1",children:e.jsx("div",{className:"p-4 space-y-6",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:s("cursorPage.runtimeSettings")}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(_,{htmlFor:"cursor-port",className:"text-xs",children:"Port"}),e.jsx(se,{id:"cursor-port",type:"number",min:1,max:65535,className:"max-w-[150px] h-8",value:fe,onChange:a=>{P(n=>({...n,port:a.target.value}))}})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(_,{htmlFor:"cursor-auto-start",className:"text-xs",children:s("cursorPage.autoStartDaemon")}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:s("cursorPage.autoStartDesc")})]}),e.jsx(ye,{id:"cursor-auto-start",checked:J,onCheckedChange:a=>{P(n=>({...n,auto_start:a}))}})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(_,{htmlFor:"cursor-ghost-mode",className:"text-xs",children:s("cursorPage.ghostMode")}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:s("cursorPage.ghostModeDesc")})]}),e.jsx(ye,{id:"cursor-ghost-mode",checked:Q,onCheckedChange:a=>{P(n=>({...n,ghost_mode:a}))}})]})]})})})}),e.jsx(ee,{value:"info",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(E,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:[e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:s("cursorPage.provider")}),e.jsx("span",{className:"font-mono",children:"Cursor IDE"})]}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:s("cursorPage.filePath")}),e.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-xs break-all",children:i?.path??"~/.ccs/cursor.settings.json"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Model mapping writes `ANTHROPIC_MODEL`, `ANTHROPIC_DEFAULT_OPUS_MODEL`, `ANTHROPIC_DEFAULT_SONNET_MODEL`, and `ANTHROPIC_DEFAULT_HAIKU_MODEL` in `cursor.settings.json`."})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-3",children:s("cursorPage.availableModels")}),d?e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(A,{className:"w-4 h-4 animate-spin"}),s("cursorPage.loadingModels")]}):r.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:s("cursorPage.noModels")}):e.jsx("div",{className:"space-y-2",children:r.map(a=>e.jsxs("div",{className:"rounded-lg border px-3 py-2 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:a.id}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[a.name," • ",a.provider]})]}),a.id===p&&e.jsx(M,{children:s("cursorPage.default")})]},a.id))})]})]})})})]})]})}),e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-2 bg-muted/30 border-b flex items-center gap-2 shrink-0 h-[45px]",children:[e.jsx(js,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:s("cursorPage.rawConfiguration")})]}),e.jsx(es,{rawJsonContent:X,isRawJsonValid:je,rawJsonEdits:T?he:null,rawSettingsEnv:i?.settings?.env,onChange:a=>{K(!0),Ie(a)}})]})]})]})})]}),e.jsx(ss,{open:Le,onOpenChange:I,children:e.jsxs(as,{children:[e.jsxs(ts,{children:[e.jsx(rs,{children:s("cursorPage.manualImportTitle")}),e.jsx(ns,{children:s("cursorPage.manualImportDesc")})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(_,{htmlFor:"cursor-manual-token",children:s("cursorPage.accessToken")}),e.jsx(se,{id:"cursor-manual-token",value:U,onChange:a=>ge(a.target.value),placeholder:s("cursorPage.accessTokenPlaceholder")})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(_,{htmlFor:"cursor-manual-machine-id",children:s("cursorPage.machineId")}),e.jsx(se,{id:"cursor-manual-machine-id",value:B,onChange:a=>xe(a.target.value),placeholder:s("cursorPage.machineIdPlaceholder")})]})]}),e.jsxs(os,{children:[e.jsx(f,{variant:"outline",onClick:()=>I(!1),children:s("cursorPage.cancel")}),e.jsxs(f,{onClick:Ke,disabled:le,children:[le?e.jsx(A,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(q,{className:"w-4 h-4 mr-2"}),s("cursorPage.import")]})]})]})})]})}export{Js as CursorPage};