@kaitranntt/ccs 7.69.1-dev.2 → 7.69.1-dev.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cliproxy/binary/version-cache.d.ts +10 -0
- package/dist/cliproxy/binary/version-cache.d.ts.map +1 -1
- package/dist/cliproxy/binary/version-cache.js +29 -7
- package/dist/cliproxy/binary/version-cache.js.map +1 -1
- package/dist/cliproxy/binary/version-checker.d.ts +14 -3
- package/dist/cliproxy/binary/version-checker.d.ts.map +1 -1
- package/dist/cliproxy/binary/version-checker.js +65 -36
- package/dist/cliproxy/binary/version-checker.js.map +1 -1
- package/dist/ui/assets/accounts-D7sfwYrK.js +1 -0
- package/dist/ui/assets/{alert-dialog-QyEXocpn.js → alert-dialog-CuN8HTEx.js} +1 -1
- package/dist/ui/assets/api-CI8RoZ-m.js +4 -0
- package/dist/ui/assets/{auth-section-BszF77uT.js → auth-section-C49fRTna.js} +1 -1
- package/dist/ui/assets/{backups-section-D6RgaOx1.js → backups-section-DeJGo6Co.js} +1 -1
- package/dist/ui/assets/channels-CEHW5H6N.js +1 -0
- package/dist/ui/assets/{checkbox-Dzwkj_Pg.js → checkbox-DVHcE1RO.js} +1 -1
- package/dist/ui/assets/claude-extension-CLmICnx_.js +1 -0
- package/dist/ui/assets/cliproxy-BQuYNZ_b.js +3 -0
- package/dist/ui/assets/cliproxy-ai-providers-Bjx7XtY6.js +15 -0
- package/dist/ui/assets/cliproxy-control-panel-DoLho1iE.js +1 -0
- package/dist/ui/assets/codex-BDfvFO8E.js +27 -0
- package/dist/ui/assets/confirm-dialog-D_5v8muu.js +1 -0
- package/dist/ui/assets/copilot-B4waN1q6.js +3 -0
- package/dist/ui/assets/{cursor-BrcDgu6X.js → cursor-DHHZs05u.js} +1 -1
- package/dist/ui/assets/droid-CZePX0Pf.js +2 -0
- package/dist/ui/assets/{globalenv-section-DoX37DqB.js → globalenv-section-nQDFHMda.js} +1 -1
- package/dist/ui/assets/{health-D_gdcxnc.js → health-BfS7V7RZ.js} +1 -1
- package/dist/ui/assets/{index-CTGpqIx6.js → index-B9VMppQ3.js} +1 -1
- package/dist/ui/assets/index-BDfXfBTa.js +72 -0
- package/dist/ui/assets/{index-DoVPk3vW.js → index-C5CFzca_.js} +1 -1
- package/dist/ui/assets/index-CRiWOwLR.js +1 -0
- package/dist/ui/assets/index-EboJtDBz.js +1 -0
- package/dist/ui/assets/index-yt8jgaSK.js +1 -0
- package/dist/ui/assets/logs-GW0Oy6XF.js +1 -0
- package/dist/ui/assets/{masked-input-C2H-Ax0Z.js → masked-input-D1Ilmeh7.js} +1 -1
- package/dist/ui/assets/proxy-status-widget-Bdh67BxQ.js +1 -0
- package/dist/ui/assets/{raw-json-settings-editor-panel-WxTn7-hS.js → raw-json-settings-editor-panel-DwzGE_kH.js} +1 -1
- package/dist/ui/assets/{searchable-select-1zOULoec.js → searchable-select-DbhlbNK0.js} +1 -1
- package/dist/ui/assets/{separator-BCfZ54mZ.js → separator-DziIoy6O.js} +1 -1
- package/dist/ui/assets/{shared-DlTbnc9n.js → shared-XJ2EhJPB.js} +1 -1
- package/dist/ui/assets/{table-Bx2cnkWN.js → table-D5bWyv-8.js} +1 -1
- package/dist/ui/assets/{updates-SiZKOnUD.js → updates-ClhhaqwU.js} +1 -1
- package/dist/ui/index.html +1 -1
- package/dist/web-server/routes/cliproxy-stats-routes.d.ts +37 -0
- package/dist/web-server/routes/cliproxy-stats-routes.d.ts.map +1 -1
- package/dist/web-server/routes/cliproxy-stats-routes.js +56 -10
- package/dist/web-server/routes/cliproxy-stats-routes.js.map +1 -1
- package/package.json +1 -1
- package/dist/ui/assets/accounts-D9eEaNx9.js +0 -1
- package/dist/ui/assets/api-7vQe0xOg.js +0 -4
- package/dist/ui/assets/channels-B1vgnNJX.js +0 -1
- package/dist/ui/assets/claude-extension-CKO4bJ22.js +0 -1
- package/dist/ui/assets/cliproxy-ai-providers-CmbFYVoR.js +0 -15
- package/dist/ui/assets/cliproxy-control-panel-M8ZfUq3C.js +0 -1
- package/dist/ui/assets/cliproxy-kHd-oC5W.js +0 -3
- package/dist/ui/assets/codex-BJ0RdMuh.js +0 -27
- package/dist/ui/assets/confirm-dialog-BlSaX2gK.js +0 -1
- package/dist/ui/assets/copilot-NJKZQXQ_.js +0 -3
- package/dist/ui/assets/droid-B9u9ZB-a.js +0 -2
- package/dist/ui/assets/index-BNU4Hhe_.js +0 -1
- package/dist/ui/assets/index-DFEMq3KP.js +0 -1
- package/dist/ui/assets/index-DOn6k1jF.js +0 -72
- package/dist/ui/assets/index-h08p9xL5.js +0 -1
- package/dist/ui/assets/logs-DtH4YMt4.js +0 -1
- package/dist/ui/assets/proxy-status-widget-BOrsn86w.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-Zb8sVEtn.js";import{r as y}from"./react-vendor-CNOkPC89.js";import{bt as te,bu as se,c as u,aF as re,L as ne,I as le,a as de,bv as ie,be as oe,bg as ce,n as be,d as K}from"./index-DOn6k1jF.js";import{M as ue}from"./masked-input-C2H-Ax0Z.js";import{p as me,R as P,w as ge,x as xe,u as B,n as fe,t as he,s as pe}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 ye(){const{state:s}=te(),t=se(),x=y.useCallback(async()=>{try{t.setWebSearchLoading(!0),t.setWebSearchError(null);const d=await fetch("/api/websearch");if(!d.ok)throw new Error("Failed to load WebSearch config");const b=await d.json();t.setWebSearchConfig(b)}catch(d){t.setWebSearchError(d.message)}finally{t.setWebSearchLoading(!1)}},[t]),i=y.useCallback(async()=>{try{t.setWebSearchStatusLoading(!0);const d=await fetch("/api/websearch/status");if(!d.ok)throw new Error("Failed to load status");const b=await d.json();t.setWebSearchStatus(b)}catch{}finally{t.setWebSearchStatusLoading(!1)}},[t]),k=y.useCallback(async d=>{const b=s.webSearchConfig;if(!b)return!1;const m={...b,...d,providers:{...b.providers,...d.providers},apiKeys:b.apiKeys};t.setWebSearchConfig(m);try{t.setWebSearchSaving(!0),t.setWebSearchError(null);const f={enabled:m.enabled,providers:m.providers};d.apiKeys&&(f.apiKeys=d.apiKeys);const h=await fetch("/api/websearch",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)});if(!h.ok){const g=await h.json();throw new Error(g.error||"Failed to save")}const v=await h.json();return t.setWebSearchConfig(v.websearch),await i(),t.setWebSearchSuccess(!0),setTimeout(()=>t.setWebSearchSuccess(!1),1500),!0}catch(f){return t.setWebSearchConfig(b),t.setWebSearchError(f.message),!1}finally{t.setWebSearchSaving(!1)}},[s.webSearchConfig,t,i]);return{config:s.webSearchConfig,status:s.webSearchStatus,loading:s.webSearchLoading,statusLoading:s.webSearchStatusLoading,saving:s.webSearchSaving,error:s.webSearchError,success:s.webSearchSuccess,fetchConfig:x,fetchStatus:i,saveConfig:k}}const ke={green:{accent:"from-emerald-500 via-lime-400 to-transparent",badge:"border-emerald-500/25 bg-emerald-500/10 text-emerald-800 dark:text-emerald-200",glow:"bg-emerald-500/18 dark:bg-emerald-500/22",surface:"border-emerald-500/30 bg-gradient-to-br from-emerald-500/10 via-background to-background dark:from-emerald-500/14",switchFrame:"border-emerald-500/20 bg-emerald-500/10"},blue:{accent:"from-sky-500 via-blue-500 to-transparent",badge:"border-sky-500/25 bg-sky-500/10 text-sky-800 dark:text-sky-200",glow:"bg-sky-500/18 dark:bg-sky-500/22",surface:"border-sky-500/30 bg-gradient-to-br from-sky-500/10 via-background to-background dark:from-sky-500/14",switchFrame:"border-sky-500/20 bg-sky-500/10"},amber:{accent:"from-amber-500 via-orange-500 to-transparent",badge:"border-amber-500/25 bg-amber-500/10 text-amber-800 dark:text-amber-200",glow:"bg-amber-500/18 dark:bg-amber-500/22",surface:"border-amber-500/30 bg-gradient-to-br from-amber-500/10 via-background to-background dark:from-amber-500/14",switchFrame:"border-amber-500/20 bg-amber-500/10"},cyan:{accent:"from-cyan-500 via-teal-400 to-transparent",badge:"border-cyan-500/25 bg-cyan-500/10 text-cyan-800 dark:text-cyan-200",glow:"bg-cyan-500/18 dark:bg-cyan-500/22",surface:"border-cyan-500/30 bg-gradient-to-br from-cyan-500/10 via-background to-background dark:from-cyan-500/14",switchFrame:"border-cyan-500/20 bg-cyan-500/10"},slate:{accent:"from-slate-500 via-slate-400 to-transparent",badge:"border-slate-500/20 bg-slate-500/10 text-slate-700 dark:text-slate-300",glow:"bg-slate-500/18 dark:bg-slate-500/22",surface:"border-slate-400/30 bg-gradient-to-br from-slate-500/8 via-background to-background dark:from-slate-500/12",switchFrame:"border-slate-400/20 bg-slate-500/10"}};function ve(s){switch(s){case"ready":return{chip:"border-emerald-500/25 bg-emerald-500/10 text-emerald-800 dark:text-emerald-200",dot:"bg-emerald-500"};case"setup":return{chip:"border-amber-500/25 bg-amber-500/10 text-amber-800 dark:text-amber-200",dot:"bg-amber-500"};case"idle":return{chip:"border-border/80 bg-muted/60 text-muted-foreground",dot:"bg-muted-foreground/70"}}}function M({title:s,description:t,detail:x,badge:i,badgeTone:k,statusLabel:d,statusTone:b,enabled:m,saving:f,onToggle:h,fields:v=[],docsUrl:g,installCommand:N,footerNote:S,children:C}){const j=ke[k],L=ve(b);return e.jsxs("div",{className:u("group relative overflow-hidden rounded-2xl border px-4 py-4 shadow-sm transition-all duration-200",m?j.surface:"border-border/70 bg-gradient-to-br from-background via-background to-muted/25",m&&"shadow-[0_18px_40px_-28px_rgba(15,23,42,0.55)]"),children:[e.jsx("div",{className:u("absolute inset-x-0 top-0 h-px bg-gradient-to-r",j.accent)}),e.jsx("div",{className:u("pointer-events-none absolute -right-6 -top-8 h-28 w-28 rounded-full blur-3xl",j.glow)}),e.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.045]",style:{backgroundImage:"radial-gradient(circle at 1px 1px, currentColor 1px, transparent 0)",backgroundSize:"22px 22px"}}),e.jsxs("div",{className:"relative flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2.5",children:[e.jsx("p",{className:"text-sm font-semibold tracking-tight",children:s}),e.jsx("span",{className:u("rounded-full border px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.18em]",j.badge),children:i}),e.jsxs("span",{className:u("inline-flex items-center gap-1.5 rounded-full border px-2 py-0.5 text-[10px] font-medium",L.chip),children:[e.jsx("span",{className:u("h-1.5 w-1.5 rounded-full",L.dot)}),d]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"text-sm leading-6 text-foreground/90",children:t}),x&&e.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:x})]})]}),e.jsx("div",{className:u("flex h-10 w-10 shrink-0 items-center justify-center rounded-xl border bg-background/75 backdrop-blur-sm",m?j.switchFrame:"border-border/70"),children:e.jsx(re,{checked:m,onCheckedChange:h,disabled:f})})]}),m&&v.length>0&&e.jsx("div",{className:"relative mt-4 rounded-xl border border-border/65 bg-background/70 p-3 shadow-[inset_0_1px_0_rgba(255,255,255,0.35)] backdrop-blur-sm",children:e.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:v.map(o=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(ne,{htmlFor:o.id,className:"text-[11px] font-medium text-muted-foreground",children:o.label}),o.saved&&e.jsx("span",{className:"text-[11px] font-medium text-emerald-600 dark:text-emerald-400",children:"Saved"})]}),e.jsx(le,{id:o.id,value:o.value,type:o.type??"text",placeholder:o.placeholder,onBlur:o.onBlur,onChange:R=>o.onChange(R.target.value),onKeyDown:o.onKeyDown,className:"h-8 border-border/70 bg-background/80 text-sm",disabled:f}),o.helpText&&e.jsx("p",{className:"text-[11px] text-muted-foreground",children:o.helpText})]},o.id))})}),m&&C&&e.jsx("div",{className:"relative mt-4 rounded-xl border border-border/65 bg-background/70 p-3 shadow-[inset_0_1px_0_rgba(255,255,255,0.35)] backdrop-blur-sm",children:C}),(S||N||g)&&e.jsxs("div",{className:"relative mt-4 space-y-2 rounded-xl border border-border/65 bg-muted/30 p-3",children:[S&&e.jsx("p",{className:"text-xs text-muted-foreground",children:S}),N&&e.jsx("code",{className:"block rounded-lg border border-border/60 bg-background/85 px-2.5 py-2 text-[11px] text-muted-foreground",children:N}),g&&e.jsxs("a",{href:g,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-xs font-medium text-primary hover:underline",children:[e.jsx(me,{className:"h-3 w-3"}),"View docs"]})]})]})}const Y=[{id:"exa",title:"Exa",defaultEnabled:!1},{id:"tavily",title:"Tavily",defaultEnabled:!1},{id:"brave",title:"Brave",defaultEnabled:!1},{id:"searxng",title:"SearXNG",defaultEnabled:!1},{id:"duckduckgo",title:"DuckDuckGo",defaultEnabled:!0},{id:"legacy",title:"Legacy CLI",defaultEnabled:!1}],U=[{id:"exa",title:"Exa",description:"Highest-priority API backend when enabled. Best for strong relevance and extracted text.",badge:"EXA_API_KEY",badgeTone:"amber",defaultEnabled:!1,fallbackDetail:"Set EXA_API_KEY",footerNote:"Runs before every other provider in the chain when enabled and ready.",fields:[{key:"max_results",label:"Max results",type:"number",placeholder:"5",helpText:"Clamp between 1 and 10 results.",defaultValue:5,min:1,max:10}]},{id:"tavily",title:"Tavily",description:"Agent-oriented API backend with concise web result content.",badge:"TAVILY_API_KEY",badgeTone:"cyan",defaultEnabled:!1,fallbackDetail:"Set TAVILY_API_KEY",footerNote:"Runs after Exa and before Brave when enabled and ready.",fields:[{key:"max_results",label:"Max results",type:"number",placeholder:"5",helpText:"Clamp between 1 and 10 results.",defaultValue:5,min:1,max:10}]},{id:"brave",title:"Brave Search",description:"API-backed search with clean metadata and broad web coverage.",badge:"BRAVE_API_KEY",badgeTone:"blue",defaultEnabled:!1,fallbackDetail:"Set BRAVE_API_KEY",footerNote:"Runs after Exa and Tavily, before DuckDuckGo.",fields:[{key:"max_results",label:"Max results",type:"number",placeholder:"5",helpText:"Clamp between 1 and 10 results.",defaultValue:5,min:1,max:10}]},{id:"searxng",title:"SearXNG",description:"Configurable JSON backend for self-hosted or public SearXNG instances.",badge:"SELF-HOSTED",badgeTone:"cyan",defaultEnabled:!1,fallbackDetail:"Set a valid base URL",footerNote:"Runs after Brave and before DuckDuckGo when enabled and ready.",fields:[{key:"url",label:"Base URL",type:"text",placeholder:"https://search.example.com",helpText:"Paste the instance base URL only. CCS appends /search?format=json for you and rejects embedded credentials.",defaultValue:""},{key:"max_results",label:"Max results",type:"number",placeholder:"5",helpText:"Clamp between 1 and 10 results.",defaultValue:5,min:1,max:10}]},{id:"duckduckgo",title:"DuckDuckGo",description:"Zero-setup floor. Keep this on unless you want no built-in fallback at all.",badge:"DEFAULT",badgeTone:"green",defaultEnabled:!0,fallbackDetail:"Built-in",footerNote:"Last real backend in the chain. No API key needed.",fields:[{key:"max_results",label:"Max results",type:"number",placeholder:"5",helpText:"Clamp between 1 and 10 results.",defaultValue:5,min:1,max:10}]}],V=[{id:"gemini",title:"Gemini CLI",description:"Optional legacy LLM fallback. Used only if every enabled real backend fails.",badge:"LEGACY",badgeTone:"slate",defaultEnabled:!1,fallbackDetail:"Optional fallback",footerNote:"Legacy path. Useful for compatibility, not the preferred search backend.",fields:[{key:"model",label:"Model",type:"text",placeholder:"gemini-2.5-flash",helpText:"CLI model passed to Gemini when this fallback runs.",defaultValue:"gemini-2.5-flash"},{key:"timeout",label:"Timeout (seconds)",type:"number",placeholder:"55",helpText:"Clamp between 5 and 300 seconds.",defaultValue:55,min:5,max:300}]},{id:"opencode",title:"OpenCode",description:"Optional legacy LLM fallback via OpenCode.",badge:"LEGACY",badgeTone:"slate",defaultEnabled:!1,fallbackDetail:"Optional fallback",footerNote:"Legacy path. Runs after Gemini in the fallback portion of the chain.",fields:[{key:"model",label:"Model",type:"text",placeholder:"opencode/grok-code",helpText:"OpenCode model passed to the CLI runner.",defaultValue:"opencode/grok-code"},{key:"timeout",label:"Timeout (seconds)",type:"number",placeholder:"90",helpText:"Clamp between 5 and 300 seconds.",defaultValue:90,min:5,max:300}]},{id:"grok",title:"Grok CLI",description:"Optional legacy xAI fallback. Requires the Grok CLI and GROK_API_KEY.",badge:"LEGACY",badgeTone:"slate",defaultEnabled:!1,fallbackDetail:"Optional fallback",footerNote:"Last step in the full fallback chain.",fields:[{key:"timeout",label:"Timeout (seconds)",type:"number",placeholder:"55",helpText:"Clamp between 5 and 300 seconds.",defaultValue:55,min:5,max:300}]}];function _(s,t){return t&&s?.available?"ready":t?"setup":"idle"}function I(s,t){return t&&s?.available?"Ready":t?"Needs setup":"Disabled"}function je(s){switch(s){case"ready":return"border-emerald-500/25 bg-emerald-500/10 text-emerald-800 dark:text-emerald-200";case"setup":return"border-amber-500/25 bg-amber-500/10 text-amber-800 dark:text-amber-200";case"idle":return"border-border/80 bg-background/85 text-muted-foreground"}}function we(s){switch(s){case"ready":return"bg-emerald-500";case"setup":return"bg-amber-500";case"idle":return"bg-border"}}function z(s){switch(s){case"ready":return"bg-emerald-500 shadow-[0_0_0_6px_rgba(16,185,129,0.12)]";case"setup":return"bg-amber-500 shadow-[0_0_0_6px_rgba(245,158,11,0.12)]";case"idle":return"bg-border"}}function X(s){switch(s){case"ready":return"bg-gradient-to-b from-emerald-500/55 to-border";case"setup":return"bg-gradient-to-b from-amber-500/55 to-border";case"idle":return"bg-border"}}function Ne(s,t){if(s.type==="number"){const i=Number.parseInt(t.trim(),10);if(!Number.isFinite(i))return s.defaultValue;const k=s.min??i,d=s.max??i;return Math.min(d,Math.max(k,i))}return t.trim()||String(s.defaultValue)}function H(s,t,x){const i=s?.[t]?.[x.key];return String(i??x.defaultValue)}function Se(s){return s==="exa"||s==="tavily"||s==="brave"}function Ce(s){if(!s?.configured)return"Not stored";if(!s.available&&s.source==="global_env")return"Stored in dashboard, but Global Env is disabled";switch(s.source){case"global_env":return"Stored in dashboard";case"process_env":return"Detected from shell env";case"both":return"Stored in dashboard + shell env";case"none":return"Not stored"}}function Ie(){const{t:s}=de(),{config:t,status:x,loading:i,statusLoading:k,saving:d,error:b,success:m,fetchConfig:f,fetchStatus:h,saveConfig:v}=ye(),{fetchRawConfig:g}=ie(),[N,S]=y.useState({}),[C,j]=y.useState({}),[L,o]=y.useState(null),[R,A]=y.useState(null),[F,q]=y.useState(!1);y.useEffect(()=>{f(),h(),g()},[f,h,g]);const E=y.useMemo(()=>new Map((x?.providers??[]).map(a=>[a.id,a])),[x?.providers]),w=V.filter(a=>t?.providers?.[a.id]?.enabled??a.defaultEnabled),J=w.some(a=>E.get(a.id)?.available),W=w.length===0?"Off":w.length===1?`${w[0].title} enabled`:`${w.length} enabled`,G=async(a,l)=>{const r=t?.providers??{};await v({providers:{...r,[a]:{...r[a],enabled:!l}}})&&await g()},Z=(a,l,r)=>{S(n=>({...n,[`${a}.${l}`]:r}))},Q=async(a,l)=>{if(!t)return;const r=`${a}.${l.key}`,n=t.providers??{},p=n[a]??{},c=p[l.key]??l.defaultValue,T=Ne(l,N[r]??H(n,a,l));if(S(D=>({...D,[r]:String(T)})),String(c)===String(T))return;await v({providers:{...n,[a]:{...p,[l.key]:T}}})&&(await g(),o(r),setTimeout(()=>{o(D=>D===r?null:D)},1200))},ee=async a=>{const l=C[a]?.trim()??"";if(!l)return;await v({apiKeys:{[a]:l}})&&(await g(),j(n=>({...n,[a]:""})),A(a),setTimeout(()=>{A(n=>n===a?null:n)},1200))},ae=async a=>{await v({apiKeys:{[a]:""}})&&(await g(),j(r=>({...r,[a]:""})),A(a),setTimeout(()=>{A(r=>r===a?null:r)},1200))},O=a=>(a.fields??[]).map(l=>{const r=`${a.id}.${l.key}`;return{id:r,label:l.label,value:N[r]??H(t?.providers??{},a.id,l),placeholder:l.placeholder,type:l.type,helpText:l.helpText,saved:L===r,onChange:n=>Z(a.id,l.key,n),onBlur:()=>{Q(a.id,l)},onKeyDown:n=>{n.key==="Enter"&&n.currentTarget.blur()}}});return i?e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[e.jsx(P,{className:"h-5 w-5 animate-spin"}),e.jsx("span",{children:s("settings.loading")})]})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`absolute left-5 right-5 top-20 z-10 transition-all duration-200 ease-out ${b||m?"translate-y-0 opacity-100":"pointer-events-none -translate-y-2 opacity-0"}`,children:[b&&e.jsxs(oe,{variant:"destructive",className:"py-2 shadow-lg",children:[e.jsx(ge,{className:"h-4 w-4"}),e.jsx(ce,{children:b})]}),m&&e.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-green-200 bg-green-50 px-3 py-2 text-green-700 shadow-lg dark:border-green-900/50 dark:bg-green-900/90 dark:text-green-300",children:[e.jsx(xe,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"text-sm font-medium",children:s("settings.saved")})]})]}),e.jsx(be,{className:"flex-1",children:e.jsxs("div",{className:"space-y-6 p-5",children:[e.jsxs("div",{className:"relative overflow-hidden rounded-2xl border bg-gradient-to-br from-background via-background to-muted/30 p-4 shadow-sm",children:[e.jsx("div",{className:"absolute inset-x-0 top-0 h-px bg-gradient-to-r from-primary/70 via-primary/20 to-transparent"}),e.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.035]",style:{backgroundImage:"repeating-linear-gradient(0deg, transparent, transparent 2px, currentColor 2px, currentColor 3px)"}}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"inline-flex h-8 w-8 items-center justify-center rounded-xl border border-primary/20 bg-primary/8 text-primary",children:e.jsx(B,{className:"h-4 w-4"})}),e.jsx("p",{className:"text-sm font-semibold tracking-tight",children:"Execution chain"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:k?s("settingsWebsearch.checking"):x?.readiness.message})]}),e.jsx(K,{variant:"ghost",size:"sm",onClick:h,disabled:k,children:e.jsx(P,{className:`h-4 w-4 ${k?"animate-spin":""}`})})]}),e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:Y.map((a,l)=>{const r=a.id==="legacy"?w.length>0:t?.providers?.[a.id]?.enabled??a.defaultEnabled,n=a.id==="legacy"?J?"ready":w.length>0?"setup":"idle":_(E.get(a.id),r),p=a.id==="legacy"?W:I(E.get(a.id),r);return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:u("inline-flex items-center gap-2 rounded-full border px-3 py-1.5 text-[11px] font-medium",je(n)),children:[e.jsx("span",{className:u("h-1.5 w-1.5 rounded-full",we(n))}),e.jsxs("span",{children:[a.title," · ",p]})]}),l<Y.length-1&&e.jsx("span",{className:"h-px w-4 rounded-full bg-border/80"})]},a.id)})})]})]}),e.jsxs("div",{className:"relative overflow-hidden rounded-2xl border bg-gradient-to-br from-background via-background to-muted/25 p-4 shadow-sm",children:[e.jsx("div",{className:"absolute inset-x-0 top-0 h-px bg-gradient-to-r from-sky-500/70 via-emerald-500/25 to-transparent"}),e.jsxs("div",{className:"relative space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-xl border border-sky-500/20 bg-sky-500/10 text-sky-700 dark:text-sky-300",children:e.jsx(B,{className:"h-4 w-4"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-semibold tracking-tight",children:"Primary backends"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Real backends run top-down before any legacy CLI fallback."})]})]}),e.jsx("div",{className:"space-y-3",children:U.map((a,l)=>{const r=E.get(a.id),n=t?.providers?.[a.id]?.enabled??a.defaultEnabled,p=_(r,n),c=Se(a.id)?a.id:null;return e.jsxs("div",{className:"grid grid-cols-[20px_minmax(0,1fr)] items-start gap-3",children:[e.jsx("div",{className:"flex h-full justify-center",children:e.jsxs("div",{className:"flex h-full flex-col items-center",children:[e.jsx("span",{className:u("mt-5 h-3 w-3 rounded-full ring-4 ring-background",z(p))}),l<U.length-1&&e.jsx("span",{className:u("mt-1 w-px flex-1",X(p))})]})}),e.jsx(M,{title:a.title,description:a.description,detail:r?.detail??a.fallbackDetail,badge:a.badge,badgeTone:a.badgeTone,statusLabel:I(r,n),statusTone:_(r,n),enabled:n,saving:d,onToggle:()=>{G(a.id,n)},fields:O(a),children:c&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-[0.18em] text-muted-foreground",children:"API Key"}),e.jsx("p",{className:"mt-1 text-sm text-foreground/90",children:Ce(t?.apiKeys?.[c])}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t?.apiKeys?.[c]?.maskedValue?`${t.apiKeys[c]?.envVar} ${t.apiKeys[c]?.maskedValue}`:`Store ${a.badge} here so the backend is ready immediately after you enable it.`})]}),R===a.id&&e.jsx("span",{className:"text-[11px] font-medium text-emerald-600 dark:text-emerald-400",children:"Saved"})]}),e.jsx(ue,{id:`${a.id}.api-key`,value:C[c]??"",onChange:T=>j($=>({...$,[c]:T.target.value})),placeholder:t?.apiKeys?.[c]?.configured?"Enter a new key to rotate the stored secret":`Paste ${a.badge}`,className:"bg-background/80 font-mono text-sm",disabled:d}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(K,{size:"sm",onClick:()=>{ee(c)},disabled:d||!(C[c]?.trim()??"").length,children:t?.apiKeys?.[c]?.configured?"Update key":"Save key"}),(t?.apiKeys?.[c]?.source==="global_env"||t?.apiKeys?.[c]?.source==="both")&&e.jsx(K,{variant:"outline",size:"sm",onClick:()=>{ae(c)},disabled:d,children:"Remove stored key"})]})]})})]},a.id)})})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("button",{type:"button",onClick:()=>q(a=>!a),className:u("flex w-full items-center justify-between gap-3 rounded-xl px-1 py-1 text-left transition-colors","hover:bg-muted/10"),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-xl border border-slate-400/20 bg-slate-500/10 text-slate-700 dark:text-slate-300",children:e.jsx(fe,{className:"h-4 w-4"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-semibold tracking-tight",children:"Legacy CLI fallbacks"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Runs only after every enabled real backend fails."})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"rounded-full border border-border/80 bg-background/85 px-2.5 py-1 text-[11px] font-medium text-muted-foreground",children:W}),F?e.jsx(he,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(pe,{className:"h-4 w-4 text-muted-foreground"})]})]}),F&&e.jsxs("div",{className:"relative overflow-hidden rounded-2xl border bg-gradient-to-br from-background via-background to-muted/20 p-3 shadow-sm",children:[e.jsx("div",{className:"absolute inset-x-0 top-0 h-px bg-gradient-to-r from-slate-500/60 via-slate-400/18 to-transparent"}),e.jsx("div",{className:"relative space-y-3",children:V.map((a,l)=>{const r=E.get(a.id),n=t?.providers?.[a.id]?.enabled??a.defaultEnabled,p=_(r,n);return e.jsxs("div",{className:"grid grid-cols-[20px_minmax(0,1fr)] items-start gap-3",children:[e.jsx("div",{className:"flex h-full justify-center",children:e.jsxs("div",{className:"flex h-full flex-col items-center",children:[e.jsx("span",{className:u("mt-5 h-3 w-3 rounded-full ring-4 ring-background",z(p))}),l<V.length-1&&e.jsx("span",{className:u("mt-1 w-px flex-1",X(p))})]})}),e.jsx(M,{title:a.title,description:a.description,detail:r?.detail??a.fallbackDetail,badge:a.badge,badgeTone:a.badgeTone,statusLabel:I(r,n),statusTone:_(r,n),enabled:n,saving:d,onToggle:()=>{G(a.id,n)},fields:O(a),docsUrl:r?.docsUrl,installCommand:r?.installCommand,footerNote:a.footerNote})]},a.id)})})]})]})]})}),e.jsx("div",{className:"border-t bg-background p-4",children:e.jsxs(K,{variant:"outline",size:"sm",onClick:()=>{f(),h(),g()},disabled:i||d,className:"w-full",children:[e.jsx(P,{className:`mr-2 h-4 w-4 ${i?"animate-spin":""}`}),s("settings.refresh")]})})]})}export{Ie as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-Zb8sVEtn.js";import{r as c,L as ne}from"./react-vendor-CNOkPC89.js";import{c as n,L as b,aF as O,r as de,s as oe,t as ce,v as me,w,I as R,d as f,n as C,Q as G,R as J,U as _,V as E,Y as L,C as y,j as k,S as x,b as T,bl as xe}from"./index-DOn6k1jF.js";import{a7 as ue,aG as pe,at as ge,Q as he,A as D,$ as z,am as P,_ as be,aD as fe,aY as ve,Y as je,ah as Ne,L as ye,aZ as we,a6 as $,Z as M,au as ke,a_ as Se,i as Le,R as Z,d as A,a$ as Ce,ag as X,C as ee}from"./icons-KVCk4_U8.js";import{u as Q,a as _e,b as Ee,k as Ie}from"./tanstack-CrmUhA7Z.js";import{t as q}from"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";function W(r,s){const t=Number.parseInt(r,10);return Number.isNaN(t)?s:Math.max(0,t)}function K({config:r,onSave:s,isPending:t}){const[d,o]=c.useState(r);c.useEffect(()=>{o(r)},[r]);const m=c.useMemo(()=>JSON.stringify(d)!==JSON.stringify(r),[r,d]);return e.jsxs("div",{className:"group relative overflow-hidden rounded-2xl border-2 border-border/60 bg-card/40 p-1 shadow-lg transition-all hover:border-border",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border bg-muted/30 px-5 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-lg bg-primary/5 border border-primary/20",children:e.jsx(ue,{className:"h-3.5 w-3.5 text-primary"})}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx("h3",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-foreground",children:"Logging Policy"}),e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-[0.1em] text-foreground/45",children:"Retention and privacy"})]})]}),e.jsx("div",{className:n("h-1.5 w-1.5 rounded-full",r.enabled?"bg-emerald-500 shadow-[0_0_8px_rgba(16,185,129,0.5)]":"bg-zinc-500")})]}),e.jsxs("div",{className:"space-y-6 p-5",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"rounded-xl border border-border/40 bg-background/50 p-3 flex flex-col gap-1",children:[e.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.12em] text-muted-foreground/70",children:"Active Status"}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:n("text-[11px] font-semibold uppercase tracking-[0.1em]",r.enabled?"text-emerald-500":"text-zinc-500"),children:r.enabled?"Live":"Off"})})]}),e.jsxs("div",{className:"rounded-xl border border-border/40 bg-background/50 p-3 flex flex-col gap-1",children:[e.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.12em] text-muted-foreground/70",children:"Redaction"}),e.jsx("span",{className:n("text-[11px] font-semibold uppercase tracking-[0.1em]",r.redact?"text-primary":"text-muted-foreground/40"),children:r.redact?"Enforced":"Plain"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-xl border border-border/40 bg-background/20 px-4 py-3 transition-colors hover:bg-background/40",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(b,{htmlFor:"logs-enabled",className:"text-[12px] font-semibold uppercase tracking-[0.12em]",children:"Pipeline"}),e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground/55",children:"Enable structured logging"})]}),e.jsx(O,{id:"logs-enabled",checked:d.enabled,onCheckedChange:a=>o(l=>({...l,enabled:a})),className:"data-[state=checked]:bg-primary"})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-xl border border-border/40 bg-background/20 px-4 py-3 transition-colors hover:bg-background/40",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(b,{htmlFor:"logs-redact",className:"text-[12px] font-semibold uppercase tracking-[0.12em]",children:"Masking"}),e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground/55",children:"Sanitize payload data"})]}),e.jsx(O,{id:"logs-redact",checked:d.redact,onCheckedChange:a=>o(l=>({...l,redact:a})),className:"data-[state=checked]:bg-primary"})]})]}),e.jsxs("div",{className:"space-y-4 pt-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 px-1",children:[e.jsx(pe,{className:"h-3 w-3 text-primary/40"}),e.jsx(b,{htmlFor:"logs-config-level",className:"text-[10px] font-semibold uppercase tracking-[0.12em] text-foreground/70",children:"Minimum Operational Threshold"})]}),e.jsxs(de,{value:d.level,onValueChange:a=>o(l=>({...l,level:a})),children:[e.jsx(oe,{id:"logs-config-level",className:"h-10 rounded-xl border-2 border-border/40 bg-background/50 text-[12px] font-semibold uppercase tracking-[0.1em] focus:ring-0",children:e.jsx(ce,{})}),e.jsxs(me,{className:"border-2 border-border bg-card",children:[e.jsx(w,{value:"error",className:"text-[11px] font-semibold uppercase tracking-[0.1em]",children:"Error Only"}),e.jsx(w,{value:"warn",className:"text-[11px] font-semibold uppercase tracking-[0.1em]",children:"Warn + Above"}),e.jsx(w,{value:"info",className:"text-[11px] font-semibold uppercase tracking-[0.1em]",children:"Info + Above"}),e.jsx(w,{value:"debug",className:"text-[11px] font-semibold uppercase tracking-[0.1em]",children:"Full Debug"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"logs-rotate-mb",className:"px-1 text-[10px] font-semibold uppercase tracking-[0.1em] text-foreground/50",children:"Rotation (MB)"}),e.jsx(R,{id:"logs-rotate-mb",type:"number",min:1,className:"h-10 rounded-xl border-2 border-border/40 bg-background/50 font-mono text-[12px] font-medium focus-visible:ring-0",value:d.rotate_mb,onChange:a=>o(l=>({...l,rotate_mb:W(a.target.value,l.rotate_mb)}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"logs-retain-days",className:"px-1 text-[10px] font-semibold uppercase tracking-[0.1em] text-foreground/50",children:"Retain (Days)"}),e.jsx(R,{id:"logs-retain-days",type:"number",min:1,className:"h-10 rounded-xl border-2 border-border/40 bg-background/50 font-mono text-[12px] font-medium focus-visible:ring-0",value:d.retain_days,onChange:a=>o(l=>({...l,retain_days:W(a.target.value,l.retain_days)}))})]})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 pt-4 border-t border-border",children:[e.jsxs(f,{onClick:()=>s(d),disabled:!m||t,className:"h-10 w-full gap-2 rounded-xl bg-primary text-[11px] font-semibold uppercase tracking-[0.14em] shadow-lg shadow-primary/20 transition-all hover:scale-[1.02] active:scale-[0.98]",children:[e.jsx(ge,{className:"h-3.5 w-3.5"}),"Commit Changes"]}),e.jsxs(f,{variant:"ghost",onClick:()=>o(r),disabled:!m||t,className:"h-9 gap-2 text-[10px] font-medium uppercase tracking-[0.12em] text-foreground/45 hover:text-foreground",children:[e.jsx(he,{className:"h-3 w-3"}),"Rollback Draft"]})]})]}),e.jsxs("div",{className:"flex items-center justify-between bg-muted/20 px-5 py-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(D,{className:"h-2.5 w-2.5 text-primary/40"}),e.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.12em] text-foreground/30",children:"Operational Logic v3.4"})]}),m&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"h-1 w-1 rounded-full bg-amber-500 animate-pulse"}),e.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.12em] text-amber-500/70",children:"Pending"})]})]})]})}function Qe(r){if(r==null)return"{}";try{return JSON.stringify(r,null,2)}catch{return String(r)}}function Fe(r){switch(r){case"error":return"Error";case"warn":return"Warn";case"info":return"Info";case"debug":return"Debug"}}const Re={error:"border-red-500/30 bg-red-500/10 text-red-700 dark:text-red-300",warn:"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300",info:"border-sky-500/30 bg-sky-500/10 text-sky-700 dark:text-sky-300",debug:"border-zinc-500/30 bg-zinc-500/10 text-zinc-700 dark:text-zinc-300"};function re({level:r,className:s}){return e.jsx("span",{className:n("inline-flex items-center rounded-full border px-2 py-0.5 text-[11px] font-medium uppercase tracking-[0.12em]",Re[r],s),children:Fe(r)})}function S({label:r,value:s,icon:t}){return e.jsxs("div",{className:"group relative flex flex-col gap-1.5 rounded-xl border border-border/40 bg-background/40 p-3 transition-all hover:bg-background/80 hover:shadow-lg hover:shadow-black/5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[t&&e.jsx(t,{className:"h-3 w-3 text-primary/40 group-hover:text-primary transition-colors"}),e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-[0.12em] text-muted-foreground/70 transition-colors group-hover:text-primary/60",children:r})]}),e.jsx("div",{className:"h-1 w-1 rounded-full bg-border/40 group-hover:bg-primary/40 transition-colors"})]}),e.jsx("p",{className:"truncate font-mono text-[13px] font-medium tracking-tight text-foreground/85 transition-colors group-hover:text-foreground",children:s})]})}function V({entry:r,sourceLabel:s}){return r?e.jsxs("div",{className:"flex h-full flex-col bg-card/30 backdrop-blur-sm animate-in fade-in slide-in-from-right-4 duration-500",children:[e.jsxs("div",{className:"relative shrink-0 border-b border-border bg-card/60 p-6 shadow-sm overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 opacity-[0.03] pointer-events-none [background-image:radial-gradient(circle_at_center,var(--primary)_1px,transparent_0)] [background-size:16px_16px]"}),e.jsxs("div",{className:"relative space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(re,{level:r.level,className:"h-5 px-3 shadow-lg shadow-black/5"}),e.jsx("div",{className:"h-4 w-px bg-border/60"}),e.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-border bg-background/50 px-3 py-1 shadow-inner",children:[e.jsx(P,{className:"h-3 w-3 text-primary/60"}),e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.12em] text-foreground/75",children:s??r.source})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(D,{className:"h-3 w-3 animate-pulse text-emerald-500"}),e.jsx("span",{className:"font-mono text-[11px] font-medium uppercase tracking-[0.12em] text-muted-foreground/45",children:new Date(r.timestamp).toLocaleTimeString(void 0,{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-1 w-4 rounded-full bg-primary/40"}),e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-[0.12em] text-primary/65",children:"Event"})]}),e.jsx("h2",{className:"text-[24px] font-semibold tracking-tight text-foreground leading-tight break-words",children:r.event}),e.jsx("div",{className:"rounded-xl border-l-4 border-primary/20 bg-muted/20 p-4 shadow-inner",children:e.jsx("p",{className:"text-[14px] font-medium leading-relaxed text-foreground/85 selection:bg-primary/20",children:r.message})})]})]})]}),e.jsx(C,{className:"flex-1",children:e.jsx("div",{className:"p-6",children:e.jsxs(G,{defaultValue:"details",className:"space-y-8",children:[e.jsxs(J,{className:"grid h-auto w-full grid-cols-2 gap-1 rounded-xl border border-border/60 bg-muted/40 p-1",children:[e.jsxs(_,{value:"details",className:"min-w-0 gap-2 rounded-lg px-3 py-2 text-[11px] font-semibold uppercase tracking-[0.1em] transition-all data-[state=active]:bg-background data-[state=active]:text-primary data-[state=active]:shadow-sm",children:[e.jsx(be,{className:"h-3.5 w-3.5"}),"Details"]}),e.jsxs(_,{value:"raw",className:"min-w-0 gap-2 rounded-lg px-3 py-2 text-[11px] font-semibold uppercase tracking-[0.1em] transition-all data-[state=active]:bg-background data-[state=active]:text-primary data-[state=active]:shadow-sm",children:[e.jsx(fe,{className:"h-3.5 w-3.5"}),"Raw Context"]})]}),e.jsxs(E,{value:"details",className:"mt-0 space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:[e.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[e.jsx(S,{label:"Entry Signature",value:r.id.slice(0,16)+"...",icon:ve}),e.jsx(S,{label:"Telemetry Origin",value:r.source,icon:P}),e.jsx(S,{label:"Process ID",value:r.processId??"NA",icon:je}),e.jsx(S,{label:"Operational Run",value:r.runId?.slice(0,8)??"NA",icon:Ne})]}),e.jsxs("div",{className:"relative overflow-hidden rounded-[2rem] border border-border bg-muted/10 p-1 shadow-inner group",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-transparent via-primary/[0.03] to-transparent h-[200%] -top-full animate-[scan_8s_linear_infinite] pointer-events-none"}),e.jsxs("div",{className:"rounded-[calc(2rem-4px)] border border-dashed border-border/40 bg-background/50 p-6 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-primary/5 border border-primary/20 text-primary shadow-inner",children:e.jsx(z,{className:"h-4 w-4"})}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-[0.12em] text-primary",children:"Automated Summary"}),e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-[0.1em] text-muted-foreground/55",children:"Quick interpretation"})]})]}),e.jsxs("p",{className:"text-[13px] leading-relaxed text-muted-foreground/80 font-medium",children:["This telemetry node was captured from"," ",e.jsx("span",{className:"rounded bg-muted/40 px-1.5 py-0.5 font-semibold text-foreground",children:s??r.source}),"operating at the"," ",e.jsx("span",{className:n("rounded px-1.5 py-0.5 text-[11px] font-semibold uppercase tracking-[0.08em]",r.level==="error"?"bg-red-500/10 text-red-500":r.level==="warn"?"bg-amber-500/10 text-amber-500":r.level==="info"?"bg-sky-500/10 text-sky-500":"bg-zinc-500/10 text-zinc-500"),children:r.level})," ","threshold. The operational payload indicates an event state of"," ",e.jsx("span",{className:"font-semibold text-foreground",children:r.event}),"."]})]})]})]}),e.jsx(E,{value:"raw",className:"mt-0 animate-in fade-in slide-in-from-bottom-2 duration-500",children:e.jsxs("div",{className:"group relative rounded-2xl border-2 border-border bg-zinc-950 p-1 shadow-2xl transition-all hover:border-primary/20",children:[e.jsx("div",{className:"absolute right-4 top-4 z-10 opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx("div",{className:"rounded-md border border-white/10 bg-white/5 px-2 py-1 text-[9px] font-medium uppercase tracking-[0.12em] text-white/45 backdrop-blur-md",children:"JSON.RAW.MODE"})}),e.jsx(C,{className:"h-[30rem] w-full rounded-xl p-6",children:e.jsx("pre",{className:"font-mono text-[12px] leading-relaxed tracking-tight text-zinc-400 selection:bg-primary/40 selection:text-primary-foreground",children:Qe({id:r.id,timestamp:r.timestamp,level:r.level,source:r.source,event:r.event,message:r.message,processId:r.processId,runId:r.runId,context:r.context??{}})})})]})})]})})}),e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-t border-border bg-muted/5 px-6 py-3",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 shadow-[0_0_8px_rgba(16,185,129,0.5)]"}),e.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.12em] text-foreground/35",children:"Node Verified"})]}),e.jsx("div",{className:"h-3 w-px bg-border/40"}),e.jsx("span",{className:"text-[10px] font-medium tabular-nums uppercase tracking-[0.12em] text-foreground/35",children:r.id.slice(0,8)})]}),e.jsx("div",{className:"rounded-full bg-primary/5 px-2 py-0.5 border border-primary/10",children:e.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.12em] text-primary/65",children:"CCS-TEC-v3"})})]})]}):e.jsxs("div",{className:"flex h-full flex-col items-center justify-center p-8 text-center animate-in fade-in duration-1000",children:[e.jsxs("div",{className:"relative mb-8",children:[e.jsx("div",{className:"absolute inset-0 animate-ping rounded-full bg-primary/5 p-12"}),e.jsx("div",{className:"relative rounded-full border-2 border-dashed border-border/40 p-10 bg-muted/5",children:e.jsx(z,{className:"h-10 w-10 text-muted-foreground/20"})})]}),e.jsxs("div",{className:"max-w-xs space-y-3",children:[e.jsx("h3",{className:"text-[15px] font-semibold uppercase tracking-[0.14em] text-foreground/65",children:"Inspector Standby"}),e.jsx("p",{className:"text-[13px] leading-relaxed text-muted-foreground/55 font-medium",children:"Select a telemetry node from the active data queue to perform deep analysis of its operational context."})]})]})}function Y({entries:r,selectedEntryId:s,onSelect:t,sourceLabels:d,isLoading:o,isFetching:m}){return e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col bg-background/50 backdrop-blur-sm",children:[e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border bg-card/40 px-6 py-3 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-2 w-2 animate-pulse rounded-full bg-primary shadow-[0_0_12px_rgba(var(--primary),0.6)]"}),e.jsx("h2",{className:"text-[12px] font-semibold uppercase tracking-[0.14em] text-foreground",children:"Live Entry Stream"})]}),e.jsx("div",{className:"h-4 w-px bg-border/60"}),e.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-emerald-500/20 bg-emerald-500/10 px-2 py-0.5",children:[e.jsx(D,{className:"h-3 w-3 text-emerald-500"}),e.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.12em] text-emerald-600",children:"Live telemetry"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[m&&e.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-primary/20 bg-primary/10 px-3 py-1",children:[e.jsx(ye,{className:"h-3 w-3 animate-spin text-primary"}),e.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.12em] text-primary",children:"Syncing"})]}),e.jsx("span",{className:"font-mono text-[10px] font-medium uppercase tracking-[0.16em] text-foreground/35",children:"NODE.01"})]})]}),e.jsxs("div",{className:"flex items-center gap-0 border-b border-border bg-muted/30 px-0 py-2 text-[10px] font-semibold uppercase tracking-[0.12em] text-foreground/45",children:[e.jsx("div",{className:"w-[6.5rem] shrink-0 px-6",children:"Time"}),e.jsx("div",{className:"w-14 shrink-0 border-l border-border/10 px-2 text-center",children:"Lvl"}),e.jsx("div",{className:"w-[15rem] shrink-0 border-l border-border/10 px-4",children:"Source"}),e.jsx("div",{className:"flex-1 border-l border-border/10 px-4",children:"Message"}),e.jsx("div",{className:"w-[5.5rem] shrink-0 border-l border-border/10 px-2 text-center",children:"Proc"}),e.jsx("div",{className:"w-[5.5rem] shrink-0 border-l border-border/10 px-3 text-center",children:"Run"}),e.jsx("div",{className:"w-11 shrink-0 border-l border-border/10 px-2 text-center",children:"Open"})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:o?e.jsx("div",{className:"space-y-1 p-2",children:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15].map(a=>e.jsx("div",{className:"h-10 w-full animate-pulse rounded-lg border border-border/5 bg-muted/20"},a))}):r.length===0?e.jsxs("div",{className:"flex h-full animate-in fade-in duration-1000 flex-col items-center justify-center gap-6 px-8 text-center",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 animate-ping rounded-full bg-muted/5 p-12"}),e.jsx("div",{className:"relative rounded-full border border-dashed border-border/40 bg-muted/5 p-10",children:e.jsx(we,{className:"h-10 w-10 text-muted-foreground/20"})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[13px] font-semibold uppercase tracking-[0.14em] text-foreground/55",children:"No matching entries"}),e.jsx("p",{className:"max-w-[18rem] text-[12px] font-medium leading-relaxed text-muted-foreground/60",children:"Your current source, level, or search filters are hiding the stream. Adjust them to bring entries back into view."})]})]}):e.jsx(C,{className:"h-full",children:e.jsx("div",{className:"flex flex-col",children:r.map(a=>{const l=a.id===s;return e.jsxs("button",{type:"button",onClick:()=>t(a.id),className:n("group relative flex w-full items-center border-b border-border/5 px-0 py-2.5 text-left transition-all duration-150",l?"z-10 bg-primary/[0.08] shadow-[inset_4px_0_0_rgba(var(--primary),1)]":"bg-transparent hover:bg-muted/30"),children:[e.jsx("div",{className:"absolute inset-y-0 left-0 w-1 origin-center scale-y-0 bg-primary transition-transform duration-300 group-hover:scale-y-100"}),e.jsxs("div",{className:"flex w-full items-center gap-0",children:[e.jsx("div",{className:"flex w-[6.5rem] shrink-0 items-center",children:e.jsx("p",{className:n("px-6 font-mono text-[11px] font-semibold tabular-nums transition-colors",l?"text-primary":"text-foreground/60 group-hover:text-foreground"),children:new Date(a.timestamp).toLocaleTimeString(void 0,{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})})}),e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-0",children:[e.jsx("div",{className:"flex w-14 shrink-0 items-center justify-center opacity-80 transition-opacity group-hover:opacity-100",children:e.jsx(re,{level:a.level,className:"origin-center scale-[0.85]"})}),e.jsxs("div",{className:"flex w-[15rem] shrink-0 flex-col gap-0.5 overflow-hidden px-4",children:[e.jsx("span",{className:n("truncate text-[11px] font-semibold uppercase tracking-[0.12em] transition-colors",l?"text-foreground":"text-foreground/50 group-hover:text-foreground/80"),children:d[a.source]??a.source}),e.jsx("span",{className:"truncate text-[10px] font-medium uppercase tracking-[0.1em] text-muted-foreground/55",children:a.event})]}),e.jsx("div",{className:"min-w-0 flex-1 px-4",children:e.jsx("p",{className:n("truncate text-[13px] font-medium leading-5 transition-colors",l?"text-foreground":"text-foreground/70 group-hover:text-foreground"),children:a.message})}),e.jsx("div",{className:"flex w-[5.5rem] shrink-0 items-center justify-center px-2 font-mono text-[10px] font-semibold tabular-nums tracking-[0.12em] text-foreground/30 transition-colors group-hover:text-primary/45",children:a.processId??"????"}),e.jsx("div",{className:"flex w-[5.5rem] shrink-0 items-center justify-center px-3 font-mono text-[10px] font-semibold tabular-nums tracking-[0.12em] text-foreground/30 transition-colors group-hover:text-primary/45",children:a.runId?.slice(0,4).toUpperCase()??"NONE"}),e.jsx("div",{className:"flex w-11 shrink-0 items-center justify-center px-2",children:e.jsx("div",{className:n("flex h-7 w-7 items-center justify-center rounded-full border transition-all",l?"animate-in zoom-in duration-300 border-primary/20 bg-primary/10 text-primary":"border-transparent text-foreground/20 group-hover:border-border/40 group-hover:bg-background/80 group-hover:text-foreground/55"),children:e.jsx($,{className:"h-3.5 w-3.5"})})})]})]})]},a.id)})})})}),e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-t border-border bg-muted/5 px-6 py-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.12em] text-foreground/35",children:"Node: CCS-CORE"}),e.jsx("div",{className:"h-1 w-1 rounded-full bg-border/40"}),e.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.12em] text-foreground/35",children:"Status: Operational"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("span",{className:"text-[10px] font-medium uppercase tracking-[0.12em] text-foreground/35",children:["Entries: ",r.length]})})]})]})}const se=["logs","config"],ae=["logs","sources"],Te=150;function De(){const[r,s]=c.useState("all"),[t,d]=c.useState("all"),[o,m]=c.useState(""),[a,l]=c.useState(Te),[g,u]=c.useState(null),p=c.useDeferredValue(o.trim()),h=Q({queryKey:se,queryFn:async()=>(await L.logs.getConfig()).logging,refetchInterval:3e4}),v=Q({queryKey:ae,queryFn:async()=>(await L.logs.getSources()).sources,refetchInterval:15e3}),i=Q({queryKey:["logs","entries",r,t,p,a],queryFn:async()=>(await L.logs.getEntries({source:r==="all"?void 0:r,level:t==="all"?void 0:t,search:p||void 0,limit:a})).entries,placeholderData:Ie,refetchInterval:1e4}),I=c.useMemo(()=>{const N=i.data??[];return N.length===0?null:g&&N.some(j=>j.id===g)?g:N[0]?.id??null},[i.data,g]),te=c.useMemo(()=>(i.data??[]).find(N=>N.id===I)??null,[I,i.data]),ie=c.useMemo(()=>(v.data??[]).map(j=>j.lastTimestamp).filter(j=>!!j).sort((j,le)=>le.localeCompare(j))[0]??null,[v.data]);return{configQuery:h,sourcesQuery:v,entriesQuery:i,selectedSource:r,setSelectedSource:s,selectedLevel:t,setSelectedLevel:d,search:o,setSearch:m,limit:a,setLimit:l,selectedEntryId:I,setSelectedEntryId:u,selectedEntry:te,latestTimestamp:ie,isInitialLoading:!h.data&&h.isLoading||!v.data&&v.isLoading||!i.data&&i.isLoading}}function Oe(){const r=_e();return Ee({mutationFn:s=>L.logs.updateConfig(s),onSuccess:async()=>{await Promise.all([r.invalidateQueries({queryKey:se}),r.invalidateQueries({queryKey:ae}),r.invalidateQueries({queryKey:["logs","entries"]})]),q.success("Logging configuration saved.")},onError:s=>{q.error(s.message||"Failed to save logging configuration.")}})}function ze(){return[{value:"all",label:"All levels"},{value:"error",label:"Errors"},{value:"warn",label:"Warnings"},{value:"info",label:"Info"},{value:"debug",label:"Debug"}]}function Pe(r){return Object.fromEntries(r.map(s=>[s.source,s.label]))}function H({sources:r,selectedSource:s,onSourceChange:t,selectedLevel:d,onLevelChange:o,search:m,onSearchChange:a,limit:l,onLimitChange:g,onRefresh:u,isRefreshing:p}){const h=ze(),v=[50,100,150,250];return e.jsxs("div",{className:"flex flex-col gap-6 animate-in fade-in slide-in-from-left-2 duration-700",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between px-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-primary shadow-[0_0_8px_rgba(var(--primary),0.5)]"}),e.jsx(b,{htmlFor:"logs-search",className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-foreground/80",children:"Payload Search"})]}),e.jsx(M,{className:"h-3 w-3 text-primary/20"})]}),e.jsxs("div",{className:"group relative",children:[e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-3.5 flex items-center transition-all group-focus-within:translate-x-1",children:e.jsx(ke,{className:"h-3.5 w-3.5 text-foreground/20 group-focus-within:text-primary transition-colors"})}),e.jsx(R,{id:"logs-search","aria-label":"Search",value:m,onChange:i=>a(i.target.value),placeholder:"Scan for patterns...",className:"h-11 rounded-xl border-2 border-border/40 bg-background/50 pl-10 text-[13px] font-medium text-foreground placeholder:text-foreground/35 focus-visible:border-primary/40 focus-visible:ring-0 transition-all shadow-inner"})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 px-1",children:[e.jsx(Se,{className:"h-3 w-3 text-primary/40"}),e.jsx(b,{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-foreground/80",children:"Source Matrix"})]}),e.jsxs("div",{className:"flex flex-col gap-1","aria-label":"Source filter",children:[e.jsxs("button",{type:"button",onClick:()=>t("all"),className:n("group relative flex items-center justify-between rounded-lg border px-3 py-2 transition-all active:scale-[0.98]",s==="all"?"border-primary/50 bg-primary/10 text-primary shadow-[0_0_15px_rgba(var(--primary),0.1)]":"border-border/40 bg-muted/20 text-foreground/40 hover:border-border hover:bg-muted/40 hover:text-foreground/80"),children:[e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.12em]",children:"Global Stream"}),s==="all"&&e.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-primary shadow-[0_0_8px_rgba(var(--primary),0.8)]"})]}),e.jsx("div",{className:"grid grid-cols-2 gap-1 mt-1",children:r.map(i=>e.jsx("button",{type:"button",onClick:()=>t(i.source),className:n("rounded-lg border px-2.5 py-1.5 text-[10px] font-semibold uppercase tracking-[0.1em] transition-all active:scale-[0.97]",s===i.source?"border-primary/50 bg-primary/10 text-primary shadow-sm":"border-border/40 bg-muted/20 text-foreground/40 hover:border-border hover:bg-muted/40 hover:text-foreground/80"),children:i.label},i.source))})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 px-1",children:[e.jsx(Le,{className:"h-3 w-3 text-primary/40"}),e.jsx(b,{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-foreground/80",children:"Sensitivity"})]}),e.jsx("div",{className:"grid grid-cols-2 gap-1.5","aria-label":"Level filter",children:h.map(i=>e.jsxs("button",{type:"button",onClick:()=>o(i.value),className:n("flex flex-col items-center gap-1 rounded-lg border px-2 py-2 text-[10px] font-semibold uppercase tracking-[0.1em] transition-all active:scale-[0.97]",d===i.value?"border-primary/50 bg-primary/10 text-primary shadow-[0_0_15px_rgba(var(--primary),0.1)]":"border-border/40 bg-muted/20 text-foreground/40 hover:border-border hover:bg-muted/40 hover:text-foreground/80"),children:[e.jsx("span",{children:i.label}),e.jsx("div",{className:n("h-0.5 w-4 rounded-full transition-colors",d===i.value?"bg-primary":"bg-foreground/10")})]},i.value))})]}),e.jsx("div",{className:"mt-4 rounded-2xl border-2 border-border bg-card/40 p-1.5 shadow-xl shadow-black/5",children:e.jsxs("div",{className:"rounded-[calc(1rem-2px)] border border-dashed border-border bg-background/60 p-4 space-y-5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-[0.14em] text-primary",children:"Operational Window"}),e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-[0.1em] text-foreground/45",children:"Tail Capacity"})]}),e.jsx("div",{className:"h-8 w-8 rounded-lg bg-primary/5 border border-primary/10 flex items-center justify-center",children:e.jsx(M,{className:"h-4 w-4 text-primary/40"})})]}),e.jsx("div",{className:"grid grid-cols-4 gap-1.5","aria-label":"Visible entries",children:v.map(i=>e.jsx("button",{type:"button",onClick:()=>g(i),className:n("rounded-md border py-1.5 text-[11px] font-semibold tabular-nums transition-all active:scale-[0.95]",l===i?"border-foreground bg-foreground text-background":"border-border/60 bg-muted/40 text-foreground/40 hover:bg-muted hover:text-foreground"),children:i},i))}),e.jsxs(f,{variant:"ghost",size:"sm",className:"group relative h-10 w-full overflow-hidden rounded-xl border-none bg-primary text-[11px] font-semibold uppercase tracking-[0.14em] text-primary-foreground transition-all hover:scale-[1.02] hover:shadow-lg hover:shadow-primary/20 active:scale-[0.98]",onClick:u,children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/10 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-1000"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Z,{className:n("h-3.5 w-3.5",p&&"animate-spin")}),e.jsx("span",{children:"Refresh Entries"})]})]})]})})]})}function Me(){return e.jsxs("div",{className:"space-y-6","aria-label":"Loading logs workspace",children:[e.jsx(y,{className:"gap-4",children:e.jsxs(k,{className:"space-y-3",children:[e.jsx(x,{className:"h-4 w-28"}),e.jsx(x,{className:"h-8 w-72"}),e.jsx(x,{className:"h-4 w-[30rem]"})]})}),e.jsx("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-4",children:[1,2,3,4].map(r=>e.jsx(y,{className:"gap-3",children:e.jsxs(k,{className:"space-y-2",children:[e.jsx(x,{className:"h-4 w-20"}),e.jsx(x,{className:"h-7 w-24"})]})},r))}),e.jsxs("div",{className:"grid gap-6 xl:grid-cols-[minmax(0,1.45fr)_22rem]",children:[e.jsxs(y,{className:"gap-4",children:[e.jsxs(k,{className:"space-y-3",children:[e.jsx(x,{className:"h-4 w-52"}),e.jsx("div",{className:"grid gap-3 md:grid-cols-4",children:[1,2,3,4].map(r=>e.jsx(x,{className:"h-10 w-full"},r))})]}),e.jsxs(T,{className:"grid gap-4 xl:grid-cols-[22rem_minmax(0,1fr)]",children:[e.jsx(x,{className:"h-[26rem] w-full"}),e.jsx(x,{className:"h-[26rem] w-full"})]})]}),e.jsxs(y,{className:"gap-4",children:[e.jsxs(k,{className:"space-y-3",children:[e.jsx(x,{className:"h-5 w-44"}),e.jsx(x,{className:"h-4 w-full"})]}),e.jsx(T,{className:"space-y-4",children:[1,2,3,4].map(r=>e.jsx(x,{className:"h-10 w-full"},r))})]})]})]})}const F=1200,Ae=336,qe=368,U=52;function B({side:r,label:s,onExpand:t}){return e.jsxs("div",{className:n("flex h-full w-full flex-col items-center justify-center gap-4 bg-muted/5",r==="left"?"border-r border-border":"border-l border-border"),children:[e.jsx(f,{variant:"ghost",size:"icon",onClick:t,"aria-label":`Show ${s.toLowerCase()}`,className:"h-9 w-9 rounded-xl border border-border/70 bg-background/85 shadow-sm",children:r==="left"?e.jsx(ee,{className:"h-4 w-4"}):e.jsx(X,{className:"h-4 w-4"})}),e.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.14em] text-foreground/45",style:{writingMode:"vertical-rl"},children:s})]})}function $e(){const r=De(),s=Oe(),t=Pe(r.sourcesQuery.data??[]),[d,o]=c.useState(()=>typeof window<"u"?window.innerWidth>=F:!1),[m,a]=c.useState(!1),[l,g]=c.useState(!1);if(c.useEffect(()=>{const p=window.matchMedia(`(min-width: ${F}px)`),h=()=>{o(window.innerWidth>=F)};return h(),p.addEventListener("change",h),()=>p.removeEventListener("change",h)},[]),r.isInitialLoading)return e.jsx(Me,{});const u=r.configQuery.data;return u?e.jsxs("div",{className:"relative flex h-full min-h-full flex-col overflow-hidden border-t border-border/40 bg-background font-sans text-foreground antialiased selection:bg-primary/30 selection:text-primary",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 z-0 opacity-40 [background-image:radial-gradient(circle_at_1px_1px,rgba(38,38,36,0.08)_1px,transparent_0)] [background-size:14px_14px]"}),e.jsxs("div",{className:"relative z-10 flex shrink-0 items-center justify-between border-b border-border/80 bg-card/95 px-6 py-2 backdrop-blur-xl shadow-md transition-all xl:px-8",children:[e.jsxs("div",{className:"flex items-center gap-10",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"group flex h-9 w-9 items-center justify-center rounded-xl border-2 border-primary/20 bg-primary/5 text-primary shadow-inner transition-all hover:scale-110 active:scale-90",children:e.jsx(A,{className:"h-4.5 w-4.5 transition-transform group-hover:rotate-6"})}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:"rounded-full bg-primary px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.14em] text-primary-foreground shadow-lg shadow-primary/20",children:"Operational"}),e.jsx("h1",{className:"text-[17px] font-semibold tracking-tight text-foreground",children:"Log Operations Center"})]}),e.jsx("p",{className:"font-mono text-[10px] font-medium uppercase tracking-[0.16em] text-foreground/45",children:"CCS.TOC.LOGS.STREAM.v3"})]})]}),e.jsx("div",{className:"hidden h-8 w-px bg-border/80 md:block"}),e.jsxs("div",{className:"hidden items-center gap-10 md:flex",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:n("h-2 w-2 rounded-full ring-4 transition-all duration-700",u.redact?"bg-emerald-500 shadow-[0_0_20px_rgba(16,185,129,0.6)] ring-emerald-500/30":"bg-zinc-600 ring-transparent")}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-foreground/90",children:"Redaction"}),e.jsx("span",{className:"text-[11px] font-medium text-foreground/50",children:u.redact?"Enforced":"Standby"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-lg border-2 border-border bg-muted shadow-inner",children:e.jsx(Ce,{className:"h-3.5 w-3.5 text-foreground"})}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-foreground/90",children:"Retention"}),e.jsxs("span",{className:"text-[11px] font-medium text-foreground/50",children:[u.retain_days,"D / ",u.rotate_mb,"MB"]})]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(f,{variant:"ghost",size:"sm",className:"group h-9 gap-3 rounded-xl border-2 border-border bg-muted px-5 text-[11px] font-semibold uppercase tracking-[0.14em] text-foreground transition-all hover:bg-foreground hover:text-background active:scale-95 shadow-lg shadow-black/5",onClick:()=>void Promise.all([r.sourcesQuery.refetch(),r.entriesQuery.refetch()]),children:[e.jsxs("div",{className:"relative",children:[e.jsx(Z,{className:n("h-3.5 w-3.5 transition-transform duration-500",(r.entriesQuery.isFetching||r.sourcesQuery.isFetching)&&"animate-spin")}),!r.entriesQuery.isFetching&&!r.sourcesQuery.isFetching&&e.jsx("div",{className:"absolute -right-1 -top-1 h-1.5 w-1.5 rounded-full border border-muted bg-primary animate-pulse"})]}),r.entriesQuery.isFetching||r.sourcesQuery.isFetching?"Syncing":"Refresh"]}),e.jsx("div",{className:"h-7 w-px bg-border/80"}),e.jsx(f,{asChild:!0,variant:"ghost",size:"sm",className:"h-9 w-9 rounded-xl border-2 border-border bg-muted p-0 text-foreground transition-all hover:bg-foreground hover:text-background active:scale-95 shadow-lg shadow-black/5",children:e.jsx(ne,{to:"/health",children:e.jsx($,{className:"h-4 w-4"})})})]})]}),e.jsx("div",{className:"relative z-10 flex min-h-0 flex-1 overflow-hidden",children:e.jsxs(G,{defaultValue:"stream",className:"flex flex-1 flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/80 bg-card/80 px-6 py-2 backdrop-blur-xl shadow-inner xl:px-8",children:[e.jsxs(J,{className:"h-10 w-auto gap-1.5 rounded-xl border border-border/60 bg-muted/40 p-1",children:[e.jsx(_,{value:"stream",className:"rounded-lg px-5 text-[11px] font-semibold uppercase tracking-[0.12em] text-foreground/60 transition-all data-[state=active]:bg-background data-[state=active]:text-primary data-[state=active]:shadow-md",children:"Telemetry Stream"}),e.jsx(_,{value:"errors",className:"rounded-lg px-5 text-[11px] font-semibold uppercase tracking-[0.12em] text-foreground/60 transition-all data-[state=active]:bg-background data-[state=active]:text-primary data-[state=active]:shadow-md",children:"Legacy Errors"})]}),e.jsxs("div",{className:"hidden items-center gap-3 lg:flex",children:[e.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-border bg-muted px-3 py-1 shadow-inner",children:[e.jsxs("span",{className:"relative flex h-1.5 w-1.5",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-500 shadow-[0_0_8px_rgba(16,185,129,0.6)]"})]}),e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-tight text-foreground/80",children:"Connected"})]}),e.jsxs("span",{className:"pr-4 text-[11px] font-medium tabular-nums text-foreground/45",children:[r.entriesQuery.data?.length??0," captured"]})]})]}),e.jsx(E,{value:"stream",className:"m-0 flex min-h-0 flex-1 overflow-y-auto lg:overflow-hidden focus-visible:outline-none",children:d?e.jsxs("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:[e.jsx("div",{"data-logs-pane":"filters",style:{width:m?U:Ae},className:"flex min-h-0 shrink-0 bg-muted/5",children:m?e.jsx(B,{side:"left",label:"Filters",onExpand:()=>a(!1)}):e.jsxs("div",{className:"flex h-full min-h-0 w-full flex-col border-r border-border p-5 2xl:p-6",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-foreground/80",children:"Filters"}),e.jsx("p",{className:"text-[11px] text-muted-foreground/70",children:"Search, source, and retention controls"})]}),e.jsx(f,{variant:"ghost",size:"icon",onClick:()=>a(!0),"aria-label":"Hide filters",className:"h-9 w-9 rounded-xl border border-border/70 bg-background/85 shadow-sm",children:e.jsx(X,{className:"h-4 w-4"})})]}),e.jsx(C,{className:"min-h-0 flex-1","data-logs-scroll-region":"filters",children:e.jsxs("div",{className:"space-y-5 pr-4",children:[e.jsx(H,{sources:r.sourcesQuery.data??[],selectedSource:r.selectedSource,onSourceChange:r.setSelectedSource,selectedLevel:r.selectedLevel,onLevelChange:r.setSelectedLevel,search:r.search,onSearchChange:r.setSearch,limit:r.limit,onLimitChange:r.setLimit,onRefresh:()=>void Promise.all([r.sourcesQuery.refetch(),r.entriesQuery.refetch()]),isRefreshing:r.entriesQuery.isFetching||r.sourcesQuery.isFetching}),e.jsx("div",{className:"border-t border-border/20 pt-5",children:e.jsx(K,{config:u,onSave:p=>s.mutate(p),isPending:s.isPending})})]})})]})}),e.jsx("div",{"data-logs-pane":"entries",className:"flex min-h-0 min-w-0 flex-1 overflow-hidden border-l border-r border-border bg-background/95",children:e.jsx(Y,{entries:r.entriesQuery.data??[],selectedEntryId:r.selectedEntryId,onSelect:r.setSelectedEntryId,sourceLabels:t,isLoading:r.entriesQuery.isLoading,isFetching:r.entriesQuery.isFetching})}),e.jsx("div",{"data-logs-pane":"details",style:{width:l?U:qe},className:"flex min-h-0 shrink-0 bg-muted/5 shadow-inner",children:l?e.jsx(B,{side:"right",label:"Details",onExpand:()=>g(!1)}):e.jsxs("div",{className:"flex h-full min-h-0 w-full flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border/50 bg-background/60 px-3 py-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-foreground/80",children:"Details"}),e.jsx("p",{className:"text-[11px] text-muted-foreground/70",children:"Selected entry context and raw payload"})]}),e.jsx(f,{variant:"ghost",size:"icon",onClick:()=>g(!0),"aria-label":"Hide details",className:"h-9 w-9 rounded-xl border border-border/70 bg-background/85 shadow-sm",children:e.jsx(ee,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(V,{entry:r.selectedEntry,sourceLabel:r.selectedEntry?t[r.selectedEntry.source]:void 0})})]})})]}):e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[e.jsx("div",{className:"border-b border-border bg-muted/5 p-5",children:e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsx(H,{sources:r.sourcesQuery.data??[],selectedSource:r.selectedSource,onSourceChange:r.setSelectedSource,selectedLevel:r.selectedLevel,onLevelChange:r.setSelectedLevel,search:r.search,onSearchChange:r.setSearch,limit:r.limit,onLimitChange:r.setLimit,onRefresh:()=>void Promise.all([r.sourcesQuery.refetch(),r.entriesQuery.refetch()]),isRefreshing:r.entriesQuery.isFetching||r.sourcesQuery.isFetching}),e.jsx(K,{config:u,onSave:p=>s.mutate(p),isPending:s.isPending})]})}),e.jsx("div",{className:"flex min-h-[32rem] flex-col overflow-hidden border-b border-border bg-background/95",children:e.jsx(Y,{entries:r.entriesQuery.data??[],selectedEntryId:r.selectedEntryId,onSelect:r.setSelectedEntryId,sourceLabels:t,isLoading:r.entriesQuery.isLoading,isFetching:r.entriesQuery.isFetching})}),e.jsx("div",{className:"flex min-h-[30rem] flex-col overflow-hidden bg-muted/5 shadow-inner",children:e.jsx(V,{entry:r.selectedEntry,sourceLabel:r.selectedEntry?t[r.selectedEntry.source]:void 0})})]})}),e.jsx(E,{value:"errors",className:"m-0 flex-1 overflow-y-auto bg-background/20 p-6 focus-visible:outline-none xl:p-8",children:e.jsxs("div",{className:"mx-auto max-w-5xl space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-700",children:[e.jsxs("div",{className:"relative overflow-hidden rounded-[2.5rem] border-2 border-border bg-card/40 p-1.5 shadow-2xl shadow-black/10",children:[e.jsx("div",{className:"absolute inset-0 opacity-[0.02] pointer-events-none [background-image:radial-gradient(circle_at_center,var(--primary)_1px,transparent_0)] [background-size:24px_24px]"}),e.jsx(y,{className:"rounded-[calc(2.5rem-0.375rem)] border-none bg-background/60 shadow-none overflow-hidden backdrop-blur-md",children:e.jsxs(T,{className:"flex flex-col gap-6 p-10",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl border-2 border-primary/20 bg-primary/10 text-primary shadow-inner",children:e.jsx(A,{className:"h-5 w-5"})}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx("p",{className:"text-[10px] font-black uppercase tracking-[0.4em] text-primary",children:"Legacy Diagnostic Node"}),e.jsx("p",{className:"text-[9px] font-bold uppercase tracking-widest text-muted-foreground/40",children:"CCS-MATRIX-FAILURE-MONITOR"})]})]}),e.jsx("div",{className:"rounded-full border border-border bg-background/50 px-3 py-1 text-[9px] font-black uppercase tracking-widest text-foreground/40 shadow-inner",children:"Mode: Historical"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-3xl font-black uppercase tracking-tighter text-foreground",children:"CLIProxy Failure Analysis"}),e.jsx("p",{className:"max-w-3xl text-[15px] font-medium leading-relaxed text-muted-foreground/60",children:"Maintain oversight of legacy request failures while the unified stream consolidates system-wide telemetry. This view provides direct access to the historical failure matrix for deep-field debugging."})]}),e.jsx("div",{className:"h-px w-full bg-gradient-to-r from-transparent via-border to-transparent opacity-40"})]})})]}),e.jsxs("div",{className:"rounded-[2.5rem] border-2 border-border bg-muted/5 p-8 shadow-inner backdrop-blur-sm",children:[e.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[e.jsx("div",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-primary shadow-[0_0_8px_rgba(var(--primary),0.5)]"}),e.jsx("span",{className:"text-[10px] font-black uppercase tracking-[0.3em] text-foreground/40",children:"Realtime Monitoring Deck"})]}),e.jsx(xe,{})]})]})})]})})]}):null}export{$e as LogsPage};
|
|
@@ -1 +0,0 @@
|
|
|
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-DOn6k1jF.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-QyEXocpn.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+="<",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};
|