1import{_ as de,a as ce}from"./D1Vwqvar.js";import{b5 as ue,di as me,dR as pe,b3 as xe,ea as U,dI as q,dJ as _e,aN as b,c8 as fe,ca as u,aV as m,b2 as l,eh as r,aQ as t,cL as e,cC as o,aS as j,ax as he,bN as I,a$ as ge,ay as ye,n as N,cq as ve,av as be,b1 as C,el as A,bX as D,aR as ke,cm as f}from"./CN-9qKdY.js";import{_ as we}from"./DfITYhA5.js";import{_ as $e}from"./BBZ6sdgq.js";import{_ as Ce}from"./DzXb0G-3.js";import Se from"./CX4KILJ9.js";import{a as S}from"./D0QvQlul.js";import{a as F,b as ze}from"./D4mxaJDd.js";import"./CmNiqwlZ.js";import"./Cvyzrbhf.js";import"./CcCOkbdC.js";import"./C9FfNegR.js";import"./DdsmsLUT.js";import"./BSpQOo0T.js";import"./CDmMnjpY.js";const Ke={class:"flex flex-col gap-6 px-5 pt-3 pb-6"},Me={key:0,class:"grid grid-cols-3 gap-4"},Be={class:"flex flex-col gap-1 rounded border border-stroke-primary p-4"},Ue={class:"text-xs text-muted uppercase tracking-wide"},Ie={class:"text-2xl font-semibold text-text-primary"},Ne={class:"flex flex-col gap-1 rounded border border-stroke-primary p-4"},De={class:"text-xs text-muted uppercase tracking-wide"},Le={class:"text-2xl font-semibold text-text-primary"},Ve={class:"flex flex-col gap-1 rounded border border-stroke-primary p-4"},Re={class:"text-xs text-muted uppercase tracking-wide"},Te={class:"text-2xl font-semibold text-text-primary"},Pe={class:"flex items-center gap-5"},Ee={key:1,class:"flex flex-col gap-4"},Oe={key:2,class:"flex flex-col items-center justify-center py-24 px-6"},Qe={class:"text-xl font-semibold text-highlighted mb-2"},qe={class:"text-sm text-toned text-center max-w-md mb-4"},je={key:3,class:"flex flex-col items-center justify-center py-24 px-6"},Ae={class:"text-xl font-semibold text-highlighted mb-2"},Fe={class:"text-sm text-toned text-center max-w-md"},Je={class:"overflow-hidden"},Ye=["title"],Ge={class:"flex items-center gap-2"},He={class:"text-sm text-text-secondary"},Xe={class:"text-sm text-text-secondary font-mono"},We={class:"flex items-center gap-1"},Ze={class:"flex items-center justify-center gap-4 pt-2"},et={key:1,class:"text-sm text-text-tertiary"},tt={key:0,class:"flex flex-col gap-4 p-6"},st={key:1,class:"flex flex-col gap-5 p-6"},ot={class:"flex flex-col gap-1"},at={class:"text-xs text-muted uppercase tracking-wide"},nt={class:"font-mono text-sm text-text-primary break-all"},it={class:"grid grid-cols-2 gap-4"},lt={class:"flex flex-col gap-1"},rt={class:"text-xs text-muted uppercase tracking-wide"},dt={class:"flex items-center gap-2"},ct={class:"text-sm text-text-primary"},ut={class:"flex flex-col gap-1"},mt={class:"text-xs text-muted uppercase tracking-wide"},pt={class:"text-sm text-text-primary font-mono"},xt={class:"flex flex-col gap-1"},_t={class:"text-xs text-muted uppercase tracking-wide"},ft={class:"text-sm text-text-primary"},ht={class:"flex flex-col gap-1"},gt={class:"text-xs text-muted uppercase tracking-wide"},yt={class:"text-sm text-text-primary font-mono"},vt={class:"flex flex-col gap-1"},bt={class:"text-xs text-muted uppercase tracking-wide"},kt={class:"bg-surface-card border border-stroke-primary rounded p-4 text-xs text-text-secondary font-mono overflow-auto max-h-[400px] whitespace-pre-wrap break-all"},wt={class:"flex items-center gap-2 pt-2"}
1,$t={class:"bg-surface-card border border-stroke-primary rounded p-3"},Ct={class:"font-mono text-sm text-highlighted break-all"},St=100,qt=ue({__name:"redis",setup(zt){const{t:a}=me();pe({title:"Redis Keys"});const h=f(""),z=xe(h,400),w=f(0);U(z,()=>{w.value=0});const J=b(()=>({prefix:z.value||void 0,cursor:w.value,count:St})),{data:x,isPending:K,isError:Y,error:G,refetch:H}=q(b(()=>F.redisKeys(J.value))),d=f([]);U(x,s=>{if(s)if(w.value===0)d.value=s.keys??[];else{const i=new Set(d.value.map(c=>c.key)),_=(s.keys??[]).filter(c=>!i.has(c.key));d.value=[...d.value,..._]}},{immediate:!0}),U(z,()=>{d.value=[]});const L=b(()=>x.value?.cursor==="0"||String(x.value?.cursor)==="0");function X(){x.value&&!L.value&&(w.value=Number(x.value.cursor))}const M=b(()=>{const s=d.value;return{dbSize:x.value?.dbSize??0,loaded:s.length,withTtl:s.filter(i=>i.ttl!==null).length}}),W=b(()=>[{accessorKey:"key",header:S(a("admin.redis.table.key")),id:"key"},{accessorKey:"type",header:S(a("admin.redis.table.type")),id:"type"},{accessorKey:"ttl",header:S(a("admin.redis.table.ttl")),id:"ttl"},{accessorKey:"size",header:S(a("admin.redis.table.size")),id:"size"},{accessorKey:"actions",header:a("admin.redis.table.actions"),id:"actions"}]),V={string:"bg-blue-500",list:"bg-purple-500",set:"bg-green-500",zset:"bg-yellow-500",hash:"bg-orange-500",stream:"bg-red-500"},g=f(null),y=f(!1),Z=_e(),{data:p,isLoading:ee}=q({...F.redisInspect(b(()=>g.value??"")),enabled:()=>!!g.value});function R(s){g.value=s,y.value=!0}function te(){g.value&&Z.invalidateQueries({queryKey:["admin","redis","inspect"]})}const T=ze(),$=f(null),v=f(!1);function P(s){$.value=s,v.value=!0}function se(){const s=$.value;s&&T.mutate(s,{onSuccess(){v.value=!1,$.value=null,d.value=d.value.filter(i=>i.key!==s),g.value===s&&(y.value=!1,g.value=null)}})}fe(()=>{y.value=!1,v.value=!1});function E(s){return s===null?a("admin.redis.ttl-none"):s<60?`${s}s`:s<3600?`${Math.floor(s/60)}m ${s%60}s`:s<86400?`${Math.floor(s/3600)}h ${Math.floor(s%3600/60)}m`:`${Math.floor(s/86400)}d ${Math.floor(s%86400/3600)}h`}function O(s){if(s===0)return"0 B";const i=["B","KB","MB","GB"],_=Math.floor(Math.log(s)/Math.log(1024));return`${(s/1024**_).toFixed(_>0?1:0)} ${i[_]}`}function oe(s){return s==null?"(nil)":typeof s=="string"?s:JSON.stringify(s,null,2)}return(s,i)=>{const _=de,c=ye,ae=he,k=we,Q=be,ne=$e,ie=ce,le=Ce,re=Se;return u(),m(N,null,[l(ie,{id:"admin-redis",ui:{body:"relative"}},{header:r(()=>[l(_,{title:e(a)("admin.redis.page-title")},null,8,["title"])]),body:r(()=>[t("div",Ke,[e(x)?(u(),m("div",Me,[t("div",Be,[t("span",Ue,o(e(a)("admin.redis.stats.db-size")),1),t("span",Ie,o(e(M).dbSize.toLocaleString()),1)]),t("div",Ne,[t("span",De,o(e(a)("admin.redis.stats.loaded")),1),t("span",Le,o(e(M).loaded.toLocaleString()),1)]),t("div",Ve,[t("span",Re,o(e(a)("admin.redis.stats.with-ttl")),1),t("span",Te,o(e(M).withTtl.toLocaleString()),1)])])):j("",!0),t("div",Pe,[l(ae,{modelValue:e(h),"onUpdate:modelValue":i[1]||(i[1]=n=>I(h)?h.value=n:null),placeholder:e(a)("admin.redis.search-placeholder"),icon:"i-lucide-search",class:"flex-1 h-9",ui:{base:"bg-surface-card border border-stroke-primary rounded-none shadow-xs focus:border-stroke-strong focus:ring-0",leadingIcon:"size-4 text-text-tertiary"}},ge({_:2},[e(h).length>0?{name:"trailing",fn:r(()=>[l(c,{icon:"i-lucide-x",color:"neutral",variant:"link",size:"sm",class:"p-0",onClick:i[0]||(i[0]=n=>h.value="")})]),key:"0"}:void 0]),1032,["modelValue","placeholder"])]),e(K)&&e(d).length===0?(u(),m("div",Ee,[l(k,{class:"h-12 w-full"}),(u(),m(N,null,ve(8,n=>l(k,{key:n,class:"h-14 w-full"})),64))])):e(Y)&&e(d).length===0?(u(),m("div",Oe,[l(Q,{name:"i-lucide-alert-triangle",class:"w-16 h-16 text-error mb-4"}),t("h2",Qe,o(e(a)("admin.redis.error-loading")),1),t("p",qe,o(e(G)?.message),1),l(c,{color:"primary",onClick:i[2]||(i[2]=n=>e(H)())},{default:r(()=>[C(o(e(a)("common.actions.retry")),1)]),_:1})])):e(d).length===0&&!e(K)?(u(),m("div",je,[l(Q,{name:"i-lucide-database",class:"w-16 h-16 text-muted mb-4"}),t("h2",Ae,o(e(a)("admin.redis.empty-title")),1),t("p",Fe,o(e(a)("admin.redis.empty-description")),1)])):(u(),m(N,{key:4},[t("div",Je,[l(ne,{data:e(d),columns:e(W),onSelect:i[3]||(i[3]=(n,B)=>R(B.original.key??""))},{"key-cell":r(({row:n})=>[t("span",{class:"font-mono text-sm text-text-primary truncate block max-w-[400px]",title:n.original.key??""},o(n.original.key),9,Ye)]),"type-cell":r(({row:n})=>[t("div",Ge,[t("span",{class:D(["inline-block w-2 h-2 rounded-full",V[n.original.type??""]??"bg-neutral-500"])},null,2),t("span",He,o(n.original.type),1)])]),"ttl-cell":r(({row:n})=>[t("span",{class:D(["text-sm",n.original.ttl===null?"text-text-tertiary":"text-text-secondary"])},o(E(n.original.ttl??null)),3)]),"size-cell":r(({row:n})=>[t("span",Xe,o(O(n.original.size??0)),1)]),"actions-cell":r(({row:n})=>[t("div",We,[l(c,{size:"xs",color:"neutral",variant:"ghost",icon:"i-lucide-eye",title:e(a)("admin.redis.inspect"),onClick:A(B=>R(n.original.key??""),["stop"])},null,8,["title","onClick"]),l(c,{size:"xs",color:"error",variant:"ghost",icon:"i-lucide-trash-2",title:e(a)("admin.redis.delete"),onClick:A(B=>P(n.original.key??""),["stop"])},null,8,["title","onClick"])])]),_:1},8,["data","columns"])]),t("div",Ze,[e(L)?(u(),m("span",et,o(e(a)("admin.redis.scan-complete"))+" · "+o(e(d).length)+" "+o(e(a)("admin.redis.keys-loaded").toLowerCase()),1)):(u(),ke(c,{key:0,color:"neutral",variant:"outline",loading:e(K),onClick:X},{default:r(()=>[C(o(e(a)("admin.redis.load-more")),1)]),_:1},8,["loading"]))])],64))])]),_:1}),l(le,{open:e(y),"onUpdate:open":i[6]||(i[6]=n=>
1I(y)?y.value=n:null),title:e(a)("admin.redis.detail-title"),ui:{content:"w-[600px] max-w-[90vw]"}},{body:r(()=>[e(ee)?(u(),m("div",tt,[l(k,{class:"h-6 w-1/2"}),l(k,{class:"h-6 w-1/3"}),l(k,{class:"h-40 w-full"})])):e(p)?(u(),m("div",st,[t("div",ot,[t("span",at,o(e(a)("admin.redis.detail-key")),1),t("span",nt,o(e(p).key),1)]),t("div",it,[t("div",lt,[t("span",rt,o(e(a)("admin.redis.detail-type")),1),t("div",dt,[t("span",{class:D(["inline-block w-2 h-2 rounded-full",V[e(p).type??""]??"bg-neutral-500"])},null,2),t("span",ct,o(e(p).type),1)])]),t("div",ut,[t("span",mt,o(e(a)("admin.redis.detail-encoding")),1),t("span",pt,o(e(p).encoding),1)]),t("div",xt,[t("span",_t,o(e(a)("admin.redis.detail-ttl")),1),t("span",ft,o(E(e(p).ttl??null)),1)]),t("div",ht,[t("span",gt,o(e(a)("admin.redis.detail-size")),1),t("span",yt,o(O(e(p).size??0)),1)])]),t("div",vt,[t("span",bt,o(e(a)("admin.redis.detail-value")),1),t("pre",kt,o(oe(e(p).value)),1)]),t("div",wt,[l(c,{color:"neutral",variant:"outline",icon:"i-lucide-refresh-cw",onClick:i[4]||(i[4]=n=>te())},{default:r(()=>[C(o(e(a)("common.actions.refresh")),1)]),_:1}),l(c,{color:"error",variant:"soft",icon:"i-lucide-trash-2",onClick:i[5]||(i[5]=n=>P(e(p).key??""))},{default:r(()=>[C(o(e(a)("admin.redis.delete")),1)]),_:1})])])):j("",!0)]),_:1},8,["open","title"]),l(re,{open:e(v),"onUpdate:open":i[7]||(i[7]=n=>I(v)?v.value=n:null),title:e(a)("admin.redis.confirm-delete-title"),description:e(a
1)("admin.redis.confirm-delete"),"confirm-text":e(a)("admin.redis.delete"),loading:e(T).isPending.value,onConfirm:se},{default:r(()=>[t("div",$t,[t("span",Ct,o(e($)),1)])]),_:1},8,["open","title","description","confirm-text","loading"])],64)}}});export{qt as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.