Like Prometheus, but for logs.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
loki/pkg/ui/frontend/dist/assets/index-DqJzRHuy.js

63 lines
284 KiB

import{j as e,S as Se,c as hr,P as re,e as Me,B as uo,E as xr,G as po,T as mo,H as go,I as br,J as fo,K as ho,L as xo,M as yr,u as vr,N as bo,V as jr,a as yo,g as vo,b as jt,d as pe,O as jo,n as wo,p as No,m as ko}from"./radix-core-ByqQ8fsu.js";import{c as wr,r as i,b as Be}from"./react-core-D_V7s-9r.js";import{u as It,a as at,L as ce,b as Nr,c as So,d as Eo,R as Co,e as To,f as Ro,g as Ao}from"./react-router-Bj-soKrx.js";import{t as _o,c as ys,a as Ee}from"./ui-utils-BNSC_Jv-.js";import{S as Io,M as Fo,C as kr,R as Lo,H as Po,a as qe,b as Do,A as Ws,c as ls,d as Sr,e as Ft,X as vs,f as Er,P as Oo,L as he,g as nt,h as Cr,i as $o,j as Mo,k as ot,l as Tr,F as Bo,m as zo,D as Rr,n as Ar,o as Vo,G as js,p as Uo,q as qo,r as Go,s as Ho,t as Ko,U as Wo,u as Zo,B as Yo}from"./ui-icons-CFVjIJRk.js";import{f as Xo,a as Qo,b as _r,c as wt,p as cs,i as Ze,d as Jo,e as Zs,g as ei,h as ti,D as Ys}from"./date-utils-B6syNIuD.js";import{R as Ir,I as si,T as Fr,a as ri,S as Lr,b as Pr,P as ai,C as Dr,V as ni,L as Or,c as $r,d as oi,e as ii,f as Mr,g as li,h as ci,i as Br,j as di,k as zr,l as Vr,m as Ur}from"./radix-inputs-D4_OLmm6.js";import{S as qr,d as Gr,P as ui,C as Hr,e as Kr,f as Wr,g as Zr,h as Yr,L as Xr,i as Qr,j as pi,T as mi,k as Jr,V as gi,l as fi,m as ea,n as hi,o as ta,p as sa,q as ra,r as xi,c as bi}from"./radix-navigation-DYoR-lWZ.js";import{R as ws,P as Ns,O as it,C as lt,a as aa,T as Lt,D as Pt,b as na,c as yi,d as vi,e as ji,f as wi,g as Ni,h as oa}from"./radix-layout-BqTpm3s4.js";import{R as ct,P as Dt,a as Ot,C as $t,T as dt,d as ki,B as Si,b as Ei,Y as Ci,X as Ti,c as Ri}from"./data-viz-BuFFX-vG.js";import{u as Mt,a as Ai,Q as _i,b as Ii}from"./query-management-DbWM5GrR.js";import{z as Fi}from"./theme-utils-CNom64Sw.js";import{u as Li,F as Pi,C as Di,o as Oi,r as $i,a as Mi,b as ia,s as Ye,d as Xs,c as la}from"./form-libs-B6JBoFJD.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))a(n);new MutationObserver(n=>{for(const o of n)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&a(l)}).observe(document,{childList:!0,subtree:!0});function r(n){const o={};return n.integrity&&(o.integrity=n.integrity),n.referrerPolicy&&(o.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?o.credentials="include":n.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function a(n){if(n.ep)return;n.ep=!0;const o=r(n);fetch(n.href,o)}})();var ca,Qs=wr;ca=Qs.createRoot,Qs.hydrateRoot;function v(...t){return _o(ys(t))}function me(t){if(t===0)return"0 B";const s=1024,r=["B","KB","MB","GB","TB","PB"],a=Math.floor(Math.log(t)/Math.log(s));return`${parseFloat((t/Math.pow(s,a)).toFixed(2))} ${r[a]}`}function Oe(t,s){return t?Object.keys(t).find(r=>da(t[r],s)):null}function da(t,s){var r;return((r=t.services)==null?void 0:r.some(a=>a.service===s))??!1}const Bi=Ee("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),q=i.forwardRef(({className:t,variant:s,size:r,asChild:a=!1,...n},o)=>{const l=a?Se:"button";return e.jsx(l,{className:v(Bi({variant:s,size:r,className:t})),ref:o,...n})});q.displayName="Button";function zi(){return e.jsx(q,{variant:"ghost",size:"icon",className:"bg-muted hover:bg-muted-hover rounded-lg",asChild:!0,children:e.jsxs("a",{href:"https://github.com/grafana/loki",target:"_blank",rel:"noopener noreferrer",children:[e.jsx("svg",{viewBox:"0 0 438.549 438.549",className:"h-[1.2rem] w-[1.2rem]",children:e.jsx("path",{fill:"currentColor",d:"M409.132 114.573c-19.608-33.596-46.205-60.194-79.798-79.8-33.598-19.607-70.277-29.408-110.063-29.408-39.781 0-76.472 9.804-110.063 29.408-33.596 19.605-60.192 46.204-79.8 79.8C9.803 148.168 0 184.854 0 224.63c0 47.78 13.94 90.745 41.827 128.906 27.884 38.164 63.906 64.572 108.063 79.227 5.14.954 8.945.283 11.419-1.996 2.475-2.282 3.711-5.14 3.711-8.562 0-.571-.049-5.708-.144-15.417a2549.81 2549.81 0 01-.144-25.406l-6.567 1.136c-4.187.767-9.469 1.092-15.846 1-6.374-.089-12.991-.757-19.842-1.999-6.854-1.231-13.229-4.086-19.13-8.559-5.898-4.473-10.085-10.328-12.56-17.556l-2.855-6.57c-1.903-4.374-4.899-9.233-8.992-14.559-4.093-5.331-8.232-8.945-12.419-10.848l-1.999-1.431c-1.332-.951-2.568-2.098-3.711-3.429-1.142-1.331-1.997-2.663-2.568-3.997-.572-1.335-.098-2.43 1.427-3.289 1.525-.859 4.281-1.276 8.28-1.276l5.708.853c3.807.763 8.516 3.042 14.133 6.851 5.614 3.806 10.229 8.754 13.846 14.842 4.38 7.806 9.657 13.754 15.846 17.847 6.184 4.093 12.419 6.136 18.699 6.136 6.28 0 11.704-.476 16.274-1.423 4.565-.952 8.848-2.383 12.847-4.285 1.713-12.758 6.377-22.559 13.988-29.41-10.848-1.14-20.601-2.857-29.264-5.14-8.658-2.286-17.605-5.996-26.835-11.14-9.235-5.137-16.896-11.516-22.985-19.126-6.09-7.614-11.088-17.61-14.987-29.979-3.901-12.374-5.852-26.648-5.852-42.826 0-23.035 7.52-42.637 22.557-58.817-7.044-17.318-6.379-36.732 1.997-58.24 5.52-1.715 13.706-.428 24.554 3.853 10.85 4.283 18.794 7.952 23.84 10.994 5.046 3.041 9.089 5.618 12.135 7.708 17.705-4.947 35.976-7.421 54.818-7.421s37.117 2.474 54.823 7.421l10.849-6.849c7.419-4.57 16.18-8.758 26.262-12.565 10.088-3.805 17.802-4.853 23.134-3.138 8.562 21.509 9.325 40.922 2.279 58.24 15.036 16.18 22.559 35.787 22.559 58.817 0 16.178-1.958 30.497-5.853 42.966-3.9 12.471-8.941 22.457-15.125 29.979-6.191 7.521-13.901 13.85-23.131 18.986-9.232 5.14-18.182 8.85-26.84 11.136-8.662 2.286-18.415 4.004-29.263 5.146 9.894 8.562 14.842 22.077 14.842 40.539v60.237c0 3.422 1.19 6.279 3.572 8.562 2.379 2.279 6.136 2.95 11.276 1.995 44.163-14.653 80.185-41.062 108.068-79.226 27.88-38.161 41.825-81.126 41.825-128.906-.01-39.771-9.818-76.454-29.414-110.049z"})}),e.jsx("span",{className:"sr-only",children:"View on GitHub"})]})})}const Vi={theme:"light",setTheme:()=>null},ua=i.createContext(Vi);function Ui(){const t=i.useContext(ua);if(t===void 0)throw new Error("useTheme must be used within a ThemeProvider");return t}function qi({children:t,defaultTheme:s="light",storageKey:r="loki-ui-theme",...a}){const[n,o]=i.useState(()=>{try{const c=localStorage.getItem(r);return c==="dark"||c==="light"?c:s}catch{return s}}),l=c=>{try{localStorage.setItem(r,c),o(c)}catch(d){console.error("Failed to save theme:",d)}};return i.useEffect(()=>{const c=window.document.documentElement;c.classList.remove("light","dark"),c.classList.add(n)},[n]),e.jsx(ua.Provider,{value:{theme:n,setTheme:l},...a,children:t})}function Gi(){const{theme:t,setTheme:s}=Ui(),r=()=>{s(t==="light"?"dark":"light")};return e.jsxs(q,{variant:"ghost",size:"icon",className:"bg-muted hover:bg-muted-hover rounded-lg",onClick:r,children:[t==="light"?e.jsx(Io,{className:"h-[1.2rem] w-[1.2rem]"}):e.jsx(Fo,{className:"h-[1.2rem] w-[1.2rem]"}),e.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}function Hi(){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(zi,{}),e.jsx(Gi,{})]})}const ks=i.forwardRef(({...t},s)=>e.jsx("nav",{ref:s,"aria-label":"breadcrumb",...t}));ks.displayName="Breadcrumb";const Ss=i.forwardRef(({className:t,...s},r)=>e.jsx("ol",{ref:r,className:v("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",t),...s}));Ss.displayName="BreadcrumbList";const Nt=i.forwardRef(({className:t,...s},r)=>e.jsx("li",{ref:r,className:v("inline-flex items-center gap-1.5",t),...s}));Nt.displayName="BreadcrumbItem";const kt=i.forwardRef(({asChild:t,className:s,...r},a)=>{const n=t?Se:"a";return e.jsx(n,{ref:a,className:v("transition-colors hover:text-foreground",s),...r})});kt.displayName="BreadcrumbLink";const pa=i.forwardRef(({className:t,...s},r)=>e.jsx("span",{ref:r,role:"link","aria-disabled":"true","aria-current":"page",className:v("font-normal text-foreground",t),...s}));pa.displayName="BreadcrumbPage";const St=({children:t,className:s,...r})=>e.jsx("li",{role:"presentation","aria-hidden":"true",className:v("[&>svg]:w-3.5 [&>svg]:h-3.5",s),...r,children:t??e.jsx(kr,{})});St.displayName="BreadcrumbSeparator";const Ki=({match:t})=>{const s=t.params.nodeName;return e.jsx("span",{children:s})},Wi=({match:t})=>{const s=t.params.ringName;return e.jsx("span",{children:s})},ee=i.forwardRef(({className:t,...s},r)=>e.jsx("div",{ref:r,className:v("rounded-xl border bg-card text-card-foreground shadow",t),...s}));ee.displayName="Card";const se=i.forwardRef(({className:t,...s},r)=>e.jsx("div",{ref:r,className:v("flex flex-col space-y-1.5 p-6",t),...s}));se.displayName="CardHeader";const ae=i.forwardRef(({className:t,...s},r)=>e.jsx("div",{ref:r,className:v("font-semibold leading-none tracking-tight",t),...s}));ae.displayName="CardTitle";const Qe=i.forwardRef(({className:t,...s},r)=>e.jsx("div",{ref:r,className:v("text-sm text-muted-foreground",t),...s}));Qe.displayName="CardDescription";const te=i.forwardRef(({className:t,...s},r)=>e.jsx("div",{ref:r,className:v("p-6 pt-0",t),...s}));te.displayName="CardContent";const ma=i.forwardRef(({className:t,...s},r)=>e.jsx("div",{ref:r,className:v("flex items-center p-6 pt-0",t),...s}));ma.displayName="CardFooter";function Zi(){const t=It(),[s]=at(),r=s.get("path")||window.location.pathname;return e.jsxs("div",{className:"flex min-h-[calc(100vh-12rem)] items-center justify-center bg-dot-pattern px-4",children:[e.jsxs(ee,{className:"w-full max-w-[450px] overflow-hidden",children:[e.jsxs(se,{className:"text-center pb-0",children:[e.jsxs("div",{className:"relative mb-8",children:[e.jsx("div",{className:"absolute inset-0 flex items-center justify-center"}),e.jsx("div",{className:"relative flex justify-center py-4",children:e.jsx("div",{className:"bg-white dark:bg-transparent p-2 rounded-full",children:e.jsx("img",{src:"https://grafana.com/media/docs/loki/logo-grafana-loki.png",alt:"Loki Logo",className:v("h-16 w-16 sm:h-24 sm:w-24","rotate-180 animate-swing hover:animate-shake cursor-pointer transition-all duration-300")})})})]}),e.jsx(ae,{className:"text-5xl sm:text-7xl font-bold bg-gradient-to-r from-primary to-primary/50 bg-clip-text text-transparent",children:"404"})]}),e.jsxs(te,{className:"text-center space-y-3 pb-8",children:[e.jsx("h2",{className:"text-xl sm:text-2xl font-semibold tracking-tight",children:"Oops! Page Not Found"}),e.jsx("p",{className:"text-sm sm:text-base text-muted-foreground",children:"Even with our powerful log aggregation, we couldn't find this page in any of our streams!"}),e.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground italic",children:["Error: LogQL query returned 0 results for label"," ",`{path="${r}"}`]})]}),e.jsxs(ma,{className:"flex justify-center gap-4 pb-8",children:[e.jsxs(q,{variant:"outline",onClick:()=>t(-1),className:"gap-2 group",size:"sm",children:[e.jsx(Lo,{className:"h-4 w-4 group-hover:animate-spin"}),"Go Back"]}),e.jsxs(q,{onClick:()=>t("/"),className:"gap-2 group",size:"sm",children:[e.jsx(Po,{className:"h-4 w-4 group-hover:animate-bounce"}),"Go Home"]})]})]}),e.jsx("style",{children:`
.bg-dot-pattern {
background-image: radial-gradient(circle at 1px 1px, hsl(var(--muted-foreground) / 0.1) 1px, transparent 0);
background-size: 32px 32px;
}
@keyframes shake {
0%, 100% { transform: rotate(180deg); }
25% { transform: rotate(170deg); }
75% { transform: rotate(190deg); }
}
@keyframes swing {
0%, 100% { transform: rotate(180deg); }
50% { transform: rotate(190deg); }
}
.animate-swing {
animation: swing 1s ease-in-out infinite;
}
.animate-shake {
animation: shake 0.3s ease-in-out;
}
`})]})}const J={INGESTER:"ingester",PARTITION_INGESTER:"partition-ingester",DISTRIBUTOR:"distributor",PATTERN_INGESTER:"pattern-ingester",QUERY_SCHEDULER:"query-scheduler",COMPACTOR:"compactor",RULER:"ruler",INDEX_GATEWAY:"index-gateway"},ga={0:"Unknown",1:"Pending",2:"Active",3:"Inactive",4:"Deleted"},Yi={cluster:null,error:null,isLoading:!0,refresh:()=>Promise.resolve()},fa=i.createContext(Yi);function ue(){const t=i.useContext(fa);if(!t)throw new Error("useCluster must be used within a ClusterProvider");return t}function ha(t){const s=new Date(t);return`${Xo(s)} ago`}function xa(t){const s=new Date(t);return Qo(s,{format:"extended"})}function Et(t){switch(typeof t=="string"?parseInt(t,10):t){case 2:return"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200";case 1:return"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200";case 3:return"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200";case 4:return"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200";default:return"bg-gray-100 text-gray-800 dark:bg-gray-900 dark:text-gray-200"}}function ba(t){const s=t.split("").reduce((n,o)=>o.charCodeAt(0)+((n<<5)-n),0),r=["bg-rose-100 text-rose-800 dark:bg-rose-900 dark:text-rose-200","bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200","bg-amber-100 text-amber-800 dark:bg-amber-900 dark:text-amber-200","bg-lime-100 text-lime-800 dark:bg-lime-900 dark:text-lime-200","bg-teal-100 text-teal-800 dark:bg-teal-900 dark:text-teal-200","bg-cyan-100 text-cyan-800 dark:bg-cyan-900 dark:text-cyan-200","bg-indigo-100 text-indigo-800 dark:bg-indigo-900 dark:text-indigo-200","bg-fuchsia-100 text-fuchsia-800 dark:bg-fuchsia-900 dark:text-fuchsia-200"],a=Math.abs(s)%r.length;return r[a]}function Es(t){const s=t.split("-");return s.length>=3?s[s.length-2]:""}function Xi(t){const s=["B","KiB","MiB","GiB","TiB"];let r=t,a=0;for(;r>=1024&&a<s.length-1;)r/=1024,a++;return`${r.toFixed(1)} ${s[a]}`}const Qi=(t,s)=>Object.values(t).some(r=>da(r,s)),ya={ingester:"ingester","partition-ring":"partition-ring",distributor:"distributor","pattern-ingester":"pattern-ingester","query-scheduler":"query-scheduler",compactor:"compactor",ruler:"ruler","index-gateway":"index-gateway"},Ne={ingester:{title:"Ingester",ringName:J.INGESTER,ringPath:"/ring",needsTokens:!0},"partition-ring":{title:"Partition Ingester",ringName:J.PARTITION_INGESTER,ringPath:"/partition-ring",needsTokens:!0},distributor:{title:"Distributor",ringName:J.DISTRIBUTOR,ringPath:"/distributor/ring",needsTokens:!1},"pattern-ingester":{title:"Pattern Ingester",ringName:J.PATTERN_INGESTER,ringPath:"/pattern/ring",needsTokens:!0},"query-scheduler":{title:"Scheduler",ringName:J.QUERY_SCHEDULER,ringPath:"/scheduler/ring",needsTokens:!1},compactor:{title:"Compactor",ringName:J.COMPACTOR,ringPath:"/compactor/ring",needsTokens:!1},ruler:{title:"Ruler",ringName:J.RULER,ringPath:"/ruler/ring",needsTokens:!0},"index-gateway":{title:"Index Gateway",ringName:J.INDEX_GATEWAY,ringPath:"/indexgateway/ring",needsTokens:!0}};function va(t){return Object.keys(Ne).find(s=>Ne[s].ringName===t)}function Ji(t){if(!t)return!1;const s=va(t);return s?Ne[s].needsTokens:!1}const el=t=>{const s=[];if(!t)return s;for(const r in Ne)Qi(t,r)&&s.push({title:Ne[r].title,url:`/rings/${Ne[r].ringName}`});return s};function ja(t,s){if(!t||!s)return"";const r=va(s);if(!r)return"";const a=Oe(t,r);if(!a)return"";const n=`/ui/api/v1/proxy/${a}`,o=Ne[r].ringPath,l=Ne[r].needsTokens?"?tokens=true":"";return`${n}${o}${l}`}const wa=[{id:J.INGESTER,title:"Ingester"},{id:J.PARTITION_INGESTER,title:"Partition Ingester"},{id:J.DISTRIBUTOR,title:"Distributor"},{id:J.PATTERN_INGESTER,title:"Pattern Ingester"},{id:J.QUERY_SCHEDULER,title:"Scheduler"},{id:J.COMPACTOR,title:"Compactor"},{id:J.RULER,title:"Ruler"},{id:J.INDEX_GATEWAY,title:"Index Gateway"}];function tl(t){const s={};try{const r=/<tbody[^>]*>([\s\S]*?)<\/tbody>/,a=t.match(r);if(!a)return s;const n=/<tr[^>]*>([\s\S]*?)<\/tr>/g,o=Array.from(a[1].matchAll(n));for(const l of o){const c=/<td[^>]*>([\s\S]*?)<\/td>/g,d=Array.from(l[1].matchAll(c)).map(u=>u[1].trim().replace(/&nbsp;/g,""));if(d.length>=10){const u=d[0],m=d[9].endsWith("%")?d[9]:`${d[9]}%`;s[u]=m}}}catch(r){console.error("Error parsing ring HTML:",r)}return s}function sl({ringName:t,isPaused:s=!1}){const{cluster:r}=ue(),[a,n]=i.useState(null),[o,l]=i.useState(""),[c,d]=i.useState(!1),u=i.useRef(),m=i.useMemo(()=>Ji(t),[t]),f=i.useCallback(()=>ja(r==null?void 0:r.members,t??""),[r,t]),y=i.useCallback(async()=>{if(!t){l("Ring name is required");return}const g=f();if(!g){l("No cluster members available");return}u.current&&u.current.abort(),u.current=new AbortController,d(!0);try{const x=await fetch(g,{headers:{Accept:"application/json"},signal:u.current.signal});if(!x.ok)throw new Error(`Failed to fetch ring: ${x.statusText}`);const b=await x.json();if(!b||!b.shards){n(null);return}const j=await fetch(g,{headers:{Accept:"text/plain"},signal:u.current.signal});if(!j.ok)throw new Error(`Failed to fetch ring ownership: ${j.statusText}`);const w=await j.text(),E=tl(w),C={...b,shards:b.shards.map(A=>({...A,ownership:E[A.id]||"0%"}))};n(C),l("")}catch(x){if(x instanceof Error&&x.name==="AbortError")return;console.error("Error fetching ring:",x),l(x instanceof Error?x.message:"Unknown error"),n(null)}finally{d(!1)}},[t,f]),N=i.useCallback(async g=>{const x=f();if(!x)throw new Error("Ring name and node name are required");let b=0;const j=g.length;for(const w of g)try{const E=new FormData;E.append("forget",w),(await fetch(x,{method:"POST",body:E})).ok&&b++}catch(E){console.error(`Error forgetting instance ${w}:`,E)}return{success:b,total:j}},[f]),{uniqueStates:h,uniqueZones:p}=i.useMemo(()=>{if(!(a!=null&&a.shards))return{uniqueStates:[],uniqueZones:[]};const g=new Set,x=new Set;return a.shards.forEach(b=>{const j=b.state||"unknown";j.trim()&&g.add(j),b.zone&&b.zone.trim()&&x.add(b.zone)}),{uniqueStates:Array.from(g).sort(),uniqueZones:Array.from(x).sort()}},[a==null?void 0:a.shards]);return i.useEffect(()=>()=>{u.current&&u.current.abort()},[]),i.useEffect(()=>{if(y(),!s){const g=setInterval(()=>{y()},5e3);return()=>{clearInterval(g)}}},[y,s]),{ring:a,error:o,isLoading:c,fetchRing:y,forgetInstances:N,uniqueStates:h,uniqueZones:p,isTokenBased:m}}const Le=i.forwardRef(({className:t,...s},r)=>e.jsx(Ir,{ref:r,className:v("peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...s,children:e.jsx(si,{className:v("flex items-center justify-center text-current"),children:e.jsx(qe,{className:"h-4 w-4"})})}));Le.displayName=Ir.displayName;const Ce=i.forwardRef(({className:t,...s},r)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:r,className:v("w-full caption-bottom text-sm",t),...s})}));Ce.displayName="Table";const Te=i.forwardRef(({className:t,...s},r)=>e.jsx("thead",{ref:r,className:v("[&_tr]:border-b",t),...s}));Te.displayName="TableHeader";const Re=i.forwardRef(({className:t,...s},r)=>e.jsx("tbody",{ref:r,className:v("[&_tr:last-child]:border-0",t),...s}));Re.displayName="TableBody";const rl=i.forwardRef(({className:t,...s},r)=>e.jsx("tfoot",{ref:r,className:v("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...s}));rl.displayName="TableFooter";const X=i.forwardRef(({className:t,...s},r)=>e.jsx("tr",{ref:r,className:v("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...s}));X.displayName="TableRow";const D=i.forwardRef(({className:t,...s},r)=>e.jsx("th",{ref:r,className:v("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...s}));D.displayName="TableHead";const F=i.forwardRef(({className:t,...s},r)=>e.jsx("td",{ref:r,className:v("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...s}));F.displayName="TableCell";const al=i.forwardRef(({className:t,...s},r)=>e.jsx("caption",{ref:r,className:v("mt-4 text-sm text-muted-foreground",t),...s}));al.displayName="TableCaption";const nl=pi,ol=mi,il=i.forwardRef(({className:t,inset:s,children:r,...a},n)=>e.jsxs(qr,{ref:n,className:v("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",s&&"pl-8",t),...a,children:[r,e.jsx(kr,{className:"ml-auto h-4 w-4"})]}));il.displayName=qr.displayName;const ll=i.forwardRef(({className:t,...s},r)=>e.jsx(Gr,{ref:r,className:v("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...s}));ll.displayName=Gr.displayName;const Na=i.forwardRef(({className:t,sideOffset:s=4,...r},a)=>e.jsx(ui,{children:e.jsx(Hr,{ref:a,sideOffset:s,className:v("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...r})}));Na.displayName=Hr.displayName;const ds=i.forwardRef(({className:t,inset:s,...r},a)=>e.jsx(Kr,{ref:a,className:v("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s&&"pl-8",t),...r}));ds.displayName=Kr.displayName;const cl=i.forwardRef(({className:t,children:s,checked:r,...a},n)=>e.jsxs(Wr,{ref:n,className:v("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:r,...a,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Zr,{children:e.jsx(qe,{className:"h-4 w-4"})})}),s]}));cl.displayName=Wr.displayName;const dl=i.forwardRef(({className:t,children:s,...r},a)=>e.jsxs(Yr,{ref:a,className:v("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...r,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Zr,{children:e.jsx(Do,{className:"h-2 w-2 fill-current"})})}),s]}));dl.displayName=Yr.displayName;const ul=i.forwardRef(({className:t,inset:s,...r},a)=>e.jsx(Xr,{ref:a,className:v("px-2 py-1.5 text-sm font-semibold",s&&"pl-8",t),...r}));ul.displayName=Xr.displayName;const pl=i.forwardRef(({className:t,...s},r)=>e.jsx(Qr,{ref:r,className:v("-mx-1 my-1 h-px bg-muted",t),...s}));pl.displayName=Qr.displayName;function Z({title:t,field:s,sortField:r,sortDirection:a,onSort:n}){const o=r===s,l=c=>{r===s&&a===c||n(s)};return e.jsx("div",{className:"flex items-center space-x-2",children:e.jsxs(nl,{children:[e.jsx(ol,{asChild:!0,children:e.jsx(q,{variant:"ghost",size:"sm",className:"-ml-3 h-8 hover:bg-muted/50 data-[state=open]:bg-muted/50",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("span",{children:t}),o?a==="desc"?e.jsx(Ws,{className:"ml-2 h-4 w-4"}):e.jsx(ls,{className:"ml-2 h-4 w-4"}):e.jsx(Sr,{className:"ml-2 h-4 w-4"})]})})}),e.jsxs(Na,{align:"start",children:[e.jsxs(ds,{onClick:()=>l("asc"),className:v("cursor-pointer",o&&a==="asc"&&"bg-accent"),children:[e.jsx(ls,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Asc"]}),e.jsxs(ds,{onClick:()=>l("desc"),className:v("cursor-pointer",o&&a==="desc"&&"bg-accent"),children:[e.jsx(Ws,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Desc"]})]})]})})}var Cs="Progress",Ts=100,[ml,Im]=hr(Cs),[gl,fl]=ml(Cs),ka=i.forwardRef((t,s)=>{const{__scopeProgress:r,value:a=null,max:n,getValueLabel:o=hl,...l}=t;(n||n===0)&&!Js(n)&&console.error(xl(`${n}`,"Progress"));const c=Js(n)?n:Ts;a!==null&&!er(a,c)&&console.error(bl(`${a}`,"Progress"));const d=er(a,c)?a:null,u=Ct(d)?o(d,c):void 0;return e.jsx(gl,{scope:r,value:d,max:c,children:e.jsx(re.div,{"aria-valuemax":c,"aria-valuemin":0,"aria-valuenow":Ct(d)?d:void 0,"aria-valuetext":u,role:"progressbar","data-state":Ca(d,c),"data-value":d??void 0,"data-max":c,...l,ref:s})})});ka.displayName=Cs;var Sa="ProgressIndicator",Ea=i.forwardRef((t,s)=>{const{__scopeProgress:r,...a}=t,n=fl(Sa,r);return e.jsx(re.div,{"data-state":Ca(n.value,n.max),"data-value":n.value??void 0,"data-max":n.max,...a,ref:s})});Ea.displayName=Sa;function hl(t,s){return`${Math.round(t/s*100)}%`}function Ca(t,s){return t==null?"indeterminate":t===s?"complete":"loading"}function Ct(t){return typeof t=="number"}function Js(t){return Ct(t)&&!isNaN(t)&&t>0}function er(t,s){return Ct(t)&&!isNaN(t)&&t<=s&&t>=0}function xl(t,s){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${s}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Ts}\`.`}function bl(t,s){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${s}\`. The \`value\` prop must be:
- a positive number
- less than the value passed to \`max\` (or ${Ts} if no \`max\` prop is set)
- \`null\` or \`undefined\` if the progress is indeterminate.
Defaulting to \`null\`.`}var Ta=ka,yl=Ea;const Ra=i.forwardRef(({className:t,value:s,...r},a)=>e.jsx(Ta,{ref:a,className:v("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",t),...r,children:e.jsx(yl,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(s||0)}%)`}})}));Ra.displayName=Ta.displayName;function vl({visibleIds:t,selectedIds:s,onChange:r}){const a=t.every(o=>s.has(o)),n=()=>{const o=new Set(t);r(a?new Set([...s].filter(l=>!o.has(l))):new Set([...s,...t]))};return e.jsx(Le,{checked:t.length>0&&a,onCheckedChange:n,"aria-label":"Select all visible instances"})}function jl({instances:t,selectedInstances:s,onSelectInstance:r,sortField:a,sortDirection:n,onSort:o,showTokens:l=!1}){return e.jsxs(Ce,{children:[e.jsx(Te,{children:e.jsxs(X,{className:"hover:bg-transparent",children:[e.jsx(D,{className:"w-[50px]",children:e.jsx(vl,{visibleIds:t.map(c=>c.id),selectedIds:s,onChange:c=>{t.forEach(d=>{c.has(d.id)!==s.has(d.id)&&r(d.id)})}})}),e.jsx(D,{className:"w-[200px]",children:e.jsx(Z,{title:"ID",field:"id",sortField:a,sortDirection:n,onSort:o})}),e.jsx(D,{className:"w-[150px]",children:e.jsx(Z,{title:"State",field:"state",sortField:a,sortDirection:n,onSort:o})}),e.jsx(D,{children:e.jsx(Z,{title:"Address",field:"address",sortField:a,sortDirection:n,onSort:o})}),l&&e.jsx(D,{className:"w-[200px]",children:e.jsx(Z,{title:"Ownership",field:"ownership",sortField:a,sortDirection:n,onSort:o})}),e.jsx(D,{className:"w-[150px]",children:e.jsx(Z,{title:"Zone",field:"zone",sortField:a,sortDirection:n,onSort:o})}),e.jsx(D,{className:"w-[200px]",children:e.jsx(Z,{title:"Last Heartbeat",field:"timestamp",sortField:a,sortDirection:n,onSort:o})}),e.jsx(D,{className:"w-[50px]"})]})}),e.jsxs(Re,{children:[t.map(c=>{const d=l?c.ownership:0;return e.jsxs(X,{children:[e.jsx(F,{children:e.jsx(Le,{checked:s.has(c.id),onCheckedChange:()=>r(c.id),"aria-label":`Select instance ${c.id}`})}),e.jsx(F,{className:"font-medium",children:e.jsx(ce,{to:`/nodes/${c.id}`,className:"hover:underline",children:c.id})}),e.jsx(F,{children:e.jsx("span",{className:v("inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",Et(c.state)),children:c.state})}),e.jsx(F,{children:c.address}),l&&e.jsx(F,{children:e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex justify-between text-xs",children:[e.jsx("span",{children:d}),e.jsxs("span",{className:"text-muted-foreground",children:[c.tokens.length," tokens"]})]}),e.jsx(Ra,{value:typeof d=="number"?d:Number(d.slice(0,-1)),className:"h-2"})]})}),e.jsx(F,{children:c.zone?e.jsx("span",{className:v("inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",ba(c.zone)),children:c.zone}):e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx(F,{children:e.jsx("span",{title:xa(c.timestamp),className:"text-muted-foreground",children:ha(c.timestamp)})}),e.jsx(F,{children:e.jsx(q,{variant:"ghost",size:"icon",asChild:!0,className:"h-8 w-8",title:"View instance details",children:e.jsx(ce,{to:`/nodes/${c.id}`,children:e.jsx(Ft,{className:"h-4 w-4"})})})})]},c.id)}),t.length===0&&e.jsx(X,{children:e.jsx(F,{colSpan:7,className:"h-24 text-center",children:e.jsx("div",{className:"text-muted-foreground",children:"No instances found"})})})]})]})}const xe=i.forwardRef(({className:t,type:s,...r},a)=>e.jsx("input",{type:s,className:v("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:a,...r}));xe.displayName="Input";var tr=1,wl=.9,Nl=.8,kl=.17,Qt=.1,Jt=.999,Sl=.9999,El=.99,Cl=/[\\\/_+.#"@\[\(\{&]/,Tl=/[\\\/_+.#"@\[\(\{&]/g,Rl=/[\s-]/,Aa=/[\s-]/g;function us(t,s,r,a,n,o,l){if(o===s.length)return n===t.length?tr:El;var c=`${n},${o}`;if(l[c]!==void 0)return l[c];for(var d=a.charAt(o),u=r.indexOf(d,n),m=0,f,y,N,h;u>=0;)f=us(t,s,r,a,u+1,o+1,l),f>m&&(u===n?f*=tr:Cl.test(t.charAt(u-1))?(f*=Nl,N=t.slice(n,u-1).match(Tl),N&&n>0&&(f*=Math.pow(Jt,N.length))):Rl.test(t.charAt(u-1))?(f*=wl,h=t.slice(n,u-1).match(Aa),h&&n>0&&(f*=Math.pow(Jt,h.length))):(f*=kl,n>0&&(f*=Math.pow(Jt,u-n))),t.charAt(u)!==s.charAt(o)&&(f*=Sl)),(f<Qt&&r.charAt(u-1)===a.charAt(o+1)||a.charAt(o+1)===a.charAt(o)&&r.charAt(u-1)!==a.charAt(o))&&(y=us(t,s,r,a,u+1,o+2,l),y*Qt>f&&(f=y*Qt)),f>m&&(m=f),u=r.indexOf(d,u+1);return l[c]=m,m}function sr(t){return t.toLowerCase().replace(Aa," ")}function Al(t,s,r){return t=r&&r.length>0?`${t+" "+r.join(" ")}`:t,us(t,s,sr(t),sr(s),0,0,{})}var _a={exports:{}},Ia={};/**
* @license React
* use-sync-external-store-shim.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Ve=i;function _l(t,s){return t===s&&(t!==0||1/t===1/s)||t!==t&&s!==s}var Il=typeof Object.is=="function"?Object.is:_l,Fl=Ve.useState,Ll=Ve.useEffect,Pl=Ve.useLayoutEffect,Dl=Ve.useDebugValue;function Ol(t,s){var r=s(),a=Fl({inst:{value:r,getSnapshot:s}}),n=a[0].inst,o=a[1];return Pl(function(){n.value=r,n.getSnapshot=s,es(n)&&o({inst:n})},[t,r,s]),Ll(function(){return es(n)&&o({inst:n}),t(function(){es(n)&&o({inst:n})})},[t]),Dl(r),r}function es(t){var s=t.getSnapshot;t=t.value;try{var r=s();return!Il(t,r)}catch{return!0}}function $l(t,s){return s()}var Ml=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?$l:Ol;Ia.useSyncExternalStore=Ve.useSyncExternalStore!==void 0?Ve.useSyncExternalStore:Ml;_a.exports=Ia;var Bl=_a.exports,We='[cmdk-group=""]',ts='[cmdk-group-items=""]',zl='[cmdk-group-heading=""]',Rs='[cmdk-item=""]',rr=`${Rs}:not([aria-disabled="true"])`,ps="cmdk-item-select",_e="data-value",Vl=(t,s,r)=>Al(t,s,r),Fa=i.createContext(void 0),ut=()=>i.useContext(Fa),La=i.createContext(void 0),As=()=>i.useContext(La),Pa=i.createContext(void 0),Da=i.forwardRef((t,s)=>{let r=$e(()=>{var S,R;return{search:"",value:(R=(S=t.value)!=null?S:t.defaultValue)!=null?R:"",filtered:{count:0,items:new Map,groups:new Set}}}),a=$e(()=>new Set),n=$e(()=>new Map),o=$e(()=>new Map),l=$e(()=>new Set),c=Oa(t),{label:d,children:u,value:m,onValueChange:f,filter:y,shouldFilter:N,loop:h,disablePointerSelection:p=!1,vimBindings:g=!0,...x}=t,b=Me(),j=Me(),w=Me(),E=i.useRef(null),C=Jl();Pe(()=>{if(m!==void 0){let S=m.trim();r.current.value=S,A.emit()}},[m]),Pe(()=>{C(6,W)},[]);let A=i.useMemo(()=>({subscribe:S=>(l.current.add(S),()=>l.current.delete(S)),snapshot:()=>r.current,setState:(S,R,$)=>{var L,G,H;if(!Object.is(r.current[S],R)){if(r.current[S]=R,S==="search")M(),Y(),C(1,K);else if(S==="value"&&($||C(5,W),((L=c.current)==null?void 0:L.value)!==void 0)){let ne=R??"";(H=(G=c.current).onValueChange)==null||H.call(G,ne);return}A.emit()}},emit:()=>{l.current.forEach(S=>S())}}),[]),B=i.useMemo(()=>({value:(S,R,$)=>{var L;R!==((L=o.current.get(S))==null?void 0:L.value)&&(o.current.set(S,{value:R,keywords:$}),r.current.filtered.items.set(S,z(R,$)),C(2,()=>{Y(),A.emit()}))},item:(S,R)=>(a.current.add(S),R&&(n.current.has(R)?n.current.get(R).add(S):n.current.set(R,new Set([S]))),C(3,()=>{M(),Y(),r.current.value||K(),A.emit()}),()=>{o.current.delete(S),a.current.delete(S),r.current.filtered.items.delete(S);let $=T();C(4,()=>{M(),($==null?void 0:$.getAttribute("id"))===S&&K(),A.emit()})}),group:S=>(n.current.has(S)||n.current.set(S,new Set),()=>{o.current.delete(S),n.current.delete(S)}),filter:()=>c.current.shouldFilter,label:d||t["aria-label"],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:b,inputId:w,labelId:j,listInnerRef:E}),[]);function z(S,R){var $,L;let G=(L=($=c.current)==null?void 0:$.filter)!=null?L:Vl;return S?G(S,r.current.search,R):0}function Y(){if(!r.current.search||c.current.shouldFilter===!1)return;let S=r.current.filtered.items,R=[];r.current.filtered.groups.forEach(L=>{let G=n.current.get(L),H=0;G.forEach(ne=>{let de=S.get(ne);H=Math.max(de,H)}),R.push([L,H])});let $=E.current;O().sort((L,G)=>{var H,ne;let de=L.getAttribute("id"),gt=G.getAttribute("id");return((H=S.get(gt))!=null?H:0)-((ne=S.get(de))!=null?ne:0)}).forEach(L=>{let G=L.closest(ts);G?G.appendChild(L.parentElement===G?L:L.closest(`${ts} > *`)):$.appendChild(L.parentElement===$?L:L.closest(`${ts} > *`))}),R.sort((L,G)=>G[1]-L[1]).forEach(L=>{var G;let H=(G=E.current)==null?void 0:G.querySelector(`${We}[${_e}="${encodeURIComponent(L[0])}"]`);H==null||H.parentElement.appendChild(H)})}function K(){let S=O().find($=>$.getAttribute("aria-disabled")!=="true"),R=S==null?void 0:S.getAttribute(_e);A.setState("value",R||void 0)}function M(){var S,R,$,L;if(!r.current.search||c.current.shouldFilter===!1){r.current.filtered.count=a.current.size;return}r.current.filtered.groups=new Set;let G=0;for(let H of a.current){let ne=(R=(S=o.current.get(H))==null?void 0:S.value)!=null?R:"",de=(L=($=o.current.get(H))==null?void 0:$.keywords)!=null?L:[],gt=z(ne,de);r.current.filtered.items.set(H,gt),gt>0&&G++}for(let[H,ne]of n.current)for(let de of ne)if(r.current.filtered.items.get(de)>0){r.current.filtered.groups.add(H);break}r.current.filtered.count=G}function W(){var S,R,$;let L=T();L&&(((S=L.parentElement)==null?void 0:S.firstChild)===L&&(($=(R=L.closest(We))==null?void 0:R.querySelector(zl))==null||$.scrollIntoView({block:"nearest"})),L.scrollIntoView({block:"nearest"}))}function T(){var S;return(S=E.current)==null?void 0:S.querySelector(`${Rs}[aria-selected="true"]`)}function O(){var S;return Array.from(((S=E.current)==null?void 0:S.querySelectorAll(rr))||[])}function V(S){let R=O()[S];R&&A.setState("value",R.getAttribute(_e))}function Q(S){var R;let $=T(),L=O(),G=L.findIndex(ne=>ne===$),H=L[G+S];(R=c.current)!=null&&R.loop&&(H=G+S<0?L[L.length-1]:G+S===L.length?L[0]:L[G+S]),H&&A.setState("value",H.getAttribute(_e))}function _(S){let R=T(),$=R==null?void 0:R.closest(We),L;for(;$&&!L;)$=S>0?Xl($,We):Ql($,We),L=$==null?void 0:$.querySelector(rr);L?A.setState("value",L.getAttribute(_e)):Q(S)}let I=()=>V(O().length-1),P=S=>{S.preventDefault(),S.metaKey?I():S.altKey?_(1):Q(1)},U=S=>{S.preventDefault(),S.metaKey?V(0):S.altKey?_(-1):Q(-1)};return i.createElement(re.div,{ref:s,tabIndex:-1,...x,"cmdk-root":"",onKeyDown:S=>{var R;if((R=x.onKeyDown)==null||R.call(x,S),!S.defaultPrevented)switch(S.key){case"n":case"j":{g&&S.ctrlKey&&P(S);break}case"ArrowDown":{P(S);break}case"p":case"k":{g&&S.ctrlKey&&U(S);break}case"ArrowUp":{U(S);break}case"Home":{S.preventDefault(),V(0);break}case"End":{S.preventDefault(),I();break}case"Enter":if(!S.nativeEvent.isComposing&&S.keyCode!==229){S.preventDefault();let $=T();if($){let L=new Event(ps);$.dispatchEvent(L)}}}}},i.createElement("label",{"cmdk-label":"",htmlFor:B.inputId,id:B.labelId,style:tc},d),Bt(t,S=>i.createElement(La.Provider,{value:A},i.createElement(Fa.Provider,{value:B},S))))}),Ul=i.forwardRef((t,s)=>{var r,a;let n=Me(),o=i.useRef(null),l=i.useContext(Pa),c=ut(),d=Oa(t),u=(a=(r=d.current)==null?void 0:r.forceMount)!=null?a:l==null?void 0:l.forceMount;Pe(()=>{if(!u)return c.item(n,l==null?void 0:l.id)},[u]);let m=$a(n,o,[t.value,t.children,o],t.keywords),f=As(),y=De(C=>C.value&&C.value===m.current),N=De(C=>u||c.filter()===!1?!0:C.search?C.filtered.items.get(n)>0:!0);i.useEffect(()=>{let C=o.current;if(!(!C||t.disabled))return C.addEventListener(ps,h),()=>C.removeEventListener(ps,h)},[N,t.onSelect,t.disabled]);function h(){var C,A;p(),(A=(C=d.current).onSelect)==null||A.call(C,m.current)}function p(){f.setState("value",m.current,!0)}if(!N)return null;let{disabled:g,value:x,onSelect:b,forceMount:j,keywords:w,...E}=t;return i.createElement(re.div,{ref:Je([o,s]),...E,id:n,"cmdk-item":"",role:"option","aria-disabled":!!g,"aria-selected":!!y,"data-disabled":!!g,"data-selected":!!y,onPointerMove:g||c.getDisablePointerSelection()?void 0:p,onClick:g?void 0:h},t.children)}),ql=i.forwardRef((t,s)=>{let{heading:r,children:a,forceMount:n,...o}=t,l=Me(),c=i.useRef(null),d=i.useRef(null),u=Me(),m=ut(),f=De(N=>n||m.filter()===!1?!0:N.search?N.filtered.groups.has(l):!0);Pe(()=>m.group(l),[]),$a(l,c,[t.value,t.heading,d]);let y=i.useMemo(()=>({id:l,forceMount:n}),[n]);return i.createElement(re.div,{ref:Je([c,s]),...o,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},r&&i.createElement("div",{ref:d,"cmdk-group-heading":"","aria-hidden":!0,id:u},r),Bt(t,N=>i.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?u:void 0},i.createElement(Pa.Provider,{value:y},N))))}),Gl=i.forwardRef((t,s)=>{let{alwaysRender:r,...a}=t,n=i.useRef(null),o=De(l=>!l.search);return!r&&!o?null:i.createElement(re.div,{ref:Je([n,s]),...a,"cmdk-separator":"",role:"separator"})}),Hl=i.forwardRef((t,s)=>{let{onValueChange:r,...a}=t,n=t.value!=null,o=As(),l=De(m=>m.search),c=De(m=>m.value),d=ut(),u=i.useMemo(()=>{var m;let f=(m=d.listInnerRef.current)==null?void 0:m.querySelector(`${Rs}[${_e}="${encodeURIComponent(c)}"]`);return f==null?void 0:f.getAttribute("id")},[]);return i.useEffect(()=>{t.value!=null&&o.setState("search",t.value)},[t.value]),i.createElement(re.input,{ref:s,...a,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":d.listId,"aria-labelledby":d.labelId,"aria-activedescendant":u,id:d.inputId,type:"text",value:n?t.value:l,onChange:m=>{n||o.setState("search",m.target.value),r==null||r(m.target.value)}})}),Kl=i.forwardRef((t,s)=>{let{children:r,label:a="Suggestions",...n}=t,o=i.useRef(null),l=i.useRef(null),c=ut();return i.useEffect(()=>{if(l.current&&o.current){let d=l.current,u=o.current,m,f=new ResizeObserver(()=>{m=requestAnimationFrame(()=>{let y=d.offsetHeight;u.style.setProperty("--cmdk-list-height",y.toFixed(1)+"px")})});return f.observe(d),()=>{cancelAnimationFrame(m),f.unobserve(d)}}},[]),i.createElement(re.div,{ref:Je([o,s]),...n,"cmdk-list":"",role:"listbox","aria-label":a,id:c.listId},Bt(t,d=>i.createElement("div",{ref:Je([l,c.listInnerRef]),"cmdk-list-sizer":""},d)))}),Wl=i.forwardRef((t,s)=>{let{open:r,onOpenChange:a,overlayClassName:n,contentClassName:o,container:l,...c}=t;return i.createElement(ws,{open:r,onOpenChange:a},i.createElement(Ns,{container:l},i.createElement(it,{"cmdk-overlay":"",className:n}),i.createElement(lt,{"aria-label":t.label,"cmdk-dialog":"",className:o},i.createElement(Da,{ref:s,...c}))))}),Zl=i.forwardRef((t,s)=>De(r=>r.filtered.count===0)?i.createElement(re.div,{ref:s,...t,"cmdk-empty":"",role:"presentation"}):null),Yl=i.forwardRef((t,s)=>{let{progress:r,children:a,label:n="Loading...",...o}=t;return i.createElement(re.div,{ref:s,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":n},Bt(t,l=>i.createElement("div",{"aria-hidden":!0},l)))}),oe=Object.assign(Da,{List:Kl,Item:Ul,Input:Hl,Group:ql,Separator:Gl,Dialog:Wl,Empty:Zl,Loading:Yl});function Xl(t,s){let r=t.nextElementSibling;for(;r;){if(r.matches(s))return r;r=r.nextElementSibling}}function Ql(t,s){let r=t.previousElementSibling;for(;r;){if(r.matches(s))return r;r=r.previousElementSibling}}function Oa(t){let s=i.useRef(t);return Pe(()=>{s.current=t}),s}var Pe=typeof window>"u"?i.useEffect:i.useLayoutEffect;function $e(t){let s=i.useRef();return s.current===void 0&&(s.current=t()),s}function Je(t){return s=>{t.forEach(r=>{typeof r=="function"?r(s):r!=null&&(r.current=s)})}}function De(t){let s=As(),r=()=>t(s.snapshot());return Bl.useSyncExternalStore(s.subscribe,r,r)}function $a(t,s,r,a=[]){let n=i.useRef(),o=ut();return Pe(()=>{var l;let c=(()=>{var u;for(let m of r){if(typeof m=="string")return m.trim();if(typeof m=="object"&&"current"in m)return m.current?(u=m.current.textContent)==null?void 0:u.trim():n.current}})(),d=a.map(u=>u.trim());o.value(t,c,d),(l=s.current)==null||l.setAttribute(_e,c),n.current=c}),n}var Jl=()=>{let[t,s]=i.useState(),r=$e(()=>new Map);return Pe(()=>{r.current.forEach(a=>a()),r.current=new Map},[t]),(a,n)=>{r.current.set(a,n),s({})}};function ec(t){let s=t.type;return typeof s=="function"?s(t.props):"render"in s?s.render(t.props):t}function Bt({asChild:t,children:s},r){return t&&i.isValidElement(s)?i.cloneElement(ec(s),{ref:s.ref},r(s.props.children)):r(s)}var tc={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Ma=ws,sc=Ns,Ba=i.forwardRef(({className:t,...s},r)=>e.jsx(it,{ref:r,className:v("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...s}));Ba.displayName=it.displayName;const _s=i.forwardRef(({className:t,children:s,...r},a)=>e.jsxs(sc,{children:[e.jsx(Ba,{}),e.jsxs(lt,{ref:a,className:v("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...r,children:[s,e.jsxs(aa,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(vs,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));_s.displayName=lt.displayName;const Is=({className:t,...s})=>e.jsx("div",{className:v("flex flex-col space-y-1.5 text-center sm:text-left",t),...s});Is.displayName="DialogHeader";const Fs=({className:t,...s})=>e.jsx("div",{className:v("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...s});Fs.displayName="DialogFooter";const Ls=i.forwardRef(({className:t,...s},r)=>e.jsx(Lt,{ref:r,className:v("text-lg font-semibold leading-none tracking-tight",t),...s}));Ls.displayName=Lt.displayName;const Ps=i.forwardRef(({className:t,...s},r)=>e.jsx(Pt,{ref:r,className:v("text-sm text-muted-foreground",t),...s}));Ps.displayName=Pt.displayName;const za=i.forwardRef(({className:t,...s},r)=>e.jsx(oe,{ref:r,className:v("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...s}));za.displayName=oe.displayName;const Va=i.forwardRef(({className:t,...s},r)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx(Er,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(oe.Input,{ref:r,className:v("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...s})]}));Va.displayName=oe.Input.displayName;const rc=i.forwardRef(({className:t,...s},r)=>e.jsx(oe.List,{ref:r,className:v("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...s}));rc.displayName=oe.List.displayName;const Ua=i.forwardRef((t,s)=>e.jsx(oe.Empty,{ref:s,className:"py-6 text-center text-sm",...t}));Ua.displayName=oe.Empty.displayName;const qa=i.forwardRef(({className:t,...s},r)=>e.jsx(oe.Group,{ref:r,className:v("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...s}));qa.displayName=oe.Group.displayName;const ac=i.forwardRef(({className:t,...s},r)=>e.jsx(oe.Separator,{ref:r,className:v("-mx-1 h-px bg-border",t),...s}));ac.displayName=oe.Separator.displayName;const ms=i.forwardRef(({className:t,...s},r)=>e.jsx(oe.Item,{ref:r,className:v("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t),...s}));ms.displayName=oe.Item.displayName;const nc=po,oc=mo,Ga=i.forwardRef(({className:t,align:s="center",sideOffset:r=4,...a},n)=>e.jsx(uo,{children:e.jsx(xr,{ref:n,align:s,sideOffset:r,className:v("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...a})}));Ga.displayName=xr.displayName;function Fe({options:t=[],selected:s=[],onChange:r,placeholder:a="Select options...",emptyMessage:n="No options found.",className:o}){const[l,c]=i.useState(!1),d=y=>{const N=s.includes(y)?s.filter(h=>h!==y):[...s,y];r(N)},u=()=>{s.length===t.length?r([]):r(t.map(y=>y.value))},m=s.length,f=t.length;return e.jsxs(nc,{open:l,onOpenChange:c,children:[e.jsx(oc,{asChild:!0,children:e.jsxs(q,{variant:"outline",role:"combobox","aria-expanded":l,className:v("justify-between",o),children:[m===0?a:`${m} selected`,e.jsx(Sr,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(Ga,{className:"w-[200px] p-0",children:e.jsxs(za,{children:[e.jsx(Va,{placeholder:a}),e.jsx(Ua,{children:n}),e.jsxs(qa,{children:[f>0&&e.jsx(ms,{onSelect:u,children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Le,{checked:m>0&&m===f,"aria-label":"Select all"}),e.jsx("span",{children:"Select all"})]})}),t.map(y=>e.jsx(ms,{onSelect:()=>d(y.value),children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Le,{checked:s.includes(y.value)}),e.jsx("span",{children:y.label})]})},y.value))]})]})})]})}function ic({idFilter:t,onIdFilterChange:s,stateFilter:r,onStateFilterChange:a,zoneFilter:n,onZoneFilterChange:o,uniqueStates:l,uniqueZones:c}){return e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Er,{className:"absolute left-2 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(xe,{placeholder:"Filter by ID...",value:t,onChange:d=>s(d.target.value),className:"pl-8"})]}),l.length>0&&e.jsx(Fe,{options:l.map(d=>({value:d,label:d})),selected:r,onChange:a,placeholder:"Filter by State",className:"w-[180px]"}),c.length>0&&e.jsx(Fe,{options:c.map(d=>({value:d,label:d})),selected:n,onChange:o,placeholder:"Filter by Zone",className:"w-[180px]"})]})}const lc=t=>{switch(t){case"ACTIVE":return"#22c55e";case"LEAVING":return"#eab308";case"PENDING":return"#3b82f6";case"JOINING":return"#a855f7";case"LEFT":return"#ef4444";default:return"#6b7280"}};function cc({instances:t}){const s=i.useMemo(()=>{const a=new Map;return t.forEach(n=>{const o=n.state||"unknown";a.set(o,(a.get(o)||0)+1)}),Array.from(a.entries()).sort((n,o)=>o[1]-n[1]).map(([n,o])=>({name:n,value:o,color:lc(n)}))},[t]),r=i.useMemo(()=>t.length,[t]);return s.length===0?null:e.jsxs("div",{className:"w-full h-[120px] relative",children:[e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center pointer-events-none",children:[e.jsx("div",{className:"text-xl font-bold",children:r}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Instances"})]}),e.jsx(ct,{width:"100%",height:"100%",children:e.jsxs(Dt,{children:[e.jsx(Ot,{data:s,cx:"50%",cy:"50%",labelLine:!1,outerRadius:60,innerRadius:42,dataKey:"value",paddingAngle:1,strokeWidth:1,children:s.map(a=>e.jsx($t,{fill:a.color,stroke:"hsl(var(--background))"},`cell-${a.name}`))}),e.jsx(dt,{content:({active:a,payload:n})=>{if(!a||!n||!n[0])return null;const o=n[0].payload;return e.jsxs("div",{className:"bg-background border rounded-lg shadow-lg px-3 py-2 flex items-center gap-2",children:[e.jsx("div",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:o.color}}),e.jsx("span",{className:"text-sm font-medium",children:o.name}),e.jsx("span",{className:"text-sm font-semibold",children:o.value})]})}})]})})]})}function Ha({onRefresh:t,isPaused:s=!1,isLoading:r,className:a}){const[n,o]=i.useState(r);return i.useEffect(()=>{let l;return r?o(!0):l=setTimeout(()=>{o(!1)},1e3),()=>{l&&clearTimeout(l)}},[r]),e.jsxs("div",{className:`flex items-center gap-2 text-sm text-muted-foreground ${a}`,children:[e.jsx(q,{variant:"secondary",size:"sm",className:"h-6 px-2 text-xs hover:bg-muted",onClick:t,children:"Refresh now"}),s?e.jsx(Oo,{className:"h-3 w-3 text-orange-500"}):e.jsx(he,{className:`h-3 w-3 ${n?"animate-spin text-emerald-500 ":"opacity-0 transition-opacity duration-1000"} `}),e.jsx("span",{className:"transition-opacity duration-1000",children:s?"Auto-refresh paused":n?"Refreshing...":""})]})}const dc=Ee("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),Ge=i.forwardRef(({className:t,variant:s,...r},a)=>e.jsx("div",{ref:a,role:"alert",className:v(dc({variant:s}),t),...r}));Ge.displayName="Alert";const He=i.forwardRef(({className:t,...s},r)=>e.jsx("h5",{ref:r,className:v("mb-1 font-medium leading-none tracking-tight",t),...s}));He.displayName="AlertTitle";const Ke=i.forwardRef(({className:t,...s},r)=>e.jsx("div",{ref:r,className:v("text-sm [&_p]:leading-relaxed",t),...s}));Ke.displayName="AlertDescription";function ke({children:t,className:s,spacing:r=!0,...a}){return e.jsx("div",{className:"container p-6",children:e.jsx("div",{className:v(r&&"space-y-6",s),...a,children:t})})}function Ds({error:t,ringName:s}){return t?e.jsx(ke,{children:e.jsxs(Ge,{variant:"destructive",children:[e.jsx(nt,{className:"h-4 w-4"}),e.jsx(He,{children:"Error"}),e.jsx(Ke,{children:t})]})}):s?null:e.jsx(ke,{children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(Cr,{className:"h-6 w-6"}),e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Rings"})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:wa.map(r=>e.jsx(ce,{to:`/rings/${r.id}`,children:e.jsxs(ee,{className:"hover:bg-muted/50 transition-colors cursor-pointer",children:[e.jsx(se,{children:e.jsx(ae,{children:r.title})}),e.jsx(te,{children:e.jsxs("p",{className:"text-sm text-muted-foreground",children:["View and manage ",r.title.toLowerCase()," ring members"]})})]})},r.id))})]})})}const uc=5,pc=1e6;let ss=0;function mc(){return ss=(ss+1)%Number.MAX_SAFE_INTEGER,ss.toString()}const rs=new Map,ar=t=>{if(rs.has(t))return;const s=setTimeout(()=>{rs.delete(t),Xe({type:"REMOVE_TOAST",toastId:t})},pc);rs.set(t,s)},gc=(t,s)=>{switch(s.type){case"ADD_TOAST":return{...t,toasts:[s.toast,...t.toasts].slice(0,uc)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(r=>r.id===s.toast.id?{...r,...s.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=s;return r?ar(r):t.toasts.forEach(a=>{ar(a.id)}),{...t,toasts:t.toasts.map(a=>a.id===r||r===void 0?{...a,open:!1}:a)}}case"REMOVE_TOAST":return s.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(r=>r.id!==s.toastId)}}},xt=[];let bt={toasts:[]};function Xe(t){bt=gc(bt,t),xt.forEach(s=>{s(bt)})}function fc({...t}){const s=mc(),r=n=>Xe({type:"UPDATE_TOAST",toast:{...n,id:s}}),a=()=>Xe({type:"DISMISS_TOAST",toastId:s});return Xe({type:"ADD_TOAST",toast:{...t,id:s,open:!0,onOpenChange:n=>{n||a()}}}),{id:s,dismiss:a,update:r}}function zt(){const[t,s]=i.useState(bt);return i.useEffect(()=>(xt.push(s),()=>{const r=xt.indexOf(s);r>-1&&xt.splice(r,1)}),[t]),{...t,toast:fc,dismiss:r=>Xe({type:"DISMISS_TOAST",toastId:r})}}function hc({ringName:t}){var Q;const[s,r]=i.useState(new Set),[a,n]=i.useState(!1),[o,l]=i.useState(0),[c,d]=i.useState("id"),[u,m]=i.useState("asc"),[f,y]=i.useState(""),[N,h]=i.useState([]),[p,g]=i.useState([]),[x,b]=i.useState(!1),{ring:j,error:w,isLoading:E,fetchRing:C,forgetInstances:A,uniqueStates:B,uniqueZones:z,isTokenBased:Y}=sl({ringName:t,isPaused:s.size>0}),K=i.useMemo(()=>j!=null&&j.shards?j.shards.filter(_=>s.has(_.id)):[],[j==null?void 0:j.shards,s]),M=i.useCallback(_=>{d(I=>I===_?(m(P=>P==="asc"?"desc":"asc"),_):(m("asc"),_))},[]),W=i.useCallback(_=>{r(I=>{const P=new Set(I);return P.has(_)?P.delete(_):P.add(_),P})},[]),{toast:T}=zt(),O=i.useCallback(async()=>{if(s.size!==0)try{n(!0),l(0);const{success:_,total:I}=await A(Array.from(s));_>0&&(await C(),r(new Set)),_<I&&T({title:"Failed to forget instances",description:`Failed to forget ${I-_} instance(s)`,variant:"destructive"})}catch{T({title:"Failed to forget instances",description:`${w}`,variant:"destructive"})}finally{n(!1),b(!1)}},[s,A,C,T,w]),V=i.useMemo(()=>j!=null&&j.shards?j.shards.filter(_=>{const I=_.id.toLowerCase().includes(f.toLowerCase()),P=N.length===0||N.includes(_.state),U=p.length===0||p.includes(_.zone);return I&&P&&U}).sort((_,I)=>{let P=0;switch(c){case"id":P=_.id.localeCompare(I.id);break;case"state":P=_.state.localeCompare(I.state);break;case"address":P=_.address.localeCompare(I.address);break;case"zone":P=(_.zone||"").localeCompare(I.zone||"");break;case"timestamp":P=new Date(_.timestamp).getTime()-new Date(I.timestamp).getTime();break;case"tokens":P=_.tokens.length-I.tokens.length;break;case"ownership":P=parseFloat(_.ownership)-parseFloat(I.ownership);break}return u==="asc"?P:-P}):[],[j==null?void 0:j.shards,f,N,p,c,u]);return w?e.jsx(Ds,{error:w,ringName:t}):e.jsxs("div",{className:"container space-y-6 p-6",children:[e.jsxs(ee,{children:[e.jsx(se,{children:e.jsxs("div",{className:"grid grid-cols-[1fr_auto] gap-8",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsxs(ae,{className:"text-3xl font-semibold tracking-tight",children:[((Q=wa.find(_=>_.id===t))==null?void 0:Q.title)||""," ","Ring Members"]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"View and manage ring instances with their current status and configuration"})]}),e.jsxs("div",{className:"flex items-center justify-between min-h-[32px]",children:[e.jsx(Ha,{onRefresh:C,isPaused:s.size>0,isLoading:E}),s.size>0&&e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:[s.size," instance",s.size!==1?"s":""," selected"]}),e.jsxs(q,{onClick:()=>b(!0),disabled:a,size:"sm",variant:"outline",className:v("border-red-200 bg-red-50 text-red-900 hover:bg-red-100 hover:text-red-900","dark:border-red-800 dark:bg-red-950 dark:text-red-200 dark:hover:bg-red-900","disabled:hover:bg-red-50 dark:disabled:hover:bg-red-950"),children:[a&&e.jsxs(e.Fragment,{children:[e.jsx(he,{className:"mr-2 h-4 w-4 animate-spin"}),o>0&&e.jsxs("span",{className:"mr-2",children:[o,"/",s.size]})]}),"Forget Selected"]})]})]})]}),e.jsx("div",{className:"flex items-center",children:e.jsx("div",{className:"w-[250px]",children:(j==null?void 0:j.shards)&&e.jsx(cc,{instances:j.shards})})})]})}),e.jsxs(te,{className:"space-y-6",children:[e.jsx(ic,{idFilter:f,onIdFilterChange:y,stateFilter:N,onStateFilterChange:h,zoneFilter:p,onZoneFilterChange:g,uniqueStates:B,uniqueZones:z}),e.jsx("div",{className:"rounded-md border bg-card",children:e.jsx(jl,{instances:V,selectedInstances:s,onSelectInstance:W,sortField:c,sortDirection:u,onSort:M,showTokens:Y})})]})]}),e.jsx(Ma,{open:x,onOpenChange:b,children:e.jsxs(_s,{children:[e.jsxs(Is,{children:[e.jsx(Ls,{children:"Confirm Forget Instances"}),e.jsx(Ps,{children:"Are you sure you want to forget the following instances? This action cannot be undone."})]}),e.jsx("div",{className:"max-h-[300px] overflow-y-auto",children:e.jsx("div",{className:"space-y-2",children:K.map(_=>e.jsxs("div",{className:"flex items-center justify-between p-2 rounded-md bg-muted",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:_.id}),e.jsx("span",{className:v("inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",Et(_.state)),children:_.state})]}),e.jsx("span",{className:"text-sm text-muted-foreground",children:_.address})]},_.id))})}),e.jsxs(Fs,{children:[e.jsx(q,{variant:"outline",onClick:()=>b(!1),disabled:a,children:"Cancel"}),e.jsx(q,{variant:"outline",onClick:O,disabled:a,className:v("border-red-200 bg-red-50 text-red-900 hover:bg-red-100 hover:text-red-900","dark:border-red-800 dark:bg-red-950 dark:text-red-200 dark:hover:bg-red-900","disabled:hover:bg-red-50 dark:disabled:hover:bg-red-950"),children:a?e.jsxs(e.Fragment,{children:[e.jsx(he,{className:"mr-2 h-4 w-4 animate-spin"}),"Forgetting..."]}):"Forget Instances"})]})]})})]})}const xc=()=>{const t=i.useRef({});return{fetchMetrics:i.useCallback(async({nodeNames:r,metrics:a})=>{if(!r.length)return{};const n={...t.current},o={};return await Promise.all(r.map(async l=>{try{const c=await fetch(`/ui/api/v1/proxy/${l}/metrics`);if(!c.ok)throw new Error(`Failed to fetch metrics: ${c.statusText}`);const d=await c.text(),u={timestamp:Date.now(),values:{}};a.forEach(f=>{const y=new RegExp(`${f}\\{[^}]*\\}\\s+([\\d.e+]+)`),N=d.match(y);N&&(u.values[f]=parseFloat(N[1]))});const m=t.current[l];if(n[l]=u,m){const f=(u.timestamp-m.timestamp)/1e3;if(f>0){const y=a.map(N=>{const h=u.values[N],p=m.values[N];if(h!==void 0&&p!==void 0){const g=(h-p)/f;return{name:N,rate:g,currentValue:h}}return{name:N,rate:0,currentValue:h??0}});o[l]=y}}}catch(c){console.error(`Error fetching metrics for node ${l}:`,c)}})),t.current=n,o},[])}},bc={0:"PartitionUnknown",1:"PartitionPending",2:"PartitionActive",3:"PartitionInactive",4:"PartitionDeleted"};function yc({isPaused:t=!1}={}){const{cluster:s,isLoading:r}=ue(),[a,n]=i.useState({partitions:[],error:"",isLoading:!1}),o=i.useRef(),l=i.useCallback(()=>ja(s==null?void 0:s.members,J.PARTITION_INGESTER),[s]),{fetchMetrics:c}=xc(),d=i.useCallback(async()=>{if(!l()){n(f=>({...f,partitions:[],error:"No cluster members available",isLoading:!1}));return}o.current&&o.current.abort(),o.current=new AbortController;try{n(g=>({...g,isLoading:!0,error:""}));const f=await fetch(l(),{signal:o.current.signal,headers:{Accept:"application/json"}});if(!f.ok)throw new Error(`Failed to fetch partitions: ${f.statusText}`);const N=(await f.json()).partitions.flatMap(g=>g.owner_ids.map(x=>({...g,owner_id:x,owner_ids:[x],zone:Es(x)}))),h=Array.from(new Set(N.map(g=>g.owner_ids).flat().filter(g=>g!==void 0))),p=await c({nodeNames:h,metrics:["loki_ingest_storage_reader_fetch_bytes_total","loki_ingest_storage_reader_fetch_compressed_bytes_total"]});n(g=>({...g,isLoading:!1,partitions:N.map(x=>{var j,w;if(!x.owner_id)return x;const b=p[x.owner_id]||[];return{...x,uncompressedRate:((j=b.find(E=>E.name==="loki_ingest_storage_reader_fetch_bytes_total"))==null?void 0:j.rate)||0,compressedRate:((w=b.find(E=>E.name==="loki_ingest_storage_reader_fetch_compressed_bytes_total"))==null?void 0:w.rate)||0}})}))}catch(f){f instanceof Error&&f.name!=="AbortError"&&n(y=>({...y,error:f instanceof Error?f.message:"Unknown error occurred",isLoading:!1}))}},[l,c]),u=i.useCallback(async(f,y)=>{if(!l())throw new Error("No cluster members available");const N=Array.from(new Set(f)),h=N.length;let p=0;return await Promise.allSettled(N.map(async g=>{const x=new FormData;x.append("action","change_state"),x.append("partition_id",g.toString());const b=bc[y];if(b===void 0)throw new Error(`Invalid partition state: ${y}`);x.append("partition_state",b.toString());const j=await fetch(l(),{method:"POST",body:x});if(!j.ok){const w=await j.text();throw new Error(`Failed to change state for partition ${g}: ${w}`)}return p++,g})),{success:p,total:h}},[l]),m=i.useMemo(()=>{const f=new Set,y=new Set,N={};return a.partitions.forEach(h=>{const p=h.state.toString();N[p]=(N[p]||0)+1,f.add(p),h.owner_ids.forEach(g=>{const x=g.split("-")[2];x&&y.add(x)})}),{partitionsByState:N,uniqueStates:Array.from(f).sort(),uniqueZones:Array.from(y).sort()}},[a.partitions]);return i.useEffect(()=>()=>{o.current&&o.current.abort()},[]),i.useEffect(()=>{if(d(),!t){const f=setInterval(d,5e3);return()=>clearInterval(f)}},[d,t]),{partitions:a.partitions,error:a.error,isLoading:a.isLoading||r,fetchPartitions:d,changePartitionState:u,...m}}function vc(t,s){return t===void 0||s===void 0||Math.abs((t-s)/s)<.1?null:t>s?"up":"down"}function jc({trend:t}){return t?t==="up"?e.jsx($o,{className:"inline h-4 w-4 text-green-500 ml-1"}):e.jsx(Mo,{className:"inline h-4 w-4 text-red-500 ml-1"}):null}function nr({currentRate:t,label:s,className:r}){const a=i.useRef(t),n=i.useMemo(()=>vc(t,a.current),[t]);return i.useEffect(()=>{const o=setTimeout(()=>{a.current=t},2e3);return()=>clearTimeout(o)},[t]),e.jsxs("span",{className:r,children:[Xi(t),"/s",s&&` ${s}`,e.jsx(jc,{trend:n})]})}function wc({allPartitions:t,selectedIds:s,onChange:r}){const a=i.useMemo(()=>Array.from(new Set(t.map(l=>l.id))),[t]),n=a.every(l=>s.has(l)),o=()=>{r(n?new Set:new Set(a))};return e.jsx(Le,{checked:a.length>0&&n,onCheckedChange:o,"aria-label":"Select all partitions"})}function Nc(t){switch(t){case 2:return"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200";case 1:return"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200";case 3:return"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200";case 4:return"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200";default:return"bg-gray-100 text-gray-800 dark:bg-gray-900 dark:text-gray-200"}}const kc=[{value:1,label:"Pending"},{value:2,label:"Active"},{value:3,label:"Inactive"},{value:4,label:"Deleted"}];function Sc({partitions:t,selectedPartitions:s,onSelectPartition:r,sortField:a,sortDirection:n,onSort:o}){const l=i.useMemo(()=>[...t].sort((c,d)=>{var m;let u=0;switch(a){case"uncompressed_rate":{u=(c.uncompressedRate||0)-(d.uncompressedRate||0);break}case"compressed_rate":{u=(c.compressedRate||0)-(d.compressedRate||0);break}case"id":u=c.id-d.id;break;case"state":u=c.state-d.state;break;case"owner":u=((m=c.owner_id)==null?void 0:m.localeCompare(d.owner_id||""))||0;break;case"zone":u=(c.zone||"").localeCompare(d.zone||"");break;case"timestamp":u=new Date(c.state_timestamp).getTime()-new Date(d.state_timestamp).getTime();break}return n==="asc"?u:-u}),[t,a,n]);return e.jsx(e.Fragment,{children:e.jsxs(Ce,{children:[e.jsx(Te,{children:e.jsxs(X,{className:"hover:bg-transparent",children:[e.jsx(D,{className:"w-[50px]",children:e.jsx(wc,{allPartitions:t,selectedIds:s,onChange:c=>{new Set(t.map(u=>u.id)).forEach(u=>{c.has(u)!==s.has(u)&&r(u)})}})}),e.jsx(D,{className:"w-[200px]",children:e.jsx(Z,{title:"Owner",field:"owner",sortField:a,sortDirection:n,onSort:o})}),e.jsx(D,{className:"w-[150px]",children:e.jsx(Z,{title:"Zone",field:"zone",sortField:a,sortDirection:n,onSort:o})}),e.jsx(D,{className:"w-[100px]",children:e.jsx(Z,{title:"Partition ID",field:"id",sortField:a,sortDirection:n,onSort:o})}),e.jsx(D,{className:"w-[150px]",children:e.jsx(Z,{title:"State",field:"state",sortField:a,sortDirection:n,onSort:o})}),e.jsx(D,{className:"w-[200px]",children:e.jsx(Z,{title:"Last Update",field:"timestamp",sortField:a,sortDirection:n,onSort:o})}),e.jsx(D,{className:"w-[150px]",children:e.jsx(Z,{title:"Uncompressed Rate",field:"uncompressed_rate",sortField:a,sortDirection:n,onSort:o})}),e.jsx(D,{className:"w-[150px]",children:e.jsx(Z,{title:"Compressed Rate",field:"compressed_rate",sortField:a,sortDirection:n,onSort:o})}),e.jsx(D,{className:"w-[100px]"})]})}),e.jsxs(Re,{children:[l.map(c=>{var d;return e.jsxs(X,{children:[e.jsx(F,{children:e.jsx(Le,{checked:s.has(c.id),onCheckedChange:()=>r(c.id),"aria-label":`Select partition ${c.id}`})}),e.jsx(F,{className:"font-medium",children:e.jsx(ce,{to:`/nodes/${c.owner_id}`,className:"hover:underline",children:c.owner_id})}),e.jsx(F,{children:e.jsx("span",{className:v("inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",ba(c.zone||"")),children:c.zone||"-"})}),e.jsx(F,{children:e.jsx("span",{className:v("inline-flex items-center px-2 py-0.5 rounded-md text-xs font-medium",c.corrupted?"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200":"bg-muted"),title:c.corrupted?"Corrupted":void 0,children:c.id})}),e.jsx(F,{children:e.jsx("span",{className:v("inline-flex items-center px-2 py-0.5 rounded-md text-xs font-medium",Nc(c.state)),children:((d=kc.find(u=>u.value===c.state))==null?void 0:d.label)||"Unknown"})}),e.jsx(F,{children:e.jsx("span",{title:xa(c.state_timestamp),className:"text-muted-foreground",children:ha(c.state_timestamp)})}),e.jsx(F,{children:e.jsx(nr,{currentRate:c.uncompressedRate||0,className:"text-muted-foreground inline-flex items-center"})}),e.jsx(F,{children:e.jsx(nr,{currentRate:c.compressedRate||0,className:"text-muted-foreground inline-flex items-center"})}),e.jsx(F,{children:e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(ce,{to:`/nodes/${c.owner_id}`,className:"hover:underline",children:e.jsx(q,{variant:"ghost",size:"icon",className:"h-8 w-8",title:"View instance details",children:e.jsx(Ft,{className:"h-4 w-4"})})})})})]},`${c.owner_id}-${c.id}`)}),l.length===0&&e.jsx(X,{children:e.jsx(F,{colSpan:7,className:"h-24 text-center",children:e.jsx("div",{className:"text-muted-foreground",children:"No partitions found"})})})]})]})})}const Tt=li,Rt=ci,et=i.forwardRef(({className:t,children:s,...r},a)=>e.jsxs(Fr,{ref:a,className:v("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...r,children:[s,e.jsx(ri,{asChild:!0,children:e.jsx(ot,{className:"h-4 w-4 opacity-50"})})]}));et.displayName=Fr.displayName;const Ka=i.forwardRef(({className:t,...s},r)=>e.jsx(Lr,{ref:r,className:v("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(Tr,{className:"h-4 w-4"})}));Ka.displayName=Lr.displayName;const Wa=i.forwardRef(({className:t,...s},r)=>e.jsx(Pr,{ref:r,className:v("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(ot,{className:"h-4 w-4"})}));Wa.displayName=Pr.displayName;const tt=i.forwardRef(({className:t,children:s,position:r="popper",...a},n)=>e.jsx(ai,{children:e.jsxs(Dr,{ref:n,className:v("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:r,...a,children:[e.jsx(Ka,{}),e.jsx(ni,{className:v("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),e.jsx(Wa,{})]})}));tt.displayName=Dr.displayName;const Ec=i.forwardRef(({className:t,...s},r)=>e.jsx(Or,{ref:r,className:v("px-2 py-1.5 text-sm font-semibold",t),...s}));Ec.displayName=Or.displayName;const ze=i.forwardRef(({className:t,children:s,...r},a)=>e.jsxs($r,{ref:a,className:v("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...r,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(oi,{children:e.jsx(qe,{className:"h-4 w-4"})})}),e.jsx(ii,{children:s})]}));ze.displayName=$r.displayName;const Cc=i.forwardRef(({className:t,...s},r)=>e.jsx(Mr,{ref:r,className:v("-mx-1 my-1 h-px bg-muted",t),...s}));Cc.displayName=Mr.displayName;const Tc=t=>{switch(t){case 2:return"#22c55e";case 1:return"#3b82f6";case 3:return"#eab308";case 4:return"#ef4444";default:return"#6b7280"}};function Rc({partitions:t}){const s=i.useMemo(()=>{const a=new Map;return t.forEach(n=>{const o=n.state;a.set(o,(a.get(o)||0)+1)}),Array.from(a.entries()).sort((n,o)=>o[1]-n[1]).map(([n,o])=>({name:ga[n],value:o,color:Tc(n)}))},[t]),r=i.useMemo(()=>t.length,[t]);return s.length===0?null:e.jsxs("div",{className:"w-full h-[120px] relative",children:[e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center pointer-events-none",children:[e.jsx("div",{className:"text-xl font-bold",children:r}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Partitions"})]}),e.jsx(ct,{width:"100%",height:"100%",children:e.jsxs(Dt,{children:[e.jsx(Ot,{data:s,cx:"50%",cy:"50%",labelLine:!1,outerRadius:60,innerRadius:42,dataKey:"value",paddingAngle:1,strokeWidth:1,children:s.map(a=>e.jsx($t,{fill:a.color,stroke:"hsl(var(--background))"},`cell-${a.name}`))}),e.jsx(dt,{content:({active:a,payload:n})=>{if(!a||!n||!n[0])return null;const o=n[0].payload;return e.jsxs("div",{className:"bg-background border rounded-lg shadow-lg px-3 py-2 flex items-center gap-2",children:[e.jsx("div",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:o.color}}),e.jsx("span",{className:"text-sm font-medium",children:o.name}),e.jsx("span",{className:"text-sm font-semibold",children:o.value})]})}})]})})]})}function Ac({idFilter:t,onIdFilterChange:s,stateFilter:r,onStateFilterChange:a,zoneFilter:n,onZoneFilterChange:o,ownerFilter:l,onOwnerFilterChange:c,uniqueStates:d,partitions:u}){const m=d.map(p=>({value:p,label:ga[parseInt(p)]})),f=new Set;u.forEach(p=>{p.owner_ids.forEach(g=>{const x=Es(g);x&&f.add(x)})});const y=Array.from(f).sort().map(p=>({value:p,label:p})),h=Array.from(new Set(u.map(p=>p.id.toString()))).sort((p,g)=>parseInt(p)-parseInt(g)).map(p=>({value:p,label:`Partition ${p}`}));return e.jsxs("div",{className:"flex flex-wrap gap-4",children:[e.jsx("div",{className:"flex-1 min-w-[200px]",children:e.jsx(xe,{placeholder:"Filter by owner name...",value:l,onChange:p=>c(p.target.value),className:"max-w-sm"})}),e.jsx(Fe,{options:m,selected:r,onChange:a,placeholder:"Filter by state",className:"w-[200px]"}),e.jsx(Fe,{options:y,selected:n,onChange:o,placeholder:"Filter by zone",className:"w-[200px]"}),e.jsx(Fe,{options:h,selected:t,onChange:s,placeholder:"Filter by partition ID",className:"w-[200px]"})]})}const ft=[{value:1,label:"Pending"},{value:2,label:"Active"},{value:3,label:"Inactive"},{value:4,label:"Deleted"}];function _c(){const[t,s]=i.useState(new Set),[r,a]=i.useState("id"),[n,o]=i.useState("asc"),[l,c]=i.useState([]),[d,u]=i.useState([]),[m,f]=i.useState([]),[y,N]=i.useState(""),[h,p]=i.useState(!1),[g,x]=i.useState(),[b,j]=i.useState(!1),{toast:w}=zt(),{partitions:E,error:C,isLoading:A,fetchPartitions:B,changePartitionState:z,uniqueStates:Y,uniqueZones:K}=yc({isPaused:t.size>0}),M=i.useMemo(()=>E.flatMap(I=>I.owner_ids.map(P=>({...I,owner_id:P,owner_ids:[P],zone:Es(P)}))),[E]),W=i.useCallback(I=>{a(P=>P===I?(o(U=>U==="asc"?"desc":"asc"),I):(o("asc"),I))},[]),T=i.useCallback(I=>{s(P=>{const U=new Set(P);return U.has(I)?U.delete(I):U.add(I),U})},[]),O=i.useMemo(()=>M.filter(I=>{const P=l.length===0||l.includes(I.id.toString()),U=d.length===0||d.includes(I.state.toString()),S=m.length===0||m.includes(I.zone),R=y?I.owner_id.toLowerCase().includes(y.toLowerCase()):!0;return P&&U&&S&&R}),[M,l,d,m,y]),V=i.useMemo(()=>M.filter(I=>t.has(I.id)),[M,t]),Q=i.useCallback(async()=>{var I;if(!(t.size===0||!g))try{p(!0);const P=parseInt(g,10),{success:U,total:S}=await z(V.map(R=>R.id),g);U>0&&S===U?(w({title:"State Change Success",description:`Successfully changed state for ${U} partition${U!==1?"s":""} to ${(I=ft.find(R=>R.value===P))==null?void 0:I.label}`}),await B()):U<S&&w({title:"State Change Failed",variant:"destructive",description:`Failed to change state for ${S-U} partition${S-U!==1?"s":""}.`}),s(new Set),x(void 0)}catch{w({title:"Error",description:"An unexpected error occurred while changing partition states."})}finally{p(!1),j(!1)}},[t,g,V,z,B,w]),_={partitions:O,selectedPartitions:t,onSelectPartition:T,sortField:r,sortDirection:n,onSort:W,onStateChange:Q};return C?e.jsx(Ds,{error:C,ringName:"partition-ingester"}):e.jsxs("div",{className:"container space-y-6 p-6",children:[e.jsxs(ee,{children:[e.jsx(se,{children:e.jsxs("div",{className:"grid grid-cols-[1fr_auto] gap-8",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx(ae,{className:"text-3xl font-semibold tracking-tight",children:"Partition Ring Members"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"View and manage partition ring instances with their current status and configuration"})]}),e.jsxs("div",{className:"flex items-center justify-between min-h-[32px]",children:[e.jsx(Ha,{onRefresh:B,isPaused:t.size>0,isLoading:A}),t.size>0&&e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:[t.size," partition",t.size!==1?"s":""," selected"]}),e.jsxs(Tt,{value:g,onValueChange:x,children:[e.jsx(et,{className:"w-[160px]",children:e.jsx(Rt,{placeholder:"Select new state"})}),e.jsx(tt,{children:ft.map(I=>e.jsx(ze,{value:I.value.toString(),children:I.label},I.value))})]}),e.jsxs(q,{onClick:()=>j(!0),disabled:h||!g,size:"sm",variant:"outline",children:[h&&e.jsx(he,{className:"mr-2 h-4 w-4 animate-spin"}),"Change State"]})]})]})]}),e.jsx("div",{className:"flex items-center",children:e.jsx("div",{className:"w-[250px]",children:e.jsx(Rc,{partitions:E})})})]})}),e.jsxs(te,{className:"space-y-6",children:[e.jsx(Ac,{idFilter:l,onIdFilterChange:c,stateFilter:d,onStateFilterChange:u,zoneFilter:m,onZoneFilterChange:f,ownerFilter:y,onOwnerFilterChange:N,uniqueStates:Y,uniqueZones:K,partitions:E}),e.jsx("div",{className:"rounded-md border bg-card",children:e.jsx(Sc,{..._})})]})]}),e.jsx(Ma,{open:b,onOpenChange:j,children:e.jsxs(_s,{children:[e.jsxs(Is,{children:[e.jsx(Ls,{children:"Confirm State Change"}),e.jsx(Ps,{children:"Are you sure you want to change the state of these partitions?"})]}),e.jsx("div",{className:"max-h-[300px] overflow-y-auto",children:e.jsx("div",{className:"space-y-2",children:Array.from(new Set(V.map(I=>I.id))).map(I=>{var U,S;const P=E.find(R=>R.id===I);return P?e.jsx("div",{className:"flex items-center justify-between p-2 rounded-md bg-muted",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-medium",children:["Partition ",I]}),e.jsx("span",{className:v("inline-flex items-center px-2 py-0.5 rounded-md text-xs font-medium",Et(P.state)),children:(U=ft.find(R=>R.value===P.state))==null?void 0:U.label}),e.jsx(Ft,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:v("inline-flex items-center px-2 py-0.5 rounded-md text-xs font-medium",Et(parseInt(g||"0",10))),children:(S=ft.find(R=>R.value===parseInt(g,10)))==null?void 0:S.label})]})},I):null})})}),e.jsxs(Fs,{children:[e.jsx(q,{variant:"outline",onClick:()=>j(!1),disabled:h,children:"Cancel"}),e.jsx(q,{onClick:Q,disabled:h,children:h?"Changing States...":"Confirm Changes"})]})]})})]})}function or(){const{ringName:t}=Nr(),s=Object.values(J).includes(t);return!t||!s?e.jsx(Ds,{}):t===J.PARTITION_INGESTER?e.jsx(_c,{}):e.jsx(hc,{ringName:t})}const pt=i.forwardRef(({className:t,children:s,...r},a)=>e.jsxs(Jr,{ref:a,className:v("relative overflow-hidden",t),...r,children:[e.jsx(gi,{className:"h-full w-full rounded-[inherit]",children:s}),e.jsx(Za,{}),e.jsx(fi,{})]}));pt.displayName=Jr.displayName;const Za=i.forwardRef(({className:t,orientation:s="vertical",...r},a)=>e.jsx(ea,{ref:a,orientation:s,className:v("flex touch-none select-none transition-colors",s==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",s==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...r,children:e.jsx(hi,{className:"relative flex-1 rounded-full bg-border"})}));Za.displayName=ea.displayName;const Vt=yi,Ut=vi,mt=i.forwardRef(({className:t,align:s="center",sideOffset:r=4,...a},n)=>e.jsx(na,{ref:n,align:s,sideOffset:r,className:v("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...a}));mt.displayName=na.displayName;const Os=({date:t,className:s=""})=>{const r=_r(t,{addSuffix:!0}),a=wt(t,"yyyy-MM-dd HH:mm:ss"),n=wt(new Date(t.getTime()+t.getTimezoneOffset()*6e4),"yyyy-MM-dd HH:mm:ss");return e.jsxs(Vt,{children:[e.jsx(Ut,{children:e.jsx("div",{className:`inline-block ${s}`,children:r})}),e.jsx(mt,{className:"w-[280px]",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-gray-100 rounded dark:bg-gray-700 w-14 text-center",children:"UTC"}),e.jsx("span",{className:"font-mono",children:n})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-gray-100 rounded dark:bg-gray-700 w-14 text-center",children:"Local"}),e.jsx("span",{className:"font-mono",children:a})]})]})})]})};function Ic({current:t,parent:s,files:r,folders:a}){const n=It(),[,o]=at(),l=d=>{o({path:d})},c=d=>{n(`/storage/dataobj/metadata?path=${encodeURIComponent(t+"/"+d.name)}`)};return e.jsx("div",{className:"space-y-4",children:e.jsxs(Ce,{children:[e.jsx(Te,{children:e.jsxs(X,{className:"h-12",children:[e.jsx(D,{children:"Name"}),e.jsx(D,{children:"Modified"}),e.jsx(D,{children:"Size"}),e.jsx(D,{})]})}),e.jsxs(Re,{children:[s!==t&&e.jsxs(X,{className:"h-12 cursor-pointer hover:bg-muted/50",onClick:()=>l(s||""),children:[e.jsx(F,{className:"font-medium",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("svg",{className:"w-5 h-5 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15 19l-7-7 7-7"})}),".."]})}),e.jsx(F,{children:"-"}),e.jsx(F,{children:"-"}),e.jsx(F,{})]},"parent"),a.map(d=>e.jsxs(X,{className:"h-12 cursor-pointer hover:bg-muted/50",onClick:()=>l(t?`${t}/${d}`:d),children:[e.jsx(F,{className:"font-medium",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(Bo,{className:"mr-2 h-4 w-4"}),d]})}),e.jsx(F,{children:"-"}),e.jsx(F,{children:"-"}),e.jsx(F,{})]},d)),r.map(d=>e.jsxs(X,{className:"h-12 cursor-pointer hover:bg-muted/50",onClick:u=>{u.target.closest("a[download]")||c(d)},children:[e.jsx(F,{className:"font-medium",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(zo,{className:"mr-2 h-4 w-4"}),d.name]})}),e.jsx(F,{children:e.jsx(Os,{date:new Date(d.lastModified)})}),e.jsx(F,{children:me(d.size)}),e.jsx(F,{children:e.jsx(q,{variant:"outline",size:"icon",asChild:!0,className:"h-8 w-8",children:e.jsx(ce,{to:d.downloadUrl,target:"_blank",download:!0,onClick:u=>u.stopPropagation(),children:e.jsx(Rr,{className:"h-4 w-4"})})})})]},d.name))]})]})})}function Fc(t){const{cluster:s}=ue(),r=i.useMemo(()=>Oe(s==null?void 0:s.members,"dataobj-explorer"),[s==null?void 0:s.members]);return Mt({queryKey:["explorer",t,r],queryFn:async()=>{if(!r)throw new Error("Node name not found");const a=await fetch(`/ui/api/v1/proxy/${r}/dataobj/api/v1/list?path=${encodeURIComponent(t)}`);if(!a.ok)throw new Error("Failed to fetch explorer data");const n=await a.json();return{...n,files:Lc(n.files).map(o=>({...o,downloadUrl:`/api/v1/proxy/${r}/dataobj/api/v1/download?file=${encodeURIComponent(t?`${t}/${o.name}`:o.name)}`}))}}})}const Lc=t=>[...t].sort((s,r)=>new Date(r.lastModified).getTime()-new Date(s.lastModified).getTime()),Pc=t=>{switch(t){case"S3":return{bg:"bg-orange-100",text:"text-orange-800",darkBg:"dark:bg-orange-900",darkText:"dark:text-orange-300"};case"GCS":return{bg:"bg-blue-100",text:"text-blue-800",darkBg:"dark:bg-blue-900",darkText:"dark:text-blue-300"};case"AZURE":return{bg:"bg-sky-100",text:"text-sky-800",darkBg:"dark:bg-sky-900",darkText:"dark:text-sky-300"};case"SWIFT":return{bg:"bg-red-100",text:"text-red-800",darkBg:"dark:bg-red-900",darkText:"dark:text-red-300"};case"COS":return{bg:"bg-purple-100",text:"text-purple-800",darkBg:"dark:bg-purple-900",darkText:"dark:text-purple-300"};case"ALIYUNOSS":return{bg:"bg-rose-100",text:"text-rose-800",darkBg:"dark:bg-rose-900",darkText:"dark:text-rose-300"};case"OCI":return{bg:"bg-red-100",text:"text-red-800",darkBg:"dark:bg-red-900",darkText:"dark:text-red-300"};case"OBS":return{bg:"bg-cyan-100",text:"text-cyan-800",darkBg:"dark:bg-cyan-900",darkText:"dark:text-cyan-300"};case"FILESYSTEM":return{bg:"bg-green-100",text:"text-green-800",darkBg:"dark:bg-green-900",darkText:"dark:text-green-300"};case"MEMORY":return{bg:"bg-yellow-100",text:"text-yellow-800",darkBg:"dark:bg-yellow-900",darkText:"dark:text-yellow-300"};default:return{bg:"bg-gray-100",text:"text-gray-800",darkBg:"dark:bg-gray-700",darkText:"dark:text-gray-300"}}};function Ya(){const[t,s]=Be.useState(""),{cluster:r}=ue(),a=i.useMemo(()=>Oe(r==null?void 0:r.members,"dataobj-explorer"),[r==null?void 0:r.members]);Be.useEffect(()=>{a&&fetch(`/ui/api/v1/proxy/${a}/dataobj/api/v1/provider`).then(d=>d.json()).then(d=>s(d.provider)).catch(console.error)},[a]);const[n]=at(),l=(n.get("path")||"").split("/").filter(Boolean),c=Pc(t);return e.jsx(ks,{children:e.jsxs(Ss,{children:[e.jsx(Nt,{children:e.jsx(kt,{asChild:!0,children:e.jsxs(ce,{to:"/storage/dataobj",className:`inline-flex items-center h-7 gap-2 px-3 py-1 text-xs font-medium ${c.bg} ${c.text} ${c.darkBg} ${c.darkText} rounded-full hover:ring-1 hover:ring-gray-300 dark:hover:ring-gray-600 transition-all duration-200`,children:[e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 576 512",className:"w-4 h-4",fill:"currentColor",children:e.jsx("path",{d:"M575.8 255.5c0 18-15 32.1-32 32.1h-32l.7 160.2c0 2.7-.2 5.4-.5 8.1V472c0 22.1-17.9 40-40 40H456c-1.1 0-2.2 0-3.3-.1c-1.4 .1-2.8 .1-4.2 .1H416 392c-22.1 0-40-17.9-40-40V448 384c0-17.7-14.3-32-32-32H256c-17.7 0-32 14.3-32 32v64 24c0 22.1-17.9 40-40 40H160 128.1c-1.5 0-3-.1-4.5-.2c-1.2 .1-2.4 .2-3.6 .2H104c-22.1 0-40-17.9-40-40V360c0-.9 0-1.9 .1-2.8V287.6H32c-18 0-32-14-32-32.1c0-9 3-17 10-24L266.4 8c7-7 15-8 22-8s15 2 21 7L564.8 231.5c8 7 12 15 11 24z"})}),t||""]})})}),l.length>0&&e.jsx(St,{}),l.map((d,u)=>{const m=l.slice(0,u+1).join("/"),f=u===l.length-1;return e.jsxs(Be.Fragment,{children:[e.jsx(Nt,{children:e.jsx(kt,{asChild:!0,children:f?e.jsx("span",{className:"text-gray-500",children:d}):e.jsx(ce,{to:`/storage/dataobj?path=${encodeURIComponent(m)}`,children:d})})}),u<l.length-1&&e.jsx(St,{})]},m)})]})})}function Dc(){const[t]=at(),s=t.get("path")||"",{data:r,isLoading:a,error:n}=Fc(s);return e.jsx(ke,{children:e.jsxs("div",{className:"flex h-full flex-col space-y-6",children:[e.jsx(Ya,{}),e.jsx(pt,{className:"h-full",children:e.jsx("div",{className:"grid gap-4",children:e.jsxs(ee,{children:[e.jsxs(se,{children:[e.jsx(ae,{children:e.jsx("h2",{className:"text-3xl font-semibold tracking-tight",children:"Data Objects Explorer"})}),e.jsx(Qe,{children:e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"The Data Objects Explorer allows you to explore the data objects in the cluster."})})]}),e.jsx(te,{children:a?e.jsx("div",{className:"flex items-center justify-center p-8",children:"Loading..."}):n?e.jsx("div",{className:"flex items-center justify-center p-8 text-destructive",children:n.message}):r?e.jsx(Ic,{current:r.current,parent:r.parent,files:r.files,folders:r.folders}):null})]})})})]})})}const Oc=Ee("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function be({className:t,variant:s,...r}){return e.jsx("div",{className:v(Oc({variant:s}),t),...r})}function $s({text:t,className:s,onCopy:r}){const[a,n]=i.useState(!1),o=()=>{navigator.clipboard.writeText(t).then(()=>{n(!0),r==null||r(),setTimeout(()=>n(!1),2e3)})};return e.jsx(q,{variant:"ghost",size:"sm",onClick:o,className:v("h-8 px-2",s),children:a?e.jsxs(e.Fragment,{children:[e.jsx(qe,{className:"h-4 w-4 mr-1"}),"Copied"]}):e.jsxs(e.Fragment,{children:[e.jsx(Ar,{className:"h-4 w-4 mr-1"}),"Copy"]})})}const qt=({compressed:t,uncompressed:s,showVisualization:r=!1})=>{if(t===0||s===0)return e.jsx("span",{className:"dark:text-gray-200",children:"-"});const a=s/t,n=a>1;return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"font-medium whitespace-nowrap dark:text-gray-200",children:[a.toFixed(1),"x"]}),r&&n&&e.jsx("div",{className:"flex-1 h-2.5 bg-gray-100 dark:bg-gray-600 border border-gray-200 dark:border-gray-500 rounded relative",children:e.jsx("div",{className:"absolute inset-y-0 left-0 bg-blue-600 dark:bg-blue-500 rounded",style:{width:`${t/s*100}%`}})})]})},$c=t=>{switch(t){case"INT64":return"bg-blue-500/20 text-blue-700 dark:bg-blue-500/30 dark:text-blue-300 hover:bg-blue-500/30";case"BYTES":return"bg-red-500/20 text-red-700 dark:bg-red-500/30 dark:text-red-300 hover:bg-red-500/30";case"FLOAT64":return"bg-purple-500/20 text-purple-700 dark:bg-purple-500/30 dark:text-purple-300 hover:bg-purple-500/30";case"BOOL":return"bg-yellow-500/20 text-yellow-700 dark:bg-yellow-500/30 dark:text-yellow-300 hover:bg-yellow-500/30";case"STRING":return"bg-green-500/20 text-green-700 dark:bg-green-500/30 dark:text-green-300 hover:bg-green-500/30";case"TIMESTAMP":return"bg-orange-500/20 text-orange-700 dark:bg-orange-500/30 dark:text-orange-300 hover:bg-orange-500/30";default:return"bg-gray-500/20 text-gray-700 dark:bg-gray-500/30 dark:text-gray-300 hover:bg-gray-500/30"}};function Mc({metadata:t,filename:s,downloadUrl:r}){const[a,n]=i.useState(null),[o,l]=i.useState({}),c=p=>{n(a===p?null:p)},d=(p,g)=>{const x=`${p}-${g}`;l(b=>({...b,[x]:!b[x]}))},u=t.sections.reduce((p,g)=>p+g.totalCompressedSize,0),m=t.sections.reduce((p,g)=>p+g.totalUncompressedSize,0),f=t.sections.filter(p=>p.type==="SECTION_TYPE_STREAMS"),y=t.sections.filter(p=>p.type==="SECTION_TYPE_LOGS"),N=f==null?void 0:f.reduce((p,g)=>p+(g.columns[0].rows_count||0),0),h=y==null?void 0:y.reduce((p,g)=>p+(g.columns[0].rows_count||0),0);return e.jsxs(ee,{className:"w-full",children:[e.jsx(Bc,{filename:s,downloadUrl:r,lastModified:t.lastModified}),e.jsxs(te,{className:"space-y-8",children:[e.jsx(zc,{totalCompressed:u,totalUncompressed:m,sections:t.sections,streamCount:N,logCount:h}),e.jsx(Vc,{sections:t.sections,expandedSectionIndex:a,expandedColumns:o,onToggleSection:c,onToggleColumn:d})]})]})}function Bc({filename:t,downloadUrl:s,lastModified:r}){return e.jsxs(se,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(ae,{className:"text-2xl font-semibold tracking-tight",children:"Thor Dataobj File"}),e.jsx(q,{asChild:!0,variant:"outline",children:e.jsxs(ce,{to:s,target:"_blank",download:!0,children:[e.jsx(Rr,{className:"h-4 w-4 mr-2"}),"Download"]})})]}),e.jsx(Qe,{className:"space-y-2",children:e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-sm text-foreground",children:t}),e.jsx($s,{text:t})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx("span",{children:"Last Modified:"}),e.jsx(Os,{date:new Date(r)})]})]})})})]})}function zc({totalCompressed:t,totalUncompressed:s,sections:r,streamCount:a,logCount:n}){return e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:[e.jsxs("div",{className:"rounded-lg bg-muted/50 p-6 shadow-sm",children:[e.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:"Compression"}),e.jsx(qt,{compressed:t,uncompressed:s,showVisualization:!0}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-2",children:[me(t)," → ",me(s)]})]}),e.jsxs("div",{className:"rounded-lg bg-muted/50 p-6 shadow-sm",children:[e.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:"Sections"}),e.jsx("div",{className:"font-medium text-lg",children:r.length}),e.jsx("div",{className:"text-xs text-muted-foreground mt-2",children:r.map(o=>o.type).join(", ")})]}),a&&e.jsxs("div",{className:"rounded-lg bg-muted/50 p-6 shadow-sm",children:[e.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:"Stream Count"}),e.jsx("div",{className:"font-medium text-lg",children:a.toLocaleString()})]}),n&&e.jsxs("div",{className:"rounded-lg bg-muted/50 p-6 shadow-sm",children:[e.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:"Log Count"}),e.jsx("div",{className:"font-medium text-lg",children:n.toLocaleString()})]})]})}function Vc({sections:t,expandedSectionIndex:s,expandedColumns:r,onToggleSection:a,onToggleColumn:n}){return e.jsx("div",{className:"divide-y divide-border",children:t.map((o,l)=>e.jsx(Uc,{section:o,sectionIndex:l,isExpanded:s===l,expandedColumns:r,onToggle:()=>a(l),onToggleColumn:c=>n(l,c)},l))})}function Uc({section:t,sectionIndex:s,isExpanded:r,expandedColumns:a,onToggle:n,onToggleColumn:o}){return e.jsxs("div",{className:"py-4",children:[e.jsxs("button",{className:"w-full flex justify-between items-center py-4 px-6 rounded-lg hover:bg-accent/50 transition-colors",onClick:n,children:[e.jsxs("h3",{className:"text-lg font-semibold",children:["Section #",s+1,": ",t.type]}),e.jsx("svg",{className:`w-5 h-5 transform transition-transform duration-300 ${r?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M19 9l-7 7-7-7"})})]}),r&&e.jsxs("div",{className:"mt-6 px-6",children:[e.jsx(qc,{section:t}),e.jsx(Gc,{columns:t.columns,sectionIndex:s,expandedColumns:a,onToggleColumn:o})]})]})}function qc({section:t}){return e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 mb-8",children:[e.jsxs("div",{className:"rounded-lg bg-secondary/50 p-6 shadow-sm",children:[e.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:"Compression"}),e.jsx(qt,{compressed:t.totalCompressedSize,uncompressed:t.totalUncompressedSize,showVisualization:!0}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-2",children:[me(t.totalCompressedSize)," →"," ",me(t.totalUncompressedSize)]})]}),e.jsxs("div",{className:"rounded-lg bg-secondary/50 p-6 shadow-sm",children:[e.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:"Column Count"}),e.jsx("div",{className:"font-medium text-lg",children:t.columnCount})]}),e.jsxs("div",{className:"rounded-lg bg-secondary/50 p-6 shadow-sm",children:[e.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:"Type"}),e.jsx("div",{className:"font-medium text-lg flex items-center gap-2",children:e.jsx(be,{variant:"outline",className:"font-mono",children:t.type})})]})]})}function Gc({columns:t,sectionIndex:s,expandedColumns:r,onToggleColumn:a}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("h4",{className:"text-lg font-medium",children:["Columns (",t.length,")"]}),e.jsx("div",{className:"space-y-4",children:t.map((n,o)=>e.jsx(Hc,{column:n,isExpanded:r[`${s}-${o}`],onToggle:()=>a(o)},o))})]})}function Hc({column:t,isExpanded:s,onToggle:r}){return e.jsxs(ee,{className:"bg-card/50",children:[e.jsxs("button",{className:"w-full flex justify-between items-center p-6 hover:bg-accent/50 transition-colors rounded-t-lg",onClick:r,children:[e.jsxs("div",{children:[e.jsx("h5",{className:"font-medium text-lg",children:t.name?`${t.name} (${t.type})`:t.type}),e.jsx("div",{className:"text-sm text-muted-foreground mt-1 flex items-center gap-2",children:e.jsx(be,{variant:"secondary",className:v("font-mono text-xs",$c(t.value_type)),children:t.value_type})})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"text-sm font-medium flex items-center gap-2",children:["Compression:",e.jsx(be,{variant:"outline",className:"font-mono",children:t.compression||"NONE"})]}),e.jsx("svg",{className:`w-4 h-4 transform transition-transform ${s?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M19 9l-7 7-7-7"})})]})]}),s&&e.jsxs(te,{className:"pt-6",children:[e.jsx(Kc,{column:t}),t.pages.length>0&&e.jsx(Wc,{pages:t.pages})]})]})}function Kc({column:t}){return e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-6 mb-8",children:[e.jsxs("div",{className:"rounded-lg bg-muted p-6",children:[e.jsx("div",{className:"text-sm text-muted-foreground mb-2 flex items-center gap-2",children:e.jsx(be,{variant:"outline",className:"font-mono",children:t.compression||"NONE"})}),e.jsx("div",{className:"font-medium",children:e.jsx(qt,{compressed:t.compressed_size,uncompressed:t.uncompressed_size})}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-2",children:[me(t.compressed_size)," →"," ",me(t.uncompressed_size)]})]}),e.jsxs("div",{className:"rounded-lg bg-muted p-6",children:[e.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:"Rows"}),e.jsx("div",{className:"font-medium text-lg",children:t.rows_count.toLocaleString()})]}),e.jsxs("div",{className:"rounded-lg bg-muted p-6",children:[e.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:"Values Count"}),e.jsx("div",{className:"font-medium text-lg",children:t.values_count.toLocaleString()})]}),e.jsxs("div",{className:"rounded-lg bg-muted p-6",children:[e.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:"Offset"}),e.jsx("div",{className:"font-medium text-lg",children:me(t.metadata_offset)})]})]})}function Wc({pages:t}){return e.jsxs("div",{className:"mt-8",children:[e.jsxs("h6",{className:"text-base font-medium mb-4",children:["Pages (",t.length,")"]}),e.jsx("div",{className:"rounded-lg border border-border overflow-hidden bg-background",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-secondary/50 border-b border-border",children:[e.jsx("th",{className:"text-left p-4 font-medium text-muted-foreground",children:"#"}),e.jsx("th",{className:"text-left p-4 font-medium text-muted-foreground",children:"Rows"}),e.jsx("th",{className:"text-left p-4 font-medium text-muted-foreground",children:"Values"}),e.jsx("th",{className:"text-left p-4 font-medium text-muted-foreground",children:"Encoding"}),e.jsx("th",{className:"text-left p-4 font-medium text-muted-foreground",children:"Compression"})]})}),e.jsx("tbody",{children:t.map((s,r)=>e.jsxs("tr",{className:"border-t border-border hover:bg-accent/50 transition-colors",children:[e.jsx("td",{className:"p-4",children:r+1}),e.jsx("td",{className:"p-4",children:s.rows_count.toLocaleString()}),e.jsx("td",{className:"p-4",children:s.values_count.toLocaleString()}),e.jsx("td",{className:"p-4",children:e.jsx(be,{variant:"outline",className:"font-mono",children:s.encoding})}),e.jsx("td",{className:"p-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(qt,{compressed:s.compressed_size,uncompressed:s.uncompressed_size}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",me(s.compressed_size)," →"," ",me(s.uncompressed_size),")"]})]})})]},r))})]})})]})}function Zc(t){const{cluster:s}=ue(),r=i.useMemo(()=>Oe(s==null?void 0:s.members,"dataobj-explorer"),[s==null?void 0:s.members]),a=i.useMemo(()=>`/api/v1/proxy/${r}/dataobj/api/v1/download?file=${encodeURIComponent(t||"")}`,[t,r]);return{...Mt({queryKey:["file-metadata",t,r],queryFn:async()=>{if(!t)throw new Error("No file path provided");if(!r)throw new Error("Node name not found");const o=await fetch(`/ui/api/v1/proxy/${r}/dataobj/api/v1/inspect?file=${encodeURIComponent(t)}`);if(!o.ok)throw new Error("Failed to fetch file metadata");return o.json()},enabled:!!t&&!!r}),downloadUrl:a}}function Yc(){const[t]=at(),s=t.get("path")||"",{data:r,downloadUrl:a,isLoading:n,error:o}=Zc(s);return e.jsx(ke,{children:e.jsxs("div",{className:"flex h-full flex-col space-y-6",children:[e.jsx(Ya,{}),e.jsx(pt,{className:"h-full",children:n?e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx(he,{className:"h-16 w-16 animate-spin"})}):o?e.jsxs(Ge,{variant:"destructive",children:[e.jsx(He,{children:"Error"}),e.jsx(Ke,{children:o.message})]}):r&&s?e.jsx(Mc,{metadata:r,filename:s,downloadUrl:a}):null})]})})}const Xc=["New","Starting","Running","Stopping","Terminated","Failed"],Qc=({nameFilter:t,targetFilter:s,selectedStates:r,onNameFilterChange:a,onTargetFilterChange:n,onStatesChange:o,onRefresh:l,availableTargets:c})=>{const d=Xc.map(m=>({label:m,value:m})),u=m=>{o(m)};return e.jsxs("div",{className:"grid grid-cols-[auto_1fr_auto] gap-x-4 gap-y-2",children:[e.jsx("div",{className:"space-y-2",children:e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"Node filters"}),e.jsx(xe,{value:t,onChange:m=>a(m.target.value),placeholder:"Filter by node name...",className:"w-[300px]"}),e.jsx(Fe,{options:c.map(m=>({value:m,label:m})),selected:s,onChange:n,placeholder:"All Targets",className:"w-[300px]"})]})}),e.jsxs("div",{className:"space-y-1.5 self-end",children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"Service states"}),e.jsx(Fe,{options:d,selected:r,onChange:u,placeholder:"Filter nodes by service states...",className:"w-full min-w-[300px]"})]}),e.jsx("div",{className:"self-end",children:e.jsx(q,{onClick:l,size:"sm",variant:"outline",className:"h-9 w-9",children:e.jsx(Vo,{className:"h-4 w-4"})})})]})},Jc=({services:t,error:s})=>{const r=()=>{if(s)return{className:"bg-red-500 dark:bg-red-500/80 hover:bg-red-600 dark:hover:bg-red-500 text-white border-transparent",tooltip:`Error: ${s}`,status:"error"};const o=t.every(c=>c.status==="Running"),l=t.every(c=>c.status==="Starting"||c.status==="Running");return o?{className:"bg-green-500 dark:bg-green-500/80 hover:bg-green-600 dark:hover:bg-green-500 text-white border-transparent",status:"healthy"}:l?{className:"bg-yellow-500 dark:bg-yellow-500/80 hover:bg-yellow-600 dark:hover:bg-yellow-500 text-white border-transparent",status:"pending"}:{className:"bg-red-500 dark:bg-red-500/80 hover:bg-red-600 dark:hover:bg-red-500 text-white border-transparent",status:"unhealthy"}},a=o=>{switch(o){case"Running":return"text-green-600 dark:text-green-400";case"Starting":return"text-yellow-600 dark:text-yellow-400";case"Failed":return"text-red-600 dark:text-red-400";case"Terminated":return"text-gray-600 dark:text-gray-400";case"Stopping":return"text-orange-600 dark:text-orange-400";case"New":return"text-blue-600 dark:text-blue-400";default:return"text-gray-600 dark:text-gray-400"}},{className:n}=r();return e.jsxs(Vt,{children:[e.jsx(Ut,{children:e.jsx("button",{type:"button",children:e.jsxs(be,{className:n,children:[t.length," services"]})})}),e.jsx(mt,{className:"w-80 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",sideOffset:5,children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"font-medium border-b border-gray-200 dark:border-gray-700 pb-1",children:"Service Status"}),e.jsx("div",{className:"space-y-1",children:t.map((o,l)=>e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"mr-4 font-medium",children:o.service}),e.jsx("span",{className:`${a(o.status)}`,children:o.status})]},l))}),s&&e.jsx("div",{className:"mt-2 pt-2 border-t border-gray-200 dark:border-gray-700 text-red-600 dark:text-red-400",children:s})]})})]})},Ms=fo,st=ho,rt=xo,Ue=i.forwardRef(({className:t,sideOffset:s=4,...r},a)=>e.jsx(go,{children:e.jsx(br,{ref:a,sideOffset:s,className:v("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...r})}));Ue.displayName=br.displayName;function ed({isReady:t,message:s,className:r}){return e.jsx(Ms,{children:e.jsxs(st,{children:[e.jsx(rt,{asChild:!0,children:e.jsx("div",{className:v("flex items-center gap-2",r),children:e.jsx("div",{className:v("h-2.5 w-2.5 rounded-full",t?"bg-green-500":"bg-red-500")})})}),e.jsx(Ue,{children:e.jsx("p",{className:"text-sm",children:s||(t?"Ready":"Not Ready")})})]})})}const td=t=>{try{const s=cs(t);return Ze(s)?_r(s,{addSuffix:!0}):"Invalid date"}catch(s){return console.warn("Error parsing date:",t,s),"Invalid date"}},sd=({name:t,node:s,onNavigate:r})=>{var a,n;return e.jsxs(X,{className:"hover:bg-muted/50 cursor-pointer",onClick:()=>r(t),children:[e.jsx(F,{className:"font-medium",children:t}),e.jsx(F,{children:s.target}),e.jsx(F,{className:"font-mono text-sm",children:s.build.version}),e.jsx(F,{children:td(s.build.buildDate)}),e.jsx(F,{children:e.jsx(Jc,{services:s.services,error:s.error})}),e.jsx(F,{children:e.jsx(ed,{isReady:(a=s.ready)==null?void 0:a.isReady,message:(n=s.ready)==null?void 0:n.message})}),e.jsx(F,{children:e.jsxs(q,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:o=>{o.stopPropagation(),r(t)},children:[e.jsx(Ft,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"View details"})]})})]},t)},rd=({nodes:t,sortField:s,sortDirection:r,onSort:a})=>{const n=It(),o=(d,u)=>{const m=cs(d),f=cs(u);return!Ze(m)&&!Ze(f)?0:Ze(m)?Ze(f)?m.getTime()-f.getTime():-1:1},l=Object.entries(t).sort(([d,u],[m,f])=>{let y=0;switch(s){case"name":y=d.localeCompare(m);break;case"target":y=u.target.localeCompare(f.target);break;case"version":y=u.build.version.localeCompare(f.build.version);break;case"buildDate":y=o(u.build.buildDate,f.build.buildDate);break}return r==="asc"?y:-y}),c=d=>{n(`/nodes/${d}`)};return e.jsx("div",{className:"rounded-md border bg-card",children:e.jsxs(Ce,{children:[e.jsx(Te,{children:e.jsxs(X,{className:"hover:bg-transparent",children:[e.jsx(D,{className:"w-[300px]",children:e.jsx(Z,{title:"Node Name",field:"name",sortField:s,sortDirection:r,onSort:a})}),e.jsx(D,{className:"w-[200px]",children:e.jsx(Z,{title:"Target",field:"target",sortField:s,sortDirection:r,onSort:a})}),e.jsx(D,{className:"w-[200px]",children:e.jsx(Z,{title:"Version",field:"version",sortField:s,sortDirection:r,onSort:a})}),e.jsx(D,{className:"w-[200px]",children:e.jsx(Z,{title:"Build Date",field:"buildDate",sortField:s,sortDirection:r,onSort:a})}),e.jsx(D,{className:"w-[150px]",children:"Status"}),e.jsx(D,{className:"w-[50px]",children:"Ready"}),e.jsx(D,{className:"w-[100px]",children:"Actions"})]})}),e.jsxs(Re,{children:[l.map(([d,u])=>e.jsx(sd,{name:d,node:u,onNavigate:c},d)),l.length===0&&e.jsx(X,{children:e.jsx(F,{colSpan:7,className:"h-24 text-center",children:e.jsx("div",{className:"text-muted-foreground",children:"No nodes found"})})})]})]})})},ir=t=>`hsl(var(--chart-${t%6+1}))`;function ad({nodes:t}){const s=i.useMemo(()=>{const a=new Map;return Object.values(t).forEach(n=>{const o=n.target||"unknown";a.set(o,(a.get(o)||0)+1)}),Array.from(a.entries()).sort((n,o)=>o[1]-n[1]).map(([n,o],l)=>({name:n,value:o,color:ir(l)}))},[t]),r=i.useMemo(()=>Object.keys(t).length,[t]);return s.length===0?null:e.jsxs("div",{className:"w-full h-[120px] relative",children:[e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center pointer-events-none",children:[e.jsx("div",{className:"text-xl font-bold",children:r}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Nodes"})]}),e.jsx(ct,{width:"100%",height:"100%",children:e.jsxs(Dt,{children:[e.jsx(Ot,{data:s,cx:"50%",cy:"50%",labelLine:!1,outerRadius:60,innerRadius:42,fill:"hsl(var(--chart-1))",dataKey:"value",paddingAngle:1,strokeWidth:1,children:s.map((a,n)=>e.jsx($t,{fill:ir(n),stroke:"hsl(var(--background))"},`cell-${a.name}`))}),e.jsx(dt,{content:({active:a,payload:n})=>{if(!a||!n||!n[0])return null;const o=n[0].payload;return e.jsxs("div",{className:"bg-background border rounded-lg shadow-lg px-3 py-2 flex items-center gap-2",children:[e.jsx("div",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:o.color}}),e.jsx("span",{className:"text-sm font-medium",children:o.name}),e.jsx("span",{className:"text-sm font-semibold",children:o.value})]})}})]})})]})}class Xa extends Be.Component{constructor(s){super(s),this.state={hasError:!1}}static getDerivedStateFromError(s){return{hasError:!0,error:s}}render(){var s;return this.state.hasError?e.jsx("div",{className:"min-h-screen flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-destructive/10 p-6 rounded-lg max-w-2xl w-full",children:[e.jsx("h2",{className:"text-xl font-semibold text-destructive mb-4",children:"Something went wrong"}),e.jsx("div",{className:"bg-background/50 p-4 rounded-md",children:e.jsx("pre",{className:"text-sm overflow-auto",children:(s=this.state.error)==null?void 0:s.message})}),e.jsx("button",{className:"mt-4 px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90",onClick:()=>window.location.reload(),children:"Reload Page"})]})}):this.props.children}}const nd=()=>{const{cluster:t,error:s,refresh:r,isLoading:a}=ue(),[n,o]=i.useState(""),[l,c]=i.useState([]),[d,u]=i.useState(["New","Starting","Running","Stopping","Terminated","Failed"]),[m,f]=i.useState("name"),[y,N]=i.useState("asc"),h=x=>{x===m?N(y==="asc"?"desc":"asc"):(f(x),N("asc"))},p=()=>t?Object.entries(t.members).reduce((x,[b,j])=>{const w=b.toLowerCase().includes(n.toLowerCase()),E=!l||l.length===0||l.includes(j.target),C=d.length===0||j.services&&Array.isArray(j.services)&&j.services.some(A=>(A==null?void 0:A.status)&&d.includes(A.status));return w&&E&&C&&(x[b]=j),x},{}):{},g=()=>{if(!t)return[];const x=new Set;return Object.values(t.members).forEach(b=>{b.target&&x.add(b.target)}),Array.from(x).sort()};return e.jsx(ke,{children:e.jsxs(ee,{className:"shadow-sm",children:[e.jsx(se,{children:e.jsxs("div",{className:"grid grid-cols-[1fr_auto] gap-8",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-3xl font-semibold tracking-tight",children:"Nodes"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"View and manage Loki nodes in your cluster with their current status and configuration"})]}),e.jsx(Qc,{nameFilter:n,targetFilter:l,selectedStates:d,onNameFilterChange:o,onTargetFilterChange:c,onStatesChange:u,onRefresh:r,availableTargets:g(),isLoading:a})]}),e.jsx("div",{className:"flex items-center",children:e.jsx("div",{className:"w-[250px]",children:e.jsx(ad,{nodes:p()})})})]})}),e.jsx(te,{children:e.jsxs("div",{className:"space-y-4",children:[s&&e.jsxs(Ge,{variant:"destructive",children:[e.jsx(nt,{className:"h-4 w-4"}),e.jsx(He,{children:"Error"}),e.jsx(Ke,{children:s})]}),a&&e.jsxs("div",{className:"flex items-center justify-center py-4",children:[e.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-primary border-t-transparent"}),e.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading..."})]}),!a&&!s&&e.jsx(rd,{nodes:p(),sortField:m,sortDirection:y,onSort:h})]})})]})})};function lr(){return e.jsx(Xa,{children:e.jsx(nd,{})})}const od=xi,Qa=i.forwardRef(({className:t,...s},r)=>e.jsx(ta,{ref:r,className:v("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...s}));Qa.displayName=ta.displayName;const yt=i.forwardRef(({className:t,...s},r)=>e.jsx(sa,{ref:r,className:v("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",t),...s}));yt.displayName=sa.displayName;const vt=i.forwardRef(({className:t,...s},r)=>e.jsx(ra,{ref:r,className:v("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...s}));vt.displayName=ra.displayName;var id=Object.create,Gt=Object.defineProperty,ld=Object.defineProperties,cd=Object.getOwnPropertyDescriptor,dd=Object.getOwnPropertyDescriptors,Ja=Object.getOwnPropertyNames,At=Object.getOwnPropertySymbols,ud=Object.getPrototypeOf,Bs=Object.prototype.hasOwnProperty,en=Object.prototype.propertyIsEnumerable,cr=(t,s,r)=>s in t?Gt(t,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[s]=r,ge=(t,s)=>{for(var r in s||(s={}))Bs.call(s,r)&&cr(t,r,s[r]);if(At)for(var r of At(s))en.call(s,r)&&cr(t,r,s[r]);return t},Ht=(t,s)=>ld(t,dd(s)),tn=(t,s)=>{var r={};for(var a in t)Bs.call(t,a)&&s.indexOf(a)<0&&(r[a]=t[a]);if(t!=null&&At)for(var a of At(t))s.indexOf(a)<0&&en.call(t,a)&&(r[a]=t[a]);return r},pd=(t,s)=>function(){return s||(0,t[Ja(t)[0]])((s={exports:{}}).exports,s),s.exports},md=(t,s)=>{for(var r in s)Gt(t,r,{get:s[r],enumerable:!0})},gd=(t,s,r,a)=>{if(s&&typeof s=="object"||typeof s=="function")for(let n of Ja(s))!Bs.call(t,n)&&n!==r&&Gt(t,n,{get:()=>s[n],enumerable:!(a=cd(s,n))||a.enumerable});return t},fd=(t,s,r)=>(r=t!=null?id(ud(t)):{},gd(!t||!t.__esModule?Gt(r,"default",{value:t,enumerable:!0}):r,t)),hd=pd({"../../node_modules/.pnpm/prismjs@1.29.0_patch_hash=vrxx3pzkik6jpmgpayxfjunetu/node_modules/prismjs/prism.js"(t,s){var r=function(){var a=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,n=0,o={},l={util:{encode:function h(p){return p instanceof c?new c(p.type,h(p.content),p.alias):Array.isArray(p)?p.map(h):p.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(h){return Object.prototype.toString.call(h).slice(8,-1)},objId:function(h){return h.__id||Object.defineProperty(h,"__id",{value:++n}),h.__id},clone:function h(p,g){g=g||{};var x,b;switch(l.util.type(p)){case"Object":if(b=l.util.objId(p),g[b])return g[b];x={},g[b]=x;for(var j in p)p.hasOwnProperty(j)&&(x[j]=h(p[j],g));return x;case"Array":return b=l.util.objId(p),g[b]?g[b]:(x=[],g[b]=x,p.forEach(function(w,E){x[E]=h(w,g)}),x);default:return p}},getLanguage:function(h){for(;h;){var p=a.exec(h.className);if(p)return p[1].toLowerCase();h=h.parentElement}return"none"},setLanguage:function(h,p){h.className=h.className.replace(RegExp(a,"gi"),""),h.classList.add("language-"+p)},isActive:function(h,p,g){for(var x="no-"+p;h;){var b=h.classList;if(b.contains(p))return!0;if(b.contains(x))return!1;h=h.parentElement}return!!g}},languages:{plain:o,plaintext:o,text:o,txt:o,extend:function(h,p){var g=l.util.clone(l.languages[h]);for(var x in p)g[x]=p[x];return g},insertBefore:function(h,p,g,x){x=x||l.languages;var b=x[h],j={};for(var w in b)if(b.hasOwnProperty(w)){if(w==p)for(var E in g)g.hasOwnProperty(E)&&(j[E]=g[E]);g.hasOwnProperty(w)||(j[w]=b[w])}var C=x[h];return x[h]=j,l.languages.DFS(l.languages,function(A,B){B===C&&A!=h&&(this[A]=j)}),j},DFS:function h(p,g,x,b){b=b||{};var j=l.util.objId;for(var w in p)if(p.hasOwnProperty(w)){g.call(p,w,p[w],x||w);var E=p[w],C=l.util.type(E);C==="Object"&&!b[j(E)]?(b[j(E)]=!0,h(E,g,null,b)):C==="Array"&&!b[j(E)]&&(b[j(E)]=!0,h(E,g,w,b))}}},plugins:{},highlight:function(h,p,g){var x={code:h,grammar:p,language:g};if(l.hooks.run("before-tokenize",x),!x.grammar)throw new Error('The language "'+x.language+'" has no grammar.');return x.tokens=l.tokenize(x.code,x.grammar),l.hooks.run("after-tokenize",x),c.stringify(l.util.encode(x.tokens),x.language)},tokenize:function(h,p){var g=p.rest;if(g){for(var x in g)p[x]=g[x];delete p.rest}var b=new m;return f(b,b.head,h),u(h,b,p,b.head,0),N(b)},hooks:{all:{},add:function(h,p){var g=l.hooks.all;g[h]=g[h]||[],g[h].push(p)},run:function(h,p){var g=l.hooks.all[h];if(!(!g||!g.length))for(var x=0,b;b=g[x++];)b(p)}},Token:c};function c(h,p,g,x){this.type=h,this.content=p,this.alias=g,this.length=(x||"").length|0}c.stringify=function h(p,g){if(typeof p=="string")return p;if(Array.isArray(p)){var x="";return p.forEach(function(C){x+=h(C,g)}),x}var b={type:p.type,content:h(p.content,g),tag:"span",classes:["token",p.type],attributes:{},language:g},j=p.alias;j&&(Array.isArray(j)?Array.prototype.push.apply(b.classes,j):b.classes.push(j)),l.hooks.run("wrap",b);var w="";for(var E in b.attributes)w+=" "+E+'="'+(b.attributes[E]||"").replace(/"/g,"&quot;")+'"';return"<"+b.tag+' class="'+b.classes.join(" ")+'"'+w+">"+b.content+"</"+b.tag+">"};function d(h,p,g,x){h.lastIndex=p;var b=h.exec(g);if(b&&x&&b[1]){var j=b[1].length;b.index+=j,b[0]=b[0].slice(j)}return b}function u(h,p,g,x,b,j){for(var w in g)if(!(!g.hasOwnProperty(w)||!g[w])){var E=g[w];E=Array.isArray(E)?E:[E];for(var C=0;C<E.length;++C){if(j&&j.cause==w+","+C)return;var A=E[C],B=A.inside,z=!!A.lookbehind,Y=!!A.greedy,K=A.alias;if(Y&&!A.pattern.global){var M=A.pattern.toString().match(/[imsuy]*$/)[0];A.pattern=RegExp(A.pattern.source,M+"g")}for(var W=A.pattern||A,T=x.next,O=b;T!==p.tail&&!(j&&O>=j.reach);O+=T.value.length,T=T.next){var V=T.value;if(p.length>h.length)return;if(!(V instanceof c)){var Q=1,_;if(Y){if(_=d(W,O,h,z),!_||_.index>=h.length)break;var S=_.index,I=_.index+_[0].length,P=O;for(P+=T.value.length;S>=P;)T=T.next,P+=T.value.length;if(P-=T.value.length,O=P,T.value instanceof c)continue;for(var U=T;U!==p.tail&&(P<I||typeof U.value=="string");U=U.next)Q++,P+=U.value.length;Q--,V=h.slice(O,P),_.index-=O}else if(_=d(W,0,V,z),!_)continue;var S=_.index,R=_[0],$=V.slice(0,S),L=V.slice(S+R.length),G=O+V.length;j&&G>j.reach&&(j.reach=G);var H=T.prev;$&&(H=f(p,H,$),O+=$.length),y(p,H,Q);var ne=new c(w,B?l.tokenize(R,B):R,K,R);if(T=f(p,H,ne),L&&f(p,T,L),Q>1){var de={cause:w+","+C,reach:G};u(h,p,g,T.prev,O,de),j&&de.reach>j.reach&&(j.reach=de.reach)}}}}}}function m(){var h={value:null,prev:null,next:null},p={value:null,prev:h,next:null};h.next=p,this.head=h,this.tail=p,this.length=0}function f(h,p,g){var x=p.next,b={value:g,prev:p,next:x};return p.next=b,x.prev=b,h.length++,b}function y(h,p,g){for(var x=p.next,b=0;b<g&&x!==h.tail;b++)x=x.next;p.next=x,x.prev=p,h.length-=b}function N(h){for(var p=[],g=h.head.next;g!==h.tail;)p.push(g.value),g=g.next;return p}return l}();s.exports=r,r.default=r}}),k=fd(hd());k.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},k.languages.markup.tag.inside["attr-value"].inside.entity=k.languages.markup.entity,k.languages.markup.doctype.inside["internal-subset"].inside=k.languages.markup,k.hooks.add("wrap",function(t){t.type==="entity"&&(t.attributes.title=t.content.replace(/&amp;/,"&"))}),Object.defineProperty(k.languages.markup.tag,"addInlined",{value:function(t,a){var r={},r=(r["language-"+a]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:k.languages[a]},r.cdata=/^<!\[CDATA\[|\]\]>$/i,{"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:r}}),a=(r["language-"+a]={pattern:/[\s\S]+/,inside:k.languages[a]},{});a[t]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return t}),"i"),lookbehind:!0,greedy:!0,inside:r},k.languages.insertBefore("markup","cdata",a)}}),Object.defineProperty(k.languages.markup.tag,"addAttribute",{value:function(t,s){k.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+t+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[s,"language-"+s],inside:k.languages[s]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),k.languages.html=k.languages.markup,k.languages.mathml=k.languages.markup,k.languages.svg=k.languages.markup,k.languages.xml=k.languages.extend("markup",{}),k.languages.ssml=k.languages.xml,k.languages.atom=k.languages.xml,k.languages.rss=k.languages.xml,function(t){var s={pattern:/\\[\\(){}[\]^$+*?|.]/,alias:"escape"},r=/\\(?:x[\da-fA-F]{2}|u[\da-fA-F]{4}|u\{[\da-fA-F]+\}|0[0-7]{0,2}|[123][0-7]{2}|c[a-zA-Z]|.)/,a="(?:[^\\\\-]|"+r.source+")",a=RegExp(a+"-"+a),n={pattern:/(<|')[^<>']+(?=[>']$)/,lookbehind:!0,alias:"variable"};t.languages.regex={"char-class":{pattern:/((?:^|[^\\])(?:\\\\)*)\[(?:[^\\\]]|\\[\s\S])*\]/,lookbehind:!0,inside:{"char-class-negation":{pattern:/(^\[)\^/,lookbehind:!0,alias:"operator"},"char-class-punctuation":{pattern:/^\[|\]$/,alias:"punctuation"},range:{pattern:a,inside:{escape:r,"range-punctuation":{pattern:/-/,alias:"operator"}}},"special-escape":s,"char-set":{pattern:/\\[wsd]|\\p\{[^{}]+\}/i,alias:"class-name"},escape:r}},"special-escape":s,"char-set":{pattern:/\.|\\[wsd]|\\p\{[^{}]+\}/i,alias:"class-name"},backreference:[{pattern:/\\(?![123][0-7]{2})[1-9]/,alias:"keyword"},{pattern:/\\k<[^<>']+>/,alias:"keyword",inside:{"group-name":n}}],anchor:{pattern:/[$^]|\\[ABbGZz]/,alias:"function"},escape:r,group:[{pattern:/\((?:\?(?:<[^<>']+>|'[^<>']+'|[>:]|<?[=!]|[idmnsuxU]+(?:-[idmnsuxU]+)?:?))?/,alias:"punctuation",inside:{"group-name":n}},{pattern:/\)/,alias:"punctuation"}],quantifier:{pattern:/(?:[+*?]|\{\d+(?:,\d*)?\})[?+]?/,alias:"number"},alternation:{pattern:/\|/,alias:"keyword"}}}(k),k.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},k.languages.javascript=k.languages.extend("clike",{"class-name":[k.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),k.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,k.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:k.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:k.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:k.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:k.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:k.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),k.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:k.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),k.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),k.languages.markup&&(k.languages.markup.tag.addInlined("script","javascript"),k.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),k.languages.js=k.languages.javascript,k.languages.actionscript=k.languages.extend("javascript",{keyword:/\b(?:as|break|case|catch|class|const|default|delete|do|dynamic|each|else|extends|final|finally|for|function|get|if|implements|import|in|include|instanceof|interface|internal|is|namespace|native|new|null|override|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|use|var|void|while|with)\b/,operator:/\+\+|--|(?:[+\-*\/%^]|&&?|\|\|?|<<?|>>?>?|[!=]=?)=?|[~?@]/}),k.languages.actionscript["class-name"].alias="function",delete k.languages.actionscript.parameter,delete k.languages.actionscript["literal-property"],k.languages.markup&&k.languages.insertBefore("actionscript","string",{xml:{pattern:/(^|[^.])<\/?\w+(?:\s+[^\s>\/=]+=("|')(?:\\[\s\S]|(?!\2)[^\\])*\2)*\s*\/?>/,lookbehind:!0,inside:k.languages.markup}}),function(t){var s=/#(?!\{).+/,r={pattern:/#\{[^}]+\}/,alias:"variable"};t.languages.coffeescript=t.languages.extend("javascript",{comment:s,string:[{pattern:/'(?:\\[\s\S]|[^\\'])*'/,greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,greedy:!0,inside:{interpolation:r}}],keyword:/\b(?:and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/,"class-member":{pattern:/@(?!\d)\w+/,alias:"variable"}}),t.languages.insertBefore("coffeescript","comment",{"multiline-comment":{pattern:/###[\s\S]+?###/,alias:"comment"},"block-regex":{pattern:/\/{3}[\s\S]*?\/{3}/,alias:"regex",inside:{comment:s,interpolation:r}}}),t.languages.insertBefore("coffeescript","string",{"inline-javascript":{pattern:/`(?:\\[\s\S]|[^\\`])*`/,inside:{delimiter:{pattern:/^`|`$/,alias:"punctuation"},script:{pattern:/[\s\S]+/,alias:"language-javascript",inside:t.languages.javascript}}},"multiline-string":[{pattern:/'''[\s\S]*?'''/,greedy:!0,alias:"string"},{pattern:/"""[\s\S]*?"""/,greedy:!0,alias:"string",inside:{interpolation:r}}]}),t.languages.insertBefore("coffeescript","keyword",{property:/(?!\d)\w+(?=\s*:(?!:))/}),delete t.languages.coffeescript["template-string"],t.languages.coffee=t.languages.coffeescript}(k),function(t){var s=t.languages.javadoclike={parameter:{pattern:/(^[\t ]*(?:\/{3}|\*|\/\*\*)\s*@(?:arg|arguments|param)\s+)\w+/m,lookbehind:!0},keyword:{pattern:/(^[\t ]*(?:\/{3}|\*|\/\*\*)\s*|\{)@[a-z][a-zA-Z-]+\b/m,lookbehind:!0},punctuation:/[{}]/};Object.defineProperty(s,"addSupport",{value:function(r,a){(r=typeof r=="string"?[r]:r).forEach(function(n){var o=function(f){f.inside||(f.inside={}),f.inside.rest=a},l="doc-comment";if(c=t.languages[n]){var c,d=c[l];if((d=d||(c=t.languages.insertBefore(n,"comment",{"doc-comment":{pattern:/(^|[^\\])\/\*\*[^/][\s\S]*?(?:\*\/|$)/,lookbehind:!0,alias:"comment"}}))[l])instanceof RegExp&&(d=c[l]={pattern:d}),Array.isArray(d))for(var u=0,m=d.length;u<m;u++)d[u]instanceof RegExp&&(d[u]={pattern:d[u]}),o(d[u]);else o(d)}})}}),s.addSupport(["java","javascript","php"],s)}(k),function(t){var s=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/,s=(t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+s.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+s.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+s.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+s.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:s,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css,t.languages.markup);s&&(s.tag.addInlined("style","css"),s.tag.addAttribute("style","css"))}(k),function(t){var s=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,s=(t.languages.css.selector={pattern:t.languages.css.selector.pattern,lookbehind:!0,inside:s={"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,"pseudo-class":/:[-\w]+/,class:/\.[-\w]+/,id:/#[-\w]+/,attribute:{pattern:RegExp(`\\[(?:[^[\\]"']|`+s.source+")*\\]"),greedy:!0,inside:{punctuation:/^\[|\]$/,"case-sensitivity":{pattern:/(\s)[si]$/i,lookbehind:!0,alias:"keyword"},namespace:{pattern:/^(\s*)(?:(?!\s)[-*\w\xA0-\uFFFF])*\|(?!=)/,lookbehind:!0,inside:{punctuation:/\|$/}},"attr-name":{pattern:/^(\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+/,lookbehind:!0},"attr-value":[s,{pattern:/(=\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+(?=\s*$)/,lookbehind:!0}],operator:/[|~*^$]?=/}},"n-th":[{pattern:/(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,lookbehind:!0,inside:{number:/[\dn]+/,operator:/[+-]/}},{pattern:/(\(\s*)(?:even|odd)(?=\s*\))/i,lookbehind:!0}],combinator:/>|\+|~|\|\|/,punctuation:/[(),]/}},t.languages.css.atrule.inside["selector-function-argument"].inside=s,t.languages.insertBefore("css","property",{variable:{pattern:/(^|[^-\w\xA0-\uFFFF])--(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*/i,lookbehind:!0}}),{pattern:/(\b\d+)(?:%|[a-z]+(?![\w-]))/,lookbehind:!0}),r={pattern:/(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,lookbehind:!0};t.languages.insertBefore("css","function",{operator:{pattern:/(\s)[+\-*\/](?=\s)/,lookbehind:!0},hexcode:{pattern:/\B#[\da-f]{3,8}\b/i,alias:"color"},color:[{pattern:/(^|[^\w-])(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|RebeccaPurple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)(?![\w-])/i,lookbehind:!0},{pattern:/\b(?:hsl|rgb)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:hsl|rgb)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:s,number:r,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:s,number:r})}(k),function(t){var s=/[*&][^\s[\]{},]+/,r=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,a="(?:"+r.source+"(?:[ ]+"+s.source+")?|"+s.source+"(?:[ ]+"+r.source+")?)",n=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),o=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function l(c,d){d=(d||"").replace(/m/g,"")+"m";var u=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,function(){return a}).replace(/<<value>>/g,function(){return c});return RegExp(u,d)}t.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,function(){return a})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,function(){return a}).replace(/<<key>>/g,function(){return"(?:"+n+"|"+o+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:l(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:l(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:l(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:l(o),lookbehind:!0,greedy:!0},number:{pattern:l(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:r,important:s,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},t.languages.yml=t.languages.yaml}(k),function(t){var s=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function r(u){return u=u.replace(/<inner>/g,function(){return s}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+u+")")}var a=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,n=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return a}),o=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source,l=(t.languages.markdown=t.languages.extend("markup",{}),t.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:t.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+n+o+"(?:"+n+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+n+o+")(?:"+n+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(a),inside:t.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+n+")"+o+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+n+"$"),inside:{"table-header":{pattern:RegExp(a),alias:"important",inside:t.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:r(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:r(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:r(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:r(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(u){["url","bold","italic","strike","code-snippet"].forEach(function(m){u!==m&&(t.languages.markdown[u].inside.content.inside[m]=t.languages.markdown[m])})}),t.hooks.add("after-tokenize",function(u){u.language!=="markdown"&&u.language!=="md"||function m(f){if(f&&typeof f!="string")for(var y=0,N=f.length;y<N;y++){var h,p=f[y];p.type!=="code"?m(p.content):(h=p.content[1],p=p.content[3],h&&p&&h.type==="code-language"&&p.type==="code-block"&&typeof h.content=="string"&&(h=h.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp"),h="language-"+(h=(/[a-z][\w-]*/i.exec(h)||[""])[0].toLowerCase()),p.alias?typeof p.alias=="string"?p.alias=[p.alias,h]:p.alias.push(h):p.alias=[h]))}}(u.tokens)}),t.hooks.add("wrap",function(u){if(u.type==="code-block"){for(var m="",f=0,y=u.classes.length;f<y;f++){var N=u.classes[f],N=/language-(.+)/.exec(N);if(N){m=N[1];break}}var h,p=t.languages[m];p?u.content=t.highlight(function(g){return g=g.replace(l,""),g=g.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(x,b){var j;return(b=b.toLowerCase())[0]==="#"?(j=b[1]==="x"?parseInt(b.slice(2),16):Number(b.slice(1)),d(j)):c[b]||x})}(u.content),p,m):m&&m!=="none"&&t.plugins.autoloader&&(h="md-"+new Date().valueOf()+"-"+Math.floor(1e16*Math.random()),u.attributes.id=h,t.plugins.autoloader.loadLanguages(m,function(){var g=document.getElementById(h);g&&(g.innerHTML=t.highlight(g.textContent,t.languages[m],m))}))}}),RegExp(t.languages.markup.tag.pattern.source,"gi")),c={amp:"&",lt:"<",gt:">",quot:'"'},d=String.fromCodePoint||String.fromCharCode;t.languages.md=t.languages.markdown}(k),k.languages.graphql={comment:/#.*/,description:{pattern:/(?:"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*")(?=\s*[a-z_])/i,greedy:!0,alias:"string",inside:{"language-markdown":{pattern:/(^"(?:"")?)(?!\1)[\s\S]+(?=\1$)/,lookbehind:!0,inside:k.languages.markdown}}},string:{pattern:/"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},number:/(?:\B-|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,boolean:/\b(?:false|true)\b/,variable:/\$[a-z_]\w*/i,directive:{pattern:/@[a-z_]\w*/i,alias:"function"},"attr-name":{pattern:/\b[a-z_]\w*(?=\s*(?:\((?:[^()"]|"(?:\\.|[^\\"\r\n])*")*\))?:)/i,greedy:!0},"atom-input":{pattern:/\b[A-Z]\w*Input\b/,alias:"class-name"},scalar:/\b(?:Boolean|Float|ID|Int|String)\b/,constant:/\b[A-Z][A-Z_\d]*\b/,"class-name":{pattern:/(\b(?:enum|implements|interface|on|scalar|type|union)\s+|&\s*|:\s*|\[)[A-Z_]\w*/,lookbehind:!0},fragment:{pattern:/(\bfragment\s+|\.{3}\s*(?!on\b))[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-mutation":{pattern:/(\bmutation\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-query":{pattern:/(\bquery\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},keyword:/\b(?:directive|enum|extend|fragment|implements|input|interface|mutation|on|query|repeatable|scalar|schema|subscription|type|union)\b/,operator:/[!=|&]|\.{3}/,"property-query":/\w+(?=\s*\()/,object:/\w+(?=\s*\{)/,punctuation:/[!(){}\[\]:=,]/,property:/\w+/},k.hooks.add("after-tokenize",function(t){if(t.language==="graphql")for(var s=t.tokens.filter(function(h){return typeof h!="string"&&h.type!=="comment"&&h.type!=="scalar"}),r=0;r<s.length;){var a=s[r++];if(a.type==="keyword"&&a.content==="mutation"){var n=[];if(f(["definition-mutation","punctuation"])&&m(1).content==="("){r+=2;var o=y(/^\($/,/^\)$/);if(o===-1)continue;for(;r<o;r++){var l=m(0);l.type==="variable"&&(N(l,"variable-input"),n.push(l.content))}r=o+1}if(f(["punctuation","property-query"])&&m(0).content==="{"&&(r++,N(m(0),"property-mutation"),0<n.length)){var c=y(/^\{$/,/^\}$/);if(c!==-1)for(var d=r;d<c;d++){var u=s[d];u.type==="variable"&&0<=n.indexOf(u.content)&&N(u,"variable-input")}}}}function m(h){return s[r+h]}function f(h,p){p=p||0;for(var g=0;g<h.length;g++){var x=m(g+p);if(!x||x.type!==h[g])return}return 1}function y(h,p){for(var g=1,x=r;x<s.length;x++){var b=s[x],j=b.content;if(b.type==="punctuation"&&typeof j=="string"){if(h.test(j))g++;else if(p.test(j)&&--g===0)return x}}return-1}function N(h,p){var g=h.alias;g?Array.isArray(g)||(h.alias=g=[g]):h.alias=g=[],g.push(p)}}),k.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/},function(t){var s=t.languages.javascript["template-string"],r=s.pattern.source,a=s.inside.interpolation,n=a.inside["interpolation-punctuation"],o=a.pattern.source;function l(f,y){if(t.languages[f])return{pattern:RegExp("((?:"+y+")\\s*)"+r),lookbehind:!0,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},"embedded-code":{pattern:/[\s\S]+/,alias:f}}}}function c(f,y,N){return f={code:f,grammar:y,language:N},t.hooks.run("before-tokenize",f),f.tokens=t.tokenize(f.code,f.grammar),t.hooks.run("after-tokenize",f),f.tokens}function d(f,y,N){var g=t.tokenize(f,{interpolation:{pattern:RegExp(o),lookbehind:!0}}),h=0,p={},g=c(g.map(function(b){if(typeof b=="string")return b;for(var j,w,b=b.content;f.indexOf((w=h++,j="___"+N.toUpperCase()+"_"+w+"___"))!==-1;);return p[j]=b,j}).join(""),y,N),x=Object.keys(p);return h=0,function b(j){for(var w=0;w<j.length;w++){if(h>=x.length)return;var E,C,A,B,z,Y,K,M=j[w];typeof M=="string"||typeof M.content=="string"?(E=x[h],(K=(Y=typeof M=="string"?M:M.content).indexOf(E))!==-1&&(++h,C=Y.substring(0,K),z=p[E],A=void 0,(B={})["interpolation-punctuation"]=n,(B=t.tokenize(z,B)).length===3&&((A=[1,1]).push.apply(A,c(B[1],t.languages.javascript,"javascript")),B.splice.apply(B,A)),A=new t.Token("interpolation",B,a.alias,z),B=Y.substring(K+E.length),z=[],C&&z.push(C),z.push(A),B&&(b(Y=[B]),z.push.apply(z,Y)),typeof M=="string"?(j.splice.apply(j,[w,1].concat(z)),w+=z.length-1):M.content=z)):(K=M.content,Array.isArray(K)?b(K):b([K]))}}(g),new t.Token(N,g,"language-"+N,f)}t.languages.javascript["template-string"]=[l("css",/\b(?:styled(?:\([^)]*\))?(?:\s*\.\s*\w+(?:\([^)]*\))*)*|css(?:\s*\.\s*(?:global|resolve))?|createGlobalStyle|keyframes)/.source),l("html",/\bhtml|\.\s*(?:inner|outer)HTML\s*\+?=/.source),l("svg",/\bsvg/.source),l("markdown",/\b(?:markdown|md)/.source),l("graphql",/\b(?:gql|graphql(?:\s*\.\s*experimental)?)/.source),l("sql",/\bsql/.source),s].filter(Boolean);var u={javascript:!0,js:!0,typescript:!0,ts:!0,jsx:!0,tsx:!0};function m(f){return typeof f=="string"?f:Array.isArray(f)?f.map(m).join(""):m(f.content)}t.hooks.add("after-tokenize",function(f){f.language in u&&function y(N){for(var h=0,p=N.length;h<p;h++){var g,x,b,j=N[h];typeof j!="string"&&(g=j.content,Array.isArray(g)?j.type==="template-string"?(j=g[1],g.length===3&&typeof j!="string"&&j.type==="embedded-code"&&(x=m(j),j=j.alias,j=Array.isArray(j)?j[0]:j,b=t.languages[j])&&(g[1]=d(x,b,j))):y(g):typeof g!="string"&&y([g]))}}(f.tokens)})}(k),function(t){t.languages.typescript=t.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),t.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete t.languages.typescript.parameter,delete t.languages.typescript["literal-property"];var s=t.languages.extend("typescript",{});delete s["class-name"],t.languages.typescript["class-name"].inside=s,t.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:s}}}}),t.languages.ts=t.languages.typescript}(k),function(t){var s=t.languages.javascript,r=/\{(?:[^{}]|\{(?:[^{}]|\{[^{}]*\})*\})+\}/.source,a="(@(?:arg|argument|param|property)\\s+(?:"+r+"\\s+)?)";t.languages.jsdoc=t.languages.extend("javadoclike",{parameter:{pattern:RegExp(a+/(?:(?!\s)[$\w\xA0-\uFFFF.])+(?=\s|$)/.source),lookbehind:!0,inside:{punctuation:/\./}}}),t.languages.insertBefore("jsdoc","keyword",{"optional-parameter":{pattern:RegExp(a+/\[(?:(?!\s)[$\w\xA0-\uFFFF.])+(?:=[^[\]]+)?\](?=\s|$)/.source),lookbehind:!0,inside:{parameter:{pattern:/(^\[)[$\w\xA0-\uFFFF\.]+/,lookbehind:!0,inside:{punctuation:/\./}},code:{pattern:/(=)[\s\S]*(?=\]$)/,lookbehind:!0,inside:s,alias:"language-javascript"},punctuation:/[=[\]]/}},"class-name":[{pattern:RegExp(/(@(?:augments|class|extends|interface|memberof!?|template|this|typedef)\s+(?:<TYPE>\s+)?)[A-Z]\w*(?:\.[A-Z]\w*)*/.source.replace(/<TYPE>/g,function(){return r})),lookbehind:!0,inside:{punctuation:/\./}},{pattern:RegExp("(@[a-z]+\\s+)"+r),lookbehind:!0,inside:{string:s.string,number:s.number,boolean:s.boolean,keyword:t.languages.typescript.keyword,operator:/=>|\.\.\.|[&|?:*]/,punctuation:/[.,;=<>{}()[\]]/}}],example:{pattern:/(@example\s+(?!\s))(?:[^@\s]|\s+(?!\s))+?(?=\s*(?:\*\s*)?(?:@\w|\*\/))/,lookbehind:!0,inside:{code:{pattern:/^([\t ]*(?:\*\s*)?)\S.*$/m,lookbehind:!0,inside:s,alias:"language-javascript"}}}}),t.languages.javadoclike.addSupport("javascript",t.languages.jsdoc)}(k),function(t){t.languages.flow=t.languages.extend("javascript",{}),t.languages.insertBefore("flow","keyword",{type:[{pattern:/\b(?:[Bb]oolean|Function|[Nn]umber|[Ss]tring|[Ss]ymbol|any|mixed|null|void)\b/,alias:"class-name"}]}),t.languages.flow["function-variable"].pattern=/(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=\s*(?:function\b|(?:\([^()]*\)(?:\s*:\s*\w+)?|(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/i,delete t.languages.flow.parameter,t.languages.insertBefore("flow","operator",{"flow-punctuation":{pattern:/\{\||\|\}/,alias:"punctuation"}}),Array.isArray(t.languages.flow.keyword)||(t.languages.flow.keyword=[t.languages.flow.keyword]),t.languages.flow.keyword.unshift({pattern:/(^|[^$]\b)(?:Class|declare|opaque|type)\b(?!\$)/,lookbehind:!0},{pattern:/(^|[^$]\B)\$(?:Diff|Enum|Exact|Keys|ObjMap|PropertyType|Record|Shape|Subtype|Supertype|await)\b(?!\$)/,lookbehind:!0})}(k),k.languages.n4js=k.languages.extend("javascript",{keyword:/\b(?:Array|any|boolean|break|case|catch|class|const|constructor|continue|debugger|declare|default|delete|do|else|enum|export|extends|false|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|module|new|null|number|package|private|protected|public|return|set|static|string|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/}),k.languages.insertBefore("n4js","constant",{annotation:{pattern:/@+\w+/,alias:"operator"}}),k.languages.n4jsd=k.languages.n4js,function(t){function s(l,c){return RegExp(l.replace(/<ID>/g,function(){return/(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/.source}),c)}t.languages.insertBefore("javascript","function-variable",{"method-variable":{pattern:RegExp("(\\.\\s*)"+t.languages.javascript["function-variable"].pattern.source),lookbehind:!0,alias:["function-variable","method","function","property-access"]}}),t.languages.insertBefore("javascript","function",{method:{pattern:RegExp("(\\.\\s*)"+t.languages.javascript.function.source),lookbehind:!0,alias:["function","property-access"]}}),t.languages.insertBefore("javascript","constant",{"known-class-name":[{pattern:/\b(?:(?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)?Array|ArrayBuffer|BigInt|Boolean|DataView|Date|Error|Function|Intl|JSON|(?:Weak)?(?:Map|Set)|Math|Number|Object|Promise|Proxy|Reflect|RegExp|String|Symbol|WebAssembly)\b/,alias:"class-name"},{pattern:/\b(?:[A-Z]\w*)Error\b/,alias:"class-name"}]}),t.languages.insertBefore("javascript","keyword",{imports:{pattern:s(/(\bimport\b\s*)(?:<ID>(?:\s*,\s*(?:\*\s*as\s+<ID>|\{[^{}]*\}))?|\*\s*as\s+<ID>|\{[^{}]*\})(?=\s*\bfrom\b)/.source),lookbehind:!0,inside:t.languages.javascript},exports:{pattern:s(/(\bexport\b\s*)(?:\*(?:\s*as\s+<ID>)?(?=\s*\bfrom\b)|\{[^{}]*\})/.source),lookbehind:!0,inside:t.languages.javascript}}),t.languages.javascript.keyword.unshift({pattern:/\b(?:as|default|export|from|import)\b/,alias:"module"},{pattern:/\b(?:await|break|catch|continue|do|else|finally|for|if|return|switch|throw|try|while|yield)\b/,alias:"control-flow"},{pattern:/\bnull\b/,alias:["null","nil"]},{pattern:/\bundefined\b/,alias:"nil"}),t.languages.insertBefore("javascript","operator",{spread:{pattern:/\.{3}/,alias:"operator"},arrow:{pattern:/=>/,alias:"operator"}}),t.languages.insertBefore("javascript","punctuation",{"property-access":{pattern:s(/(\.\s*)#?<ID>/.source),lookbehind:!0},"maybe-class-name":{pattern:/(^|[^$\w\xA0-\uFFFF])[A-Z][$\w\xA0-\uFFFF]+/,lookbehind:!0},dom:{pattern:/\b(?:document|(?:local|session)Storage|location|navigator|performance|window)\b/,alias:"variable"},console:{pattern:/\bconsole(?=\s*\.)/,alias:"class-name"}});for(var r=["function","function-variable","method","method-variable","property-access"],a=0;a<r.length;a++){var o=r[a],n=t.languages.javascript[o],o=(n=t.util.type(n)==="RegExp"?t.languages.javascript[o]={pattern:n}:n).inside||{};(n.inside=o)["maybe-class-name"]=/^[A-Z][\s\S]*/}}(k),function(t){var s=t.util.clone(t.languages.javascript),r=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,a=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,n=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function o(d,u){return d=d.replace(/<S>/g,function(){return r}).replace(/<BRACES>/g,function(){return a}).replace(/<SPREAD>/g,function(){return n}),RegExp(d,u)}n=o(n).source,t.languages.jsx=t.languages.extend("markup",s),t.languages.jsx.tag.pattern=o(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),t.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,t.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,t.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,t.languages.jsx.tag.inside.comment=s.comment,t.languages.insertBefore("inside","attr-name",{spread:{pattern:o(/<SPREAD>/.source),inside:t.languages.jsx}},t.languages.jsx.tag),t.languages.insertBefore("inside","special-attr",{script:{pattern:o(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:t.languages.jsx}}},t.languages.jsx.tag);function l(d){for(var u=[],m=0;m<d.length;m++){var f=d[m],y=!1;typeof f!="string"&&(f.type==="tag"&&f.content[0]&&f.content[0].type==="tag"?f.content[0].content[0].content==="</"?0<u.length&&u[u.length-1].tagName===c(f.content[0].content[1])&&u.pop():f.content[f.content.length-1].content!=="/>"&&u.push({tagName:c(f.content[0].content[1]),openedBraces:0}):0<u.length&&f.type==="punctuation"&&f.content==="{"?u[u.length-1].openedBraces++:0<u.length&&0<u[u.length-1].openedBraces&&f.type==="punctuation"&&f.content==="}"?u[u.length-1].openedBraces--:y=!0),(y||typeof f=="string")&&0<u.length&&u[u.length-1].openedBraces===0&&(y=c(f),m<d.length-1&&(typeof d[m+1]=="string"||d[m+1].type==="plain-text")&&(y+=c(d[m+1]),d.splice(m+1,1)),0<m&&(typeof d[m-1]=="string"||d[m-1].type==="plain-text")&&(y=c(d[m-1])+y,d.splice(m-1,1),m--),d[m]=new t.Token("plain-text",y,null,y)),f.content&&typeof f.content!="string"&&l(f.content)}}var c=function(d){return d?typeof d=="string"?d:typeof d.content=="string"?d.content:d.content.map(c).join(""):""};t.hooks.add("after-tokenize",function(d){d.language!=="jsx"&&d.language!=="tsx"||l(d.tokens)})}(k),function(t){var s=t.util.clone(t.languages.typescript),s=(t.languages.tsx=t.languages.extend("jsx",s),delete t.languages.tsx.parameter,delete t.languages.tsx["literal-property"],t.languages.tsx.tag);s.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+s.pattern.source+")",s.pattern.flags),s.lookbehind=!0}(k),k.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(/(^|[^"#])/.source+"(?:"+/"(?:\\(?:\((?:[^()]|\([^()]*\))*\)|\r\n|[^(])|[^\\\r\n"])*"/.source+"|"+/"""(?:\\(?:\((?:[^()]|\([^()]*\))*\)|[^(])|[^\\"]|"(?!""))*"""/.source+")"+/(?!["#])/.source),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:"punctuation"},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(/(^|[^"#])(#+)/.source+"(?:"+/"(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|\r\n|[^#])|[^\\\r\n])*?"/.source+"|"+/"""(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|[^#])|[^\\])*?"""/.source+")\\2"),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:"punctuation"},string:/[\s\S]+/}}],directive:{pattern:RegExp(/#/.source+"(?:"+/(?:elseif|if)\b/.source+"(?:[ ]*"+/(?:![ \t]*)?(?:\b\w+\b(?:[ \t]*\((?:[^()]|\([^()]*\))*\))?|\((?:[^()]|\([^()]*\))*\))(?:[ \t]*(?:&&|\|\|))?/.source+")+|"+/(?:else|endif)\b/.source+")"),alias:"property",inside:{"directive-name":/^#\w+/,boolean:/\b(?:false|true)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:"constant"},"other-directive":{pattern:/#\w+\b/,alias:"property"},attribute:{pattern:/@\w+/,alias:"atrule"},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:"function"},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:"important"},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:false|true)\b/,nil:{pattern:/\bnil\b/,alias:"constant"},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:"keyword"},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/},k.languages.swift["string-literal"].forEach(function(t){t.inside.interpolation.inside=k.languages.swift}),function(t){t.languages.kotlin=t.languages.extend("clike",{keyword:{pattern:/(^|[^.])\b(?:abstract|actual|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|dynamic|else|enum|expect|external|final|finally|for|fun|get|if|import|in|infix|init|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|operator|out|override|package|private|protected|public|reified|return|sealed|set|super|suspend|tailrec|this|throw|to|try|typealias|val|var|vararg|when|where|while)\b/,lookbehind:!0},function:[{pattern:/(?:`[^\r\n`]+`|\b\w+)(?=\s*\()/,greedy:!0},{pattern:/(\.)(?:`[^\r\n`]+`|\w+)(?=\s*\{)/,lookbehind:!0,greedy:!0}],number:/\b(?:0[xX][\da-fA-F]+(?:_[\da-fA-F]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/,operator:/\+[+=]?|-[-=>]?|==?=?|!(?:!|==?)?|[\/*%<>]=?|[?:]:?|\.\.|&&|\|\||\b(?:and|inv|or|shl|shr|ushr|xor)\b/}),delete t.languages.kotlin["class-name"];var s={"interpolation-punctuation":{pattern:/^\$\{?|\}$/,alias:"punctuation"},expression:{pattern:/[\s\S]+/,inside:t.languages.kotlin}};t.languages.insertBefore("kotlin","string",{"string-literal":[{pattern:/"""(?:[^$]|\$(?:(?!\{)|\{[^{}]*\}))*?"""/,alias:"multiline",inside:{interpolation:{pattern:/\$(?:[a-z_]\w*|\{[^{}]*\})/i,inside:s},string:/[\s\S]+/}},{pattern:/"(?:[^"\\\r\n$]|\\.|\$(?:(?!\{)|\{[^{}]*\}))*"/,alias:"singleline",inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$(?:[a-z_]\w*|\{[^{}]*\})/i,lookbehind:!0,inside:s},string:/[\s\S]+/}}],char:{pattern:/'(?:[^'\\\r\n]|\\(?:.|u[a-fA-F0-9]{0,4}))'/,greedy:!0}}),delete t.languages.kotlin.string,t.languages.insertBefore("kotlin","keyword",{annotation:{pattern:/\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,alias:"builtin"}}),t.languages.insertBefore("kotlin","function",{label:{pattern:/\b\w+@|@\w+\b/,alias:"symbol"}}),t.languages.kt=t.languages.kotlin,t.languages.kts=t.languages.kotlin}(k),k.languages.c=k.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),k.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),k.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},k.languages.c.string],char:k.languages.c.char,comment:k.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:k.languages.c}}}}),k.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete k.languages.c.boolean,k.languages.objectivec=k.languages.extend("c",{string:{pattern:/@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,operator:/-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete k.languages.objectivec["class-name"],k.languages.objc=k.languages.objectivec,k.languages.reason=k.languages.extend("clike",{string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^\\\r\n"])*"/,greedy:!0},"class-name":/\b[A-Z]\w*/,keyword:/\b(?:and|as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|method|module|mutable|new|nonrec|object|of|open|or|private|rec|sig|struct|switch|then|to|try|type|val|virtual|when|while|with)\b/,operator:/\.{3}|:[:=]|\|>|->|=(?:==?|>)?|<=?|>=?|[|^?'#!~`]|[+\-*\/]\.?|\b(?:asr|land|lor|lsl|lsr|lxor|mod)\b/}),k.languages.insertBefore("reason","class-name",{char:{pattern:/'(?:\\x[\da-f]{2}|\\o[0-3][0-7][0-7]|\\\d{3}|\\.|[^'\\\r\n])'/,greedy:!0},constructor:/\b[A-Z]\w*\b(?!\s*\.)/,label:{pattern:/\b[a-z]\w*(?=::)/,alias:"symbol"}}),delete k.languages.reason.function,function(t){for(var s=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,r=0;r<2;r++)s=s.replace(/<self>/g,function(){return s});s=s.replace(/<self>/g,function(){return/[^\s\S]/.source}),t.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+s),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},t.languages.rust["closure-params"].inside.rest=t.languages.rust,t.languages.rust.attribute.inside.string=t.languages.rust.string}(k),k.languages.go=k.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),k.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete k.languages.go["class-name"],function(t){var s=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,r=/\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g,function(){return s.source});t.languages.cpp=t.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g,function(){return s.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:s,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),t.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g,function(){return r})+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),t.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t.languages.cpp}}}}),t.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),t.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:t.languages.extend("cpp",{})}}),t.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},t.languages.cpp["base-clause"])}(k),k.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},k.languages.python["string-interpolation"].inside.interpolation.inside.rest=k.languages.python,k.languages.py=k.languages.python,k.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},k.languages.webmanifest=k.languages.json;var xd={};md(xd,{dracula:()=>yd,duotoneDark:()=>jd,duotoneLight:()=>Nd,github:()=>Sd,gruvboxMaterialDark:()=>eu,gruvboxMaterialLight:()=>su,jettwaveDark:()=>Hd,jettwaveLight:()=>Wd,nightOwl:()=>Cd,nightOwlLight:()=>Rd,oceanicNext:()=>_d,okaidia:()=>Fd,oneDark:()=>Yd,oneLight:()=>Qd,palenight:()=>Pd,shadesOfPurple:()=>Od,synthwave84:()=>Md,ultramin:()=>zd,vsDark:()=>sn,vsLight:()=>qd});var bd={plain:{color:"#F8F8F2",backgroundColor:"#282A36"},styles:[{types:["prolog","constant","builtin"],style:{color:"rgb(189, 147, 249)"}},{types:["inserted","function"],style:{color:"rgb(80, 250, 123)"}},{types:["deleted"],style:{color:"rgb(255, 85, 85)"}},{types:["changed"],style:{color:"rgb(255, 184, 108)"}},{types:["punctuation","symbol"],style:{color:"rgb(248, 248, 242)"}},{types:["string","char","tag","selector"],style:{color:"rgb(255, 121, 198)"}},{types:["keyword","variable"],style:{color:"rgb(189, 147, 249)",fontStyle:"italic"}},{types:["comment"],style:{color:"rgb(98, 114, 164)"}},{types:["attr-name"],style:{color:"rgb(241, 250, 140)"}}]},yd=bd,vd={plain:{backgroundColor:"#2a2734",color:"#9a86fd"},styles:[{types:["comment","prolog","doctype","cdata","punctuation"],style:{color:"#6c6783"}},{types:["namespace"],style:{opacity:.7}},{types:["tag","operator","number"],style:{color:"#e09142"}},{types:["property","function"],style:{color:"#9a86fd"}},{types:["tag-id","selector","atrule-id"],style:{color:"#eeebff"}},{types:["attr-name"],style:{color:"#c4b9fe"}},{types:["boolean","string","entity","url","attr-value","keyword","control","directive","unit","statement","regex","atrule","placeholder","variable"],style:{color:"#ffcc99"}},{types:["deleted"],style:{textDecorationLine:"line-through"}},{types:["inserted"],style:{textDecorationLine:"underline"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["important","bold"],style:{fontWeight:"bold"}},{types:["important"],style:{color:"#c4b9fe"}}]},jd=vd,wd={plain:{backgroundColor:"#faf8f5",color:"#728fcb"},styles:[{types:["comment","prolog","doctype","cdata","punctuation"],style:{color:"#b6ad9a"}},{types:["namespace"],style:{opacity:.7}},{types:["tag","operator","number"],style:{color:"#063289"}},{types:["property","function"],style:{color:"#b29762"}},{types:["tag-id","selector","atrule-id"],style:{color:"#2d2006"}},{types:["attr-name"],style:{color:"#896724"}},{types:["boolean","string","entity","url","attr-value","keyword","control","directive","unit","statement","regex","atrule"],style:{color:"#728fcb"}},{types:["placeholder","variable"],style:{color:"#93abdc"}},{types:["deleted"],style:{textDecorationLine:"line-through"}},{types:["inserted"],style:{textDecorationLine:"underline"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["important","bold"],style:{fontWeight:"bold"}},{types:["important"],style:{color:"#896724"}}]},Nd=wd,kd={plain:{color:"#393A34",backgroundColor:"#f6f8fa"},styles:[{types:["comment","prolog","doctype","cdata"],style:{color:"#999988",fontStyle:"italic"}},{types:["namespace"],style:{opacity:.7}},{types:["string","attr-value"],style:{color:"#e3116c"}},{types:["punctuation","operator"],style:{color:"#393A34"}},{types:["entity","url","symbol","number","boolean","variable","constant","property","regex","inserted"],style:{color:"#36acaa"}},{types:["atrule","keyword","attr-name","selector"],style:{color:"#00a4db"}},{types:["function","deleted","tag"],style:{color:"#d73a49"}},{types:["function-variable"],style:{color:"#6f42c1"}},{types:["tag","selector","keyword"],style:{color:"#00009f"}}]},Sd=kd,Ed={plain:{color:"#d6deeb",backgroundColor:"#011627"},styles:[{types:["changed"],style:{color:"rgb(162, 191, 252)",fontStyle:"italic"}},{types:["deleted"],style:{color:"rgba(239, 83, 80, 0.56)",fontStyle:"italic"}},{types:["inserted","attr-name"],style:{color:"rgb(173, 219, 103)",fontStyle:"italic"}},{types:["comment"],style:{color:"rgb(99, 119, 119)",fontStyle:"italic"}},{types:["string","url"],style:{color:"rgb(173, 219, 103)"}},{types:["variable"],style:{color:"rgb(214, 222, 235)"}},{types:["number"],style:{color:"rgb(247, 140, 108)"}},{types:["builtin","char","constant","function"],style:{color:"rgb(130, 170, 255)"}},{types:["punctuation"],style:{color:"rgb(199, 146, 234)"}},{types:["selector","doctype"],style:{color:"rgb(199, 146, 234)",fontStyle:"italic"}},{types:["class-name"],style:{color:"rgb(255, 203, 139)"}},{types:["tag","operator","keyword"],style:{color:"rgb(127, 219, 202)"}},{types:["boolean"],style:{color:"rgb(255, 88, 116)"}},{types:["property"],style:{color:"rgb(128, 203, 196)"}},{types:["namespace"],style:{color:"rgb(178, 204, 214)"}}]},Cd=Ed,Td={plain:{color:"#403f53",backgroundColor:"#FBFBFB"},styles:[{types:["changed"],style:{color:"rgb(162, 191, 252)",fontStyle:"italic"}},{types:["deleted"],style:{color:"rgba(239, 83, 80, 0.56)",fontStyle:"italic"}},{types:["inserted","attr-name"],style:{color:"rgb(72, 118, 214)",fontStyle:"italic"}},{types:["comment"],style:{color:"rgb(152, 159, 177)",fontStyle:"italic"}},{types:["string","builtin","char","constant","url"],style:{color:"rgb(72, 118, 214)"}},{types:["variable"],style:{color:"rgb(201, 103, 101)"}},{types:["number"],style:{color:"rgb(170, 9, 130)"}},{types:["punctuation"],style:{color:"rgb(153, 76, 195)"}},{types:["function","selector","doctype"],style:{color:"rgb(153, 76, 195)",fontStyle:"italic"}},{types:["class-name"],style:{color:"rgb(17, 17, 17)"}},{types:["tag"],style:{color:"rgb(153, 76, 195)"}},{types:["operator","property","keyword","namespace"],style:{color:"rgb(12, 150, 155)"}},{types:["boolean"],style:{color:"rgb(188, 84, 84)"}}]},Rd=Td,ie={char:"#D8DEE9",comment:"#999999",keyword:"#c5a5c5",primitive:"#5a9bcf",string:"#8dc891",variable:"#d7deea",boolean:"#ff8b50",punctuation:"#5FB3B3",tag:"#fc929e",function:"#79b6f2",className:"#FAC863",method:"#6699CC",operator:"#fc929e"},Ad={plain:{backgroundColor:"#282c34",color:"#ffffff"},styles:[{types:["attr-name"],style:{color:ie.keyword}},{types:["attr-value"],style:{color:ie.string}},{types:["comment","block-comment","prolog","doctype","cdata","shebang"],style:{color:ie.comment}},{types:["property","number","function-name","constant","symbol","deleted"],style:{color:ie.primitive}},{types:["boolean"],style:{color:ie.boolean}},{types:["tag"],style:{color:ie.tag}},{types:["string"],style:{color:ie.string}},{types:["punctuation"],style:{color:ie.string}},{types:["selector","char","builtin","inserted"],style:{color:ie.char}},{types:["function"],style:{color:ie.function}},{types:["operator","entity","url","variable"],style:{color:ie.variable}},{types:["keyword"],style:{color:ie.keyword}},{types:["atrule","class-name"],style:{color:ie.className}},{types:["important"],style:{fontWeight:"400"}},{types:["bold"],style:{fontWeight:"bold"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["namespace"],style:{opacity:.7}}]},_d=Ad,Id={plain:{color:"#f8f8f2",backgroundColor:"#272822"},styles:[{types:["changed"],style:{color:"rgb(162, 191, 252)",fontStyle:"italic"}},{types:["deleted"],style:{color:"#f92672",fontStyle:"italic"}},{types:["inserted"],style:{color:"rgb(173, 219, 103)",fontStyle:"italic"}},{types:["comment"],style:{color:"#8292a2",fontStyle:"italic"}},{types:["string","url"],style:{color:"#a6e22e"}},{types:["variable"],style:{color:"#f8f8f2"}},{types:["number"],style:{color:"#ae81ff"}},{types:["builtin","char","constant","function","class-name"],style:{color:"#e6db74"}},{types:["punctuation"],style:{color:"#f8f8f2"}},{types:["selector","doctype"],style:{color:"#a6e22e",fontStyle:"italic"}},{types:["tag","operator","keyword"],style:{color:"#66d9ef"}},{types:["boolean"],style:{color:"#ae81ff"}},{types:["namespace"],style:{color:"rgb(178, 204, 214)",opacity:.7}},{types:["tag","property"],style:{color:"#f92672"}},{types:["attr-name"],style:{color:"#a6e22e !important"}},{types:["doctype"],style:{color:"#8292a2"}},{types:["rule"],style:{color:"#e6db74"}}]},Fd=Id,Ld={plain:{color:"#bfc7d5",backgroundColor:"#292d3e"},styles:[{types:["comment"],style:{color:"rgb(105, 112, 152)",fontStyle:"italic"}},{types:["string","inserted"],style:{color:"rgb(195, 232, 141)"}},{types:["number"],style:{color:"rgb(247, 140, 108)"}},{types:["builtin","char","constant","function"],style:{color:"rgb(130, 170, 255)"}},{types:["punctuation","selector"],style:{color:"rgb(199, 146, 234)"}},{types:["variable"],style:{color:"rgb(191, 199, 213)"}},{types:["class-name","attr-name"],style:{color:"rgb(255, 203, 107)"}},{types:["tag","deleted"],style:{color:"rgb(255, 85, 114)"}},{types:["operator"],style:{color:"rgb(137, 221, 255)"}},{types:["boolean"],style:{color:"rgb(255, 88, 116)"}},{types:["keyword"],style:{fontStyle:"italic"}},{types:["doctype"],style:{color:"rgb(199, 146, 234)",fontStyle:"italic"}},{types:["namespace"],style:{color:"rgb(178, 204, 214)"}},{types:["url"],style:{color:"rgb(221, 221, 221)"}}]},Pd=Ld,Dd={plain:{color:"#9EFEFF",backgroundColor:"#2D2A55"},styles:[{types:["changed"],style:{color:"rgb(255, 238, 128)"}},{types:["deleted"],style:{color:"rgba(239, 83, 80, 0.56)"}},{types:["inserted"],style:{color:"rgb(173, 219, 103)"}},{types:["comment"],style:{color:"rgb(179, 98, 255)",fontStyle:"italic"}},{types:["punctuation"],style:{color:"rgb(255, 255, 255)"}},{types:["constant"],style:{color:"rgb(255, 98, 140)"}},{types:["string","url"],style:{color:"rgb(165, 255, 144)"}},{types:["variable"],style:{color:"rgb(255, 238, 128)"}},{types:["number","boolean"],style:{color:"rgb(255, 98, 140)"}},{types:["attr-name"],style:{color:"rgb(255, 180, 84)"}},{types:["keyword","operator","property","namespace","tag","selector","doctype"],style:{color:"rgb(255, 157, 0)"}},{types:["builtin","char","constant","function","class-name"],style:{color:"rgb(250, 208, 0)"}}]},Od=Dd,$d={plain:{backgroundColor:"linear-gradient(to bottom, #2a2139 75%, #34294f)",backgroundImage:"#34294f",color:"#f92aad",textShadow:"0 0 2px #100c0f, 0 0 5px #dc078e33, 0 0 10px #fff3"},styles:[{types:["comment","block-comment","prolog","doctype","cdata"],style:{color:"#495495",fontStyle:"italic"}},{types:["punctuation"],style:{color:"#ccc"}},{types:["tag","attr-name","namespace","number","unit","hexcode","deleted"],style:{color:"#e2777a"}},{types:["property","selector"],style:{color:"#72f1b8",textShadow:"0 0 2px #100c0f, 0 0 10px #257c5575, 0 0 35px #21272475"}},{types:["function-name"],style:{color:"#6196cc"}},{types:["boolean","selector-id","function"],style:{color:"#fdfdfd",textShadow:"0 0 2px #001716, 0 0 3px #03edf975, 0 0 5px #03edf975, 0 0 8px #03edf975"}},{types:["class-name","maybe-class-name","builtin"],style:{color:"#fff5f6",textShadow:"0 0 2px #000, 0 0 10px #fc1f2c75, 0 0 5px #fc1f2c75, 0 0 25px #fc1f2c75"}},{types:["constant","symbol"],style:{color:"#f92aad",textShadow:"0 0 2px #100c0f, 0 0 5px #dc078e33, 0 0 10px #fff3"}},{types:["important","atrule","keyword","selector-class"],style:{color:"#f4eee4",textShadow:"0 0 2px #393a33, 0 0 8px #f39f0575, 0 0 2px #f39f0575"}},{types:["string","char","attr-value","regex","variable"],style:{color:"#f87c32"}},{types:["parameter"],style:{fontStyle:"italic"}},{types:["entity","url"],style:{color:"#67cdcc"}},{types:["operator"],style:{color:"ffffffee"}},{types:["important","bold"],style:{fontWeight:"bold"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["entity"],style:{cursor:"help"}},{types:["inserted"],style:{color:"green"}}]},Md=$d,Bd={plain:{color:"#282a2e",backgroundColor:"#ffffff"},styles:[{types:["comment"],style:{color:"rgb(197, 200, 198)"}},{types:["string","number","builtin","variable"],style:{color:"rgb(150, 152, 150)"}},{types:["class-name","function","tag","attr-name"],style:{color:"rgb(40, 42, 46)"}}]},zd=Bd,Vd={plain:{color:"#9CDCFE",backgroundColor:"#1E1E1E"},styles:[{types:["prolog"],style:{color:"rgb(0, 0, 128)"}},{types:["comment"],style:{color:"rgb(106, 153, 85)"}},{types:["builtin","changed","keyword","interpolation-punctuation"],style:{color:"rgb(86, 156, 214)"}},{types:["number","inserted"],style:{color:"rgb(181, 206, 168)"}},{types:["constant"],style:{color:"rgb(100, 102, 149)"}},{types:["attr-name","variable"],style:{color:"rgb(156, 220, 254)"}},{types:["deleted","string","attr-value","template-punctuation"],style:{color:"rgb(206, 145, 120)"}},{types:["selector"],style:{color:"rgb(215, 186, 125)"}},{types:["tag"],style:{color:"rgb(78, 201, 176)"}},{types:["tag"],languages:["markup"],style:{color:"rgb(86, 156, 214)"}},{types:["punctuation","operator"],style:{color:"rgb(212, 212, 212)"}},{types:["punctuation"],languages:["markup"],style:{color:"#808080"}},{types:["function"],style:{color:"rgb(220, 220, 170)"}},{types:["class-name"],style:{color:"rgb(78, 201, 176)"}},{types:["char"],style:{color:"rgb(209, 105, 105)"}}]},sn=Vd,Ud={plain:{color:"#000000",backgroundColor:"#ffffff"},styles:[{types:["comment"],style:{color:"rgb(0, 128, 0)"}},{types:["builtin"],style:{color:"rgb(0, 112, 193)"}},{types:["number","variable","inserted"],style:{color:"rgb(9, 134, 88)"}},{types:["operator"],style:{color:"rgb(0, 0, 0)"}},{types:["constant","char"],style:{color:"rgb(129, 31, 63)"}},{types:["tag"],style:{color:"rgb(128, 0, 0)"}},{types:["attr-name"],style:{color:"rgb(255, 0, 0)"}},{types:["deleted","string"],style:{color:"rgb(163, 21, 21)"}},{types:["changed","punctuation"],style:{color:"rgb(4, 81, 165)"}},{types:["function","keyword"],style:{color:"rgb(0, 0, 255)"}},{types:["class-name"],style:{color:"rgb(38, 127, 153)"}}]},qd=Ud,Gd={plain:{color:"#f8fafc",backgroundColor:"#011627"},styles:[{types:["prolog"],style:{color:"#000080"}},{types:["comment"],style:{color:"#6A9955"}},{types:["builtin","changed","keyword","interpolation-punctuation"],style:{color:"#569CD6"}},{types:["number","inserted"],style:{color:"#B5CEA8"}},{types:["constant"],style:{color:"#f8fafc"}},{types:["attr-name","variable"],style:{color:"#9CDCFE"}},{types:["deleted","string","attr-value","template-punctuation"],style:{color:"#cbd5e1"}},{types:["selector"],style:{color:"#D7BA7D"}},{types:["tag"],style:{color:"#0ea5e9"}},{types:["tag"],languages:["markup"],style:{color:"#0ea5e9"}},{types:["punctuation","operator"],style:{color:"#D4D4D4"}},{types:["punctuation"],languages:["markup"],style:{color:"#808080"}},{types:["function"],style:{color:"#7dd3fc"}},{types:["class-name"],style:{color:"#0ea5e9"}},{types:["char"],style:{color:"#D16969"}}]},Hd=Gd,Kd={plain:{color:"#0f172a",backgroundColor:"#f1f5f9"},styles:[{types:["prolog"],style:{color:"#000080"}},{types:["comment"],style:{color:"#6A9955"}},{types:["builtin","changed","keyword","interpolation-punctuation"],style:{color:"#0c4a6e"}},{types:["number","inserted"],style:{color:"#B5CEA8"}},{types:["constant"],style:{color:"#0f172a"}},{types:["attr-name","variable"],style:{color:"#0c4a6e"}},{types:["deleted","string","attr-value","template-punctuation"],style:{color:"#64748b"}},{types:["selector"],style:{color:"#D7BA7D"}},{types:["tag"],style:{color:"#0ea5e9"}},{types:["tag"],languages:["markup"],style:{color:"#0ea5e9"}},{types:["punctuation","operator"],style:{color:"#475569"}},{types:["punctuation"],languages:["markup"],style:{color:"#808080"}},{types:["function"],style:{color:"#0e7490"}},{types:["class-name"],style:{color:"#0ea5e9"}},{types:["char"],style:{color:"#D16969"}}]},Wd=Kd,Zd={plain:{backgroundColor:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)"},styles:[{types:["comment","prolog","cdata"],style:{color:"hsl(220, 10%, 40%)"}},{types:["doctype","punctuation","entity"],style:{color:"hsl(220, 14%, 71%)"}},{types:["attr-name","class-name","maybe-class-name","boolean","constant","number","atrule"],style:{color:"hsl(29, 54%, 61%)"}},{types:["keyword"],style:{color:"hsl(286, 60%, 67%)"}},{types:["property","tag","symbol","deleted","important"],style:{color:"hsl(355, 65%, 65%)"}},{types:["selector","string","char","builtin","inserted","regex","attr-value"],style:{color:"hsl(95, 38%, 62%)"}},{types:["variable","operator","function"],style:{color:"hsl(207, 82%, 66%)"}},{types:["url"],style:{color:"hsl(187, 47%, 55%)"}},{types:["deleted"],style:{textDecorationLine:"line-through"}},{types:["inserted"],style:{textDecorationLine:"underline"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["important","bold"],style:{fontWeight:"bold"}},{types:["important"],style:{color:"hsl(220, 14%, 71%)"}}]},Yd=Zd,Xd={plain:{backgroundColor:"hsl(230, 1%, 98%)",color:"hsl(230, 8%, 24%)"},styles:[{types:["comment","prolog","cdata"],style:{color:"hsl(230, 4%, 64%)"}},{types:["doctype","punctuation","entity"],style:{color:"hsl(230, 8%, 24%)"}},{types:["attr-name","class-name","boolean","constant","number","atrule"],style:{color:"hsl(35, 99%, 36%)"}},{types:["keyword"],style:{color:"hsl(301, 63%, 40%)"}},{types:["property","tag","symbol","deleted","important"],style:{color:"hsl(5, 74%, 59%)"}},{types:["selector","string","char","builtin","inserted","regex","attr-value","punctuation"],style:{color:"hsl(119, 34%, 47%)"}},{types:["variable","operator","function"],style:{color:"hsl(221, 87%, 60%)"}},{types:["url"],style:{color:"hsl(198, 99%, 37%)"}},{types:["deleted"],style:{textDecorationLine:"line-through"}},{types:["inserted"],style:{textDecorationLine:"underline"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["important","bold"],style:{fontWeight:"bold"}},{types:["important"],style:{color:"hsl(230, 8%, 24%)"}}]},Qd=Xd,Jd={plain:{color:"#ebdbb2",backgroundColor:"#292828"},styles:[{types:["imports","class-name","maybe-class-name","constant","doctype","builtin","function"],style:{color:"#d8a657"}},{types:["property-access"],style:{color:"#7daea3"}},{types:["tag"],style:{color:"#e78a4e"}},{types:["attr-name","char","url","regex"],style:{color:"#a9b665"}},{types:["attr-value","string"],style:{color:"#89b482"}},{types:["comment","prolog","cdata","operator","inserted"],style:{color:"#a89984"}},{types:["delimiter","boolean","keyword","selector","important","atrule","property","variable","deleted"],style:{color:"#ea6962"}},{types:["entity","number","symbol"],style:{color:"#d3869b"}}]},eu=Jd,tu={plain:{color:"#654735",backgroundColor:"#f9f5d7"},styles:[{types:["delimiter","boolean","keyword","selector","important","atrule","property","variable","deleted"],style:{color:"#af2528"}},{types:["imports","class-name","maybe-class-name","constant","doctype","builtin"],style:{color:"#b4730e"}},{types:["string","attr-value"],style:{color:"#477a5b"}},{types:["property-access"],style:{color:"#266b79"}},{types:["function","attr-name","char","url"],style:{color:"#72761e"}},{types:["tag"],style:{color:"#b94c07"}},{types:["comment","prolog","cdata","operator","inserted"],style:{color:"#a89984"}},{types:["entity","number","symbol"],style:{color:"#924f79"}}]},su=tu,ru=t=>i.useCallback(s=>{var r=s,{className:a,style:n,line:o}=r,l=tn(r,["className","style","line"]);const c=Ht(ge({},l),{className:ys("token-line",a)});return typeof t=="object"&&"plain"in t&&(c.style=t.plain),typeof n=="object"&&(c.style=ge(ge({},c.style||{}),n)),c},[t]),au=t=>{const s=i.useCallback(({types:r,empty:a})=>{if(t!=null){{if(r.length===1&&r[0]==="plain")return a!=null?{display:"inline-block"}:void 0;if(r.length===1&&a!=null)return t[r[0]]}return Object.assign(a!=null?{display:"inline-block"}:{},...r.map(n=>t[n]))}},[t]);return i.useCallback(r=>{var a=r,{token:n,className:o,style:l}=a,c=tn(a,["token","className","style"]);const d=Ht(ge({},c),{className:ys("token",...n.types,o),children:n.content,style:s(n)});return l!=null&&(d.style=ge(ge({},d.style||{}),l)),d},[s])},nu=/\r\n|\r|\n/,dr=t=>{t.length===0?t.push({types:["plain"],content:`
`,empty:!0}):t.length===1&&t[0].content===""&&(t[0].content=`
`,t[0].empty=!0)},ur=(t,s)=>{const r=t.length;return r>0&&t[r-1]===s?t:t.concat(s)},ou=t=>{const s=[[]],r=[t],a=[0],n=[t.length];let o=0,l=0,c=[];const d=[c];for(;l>-1;){for(;(o=a[l]++)<n[l];){let u,m=s[l];const y=r[l][o];if(typeof y=="string"?(m=l>0?m:["plain"],u=y):(m=ur(m,y.type),y.alias&&(m=ur(m,y.alias)),u=y.content),typeof u!="string"){l++,s.push(m),r.push(u),a.push(0),n.push(u.length);continue}const N=u.split(nu),h=N.length;c.push({types:m,content:N[0]});for(let p=1;p<h;p++)dr(c),d.push(c=[]),c.push({types:m,content:N[p]})}l--,s.pop(),r.pop(),a.pop(),n.pop()}return dr(c),d},pr=ou,iu=({prism:t,code:s,grammar:r,language:a})=>i.useMemo(()=>{if(r==null)return pr([s]);const n={code:s,grammar:r,language:a,tokens:[]};return t.hooks.run("before-tokenize",n),n.tokens=t.tokenize(s,r),t.hooks.run("after-tokenize",n),pr(n.tokens)},[s,r,a,t]),lu=(t,s)=>{const{plain:r}=t,a=t.styles.reduce((n,o)=>{const{languages:l,style:c}=o;return l&&!l.includes(s)||o.types.forEach(d=>{const u=ge(ge({},n[d]),c);n[d]=u}),n},{});return a.root=r,a.plain=Ht(ge({},r),{backgroundColor:void 0}),a},cu=lu,du=({children:t,language:s,code:r,theme:a,prism:n})=>{const o=s.toLowerCase(),l=cu(a,o),c=ru(l),d=au(l),u=n.languages[o],m=iu({prism:n,language:o,code:r,grammar:u});return t({tokens:m,className:`prism-code language-${o}`,style:l!=null?l.root:{},getLineProps:c,getTokenProps:d})},uu=t=>i.createElement(du,Ht(ge({},t),{prism:t.prism||k,theme:t.theme||sn,code:t.code,language:t.language}));/*! Bundled license information:
prismjs/prism.js:
(**
* Prism: Lightweight, robust, elegant syntax highlighting
*
* @license MIT <https://opensource.org/licenses/MIT>
* @author Lea Verou <https://lea.verou.me>
* @namespace
* @public
*)
*/const pu=(t,s)=>s.some(r=>{if(typeof r=="number")return t===r;const[a,n]=r.split(":").map(o=>parseInt(o));return a<=t&&t<=n}),mu=(t,s,r)=>r.some(([a,[n,o]])=>a===t&&n<=s&&s<=o),gu=(t,s)=>t.split(new RegExp(`(${s.map(([r])=>r).join("|")})`)).filter(Boolean),fu=t=>t.map(s=>{s=s.startsWith("/")?s:"/"+s;const[,r,a="0:Infinity"]=s.split("/"),[n,o=n]=a.split(":").map(l=>Number(l));return[r,[n,o]]}),rn=(t,s)=>()=>{const r=i.useContext(t);if(r===void 0)throw new Error(s);return r},Kt=t=>Object.assign(i.forwardRef(t),{displayName:t.displayName??t.name}),an=i.createContext(void 0),nn=i.createContext(void 0),on=rn(an,'Could not find nearest <CodeBlock /> component. Please wrap this component with a <CodeBlock /> component imported from "react-code-block".'),zs=rn(nn,'Could not find nearest <CodeBlock.Code /> component. Please wrap this component with <CodeBlock.Code /> component imported from "react-code-block".'),ye=({code:t,words:s=[],lines:r=[],children:a,...n})=>{const o=i.useMemo(()=>fu(s),[s]);return e.jsx(an.Provider,{value:{code:t.trim(),words:o,lines:r,...n},children:a})},hu=({as:t,children:s,...r},a)=>{const{lines:n,words:o,...l}=on(),c=t??"pre";return e.jsx(uu,{...l,children:d=>e.jsx(c,{...r,ref:a,children:d.tokens.map((u,m)=>{const f=m+1,y=pu(f,n);return e.jsx(nn.Provider,{value:{highlight:d,line:u,lineNumber:f},children:typeof s=="function"?s({isLineHighlighted:y,lineNumber:f},m):s},m)})})})},xu=({as:t,children:s,className:r,...a},n)=>{const{highlight:o,line:l}=zs(),{getLineProps:c}=o,d=t??"div";return e.jsx(d,{...c({line:l,className:r}),...a,ref:n,children:s})},bu=({as:t,children:s=({children:o})=>e.jsx("span",{children:o}),className:r,...a},n)=>{const{words:o}=on(),{line:l,highlight:c,lineNumber:d}=zs(),{getTokenProps:u}=c,m=t??"span";return e.jsx(Be.Fragment,{children:l.map((f,y)=>{const{children:N,...h}=u({token:f,className:r}),p=o.length?gu(N,o):[N];return e.jsx(Be.Fragment,{children:p.map((g,x)=>e.jsx(m,{...h,...a,ref:n,children:s({children:g,isTokenHighlighted:mu(g,d,o)})},x))},y)})})},yu=({as:t,...s},r)=>{const{lineNumber:a}=zs(),n=t??"span";return e.jsx(n,{...s,ref:r,children:a})};ye.Code=Kt(hu);ye.LineContent=Kt(xu);ye.Token=Kt(bu);ye.LineNumber=Kt(yu);const vu={plain:{color:"var(--foreground)",backgroundColor:"var(--muted)"},styles:[{types:["comment"],style:{color:"#6e7781",fontStyle:"italic"}},{types:["keyword","selector","changed"],style:{color:"#cf222e"}},{types:["constant","number","builtin"],style:{color:"#0550ae"}},{types:["string","attr-value"],style:{color:"#0a3069"}},{types:["function","attr-name"],style:{color:"#8250df"}},{types:["tag","operator"],style:{color:"#116329"}},{types:["variable","property"],style:{color:"#953800"}},{types:["punctuation"],style:{color:"#24292f"}}]},ju={plain:{color:"var(--foreground)",backgroundColor:"var(--muted)"},styles:[{types:["comment"],style:{color:"#8b949e",fontStyle:"italic"}},{types:["keyword","selector","changed"],style:{color:"#ff7b72"}},{types:["constant","number","builtin"],style:{color:"#79c0ff"}},{types:["string","attr-value"],style:{color:"#a5d6ff"}},{types:["function","attr-name"],style:{color:"#d2a8ff"}},{types:["tag","operator"],style:{color:"#7ee787"}},{types:["variable","property"],style:{color:"#ffa657"}},{types:["punctuation"],style:{color:"#c9d1d9"}}]};function as({code:t,language:s="typescript",fileName:r,className:a,maxLines:n=200}){const[o,l]=i.useState(!1),[c,d]=i.useState(!1),{theme:u}=Fi(),m=async()=>{await navigator.clipboard.writeText(t),l(!0),setTimeout(()=>l(!1),2e3)},f=t.split(`
`),y=f.length>n,N=c?t:f.slice(0,n).join(`
`);return e.jsxs("div",{className:v("relative group rounded-lg overflow-hidden",a),children:[r&&e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b bg-muted/50",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:r}),e.jsxs(q,{variant:"ghost",size:"icon",className:"h-7 w-7 opacity-0 group-hover:opacity-100 transition-opacity",onClick:m,children:[o?e.jsx(qe,{className:"h-4 w-4"}):e.jsx(Ar,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Copy code"})]})]}),e.jsx(ye,{code:N,language:s,theme:u==="dark"?ju:vu,children:e.jsx(ye.Code,{className:"bg-muted/50 p-4 text-sm whitespace-pre-wrap break-words",children:e.jsx(ye.LineContent,{className:"max-w-full",children:e.jsx(ye.Token,{})})})}),y&&e.jsx("div",{className:"flex justify-center p-2 border-t bg-muted/50",children:e.jsx(q,{variant:"ghost",size:"sm",onClick:()=>d(!c),className:"flex items-center gap-2",children:c?e.jsxs(e.Fragment,{children:["Show Less ",e.jsx(Tr,{className:"h-4 w-4"})]}):e.jsxs(e.Fragment,{children:["Show More (",f.length-n," more lines)"," ",e.jsx(ot,{className:"h-4 w-4"})]})})})]})}function wu(t){const[s,r]=i.useState(null),[a,n]=i.useState(!1),[o,l]=i.useState(null);return i.useEffect(()=>{if(!t){l("Node name is required");return}n(!0),l(null),fetch(`/ui/api/v1/proxy/${t}/ui/api/v1/cluster/nodes/self/details`).then(c=>{if(!c.ok)throw new Error(`Failed to fetch node details: ${c.statusText}`);return c.json()}).then(c=>{var d,u;c.target=((u=(d=c.config.match(/target:\s*([^\n]+)/))==null?void 0:d[1])==null?void 0:u.trim())||"",r(c),n(!1)}).catch(c=>{l(c instanceof Error?c.message:"An error occurred"),n(!1)})},[t]),{nodeDetails:s,isLoading:a,error:o}}function Nu(t,s){const[r,a]=i.useState(!1),[n,o]=i.useState(null),[l,c]=i.useState("");return i.useEffect(()=>{if(!s){c("");return}if(!t)return;const d=new AbortController;async function u(){a(!0),o(null);try{const m=await fetch(`/ui/api/v1/proxy/${t}/metrics`,{signal:d.signal});if(!m.ok)throw new Error(`Failed to fetch metrics: ${m.statusText}`);const f=await m.text();c(f)}catch(m){m instanceof Error?o(m.message):o("An unknown error occurred")}finally{a(!1)}}return u(),()=>{d.abort()}},[t,s]),{isLoading:r,error:n,metrics:l}}const ku={Running:"#10B981",Starting:"#F59E0B",New:"#3B82F6",Stopping:"#F59E0B",Terminated:"#6B7280",Failed:"#EF4444"};function Su({services:t}){const s=i.useMemo(()=>{const a=t.reduce((n,{status:o})=>{const l=o;return n.set(l,(n.get(l)||0)+1),n},new Map);return Array.from(a.entries()).sort((n,o)=>o[1]-n[1]).map(([n,o])=>({name:n,value:o,color:ku[n]}))},[t]),r=i.useMemo(()=>t.length,[t]);return s.length===0?null:e.jsxs("div",{className:"h-[180px] w-full flex items-center",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center pointer-events-none z-10",children:[e.jsx("div",{className:"text-2xl font-bold",children:r}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Services"})]}),e.jsx(ct,{width:"100%",height:180,children:e.jsxs(Dt,{margin:{top:0,right:0,bottom:0,left:0},children:[e.jsx(Ot,{data:s,cx:"50%",cy:"50%",labelLine:!1,outerRadius:70,innerRadius:50,dataKey:"value",paddingAngle:2,strokeWidth:2,children:s.map(a=>e.jsx($t,{fill:a.color,stroke:"hsl(var(--background))"},`cell-${a.name}`))}),e.jsx(dt,{content:({active:a,payload:n})=>{if(!a||!n||!n[0])return null;const o=n[0].payload;return e.jsxs("div",{className:"bg-background border rounded-lg shadow-lg px-3 py-2 flex items-center gap-2",children:[e.jsx("div",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:o.color}}),e.jsx("span",{className:"text-sm font-medium",children:o.name}),e.jsx("span",{className:"text-sm font-semibold",children:o.value})]})}})]})})]}),e.jsx("div",{className:"flex flex-col gap-1.5 min-w-[120px] pl-4",children:s.map(a=>e.jsxs("div",{className:"flex items-center justify-between gap-2 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:a.color}}),e.jsx("span",{className:"text-muted-foreground",children:a.name})]}),e.jsx("span",{className:"font-medium tabular-nums",children:a.value})]},a.name))})]})}const Eu=t=>{switch(t){case"Running":return"text-green-600 dark:text-green-400";case"Starting":return"text-yellow-600 dark:text-yellow-400";case"Failed":return"text-red-600 dark:text-red-400";case"New":return"text-blue-600 dark:text-blue-400";case"Terminated":return"text-gray-600 dark:text-gray-400";default:return"text-gray-600 dark:text-gray-400"}};function Cu({services:t}){return e.jsx(pt,{className:"h-[180px] rounded-md border",children:e.jsxs(Ce,{children:[e.jsx(Te,{children:e.jsxs(X,{children:[e.jsx(D,{children:"Service"}),e.jsx(D,{className:"text-right",children:"Status"})]})}),e.jsx(Re,{children:t.map(s=>e.jsxs(X,{className:"hover:bg-muted/50",children:[e.jsx(F,{className:"font-medium",children:s.service}),e.jsx(F,{className:`text-right ${Eu(s.status)} font-medium`,children:s.status})]},s.service))})]})})}const Tu={aws:"text-yellow-600 bg-yellow-100 dark:bg-yellow-950 dark:text-yellow-400","aws-dynamo":"text-yellow-600 bg-yellow-100 dark:bg-yellow-950 dark:text-yellow-400",s3:"text-yellow-600 bg-yellow-100 dark:bg-yellow-950 dark:text-yellow-400",azure:"text-blue-600 bg-blue-100 dark:bg-blue-950 dark:text-blue-400",gcp:"text-blue-600 bg-blue-100 dark:bg-blue-950 dark:text-blue-400","gcp-columnkey":"text-blue-600 bg-blue-100 dark:bg-blue-950 dark:text-blue-400",gcs:"text-blue-600 bg-blue-100 dark:bg-blue-950 dark:text-blue-400",alibabacloud:"text-orange-600 bg-orange-100 dark:bg-orange-950 dark:text-orange-400",filesystem:"text-gray-600 bg-gray-100 dark:bg-gray-800 dark:text-gray-400",local:"text-gray-600 bg-gray-100 dark:bg-gray-800 dark:text-gray-400",boltdb:"text-emerald-600 bg-emerald-100 dark:bg-emerald-950 dark:text-emerald-400",cassandra:"text-blue-700 bg-blue-100 dark:bg-blue-950 dark:text-blue-400",bigtable:"text-red-600 bg-red-100 dark:bg-red-950 dark:text-red-400","bigtable-hashed":"text-red-600 bg-red-100 dark:bg-red-950 dark:text-red-400",bos:"text-cyan-600 bg-cyan-100 dark:bg-cyan-950 dark:text-cyan-400",cos:"text-green-600 bg-green-100 dark:bg-green-950 dark:text-green-400",swift:"text-orange-600 bg-orange-100 dark:bg-orange-950 dark:text-orange-400",inmemory:"text-purple-600 bg-purple-100 dark:bg-purple-950 dark:text-purple-400","grpc-store":"text-indigo-600 bg-indigo-100 dark:bg-indigo-950 dark:text-indigo-400"};function Ru({type:t,className:s}){const r=t.toLowerCase(),a=Tu[r]||"text-gray-600 bg-gray-100 dark:bg-gray-800 dark:text-gray-400";return e.jsx("span",{className:v("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium",a,s),children:r})}const Au=Ee("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),le=i.forwardRef(({className:t,...s},r)=>e.jsx(yr,{ref:r,className:v(Au(),t),...s}));le.displayName=yr.displayName;function _u(t){const[s,r]=i.useState("info"),[a,n]=i.useState(!1),[o,l]=i.useState(null),[c,d]=i.useState(!1),u=f=>{const y=f.message.match(/Current log level is (\w+)/);return(y==null?void 0:y[1])||"info"};return i.useEffect(()=>{async function f(){if(t){n(!0),l(null);try{const y=await fetch(`/ui/api/v1/proxy/${t}/log_level`);if(!y.ok)throw new Error(`Failed to fetch log level: ${y.statusText}`);const N=await y.json();r(u(N))}catch(y){l(y instanceof Error?y.message:"Failed to fetch log level")}finally{n(!1)}}}f()},[t]),{logLevel:s,isLoading:a,error:o,success:c,setLogLevel:async f=>{if(t){n(!0),l(null),d(!1);try{const y=await fetch(`/ui/api/v1/proxy/${t}/log_level?log_level=${f}`,{method:"POST"});if(!y.ok)throw new Error(`Failed to update log level: ${y.statusText}`);const N=await y.json();if(N.status==="success"&&N.message.includes(f))r(f),d(!0),setTimeout(()=>d(!1),3e3);else throw new Error("Failed to update log level: Unexpected response")}catch(y){l(y instanceof Error?y.message:"Failed to update log level")}finally{n(!1)}}}}}const Iu=["debug","info","warn","error"];function Fu({nodeName:t,className:s}){const{logLevel:r,isLoading:a,error:n,success:o,setLogLevel:l}=_u(t),c=d=>{l(d)};return e.jsxs("div",{className:"relative flex items-center gap-2",children:[e.jsxs(Tt,{value:r,onValueChange:c,disabled:a,children:[e.jsx(et,{className:v("w-[180px]",s,a&&"opacity-50 cursor-not-allowed"),children:e.jsx(Rt,{placeholder:"Select log level"})}),e.jsx(tt,{children:Iu.map(d=>e.jsx(ze,{value:d,children:d},d))})]}),e.jsx(Ms,{children:e.jsxs(st,{children:[e.jsx(rt,{asChild:!0,children:e.jsxs("div",{className:v("absolute -right-6 transition-all duration-300 ease-in-out",o||n?"opacity-100 translate-x-0":"opacity-0 translate-x-2"),children:[o&&e.jsx(qe,{className:"h-4 w-4 text-green-500 animate-in zoom-in-50 duration-300"}),n&&e.jsx(nt,{className:"h-4 w-4 text-red-500 animate-in zoom-in-50 duration-300"})]})}),e.jsxs(Ue,{side:"right",className:"text-xs",children:[o&&"Log level updated successfully",n&&n]})]})})]})}const ln=i.forwardRef(({className:t,...s},r)=>e.jsx(Br,{className:v("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...s,ref:r,children:e.jsx(di,{className:v("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));ln.displayName=Br.displayName;function Lu(t){return js({tag:"svg",attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zm-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3z"},child:[]}]})(t)}function Pu(t){return js({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M220.8 123.3c1 .5 1.8 1.7 3 1.7 1.1 0 2.8-.4 2.9-1.5.2-1.4-1.9-2.3-3.2-2.9-1.7-.7-3.9-1-5.5-.1-.4.2-.8.7-.6 1.1.3 1.3 2.3 1.1 3.4 1.7zm-21.9 1.7c1.2 0 2-1.2 3-1.7 1.1-.6 3.1-.4 3.5-1.6.2-.4-.2-.9-.6-1.1-1.6-.9-3.8-.6-5.5.1-1.3.6-3.4 1.5-3.2 2.9.1 1 1.8 1.5 2.8 1.4zM420 403.8c-3.6-4-5.3-11.6-7.2-19.7-1.8-8.1-3.9-16.8-10.5-22.4-1.3-1.1-2.6-2.1-4-2.9-1.3-.8-2.7-1.5-4.1-2 9.2-27.3 5.6-54.5-3.7-79.1-11.4-30.1-31.3-56.4-46.5-74.4-17.1-21.5-33.7-41.9-33.4-72C311.1 85.4 315.7.1 234.8 0 132.4-.2 158 103.4 156.9 135.2c-1.7 23.4-6.4 41.8-22.5 64.7-18.9 22.5-45.5 58.8-58.1 96.7-6 17.9-8.8 36.1-6.2 53.3-6.5 5.8-11.4 14.7-16.6 20.2-4.2 4.3-10.3 5.9-17 8.3s-14 6-18.5 14.5c-2.1 3.9-2.8 8.1-2.8 12.4 0 3.9.6 7.9 1.2 11.8 1.2 8.1 2.5 15.7.8 20.8-5.2 14.4-5.9 24.4-2.2 31.7 3.8 7.3 11.4 10.5 20.1 12.3 17.3 3.6 40.8 2.7 59.3 12.5 19.8 10.4 39.9 14.1 55.9 10.4 11.6-2.6 21.1-9.6 25.9-20.2 12.5-.1 26.3-5.4 48.3-6.6 14.9-1.2 33.6 5.3 55.1 4.1.6 2.3 1.4 4.6 2.5 6.7v.1c8.3 16.7 23.8 24.3 40.3 23 16.6-1.3 34.1-11 48.3-27.9 13.6-16.4 36-23.2 50.9-32.2 7.4-4.5 13.4-10.1 13.9-18.3.4-8.2-4.4-17.3-15.5-29.7zM223.7 87.3c9.8-22.2 34.2-21.8 44-.4 6.5 14.2 3.6 30.9-4.3 40.4-1.6-.8-5.9-2.6-12.6-4.9 1.1-1.2 3.1-2.7 3.9-4.6 4.8-11.8-.2-27-9.1-27.3-7.3-.5-13.9 10.8-11.8 23-4.1-2-9.4-3.5-13-4.4-1-6.9-.3-14.6 2.9-21.8zM183 75.8c10.1 0 20.8 14.2 19.1 33.5-3.5 1-7.1 2.5-10.2 4.6 1.2-8.9-3.3-20.1-9.6-19.6-8.4.7-9.8 21.2-1.8 28.1 1 .8 1.9-.2-5.9 5.5-15.6-14.6-10.5-52.1 8.4-52.1zm-13.6 60.7c6.2-4.6 13.6-10 14.1-10.5 4.7-4.4 13.5-14.2 27.9-14.2 7.1 0 15.6 2.3 25.9 8.9 6.3 4.1 11.3 4.4 22.6 9.3 8.4 3.5 13.7 9.7 10.5 18.2-2.6 7.1-11 14.4-22.7 18.1-11.1 3.6-19.8 16-38.2 14.9-3.9-.2-7-1-9.6-2.1-8-3.5-12.2-10.4-20-15-8.6-4.8-13.2-10.4-14.7-15.3-1.4-4.9 0-9 4.2-12.3zm3.3 334c-2.7 35.1-43.9 34.4-75.3 18-29.9-15.8-68.6-6.5-76.5-21.9-2.4-4.7-2.4-12.7 2.6-26.4v-.2c2.4-7.6.6-16-.6-23.9-1.2-7.8-1.8-15 .9-20 3.5-6.7 8.5-9.1 14.8-11.3 10.3-3.7 11.8-3.4 19.6-9.9 5.5-5.7 9.5-12.9 14.3-18 5.1-5.5 10-8.1 17.7-6.9 8.1 1.2 15.1 6.8 21.9 16l19.6 35.6c9.5 19.9 43.1 48.4 41 68.9zm-1.4-25.9c-4.1-6.6-9.6-13.6-14.4-19.6 7.1 0 14.2-2.2 16.7-8.9 2.3-6.2 0-14.9-7.4-24.9-13.5-18.2-38.3-32.5-38.3-32.5-13.5-8.4-21.1-18.7-24.6-29.9s-3-23.3-.3-35.2c5.2-22.9 18.6-45.2 27.2-59.2 2.3-1.7.8 3.2-8.7 20.8-8.5 16.1-24.4 53.3-2.6 82.4.6-20.7 5.5-41.8 13.8-61.5 12-27.4 37.3-74.9 39.3-112.7 1.1.8 4.6 3.2 6.2 4.1 4.6 2.7 8.1 6.7 12.6 10.3 12.4 10 28.5 9.2 42.4 1.2 6.2-3.5 11.2-7.5 15.9-9 9.9-3.1 17.8-8.6 22.3-15 7.7 30.4 25.7 74.3 37.2 95.7 6.1 11.4 18.3 35.5 23.6 64.6 3.3-.1 7 .4 10.9 1.4 13.8-35.7-11.7-74.2-23.3-84.9-4.7-4.6-4.9-6.6-2.6-6.5 12.6 11.2 29.2 33.7 35.2 59 2.8 11.6 3.3 23.7.4 35.7 16.4 6.8 35.9 17.9 30.7 34.8-2.2-.1-3.2 0-4.2 0 3.2-10.1-3.9-17.6-22.8-26.1-19.6-8.6-36-8.6-38.3 12.5-12.1 4.2-18.3 14.7-21.4 27.3-2.8 11.2-3.6 24.7-4.4 39.9-.5 7.7-3.6 18-6.8 29-32.1 22.9-76.7 32.9-114.3 7.2zm257.4-11.5c-.9 16.8-41.2 19.9-63.2 46.5-13.2 15.7-29.4 24.4-43.6 25.5s-26.5-4.8-33.7-19.3c-4.7-11.1-2.4-23.1 1.1-36.3 3.7-14.2 9.2-28.8 9.9-40.6.8-15.2 1.7-28.5 4.2-38.7 2.6-10.3 6.6-17.2 13.7-21.1.3-.2.7-.3 1-.5.8 13.2 7.3 26.6 18.8 29.5 12.6 3.3 30.7-7.5 38.4-16.3 9-.3 15.7-.9 22.6 5.1 9.9 8.5 7.1 30.3 17.1 41.6 10.6 11.6 14 19.5 13.7 24.6zM173.3 148.7c2 1.9 4.7 4.5 8 7.1 6.6 5.2 15.8 10.6 27.3 10.6 11.6 0 22.5-5.9 31.8-10.8 4.9-2.6 10.9-7 14.8-10.4s5.9-6.3 3.1-6.6-2.6 2.6-6 5.1c-4.4 3.2-9.7 7.4-13.9 9.8-7.4 4.2-19.5 10.2-29.9 10.2s-18.7-4.8-24.9-9.7c-3.1-2.5-5.7-5-7.7-6.9-1.5-1.4-1.9-4.6-4.3-4.9-1.4-.1-1.8 3.7 1.7 6.5z"},child:[]}]})(t)}function Du(t){return js({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M0 93.7l183.6-25.3v177.4H0V93.7zm0 324.6l183.6 25.3V268.4H0v149.9zm203.8 28L448 480V268.4H203.8v177.9zm0-380.6v180.1H448V32L203.8 65.7z"},child:[]}]})(t)}const Ou=t=>{const s=t.toLowerCase();return s.includes("darwin")||s.includes("mac")?e.jsx(Lu,{className:"h-4 w-4"}):s.includes("linux")?e.jsx(Pu,{className:"h-4 w-4"}):s.includes("windows")?e.jsx(Du,{className:"h-4 w-4"}):null},$u=t=>{const s=t.toLowerCase();return s==="oss"?"bg-blue-500/20 text-blue-700 dark:bg-blue-500/30 dark:text-blue-300 hover:bg-blue-500/30":s==="enterprise"?"bg-yellow-500/20 text-yellow-700 dark:bg-yellow-500/30 dark:text-yellow-300 hover:bg-yellow-500/30":""};function Mu({build:t,edition:s,os:r,arch:a}){const n=Ou(r);return e.jsxs(ee,{children:[e.jsx(se,{children:e.jsx(ae,{children:"Version Information"})}),e.jsx(te,{children:e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(le,{children:"Version"}),e.jsx("p",{className:"text-sm",children:t.version})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(le,{children:"Branch"}),e.jsx("p",{className:"text-sm",children:t.branch})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(le,{children:"Go Version"}),e.jsx("p",{className:"text-sm",children:t.goVersion})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(le,{children:"Edition"}),e.jsx("div",{children:e.jsx(be,{className:$u(s),children:s.toUpperCase()})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(le,{children:"Architecture"}),e.jsx("p",{className:"text-sm",children:a})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(le,{children:"OS"}),e.jsxs("div",{className:"flex items-center gap-2",children:[n,e.jsx("p",{className:"text-sm",children:r})]})]})]})]})})]})}function Bu({nodeName:t,className:s}){const[r,a]=i.useState({isReady:!1,message:"Checking status..."}),[n,o]=i.useState(!0);return i.useEffect(()=>{const l=async()=>{try{const u=await fetch(`/ui/api/v1/proxy/${t}/ready`),m=await u.text();a({isReady:u.ok&&m.includes("ready"),message:u.ok?"Ready":m})}catch(u){a({isReady:!1,message:u instanceof Error?u.message:"Failed to check status"})}};l();const c=setInterval(l,3e3),d=setInterval(()=>{o(u=>!u)},1e3);return()=>{clearInterval(c),clearInterval(d)}},[t]),e.jsxs("div",{className:v("flex items-center gap-2",s),children:[e.jsx("span",{className:v("text-sm",r.isReady?"text-muted-foreground":"text-red-500"),children:r.message}),e.jsx("div",{className:v("h-2.5 w-2.5 rounded-full transition-opacity duration-150",r.isReady?"bg-green-500":"bg-red-500",n?"opacity-100":"opacity-30")})]})}const zu=[{name:"allocs",description:"A sampling of all past memory allocations"},{name:"block",description:"Stack traces that led to blocking on synchronization primitives"},{name:"heap",description:"A sampling of memory allocations of live objects"},{name:"mutex",description:"Stack traces of holders of contended mutexes"},{name:"profile",urlSuffix:"?seconds=15",description:"CPU profile (15 seconds)",displayName:"profile"},{name:"goroutine",description:"Stack traces of all current goroutines (debug=1)",variants:[{suffix:"?debug=0",label:"Basic",description:"Basic goroutine info"},{suffix:"?debug=1",label:"Standard",description:"Standard goroutine stack traces"},{suffix:"?debug=2",label:"Full",description:"Full goroutine stack dump with additional info"}]},{name:"threadcreate",description:"Stack traces that led to the creation of new OS threads",urlSuffix:"?debug=1",displayName:"threadcreate"},{name:"trace",description:"A trace of execution of the current program",urlSuffix:"?debug=1",displayName:"trace"}];function Vu({nodeName:t}){const s=r=>{window.open(`/ui/api/v1/proxy/${t}/debug/pprof/${r}`,"_blank")};return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:"Profiling Tools:"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:zu.map(r=>r.variants?r.variants.map(a=>e.jsxs(st,{children:[e.jsx(rt,{asChild:!0,children:e.jsx(q,{variant:"outline",size:"sm",onClick:()=>s(`${r.name}${a.suffix}`),children:`${r.name} (${a.label})`})}),e.jsx(Ue,{children:e.jsx("p",{children:a.description})})]},`${r.name}${a.suffix}`)):e.jsxs(st,{children:[e.jsx(rt,{asChild:!0,children:e.jsx(q,{variant:"outline",size:"sm",onClick:()=>s(`${r.name}${r.urlSuffix||""}`),children:r.displayName||r.name})}),e.jsx(Ue,{children:e.jsx("p",{children:r.description})})]},r.name))})]})}function Uu(){const{nodeName:t}=Nr(),[s,r]=i.useState("config"),{nodeDetails:a,isLoading:n,error:o}=wu(t),{metrics:l,isLoading:c,error:d}=Nu(t,s==="raw-metrics"),[u,m]=i.useState(!1);return n?e.jsx("div",{className:"container space-y-6 p-6",children:e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-primary border-t-transparent"}),e.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading..."})]})}):a?e.jsx(ke,{children:e.jsxs(ee,{children:[e.jsx(se,{children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex-1",children:e.jsx(ae,{children:e.jsx("h2",{className:"text-3xl font-semibold tracking-tight",children:e.jsxs("div",{className:"flex items-center gap-2",children:[a.target," - ",t,e.jsx($s,{text:t||""})]})})})}),e.jsx(Bu,{nodeName:t||""})]})}),e.jsxs(te,{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(Mu,{build:a.build,edition:a.edition,os:a.os,arch:a.arch}),e.jsxs(ee,{children:[e.jsx(se,{children:e.jsx(ae,{children:"Cluster Information"})}),e.jsx(te,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(le,{children:"Cluster ID"}),e.jsx("p",{className:"text-sm",children:a.clusterID})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(le,{children:"Created"}),e.jsx("p",{className:"text-sm",children:wt(a.clusterSeededAt,"PPpp")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(le,{children:"Storage"}),e.jsx("p",{children:e.jsx(Ru,{type:(a.metrics.store_object_type||"filesystem").toLowerCase(),className:""})})]})]})})]}),e.jsxs(ee,{children:[e.jsxs(se,{className:"flex flex-row items-center justify-between",children:[e.jsx(ae,{children:"Service Status"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(le,{htmlFor:"view-mode",children:"Table View"}),e.jsx(ln,{id:"view-mode",checked:u,onCheckedChange:m})]})]}),e.jsx(te,{children:u?e.jsx(Cu,{services:a.services}):e.jsx(Su,{services:a.services})})]})]}),e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mr-4",children:[e.jsx(le,{children:"Log Level"}),e.jsx(Fu,{nodeName:t||""})]}),e.jsx(Vu,{nodeName:t||""})]}),e.jsx("div",{children:e.jsxs(od,{defaultValue:"config",onValueChange:r,children:[e.jsxs(Qa,{children:[e.jsx(yt,{value:"config",children:"Configuration"}),e.jsx(yt,{value:"metrics",children:"Analytics"}),e.jsx(yt,{value:"raw-metrics",children:"Raw Metrics"})]}),e.jsx(vt,{value:"config",className:"mt-6",children:e.jsx(as,{language:"yaml",code:a.config,fileName:"loki.yaml"})}),e.jsx(vt,{value:"metrics",className:"mt-6",children:a.metrics&&e.jsx(as,{code:JSON.stringify(a.metrics,null,2),language:"json",fileName:"analytics.json"})}),e.jsx(vt,{value:"raw-metrics",className:"mt-6",children:c?e.jsxs("div",{className:"flex items-center justify-center p-6",children:[e.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-primary border-t-transparent"}),e.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading metrics..."})]}):d?e.jsx("div",{className:"bg-red-50 dark:bg-red-900 border-l-4 border-red-400 p-4",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-200",children:d})}):l?e.jsx(as,{code:l,language:"yaml",fileName:"metrics"}):null})]})})]})]})}):e.jsx("div",{className:"container space-y-6 p-6",children:e.jsx("div",{className:"bg-red-50 dark:bg-red-900 border-l-4 border-red-400 p-4",children:e.jsx("div",{className:"flex",children:e.jsx("div",{className:"ml-3",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-200",children:o||`Node "${t}" not found`})})})})})}function qu(){return e.jsx(Xa,{children:e.jsx(Uu,{})})}function Ae(){return e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[80vh] p-4",children:[e.jsx(Uo,{className:"h-16 w-16 text-muted-foreground mb-6"}),e.jsx("h1",{className:"text-4xl font-bold text-center mb-4",children:"Coming Soon"}),e.jsx("p",{className:"text-lg text-muted-foreground text-center max-w-md",children:"We're working hard to bring you this feature. Stay tuned for updates!"})]})}const cn=Ee("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-sm hover:bg-accent hover:text-accent-foreground"},size:{default:"h-9 px-2 min-w-9",sm:"h-8 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}}),Gu=i.forwardRef(({className:t,variant:s,size:r,...a},n)=>e.jsx(zr,{ref:n,className:v(cn({variant:s,size:r,className:t})),...a}));Gu.displayName=zr.displayName;const dn=i.createContext({size:"default",variant:"default"}),un=i.forwardRef(({className:t,variant:s,size:r,children:a,...n},o)=>e.jsx(Vr,{ref:o,className:v("flex items-center justify-center gap-1",t),...n,children:e.jsx(dn.Provider,{value:{variant:s,size:r},children:a})}));un.displayName=Vr.displayName;const pn=i.forwardRef(({className:t,children:s,variant:r,size:a,...n},o)=>{const l=i.useContext(dn);return e.jsx(Ur,{ref:o,className:v(cn({variant:l.variant||r,size:l.size||a}),t),...n,children:s})});pn.displayName=Ur.displayName;const _t={Received:"received",Processing:"processed"},Hu=t=>{const{cluster:s}=ue(),r=i.useMemo(()=>Oe(s==null?void 0:s.members,ya.compactor),[s==null?void 0:s.members]),{data:a,isLoading:n,error:o}=Mt({queryKey:["deletes",t,r],queryFn:async()=>{try{return(await Promise.all(t.map(async c=>{const d=await fetch(`/ui/api/v1/proxy/${r}/compactor/ui/api/v1/deletes?status=${c}`);if(!d.ok){const u=await d.text();throw new Error(u||`HTTP error! status: ${d.status}`)}return d.json()}))).flat()}catch(l){throw l instanceof Error?l:new Error("Failed to fetch delete requests")}},enabled:!!r});return{data:a,isLoading:n,error:o}},Ku=({selectedStatus:t,onStatusChange:s,queryFilter:r,onQueryFilterChange:a})=>e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:"Status"}),e.jsx(un,{type:"multiple",value:t,onValueChange:n=>{n.length>0&&s(n)},className:"justify-start",children:Object.entries(_t).map(([n,o])=>e.jsx(pn,{value:o,"aria-label":`Toggle ${n.toLowerCase()} status`,className:"capitalize",children:n},o))})]}),e.jsx(xe,{type:"search",placeholder:"Filter by query...",value:r,onChange:n=>a(n.target.value),className:"w-[300px]"})]}),Wu=({status:t})=>{const s=t===_t.Received?"secondary":"default";return e.jsx(be,{variant:s,className:"capitalize",children:t})},Zu=({start:t,end:s})=>{const r=Jo(Zs(t/1e3),Zs(s/1e3)),a=n=>{const o=new Date(n);return wt(new Date(o.getTime()+o.getTimezoneOffset()*6e4),"yyyy-MM-dd HH:mm:ss")};return e.jsxs(Vt,{children:[e.jsx(Ut,{children:e.jsx("span",{className:"cursor-default",children:r})}),e.jsx(mt,{className:"w-fit",children:e.jsx("div",{className:"space-y-2",children:e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-gray-100 rounded dark:bg-gray-700 w-14 text-center",children:"From"}),e.jsx("span",{className:"font-mono",children:a(t)})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-gray-100 rounded dark:bg-gray-700 w-14 text-center",children:"To"}),e.jsx("span",{className:"font-mono",children:a(s)})]})]})})})]})},Yu=({requests:t,sortField:s,sortDirection:r,onSort:a})=>{const n=[...t].sort((o,l)=>{let c=0,d,u;switch(s){case"status":c=o.status.localeCompare(l.status);break;case"user":c=o.user_id.localeCompare(l.user_id);break;case"createdAt":c=o.created_at-l.created_at;break;case"duration":d=o.end_time-o.start_time,u=l.end_time-l.start_time,c=d-u;break}return r==="asc"?c:-c});return e.jsx("div",{className:"rounded-md border bg-card",children:e.jsxs(Ce,{children:[e.jsx(Te,{children:e.jsxs(X,{className:"hover:bg-transparent",children:[e.jsx(D,{className:"w-[80px]",children:e.jsx(Z,{title:"Status",field:"status",sortField:s,sortDirection:r,onSort:a})}),e.jsx(D,{className:"w-[100px]",children:e.jsx(Z,{title:"User",field:"user",sortField:s,sortDirection:r,onSort:a})}),e.jsx(D,{className:"w-[200px]",children:e.jsx(Z,{title:"Created At",field:"createdAt",sortField:s,sortDirection:r,onSort:a})}),e.jsx(D,{className:"w-[150px]",children:e.jsx(Z,{title:"Range",field:"duration",sortField:s,sortDirection:r,onSort:a})}),e.jsx(D,{className:"w-[100px]",children:"Deleted Lines"}),e.jsx(D,{children:"Query"})]})}),e.jsxs(Re,{children:[n.map(o=>e.jsxs(X,{children:[e.jsx(F,{className:"px-4",children:e.jsx(Wu,{status:o.status})}),e.jsx(F,{children:o.user_id}),e.jsx(F,{children:e.jsx(Os,{date:new Date(o.created_at)})}),e.jsx(F,{children:e.jsx(Zu,{start:o.start_time,end:o.end_time})}),e.jsx(F,{children:o.deleted_lines}),e.jsx(F,{children:e.jsx("code",{className:"font-mono text-sm whitespace-pre-wrap break-all",children:o.query})})]},`${o.request_id}-${o.start_time}-${o.end_time}`)),n.length===0&&e.jsx(X,{children:e.jsx(F,{colSpan:7,className:"h-24 text-center",children:e.jsx("div",{className:"text-muted-foreground",children:"No delete requests found"})})})]})]})})},Xu=()=>{const[t,s]=i.useState([_t.Received,_t.Processing]),[r,a]=i.useState(""),[n,o]=i.useState("createdAt"),[l,c]=i.useState("desc"),{data:d,isLoading:u,error:m}=Hu(t),f=i.useMemo(()=>!d||!r?d:d.filter(N=>N.query.toLowerCase().includes(r.toLowerCase())),[d,r]),y=N=>{N===n?c(l==="asc"?"desc":"asc"):(o(N),c("desc"))};return e.jsx(ke,{children:e.jsxs(ee,{className:"shadow-sm",children:[e.jsx(se,{children:e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-3xl font-semibold tracking-tight",children:"Delete Requests"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"View and manage delete requests in your cluster"})]}),e.jsx(q,{variant:"default",asChild:!0,children:e.jsxs(ce,{to:"/tenants/deletes/new",children:[e.jsx(qo,{className:"mr-2 h-4 w-4"}),"New Delete Request"]})})]}),e.jsx(Ku,{selectedStatus:t,onStatusChange:s,queryFilter:r,onQueryFilterChange:a})]})}),e.jsx(te,{children:e.jsxs("div",{className:"space-y-4",children:[m&&e.jsxs(Ge,{variant:"destructive",children:[e.jsx(nt,{className:"h-4 w-4"}),e.jsx(He,{children:"Error"}),e.jsx(Ke,{children:m.message})]}),u&&e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx(he,{className:"h-16 w-16 animate-spin"})}),!u&&!m&&f&&e.jsx(Yu,{requests:f,sortField:n,sortDirection:l,onSort:y})]})})]})})},mn=Pi,gn=i.createContext({}),Ie=({...t})=>e.jsx(gn.Provider,{value:{name:t.name},children:e.jsx(Di,{...t})}),Wt=()=>{const t=i.useContext(gn),s=i.useContext(fn),{getFieldState:r,formState:a}=Li(),n=r(t.name,a);if(!t)throw new Error("useFormField should be used within <FormField>");const{id:o}=s;return{id:o,name:t.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...n}},fn=i.createContext({}),ve=i.forwardRef(({className:t,...s},r)=>{const a=i.useId();return e.jsx(fn.Provider,{value:{id:a},children:e.jsx("div",{ref:r,className:v("space-y-2",t),...s})})});ve.displayName="FormItem";const fe=i.forwardRef(({className:t,...s},r)=>{const{error:a,formItemId:n}=Wt();return e.jsx(le,{ref:r,className:v(a&&"text-destructive",t),htmlFor:n,...s})});fe.displayName="FormLabel";const je=i.forwardRef(({...t},s)=>{const{error:r,formItemId:a,formDescriptionId:n,formMessageId:o}=Wt();return e.jsx(Se,{ref:s,id:a,"aria-describedby":r?`${n} ${o}`:`${n}`,"aria-invalid":!!r,...t})});je.displayName="FormControl";const hn=i.forwardRef(({className:t,...s},r)=>{const{formDescriptionId:a}=Wt();return e.jsx("p",{ref:r,id:a,className:v("text-[0.8rem] text-muted-foreground",t),...s})});hn.displayName="FormDescription";const we=i.forwardRef(({className:t,children:s,...r},a)=>{const{error:n,formMessageId:o}=Wt(),l=n?String(n==null?void 0:n.message):s;return l?e.jsx("p",{ref:a,id:o,className:v("text-[0.8rem] font-medium text-destructive",t),...r,children:l}):null});we.displayName="FormMessage";const xn=i.forwardRef(({className:t,...s},r)=>e.jsx("textarea",{className:v("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:r,...s}));xn.displayName="Textarea";var Qu=function(t,s){for(var r={};t.length;){var a=t[0],n=a.code,o=a.message,l=a.path.join(".");if(!r[l])if("unionErrors"in a){var c=a.unionErrors[0].errors[0];r[l]={message:c.message,type:c.code}}else r[l]={message:o,type:n};if("unionErrors"in a&&a.unionErrors.forEach(function(m){return m.errors.forEach(function(f){return t.push(f)})}),s){var d=r[l].types,u=d&&d[a.code];r[l]=Mi(l,s,r,n,u?[].concat(u,a.message):a.message)}t.shift()}return r},bn=function(t,s,r){return r===void 0&&(r={}),function(a,n,o){try{return Promise.resolve(function(l,c){try{var d=Promise.resolve(t[r.mode==="sync"?"parse":"parseAsync"](a,s)).then(function(u){return o.shouldUseNativeValidation&&Oi({},o),{errors:{},values:r.raw?a:u}})}catch(u){return c(u)}return d&&d.then?d.then(void 0,c):d}(0,function(l){if(function(c){return Array.isArray(c==null?void 0:c.errors)}(l))return{values:{},errors:$i(Qu(l.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw l}))}catch(l){return Promise.reject(l)}}};const Ju=ia({tenant_id:Ye().min(1,"Tenant ID is required"),query:Ye().min(1,"Query is required"),start_time:Xs(),end_time:Xs().refine(t=>t>new Date(Date.now()-7*24*60*60*1e3),"End time must be after start time")}),ep=()=>{const t=It(),s=Ai(),[r,a]=i.useState(null),[n,o]=i.useState(!1),{cluster:l}=ue(),c=i.useMemo(()=>Oe(l==null?void 0:l.members,ya.compactor),[l==null?void 0:l.members]),d=la({resolver:bn(Ju),defaultValues:{tenant_id:"",query:"",start_time:new Date(Date.now()-7*24*60*60*1e3),end_time:new Date}}),u=i.useCallback(async(N,h=!1)=>{if(N.trim()){o(!0);try{const p=await fetch(`/ui/api/v1/proxy/${c}/loki/api/v1/format_query?query=${N}`,{method:"POST"}),g=await p.json();if(!p.ok||g.status==="invalid-query")throw new Error(g.error||"Invalid LogQL query");d.clearErrors("query"),h&&d.setValue("query",g.data)}catch(p){d.setError("query",{message:p instanceof Error?p.message:"Invalid LogQL query"})}finally{o(!1)}}},[d,c]),m=i.useMemo(()=>ki(N=>u(N,!1),1e3),[u]),f=async N=>{const h=new URLSearchParams;h.append("query",N.query),h.append("start",Math.floor(N.start_time.getTime()/1e3).toString()),h.append("end",Math.floor(N.end_time.getTime()/1e3).toString());try{const p=await fetch(`/ui/api/v1/proxy/${c}/compactor/ui/api/v1/deletes?${h.toString()}`,{method:"POST",headers:{"X-Scope-OrgID":N.tenant_id}});if(!p.ok){const g=await p.text();throw new Error(g||"Failed to create delete request")}await s.invalidateQueries({queryKey:["deletes"]}),t("/tenants/deletes")}catch(p){console.error("Error creating delete request:",p),a(p instanceof Error?p.message:"Failed to create delete request")}},y=i.useMemo(()=>{const N=d.watch("start_time"),h=d.watch("end_time");return ei(ti({start:N,end:h}),{format:["years","months","weeks","days","hours","minutes"],zero:!1})},[d]);return e.jsx(ke,{children:e.jsxs(ee,{children:[e.jsx(se,{children:e.jsx(ae,{children:"New Delete Request"})}),e.jsxs(te,{children:[r&&e.jsxs(Ge,{variant:"destructive",className:"mb-6",children:[e.jsx(nt,{className:"h-4 w-4"}),e.jsx(He,{children:"Error"}),e.jsx(Ke,{children:r})]}),e.jsx(mn,{...d,children:e.jsxs("form",{onSubmit:d.handleSubmit(f),className:"space-y-8",children:[e.jsx(Ie,{control:d.control,name:"tenant_id",render:({field:N})=>e.jsxs(ve,{children:[e.jsx(fe,{children:"TENANT ID"}),e.jsx(je,{children:e.jsx(xe,{placeholder:"Enter tenant ID",...N})}),e.jsx(we,{})]})}),e.jsx(Ie,{control:d.control,name:"query",render:({field:N})=>e.jsxs(ve,{children:[e.jsx(fe,{children:"LOGQL QUERY"}),e.jsx(je,{children:e.jsxs("div",{className:"relative",children:[e.jsx(xn,{placeholder:'{app="example"}',className:"font-mono",...N,onChange:h=>{N.onChange(h),m(h.target.value)},onBlur:async h=>{N.onBlur(),h.target.value&&await u(h.target.value,!0)}}),n&&e.jsx("div",{className:"absolute right-3 top-3",children:e.jsx(he,{className:"h-5 w-5 animate-spin"})})]})}),e.jsx(hn,{children:"Enter a LogQL query with labels in curly braces"}),e.jsx(we,{})]})}),e.jsxs("div",{className:"grid grid-cols-3 gap-8",children:[e.jsx(Ie,{control:d.control,name:"start_time",render:({field:N})=>e.jsxs(ve,{children:[e.jsx(fe,{children:"START TIME"}),e.jsx(je,{children:e.jsx(Ys,{selected:N.value,onChange:N.onChange,showTimeSelect:!0,timeFormat:"HH:mm",timeIntervals:15,dateFormat:"yyyy-MM-dd HH:mm",className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"})}),e.jsx(we,{})]})}),e.jsx(Ie,{control:d.control,name:"end_time",render:({field:N})=>e.jsxs(ve,{children:[e.jsx(fe,{children:"END TIME"}),e.jsx(je,{children:e.jsx(Ys,{selected:N.value,onChange:N.onChange,showTimeSelect:!0,timeFormat:"HH:mm",timeIntervals:15,dateFormat:"yyyy-MM-dd HH:mm",minDate:d.watch("start_time"),className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"})}),e.jsx(we,{})]})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(fe,{children:"DURATION"}),e.jsx("div",{className:"h-10 flex items-center",children:e.jsx("span",{className:"text-sm text-muted-foreground",children:y})})]})]}),e.jsxs("div",{className:"flex justify-end space-x-3 pt-6 border-t",children:[e.jsx(q,{type:"button",variant:"outline",onClick:()=>t("/tenants/deletes"),children:"Cancel"}),e.jsx(q,{type:"submit",disabled:!d.formState.isValid||d.formState.isSubmitting,children:d.formState.isSubmitting?"Creating...":"Create Delete Request"})]})]})})]})]})})},tp={light:"",dark:".dark"},yn=i.createContext(null);function vn(){const t=i.useContext(yn);if(!t)throw new Error("useChart must be used within a <ChartContainer />");return t}const jn=i.forwardRef(({id:t,className:s,children:r,config:a,...n},o)=>{const l=i.useId(),c=`chart-${t||l.replace(/:/g,"")}`;return e.jsx(yn.Provider,{value:{config:a},children:e.jsxs("div",{"data-chart":c,ref:o,className:v("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",s),...n,children:[e.jsx(sp,{id:c,config:a}),e.jsx(ct,{children:r})]})})});jn.displayName="Chart";const sp=({id:t,config:s})=>{const r=Object.entries(s).filter(([,a])=>a.theme||a.color);return r.length?e.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(tp).map(([a,n])=>`
${n} [data-chart=${t}] {
${r.map(([o,l])=>{var d;const c=((d=l.theme)==null?void 0:d[a])||l.color;return c?` --color-${o}: ${c};`:null}).join(`
`)}
}
`).join(`
`)}}):null},rp=dt,wn=i.forwardRef(({active:t,payload:s,className:r,indicator:a="dot",hideLabel:n=!1,hideIndicator:o=!1,label:l,labelFormatter:c,labelClassName:d,formatter:u,color:m,nameKey:f,labelKey:y},N)=>{const{config:h}=vn(),p=i.useMemo(()=>{var E;if(n||!(s!=null&&s.length))return null;const[x]=s,b=`${y||x.dataKey||x.name||"value"}`,j=gs(h,x,b),w=!y&&typeof l=="string"?((E=h[l])==null?void 0:E.label)||l:j==null?void 0:j.label;return c?e.jsx("div",{className:v("font-medium",d),children:c(w,s)}):w?e.jsx("div",{className:v("font-medium",d),children:w}):null},[l,c,s,n,d,h,y]);if(!t||!(s!=null&&s.length))return null;const g=s.length===1&&a!=="dot";return e.jsxs("div",{ref:N,className:v("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",r),children:[g?null:p,e.jsx("div",{className:"grid gap-1.5",children:s.map((x,b)=>{const j=`${f||x.name||x.dataKey||"value"}`,w=gs(h,x,j),E=m||x.payload.fill||x.color;return e.jsx("div",{className:v("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",a==="dot"&&"items-center"),children:u&&(x==null?void 0:x.value)!==void 0&&x.name?u(x.value,x.name,x,b,x.payload):e.jsxs(e.Fragment,{children:[w!=null&&w.icon?e.jsx(w.icon,{}):!o&&e.jsx("div",{className:v("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":a==="dot","w-1":a==="line","w-0 border-[1.5px] border-dashed bg-transparent":a==="dashed","my-0.5":g&&a==="dashed"}),style:{"--color-bg":E,"--color-border":E}}),e.jsxs("div",{className:v("flex flex-1 justify-between leading-none",g?"items-end":"items-center"),children:[e.jsxs("div",{className:"grid gap-1.5",children:[g?p:null,e.jsx("span",{className:"text-muted-foreground",children:(w==null?void 0:w.label)||x.name})]}),x.value&&e.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:x.value.toLocaleString()})]})]})},x.dataKey)})})]})});wn.displayName="ChartTooltip";const ap=i.forwardRef(({className:t,hideIcon:s=!1,payload:r,verticalAlign:a="bottom",nameKey:n},o)=>{const{config:l}=vn();return r!=null&&r.length?e.jsx("div",{ref:o,className:v("flex items-center justify-center gap-4",a==="top"?"pb-3":"pt-3",t),children:r.map(c=>{const d=`${n||c.dataKey||"value"}`,u=gs(l,c,d);return e.jsxs("div",{className:v("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[u!=null&&u.icon&&!s?e.jsx(u.icon,{}):e.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:c.color}}),u==null?void 0:u.label]},c.value)})}):null});ap.displayName="ChartLegend";function gs(t,s,r){if(typeof s!="object"||s===null)return;const a="payload"in s&&typeof s.payload=="object"&&s.payload!==null?s.payload:void 0;let n=r;return r in s&&typeof s[r]=="string"?n=s[r]:a&&r in a&&typeof a[r]=="string"&&(n=a[r]),n in t?t[n]:t[r]}const np=ji,op=wi,ip=Ni,lp=ia({tenant:Ye().min(1,"Tenant ID is required"),since:Ye(),matcher:Ye().default("{}")}),cp=[{value:"1h",label:"Last 1 hour"},{value:"3h",label:"Last 3 hours"},{value:"6h",label:"Last 6 hours"},{value:"12h",label:"Last 12 hours"},{value:"24h",label:"Last 24 hours"}];function dp({values:t,totalValues:s}){return e.jsx("div",{className:"space-y-2 py-2",children:t.map(({value:r,count:a})=>e.jsxs("div",{className:"grid grid-cols-[200px_1fr_80px] items-center gap-4",children:[e.jsx(be,{variant:"outline",className:"font-mono text-xs justify-self-start overflow-hidden",children:r}),e.jsx("div",{className:"h-2 bg-muted rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-primary",style:{width:`${a/s*100}%`}})}),e.jsxs("span",{className:"text-xs text-muted-foreground tabular-nums justify-self-end",children:[(a/s*100).toFixed(1),"%"]})]},r))})}function up(){const{cluster:t}=ue(),{toast:s}=zt(),[r,a]=i.useState(null),[n,o]=i.useState("uniqueValues"),[l,c]=i.useState("desc"),[d,u]=i.useState("uniqueValues"),[m,f]=i.useState(new Set),y=la({resolver:bn(lp),defaultValues:{matcher:"{}",since:"1h"}}),N=Oe(t==null?void 0:t.members,"query-frontend"),{isLoading:h,refetch:p}=Mt({queryKey:["analyze-labels"],queryFn:async()=>{try{const w=y.getValues(),E=new Date,C=new Date(E.getTime()-pp(w.since)),A=await fetch(`/ui/api/v1/proxy/${N}/loki/api/v1/series?match[]=${encodeURIComponent(w.matcher)}&start=${C.getTime()*1e6}&end=${E.getTime()*1e6}`,{headers:{"X-Scope-OrgID":w.tenant}});if(!A.ok){const M=await A.text();throw new Error(M||"Failed to fetch series")}const B=await A.json(),z=new Map,Y=new Map;B.data.forEach(M=>{Object.entries(M).forEach(([W,T])=>{z.has(W)||(z.set(W,{uniqueValues:new Set,inStreams:0}),Y.set(W,new Map));const O=z.get(W),V=Y.get(W);O.uniqueValues.add(T),O.inStreams++,V.set(T,(V.get(T)||0)+1)})});const K=Array.from(z.entries()).map(([M,W])=>{const T=Array.from(Y.get(M).entries()).map(([O,V])=>({value:O,count:V})).sort((O,V)=>V.count-O.count).slice(0,5);return{name:M,uniqueValues:W.uniqueValues.size,inStreams:W.inStreams,sampleValues:T}});return K.sort((M,W)=>W.uniqueValues-M.uniqueValues),a({totalStreams:B.data.length,uniqueLabels:z.size,labels:K}),B}catch(w){throw s({variant:"destructive",title:"Error analyzing labels",description:w instanceof Error?w.message:"An unexpected error occurred"}),w}},enabled:!1});function g(){p()}const x=i.useMemo(()=>{const w=document.createElement("style"),E=(r==null?void 0:r.labels.slice(0,10).map((C,A)=>{const B=A*137.5%360;return`--chart-color-${A}: hsl(${B}, 70%, 50%);`}).join(`
`))||"";return w.textContent=`:root { ${E} }`,document.head.appendChild(w),()=>w.remove()},[r]);i.useEffect(()=>x,[x]);const b={value:{label:d==="uniqueValues"?"Unique Values":"Found In Streams",theme:{light:"var(--chart-color-0)",dark:"var(--chart-color-0)"}}},j=i.useMemo(()=>r?[...r.labels].sort((w,E)=>{let C=0;switch(n){case"name":C=w.name.localeCompare(E.name);break;case"uniqueValues":C=w.uniqueValues-E.uniqueValues;break;case"inStreams":C=w.inStreams-E.inStreams;break;case"cardinality":C=w.uniqueValues/w.inStreams-E.uniqueValues/E.inStreams;break}return l==="asc"?C:-C}):[],[r,n,l]);return e.jsxs("div",{className:"container mx-auto p-4 space-y-6",children:[e.jsxs(ee,{children:[e.jsxs(se,{children:[e.jsx(ae,{children:"Analyze Labels"}),e.jsx(Qe,{children:"Analyze label distribution across your log streams"})]}),e.jsx(te,{children:e.jsx(mn,{...y,children:e.jsxs("form",{onSubmit:y.handleSubmit(g),className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[e.jsx(Ie,{control:y.control,name:"tenant",render:({field:w})=>e.jsxs(ve,{className:"flex flex-col space-y-1.5",children:[e.jsx(fe,{children:"Tenant ID"}),e.jsx(je,{children:e.jsx(xe,{placeholder:"Enter tenant ID...",...w})}),e.jsx(we,{className:"text-xs"})]})}),e.jsx(Ie,{control:y.control,name:"since",render:({field:w})=>e.jsxs(ve,{className:"flex flex-col space-y-1.5",children:[e.jsx(fe,{children:"Time Range"}),e.jsxs(Tt,{onValueChange:w.onChange,defaultValue:w.value,children:[e.jsx(je,{children:e.jsx(et,{children:e.jsx(Rt,{placeholder:"Select time range"})})}),e.jsx(tt,{children:cp.map(E=>e.jsx(ze,{value:E.value,children:E.label},E.value))})]}),e.jsx(we,{className:"text-xs"})]})}),e.jsx(Ie,{control:y.control,name:"matcher",render:({field:w})=>e.jsxs(ve,{className:"flex flex-col space-y-1.5",children:[e.jsx(fe,{children:"Matcher"}),e.jsx(je,{children:e.jsx(xe,{placeholder:"Enter matcher... (default: {})",...w})}),e.jsx(we,{className:"text-xs"})]})}),e.jsx(q,{type:"submit",disabled:h,className:"self-end h-10",children:h?"Analyzing...":"Analyze"})]})})})]}),r&&e.jsxs(e.Fragment,{children:[e.jsxs(ee,{children:[e.jsxs(se,{className:"flex flex-col items-stretch space-y-0 border-b p-0 sm:flex-row",children:[e.jsxs("div",{className:"flex flex-1 flex-col justify-center gap-1 px-6 py-5 sm:py-6",children:[e.jsx(ae,{children:"Label Distribution"}),e.jsx(Qe,{children:"Top 20 labels by unique values"})]}),e.jsxs("div",{className:"flex",children:[e.jsxs("div",{className:"relative z-30 flex flex-1 flex-col justify-center gap-1 px-6 py-4 text-left sm:px-8 sm:py-6",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Total Streams"}),e.jsx("span",{className:"text-lg font-bold leading-none sm:text-3xl",children:r.totalStreams.toLocaleString()})]}),e.jsxs("div",{className:"relative z-30 flex flex-1 flex-col justify-center gap-1 border-l px-6 py-4 text-left sm:px-8 sm:py-6",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Unique Labels"}),e.jsx("span",{className:"text-lg font-bold leading-none sm:text-3xl",children:r.uniqueLabels.toLocaleString()})]})]})]}),e.jsxs(te,{className:"px-2 sm:p-6",children:[e.jsx("div",{className:"mb-4",children:e.jsxs(Tt,{value:d,onValueChange:w=>u(w),children:[e.jsx(et,{className:"w-[200px]",children:e.jsx(Rt,{placeholder:"Select metric"})}),e.jsxs(tt,{children:[e.jsx(ze,{value:"uniqueValues",children:"Unique Values"}),e.jsx(ze,{value:"inStreams",children:"Found In Streams"})]})]})}),e.jsx(jn,{config:b,className:"aspect-auto h-[500px] w-full",children:e.jsxs(Si,{data:r.labels.slice(0,20).map((w,E)=>({name:w.name,value:d==="uniqueValues"?w.uniqueValues:w.inStreams,fill:`var(--chart-color-${E})`})),layout:"vertical",margin:{right:24},barSize:452/Math.min(20,r.labels.length)*.6,maxBarSize:24,children:[e.jsx(Ei,{horizontal:!1}),e.jsx(Ci,{dataKey:"name",type:"category",tickLine:!1,axisLine:!1,width:90,fontSize:11,interval:0}),e.jsx(Ti,{type:"number",tickLine:!1,axisLine:!1,tickMargin:8}),e.jsx(rp,{content:e.jsx(wn,{className:"w-[200px]"})}),e.jsx(Ri,{dataKey:"value",fillOpacity:.8,radius:[4,4,0,0]})]})})]})]}),e.jsxs(ee,{children:[e.jsx(se,{children:e.jsx(ae,{children:"Label Details"})}),e.jsx(te,{children:e.jsxs(Ce,{children:[e.jsx(Te,{children:e.jsxs(X,{children:[e.jsx(D,{children:e.jsx(Z,{title:"Label Name",field:"name",sortField:n,sortDirection:l,onSort:w=>{w===n?c(l==="asc"?"desc":"asc"):(o(w),c("desc"))}})}),e.jsx(D,{children:e.jsx(Z,{title:"Unique Values",field:"uniqueValues",sortField:n,sortDirection:l,onSort:w=>{w===n?c(l==="asc"?"desc":"asc"):(o(w),c("desc"))}})}),e.jsx(D,{children:e.jsx(Z,{title:"Found In Streams",field:"inStreams",sortField:n,sortDirection:l,onSort:w=>{w===n?c(l==="asc"?"desc":"asc"):(o(w),c("desc"))}})}),e.jsx(D,{children:e.jsx(Z,{title:"Cardinality %",field:"cardinality",sortField:n,sortDirection:l,onSort:w=>{w===n?c(l==="asc"?"desc":"asc"):(o(w),c("desc"))}})})]})}),e.jsx(Re,{children:j.map(w=>e.jsx(np,{asChild:!0,open:m.has(w.name),onOpenChange:E=>{const C=new Set(m);E?C.add(w.name):C.delete(w.name),f(C)},children:e.jsxs(e.Fragment,{children:[e.jsxs(X,{children:[e.jsx(F,{className:"font-medium",children:e.jsxs(op,{className:"flex items-center gap-2 hover:text-primary",children:[e.jsx(ot,{className:v("h-4 w-4 transition-transform",m.has(w.name)&&"rotate-180")}),w.name]})}),e.jsx(F,{children:w.uniqueValues.toLocaleString()}),e.jsx(F,{children:w.inStreams.toLocaleString()}),e.jsxs(F,{children:[(w.uniqueValues/w.inStreams*100).toFixed(2),"%"]})]}),e.jsx(ip,{asChild:!0,children:e.jsx(X,{children:e.jsx(F,{colSpan:4,className:"border-t-0 bg-muted/5",children:e.jsx("div",{className:"px-4",children:e.jsx(dp,{values:w.sampleValues,totalValues:w.inStreams})})})})})]})},w.name))})]})})]})]})]})}function pp(t){const s=parseInt(t),a=t.slice(-1)==="h"?36e5:0;return s*a}const Nn=[{path:"/",breadcrumb:"Home",element:e.jsx(lr,{})},{path:"/nodes",breadcrumb:"Nodes",element:e.jsx(lr,{})},{path:"/nodes/:nodeName",breadcrumb:Ki,element:e.jsx(qu,{})},{path:"/versions",breadcrumb:"Versions",element:e.jsx(Ae,{})},{path:"/rings",breadcrumb:"Rings",element:e.jsx(or,{})},{path:"/rings/:ringName",breadcrumb:Wi,element:e.jsx(or,{})},{path:"/storage",breadcrumb:"Storage",element:e.jsx(Ae,{})},{path:"/storage/object",breadcrumb:"Object Storage",element:e.jsx(Ae,{})},{path:"/storage/dataobj",breadcrumb:"Data Objects",element:e.jsx(Dc,{})},{path:"/storage/dataobj/metadata",breadcrumb:"File Metadata",element:e.jsx(Yc,{})},{path:"/tenants",breadcrumb:"Tenants",element:e.jsx(Ae,{})},{path:"/tenants/deletes",breadcrumb:"Deletes",element:e.jsx(Xu,{})},{path:"/tenants/deletes/new",element:e.jsx(ep,{}),breadcrumb:"New Delete Request"},{path:"/tenants/analyze-labels",element:e.jsx(up,{}),breadcrumb:"Analyze Labels"},{path:"/tenants/limits",breadcrumb:"Limits",element:e.jsx(Ae,{})},{path:"/tenants/labels",breadcrumb:"Labels",element:e.jsx(Ae,{})},{path:"/rules",breadcrumb:"Rules",element:e.jsx(Ae,{})},{path:"/404",breadcrumb:"404",element:e.jsx(Zi,{})}];function mp(){const t=So(Nn,{disableDefaults:!0});return e.jsx(ks,{children:e.jsx(Ss,{children:t.map(({match:s,breadcrumb:r},a)=>e.jsxs(i.Fragment,{children:[e.jsx(Nt,{className:a===0?"hidden md:block":"",children:a===t.length-1?e.jsx(pa,{children:r}):e.jsx(kt,{asChild:!0,children:e.jsx(ce,{to:s.pathname,children:r})})}),a<t.length-1&&e.jsx(St,{className:a===0?"hidden md:block":""})]},s.pathname))})})}function kn(){const s=window.location.pathname.match(/(.*\/ui\/)/);return(s==null?void 0:s[1])||"/ui/"}function gp(){const{cluster:t,isLoading:s}=ue(),[r,a]=i.useState(!0);i.useEffect(()=>{let l;return s?a(!0):l=setTimeout(()=>{a(!1)},500),()=>{l&&clearTimeout(l)}},[s]);const n=()=>{if(!(t!=null&&t.members))return"v0.0.0";const l=new Map;Object.values(t.members).forEach(u=>{if(!u.build.version)return;const m=u.build.version;l.set(m,(l.get(m)||0)+1)});let c="v0.0.0",d=0;return l.forEach((u,m)=>{u>d&&(d=u,c=m)}),c},o=()=>{if(!(t!=null&&t.members))return[];const l=new Set,c=new Map;return Object.values(t.members).forEach(d=>{const u=d.build.version;l.add(u),c.set(u,{revision:d.build.revision,branch:d.build.branch,buildUser:d.build.buildUser,buildDate:d.build.buildDate,goVersion:d.build.goVersion})}),Array.from(l).map(d=>({version:d??"v0.0.0",info:c.get(d)??{revision:"v0.0.0",branch:"v0.0.0",buildUser:"v0.0.0",buildDate:"v0.0.0",goVersion:"v0.0.0"}}))};return{mostCommonVersion:n(),versionInfos:o(),isLoading:r}}function fp(){const{mostCommonVersion:t,versionInfos:s,isLoading:r}=gp(),[a,n]=i.useState(!1),o=()=>s.map(({version:l,info:c})=>`Version: ${l}
Revision: ${c.revision}
Branch: ${c.branch}
Build User: ${c.buildUser}
Build Date: ${c.buildDate}
Go Version: ${c.goVersion}
`).join(`
`);return e.jsxs(Vt,{open:a,onOpenChange:n,children:[e.jsx(Ut,{asChild:!0,children:e.jsxs("span",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[e.jsx("button",{onClick:()=>n(!a),className:v("transition-opacity duration-200 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 rounded px-1 -mx-1",{"opacity-0":r,"opacity-100":!r}),children:t}),r&&e.jsxs(e.Fragment,{children:[e.jsx(he,{className:"h-3 w-3 animate-spin"}),"Loading..."]})]})}),e.jsx(mt,{side:"bottom",align:"start",className:"w-[400px]",children:e.jsxs("div",{className:"p-2",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("div",{className:"font-semibold",children:"Build Information"}),!r&&s.length>0&&e.jsx($s,{text:o()})]}),e.jsx("div",{className:v("transition-opacity duration-200",{"opacity-0":r,"opacity-100":!r}),children:s.length>0?s.map(({version:l,info:c})=>e.jsxs("div",{className:"mb-2 last:mb-0",children:[e.jsx("div",{className:"font-semibold",children:l}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{children:["Revision: ",c.revision]}),e.jsxs("div",{children:["Branch: ",c.branch]}),e.jsxs("div",{children:["Build User: ",c.buildUser]}),e.jsxs("div",{children:["Build Date: ",c.buildDate]}),e.jsxs("div",{children:["Go Version: ",c.goVersion]})]})]},l)):e.jsx("div",{className:"text-sm text-muted-foreground",children:"No build information available"})}),r&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(he,{className:"h-4 w-4 animate-spin"}),e.jsx("span",{children:"Loading build information..."})]})]})})]})}const ns=768;function hp(){const[t,s]=i.useState(void 0);return i.useEffect(()=>{const r=window.matchMedia(`(max-width: ${ns-1}px)`),a=()=>{s(window.innerWidth<ns)};return r.addEventListener("change",a),s(window.innerWidth<ns),()=>r.removeEventListener("change",a)},[]),!!t}const Vs=i.forwardRef(({className:t,orientation:s="horizontal",decorative:r=!0,...a},n)=>e.jsx(oa,{ref:n,decorative:r,orientation:s,className:v("shrink-0 bg-border",s==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...a}));Vs.displayName=oa.displayName;const xp=ws,bp=Ns,Sn=i.forwardRef(({className:t,...s},r)=>e.jsx(it,{className:v("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...s,ref:r}));Sn.displayName=it.displayName;const yp=Ee("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),En=i.forwardRef(({side:t="right",className:s,children:r,...a},n)=>e.jsxs(bp,{children:[e.jsx(Sn,{}),e.jsxs(lt,{ref:n,className:v(yp({side:t}),s),...a,children:[e.jsxs(aa,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[e.jsx(vs,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]}),r]})]}));En.displayName=lt.displayName;const vp=i.forwardRef(({className:t,...s},r)=>e.jsx(Lt,{ref:r,className:v("text-lg font-semibold text-foreground",t),...s}));vp.displayName=Lt.displayName;const jp=i.forwardRef(({className:t,...s},r)=>e.jsx(Pt,{ref:r,className:v("text-sm text-muted-foreground",t),...s}));jp.displayName=Pt.displayName;function mr({className:t,...s}){return e.jsx("div",{className:v("animate-pulse rounded-md bg-primary/10",t),...s})}const wp="sidebar:state",Np=60*60*24*7,kp="16rem",Sp="18rem",Ep="3rem",Cp="b",Cn=i.createContext(null);function Zt(){const t=i.useContext(Cn);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}const Tn=i.forwardRef(({defaultOpen:t=!0,open:s,onOpenChange:r,className:a,style:n,children:o,...l},c)=>{const d=hp(),[u,m]=i.useState(!1),[f,y]=i.useState(t),N=s??f,h=i.useCallback(b=>{const j=typeof b=="function"?b(N):b;r?r(j):y(j),document.cookie=`${wp}=${j}; path=/; max-age=${Np}`},[r,N]),p=i.useCallback(()=>d?m(b=>!b):h(b=>!b),[d,h,m]);i.useEffect(()=>{const b=j=>{j.key===Cp&&(j.metaKey||j.ctrlKey)&&(j.preventDefault(),p())};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[p]);const g=N?"expanded":"collapsed",x=i.useMemo(()=>({state:g,open:N,setOpen:h,isMobile:d,openMobile:u,setOpenMobile:m,toggleSidebar:p}),[g,N,h,d,u,m,p]);return e.jsx(Cn.Provider,{value:x,children:e.jsx(Ms,{delayDuration:0,children:e.jsx("div",{style:{"--sidebar-width":kp,"--sidebar-width-icon":Ep,...n},className:v("group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar",a),ref:c,...l,children:o})})})});Tn.displayName="SidebarProvider";const Rn=i.forwardRef(({side:t="left",variant:s="sidebar",collapsible:r="offcanvas",className:a,children:n,...o},l)=>{const{isMobile:c,state:d,openMobile:u,setOpenMobile:m}=Zt();return r==="none"?e.jsx("div",{className:v("flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground",a),ref:l,...o,children:n}):c?e.jsx(xp,{open:u,onOpenChange:m,...o,children:e.jsx(En,{"data-sidebar":"sidebar","data-mobile":"true",className:"w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":Sp},side:t,children:e.jsx("div",{className:"flex h-full w-full flex-col",children:n})})}):e.jsxs("div",{ref:l,className:"group peer hidden text-sidebar-foreground md:block","data-state":d,"data-collapsible":d==="collapsed"?r:"","data-variant":s,"data-side":t,children:[e.jsx("div",{className:v("relative h-svh w-[--sidebar-width] bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",s==="floating"||s==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon]")}),e.jsx("div",{className:v("fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] duration-200 ease-linear md:flex",t==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",s==="floating"||s==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l",a),...o,children:e.jsx("div",{"data-sidebar":"sidebar",className:"flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow",children:n})})]})});Rn.displayName="Sidebar";const An=i.forwardRef(({className:t,onClick:s,...r},a)=>{const{toggleSidebar:n}=Zt();return e.jsxs(q,{ref:a,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:v("h-7 w-7",t),onClick:o=>{s==null||s(o),n()},...r,children:[e.jsx(Go,{}),e.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})});An.displayName="SidebarTrigger";const _n=i.forwardRef(({className:t,...s},r)=>{const{toggleSidebar:a}=Zt();return e.jsx("button",{ref:r,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:a,title:"Toggle Sidebar",className:v("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex","[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",t),...s})});_n.displayName="SidebarRail";const In=i.forwardRef(({className:t,...s},r)=>e.jsx("main",{ref:r,className:v("relative flex min-h-svh flex-1 flex-col bg-background","peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",t),...s}));In.displayName="SidebarInset";const Tp=i.forwardRef(({className:t,...s},r)=>e.jsx(xe,{ref:r,"data-sidebar":"input",className:v("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",t),...s}));Tp.displayName="SidebarInput";const Fn=i.forwardRef(({className:t,...s},r)=>e.jsx("div",{ref:r,"data-sidebar":"header",className:v("flex flex-col gap-2 p-2",t),...s}));Fn.displayName="SidebarHeader";const Rp=i.forwardRef(({className:t,...s},r)=>e.jsx("div",{ref:r,"data-sidebar":"footer",className:v("flex flex-col gap-2 p-2",t),...s}));Rp.displayName="SidebarFooter";const Ap=i.forwardRef(({className:t,...s},r)=>e.jsx(Vs,{ref:r,"data-sidebar":"separator",className:v("mx-2 w-auto bg-sidebar-border",t),...s}));Ap.displayName="SidebarSeparator";const Ln=i.forwardRef(({className:t,...s},r)=>e.jsx("div",{ref:r,"data-sidebar":"content",className:v("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",t),...s}));Ln.displayName="SidebarContent";const Pn=i.forwardRef(({className:t,...s},r)=>e.jsx("div",{ref:r,"data-sidebar":"group",className:v("relative flex w-full min-w-0 flex-col p-2",t),...s}));Pn.displayName="SidebarGroup";const _p=i.forwardRef(({className:t,asChild:s=!1,...r},a)=>{const n=s?Se:"div";return e.jsx(n,{ref:a,"data-sidebar":"group-label",className:v("flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opa] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",t),...r})});_p.displayName="SidebarGroupLabel";const Ip=i.forwardRef(({className:t,asChild:s=!1,...r},a)=>{const n=s?Se:"button";return e.jsx(n,{ref:a,"data-sidebar":"group-action",className:v("absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","group-data-[collapsible=icon]:hidden",t),...r})});Ip.displayName="SidebarGroupAction";const Fp=i.forwardRef(({className:t,...s},r)=>e.jsx("div",{ref:r,"data-sidebar":"group-content",className:v("w-full text-sm",t),...s}));Fp.displayName="SidebarGroupContent";const fs=i.forwardRef(({className:t,...s},r)=>e.jsx("ul",{ref:r,"data-sidebar":"menu",className:v("flex w-full min-w-0 flex-col gap-1",t),...s}));fs.displayName="SidebarMenu";const Us=i.forwardRef(({className:t,...s},r)=>e.jsx("li",{ref:r,"data-sidebar":"menu-item",className:v("group/menu-item relative",t),...s}));Us.displayName="SidebarMenuItem";const Lp=Ee("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:!p-0"}},defaultVariants:{variant:"default",size:"default"}}),qs=i.forwardRef(({asChild:t=!1,isActive:s=!1,variant:r="default",size:a="default",tooltip:n,className:o,...l},c)=>{const d=t?Se:"button",{isMobile:u,state:m}=Zt(),f=e.jsx(d,{ref:c,"data-sidebar":"menu-button","data-size":a,"data-active":s,className:v(Lp({variant:r,size:a}),o),...l});return n?(typeof n=="string"&&(n={children:n}),e.jsxs(st,{children:[e.jsx(rt,{asChild:!0,children:f}),e.jsx(Ue,{side:"right",align:"center",hidden:m!=="collapsed"||u,...n})]})):f});qs.displayName="SidebarMenuButton";const Pp=i.forwardRef(({className:t,asChild:s=!1,showOnHover:r=!1,...a},n)=>{const o=s?Se:"button";return e.jsx(o,{ref:n,"data-sidebar":"menu-action",className:v("absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",r&&"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",t),...a})});Pp.displayName="SidebarMenuAction";const Dp=i.forwardRef(({className:t,...s},r)=>e.jsx("div",{ref:r,"data-sidebar":"menu-badge",className:v("pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground","peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",t),...s}));Dp.displayName="SidebarMenuBadge";const Op=i.forwardRef(({className:t,showIcon:s=!1,...r},a)=>{const n=i.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return e.jsxs("div",{ref:a,"data-sidebar":"menu-skeleton",className:v("flex h-8 items-center gap-2 rounded-md px-2",t),...r,children:[s&&e.jsx(mr,{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),e.jsx(mr,{className:"h-4 max-w-[--skeleton-width] flex-1","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":n}})]})});Op.displayName="SidebarMenuSkeleton";const Dn=i.forwardRef(({className:t,...s},r)=>e.jsx("ul",{ref:r,"data-sidebar":"menu-sub",className:v("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",t),...s}));Dn.displayName="SidebarMenuSub";const On=i.forwardRef(({...t},s)=>e.jsx("li",{ref:s,...t}));On.displayName="SidebarMenuSubItem";const $n=i.forwardRef(({asChild:t=!1,size:s="md",isActive:r,className:a,...n},o)=>{const l=t?Se:"a";return e.jsx(l,{ref:o,"data-sidebar":"menu-sub-button","data-size":s,"data-active":r,className:v("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",s==="sm"&&"text-xs",s==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",a),...n})});$n.displayName="SidebarMenuSubButton";function $p(t,s){const[r,a]=i.useState(s);return i.useEffect(()=>{if(!(t!=null&&t.members))return;const n=s.map(o=>o.title==="Rings"&&t.members?{...o,items:el(t.members)}:o);a(n)},[t==null?void 0:t.members,s]),r}const os=[{title:"Cluster",url:"/nodes",icon:e.jsx(Ho,{className:"h-4 w-4"}),items:[{title:"Nodes",url:"/nodes"},{title:"Rollouts & Versions",url:"/versions"}]},{title:"Rings",url:"/rings",icon:e.jsx(Cr,{className:"h-4 w-4"}),items:[]},{title:"Storage",url:"/storage",icon:e.jsx(Ko,{className:"h-4 w-4"}),items:[{title:"Object Storage",url:"/storage/object"},{title:"Data Objects",url:"/storage/dataobj"}]},{title:"Tenants",url:"/tenants",icon:e.jsx(Wo,{className:"h-4 w-4"}),items:[{title:"Analyze Labels",url:"/tenants/analyze-labels"},{title:"Deletes",url:"/tenants/deletes"},{title:"Limits",url:"/tenants/limits"},{title:"Labels",url:"/tenants/labels"}]},{title:"Rules",url:"/rules",icon:e.jsx(Zo,{className:"h-4 w-4"}),items:[]},{title:"Documentation",url:"https://grafana.com/docs/loki/latest/",icon:e.jsx(Yo,{className:"h-4 w-4"}),items:[]}];function Mp(t){return e.jsx(_n,{...t,className:v("after:bg-border/40 hover:after:bg-border","hover:bg-muted/50",t.className)})}const gr="loki-sidebar-open-sections",Bp=i.memo(function({item:s,isOpen:r,isActive:a,onToggle:n}){return e.jsxs(Us,{children:[e.jsx(qs,{asChild:!0,isActive:a(s.url),onClick:()=>n(s.title),children:e.jsxs("div",{className:"flex items-center justify-between font-medium",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[s.icon,e.jsx(ce,{to:`${s.url}`,target:s.url.includes("http")?"_blank":"_self",children:s.title})]}),s.items&&s.items.length>0&&e.jsx(ot,{className:v("h-4 w-4 transition-transform duration-200",r?"rotate-0":"-rotate-90")})]})}),s.items&&s.items.length>0&&r&&e.jsx(Dn,{children:s.items.map(o=>e.jsx(On,{children:e.jsx($n,{asChild:!0,isActive:a(o.url),children:e.jsx(ce,{to:`${o.url}`,children:o.title})})},o.title))})]})});function zp({...t}){const s=kn(),r=Eo(),{cluster:a}=ue(),n=r.pathname.replace(s,"/"),[o,l]=i.useState(()=>{const m=localStorage.getItem(gr);if(m)try{return JSON.parse(m)}catch{return os.reduce((f,y)=>({...f,[y.title]:!0}),{})}return os.reduce((f,y)=>({...f,[y.title]:!0}),{})}),c=$p(a,os),d=i.useCallback(m=>m==="/"?n==="/":n.startsWith(m),[n]),u=i.useCallback(m=>{l(f=>{const y={...f,[m]:!f[m]};return localStorage.setItem(gr,JSON.stringify(y)),y})},[]);return e.jsxs(Rn,{...t,children:[e.jsx(Fn,{className:"py-4",children:e.jsx(fs,{children:e.jsx(Us,{children:e.jsx(qs,{size:"lg",asChild:!0,children:e.jsxs("div",{className:"flex items-center gap-3 px-6 py-4",children:[e.jsx("img",{src:"https://grafana.com/media/docs/loki/logo-grafana-loki.png",alt:"Loki Logo",className:"h-7 w-7"}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("span",{className:"text-sm font-semibold leading-none",children:"Grafana Loki"}),e.jsx(fp,{})]})]})})})})}),e.jsx(pt,{className:"flex-1",children:e.jsx(Ln,{children:e.jsx(Pn,{children:e.jsx(fs,{children:c.map(m=>e.jsx(i.Fragment,{children:e.jsx(Bp,{item:m,isOpen:o[m.title],isActive:d,onToggle:u})},m.title))})})})}),e.jsx(Mp,{})]})}function Vp(){const[t,s]=i.useState(!1);i.useEffect(()=>{const a=()=>{s(window.scrollY>300)};return window.addEventListener("scroll",a),()=>window.removeEventListener("scroll",a)},[]);const r=()=>{window.scrollTo({top:0,behavior:"smooth"})};return t?e.jsx(q,{onClick:r,size:"icon",className:"fixed bottom-8 right-8 rounded-full shadow-lg transition-all duration-300","aria-label":"Back to top",children:e.jsx(ls,{className:"h-4 w-4"})}):null}var Gs="ToastProvider",[Hs,Up,qp]=bi("Toast"),[Mn,Fm]=hr("Toast",[qp]),[Gp,Yt]=Mn(Gs),Bn=t=>{const{__scopeToast:s,label:r="Notification",duration:a=5e3,swipeDirection:n="right",swipeThreshold:o=50,children:l}=t,[c,d]=i.useState(null),[u,m]=i.useState(0),f=i.useRef(!1),y=i.useRef(!1);return r.trim()||console.error(`Invalid prop \`label\` supplied to \`${Gs}\`. Expected non-empty \`string\`.`),e.jsx(Hs.Provider,{scope:s,children:e.jsx(Gp,{scope:s,label:r,duration:a,swipeDirection:n,swipeThreshold:o,toastCount:u,viewport:c,onViewportChange:d,onToastAdd:i.useCallback(()=>m(N=>N+1),[]),onToastRemove:i.useCallback(()=>m(N=>N-1),[]),isFocusedToastEscapeKeyDownRef:f,isClosePausedRef:y,children:l})})};Bn.displayName=Gs;var zn="ToastViewport",Hp=["F8"],hs="toast.viewportPause",xs="toast.viewportResume",Vn=i.forwardRef((t,s)=>{const{__scopeToast:r,hotkey:a=Hp,label:n="Notifications ({hotkey})",...o}=t,l=Yt(zn,r),c=Up(r),d=i.useRef(null),u=i.useRef(null),m=i.useRef(null),f=i.useRef(null),y=vr(s,f,l.onViewportChange),N=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),h=l.toastCount>0;i.useEffect(()=>{const g=x=>{var j;a.length!==0&&a.every(w=>x[w]||x.code===w)&&((j=f.current)==null||j.focus())};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[a]),i.useEffect(()=>{const g=d.current,x=f.current;if(h&&g&&x){const b=()=>{if(!l.isClosePausedRef.current){const C=new CustomEvent(hs);x.dispatchEvent(C),l.isClosePausedRef.current=!0}},j=()=>{if(l.isClosePausedRef.current){const C=new CustomEvent(xs);x.dispatchEvent(C),l.isClosePausedRef.current=!1}},w=C=>{!g.contains(C.relatedTarget)&&j()},E=()=>{g.contains(document.activeElement)||j()};return g.addEventListener("focusin",b),g.addEventListener("focusout",w),g.addEventListener("pointermove",b),g.addEventListener("pointerleave",E),window.addEventListener("blur",b),window.addEventListener("focus",j),()=>{g.removeEventListener("focusin",b),g.removeEventListener("focusout",w),g.removeEventListener("pointermove",b),g.removeEventListener("pointerleave",E),window.removeEventListener("blur",b),window.removeEventListener("focus",j)}}},[h,l.isClosePausedRef]);const p=i.useCallback(({tabbingDirection:g})=>{const b=c().map(j=>{const w=j.ref.current,E=[w,...nm(w)];return g==="forwards"?E:E.reverse()});return(g==="forwards"?b.reverse():b).flat()},[c]);return i.useEffect(()=>{const g=f.current;if(g){const x=b=>{var E,C,A;const j=b.altKey||b.ctrlKey||b.metaKey;if(b.key==="Tab"&&!j){const B=document.activeElement,z=b.shiftKey;if(b.target===g&&z){(E=u.current)==null||E.focus();return}const M=p({tabbingDirection:z?"backwards":"forwards"}),W=M.findIndex(T=>T===B);is(M.slice(W+1))?b.preventDefault():z?(C=u.current)==null||C.focus():(A=m.current)==null||A.focus()}};return g.addEventListener("keydown",x),()=>g.removeEventListener("keydown",x)}},[c,p]),e.jsxs(bo,{ref:d,role:"region","aria-label":n.replace("{hotkey}",N),tabIndex:-1,style:{pointerEvents:h?void 0:"none"},children:[h&&e.jsx(bs,{ref:u,onFocusFromOutsideViewport:()=>{const g=p({tabbingDirection:"forwards"});is(g)}}),e.jsx(Hs.Slot,{scope:r,children:e.jsx(re.ol,{tabIndex:-1,...o,ref:y})}),h&&e.jsx(bs,{ref:m,onFocusFromOutsideViewport:()=>{const g=p({tabbingDirection:"backwards"});is(g)}})]})});Vn.displayName=zn;var Un="ToastFocusProxy",bs=i.forwardRef((t,s)=>{const{__scopeToast:r,onFocusFromOutsideViewport:a,...n}=t,o=Yt(Un,r);return e.jsx(jr,{"aria-hidden":!0,tabIndex:0,...n,ref:s,style:{position:"fixed"},onFocus:l=>{var u;const c=l.relatedTarget;!((u=o.viewport)!=null&&u.contains(c))&&a()}})});bs.displayName=Un;var Xt="Toast",Kp="toast.swipeStart",Wp="toast.swipeMove",Zp="toast.swipeCancel",Yp="toast.swipeEnd",qn=i.forwardRef((t,s)=>{const{forceMount:r,open:a,defaultOpen:n,onOpenChange:o,...l}=t,[c=!0,d]=yo({prop:a,defaultProp:n,onChange:o});return e.jsx(vo,{present:r||c,children:e.jsx(Jp,{open:c,...l,ref:s,onClose:()=>d(!1),onPause:jt(t.onPause),onResume:jt(t.onResume),onSwipeStart:pe(t.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:pe(t.onSwipeMove,u=>{const{x:m,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${m}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${f}px`)}),onSwipeCancel:pe(t.onSwipeCancel,u=>{u.currentTarget.setAttribute("data-swipe","cancel"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:pe(t.onSwipeEnd,u=>{const{x:m,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","end"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${m}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${f}px`),d(!1)})})})});qn.displayName=Xt;var[Xp,Qp]=Mn(Xt,{onClose(){}}),Jp=i.forwardRef((t,s)=>{const{__scopeToast:r,type:a="foreground",duration:n,open:o,onClose:l,onEscapeKeyDown:c,onPause:d,onResume:u,onSwipeStart:m,onSwipeMove:f,onSwipeCancel:y,onSwipeEnd:N,...h}=t,p=Yt(Xt,r),[g,x]=i.useState(null),b=vr(s,T=>x(T)),j=i.useRef(null),w=i.useRef(null),E=n||p.duration,C=i.useRef(0),A=i.useRef(E),B=i.useRef(0),{onToastAdd:z,onToastRemove:Y}=p,K=jt(()=>{var O;(g==null?void 0:g.contains(document.activeElement))&&((O=p.viewport)==null||O.focus()),l()}),M=i.useCallback(T=>{!T||T===1/0||(window.clearTimeout(B.current),C.current=new Date().getTime(),B.current=window.setTimeout(K,T))},[K]);i.useEffect(()=>{const T=p.viewport;if(T){const O=()=>{M(A.current),u==null||u()},V=()=>{const Q=new Date().getTime()-C.current;A.current=A.current-Q,window.clearTimeout(B.current),d==null||d()};return T.addEventListener(hs,V),T.addEventListener(xs,O),()=>{T.removeEventListener(hs,V),T.removeEventListener(xs,O)}}},[p.viewport,E,d,u,M]),i.useEffect(()=>{o&&!p.isClosePausedRef.current&&M(E)},[o,E,p.isClosePausedRef,M]),i.useEffect(()=>(z(),()=>Y()),[z,Y]);const W=i.useMemo(()=>g?Xn(g):null,[g]);return p.viewport?e.jsxs(e.Fragment,{children:[W&&e.jsx(em,{__scopeToast:r,role:"status","aria-live":a==="foreground"?"assertive":"polite","aria-atomic":!0,children:W}),e.jsx(Xp,{scope:r,onClose:K,children:wr.createPortal(e.jsx(Hs.ItemSlot,{scope:r,children:e.jsx(jo,{asChild:!0,onEscapeKeyDown:pe(c,()=>{p.isFocusedToastEscapeKeyDownRef.current||K(),p.isFocusedToastEscapeKeyDownRef.current=!1}),children:e.jsx(re.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":p.swipeDirection,...h,ref:b,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:pe(t.onKeyDown,T=>{T.key==="Escape"&&(c==null||c(T.nativeEvent),T.nativeEvent.defaultPrevented||(p.isFocusedToastEscapeKeyDownRef.current=!0,K()))}),onPointerDown:pe(t.onPointerDown,T=>{T.button===0&&(j.current={x:T.clientX,y:T.clientY})}),onPointerMove:pe(t.onPointerMove,T=>{if(!j.current)return;const O=T.clientX-j.current.x,V=T.clientY-j.current.y,Q=!!w.current,_=["left","right"].includes(p.swipeDirection),I=["left","up"].includes(p.swipeDirection)?Math.min:Math.max,P=_?I(0,O):0,U=_?0:I(0,V),S=T.pointerType==="touch"?10:2,R={x:P,y:U},$={originalEvent:T,delta:R};Q?(w.current=R,ht(Wp,f,$,{discrete:!1})):fr(R,p.swipeDirection,S)?(w.current=R,ht(Kp,m,$,{discrete:!1}),T.target.setPointerCapture(T.pointerId)):(Math.abs(O)>S||Math.abs(V)>S)&&(j.current=null)}),onPointerUp:pe(t.onPointerUp,T=>{const O=w.current,V=T.target;if(V.hasPointerCapture(T.pointerId)&&V.releasePointerCapture(T.pointerId),w.current=null,j.current=null,O){const Q=T.currentTarget,_={originalEvent:T,delta:O};fr(O,p.swipeDirection,p.swipeThreshold)?ht(Yp,N,_,{discrete:!0}):ht(Zp,y,_,{discrete:!0}),Q.addEventListener("click",I=>I.preventDefault(),{once:!0})}})})})}),p.viewport)})]}):null}),em=t=>{const{__scopeToast:s,children:r,...a}=t,n=Yt(Xt,s),[o,l]=i.useState(!1),[c,d]=i.useState(!1);return rm(()=>l(!0)),i.useEffect(()=>{const u=window.setTimeout(()=>d(!0),1e3);return()=>window.clearTimeout(u)},[]),c?null:e.jsx(wo,{asChild:!0,children:e.jsx(jr,{...a,children:o&&e.jsxs(e.Fragment,{children:[n.label," ",r]})})})},tm="ToastTitle",Gn=i.forwardRef((t,s)=>{const{__scopeToast:r,...a}=t;return e.jsx(re.div,{...a,ref:s})});Gn.displayName=tm;var sm="ToastDescription",Hn=i.forwardRef((t,s)=>{const{__scopeToast:r,...a}=t;return e.jsx(re.div,{...a,ref:s})});Hn.displayName=sm;var Kn="ToastAction",Wn=i.forwardRef((t,s)=>{const{altText:r,...a}=t;return r.trim()?e.jsx(Yn,{altText:r,asChild:!0,children:e.jsx(Ks,{...a,ref:s})}):(console.error(`Invalid prop \`altText\` supplied to \`${Kn}\`. Expected non-empty \`string\`.`),null)});Wn.displayName=Kn;var Zn="ToastClose",Ks=i.forwardRef((t,s)=>{const{__scopeToast:r,...a}=t,n=Qp(Zn,r);return e.jsx(Yn,{asChild:!0,children:e.jsx(re.button,{type:"button",...a,ref:s,onClick:pe(t.onClick,n.onClose)})})});Ks.displayName=Zn;var Yn=i.forwardRef((t,s)=>{const{__scopeToast:r,altText:a,...n}=t;return e.jsx(re.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":a||void 0,...n,ref:s})});function Xn(t){const s=[];return Array.from(t.childNodes).forEach(a=>{if(a.nodeType===a.TEXT_NODE&&a.textContent&&s.push(a.textContent),am(a)){const n=a.ariaHidden||a.hidden||a.style.display==="none",o=a.dataset.radixToastAnnounceExclude==="";if(!n)if(o){const l=a.dataset.radixToastAnnounceAlt;l&&s.push(l)}else s.push(...Xn(a))}}),s}function ht(t,s,r,{discrete:a}){const n=r.originalEvent.currentTarget,o=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:r});s&&n.addEventListener(t,s,{once:!0}),a?ko(n,o):n.dispatchEvent(o)}var fr=(t,s,r=0)=>{const a=Math.abs(t.x),n=Math.abs(t.y),o=a>n;return s==="left"||s==="right"?o&&a>r:!o&&n>r};function rm(t=()=>{}){const s=jt(t);No(()=>{let r=0,a=0;return r=window.requestAnimationFrame(()=>a=window.requestAnimationFrame(s)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(a)}},[s])}function am(t){return t.nodeType===t.ELEMENT_NODE}function nm(t){const s=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:a=>{const n=a.tagName==="INPUT"&&a.type==="hidden";return a.disabled||a.hidden||n?NodeFilter.FILTER_SKIP:a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)s.push(r.currentNode);return s}function is(t){const s=document.activeElement;return t.some(r=>r===s?!0:(r.focus(),document.activeElement!==s))}var om=Bn,Qn=Vn,Jn=qn,eo=Gn,to=Hn,so=Wn,ro=Ks;const im=om,ao=i.forwardRef(({className:t,...s},r)=>e.jsx(Qn,{ref:r,className:v("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...s}));ao.displayName=Qn.displayName;const lm=Ee("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),no=i.forwardRef(({className:t,variant:s,...r},a)=>e.jsx(Jn,{ref:a,className:v(lm({variant:s}),t),...r}));no.displayName=Jn.displayName;const cm=i.forwardRef(({className:t,...s},r)=>e.jsx(so,{ref:r,className:v("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",t),...s}));cm.displayName=so.displayName;const oo=i.forwardRef(({className:t,...s},r)=>e.jsx(ro,{ref:r,className:v("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...s,children:e.jsx(vs,{className:"h-4 w-4"})}));oo.displayName=ro.displayName;const io=i.forwardRef(({className:t,...s},r)=>e.jsx(eo,{ref:r,className:v("text-sm font-semibold [&+div]:text-xs",t),...s}));io.displayName=eo.displayName;const lo=i.forwardRef(({className:t,...s},r)=>e.jsx(to,{ref:r,className:v("text-sm opacity-90",t),...s}));lo.displayName=to.displayName;function dm(){const{toasts:t}=zt();return e.jsxs(im,{children:[t.map(function({id:s,title:r,description:a,action:n,...o}){return e.jsxs(no,{...o,children:[e.jsxs("div",{className:"grid gap-1",children:[r&&e.jsx(io,{children:r}),a&&e.jsx(lo,{children:a})]}),n,e.jsx(oo,{})]},s)}),e.jsx(ao,{})]})}function um({children:t}){return e.jsx("div",{className:"flex min-h-screen",children:e.jsxs(Tn,{children:[e.jsx(zp,{}),e.jsxs(In,{children:[e.jsxs("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:[e.jsx(An,{}),e.jsx(Vs,{orientation:"vertical",className:"mr-2 h-4"}),e.jsx(mp,{}),e.jsx("div",{className:"ml-auto px-4",children:e.jsx(Hi,{})})]}),e.jsx("main",{className:"flex flex-1 flex-col",children:t}),e.jsx(dm,{}),e.jsx(Vp,{})]})]})})}var pm=function(){return null};const mm=new _i({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:!1,staleTime:5*60*1e3}}});function gm({children:t}){return e.jsxs(Ii,{client:mm,children:[t,e.jsx(pm,{initialIsOpen:!1})]})}function fm({children:t}){const[s,r]=i.useState(null),[a,n]=i.useState(null),[o,l]=i.useState(!0),c=i.useRef(!1),d=i.useCallback(async()=>{if(!c.current){c.current=!0,l(!0);try{const m=await fetch("/ui/api/v1/cluster/nodes");if(!m.ok)throw new Error(`Failed to fetch cluster data: ${m.statusText}`);const f=await m.json();r(f),n(null)}catch(m){n(m instanceof Error?m.message:"An unknown error occurred")}finally{l(!1),c.current=!1}}},[]),u=i.useCallback(async()=>{await d()},[d]);return i.useEffect(()=>{d()},[d]),e.jsx(fa.Provider,{value:{cluster:s,error:a,isLoading:o,refresh:u},children:t})}function hm(){return e.jsx(gm,{children:e.jsx(qi,{defaultTheme:"dark",storageKey:"loki-ui-theme",children:e.jsx(fm,{children:e.jsx(um,{children:e.jsx(Co,{children:Nn.map(t=>e.jsx(To,{path:t.path,element:t.element},t.path))})})})})})}const xm=kn(),bm=Ro([{path:"*",element:e.jsx(hm,{})}],{basename:xm,future:{v7_relativeSplatPath:!0}}),co=document.getElementById("root");if(!co)throw new Error("Root element not found");ca(co).render(e.jsx(i.StrictMode,{children:e.jsx(Ao,{router:bm,future:{v7_startTransition:!0}})}));