db-studio 1.17.0 → 1.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/dist/index.js +98 -93
  2. package/dist/index.js.map +1 -1
  3. package/dist/web-dist/assets/_pathlessLayout-D83hYFIC.js +1 -0
  4. package/dist/web-dist/assets/_pathlessLayout-DYRsUfs6.js +2 -0
  5. package/dist/web-dist/assets/_queryId-DmyRcSX-.js +1 -0
  6. package/dist/web-dist/assets/_table-CXzhHR9S.js +1 -0
  7. package/dist/web-dist/assets/_table-Cwy7lxKk.js +1 -0
  8. package/dist/web-dist/assets/_table-DaqO5XGq.js +1 -0
  9. package/dist/web-dist/assets/abap-Ds2wIDQc.js +1 -0
  10. package/dist/web-dist/assets/apex-DfqBN11z.js +1 -0
  11. package/dist/web-dist/assets/azcli-COqL1c-b.js +1 -0
  12. package/dist/web-dist/assets/badge-Ckwkbv_3.js +1 -0
  13. package/dist/web-dist/assets/bat-Nrlrgwbn.js +1 -0
  14. package/dist/web-dist/assets/bicep-DMqb4xTm.js +2 -0
  15. package/dist/web-dist/assets/browser-dcbfhXDu.js +1 -0
  16. package/dist/web-dist/assets/{bundle-mjs-CfhZe4O1.js → bundle-mjs-DfrVkH8G.js} +1 -1
  17. package/dist/web-dist/assets/cameligo-DQX1RguE.js +1 -0
  18. package/dist/web-dist/assets/chat-sidebar-p9xpAAXQ.js +132 -0
  19. package/dist/web-dist/assets/clojure-CmnlCds-.js +1 -0
  20. package/dist/web-dist/assets/{code-editor-CI9i4mj3.js → code-editor-DsRAUGQh.js} +2 -2
  21. package/dist/web-dist/assets/coffee-CgcM3HWm.js +1 -0
  22. package/dist/web-dist/assets/cpp-BnqpxZdA.js +1 -0
  23. package/dist/web-dist/assets/csharp-B8V_ECLX.js +1 -0
  24. package/dist/web-dist/assets/csp-Dzh7GjET.js +1 -0
  25. package/dist/web-dist/assets/css-BY0zxVqM.js +3 -0
  26. package/dist/web-dist/assets/cssMode-D_jEABO9.js +1 -0
  27. package/dist/web-dist/assets/cypher-D9AVJPko.js +1 -0
  28. package/dist/web-dist/assets/dart-vuJN5abD.js +1 -0
  29. package/dist/web-dist/assets/database.store-C0jTx_DA.js +57 -0
  30. package/dist/web-dist/assets/{dist-CKgBcNn7.js → dist-DmSgBrHs.js} +1 -1
  31. package/dist/web-dist/assets/dockerfile-Du-akT44.js +1 -0
  32. package/dist/web-dist/assets/ecl-C3XWQlLZ.js +1 -0
  33. package/dist/web-dist/assets/editor-1FQrmyyI.css +1 -0
  34. package/dist/web-dist/assets/editor.api-VeMVvGYa.js +865 -0
  35. package/dist/web-dist/assets/elixir-BzsCBGJ0.js +1 -0
  36. package/dist/web-dist/assets/esm-D_bQ4AdP.js +501 -0
  37. package/dist/web-dist/assets/flow9-z5gBTD0L.js +1 -0
  38. package/dist/web-dist/assets/freemarker2-B9XmkS8x.js +3 -0
  39. package/dist/web-dist/assets/fsharp-CMq6tChx.js +1 -0
  40. package/dist/web-dist/assets/go-ClPsEbRK.js +1 -0
  41. package/dist/web-dist/assets/graphql-7BvkEJ5O.js +1 -0
  42. package/dist/web-dist/assets/handlebars-sf8CVwlq.js +1 -0
  43. package/dist/web-dist/assets/hcl-DN6aCTHV.js +1 -0
  44. package/dist/web-dist/assets/highlighted-body-OFNGDK62-BU0nMuYA.js +1 -0
  45. package/dist/web-dist/assets/html-DI5TL_8H.js +1 -0
  46. package/dist/web-dist/assets/htmlMode-D_4DT2Lu.js +1 -0
  47. package/dist/web-dist/assets/{icons-Cqp8qsxp.js → icons-BEkcNqUd.js} +1 -1
  48. package/dist/web-dist/assets/index-CK2sj4Xy.css +2 -0
  49. package/dist/web-dist/assets/index-b6Apx1z7.js +39 -0
  50. package/dist/web-dist/assets/{indexes-BJXcp3El.js → indexes-Cv0o_HTj.js} +1 -1
  51. package/dist/web-dist/assets/ini-Ba74TRs3.js +1 -0
  52. package/dist/web-dist/assets/java-B1OFDleH.js +1 -0
  53. package/dist/web-dist/assets/javascript-Cf3sZaZX.js +1 -0
  54. package/dist/web-dist/assets/json-editor-C9dFqjTV.js +1 -0
  55. package/dist/web-dist/assets/jsonMode-CQjwhzT5.js +7 -0
  56. package/dist/web-dist/assets/julia-CMywvhYA.js +1 -0
  57. package/dist/web-dist/assets/keys-o03XLuW4.js +1 -0
  58. package/dist/web-dist/assets/kotlin-BD6_sIY9.js +1 -0
  59. package/dist/web-dist/assets/less-BxdK-Aa1.js +2 -0
  60. package/dist/web-dist/assets/lexon-DCaYyeqi.js +1 -0
  61. package/dist/web-dist/assets/liquid-D7tk2apZ.js +1 -0
  62. package/dist/web-dist/assets/{logs-DEpoT_GT.js → logs-Ncb6EFEi.js} +1 -1
  63. package/dist/web-dist/assets/lspLanguageFeatures-DHxnBjVJ.js +4 -0
  64. package/dist/web-dist/assets/lua-DYwtBF6d.js +1 -0
  65. package/dist/web-dist/assets/m3-CogUFTfR.js +1 -0
  66. package/dist/web-dist/assets/markdown-COKMRj9K.js +1 -0
  67. package/dist/web-dist/assets/mdx-H6YCl9d8.js +1 -0
  68. package/dist/web-dist/assets/mermaid-GHXKKRXX-D3S70ynC.js +1 -0
  69. package/dist/web-dist/assets/{middleware-DGlL7Sbs.js → middleware-CEqbkwLH.js} +1 -1
  70. package/dist/web-dist/assets/mips-BDOMMsh0.js +1 -0
  71. package/dist/web-dist/assets/module-CYndhtxW.js +2 -0
  72. package/dist/web-dist/assets/monaco-theme-BnSsSzUH.css +1 -0
  73. package/dist/web-dist/assets/monaco-theme-CyGd7xOU.js +64 -0
  74. package/dist/web-dist/assets/msdax-Bt2yooL5.js +1 -0
  75. package/dist/web-dist/assets/mysql-Bs8-d6RT.js +1 -0
  76. package/dist/web-dist/assets/objective-c-DZGYv99U.js +1 -0
  77. package/dist/web-dist/assets/pascal-FvUHIAld.js +1 -0
  78. package/dist/web-dist/assets/pascaligo-DEr9uXJO.js +1 -0
  79. package/dist/web-dist/assets/perl-DfX9jvgM.js +1 -0
  80. package/dist/web-dist/assets/personal-preferences.store-BIcu6qr5.js +1 -0
  81. package/dist/web-dist/assets/pgsql-B12f-wRt.js +1 -0
  82. package/dist/web-dist/assets/php-MynGtmh0.js +1 -0
  83. package/dist/web-dist/assets/pla-BSfIEgVT.js +1 -0
  84. package/dist/web-dist/assets/postiats-wriGJNMc.js +1 -0
  85. package/dist/web-dist/assets/powerquery-qTNF5irm.js +1 -0
  86. package/dist/web-dist/assets/powershell-Cr0AiP2J.js +1 -0
  87. package/dist/web-dist/assets/preload-helper-DICoZAvL.js +1 -0
  88. package/dist/web-dist/assets/protobuf-B5pCjOfx.js +2 -0
  89. package/dist/web-dist/assets/pug-BnGzsuEw.js +1 -0
  90. package/dist/web-dist/assets/python-Bd-J5HMt.js +1 -0
  91. package/dist/web-dist/assets/qsharp-C-Z8Szjm.js +1 -0
  92. package/dist/web-dist/assets/{queries.store-mYjqPBIG.js → queries.store-BbUkkWy1.js} +1 -1
  93. package/dist/web-dist/assets/query-runner-DBIufzsZ.js +17 -0
  94. package/dist/web-dist/assets/r-lFEgLDol.js +1 -0
  95. package/dist/web-dist/assets/radix-ui-Bp71_UWp.js +51 -0
  96. package/dist/web-dist/assets/razor-BL-2JJuP.js +1 -0
  97. package/dist/web-dist/assets/react-BziCK5DU.js +1 -0
  98. package/dist/web-dist/assets/{react-dom-MwQ-XgNN.js → react-dom-ctQEFzyp.js} +5 -5
  99. package/dist/web-dist/assets/redis-CJPiZ1dc.js +1 -0
  100. package/dist/web-dist/assets/redis-value-rbj0L_ie.js +1 -0
  101. package/dist/web-dist/assets/redshift-D1FKNo6F.js +1 -0
  102. package/dist/web-dist/assets/restructuredtext-BdtNntNZ.js +1 -0
  103. package/dist/web-dist/assets/{rolldown-runtime-BCBVhuY0.js → rolldown-runtime-Ba77kUFP.js} +1 -1
  104. package/dist/web-dist/assets/ruby-C2uUAsPh.js +1 -0
  105. package/dist/web-dist/assets/runner-WhyDqbco.js +1 -0
  106. package/dist/web-dist/assets/rust-B22jVKPi.js +1 -0
  107. package/dist/web-dist/assets/sb-H5-MsoWu.js +1 -0
  108. package/dist/web-dist/assets/scala-JHuRLUuq.js +1 -0
  109. package/dist/web-dist/assets/{schema-boTdkq9l.js → schema-DdnQO20v.js} +1 -1
  110. package/dist/web-dist/assets/scheme-CqKe-_5y.js +1 -0
  111. package/dist/web-dist/assets/scss-C9ckl5Lm.js +3 -0
  112. package/dist/web-dist/assets/select-Cg3fBZqb.js +1 -0
  113. package/dist/web-dist/assets/separator-B2Ii4cjw.js +1 -0
  114. package/dist/web-dist/assets/sheet-sidebar-D8BG4Pf9.js +1 -0
  115. package/dist/web-dist/assets/shell-C9lIrU5P.js +1 -0
  116. package/dist/web-dist/assets/solidity-BdsCByFb.js +1 -0
  117. package/dist/web-dist/assets/sophia-BiYQOR15.js +1 -0
  118. package/dist/web-dist/assets/sparql-CZhOhni4.js +1 -0
  119. package/dist/web-dist/assets/spinner-gvrX8mkL.js +1 -0
  120. package/dist/web-dist/assets/sql-DGoEI4nz.js +1 -0
  121. package/dist/web-dist/assets/st-DUBBkXkg.js +1 -0
  122. package/dist/web-dist/assets/swift-D_36y0eN.js +1 -0
  123. package/dist/web-dist/assets/systemverilog-BAtlR_WK.js +1 -0
  124. package/dist/web-dist/assets/{table-mU6PMMQx.js → table-Gq1Nd4WJ.js} +1 -1
  125. package/dist/web-dist/assets/tanstack-HxB2LyLp.js +8 -0
  126. package/dist/web-dist/assets/tcl-D05MO8B_.js +1 -0
  127. package/dist/web-dist/assets/tooltip-CIAbgIn7.js +12 -0
  128. package/dist/web-dist/assets/tsMode-4FmdP9_o.js +11 -0
  129. package/dist/web-dist/assets/twig-CPq3SV5E.js +1 -0
  130. package/dist/web-dist/assets/typescript-CEcdsK9n.js +1 -0
  131. package/dist/web-dist/assets/typespec-I6aAHcEc.js +1 -0
  132. package/dist/web-dist/assets/utils-CNXzeC6_.js +1 -0
  133. package/dist/web-dist/assets/vb-C6fWMOt8.js +1 -0
  134. package/dist/web-dist/assets/{visualizer-CnmK5vq1.js → visualizer-Cxu0_nai.js} +1 -1
  135. package/dist/web-dist/assets/wgsl-CsswhpkD.js +298 -0
  136. package/dist/web-dist/assets/workers-CH8V5wKq.js +1 -0
  137. package/dist/web-dist/assets/xml-Clh3WxEv.js +1 -0
  138. package/dist/web-dist/assets/yaml--Kwp2ruw.js +1 -0
  139. package/dist/web-dist/index.html +22 -20
  140. package/package.json +8 -5
  141. package/dist/web-dist/assets/_pathlessLayout-BkAR-cxy.js +0 -132
  142. package/dist/web-dist/assets/_pathlessLayout-Da39Ex7I.js +0 -1
  143. package/dist/web-dist/assets/_queryId-DJ8Cszxw.js +0 -1
  144. package/dist/web-dist/assets/_table-C0a5HWX2.js +0 -1
  145. package/dist/web-dist/assets/_table-CSyEA1sh.js +0 -1
  146. package/dist/web-dist/assets/_table-D2rPjuB3.js +0 -1
  147. package/dist/web-dist/assets/badge-BgJ132Zp.js +0 -1
  148. package/dist/web-dist/assets/browser-DRVH5V78.js +0 -1
  149. package/dist/web-dist/assets/database.store-ybZyJeQE.js +0 -57
  150. package/dist/web-dist/assets/format-cell-value-FBkY2oBS.js +0 -1
  151. package/dist/web-dist/assets/highlighted-body-OFNGDK62-DJ_AZ-U-.js +0 -1
  152. package/dist/web-dist/assets/index-CZcDmX3V.css +0 -2
  153. package/dist/web-dist/assets/index-DkEjlgj_.js +0 -36
  154. package/dist/web-dist/assets/mermaid-GHXKKRXX-C-5cK5mF.js +0 -1
  155. package/dist/web-dist/assets/monaco-editor-Dlx7llW7.js +0 -1252
  156. package/dist/web-dist/assets/monaco-editor-IL9D_L0g.css +0 -1
  157. package/dist/web-dist/assets/monitoring-COzw_qZY.js +0 -22
  158. package/dist/web-dist/assets/overlay.store-CdMPivQ4.js +0 -11
  159. package/dist/web-dist/assets/query-runner-Rk39OSFU.js +0 -17
  160. package/dist/web-dist/assets/radix-ui-B5VLwTAi.js +0 -51
  161. package/dist/web-dist/assets/react-CYwS-VST.js +0 -1
  162. package/dist/web-dist/assets/redis-value-D5wqUFuP.js +0 -1
  163. package/dist/web-dist/assets/runner--5mwKvXr.js +0 -1
  164. package/dist/web-dist/assets/schema-C8mv4CVD.js +0 -1
  165. package/dist/web-dist/assets/tanstack-DvfzCieo.js +0 -11
  166. package/dist/web-dist/assets/use-database-engine-FWzj-N81.js +0 -1
@@ -0,0 +1 @@
1
+ import{g as n}from"./tanstack-HxB2LyLp.js";import{kt as a}from"./radix-ui-Bp71_UWp.js";import{Y as o}from"./index-b6Apx1z7.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"db-studio@1.18.0"};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f1c8652e-5041-4a3f-a320-f37a13522796",e._sentryDebugIdIdentifier="sentry-dbid-f1c8652e-5041-4a3f-a320-f37a13522796")}catch{}})();var r=a();function u(){return o()?.dataModel==="key-value"?(0,r.jsx)(n,{to:"/browser"}):(0,r.jsx)("main",{className:"flex-1 flex items-center justify-center",children:"Select a tab to get started"})}export{u as component};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/chat-sidebar-p9xpAAXQ.js","assets/rolldown-runtime-Ba77kUFP.js","assets/icons-BEkcNqUd.js","assets/radix-ui-Bp71_UWp.js","assets/bundle-mjs-DfrVkH8G.js","assets/utils-CNXzeC6_.js","assets/tooltip-CIAbgIn7.js","assets/react-BziCK5DU.js","assets/database.store-C0jTx_DA.js","assets/preload-helper-DICoZAvL.js","assets/sheet-sidebar-D8BG4Pf9.js","assets/keys-o03XLuW4.js","assets/separator-B2Ii4cjw.js","assets/index-b6Apx1z7.js","assets/tanstack-HxB2LyLp.js","assets/react-dom-ctQEFzyp.js","assets/dist-DmSgBrHs.js","assets/spinner-gvrX8mkL.js","assets/badge-Ckwkbv_3.js","assets/select-Cg3fBZqb.js","assets/middleware-CEqbkwLH.js","assets/personal-preferences.store-BIcu6qr5.js","assets/index-CK2sj4Xy.css"])))=>i.map(i=>d[i]);
2
+ import{n as rs,r as ns}from"./rolldown-runtime-Ba77kUFP.js";import{_ as re,d as is,g as ve,h as Ke,n as ls,s as ne,v as xe,x as os}from"./tanstack-HxB2LyLp.js";import{$ as cs,C as ds,E as us,G as He,I as ms,J as hs,K as xs,O as _e,S as te,T as we,W as fs,Y as bs,Z as ps,_ as ke,d as Re,f as gs,ft as js,gt as vs,h as ys,i as Ns,it as Cs,k as Ie,m as Ss,o as Te,pt as ye,ut as Oe,vt as ws,w as ks,wt as Ts,x as Qe,z as Es}from"./icons-BEkcNqUd.js";import{a as Ds,i as _s,kt as Rs,n as Is,o as Os,r as Fs,t as zs}from"./radix-ui-Bp71_UWp.js";import{n as A}from"./dist-DmSgBrHs.js";import{t as E}from"./utils-CNXzeC6_.js";import{t as As}from"./spinner-gvrX8mkL.js";import{o as Fe,s as z,t as Ls}from"./keys-o03XLuW4.js";import{G as j,R as Ms,a as L,c as se,i as B,n as U,s as Ps,t as G}from"./tooltip-CIAbgIn7.js";import{i as $s,n as Vs,s as Ks,t as Hs}from"./sheet-sidebar-D8BG4Pf9.js";import{i as Qs,t as qe}from"./database.store-C0jTx_DA.js";import{t as qs}from"./preload-helper-DICoZAvL.js";import{c as Bs,d as Us,f as Gs,l as Ws,o as Ys,p as Xs,s as Zs,t as Js,u as et}from"./badge-Ckwkbv_3.js";import{a as ie,i as le,n as oe,r as M,t as ce}from"./select-Cg3fBZqb.js";import{r as st,t as tt}from"./separator-B2Ii4cjw.js";import{r as fe}from"./personal-preferences.store-BIcu6qr5.js";import{$ as at,A as rt,B as nt,D as Be,E as F,F as it,I as O,K as lt,L as ze,M as ot,N as Ue,O as ct,P as Ge,R as dt,S as ut,T as mt,V as We,Y as H,_ as Ae,a as ht,at as W,d as xt,f as ft,g as Q,h as bt,it as Y,k as pt,nt as X,o as gt,ot as Z,q as jt,rt as J,s as vt,st as ee,tt as ae,u as yt,v as Nt,y as q,z as Ct}from"./index-b6Apx1z7.js";import{t as be}from"./queries.store-BbUkkWy1.js";import{i as St,n as Ne,o as wt,r as kt,s as Tt}from"./redis-value-rbj0L_ie.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};s.SENTRY_RELEASE={id:"db-studio@1.18.0"};var t=new s.Error().stack;t&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[t]="c7cf21ba-62af-4550-8325-1a02c5ed6b7f",s._sentryDebugIdIdentifier="sentry-dbid-c7cf21ba-62af-4550-8325-1a02c5ed6b7f")}catch{}})();var Le={AUTHOR:"Hüsam 🥑 <husam@ql3.dev>",AUTHOR_NAME:"Hüsam",AUTHOR_AVATAR:"/avocado.png",AUTHOR_USERNAME:"husamql3",AUTHOR_GITHUB_LINK:"https://github.com/husamql3",SITE_DESCRIPTION:"The modern pgAdmin alternative that works with every database.",SITE_KEYWORDS:["pgadmin alternative","database client","database gui","database browser","sql editor","postgresql client","mysql client","table editor","ai sql","er diagram"],SITE_TITLE:"db-studio",SITE_NAME:"dbstudio.sh",SITE_URL:"https://dbstudio.sh",SITE_X_LINK:"https://x.com/dbstudio_sh",SITE_GITHUB_LINK:"https://github.com/husamql3/db-studio",SITE_GITHUB_NEW_ISSUE_LINK:"https://github.com/husamql3/db-studio/issues/new/choose",SITE_DOCS_LINK:"https://dbstudio.sh/docs",SITE_CHANGELOG_LINK:"https://dbstudio.sh/changelog",SITE_ROADMAP_LINK:"https://dbstudio.sh/roadmap",SITE_IMAGE:"https://dbstudio.sh/og-image.png",SITE_IMAGE_WIDTH:"1200",SITE_IMAGE_HEIGHT:"630",SITE_IMAGE_ALT:"dbstudio.sh – Modern database management studio",SITE_COLOR:"#1447e6"},i=ns(Ts(),1),Et=({enabled:s=!0}={})=>{const{data:t,isLoading:a,error:r,refetch:n}=os({queryKey:Ls.rateLimit(),queryFn:async()=>(await Ms()).data,enabled:s});return{rateLimit:t,isLoadingRateLimit:a,errorRateLimit:r,refetchRateLimit:n}},Ye={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Me=i.createContext&&i.createContext(Ye),Dt=["attr","size","title"];function _t(s,t){if(s==null)return{};var a,r,n=Rt(s,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(s);for(r=0;r<o.length;r++)a=o[r],t.indexOf(a)===-1&&{}.propertyIsEnumerable.call(s,a)&&(n[a]=s[a])}return n}function Rt(s,t){if(s==null)return{};var a={};for(var r in s)if({}.hasOwnProperty.call(s,r)){if(t.indexOf(r)!==-1)continue;a[r]=s[r]}return a}function me(){return me=Object.assign?Object.assign.bind():function(s){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)({}).hasOwnProperty.call(a,r)&&(s[r]=a[r])}return s},me.apply(null,arguments)}function Pe(s,t){var a=Object.keys(s);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(s);t&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(s,n).enumerable})),a.push.apply(a,r)}return a}function he(s){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?arguments[t]:{};t%2?Pe(Object(a),!0).forEach(function(r){It(s,r,a[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(a)):Pe(Object(a)).forEach(function(r){Object.defineProperty(s,r,Object.getOwnPropertyDescriptor(a,r))})}return s}function It(s,t,a){return(t=Ot(t))in s?Object.defineProperty(s,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):s[t]=a,s}function Ot(s){var t=Ft(s,"string");return typeof t=="symbol"?t:t+""}function Ft(s,t){if(typeof s!="object"||!s)return s;var a=s[Symbol.toPrimitive];if(a!==void 0){var r=a.call(s,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(s)}function Xe(s){return s&&s.map((t,a)=>i.createElement(t.tag,he({key:a},t.attr),Xe(t.child)))}function zt(s){return t=>i.createElement(At,me({attr:he({},s.attr)},t),Xe(s.child))}function At(s){var t=a=>{var{attr:r,size:n,title:o}=s,l=_t(s,Dt),c=n||a.size||"1em",u;return a.className&&(u=a.className),s.className&&(u=(u?u+" ":"")+s.className),i.createElement("svg",me({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},a.attr,r,l,{className:u,style:he(he({color:s.color||a.color},a.style),s.style),height:c,width:c,xmlns:"http://www.w3.org/2000/svg"}),o&&i.createElement("title",null,o),s.children)};return Me!==void 0?i.createElement(Me.Consumer,null,a=>t(a)):t(Ye)}function Lt(s){return zt({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4"},child:[]},{tag:"path",attr:{d:"M9 18c-4.51 2-5-2-7-2"},child:[]}]})(s)}var e=Rs(),Se=()=>qs(()=>import("./chat-sidebar-p9xpAAXQ.js").then(s=>s.t),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22])),Mt=(0,i.lazy)(()=>Se().then(s=>({default:s.ChatSidebar}))),Pt=()=>{const{openOverlay:s,isOverlayOpen:t}=se(),[a,r]=(0,i.useState)(!1);t("chat.assistant")&&!a&&r(!0);const{dbType:n}=qe(),{provider:o}=xt(),l=ft(bt),c=vt(),u=l.status[o],m=u?.state==="set"||u?.state==="locked",{rateLimit:x,isLoadingRateLimit:y,errorRateLimit:h}=Et({enabled:c&&o==="gemini"&&!m}),{remaining:b=0,limit:d=0}=x??{remaining:0,limit:0},S=m?"bg-emerald-500":y||h?"bg-zinc-500":o!=="gemini"||b===0?"bg-red-500":b<=5?"bg-yellow-500":"bg-emerald-500";return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(G,{children:[(0,e.jsx)(B,{asChild:!0,children:(0,e.jsxs)(j,{variant:"ghost",className:"border-r-0 border-y-0 border-l border-border rounded-none h-full w-12 relative text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors","aria-label":"Open AI assistant",onPointerEnter:Se,onFocus:Se,onClick:()=>{s("chat.assistant"),n&&Qs.capture("chat_opened",{db_type:n})},children:[(0,e.jsx)(Ss,{className:"size-5"}),(0,e.jsx)("span",{"data-testid":"chat-status-indicator",className:E("absolute top-2 right-2 h-2 w-2 rounded-full ring-2 ring-background",S)})]})}),(0,e.jsx)(U,{side:"bottom",className:"text-xs",children:m?(0,e.jsxs)("p",{children:["AI Assistant · personal ",o," key"]}):!y&&!h?b>0?(0,e.jsxs)("p",{children:[b,"/",d," messages remaining"]}):(0,e.jsx)("p",{children:"AI Assistant"}):(0,e.jsx)("p",{children:"AI status unavailable"})})]}),a&&(0,e.jsx)(i.Suspense,{children:(0,e.jsx)(Mt,{})})]})},$t=()=>{const{pathname:s}=ne(),t=xe({strict:!1}),a=s.split("/")[1]||"table",r=H(),n=r?.dataModel==="key-value"?["browser","runner"]:Ps.filter(l=>l!=="indexes"||r?.indexes),o=t.table;return(0,e.jsx)("div",{className:"flex h-full items-center",children:n.map(l=>{const c=(l==="table"||l==="schema"||l==="indexes")&&o;return(0,e.jsx)(Ke,{to:c?`/${l}/$table`:`/${l}`,params:c?{table:o}:void 0,className:"h-full flex items-center",children:(0,e.jsx)(j,{variant:"ghost",className:E("flex-1 px-4 border-l-0 border-y-0 border-r border-border h-full rounded-none capitalize text-xs font-medium transition-colors",a===l?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground hover:bg-muted/50"),children:l})},l)})})},Vt=()=>{const{sidebar:{isOpen:s,isPinned:t},setSidebarOpen:a,setSidebarPinned:r}=fe(),n=()=>{a(!s),r(!t)};return(0,e.jsx)(j,{variant:"ghost",onClick:n,className:"h-full aspect-square border-l-0 border-y-0 border-r border-border rounded-none text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors",children:(0,e.jsx)(us,{className:"size-5"})})},Kt=()=>{const{theme:s,isDark:t,setTheme:a}=ut(),{openOverlay:r}=se();return(0,e.jsxs)("div",{className:"border-b border-border w-full flex items-center justify-between bg-background text-foreground h-12",children:[(0,e.jsxs)("div",{className:"flex items-center h-full",children:[(0,e.jsx)(Vt,{}),(0,e.jsx)($t,{})]}),(0,e.jsxs)("div",{className:"flex items-center h-full",children:[(0,e.jsx)(Pt,{}),(0,e.jsxs)(G,{children:[(0,e.jsx)(B,{asChild:!0,children:(0,e.jsx)(j,{type:"button",variant:"ghost",className:"border-r-0 border-y-0 border-l border-border rounded-none h-full w-12 text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors","aria-label":"Open settings",onClick:()=>r("settings.app"),children:(0,e.jsx)(ys,{className:"size-5"})})}),(0,e.jsx)(U,{children:(0,e.jsx)("p",{children:"Settings"})})]}),(0,e.jsxs)(Ue,{children:[(0,e.jsxs)(G,{children:[(0,e.jsx)(B,{asChild:!0,children:(0,e.jsx)(We,{asChild:!0,children:(0,e.jsx)(j,{variant:"ghost",className:"border-r-0 border-y-0 border-l border-border rounded-none h-full w-12 text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors","aria-label":`Theme: ${s}, switch theme`,children:s==="light"?(0,e.jsx)(Re,{className:"size-5"}):s==="dark"?(0,e.jsx)(_e,{className:"size-5"}):(0,e.jsx)(Ie,{className:"size-5"})})})}),(0,e.jsx)(U,{children:(0,e.jsx)("p",{children:t?"Switch to light mode":"Switch to dark mode"})})]}),(0,e.jsxs)(Ge,{align:"end",children:[(0,e.jsxs)(O,{onClick:()=>a("light"),children:[(0,e.jsx)(Re,{}),"Light",s==="light"&&(0,e.jsx)(ye,{className:"ml-auto"})]}),(0,e.jsxs)(O,{onClick:()=>a("dark"),children:[(0,e.jsx)(_e,{}),"Dark",s==="dark"&&(0,e.jsx)(ye,{className:"ml-auto"})]}),(0,e.jsxs)(O,{onClick:()=>a("system"),children:[(0,e.jsx)(Ie,{}),"System",s==="system"&&(0,e.jsx)(ye,{className:"ml-auto"})]})]})]}),(0,e.jsxs)(G,{children:[(0,e.jsx)(B,{asChild:!0,children:(0,e.jsx)(j,{variant:"ghost",className:"border-r-0 border-y-0 border-l border-border rounded-none h-full w-12 text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors",asChild:!0,children:(0,e.jsx)("a",{href:Le.SITE_GITHUB_NEW_ISSUE_LINK,target:"_blank",rel:"noopener noreferrer","aria-label":"Create a new GitHub issue",children:(0,e.jsx)(vs,{className:"size-5"})})})}),(0,e.jsx)(U,{children:(0,e.jsx)("p",{children:"Report a bug"})})]}),(0,e.jsxs)(G,{children:[(0,e.jsx)(B,{asChild:!0,children:(0,e.jsx)(j,{variant:"ghost",className:"border-r-0 border-y-0 border-l border-border rounded-none h-full w-12 text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors",asChild:!0,children:(0,e.jsx)("a",{href:Le.SITE_GITHUB_LINK,target:"_blank",rel:"noopener noreferrer","aria-label":"View the db-studio GitHub repository",children:(0,e.jsx)(Lt,{className:"size-5"})})})}),(0,e.jsx)(U,{children:(0,e.jsx)("p",{children:"View on GitHub"})})]})]})]})};function Ze({...s}){return(0,e.jsx)(_s,{"data-slot":"context-menu",...s})}function Je({className:s,...t}){return(0,e.jsx)(Os,{"data-slot":"context-menu-trigger",className:E("select-none",s),...t})}function es({className:s,...t}){return(0,e.jsx)(Fs,{children:(0,e.jsx)(zs,{"data-slot":"context-menu-content",className:E("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-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 ring-foreground/10 bg-popover text-popover-foreground min-w-32 rounded-lg p-1 shadow-md ring-1 duration-100 z-50 max-h-(--radix-context-menu-content-available-height) origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto",s),...t})})}function V({className:s,inset:t,variant:a="default",...r}){return(0,e.jsx)(Is,{"data-slot":"context-menu-item","data-inset":t,"data-variant":a,className:E("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive not-data-[variant=destructive]:focus:**:text-accent-foreground min-h-7 gap-2 rounded-md px-2 py-1 text-xs/relaxed [&_svg:not([class*='size-'])]:size-3.5 group/context-menu-item relative flex cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0",s),...r})}function $e({className:s,...t}){return(0,e.jsx)(Ds,{"data-slot":"context-menu-separator",className:E("bg-border/50 -mx-1 my-1 h-px",s),...t})}var Ce=({folderId:s,isExpanded:t,onToggle:a,count:r,name:n,showContextMenu:o=!1})=>{const l=re(),{deleteFolder:c,getQueriesByFolder:u,addQuery:m,updateFolder:x}=be(),[y,h]=(0,i.useState)(!1),[b,d]=(0,i.useState)(""),[p,S]=(0,i.useState)(!1),f=(0,i.useCallback)(()=>{if(s){if(u(s).length>0){S(!0);return}c(s)}},[c,s,u]),w=(0,i.useCallback)(()=>{s&&(c(s),S(!1))},[c,s]),D=(0,i.useCallback)(()=>{const R=m(void 0,s);l({to:"/runner/$queryId",params:{queryId:R}})},[m,s,l]),v=(0,i.useCallback)(()=>{d(n),h(!0)},[n]),_=(0,i.useCallback)(()=>{s&&b.trim()&&(x(s,{name:b.trim()}),h(!1),d(""))},[s,b,x]);return(0,e.jsxs)(e.Fragment,{children:[o?(0,e.jsxs)(Ze,{children:[(0,e.jsx)(Je,{asChild:!0,children:(0,e.jsxs)("button",{type:"button",onClick:a,className:E("w-full flex gap-2 px-4 py-2 text-sm transition-colors text-left","hover:bg-sidebar-accent/50 hover:text-sidebar-foreground focus:outline-none focus:bg-sidebar-accent focus:text-sidebar-accent-foreground","text-sidebar-foreground/70 items-center"),children:[(0,e.jsx)(Oe,{className:E("size-4 transition-transform duration-200",t?"rotate-90":"")}),(0,e.jsx)("span",{className:"flex-1",children:n}),(0,e.jsx)(ae,{children:r})]})}),(0,e.jsxs)(es,{children:[(0,e.jsxs)(V,{onClick:D,children:[(0,e.jsx)(te,{className:"size-4"}),"Add a new query"]}),(0,e.jsxs)(V,{onClick:v,children:[(0,e.jsx)(we,{className:"size-4"}),"Rename folder"]}),(0,e.jsxs)(V,{onClick:f,children:[(0,e.jsx)(Te,{className:"size-4"}),"Delete folder"]})]})]}):(0,e.jsxs)("button",{type:"button",onClick:a,className:E("w-full flex gap-2 px-4 py-2 text-sm transition-colors text-left","hover:bg-sidebar-accent/50 hover:text-sidebar-foreground focus:outline-none focus:bg-sidebar-accent focus:text-sidebar-accent-foreground","text-sidebar-foreground/70 items-center"),children:[(0,e.jsx)(Oe,{className:E("size-4 transition-transform duration-200",t?"rotate-90":"")}),(0,e.jsx)("span",{className:"flex-1",children:n}),(0,e.jsx)(ae,{children:r})]}),(0,e.jsx)(X,{open:y,onOpenChange:h,children:(0,e.jsxs)(J,{children:[(0,e.jsxs)(Z,{children:[(0,e.jsx)(ee,{children:"Rename Folder"}),(0,e.jsx)(Y,{children:"Enter a new name for this folder."})]}),(0,e.jsx)(z,{value:b,onChange:R=>d(R.target.value),placeholder:"Folder name",onKeyDown:R=>{R.key==="Enter"&&_()},autoFocus:!0}),(0,e.jsxs)(W,{children:[(0,e.jsx)(j,{variant:"outline",onClick:()=>{h(!1),d("")},children:"Cancel"}),(0,e.jsx)(j,{onClick:_,disabled:!b.trim(),children:"Rename"})]})]})}),(0,e.jsx)(Ys,{open:p,onOpenChange:S,children:(0,e.jsxs)(Ws,{children:[(0,e.jsxs)(Gs,{children:[(0,e.jsx)(Xs,{children:"Delete Folder"}),(0,e.jsxs)(et,{children:["This folder contains ",r," ",r===1?"query":"queries",". Deleting this folder will also delete all queries inside it. This action cannot be undone."]})]}),(0,e.jsxs)(Us,{children:[(0,e.jsx)(Bs,{children:"Cancel"}),(0,e.jsx)(Zs,{onClick:w,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete Folder"})]})]})})]})},ue=({id:s,tableName:t,isNested:a=!1,showContextMenu:r=!0})=>{const n=re(),{deleteQuery:o,addQuery:l,getQuery:c,toggleFavorite:u,updateQuery:m,moveQuery:x,folders:y,addFolder:h}=be(),{queryId:b}=xe({strict:!1}),d=b===s,p=c(s),S=p?.isFavorite??!1,[f,w]=(0,i.useState)(!1),[D,v]=(0,i.useState)(""),[_,R]=(0,i.useState)(!1),[g,N]=(0,i.useState)(void 0),[k,I]=(0,i.useState)(!1),[P,$]=(0,i.useState)(""),de=(0,i.useCallback)(()=>{n({to:"/runner/$queryId",params:{queryId:s}})},[n,s]),pe=(0,i.useCallback)(()=>{o(s),b===s&&n({to:"/runner"}),A.success("Query deleted successfully")},[o,s,n,b]),ge=(0,i.useCallback)(()=>{const C=c(s),as=l(`${C?.name} (Copy)`);n({to:"/runner/$queryId",params:{queryId:as}}),A.success("Query duplicated successfully")},[l,c,n,s]),T=(0,i.useCallback)(()=>{u(s),A.success("Query favorited successfully")},[u,s]),je=(0,i.useCallback)(()=>{v(p?.name??""),w(!0)},[p?.name]),Ee=(0,i.useCallback)(()=>{D.trim()&&(m(s,{name:D.trim()}),w(!1),v(""),A.success("Query renamed successfully"))},[s,D,m]),ss=(0,i.useCallback)(()=>{N(p?.folderId),I(!1),$(""),R(!0)},[p?.folderId]),ts=(0,i.useCallback)(C=>{C==="__create_new__"?(I(!0),N(void 0)):(I(!1),N(C==="__none__"?void 0:C))},[]),De=(0,i.useCallback)(()=>{if(k&&P.trim()){const C=Math.random().toString(36).substring(2,15);h({id:C,name:P.trim(),isExpanded:!0,isFavorite:!1}),x(s,C),A.success("Query moved to new folder successfully")}else k||(x(s,g),A.success("Query moved to selected folder successfully"));R(!1),I(!1),$(""),N(void 0)},[k,P,g,s,h,x]);return(0,e.jsxs)("li",{className:"relative",children:[r?(0,e.jsxs)(Ze,{children:[(0,e.jsx)(Je,{asChild:!0,children:(0,e.jsxs)("button",{type:"button",onClick:de,className:E("w-full flex gap-2 py-2 text-sm transition-colors text-left justify-start items-center focus:outline-none",d?"text-sidebar-accent-foreground bg-sidebar-accent font-medium":"text-sidebar-foreground/70 hover:text-sidebar-foreground hover:bg-sidebar-accent/50 focus:bg-sidebar-accent focus:text-sidebar-accent-foreground",a?"px-4 pl-12":"px-4"),children:[d&&(0,e.jsx)("span",{className:"absolute left-0 top-0 bottom-0 w-1 bg-primary"}),(0,e.jsx)("span",{className:"flex-1",children:t})]})}),(0,e.jsxs)(es,{children:[(0,e.jsxs)(V,{onClick:je,children:[(0,e.jsx)(we,{className:"size-4"}),"Rename query"]}),(0,e.jsxs)(V,{onClick:ge,children:[(0,e.jsx)(cs,{className:"size-4"}),"Duplicate query"]}),(0,e.jsxs)(V,{onClick:T,children:[(0,e.jsx)(gs,{className:S?"size-4 fill-current":"size-4"}),S?"Remove from favorites":"Add to favorites"]}),(0,e.jsx)($e,{}),(0,e.jsxs)(V,{onClick:ss,children:[(0,e.jsx)(fs,{className:"size-4"}),"Move to folder"]}),(0,e.jsx)($e,{}),(0,e.jsxs)(V,{onClick:pe,children:[(0,e.jsx)(Te,{className:"size-4"}),"Delete query"]})]})]}):(0,e.jsxs)("button",{type:"button",onClick:de,className:E("w-full flex gap-2 py-2 text-sm transition-colors text-left justify-start items-center focus:outline-none",d?"text-sidebar-accent-foreground bg-sidebar-accent font-medium":"text-sidebar-foreground/70 hover:text-sidebar-foreground hover:bg-sidebar-accent/50 focus:bg-sidebar-accent focus:text-sidebar-accent-foreground",a?"px-4 pl-12":"px-4"),children:[d&&(0,e.jsx)("span",{className:"absolute left-0 top-0 bottom-0 w-1 bg-primary"}),(0,e.jsx)("span",{className:"flex-1",children:t})]}),(0,e.jsx)(X,{open:f,onOpenChange:w,children:(0,e.jsxs)(J,{children:[(0,e.jsxs)(Z,{children:[(0,e.jsx)(ee,{children:"Rename Query"}),(0,e.jsx)(Y,{children:"Enter a new name for this query."})]}),(0,e.jsx)(z,{value:D,onChange:C=>v(C.target.value),placeholder:"Query name",onKeyDown:C=>{C.key==="Enter"&&Ee()},autoFocus:!0}),(0,e.jsxs)(W,{children:[(0,e.jsx)(j,{variant:"outline",onClick:()=>{w(!1),v("")},children:"Cancel"}),(0,e.jsx)(j,{onClick:Ee,disabled:!D.trim(),children:"Rename"})]})]})}),(0,e.jsx)(X,{open:_,onOpenChange:C=>{R(C),C||(I(!1),$(""),N(void 0))},children:(0,e.jsxs)(J,{children:[(0,e.jsxs)(Z,{children:[(0,e.jsx)(ee,{children:"Move to Folder"}),(0,e.jsx)(Y,{children:"Select a folder to move this query to."})]}),(0,e.jsx)("div",{className:"space-y-4",children:k?(0,e.jsx)(z,{value:P,onChange:C=>$(C.target.value),placeholder:"Folder name",onKeyDown:C=>{C.key==="Enter"&&P.trim()&&De(),C.key==="Escape"&&(I(!1),$(""))},autoFocus:!0}):(0,e.jsxs)(ce,{value:g??"__none__",onValueChange:ts,children:[(0,e.jsx)(le,{className:"w-full",children:(0,e.jsx)(ie,{placeholder:"Select a folder"})}),(0,e.jsxs)(oe,{children:[(0,e.jsx)(M,{value:"__none__",children:"No folder"}),y.map(C=>(0,e.jsx)(M,{value:C.id,children:C.name},C.id)),(0,e.jsx)(M,{value:"__create_new__",children:(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(He,{className:"size-4"}),"Create a new folder"]})})]})]})}),(0,e.jsxs)(W,{children:[(0,e.jsx)(j,{variant:"outline",onClick:()=>{R(!1),I(!1),$(""),N(void 0)},children:"Cancel"}),(0,e.jsx)(j,{onClick:De,disabled:k&&!P.trim(),children:k?"Create & Move":"Move"})]})]})})]})},Ht=()=>{const[s]=F(L.SIDEBAR_SEARCH,{defaultValue:""}),{folders:t,queries:a,getFavoriteQueries:r,getQueriesByFolder:n,toggleFolder:o}=be(),[l,c]=(0,i.useState)(!0),[u,m]=(0,i.useState)(!0),x=a.filter(d=>!d.isFavorite).length,y=r(),h=y.length,b=a.filter(d=>!d.folderId&&!d.isFavorite);if(s){const d=a.filter(p=>p.name.toLowerCase().includes(s.toLowerCase()));return d.length===0?(0,e.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:"No queries found matching"}):(0,e.jsx)("div",{className:"flex-1 overflow-y-auto",children:d.map(p=>(0,e.jsx)(ue,{id:p.id,tableName:p.name},p.id))})}return(0,e.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[(0,e.jsx)(Ce,{name:"Favorites",isExpanded:l,onToggle:()=>c(!l),count:h}),l&&y.map(d=>(0,e.jsx)(ue,{id:d.id,tableName:d.name},d.id)),(0,e.jsx)(tt,{className:"bg-sidebar-border"}),(0,e.jsx)(Ce,{name:"Queries",isExpanded:u,onToggle:()=>m(!u),count:x}),u&&(0,e.jsxs)(e.Fragment,{children:[t.map(d=>{const p=n(d.id),S=p.length;return(0,e.jsxs)("div",{children:[(0,e.jsx)(Ce,{folderId:d.id,name:d.name,isExpanded:d.isExpanded,onToggle:()=>o(d.id),count:S,showContextMenu:!0}),d.isExpanded&&p.map(f=>(0,e.jsx)(ue,{id:f.id,tableName:f.name,isNested:!0,showContextMenu:!0},f.id))]},d.id)}),b.map(d=>(0,e.jsx)(ue,{id:d.id,tableName:d.name,showContextMenu:!0},d.id))]})]})},Qt=()=>{const{addQuery:s,addFolder:t}=be(),a=re(),r=(0,i.useRef)(null),[n,o]=F(L.SIDEBAR_SEARCH,{defaultValue:""}),l=m=>{o(m.target.value)},c=()=>{const m=s();a({to:"/runner/$queryId",params:{queryId:m}})},u=()=>{const m=Math.random().toString(36).substring(2,15);t({id:m,name:"New Folder",isExpanded:!0,isFavorite:!1})};return(0,e.jsxs)("div",{className:"p-3 space-y-2 border-b border-sidebar-border",children:[(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsxs)(j,{className:"flex-1 justify-start h-8",onClick:c,children:[(0,e.jsx)(te,{className:"size-4"}),"Add Query"]}),(0,e.jsxs)(j,{className:"flex-1 justify-start h-8",onClick:u,children:[(0,e.jsx)(He,{className:"size-4"}),"Add Folder"]})]}),(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsx)(ke,{className:"absolute left-2 top-1/2 -translate-y-1/2 size-4 text-muted-foreground"}),(0,e.jsx)(z,{ref:r,placeholder:"Search queries",value:n??"",onChange:l,className:"rounded-sm h-8 pl-8 pr-8"}),(0,e.jsx)(ae,{className:"absolute right-2 top-1/2 -translate-y-1/2 text-xs",children:"/"})]})]})},qt=()=>(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Qt,{}),(0,e.jsx)(Ht,{})]}),Bt=({tableName:s,schemaName:t})=>{const a=re(),r=xe({strict:!1}),{pathname:n}=ne(),{copyTableSchema:o,isCopyingSchema:l}=at(),{exportFile:c,isExportingFile:u}=pt(),{deleteTable:m,forceDeleteTable:x,isDeletingTable:y}=rt(),{renameTable:h,isRenamingTable:b}=ct({tableName:s,schemaName:t}),{openOverlay:d,closeOverlay:p,isOverlayOpen:S}=se(),{setEditingTable:f}=jt(),w=ot(),[D,v]=(0,i.useState)(s),[_,R]=(0,i.useState)([]),g=`tables.rename-table.${s}`,N=`tables.delete-table.${s}`,k=`tables.force-delete-table.${s}`,I=T=>{T?(v(s),d(g)):p(g)},P=async()=>{const T=D.trim();if(!(!T||T===s))try{if(await h({newTableName:T,schemaName:t}),I(!1),r.table===s){const je=n.startsWith("/schema")?"/schema/$table":n.startsWith("/indexes")?"/indexes/$table":"/table/$table";a({to:je,params:{table:T}})}}catch{}},$=()=>{navigator.clipboard.writeText(s),A.success("Table name copied to clipboard")},de=async()=>{const T=await m(s);T.fkViolation?(R(T.relatedRecords),p(N),d(k)):(p(N),a({to:"/"}))},pe=async()=>{await x(s),p(k),a({to:"/"})},ge=()=>{p(k),R([])};return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(Ue,{children:[(0,e.jsx)(We,{asChild:!0,children:(0,e.jsx)(j,{variant:"ghost",size:"icon-sm",onClick:T=>{T.stopPropagation(),T.preventDefault()},onPointerDown:T=>{T.stopPropagation()},children:(0,e.jsx)(hs,{})})}),(0,e.jsx)(Ge,{className:"w-56",align:"start",children:(0,e.jsxs)(it,{children:[(0,e.jsxs)(O,{onClick:$,children:[(0,e.jsx)(Cs,{className:"size-4"}),"Copy name"]}),(0,e.jsxs)(O,{onClick:()=>o(s),disabled:l,children:[(0,e.jsx)(xs,{className:"size-4"}),"Copy table schema"]}),(0,e.jsx)(ze,{}),(0,e.jsxs)(O,{onClick:()=>I(!0),children:[(0,e.jsx)(Ns,{className:"size-4"}),"Rename table"]}),!w&&(0,e.jsxs)(O,{onClick:()=>{f(s),d("schema.edit-table")},children:[(0,e.jsx)(we,{className:"size-4"}),"Edit table"]}),(0,e.jsxs)(dt,{children:[(0,e.jsxs)(nt,{children:[(0,e.jsx)(bs,{className:"size-4"}),"Export data"]}),(0,e.jsxs)(Ct,{children:[(0,e.jsx)(O,{onClick:()=>c({tableName:s,format:"csv"}),disabled:u,children:"Export as CSV"}),(0,e.jsx)(O,{onClick:()=>c({tableName:s,format:"json"}),disabled:u,children:"Export as JSON"}),(0,e.jsx)(O,{onClick:()=>c({tableName:s,format:"xlsx"}),disabled:u,children:"Export as Excel"})]})]}),(0,e.jsx)(ze,{}),(0,e.jsxs)(O,{variant:"destructive",onClick:()=>d(N),children:[(0,e.jsx)(Te,{className:"size-4"}),"Delete table"]})]})})]}),(0,e.jsx)(Ut,{tableName:s,newTableName:D,setNewTableName:v,isOpen:S(g),onOpenChange:I,onRename:P,isRenaming:b}),(0,e.jsx)(Gt,{isOpen:S(N),onOpenChange:T=>{T||p(N)},tableName:s,onDelete:de,isDeleting:y}),(0,e.jsx)(Wt,{isOpen:S(k),onOpenChange:T=>{T||p(k)},tableName:s,relatedRecords:_,onForceDelete:pe,onCancel:ge,isDeleting:y})]})},Ut=({tableName:s,newTableName:t,setNewTableName:a,isOpen:r,onOpenChange:n,onRename:o,isRenaming:l})=>{const c=t.trim(),u=!c||c===s;return(0,e.jsx)(X,{open:r,onOpenChange:n,children:(0,e.jsxs)(J,{className:"max-w-md",children:[(0,e.jsxs)(Z,{children:[(0,e.jsx)(ee,{children:"Rename Table"}),(0,e.jsx)(Y,{children:"Update the table name while keeping all data and schema unchanged."})]}),(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(Fe,{htmlFor:"current-table-name",children:"Current name"}),(0,e.jsx)(z,{id:"current-table-name",value:s,readOnly:!0,disabled:!0})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(Fe,{htmlFor:"new-table-name",children:"New name"}),(0,e.jsx)(z,{id:"new-table-name",value:t,onChange:m=>a(m.target.value),placeholder:"table_name",autoFocus:!0,disabled:l,onKeyDown:m=>{m.key==="Enter"&&!u&&!l&&o()}})]})]}),(0,e.jsxs)(W,{className:"gap-2",children:[(0,e.jsx)(j,{variant:"outline",onClick:()=>n(!1),disabled:l,children:"Cancel"}),(0,e.jsx)(j,{onClick:o,disabled:u||l,children:l?"Renaming...":"Rename Table"})]})]})})},Gt=({isOpen:s,onOpenChange:t,tableName:a,onDelete:r,isDeleting:n})=>(0,e.jsx)(X,{open:s,onOpenChange:t,children:(0,e.jsxs)(J,{className:"max-w-md",children:[(0,e.jsxs)(Z,{children:[(0,e.jsx)(ee,{children:"Delete Table"}),(0,e.jsxs)(Y,{children:["Are you sure you want to delete the table"," ",(0,e.jsxs)("span",{className:"font-semibold text-foreground",children:['"',a,'"']}),"? This action cannot be undone and all data will be permanently lost."]})]}),(0,e.jsxs)(W,{className:"gap-2",children:[(0,e.jsx)(j,{variant:"outline",onClick:()=>t(!1),disabled:n,children:"Cancel"}),(0,e.jsx)(j,{variant:"destructive",onClick:r,disabled:n,children:n?"Deleting...":"Delete Table"})]})]})}),Wt=({isOpen:s,onOpenChange:t,tableName:a,relatedRecords:r,onForceDelete:n,onCancel:o,isDeleting:l})=>(0,e.jsx)(X,{open:s,onOpenChange:t,children:(0,e.jsxs)(J,{className:"max-w-xl! max-h-[calc(100vh-1rem)]!",children:[(0,e.jsxs)(Z,{children:[(0,e.jsx)(ee,{children:"Cannot Delete - Foreign Key Constraint"}),(0,e.jsxs)(Y,{children:["The table ",(0,e.jsxs)("span",{className:"font-semibold text-foreground",children:['"',a,'"']})," ","cannot be deleted because it is referenced by records in other tables. You can either cancel the operation or force delete, which will also delete all related records."]})]}),(0,e.jsx)("div",{className:"space-y-4 max-h-64 overflow-y-auto",children:r.map((c,u)=>(0,e.jsxs)("div",{className:"border border-border rounded-md p-3",children:[(0,e.jsxs)("div",{className:"font-medium text-sm mb-2",children:["Table: ",(0,e.jsx)("span",{className:"text-primary",children:c.tableName}),(0,e.jsxs)("span",{className:"text-muted-foreground ml-2",children:["(",c.records.length," record",c.records.length!==1?"s":"",")"]})]}),(0,e.jsxs)("div",{className:"text-xs text-muted-foreground mb-2",children:["References column: ",c.columnName]}),(0,e.jsx)("div",{className:"bg-muted rounded p-2 text-xs overflow-x-auto",children:(0,e.jsxs)("pre",{className:"whitespace-pre-wrap",children:[JSON.stringify(c.records.slice(0,5),null,2),c.records.length>5&&(0,e.jsxs)("div",{className:"text-muted-foreground mt-2",children:["... and ",c.records.length-5," more"]})]})})]},`${c.tableName}-${c.columnName}-${u}`))}),(0,e.jsxs)(W,{className:"gap-2",children:[(0,e.jsx)(j,{variant:"outline",onClick:o,disabled:l,children:"Cancel"}),(0,e.jsx)(j,{variant:"destructive",onClick:n,disabled:l,children:l?"Deleting...":"Force Delete All"})]})]})}),Yt=({tableName:s,rowCount:t,rowCountEstimated:a,schemaName:r})=>{const n=xe({strict:!1}),{pathname:o}=ne(),l=n.table===s,c=o.startsWith("/schema")?"/schema/$table":o.startsWith("/indexes")?"/indexes/$table":"/table/$table";return(0,e.jsxs)("li",{className:"relative group",children:[l&&(0,e.jsx)("span",{className:"absolute left-0 top-0 bottom-0 w-1 bg-primary z-10"}),(0,e.jsxs)("div",{className:E("w-full flex gap-0.5 pl-4 pr-2 py-1.5 text-sm transition-colors text-left justify-start items-center focus:outline-none",l?"text-sidebar-accent-foreground bg-sidebar-accent font-medium":"text-sidebar-foreground/70 hover:text-sidebar-foreground hover:bg-sidebar-accent/50 focus:bg-sidebar-accent focus:text-sidebar-accent-foreground"),children:[(0,e.jsx)(Ke,{to:c,params:{table:s},className:"flex-1 flex items-center gap-1 min-w-0 focus:outline-none",children:(0,e.jsxs)("span",{className:"flex-1 truncate",children:[r&&r!=="public"?`${r}.`:"",s]})}),(0,e.jsxs)("div",{className:"flex items-center gap-1 h-5 shrink-0",children:[(0,e.jsx)("div",{className:E(l?"opacity-100":"opacity-0 group-hover:opacity-100 focus-within:opacity-100"),children:(0,e.jsx)(Bt,{tableName:s,schemaName:r})}),(0,e.jsxs)(ae,{children:[a&&"~",t]})]})]})]})},Xt=()=>{const[s]=F(L.SIDEBAR_SEARCH,{defaultValue:""}),[t,a]=F(L.ACTIVE_SCHEMA,{defaultValue:"all"}),r=H(),{tablesList:n=[],isLoadingTablesList:o,errorTablesList:l}=Be(),c=(0,i.useMemo)(()=>Array.from(new Set(n.reduce((x,y)=>(y.schemaName&&x.push(y.schemaName),x),[]))).sort(),[n]),u=(r?.schemaSelector??!1)&&c.length>1,m=n?.filter(x=>{const y=t==="all"||x.schemaName===t,h=x.tableName.toLowerCase().includes(s.toLowerCase());return y&&h});return(0,i.useEffect)(()=>{!u||t==="all"||c.includes(t)||a("all")},[c,t,a,u]),o?(0,e.jsx)("div",{className:"flex-1 h-full overflow-y-auto pb-3 flex items-center justify-center",children:(0,e.jsx)(As,{size:"size-6"})}):l?(0,e.jsxs)("div",{className:"flex-1 overflow-y-auto pb-3 h-full flex items-center justify-center",children:["Error: ",l.message]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"flex-1 overflow-y-auto pb-3",children:m&&m.length>0?(0,e.jsx)("ul",{children:m?.map(x=>(0,e.jsx)(Yt,{schemaName:x.schemaName,tableName:x.tableName,rowCount:x.rowCount,rowCountEstimated:x.rowCountEstimated},x.schemaName?`${x.schemaName}.${x.tableName}`:x.tableName))}):s?(0,e.jsx)("div",{className:"flex-1 overflow-y-auto pb-3 h-full flex items-center justify-center",children:"No tables found matching"}):(0,e.jsx)("div",{className:"flex-1 overflow-y-auto pb-3 h-full flex items-center justify-center",children:"No tables available"})}),(0,e.jsx)(lt,{})]})},Zt=()=>{const s=(0,i.useRef)(null),[t,a]=F(L.SIDEBAR_SEARCH,{defaultValue:""}),{openOverlay:r}=se(),n=H();return mt("/",o=>{o.preventDefault(),s.current&&s.current.focus()},{preventDefault:!0}),(0,e.jsx)("div",{className:"px-3 pb-3 pt-2 space-y-2",children:(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsxs)("div",{className:"relative min-w-0 flex-1",children:[(0,e.jsx)(ke,{className:"absolute left-2 top-1/2 -translate-y-1/2 size-4 text-muted-foreground"}),(0,e.jsx)(z,{ref:s,variant:"outline",placeholder:"Search tables",value:t??"",onChange:o=>a(o.target.value.trim()),className:"rounded-sm h-8 pl-8 pr-8"}),(0,e.jsx)(ae,{className:"absolute right-2 top-1/2 -translate-y-1/2 text-xs",children:"/"})]}),n?.dataModel!=="document"&&(0,e.jsx)(j,{size:"icon-lg",className:"shrink-0 rounded-sm",onClick:()=>r("table-builder.create-table"),"aria-label":"Add table",children:(0,e.jsx)(te,{className:"size-4"})})]})})},Jt=()=>{const[s,t]=F(L.ACTIVE_SCHEMA,{defaultValue:"all"}),a=H(),{tablesList:r=[]}=Be(),n=(0,i.useMemo)(()=>Array.from(new Set(r.reduce((o,l)=>(l.schemaName&&o.push(l.schemaName),o),[]))).sort(),[r]);return(a?.schemaSelector??!1)&&n.length>1?(0,e.jsx)("div",{className:"px-3 pt-3",children:(0,e.jsxs)(ce,{value:s,onValueChange:t,children:[(0,e.jsx)(le,{variant:"outline",className:"h-8! w-full justify-between rounded-sm",children:(0,e.jsx)(ie,{placeholder:"Select schema"})}),(0,e.jsxs)(oe,{children:[(0,e.jsx)(M,{value:"all",children:"All schemas"}),n.map(o=>(0,e.jsx)(M,{value:o,children:o},o))]})]})}):null},Ve=()=>(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Jt,{}),(0,e.jsx)(Zt,{}),(0,e.jsx)(st,{className:"flex-1 overflow-y-auto pb-3 block h-full w-full",children:(0,e.jsx)(Xt,{})})]});function ea(){const{databases:s,isLoadingDatabases:t,refetchDatabases:a,isRefetchingDatabases:r}=gt(),{connectionInfo:n,isLoadingConnectionInfo:o}=ht(),{selectedDatabase:l,setSelectedDatabase:c}=qe(),u=H(),m=re(),[x,y]=(0,i.useState)(!1),h=d=>{c(d),m({to:u?.dataModel==="key-value"?"/browser":"/table",search:{}})},b=async()=>{await a(),A.success("Databases refreshed")};return(0,e.jsx)("div",{className:"mt-auto border-t border-sidebar-border bg-sidebar text-sidebar-foreground",children:(0,e.jsxs)("div",{className:"p-4 space-y-2",children:[(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(ps,{className:"size-4 text-muted-foreground"}),(0,e.jsx)("span",{className:"text-sm font-medium",children:"Database"})]}),(0,e.jsxs)(G,{children:[(0,e.jsx)(B,{asChild:!0,children:(0,e.jsx)(j,{variant:"ghost",size:"icon",className:"size-6 hover:bg-accent",onClick:b,disabled:t||r,children:(0,e.jsx)(Qe,{className:E("size-3.5",(t||r)&&"animate-spin")})})}),(0,e.jsx)(U,{children:"Refresh databases"})]})]}),(0,e.jsxs)(ce,{value:l||"",onValueChange:h,children:[(0,e.jsx)(le,{className:"h-9 text-xs font-mono w-full",disabled:t||r,children:(0,e.jsx)(ie,{placeholder:"Select database..."})}),(0,e.jsx)(oe,{children:s?.map(d=>(0,e.jsx)(M,{value:d.name,className:"font-mono text-xs",children:d.name},d.name))})]})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsxs)(j,{variant:"ghost",className:"w-full hover:bg-accent flex items-center justify-between",onClick:()=>y(!x),disabled:o||r,children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("div",{className:"flex items-center justify-center",children:(0,e.jsxs)("div",{className:"relative flex size-2",children:[(0,e.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),(0,e.jsx)("span",{className:"relative inline-flex rounded-full size-2 bg-green-500"})]})}),(0,e.jsx)("span",{className:"text-xs font-medium text-green-600",children:"Connected"})]}),(0,e.jsx)(js,{className:E("size-3 text-muted-foreground transition-transform",x&&"rotate-180")})]}),x&&n&&(0,e.jsxs)("div",{className:"space-y-1.5 p-2 rounded-md bg-muted/30",children:[(0,e.jsxs)("div",{className:"flex justify-between items-center",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"Host"}),(0,e.jsxs)("span",{className:"text-xs font-mono text-foreground",children:[n.host,":",n.port]})]}),(0,e.jsxs)("div",{className:"flex justify-between items-center",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"User"}),(0,e.jsx)("span",{className:"text-xs font-mono text-foreground",children:n.user})]}),(0,e.jsxs)("div",{className:"flex justify-between items-center",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"Databases"}),(0,e.jsx)("span",{className:"text-xs font-mono font-medium text-foreground",children:s?.length||0})]})]})]})]})})}var sa=()=>{const{sidebar:{isPinned:s},toggleSidebarPinned:t}=fe();return(0,e.jsx)("div",{className:"flex items-center justify-between h-9 border-b border-sidebar-border",children:(0,e.jsx)(j,{variant:"ghost",size:"lg",onClick:t,className:"size-9 flex items-center justify-center transition hover:bg-transparent! focus-visible:ring-0 focus-visible:ring-offset-0",title:s?"Unpin sidebar":"Pin sidebar",children:s?(0,e.jsx)(ks,{className:"size-4"}):(0,e.jsx)(ds,{className:"size-4"})})})},ta=({children:s})=>{const{sidebar:{width:t,isOpen:a,isPinned:r},setSidebarWidth:n,setSidebarOpen:o}=fe(),l=(0,i.useRef)(!1),c=(0,i.useRef)(0),u=(0,i.useRef)(0),m=(0,i.useRef)(null),x=(0,i.useRef)(null),y=(0,i.useRef)(g=>{}),h=(0,i.useRef)(()=>{}),b=(0,i.useRef)(g=>{}),d=(0,i.useRef)(()=>{}),p=(0,i.useRef)(()=>{}),S=(0,i.useCallback)(g=>{l.current&&requestAnimationFrame(()=>{const N=g.clientX-c.current,k=u.current+N;n(k)})},[n]),f=(0,i.useCallback)(()=>{l.current=!1,Object.assign(document.body.style,{cursor:"",userSelect:""});const g=document.getElementById("resize-overlay");g&&g.remove()},[]),w=(0,i.useCallback)(g=>{g.preventDefault(),l.current=!0,c.current=g.clientX,u.current=t,Object.assign(document.body.style,{cursor:"col-resize",userSelect:"none"});const N=document.createElement("div");N.id="resize-overlay",N.style.cssText="position:fixed;inset:0;z-index:9999;cursor:col-resize;",document.body.appendChild(N)},[t]),D=(0,i.useCallback)(()=>{r||o(!0)},[r,o]),v=(0,i.useCallback)(()=>{r||o(!1)},[r,o]),_=(0,i.useCallback)(g=>{r||a||l.current||(g.clientX<=L.HOVER_ZONE?(m.current&&clearTimeout(m.current),m.current=window.setTimeout(()=>{o(!0)},L.HOVER_DELAY)):g.clientX>L.HOVER_ZONE+50&&m.current&&clearTimeout(m.current))},[r,a,o]);y.current=S,h.current=f,b.current=_,d.current=D,p.current=v;const R=g=>{r||o(g)};return(0,i.useEffect)(()=>{const g=I=>y.current(I),N=()=>h.current(),k=I=>b.current(I);return document.addEventListener("mousemove",g),document.addEventListener("mouseup",N),document.addEventListener("mousemove",k),()=>{document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",N),document.removeEventListener("mousemove",k),m.current&&clearTimeout(m.current)}},[]),(0,i.useEffect)(()=>{const g=x.current;if(!g)return;const N=()=>d.current(),k=()=>p.current();return g.addEventListener("mouseenter",N),g.addEventListener("mouseleave",k),()=>{g.removeEventListener("mouseenter",N),g.removeEventListener("mouseleave",k)}},[]),(0,e.jsxs)(Vs,{open:a,onOpenChange:R,modal:!1,children:[(0,e.jsx)(Ks,{className:"sr-only",children:"Open Sidebar"}),(0,e.jsx)($s,{ref:x,side:"left",showCloseButton:!1,isPinned:r,className:E("bg-sidebar border-r border-sidebar-border text-sidebar-foreground p-0","transition-transform duration-300 ease-out"),style:{width:`${t}px`},onOpenAutoFocus:g=>g.preventDefault(),children:(0,e.jsxs)("div",{className:"relative h-full flex flex-col",children:[s,(0,e.jsx)("div",{role:"button",tabIndex:0,onMouseDown:w,className:E("absolute inset-y-0 -right-1.5 w-3 cursor-col-resize z-50 outline-none","after:absolute after:inset-y-0 after:left-1/2 after:w-px after:transition-colors","hover:after:bg-blue-400/70 active:after:bg-blue-400/70 focus-visible:after:bg-blue-400/70"),title:"Drag to resize sidebar"})]})})]})},aa=["string","hash","list","set","zset","stream"],K=St(""),ra=()=>{const{closeOverlay:s,isOverlayOpen:t}=se(),[a,r]=(0,i.useState)(K),[n,o]=(0,i.useState)("string"),[l,c]=(0,i.useState)(K),[u,m]=(0,i.useState)(K),[x,y]=(0,i.useState)("0"),[h,b]=(0,i.useState)(""),{createKey:d,isPending:p}=wt(),S=t("redis-browser.create-key"),f=n==="hash"||n==="stream",w=a===null||l===null||f&&u===null,D=async()=>{const v=f?u:K;if(a===null||l===null||v===null)return;let _;switch(n){case"string":_={kind:"string",value:l};break;case"hash":_={kind:"hash",entries:[{field:l,value:v}]};break;case"list":_={kind:"list",entries:[l]};break;case"set":_={kind:"set",members:[l]};break;case"zset":_={kind:"zset",entries:[{member:l,score:Number(x)}]};break;case"stream":_={kind:"stream",id:"*",fields:[{field:l,value:v}]}}await d({key:a,type:n,value:_,ttlMs:h?Number(h)*1e3:null}),r(K),o("string"),c(K),m(K),y("0"),b(""),s("redis-browser.create-key")};return(0,e.jsxs)(Hs,{title:"Create Redis key",description:"Creates the key atomically and never overwrites an existing key.",open:S,onOpenChange:v=>{v||s("redis-browser.create-key")},size:"sm:max-w-md!",headerClassName:"border-b border-border p-4",titleClassName:"text-sm font-medium",contentClassName:"space-y-4 px-4 py-4",children:[(0,e.jsxs)(Nt,{className:"gap-4",children:[(0,e.jsxs)(Q,{children:[(0,e.jsx)(q,{htmlFor:"redis-key-name",children:"Key"}),(0,e.jsx)(Ne,{id:"redis-key-name",value:a,onChange:r,className:"h-8",placeholder:"cache:user:42"}),(0,e.jsx)(Ae,{children:"Text, hexadecimal, and Base64 keys are supported."})]}),(0,e.jsxs)(Q,{children:[(0,e.jsx)(q,{htmlFor:"redis-key-type",children:"Type"}),(0,e.jsxs)(ce,{value:n,onValueChange:v=>o(v),children:[(0,e.jsx)(le,{id:"redis-key-type",className:"h-8!",children:(0,e.jsx)(ie,{})}),(0,e.jsx)(oe,{children:aa.map(v=>(0,e.jsx)(M,{value:v,children:v},v))})]})]}),(0,e.jsxs)(Q,{children:[(0,e.jsx)(q,{htmlFor:"redis-key-first-value",children:n==="hash"||n==="stream"?"Initial field":n==="zset"?"Initial member":"Initial value"}),(0,e.jsx)(Ne,{id:"redis-key-first-value",value:l,onChange:c})]}),(n==="hash"||n==="stream")&&(0,e.jsxs)(Q,{children:[(0,e.jsx)(q,{htmlFor:"redis-key-second-value",children:"Initial value"}),(0,e.jsx)(Ne,{id:"redis-key-second-value",value:u,onChange:m})]}),n==="zset"&&(0,e.jsxs)(Q,{children:[(0,e.jsx)(q,{htmlFor:"redis-key-score",children:"Score"}),(0,e.jsx)(z,{id:"redis-key-score",type:"number",value:x,onChange:v=>y(v.target.value),className:"font-mono"})]}),(0,e.jsxs)(Q,{children:[(0,e.jsx)(q,{htmlFor:"redis-key-ttl",children:"TTL in seconds"}),(0,e.jsx)(z,{id:"redis-key-ttl",type:"number",min:1,value:h,onChange:v=>b(v.target.value),placeholder:"Persistent",className:"font-mono h-8"}),(0,e.jsx)(Ae,{children:"Leave empty to create a persistent key."})]})]}),(0,e.jsxs)("div",{className:"flex justify-end gap-2 border-t border-border pt-4",children:[(0,e.jsx)(j,{variant:"outline",onClick:()=>s("redis-browser.create-key"),children:"Cancel"}),(0,e.jsx)(j,{disabled:p||w,onClick:D,children:"Create key"})]})]})},na=["string","hash","list","set","zset","stream"],ia={string:"STR",hash:"HASH",list:"LIST",set:"SET",zset:"ZSET",stream:"XSTR"},la=s=>s===-1?"∞":s<0?"gone":s<1e3?`${s}ms`:s<6e4?`${Math.ceil(s/1e3)}s`:s<36e5?`${Math.ceil(s/6e4)}m`:`${Math.ceil(s/36e5)}h`,oa=s=>s===null?"—":s<1024?`${s} B`:`${(s/1024).toFixed(1)} KiB`,ca=(s,t)=>t!==void 0?t||"(empty key)":`0x${Array.from(kt(s),a=>a.toString(16).padStart(2,"0")).join("")}`,da=()=>{const{openOverlay:s}=se(),[t,a]=F("key"),[r,n]=F("search",{defaultValue:""}),[o,l]=(0,i.useState)(r),[c,u]=F("type",{defaultValue:""}),[m,x]=F("glob",{defaultValue:"false"}),y=m==="true",h=Tt({search:o,type:c,exactPattern:y}),b=(0,i.useMemo)(()=>h.data?.pages.flatMap(f=>f.keys)??[],[h.data]),d=(0,i.useRef)(null),p=ls({count:b.length,getScrollElement:()=>d.current,estimateSize:()=>33,overscan:10}),S=p.getVirtualItems();return(0,i.useEffect)(()=>{const f=window.setTimeout(()=>l(r),250);return()=>window.clearTimeout(f)},[r]),(0,i.useEffect)(()=>{const f=S.at(-1);f&&f.index>=b.length-5&&h.hasNextPage&&!h.isFetchingNextPage&&h.fetchNextPage()},[S,b.length,h.hasNextPage,h.isFetchingNextPage,h.fetchNextPage]),(0,e.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col bg-background font-mono",children:[(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"space-y-2 px-3 pb-3 pt-2",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsxs)("div",{className:"relative min-w-0 flex-1",children:[(0,e.jsx)(ke,{className:"absolute left-2 top-1/2 -translate-y-1/2 size-4 text-muted-foreground"}),(0,e.jsx)(z,{variant:"outline",value:r,onChange:f=>n(f.target.value),placeholder:y?"Redis glob pattern":"Find keys","aria-label":"Find Redis keys",className:"h-8 rounded-sm pl-8"})]}),(0,e.jsx)(j,{variant:"outline",size:"icon-lg",className:"shrink-0 rounded-sm",onClick:()=>A.promise(h.refetch({throwOnError:!0}),{loading:"Refreshing Redis keys...",success:"Redis keys refreshed",error:"Failed to refresh Redis keys"}),disabled:h.isFetching,"aria-label":"Refresh Redis keys",children:(0,e.jsx)(Qe,{className:E(h.isFetching&&"animate-spin")})}),(0,e.jsx)(j,{size:"icon-lg",className:"shrink-0 rounded-sm",onClick:()=>s("redis-browser.create-key"),"aria-label":"Create Redis key",children:(0,e.jsx)(te,{})})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsxs)(ce,{value:c||"all",onValueChange:f=>u(f==="all"?"":f),children:[(0,e.jsx)(le,{variant:"outline","aria-label":"Filter Redis key type",className:"h-8! min-w-0 flex-1 justify-between rounded-sm",children:(0,e.jsx)(ie,{})}),(0,e.jsxs)(oe,{children:[(0,e.jsx)(M,{value:"all",children:"All types"}),na.map(f=>(0,e.jsx)(M,{value:f,children:f},f))]})]}),(0,e.jsxs)(yt,{variant:"outline",size:"lg",pressed:y,onPressedChange:f=>x(f?"true":"false"),className:"shrink-0 rounded-sm px-2 text-xs/relaxed uppercase","aria-label":"Use Redis glob pattern",children:[(0,e.jsx)(ws,{className:"size-4"})," Glob"]})]})]}),(0,e.jsxs)("div",{className:"flex h-6 items-center justify-between px-4 text-[9px] uppercase tracking-wider text-muted-foreground",children:[(0,e.jsxs)("span",{children:[b.length," loaded"]}),(0,e.jsx)("span",{children:h.dataUpdatedAt>0?new Date(h.dataUpdatedAt).toLocaleTimeString():"not scanned"})]})]}),(0,e.jsxs)("div",{ref:d,className:"min-h-0 flex-1 overflow-auto",children:[h.isLoading?(0,e.jsx)("div",{className:"px-3 py-4 text-xs text-muted-foreground",children:"Scanning keyspace…"}):b.length===0?(0,e.jsxs)("div",{className:"flex min-h-32 flex-col items-center justify-center gap-2 px-4 text-center text-muted-foreground",children:[(0,e.jsx)(ms,{className:"size-4"}),(0,e.jsx)("span",{className:"text-xs",children:"No keys in this scan."}),(0,e.jsxs)(j,{variant:"outline",size:"sm",onClick:()=>s("redis-browser.create-key"),children:[(0,e.jsx)(te,{})," Create key"]})]}):(0,e.jsx)("div",{className:"relative w-full",style:{height:`${p.getTotalSize()}px`},children:S.map(f=>{const w=b[f.index],D=w.key.base64||"-",v=ca(w.key.base64,w.key.utf8);return(0,e.jsxs)(j,{variant:"ghost",onClick:()=>a(D),className:E("absolute left-0 top-0 h-auto w-full justify-start gap-2 rounded-none px-4 py-1.5 text-sm font-normal transition-colors",t===D?"bg-sidebar-accent text-sidebar-accent-foreground font-medium before:absolute before:inset-y-0 before:left-0 before:w-1 before:bg-primary":"text-sidebar-foreground/70 hover:bg-sidebar-accent/50 hover:text-sidebar-foreground"),style:{transform:`translateY(${f.start}px)`},title:v,children:[(0,e.jsx)("span",{className:"min-w-0 flex-1 truncate text-left text-current",children:v}),(0,e.jsx)(Js,{variant:"outline",className:"h-4 w-10 shrink-0 justify-center rounded-sm px-1 text-[8px] font-normal text-muted-foreground",children:ia[w.type]??"?"}),(0,e.jsxs)("span",{className:"shrink-0 text-[9px] text-muted-foreground",children:[oa(w.memoryBytes)," ·"," ",w.ttlMs===-1?(0,e.jsx)(Es,{className:"inline size-3 align-[-2px]","aria-label":"No expiry"}):la(w.ttlMs)]})]},`${D}-${f.index}`)})}),h.isFetchingNextPage&&(0,e.jsx)("div",{className:"px-2 py-1 text-center text-[10px] text-muted-foreground",children:"Scanning more…"})]}),(0,e.jsx)(ra,{})]})},ua=()=>{const{pathname:s}=ne(),t=s.split("/")[1],a=H()?.dataModel==="key-value",r=(0,i.useMemo)(()=>{if(a&&t!=="runner")return(0,e.jsx)(da,{});switch(t){case"":case"table":case"schema":case"indexes":return(0,e.jsx)(Ve,{});case"runner":return(0,e.jsx)(qt,{});default:return(0,e.jsx)(Ve,{})}},[a,t]);return(0,e.jsxs)(ta,{children:[(0,e.jsx)(sa,{}),r,(0,e.jsx)(ea,{})]})},Ia=rs({component:()=>ma});function ma(){const s=H(),t=s?.dataModel==="key-value",{pathname:a}=ne(),r=a.split("/")[1],{sidebar:{isPinned:n,width:o}}=fe();return t&&r!=="browser"&&r!=="runner"?(0,e.jsx)(ve,{to:"/browser"}):!t&&r==="browser"?(0,e.jsx)(ve,{to:"/"}):s&&!s.indexes&&r==="indexes"?(0,e.jsx)(ve,{to:"/table"}):(0,e.jsxs)("div",{className:"bg-background text-foreground w-dvw flex h-dvh max-h-dvh overflow-hidden relative",children:[(0,e.jsx)(ua,{}),(0,e.jsxs)("div",{className:"flex-1 flex flex-col h-full overflow-hidden ",style:{marginLeft:n?`${o}px`:"0"},children:[(0,e.jsx)(Kt,{}),(0,e.jsx)(is,{})]})]})}export{ma as component,Et as n,Ia as t};
@@ -0,0 +1 @@
1
+ import{kt as r}from"./radix-ui-Bp71_UWp.js";import{n as t}from"./index-b6Apx1z7.js";import{t as o}from"./query-runner-DBIufzsZ.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"db-studio@1.18.0"};var n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="75ea95b1-76bb-4d8e-9053-9359e4ea8b8e",e._sentryDebugIdIdentifier="sentry-dbid-75ea95b1-76bb-4d8e-9053-9359e4ea8b8e")}catch{}})();var s=r();function b(){const{queryId:e}=t.useParams();return(0,s.jsx)(o,{queryId:e})}export{b as component};
@@ -0,0 +1 @@
1
+ import{kt as n}from"./radix-ui-Bp71_UWp.js";import{b as o,x as r}from"./index-b6Apx1z7.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"db-studio@1.18.0"};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f43047c5-cd58-44bc-91f5-aba24725571b",e._sentryDebugIdIdentifier="sentry-dbid-f43047c5-cd58-44bc-91f5-aba24725571b")}catch{}})();var s=n();function b(){const{table:e}=r.useParams();return(0,s.jsx)(o,{tableName:e})}export{b as component};
@@ -0,0 +1 @@
1
+ import{r as Q}from"./rolldown-runtime-Ba77kUFP.js";import{C as A,b as $,h as G,x as H}from"./tanstack-HxB2LyLp.js";import{S as L,a as Y,j as J,o as X,u as Z,wt as W,x as ee}from"./icons-BEkcNqUd.js";import{kt as se}from"./radix-ui-Bp71_UWp.js";import{n as R}from"./dist-DmSgBrHs.js";import{t as ne}from"./utils-CNXzeC6_.js";import{t as P}from"./spinner-gvrX8mkL.js";import{o as g,r as C,s as _}from"./keys-o03XLuW4.js";import{G as u,c as h,d as te,h as ae,i as re,n as ie,t as de,y as oe}from"./tooltip-CIAbgIn7.js";import{t as le}from"./sheet-sidebar-D8BG4Pf9.js";import{t as ce}from"./react-BziCK5DU.js";import{s as xe,t as I}from"./database.store-C0jTx_DA.js";import{t as b}from"./badge-Ckwkbv_3.js";import{a as me,i as ue,n as he,r as fe,t as pe}from"./select-Cg3fBZqb.js";import{G as ge,H as F,J as je,Q as be,U as ye,X as ve,Y as Ne,Z as O,at as Ce,i as Ie,it as Se,nt as De,ot as ze,rt as Te,st as ke}from"./index-b6Apx1z7.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};s.SENTRY_RELEASE={id:"db-studio@1.18.0"};var t=new s.Error().stack;t&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[t]="c3faa964-858f-45fb-b98f-1333ac4b276d",s._sentryDebugIdIdentifier="sentry-dbid-c3faa964-858f-45fb-b98f-1333ac4b276d")}catch{}})();var N=Q(W(),1),we=({tableName:s})=>{const t=A(),{closeOverlay:i}=h(),{selectedDatabase:r}=I(),{mutateAsync:x,isPending:l}=$({mutationFn:async o=>(await te({tableName:s,data:o,db:r})).data.data,onSuccess:async()=>{await t.invalidateQueries({queryKey:C.byTable(s),exact:!1}),i("indexes.create-index")}});return{createIndex:async o=>R.promise(x(o),{loading:"Creating index...",success:d=>d||"Index created successfully",error:d=>typeof d.details=="string"&&d.details||d.message||"Failed to create index"}),isCreatingIndex:l}},e=se(),qe=({tableName:s})=>{const{closeOverlay:t}=h(),{createIndex:i,isCreatingIndex:r}=we({tableName:s}),{tableCols:x,isLoadingTableCols:l}=je({tableName:s}),m=Ne(),o=m?.indexes||null,d=o?.methods??[],{control:a,register:f,handleSubmit:M,setValue:S,watch:U,formState:{errors:y,dirtyFields:K,isSubmitted:D}}=be({mode:"onSubmit",defaultValues:{indexName:"",columns:[],isUnique:!1,method:d[0]},resolver:ve(xe)}),p=U("columns"),V=m?.dataModel==="document",[z,B]=(0,N.useState)([]),[v,T]=(0,N.useState)(""),k=[...new Set([...x?.map(({columnName:n})=>n)??[],...z])],w=n=>{const c=p.includes(n)?p.filter(j=>j!==n):[...p,n];S("columns",c,{shouldValidate:D}),K.indexName||S("indexName",c.length?`${s}_${c.join("_").replaceAll(".","_")}_idx`:"",{shouldValidate:D})},q=()=>{const n=v.trim();n&&(k.includes(n)||B([...z,n]),p.includes(n)||w(n),T(""))};return(0,e.jsxs)("form",{onSubmit:M(n=>i(n)),className:"space-y-6",children:[(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(g,{className:"text-xs",children:"Columns, in index order"}),l?(0,e.jsx)(P,{size:"size-5"}):(0,e.jsx)("div",{className:"space-y-1",children:k.map(n=>{const c=p.indexOf(n),j=`create-index-column-${n}`;return(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(F,{id:j,checked:c!==-1,onCheckedChange:()=>w(n)}),(0,e.jsx)(g,{htmlFor:j,className:"font-mono font-normal cursor-pointer",children:n}),c!==-1&&(0,e.jsxs)("span",{className:"text-xs text-muted-foreground",children:["#",c+1]})]},n)})}),V&&(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(_,{value:v,onChange:n=>T(n.target.value),onKeyDown:n=>{n.key==="Enter"&&(n.preventDefault(),q())},placeholder:"Add field path, e.g. address.city","aria-label":"Add field path",className:"font-mono"}),(0,e.jsx)(u,{type:"button",variant:"outline",onClick:q,disabled:!v.trim(),children:"Add"})]}),y.columns&&(0,e.jsx)("p",{className:"text-xs text-destructive",children:"Select at least one column."})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(g,{htmlFor:"create-index-name",className:"text-xs",children:"Name"}),(0,e.jsx)(_,{id:"create-index-name",...f("indexName"),placeholder:`${s}_column_idx`,className:ne("font-mono",y.indexName&&"border-destructive ring-destructive ring-1")}),y.indexName&&(0,e.jsx)("p",{className:"text-xs text-destructive",children:"Enter an index name."})]}),(0,e.jsxs)("div",{className:"flex items-center gap-6",children:[(0,e.jsx)(O,{control:a,name:"isUnique",render:({field:n})=>(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(F,{id:"create-index-unique",checked:n.value,onCheckedChange:c=>n.onChange(c===!0)}),(0,e.jsx)(g,{htmlFor:"create-index-unique",className:"cursor-pointer",children:"Unique"})]})}),d.length>0&&(0,e.jsx)(O,{control:a,name:"method",render:({field:n})=>(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(g,{htmlFor:"create-index-method",children:"Method"}),(0,e.jsxs)(pe,{value:n.value,onValueChange:n.onChange,children:[(0,e.jsx)(ue,{id:"create-index-method",className:"font-mono",children:(0,e.jsx)(me,{})}),(0,e.jsx)(he,{children:d.map(c=>(0,e.jsx)(fe,{value:c,className:"font-mono",children:c},c))})]})]})})]}),o?.createNote&&(0,e.jsxs)("p",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,e.jsx)(Y,{className:"size-3.5 shrink-0"}),o.createNote]}),(0,e.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,e.jsx)(u,{type:"button",variant:"outline",size:"lg",onClick:()=>t("indexes.create-index"),disabled:r,children:"Cancel"}),(0,e.jsx)(u,{type:"submit",variant:"default",size:"lg",disabled:r,children:r?"Creating...":"Create index"})]})]})},_e=({tableName:s})=>{const{closeOverlay:t,isOverlayOpen:i}=h();return(0,e.jsx)(le,{title:"Create index",description:`Create an index on "${s}".`,open:i("indexes.create-index"),onOpenChange:r=>{r||t("indexes.create-index")},children:(0,e.jsx)(qe,{tableName:s})})},Fe=({tableName:s})=>{const t=A(),{closeOverlay:i}=h(),{selectedDatabase:r}=I(),{mutateAsync:x,isPending:l}=$({mutationFn:async o=>(await ae({tableName:s,indexName:o,db:r})).data.data,onSuccess:async()=>{await t.invalidateQueries({queryKey:C.byTable(s),exact:!1}),i("indexes.drop-index")}});return{dropIndex:async o=>R.promise(x(o),{loading:"Dropping index...",success:d=>d||"Index dropped successfully",error:d=>typeof d.details=="string"&&d.details||d.message||"Failed to drop index"}),isDroppingIndex:l}},E=ce()(s=>({droppingIndex:null,setDroppingIndex:t=>s({droppingIndex:t})})),Oe=({tableName:s})=>{const{closeOverlay:t,isOverlayOpen:i}=h(),{droppingIndex:r}=E(),{dropIndex:x,isDroppingIndex:l}=Fe({tableName:s});return r?(0,e.jsx)(De,{open:i("indexes.drop-index"),onOpenChange:m=>{m||t("indexes.drop-index")},children:(0,e.jsxs)(Te,{className:"max-w-md",children:[(0,e.jsxs)(ze,{children:[(0,e.jsx)(ke,{children:"Drop Index"}),(0,e.jsxs)(Se,{children:["Drop the index"," ",(0,e.jsxs)("span",{className:"font-semibold text-foreground",children:['"',r.indexName,'"']})," ","from table ",(0,e.jsxs)("span",{className:"font-semibold text-foreground",children:['"',s,'"']}),"? No rows are deleted, but queries that rely on this index may get slower."]})]}),(0,e.jsxs)(Ce,{className:"gap-2",children:[(0,e.jsx)(u,{variant:"outline",onClick:()=>t("indexes.drop-index"),disabled:l,children:"Cancel"}),(0,e.jsx)(u,{variant:"destructive",onClick:()=>x(r.indexName),disabled:l,children:l?"Dropping...":"Drop Index"})]})]})}):null},Ae=({index:s})=>{const{openOverlay:t}=h(),{setDroppingIndex:i}=E();return s.kind!=="index"?(0,e.jsxs)(de,{children:[(0,e.jsx)(re,{asChild:!0,children:(0,e.jsx)("span",{className:"inline-flex text-muted-foreground/40",children:(0,e.jsx)(J,{className:"size-3.5"})})}),(0,e.jsx)(ie,{side:"left",children:(0,e.jsx)("p",{children:"Backs a constraint. Drop the constraint to remove it."})})]}):(0,e.jsx)(u,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-destructive","aria-label":`Drop index ${s.indexName}`,onClick:()=>{i(s),t("indexes.drop-index")},children:(0,e.jsx)(X,{className:"size-3.5"})})},$e=({tableName:s,refetch:t,isRefetching:i=!1})=>{const{openOverlay:r}=h();return(0,e.jsxs)("header",{className:"max-h-8 overflow-hidden border-b border-border w-full flex items-center bg-background text-foreground sticky top-0 left-0 right-0 z-0",children:[(0,e.jsx)(u,{type:"button",variant:"ghost",className:"size-8! aspect-square border-x-0 border-y-0 border-border rounded-none text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors",onClick:()=>{t()},"aria-label":`Refetch indexes for ${s}`,disabled:i,children:(0,e.jsx)(ee,{className:"size-4"})}),(0,e.jsx)(u,{variant:"ghost",asChild:!0,className:"h-8! border-l border-y-0 border-r-0 border-border rounded-none flex items-center gap-2 text-muted-foreground hover:text-foreground",children:(0,e.jsxs)(G,{to:"/table/$table",params:{table:s},"aria-label":`View data for ${s}`,children:[(0,e.jsx)(Z,{className:"size-4"}),"View data"]})}),(0,e.jsxs)(u,{type:"button",variant:"default",className:"h-8! border-l border-y-0 border-r-0 border-border rounded-none flex items-center gap-2",onClick:()=>r("indexes.create-index"),children:[(0,e.jsx)(L,{className:"size-4"}),"Create Index"]})]})},Le=({tableName:s})=>{const{selectedDatabase:t}=I(),{data:i,isLoading:r,isRefetching:x,error:l,refetch:m}=H({queryKey:C.table(s,t),queryFn:()=>oe(s,t),select:o=>o.data.data,enabled:!!s&&!!t});return{tableIndexes:i,isLoadingTableIndexes:r,isRefetchingTableIndexes:x,errorTableIndexes:l,refetchTableIndexes:m}},Re={primary:"Primary","unique-constraint":"Unique constraint",index:null},Pe=({tableName:s})=>{const{tableIndexes:t,isLoadingTableIndexes:i,isRefetchingTableIndexes:r,errorTableIndexes:x,refetchTableIndexes:l}=Le({tableName:s}),{openOverlay:m}=h(),o=!!t?.some(a=>a.method!==null),d=(0,N.useMemo)(()=>[{id:"indexName",header:"Name",accessorKey:"indexName",cell:({row:a})=>{const f=Re[a.original.kind];return(0,e.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,e.jsx)("span",{className:"font-mono text-foreground font-medium truncate",children:a.original.indexName}),f&&(0,e.jsx)(b,{variant:"secondary",className:"text-[0.6rem] px-1.5 shrink-0",children:f}),a.original.isSparse&&(0,e.jsx)(b,{variant:"secondary",className:"text-[0.6rem] px-1.5 shrink-0",children:"Sparse"}),a.original.expireAfterSeconds!==void 0&&(0,e.jsxs)(b,{variant:"secondary",className:"text-[0.6rem] px-1.5 shrink-0",children:["TTL (",a.original.expireAfterSeconds,"s)"]})]})},size:340,minSize:160},{id:"columns",header:"Columns",accessorFn:a=>a.columns.join(", "),cell:({getValue:a})=>(0,e.jsx)("span",{className:"font-mono text-xs text-muted-foreground truncate",children:a()}),size:220,minSize:120},{id:"isUnique",header:"Unique",cell:({row:a})=>a.original.isUnique?(0,e.jsx)(b,{variant:"secondary",className:"text-[0.6rem] px-1.5",children:"Unique"}):(0,e.jsx)("span",{className:"text-xs text-muted-foreground/50",children:"no"}),size:90,minSize:80},...o?[{id:"method",header:"Method",cell:({row:a})=>(0,e.jsx)("span",{className:"font-mono text-xs text-muted-foreground",children:a.original.method}),size:100,minSize:80}]:[],{id:"definition",header:"Definition",accessorKey:"definition",cell:({getValue:a})=>{const f=a();return f?(0,e.jsx)("span",{className:"font-mono text-xs text-muted-foreground truncate",children:f}):(0,e.jsx)("span",{className:"text-muted-foreground/50",children:"—"})},size:360,minSize:120},{id:"actions",header:"",cell:({row:a})=>(0,e.jsx)("div",{className:"flex flex-1 justify-center items-center",children:(0,e.jsx)(Ae,{index:a.original})}),size:50,enableResizing:!1}],[o]);return i?(0,e.jsx)("div",{className:"size-full flex items-center justify-center",children:(0,e.jsx)(P,{size:"size-7"})}):x?(0,e.jsxs)("div",{className:"size-full flex flex-col items-center justify-center gap-2",children:[(0,e.jsx)("div",{className:"text-sm font-medium",children:"Failed to load indexes"}),(0,e.jsx)("div",{className:"text-sm text-muted-foreground",children:x.message})]}):(0,e.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,e.jsx)($e,{tableName:s,refetch:l,isRefetching:r}),t?.length?(0,e.jsx)(ge,{columns:d,data:t,renderCellAccessory:a=>(0,e.jsx)(ye,{value:a})}):(0,e.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center gap-3",children:[(0,e.jsx)("div",{className:"text-sm text-muted-foreground",children:"This table has no indexes yet."}),(0,e.jsxs)(u,{type:"button",onClick:()=>m("indexes.create-index"),children:[(0,e.jsx)(L,{className:"size-4"}),"Create index"]})]}),(0,e.jsx)(_e,{tableName:s}),(0,e.jsx)(Oe,{tableName:s})]})};function ss(){const{table:s}=Ie.useParams();return(0,e.jsx)("main",{className:"flex-1 flex flex-col overflow-hidden",children:(0,e.jsx)(Pe,{tableName:s})})}export{ss as component};
@@ -0,0 +1 @@
1
+ import{kt as o}from"./radix-ui-Bp71_UWp.js";import{j as r,t as a}from"./index-b6Apx1z7.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"db-studio@1.18.0"};var n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="88d8ac84-1407-49ef-aaf0-e8e337d7ccf7",e._sentryDebugIdIdentifier="sentry-dbid-88d8ac84-1407-49ef-aaf0-e8e337d7ccf7")}catch{}})();var t=o();function i(){const{table:e}=a.useParams();return(0,t.jsx)("main",{className:"flex-1 flex flex-col overflow-hidden",children:(0,t.jsx)(r,{tableName:e})})}export{i as component};
@@ -0,0 +1 @@
1
+ (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"db-studio@1.18.0"};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3c39b1bc-0997-4627-b32e-a588be4711ba",e._sentryDebugIdIdentifier="sentry-dbid-3c39b1bc-0997-4627-b32e-a588be4711ba")}catch{}})();var i={comments:{lineComment:"*"},brackets:[["[","]"],["(",")"]]},s={defaultToken:"invalid",ignoreCase:!0,tokenPostfix:".abap",keywords:["abap-source","abbreviated","abstract","accept","accepting","according","activation","actual","add","add-corresponding","adjacent","after","alias","aliases","align","all","allocate","alpha","analysis","analyzer","and","append","appendage","appending","application","archive","area","arithmetic","as","ascending","aspect","assert","assign","assigned","assigning","association","asynchronous","at","attributes","authority","authority-check","avg","back","background","backup","backward","badi","base","before","begin","between","big","binary","bintohex","bit","black","blank","blanks","blob","block","blocks","blue","bound","boundaries","bounds","boxed","break-point","buffer","by","bypassing","byte","byte-order","call","calling","case","cast","casting","catch","center","centered","chain","chain-input","chain-request","change","changing","channels","character","char-to-hex","check","checkbox","ci_","circular","class","class-coding","class-data","class-events","class-methods","class-pool","cleanup","clear","client","clob","clock","close","coalesce","code","coding","col_background","col_group","col_heading","col_key","col_negative","col_normal","col_positive","col_total","collect","color","column","columns","comment","comments","commit","common","communication","comparing","component","components","compression","compute","concat","concat_with_space","concatenate","cond","condense","condition","connect","connection","constants","context","contexts","continue","control","controls","conv","conversion","convert","copies","copy","corresponding","country","cover","cpi","create","creating","critical","currency","currency_conversion","current","cursor","cursor-selection","customer","customer-function","dangerous","data","database","datainfo","dataset","date","dats_add_days","dats_add_months","dats_days_between","dats_is_valid","daylight","dd/mm/yy","dd/mm/yyyy","ddmmyy","deallocate","decimal_shift","decimals","declarations","deep","default","deferred","define","defining","definition","delete","deleting","demand","department","descending","describe","destination","detail","dialog","directory","disconnect","display","display-mode","distinct","divide","divide-corresponding","division","do","dummy","duplicate","duplicates","duration","during","dynamic","dynpro","edit","editor-call","else","elseif","empty","enabled","enabling","encoding","end","endat","endcase","endcatch","endchain","endclass","enddo","endenhancement","end-enhancement-section","endexec","endform","endfunction","endian","endif","ending","endinterface","end-lines","endloop","endmethod","endmodule","end-of-definition","end-of-editing","end-of-file","end-of-page","end-of-selection","endon","endprovide","endselect","end-test-injection","end-test-seam","endtry","endwhile","endwith","engineering","enhancement","enhancement-point","enhancements","enhancement-section","entries","entry","enum","environment","equiv","errormessage","errors","escaping","event","events","exact","except","exception","exceptions","exception-table","exclude","excluding","exec","execute","exists","exit","exit-command","expand","expanding","expiration","explicit","exponent","export","exporting","extend","extended","extension","extract","fail","fetch","field","field-groups","fields","field-symbol","field-symbols","file","filter","filters","filter-table","final","find","first","first-line","fixed-point","fkeq","fkge","flush","font","for","form","format","forward","found","frame","frames","free","friends","from","function","functionality","function-pool","further","gaps","generate","get","giving","gkeq","gkge","global","grant","green","group","groups","handle","handler","harmless","hashed","having","hdb","header","headers","heading","head-lines","help-id","help-request","hextobin","hide","high","hint","hold","hotspot","icon","id","identification","identifier","ids","if","ignore","ignoring","immediately","implementation","implementations","implemented","implicit","import","importing","in","inactive","incl","include","includes","including","increment","index","index-line","infotypes","inheriting","init","initial","initialization","inner","inout","input","insert","instance","instances","instr","intensified","interface","interface-pool","interfaces","internal","intervals","into","inverse","inverted-date","is","iso","job","join","keep","keeping","kernel","key","keys","keywords","kind","language","last","late","layout","leading","leave","left","left-justified","leftplus","leftspace","legacy","length","let","level","levels","like","line","lines","line-count","linefeed","line-selection","line-size","list","listbox","list-processing","little","llang","load","load-of-program","lob","local","locale","locator","logfile","logical","log-point","long","loop","low","lower","lpad","lpi","ltrim","mail","main","major-id","mapping","margin","mark","mask","match","matchcode","max","maximum","medium","members","memory","mesh","message","message-id","messages","messaging","method","methods","min","minimum","minor-id","mm/dd/yy","mm/dd/yyyy","mmddyy","mode","modif","modifier","modify","module","move","move-corresponding","multiply","multiply-corresponding","name","nametab","native","nested","nesting","new","new-line","new-page","new-section","next","no","no-display","no-extension","no-gap","no-gaps","no-grouping","no-heading","no-scrolling","no-sign","no-title","no-topofpage","no-zero","node","nodes","non-unicode","non-unique","not","null","number","object","objects","obligatory","occurrence","occurrences","occurs","of","off","offset","ole","on","only","open","option","optional","options","or","order","other","others","out","outer","output","output-length","overflow","overlay","pack","package","pad","padding","page","pages","parameter","parameters","parameter-table","part","partially","pattern","percentage","perform","performing","person","pf1","pf10","pf11","pf12","pf13","pf14","pf15","pf2","pf3","pf4","pf5","pf6","pf7","pf8","pf9","pf-status","pink","places","pool","pos_high","pos_low","position","pragmas","precompiled","preferred","preserving","primary","print","print-control","priority","private","procedure","process","program","property","protected","provide","public","push","pushbutton","put","queue-only","quickinfo","radiobutton","raise","raising","range","ranges","read","reader","read-only","receive","received","receiver","receiving","red","redefinition","reduce","reduced","ref","reference","refresh","regex","reject","remote","renaming","replace","replacement","replacing","report","request","requested","reserve","reset","resolution","respecting","responsible","result","results","resumable","resume","retry","return","returncode","returning","returns","right","right-justified","rightplus","rightspace","risk","rmc_communication_failure","rmc_invalid_status","rmc_system_failure","role","rollback","rows","rpad","rtrim","run","sap","sap-spool","saving","scale_preserving","scale_preserving_scientific","scan","scientific","scientific_with_leading_zero","scroll","scroll-boundary","scrolling","search","secondary","seconds","section","select","selection","selections","selection-screen","selection-set","selection-sets","selection-table","select-options","send","separate","separated","set","shared","shift","short","shortdump-id","sign_as_postfix","single","size","skip","skipping","smart","some","sort","sortable","sorted","source","specified","split","spool","spots","sql","sqlscript","stable","stamp","standard","starting","start-of-editing","start-of-selection","state","statement","statements","static","statics","statusinfo","step-loop","stop","structure","structures","style","subkey","submatches","submit","subroutine","subscreen","subtract","subtract-corresponding","suffix","sum","summary","summing","supplied","supply","suppress","switch","switchstates","symbol","syncpoints","syntax","syntax-check","syntax-trace","system-call","system-exceptions","system-exit","tab","tabbed","table","tables","tableview","tabstrip","target","task","tasks","test","testing","test-injection","test-seam","text","textpool","then","throw","time","times","timestamp","timezone","tims_is_valid","title","titlebar","title-lines","to","tokenization","tokens","top-lines","top-of-page","trace-file","trace-table","trailing","transaction","transfer","transformation","translate","transporting","trmac","truncate","truncation","try","tstmp_add_seconds","tstmp_current_utctimestamp","tstmp_is_valid","tstmp_seconds_between","type","type-pool","type-pools","types","uline","unassign","under","unicode","union","unique","unit_conversion","unix","unpack","until","unwind","up","update","upper","user","user-command","using","utf-8","valid","value","value-request","values","vary","varying","verification-message","version","via","view","visible","wait","warning","when","whenever","where","while","width","window","windows","with","with-heading","without","with-title","word","work","write","writer","xml","xsd","yellow","yes","yymmdd","zero","zone","abap_system_timezone","abap_user_timezone","access","action","adabas","adjust_numbers","allow_precision_loss","allowed","amdp","applicationuser","as_geo_json","as400","associations","balance","behavior","breakup","bulk","cds","cds_client","check_before_save","child","clients","corr","corr_spearman","cross","cycles","datn_add_days","datn_add_months","datn_days_between","dats_from_datn","dats_tims_to_tstmp","dats_to_datn","db2","db6","ddl","dense_rank","depth","deterministic","discarding","entities","entity","error","failed","finalize","first_value","fltp_to_dec","following","fractional","full","graph","grouping","hierarchy","hierarchy_ancestors","hierarchy_ancestors_aggregate","hierarchy_descendants","hierarchy_descendants_aggregate","hierarchy_siblings","incremental","indicators","lag","last_value","lead","leaves","like_regexpr","link","locale_sap","lock","locks","many","mapped","matched","measures","median","mssqlnt","multiple","nodetype","ntile","nulls","occurrences_regexpr","one","operations","oracle","orphans","over","parent","parents","partition","pcre","period","pfcg_mapping","preceding","privileged","product","projection","rank","redirected","replace_regexpr","reported","response","responses","root","row","row_number","sap_system_date","save","schema","session","sets","shortdump","siblings","spantree","start","stddev","string_agg","subtotal","sybase","tims_from_timn","tims_to_timn","to_blob","to_clob","total","trace-entry","tstmp_to_dats","tstmp_to_dst","tstmp_to_tims","tstmpl_from_utcl","tstmpl_to_utcl","unbounded","utcl_add_seconds","utcl_current","utcl_seconds_between","uuid","var","verbatim"],builtinFunctions:["abs","acos","asin","atan","bit-set","boolc","boolx","ceil","char_off","charlen","cmax","cmin","concat_lines_of","contains","contains_any_not_of","contains_any_of","cos","cosh","count","count_any_not_of","count_any_of","dbmaxlen","distance","escape","exp","find_any_not_of","find_any_of","find_end","floor","frac","from_mixed","ipow","line_exists","line_index","log","log10","matches","nmax","nmin","numofchar","repeat","rescale","reverse","round","segment","shift_left","shift_right","sign","sin","sinh","sqrt","strlen","substring","substring_after","substring_before","substring_from","substring_to","tan","tanh","to_lower","to_mixed","to_upper","trunc","utclong_add","utclong_current","utclong_diff","xsdbool","xstrlen"],typeKeywords:["b","c","d","decfloat16","decfloat34","f","i","int8","n","p","s","string","t","utclong","x","xstring","any","clike","csequence","decfloat","numeric","simple","xsequence","accp","char","clnt","cuky","curr","datn","dats","d16d","d16n","d16r","d34d","d34n","d34r","dec","df16_dec","df16_raw","df34_dec","df34_raw","fltp","geom_ewkb","int1","int2","int4","lang","lchr","lraw","numc","quan","raw","rawstring","sstring","timn","tims","unit","utcl","df16_scl","df34_scl","prec","varc","abap_bool","abap_false","abap_true","abap_undefined","me","screen","space","super","sy","syst","table_line","*sys*"],builtinMethods:["class_constructor","constructor"],derivedTypes:["%CID","%CID_REF","%CONTROL","%DATA","%ELEMENT","%FAIL","%KEY","%MSG","%PARAM","%PID","%PID_ASSOC","%PID_PARENT","%_HINTS"],cdsLanguage:["@AbapAnnotation","@AbapCatalog","@AccessControl","@API","@ClientDependent","@ClientHandling","@CompatibilityContract","@DataAging","@EndUserText","@Environment","@LanguageDependency","@MappingRole","@Metadata","@MetadataExtension","@ObjectModel","@Scope","@Semantics","$EXTENSION","$SELF"],selectors:["->","->*","=>","~","~*"],operators:[" +"," -","/","*","**","div","mod","=","#","@","+=","-=","*=","/=","**=","&&=","?=","&","&&","bit-and","bit-not","bit-or","bit-xor","m","o","z","<"," >","<=",">=","<>","><","=<","=>","bt","byte-ca","byte-cn","byte-co","byte-cs","byte-na","byte-ns","ca","cn","co","cp","cs","eq","ge","gt","le","lt","na","nb","ne","np","ns","*/","*:","--","/*","//"],symbols:/[=><!~?&+\-*\/\^%#@]+/,tokenizer:{root:[[/[a-z_\/$%@]([\w\/$%]|-(?!>))*/,{cases:{"@typeKeywords":"type","@keywords":"keyword","@cdsLanguage":"annotation","@derivedTypes":"type","@builtinFunctions":"type","@builtinMethods":"type","@operators":"key","@default":"identifier"}}],[/<[\w]+>/,"identifier"],[/##[\w|_]+/,"comment"],{include:"@whitespace"},[/[:,.]/,"delimiter"],[/[{}()\[\]]/,"@brackets"],[/@symbols/,{cases:{"@selectors":"tag","@operators":"key","@default":""}}],[/'/,{token:"string",bracket:"@open",next:"@stringquote"}],[/`/,{token:"string",bracket:"@open",next:"@stringping"}],[/\|/,{token:"string",bracket:"@open",next:"@stringtemplate"}],[/\d+/,"number"]],stringtemplate:[[/[^\\\|]+/,"string"],[/\\\|/,"string"],[/\|/,{token:"string",bracket:"@close",next:"@pop"}]],stringping:[[/[^\\`]+/,"string"],[/`/,{token:"string",bracket:"@close",next:"@pop"}]],stringquote:[[/[^\\']+/,"string"],[/'/,{token:"string",bracket:"@close",next:"@pop"}]],whitespace:[[/[ \t\r\n]+/,""],[/^\*.*$/,"comment"],[/\".*$/,"comment"]]}};export{i as conf,s as language};
@@ -0,0 +1 @@
1
+ (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"db-studio@1.18.0"};var s=new e.Error().stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="b63b13e9-254d-4208-948c-98ef9dce408e",e._sentryDebugIdIdentifier="sentry-dbid-b63b13e9-254d-4208-948c-98ef9dce408e")}catch{}})();var r={wordPattern:/(-?\d*\.\d\w*)|([^\`\~\!\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"},{open:"<",close:">"}],folding:{markers:{start:new RegExp("^\\s*//\\s*(?:(?:#?region\\b)|(?:<editor-fold\\b))"),end:new RegExp("^\\s*//\\s*(?:(?:#?endregion\\b)|(?:</editor-fold>))")}}},n=["abstract","activate","and","any","array","as","asc","assert","autonomous","begin","bigdecimal","blob","boolean","break","bulk","by","case","cast","catch","char","class","collect","commit","const","continue","convertcurrency","decimal","default","delete","desc","do","double","else","end","enum","exception","exit","export","extends","false","final","finally","float","for","from","future","get","global","goto","group","having","hint","if","implements","import","in","inner","insert","instanceof","int","interface","into","join","last_90_days","last_month","last_n_days","last_week","like","limit","list","long","loop","map","merge","native","new","next_90_days","next_month","next_n_days","next_week","not","null","nulls","number","object","of","on","or","outer","override","package","parallel","pragma","private","protected","public","retrieve","return","returning","rollback","savepoint","search","select","set","short","sort","stat","static","strictfp","super","switch","synchronized","system","testmethod","then","this","this_month","this_week","throw","throws","today","tolabel","tomorrow","transaction","transient","trigger","true","try","type","undelete","update","upsert","using","virtual","void","volatile","webservice","when","where","while","yesterday"],o=e=>e.charAt(0).toUpperCase()+e.substr(1),t=[];n.forEach(e=>{t.push(e),t.push(e.toUpperCase()),t.push(o(e))});var a={defaultToken:"",tokenPostfix:".apex",keywords:t,operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],symbols:/[=><!~?:&|+\-*\/\^%]+/,escapes:/\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,digits:/\d+(_+\d+)*/,octaldigits:/[0-7]+(_+[0-7]+)*/,binarydigits:/[0-1]+(_+[0-1]+)*/,hexdigits:/[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/,tokenizer:{root:[[/[a-z_$][\w$]*/,{cases:{"@keywords":{token:"keyword.$0"},"@default":"identifier"}}],[/[A-Z][\w\$]*/,{cases:{"@keywords":{token:"keyword.$0"},"@default":"type.identifier"}}],{include:"@whitespace"},[/[{}()\[\]]/,"@brackets"],[/[<>](?!@symbols)/,"@brackets"],[/@symbols/,{cases:{"@operators":"delimiter","@default":""}}],[/@\s*[a-zA-Z_\$][\w\$]*/,"annotation"],[/(@digits)[eE]([\-+]?(@digits))?[fFdD]?/,"number.float"],[/(@digits)\.(@digits)([eE][\-+]?(@digits))?[fFdD]?/,"number.float"],[/(@digits)[fFdD]/,"number.float"],[/(@digits)[lL]?/,"number"],[/[;,.]/,"delimiter"],[/"([^"\\]|\\.)*$/,"string.invalid"],[/'([^'\\]|\\.)*$/,"string.invalid"],[/"/,"string",'@string."'],[/'/,"string","@string.'"],[/'[^\\']'/,"string"],[/(')(@escapes)(')/,["string","string.escape","string"]],[/'/,"string.invalid"]],whitespace:[[/[ \t\r\n]+/,""],[/\/\*\*(?!\/)/,"comment.doc","@apexdoc"],[/\/\*/,"comment","@comment"],[/\/\/.*$/,"comment"]],comment:[[/[^\/*]+/,"comment"],[/\*\//,"comment","@pop"],[/[\/*]/,"comment"]],apexdoc:[[/[^\/*]+/,"comment.doc"],[/\*\//,"comment.doc","@pop"],[/[\/*]/,"comment.doc"]],string:[[/[^\\"']+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/["']/,{cases:{"$#==$S2":{token:"string",next:"@pop"},"@default":"string"}}]]}};export{r as conf,a as language};
@@ -0,0 +1 @@
1
+ (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"db-studio@1.18.0"};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="bf9ae677-ef2b-449e-b821-9b20d55f8b83",e._sentryDebugIdIdentifier="sentry-dbid-bf9ae677-ef2b-449e-b821-9b20d55f8b83")}catch{}})();var o={comments:{lineComment:"#"}},s={defaultToken:"keyword",ignoreCase:!0,tokenPostfix:".azcli",str:/[^#\s]/,tokenizer:{root:[{include:"@comment"},[/\s-+@str*\s*/,{cases:{"@eos":{token:"key.identifier",next:"@popall"},"@default":{token:"key.identifier",next:"@type"}}}],[/^-+@str*\s*/,{cases:{"@eos":{token:"key.identifier",next:"@popall"},"@default":{token:"key.identifier",next:"@type"}}}]],type:[{include:"@comment"},[/-+@str*\s*/,{cases:{"@eos":{token:"key.identifier",next:"@popall"},"@default":"key.identifier"}}],[/@str+\s*/,{cases:{"@eos":{token:"string",next:"@popall"},"@default":"string"}}]],comment:[[/#.*$/,{cases:{"@eos":{token:"comment",next:"@popall"}}}]]}};export{o as conf,s as language};
@@ -0,0 +1 @@
1
+ import{R as l,a as u,at as c,ot as g}from"./icons-BEkcNqUd.js";import{$ as f,G as m,J as p,K as x,Q as b,U as v,W as h,X as j,Y as y,Z as C,et as w,gt as z,kt as k,q as A,tt as D}from"./radix-ui-Bp71_UWp.js";import{t as o}from"./utils-CNXzeC6_.js";import{l as N}from"./keys-o03XLuW4.js";import{G as s,q as _}from"./tooltip-CIAbgIn7.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"db-studio@1.18.0"};var a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="2b0d16b6-6d7a-4663-b702-a085bd547464",e._sentryDebugIdIdentifier="sentry-dbid-2b0d16b6-6d7a-4663-b702-a085bd547464")}catch{}})();var t=k(),T={info:{icon:l,containerClass:"border-blue-500/50 bg-blue-50/50 text-blue-600 dark:bg-blue-950/20",iconClass:"text-blue-500"},warning:{icon:u,containerClass:"border-amber-500/50 bg-amber-50/50 text-amber-600 dark:bg-amber-950/20",iconClass:"text-amber-500"},error:{icon:g,containerClass:"border-red-500/50 bg-red-50/50 text-red-600 dark:bg-red-950/20",iconClass:"text-red-500"},success:{icon:c,containerClass:"border-emerald-500/50 bg-emerald-50/50 text-emerald-600 dark:bg-emerald-950/20",iconClass:"text-emerald-500"}},G=({variant:e,title:a,message:r,className:i})=>{const n=T[e],d=n.icon;return(0,t.jsxs)("div",{className:o("rounded-md border px-4 py-3",n.containerClass,i),children:[(0,t.jsxs)("p",{className:o("text-sm flex items-center gap-2",r?"mb-1":""),children:[(0,t.jsx)(d,{"aria-hidden":"true",className:o("-mt-0.5 inline-flex opacity-80",n.iconClass),size:16}),(0,t.jsx)("span",{className:"font-medium",children:a})]}),r&&(0,t.jsx)("p",{className:"text-xs opacity-90 ml-7",children:r})]})};function O({...e}){return(0,t.jsx)(w,{"data-slot":"alert-dialog",...e})}function I({...e}){return(0,t.jsx)(f,{"data-slot":"alert-dialog-portal",...e})}function P({className:e,...a}){return(0,t.jsx)(b,{"data-slot":"alert-dialog-overlay",className:o("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/80 duration-100 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 z-50",e),...a})}function V({className:e,size:a="default",...r}){return(0,t.jsxs)(I,{children:[(0,t.jsx)(P,{}),(0,t.jsx)(j,{"data-slot":"alert-dialog-content","data-size":a,className:o("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 bg-background ring-foreground/10 gap-3 rounded-xl p-4 ring-1 duration-100 data-[size=default]:max-w-xs data-[size=sm]:max-w-64 data-[size=default]:sm:max-w-sm group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 outline-none",e),...r})]})}function Y({className:e,...a}){return(0,t.jsx)("div",{"data-slot":"alert-dialog-header",className:o("grid grid-rows-[auto_1fr] place-items-center gap-1 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",e),...a})}function F({className:e,...a}){return(0,t.jsx)("div",{"data-slot":"alert-dialog-footer",className:o("flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",e),...a})}function H({className:e,...a}){return(0,t.jsx)(D,{"data-slot":"alert-dialog-title",className:o("text-sm font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",e),...a})}function J({className:e,...a}){return(0,t.jsx)(C,{"data-slot":"alert-dialog-description",className:o("text-muted-foreground *:[a]:hover:text-foreground text-xs/relaxed text-balance md:text-pretty *:[a]:underline *:[a]:underline-offset-3",e),...a})}function K({className:e,variant:a="default",size:r="default",...i}){return(0,t.jsx)(s,{variant:a,size:r,asChild:!0,children:(0,t.jsx)(p,{"data-slot":"alert-dialog-action",className:o(e),...i})})}function L({className:e,variant:a="outline",size:r="default",...i}){return(0,t.jsx)(s,{variant:a,size:r,asChild:!0,children:(0,t.jsx)(y,{"data-slot":"alert-dialog-cancel",className:o(e),...i})})}function Q({modal:e,...a}){const r=N();return(0,t.jsx)(x,{"data-slot":"popover",modal:e??(r?!0:void 0),...a})}function U({...e}){return(0,t.jsx)(A,{"data-slot":"popover-trigger",...e})}function W({className:e,align:a="center",sideOffset:r=4,...i}){return(0,t.jsx)(m,{children:(0,t.jsx)(h,{"data-slot":"popover-content",align:a,sideOffset:r,className:o("bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-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 ring-foreground/10 flex flex-col gap-4 rounded-lg p-2.5 text-xs shadow-md ring-1 duration-100 z-50 w-72 origin-(--radix-popover-content-transform-origin) outline-hidden",e),...i})})}function X({...e}){return(0,t.jsx)(v,{"data-slot":"popover-anchor",...e})}var E=_("h-5 gap-1 rounded-full border border-transparent px-2 py-0.5 text-[0.625rem] font-medium transition-all has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-2.5! inline-flex items-center justify-center w-fit whitespace-nowrap shrink-0 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-colors overflow-hidden group/badge",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 [a]:hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 text-destructive dark:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground bg-input/20 dark:bg-input/30",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function Z({className:e,variant:a="default",asChild:r=!1,...i}){return(0,t.jsx)(r?z:"span",{"data-slot":"badge","data-variant":a,className:o(E({variant:a}),e),...i})}export{U as a,L as c,F as d,Y as f,W as i,V as l,G as m,Q as n,O as o,H as p,X as r,K as s,Z as t,J as u};
@@ -0,0 +1 @@
1
+ (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"db-studio@1.18.0"};var s=new e.Error().stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="249f5ce5-b92e-40d9-8b24-1d5a7cdcea72",e._sentryDebugIdIdentifier="sentry-dbid-249f5ce5-b92e-40d9-8b24-1d5a7cdcea72")}catch{}})();var t={comments:{lineComment:"REM"},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'}],surroundingPairs:[{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'}],folding:{markers:{start:new RegExp("^\\s*(::\\s*|REM\\s+)#region"),end:new RegExp("^\\s*(::\\s*|REM\\s+)#endregion")}}},n={defaultToken:"",ignoreCase:!0,tokenPostfix:".bat",brackets:[{token:"delimiter.bracket",open:"{",close:"}"},{token:"delimiter.parenthesis",open:"(",close:")"},{token:"delimiter.square",open:"[",close:"]"}],keywords:/call|defined|echo|errorlevel|exist|for|goto|if|pause|set|shift|start|title|not|pushd|popd/,symbols:/[=><!~?&|+\-*\/\^;\.,]+/,escapes:/\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,tokenizer:{root:[[/^(\s*)(rem(?:\s.*|))$/,["","comment"]],[/(\@?)(@keywords)(?!\w)/,[{token:"keyword"},{token:"keyword.$2"}]],[/[ \t\r\n]+/,""],[/setlocal(?!\w)/,"keyword.tag-setlocal"],[/endlocal(?!\w)/,"keyword.tag-setlocal"],[/[a-zA-Z_]\w*/,""],[/:\w*/,"metatag"],[/%[^%]+%/,"variable"],[/%%[\w]+(?!\w)/,"variable"],[/[{}()\[\]]/,"@brackets"],[/@symbols/,"delimiter"],[/\d*\.\d+([eE][\-+]?\d+)?/,"number.float"],[/0[xX][0-9a-fA-F_]*[0-9a-fA-F]/,"number.hex"],[/\d+/,"number"],[/[;,.]/,"delimiter"],[/"/,"string",'@string."'],[/'/,"string","@string.'"]],string:[[/[^\\"'%]+/,{cases:{"@eos":{token:"string",next:"@popall"},"@default":"string"}}],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/%[\w ]+%/,"variable"],[/%%[\w]+(?!\w)/,"variable"],[/["']/,{cases:{"$#==$S2":{token:"string",next:"@pop"},"@default":"string"}}],[/$/,"string","@popall"]]}};export{t as conf,n as language};
@@ -0,0 +1,2 @@
1
+ (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"db-studio@1.18.0"};var n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="6f8aa1b6-e914-4261-b615-33cc7f55ccba",e._sentryDebugIdIdentifier="sentry-dbid-6f8aa1b6-e914-4261-b615-33cc7f55ccba")}catch{}})();var t=e=>`\\b${e}\\b`,o=t("[_a-zA-Z][_a-zA-Z0-9]*"),r=["targetScope","resource","module","param","var","output","for","in","if","existing"],i=["true","false","null"],a="[ \\t\\r\\n]",s="[0-9]+",g={comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:"'",close:"'"},{open:"'''",close:"'''"}],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:"'",close:"'",notIn:["string","comment"]},{open:"'''",close:"'''",notIn:["string","comment"]}],autoCloseBefore:`:.,=}])'
2
+ `,indentationRules:{increaseIndentPattern:new RegExp("^((?!\\/\\/).)*(\\{[^}\"'`]*|\\([^)\"'`]*|\\[[^\\]\"'`]*)$"),decreaseIndentPattern:new RegExp("^((?!.*?\\/\\*).*\\*/)?\\s*[\\}\\]].*$")}},l={defaultToken:"",tokenPostfix:".bicep",brackets:[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"}],symbols:/[=><!~?:&|+\-*/^%]+/,keywords:r,namedLiterals:i,escapes:"\\\\(u{[0-9A-Fa-f]+}|n|r|t|\\\\|'|\\${)",tokenizer:{root:[{include:"@expression"},{include:"@whitespace"}],stringVerbatim:[{regex:"(|'|'')[^']",action:{token:"string"}},{regex:"'''",action:{token:"string.quote",next:"@pop"}}],stringLiteral:[{regex:"\\${",action:{token:"delimiter.bracket",next:"@bracketCounting"}},{regex:"[^\\\\'$]+",action:{token:"string"}},{regex:"@escapes",action:{token:"string.escape"}},{regex:"\\\\.",action:{token:"string.escape.invalid"}},{regex:"'",action:{token:"string",next:"@pop"}}],bracketCounting:[{regex:"{",action:{token:"delimiter.bracket",next:"@bracketCounting"}},{regex:"}",action:{token:"delimiter.bracket",next:"@pop"}},{include:"expression"}],comment:[{regex:"[^\\*]+",action:{token:"comment"}},{regex:"\\*\\/",action:{token:"comment",next:"@pop"}},{regex:"[\\/*]",action:{token:"comment"}}],whitespace:[{regex:a},{regex:"\\/\\*",action:{token:"comment",next:"@comment"}},{regex:"\\/\\/.*$",action:{token:"comment"}}],expression:[{regex:"'''",action:{token:"string.quote",next:"@stringVerbatim"}},{regex:"'",action:{token:"string.quote",next:"@stringLiteral"}},{regex:s,action:{token:"number"}},{regex:o,action:{cases:{"@keywords":{token:"keyword"},"@namedLiterals":{token:"keyword"},"@default":{token:"identifier"}}}}]}};export{g as conf,l as language};
@@ -0,0 +1 @@
1
+ import{r as me}from"./rolldown-runtime-Ba77kUFP.js";import{_ as he}from"./tanstack-HxB2LyLp.js";import{$ as xe,S as ee,T as fe,X as be,_ as pe,c as ge,o as _,pt as ve,v as B,wt as je,x as ye,xt as Ne}from"./icons-BEkcNqUd.js";import{kt as ke}from"./radix-ui-Bp71_UWp.js";import{n as we}from"./dist-DmSgBrHs.js";import{t as q}from"./utils-CNXzeC6_.js";import{t as Se}from"./spinner-gvrX8mkL.js";import{s as J}from"./keys-o03XLuW4.js";import{G as m,O as Ce,c as Re,i as Z,n as Q,t as W}from"./tooltip-CIAbgIn7.js";import{t as De}from"./database.store-C0jTx_DA.js";import{a as _e,c as Me,d as Le,f as Te,i as Ee,l as $e,m as P,n as Fe,o as Oe,p as Ae,s as ze,t as Ie,u as Pe}from"./badge-Ckwkbv_3.js";import{E as Be,_ as Je,c as Ke,g as X,l as ie,v as Ge,y as Y}from"./index-b6Apx1z7.js";import{t as Ue}from"./queries.store-BbUkkWy1.js";import{a as He,i as Ve,n as S,o as qe,r as Ze,t as D}from"./redis-value-rbj0L_ie.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};s.SENTRY_RELEASE={id:"db-studio@1.18.0"};var r=new s.Error().stack;r&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[r]="2e2e2234-9cd3-4bf9-8447-aeb78e461dae",s._sentryDebugIdIdentifier="sentry-dbid-2e2e2234-9cd3-4bf9-8447-aeb78e461dae")}catch{}})();var p=me(je(),1),e=ke(),le=({text:s,label:r,className:t})=>{const[a,i]=(0,p.useState)(!1);return(0,e.jsxs)(W,{children:[(0,e.jsx)(Z,{asChild:!0,children:(0,e.jsx)(m,{variant:"ghost",size:"icon-sm",className:t,onClick:async()=>{await navigator.clipboard.writeText(typeof s=="function"?s():s),i(!0),window.setTimeout(()=>i(!1),1200)},"aria-label":r,children:a?(0,e.jsx)(ve,{}):(0,e.jsx)(xe,{})})}),(0,e.jsx)(Q,{children:a?"Copied":r})]})},Qe=[{label:"60s",ttlMs:6e4},{label:"10m",ttlMs:6e5},{label:"1h",ttlMs:36e5},{label:"1d",ttlMs:864e5},{label:"7d",ttlMs:6048e5}],We=s=>s===null?"—":s<1024?`${s} B`:s<1048576?`${(s/1024).toFixed(1)} KiB`:`${(s/1048576).toFixed(1)} MiB`,Xe=s=>{const r=Math.max(0,Math.ceil(s/1e3));if(r<60)return`${r}s`;const t=Math.floor(r/60);if(t<60)return`${t}m ${r%60}s`;const a=Math.floor(t/60);return a<24?`${a}h ${t%60}m`:`${Math.floor(a/24)}d ${a%24}h`},Ye=s=>{const[,r]=(0,p.useReducer)(t=>t+1,0);(0,p.useEffect)(()=>{if(!s)return;const t=window.setInterval(r,1e3);return()=>window.clearInterval(t)},[s])},es=({detail:s,label:r,loadedCount:t,fetchedAt:a,isFetching:i,pending:n,command:l,act:o,onRefresh:d,onOpenRunner:h,onDelete:c})=>{const[b,u]=(0,p.useState)(s.key),[M,G]=(0,p.useState)("");Ye(s.ttlMs>0);const C=s.ttlMs>0?s.ttlMs-(Date.now()-a):s.ttlMs,N=s.ttlMs===-1,x=!N&&C<=0,z=[{name:"TTL",value:N?"∞":x?"expired":Xe(C),hint:N?"No expiry — the key persists until deleted.":x?"The TTL elapsed; Redis has evicted or is about to evict this key.":`Expires ${new Date(a+s.ttlMs).toLocaleString()}`,alert:x},{name:"MEM",value:We(s.memoryBytes),hint:"Approximate memory usage reported by MEMORY USAGE."},{name:"LEN",value:s.length?.toLocaleString()??"—",hint:t!==null&&s.length!==null?`${t.toLocaleString()} of ${s.length.toLocaleString()} entries loaded in this view.`:"Length reported by Redis (entries, or bytes for strings)."},{name:"REV",value:s.revision.slice(0,8),hint:"Optimistic-lock revision. Writes are rejected when the key changed since this fetch."},{name:"AT",value:new Date(a).toLocaleTimeString(),hint:"When this snapshot was fetched from Redis."}];return(0,e.jsx)("header",{className:"border-b border-border",children:(0,e.jsxs)("div",{className:"flex min-h-10 items-stretch justify-between",children:[(0,e.jsxs)("div",{className:"flex min-w-0 flex-1 items-stretch overflow-x-auto",children:[(0,e.jsxs)("div",{className:"flex min-w-0 max-w-[min(36rem,45vw)] shrink items-center gap-1 px-3 py-1.5",children:[(0,e.jsx)("code",{className:"min-w-0 truncate text-sm text-foreground",title:r,children:r||"(empty key)"}),(0,e.jsx)(le,{text:s.key.utf8??s.key.base64,label:"Copy key name",className:"shrink-0 text-muted-foreground"}),(0,e.jsx)(Ie,{variant:"outline",className:"h-4 shrink-0 rounded-sm px-1.5 text-[8px] font-normal uppercase text-muted-foreground",children:s.type})]}),z.map(({name:v,value:I,hint:L,alert:T},E)=>(0,e.jsxs)(W,{children:[(0,e.jsx)(Z,{asChild:!0,children:(0,e.jsxs)("div",{className:q("flex shrink-0 cursor-default items-center gap-1.5 border-s border-border px-2 text-[10px]",E===z.length-1&&"border-e"),children:[(0,e.jsx)("span",{className:"text-muted-foreground",children:v}),(0,e.jsx)("span",{className:q("tabular-nums",T?"text-destructive":"text-foreground"),children:I})]})}),(0,e.jsx)(Q,{side:"bottom",children:L})]},v))]}),(0,e.jsxs)("div",{className:"flex shrink-0 items-stretch",children:[(0,e.jsxs)(m,{variant:"ghost",size:"sm",className:"h-auto rounded-none border-y-0 border-s border-e-0 border-border px-2",onClick:d,disabled:i,children:[(0,e.jsx)(ye,{className:q(i&&"animate-spin")})," Refresh"]}),l&&(0,e.jsxs)(W,{children:[(0,e.jsx)(Z,{asChild:!0,children:(0,e.jsxs)(m,{variant:"ghost",size:"sm",className:"h-auto rounded-none border-y-0 border-s border-e-0 border-border px-2",onClick:h,children:[(0,e.jsx)(ge,{})," Runner"]})}),(0,e.jsxs)(Q,{side:"bottom",children:["Open in the query runner as ",(0,e.jsx)("code",{className:"font-mono",children:l})]})]}),(0,e.jsxs)(Fe,{children:[(0,e.jsx)(_e,{asChild:!0,children:(0,e.jsxs)(m,{variant:"ghost",size:"sm",className:"h-auto rounded-none border-y-0 border-s border-e-0 border-border px-2",children:[(0,e.jsx)(fe,{})," Edit"]})}),(0,e.jsx)(Ee,{align:"end",className:"w-72 rounded-sm p-3 font-mono",children:(0,e.jsxs)(Ge,{className:"gap-4",children:[(0,e.jsxs)(X,{className:"gap-1.5",children:[(0,e.jsx)(Y,{htmlFor:"redis-key-rename",children:"Rename key"}),(0,e.jsxs)("form",{className:"flex",onSubmit:v=>{v.preventDefault(),!(b===null||b.base64===s.key.base64||n)&&o({action:"rename",newKey:b})},children:[(0,e.jsx)(S,{id:"redis-key-rename",value:b,onChange:u,className:"rounded-e-none font-mono"}),(0,e.jsx)(m,{type:"submit",size:"icon",className:"h-auto self-stretch rounded-s-none border-0 bg-clip-border",disabled:b===null||b.base64===s.key.base64||n,"aria-label":"Rename key",children:(0,e.jsx)(Ne,{})})]})]}),(0,e.jsxs)(X,{className:"gap-1.5",children:[(0,e.jsx)(Y,{htmlFor:"redis-key-ttl-operation",children:"TTL in seconds"}),(0,e.jsxs)("form",{className:"flex",onSubmit:v=>{v.preventDefault(),!n&&o({action:"setTtl",ttlMs:M?Number(M)*1e3:null})},children:[(0,e.jsx)(J,{id:"redis-key-ttl-operation",type:"number",min:1,value:M,onChange:v=>G(v.target.value),placeholder:s.ttlMs>0?String(Math.ceil(s.ttlMs/1e3)):"Persistent",className:"rounded-e-none font-mono"}),(0,e.jsx)(m,{type:"submit",className:"h-auto self-stretch rounded-s-none border-0 bg-clip-border",disabled:n,children:"Apply"})]}),(0,e.jsxs)("div",{className:"flex flex-wrap gap-1",children:[Qe.map(v=>(0,e.jsx)(m,{type:"button",variant:"outline",size:"xs",disabled:n,onClick:()=>o({action:"setTtl",ttlMs:v.ttlMs}),children:v.label},v.label)),(0,e.jsx)(m,{type:"button",variant:"outline",size:"xs",disabled:n||N,onClick:()=>o({action:"setTtl",ttlMs:null}),children:"Persist"})]}),(0,e.jsx)(Je,{children:"Leave empty to persist the key."})]})]})})]}),(0,e.jsxs)(m,{variant:"destructive",size:"sm",className:"h-auto rounded-none border-y-0 border-s border-e-0 border-border px-2",disabled:n,onClick:c,children:[(0,e.jsx)(_,{})," Delete"]})]})]})})},w=Ve(""),j=s=>s.utf8??`base64:${s.base64}`,$=(s,...r)=>r.some(t=>String(t).toLowerCase().includes(s)),F=s=>{switch(s.kind){case"string":return JSON.stringify(j(s.value),null,2);case"hash":return JSON.stringify(Object.fromEntries(s.entries.map(r=>[j(r.field),j(r.value)])),null,2);case"list":return JSON.stringify(s.entries.map(r=>j(r.value)),null,2);case"set":return JSON.stringify(s.members.map(j),null,2);case"zset":return JSON.stringify(s.entries.map(r=>({member:j(r.member),score:r.score})),null,2);case"stream":return JSON.stringify(s.entries.map(r=>({id:r.id,fields:Object.fromEntries(r.fields.map(t=>[j(t.field),j(t.value)]))})),null,2);default:return""}},K=(s,r)=>{const[t,a]=(0,p.useState)(s),[i,n]=(0,p.useState)(r);return i!==r&&(n(r),a(s)),[t,a]},O=({filtered:s})=>(0,e.jsx)("div",{className:"flex h-10 items-center justify-center px-2 text-xs text-muted-foreground",children:s?"No loaded entries match the filter.":"No entries loaded."}),A=({filter:s,onFilterChange:r,shownCount:t,loadedCount:a,totalCount:i,copyJson:n,extra:l,header:o,children:d,footer:h})=>(0,e.jsxs)("div",{className:"overflow-hidden border border-border",children:[(0,e.jsxs)("div",{className:"flex h-8 items-center gap-1 border-b border-border bg-muted/10 px-1",children:[(0,e.jsx)(pe,{className:"ms-1 size-3 shrink-0 text-muted-foreground"}),(0,e.jsx)(J,{variant:"outline",value:s,onChange:c=>r(c.target.value),placeholder:"Filter loaded entries","aria-label":"Filter loaded entries",className:"h-6 flex-1 rounded-none border-none px-1 font-mono focus-visible:ring-0"}),l,(0,e.jsx)("span",{className:"shrink-0 px-1 text-[10px] tabular-nums text-muted-foreground",children:s?`${t} / ${a}`:i!==null&&i>a?`${a.toLocaleString()} of ${i.toLocaleString()}`:a.toLocaleString()}),(0,e.jsx)(le,{text:n,label:"Copy loaded entries as JSON"})]}),o,d,h]}),se=({labels:s,onSave:r,pending:t,score:a=!1})=>{const[i,n]=(0,p.useState)(w),[l,o]=(0,p.useState)(w),[d,h]=(0,p.useState)("0"),c=i===null||!a&&l===null,b=async u=>{u.preventDefault(),!(i===null||l===null)&&await r(i,a?Number(d):l)&&(n(w),o(w),h("0"))};return(0,e.jsxs)("form",{onSubmit:b,className:"grid grid-cols-[1fr_1fr_auto] items-center gap-2 border-t border-border bg-muted/10 p-2",children:[(0,e.jsx)(S,{value:i,onChange:n,placeholder:s[0]}),a?(0,e.jsx)(J,{type:"number",step:"any",value:d,onChange:u=>h(u.target.value),placeholder:s[1],className:"font-mono"}):(0,e.jsx)(S,{value:l,onChange:o,placeholder:s[1]}),(0,e.jsxs)(m,{type:"submit",disabled:t||c,children:[(0,e.jsx)(ee,{})," Add"]})]})},ss=({value:s,truncated:r,act:t,pending:a,onLoadFull:i,onDownload:n})=>{const[l,o]=K(s,s.base64),d=l!==null&&l.base64!==s.base64;return(0,e.jsxs)("div",{className:"space-y-3",children:[r&&(0,e.jsxs)("div",{className:"grid gap-2 border-b border-border pb-3 sm:grid-cols-[1fr_auto] sm:items-center",children:[(0,e.jsx)(P,{variant:"warning",title:"Preview truncated",message:"Load the full value before editing (up to the 8 MiB response cap).",className:"rounded-sm"}),(0,e.jsx)(m,{variant:"outline",onClick:i,children:"Load full"})]}),(0,e.jsx)(D,{value:s,onDownload:n}),(0,e.jsxs)("form",{onSubmit:h=>{h.preventDefault(),l!==null&&d&&t({action:"setString",value:l})},className:"border border-border p-3",children:[(0,e.jsxs)(X,{className:"gap-1.5",children:[(0,e.jsx)(Y,{htmlFor:"redis-string-value",children:"Replace value"}),(0,e.jsx)(S,{id:"redis-string-value",value:l,onChange:o})]}),(0,e.jsxs)(m,{type:"submit",className:"mt-3",disabled:r||a||!d,children:[(0,e.jsx)(B,{})," Save value"]})]})]})},rs=({field:s,value:r,act:t,pending:a})=>{const[i,n]=K(r,r.base64),l=i!==null&&i.base64!==r.base64;return(0,e.jsxs)("div",{className:"grid min-h-8 grid-cols-[minmax(10rem,0.7fr)_1fr_5rem] items-center gap-2 border-b border-border px-2 py-1",children:[(0,e.jsx)(D,{value:s,compact:!0}),(0,e.jsx)(S,{value:i,onChange:n}),(0,e.jsxs)("div",{className:"flex",children:[(0,e.jsx)(m,{variant:"ghost",size:"icon-sm",className:l?"text-primary":void 0,disabled:a||!l,onClick:()=>i!==null&&t({action:"upsertHash",field:s,value:i}),"aria-label":"Save hash value",children:(0,e.jsx)(B,{})}),(0,e.jsx)(m,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-destructive",disabled:a,onClick:()=>t({action:"deleteHash",field:s}),"aria-label":"Delete hash field",children:(0,e.jsx)(_,{})})]})]})},ts=({value:s,total:r,act:t,pending:a})=>{const[i,n]=(0,p.useState)(""),l=i.trim().toLowerCase(),o=l?s.entries.filter(d=>$(l,j(d.field),j(d.value))):s.entries;return(0,e.jsx)(A,{filter:i,onFilterChange:n,shownCount:o.length,loadedCount:s.entries.length,totalCount:r,copyJson:()=>F(s),header:(0,e.jsxs)("div",{className:"grid h-8 grid-cols-[minmax(10rem,0.7fr)_1fr_5rem] items-center border-b border-border bg-muted/20 px-2 text-[10px] uppercase tracking-wider text-muted-foreground",children:[(0,e.jsx)("span",{children:"Field"}),(0,e.jsx)("span",{children:"Value"}),(0,e.jsx)("span",{})]}),footer:(0,e.jsx)(se,{labels:["field","value"],pending:a,onSave:(d,h)=>t({action:"upsertHash",field:d,value:h})}),children:o.length===0?(0,e.jsx)(O,{filtered:l.length>0}):o.map(d=>(0,e.jsx)(rs,{field:d.field,value:d.value,act:t,pending:a},d.field.base64))})},as=({index:s,value:r,revision:t,act:a,pending:i})=>{const[n,l]=K(r,`${t}:${r.base64}`),o=n!==null&&n.base64!==r.base64;return(0,e.jsxs)("div",{className:"grid min-h-8 grid-cols-[3rem_1fr_5rem] items-center gap-2 border-b border-border px-2 py-1",children:[(0,e.jsx)("code",{className:"text-xs text-muted-foreground",children:s}),(0,e.jsx)(S,{value:n,onChange:l}),(0,e.jsxs)("div",{className:"flex",children:[(0,e.jsx)(m,{variant:"ghost",size:"icon-sm",className:o?"text-primary":void 0,disabled:i||!o,onClick:()=>n!==null&&a({action:"setList",index:s,value:n}),"aria-label":`Save list item ${s}`,children:(0,e.jsx)(B,{})}),(0,e.jsx)(m,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-destructive",disabled:i,onClick:()=>a({action:"deleteList",index:s}),"aria-label":`Delete list item ${s}`,children:(0,e.jsx)(_,{})})]})]})},ns=({value:s,revision:r,total:t,act:a,pending:i})=>{const[n,l]=(0,p.useState)(""),[o,d]=(0,p.useState)(w),h=n.trim().toLowerCase(),c=h?s.entries.filter(u=>$(h,u.index,j(u.value))):s.entries,b=async u=>{o!==null&&await a({action:"pushList",side:u,value:o})&&d(w)};return(0,e.jsx)(A,{filter:n,onFilterChange:l,shownCount:c.length,loadedCount:s.entries.length,totalCount:t,copyJson:()=>F(s),header:(0,e.jsxs)("div",{className:"grid h-8 grid-cols-[3rem_1fr_5rem] items-center border-b border-border bg-muted/20 px-2 text-[10px] uppercase tracking-wider text-muted-foreground",children:[(0,e.jsx)("span",{children:"Index"}),(0,e.jsx)("span",{children:"Value"}),(0,e.jsx)("span",{})]}),footer:(0,e.jsxs)("form",{onSubmit:u=>{u.preventDefault(),b("right")},className:"grid grid-cols-[1fr_auto_auto] items-center gap-2 border-t border-border bg-muted/10 p-2",children:[(0,e.jsx)(S,{value:o,onChange:d,placeholder:"new item"}),(0,e.jsx)(m,{type:"button",variant:"outline",disabled:i||o===null,onClick:()=>b("left"),children:"Push left"}),(0,e.jsx)(m,{type:"submit",disabled:i||o===null,children:"Push right"})]}),children:c.length===0?(0,e.jsx)(O,{filtered:h.length>0}):c.map(u=>(0,e.jsx)(as,{index:u.index,value:u.value,revision:r,act:a,pending:i},u.index))})},is=({value:s,total:r,act:t,pending:a})=>{const[i,n]=(0,p.useState)(""),[l,o]=(0,p.useState)(w),d=i.trim().toLowerCase(),h=d?s.members.filter(c=>$(d,j(c))):s.members;return(0,e.jsx)(A,{filter:i,onFilterChange:n,shownCount:h.length,loadedCount:s.members.length,totalCount:r,copyJson:()=>F(s),header:(0,e.jsxs)("div",{className:"grid h-8 grid-cols-[1fr_2rem] items-center border-b border-border bg-muted/20 px-2 text-[10px] uppercase tracking-wider text-muted-foreground",children:[(0,e.jsx)("span",{children:"Member"}),(0,e.jsx)("span",{})]}),footer:(0,e.jsxs)("form",{onSubmit:async c=>{c.preventDefault(),l!==null&&await t({action:"addSet",member:l})&&o(w)},className:"grid grid-cols-[1fr_auto] items-center gap-2 border-t border-border bg-muted/10 p-2",children:[(0,e.jsx)(S,{value:l,onChange:o,placeholder:"new member"}),(0,e.jsxs)(m,{type:"submit",disabled:a||l===null,children:[(0,e.jsx)(ee,{})," Add member"]})]}),children:h.length===0?(0,e.jsx)(O,{filtered:d.length>0}):h.map(c=>(0,e.jsxs)("div",{className:"flex min-h-8 items-center gap-2 border-b border-border px-2 py-1",children:[(0,e.jsx)("span",{className:"min-w-0 flex-1",children:(0,e.jsx)(D,{value:c,compact:!0})}),(0,e.jsx)(m,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-destructive",disabled:a,onClick:()=>t({action:"removeSet",member:c}),"aria-label":"Remove set member",children:(0,e.jsx)(_,{})})]},c.base64))})},ls=({member:s,score:r,act:t,pending:a})=>{const[i,n]=K(String(r),String(r)),l=Number(i),o=i!==String(r);return(0,e.jsxs)("div",{className:"grid min-h-8 grid-cols-[1fr_8rem_5rem] items-center gap-2 border-b border-border px-2 py-1",children:[(0,e.jsx)(D,{value:s,compact:!0}),(0,e.jsx)(J,{inputMode:"decimal",value:i,onChange:d=>n(d.target.value),"aria-label":"Sorted set score",className:"font-mono"}),(0,e.jsxs)("div",{className:"flex",children:[(0,e.jsx)(m,{variant:"ghost",size:"icon-sm",className:o?"text-primary":void 0,disabled:a||!o||!Number.isFinite(l),onClick:()=>t({action:"upsertZset",member:s,score:l}),"aria-label":"Save sorted set score",children:(0,e.jsx)(B,{})}),(0,e.jsx)(m,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-destructive",disabled:a,onClick:()=>t({action:"removeZset",member:s}),"aria-label":"Remove sorted set member",children:(0,e.jsx)(_,{})})]})]})},os=({value:s,total:r,act:t,pending:a})=>{const[i,n]=(0,p.useState)(""),l=i.trim().toLowerCase(),o=l?s.entries.filter(d=>$(l,j(d.member),d.score)):s.entries;return(0,e.jsx)(A,{filter:i,onFilterChange:n,shownCount:o.length,loadedCount:s.entries.length,totalCount:r,copyJson:()=>F(s),header:(0,e.jsxs)("div",{className:"grid h-8 grid-cols-[1fr_8rem_5rem] items-center border-b border-border bg-muted/20 px-2 text-[10px] uppercase tracking-wider text-muted-foreground",children:[(0,e.jsx)("span",{children:"Member"}),(0,e.jsx)("span",{children:"Score"}),(0,e.jsx)("span",{})]}),footer:(0,e.jsx)(se,{score:!0,labels:["member","score"],pending:a,onSave:(d,h)=>t({action:"upsertZset",member:d,score:h})}),children:o.length===0?(0,e.jsx)(O,{filtered:l.length>0}):o.map(d=>(0,e.jsx)(ls,{member:d.member,score:d.score,act:t,pending:a},d.member.base64))})},ds=({value:s,total:r,act:t,pending:a,direction:i,onDirectionChange:n})=>{const[l,o]=(0,p.useState)(""),d=l.trim().toLowerCase(),h=d?s.entries.filter(c=>$(d,c.id,...c.fields.flatMap(b=>[j(b.field),j(b.value)]))):s.entries;return(0,e.jsx)(A,{filter:l,onFilterChange:o,shownCount:h.length,loadedCount:s.entries.length,totalCount:r,copyJson:()=>F(s),extra:(0,e.jsxs)(Ke,{type:"single",variant:"ghost",size:"sm",value:i,onValueChange:c=>c&&n(c),"aria-label":"Stream order",className:"shrink-0 rounded-none",children:[(0,e.jsx)(ie,{value:"forward",className:"h-6 rounded-none px-2 text-[10px]",children:"Oldest first"}),(0,e.jsx)(ie,{value:"backward",className:"h-6 rounded-none px-2 text-[10px]",children:"Newest first"})]}),header:(0,e.jsxs)("div",{className:"grid h-8 grid-cols-[10rem_1fr_2rem] items-center border-b border-border bg-muted/20 px-2 text-[10px] uppercase tracking-wider text-muted-foreground",children:[(0,e.jsx)("span",{children:"Entry ID"}),(0,e.jsx)("span",{children:"Fields"}),(0,e.jsx)("span",{})]}),footer:(0,e.jsx)(se,{labels:["field","value"],pending:a,onSave:(c,b)=>t({action:"appendStream",id:"*",fields:[{field:c,value:b}]})}),children:h.length===0?(0,e.jsx)(O,{filtered:d.length>0}):h.map(c=>(0,e.jsxs)("div",{className:"grid grid-cols-[10rem_1fr_2rem] border-b border-border",children:[(0,e.jsx)("code",{className:"border-e border-border px-2 py-1.5 text-xs text-primary",children:c.id}),(0,e.jsx)("div",{className:"grid gap-1 px-2 py-1.5",children:c.fields.map(b=>(0,e.jsxs)("div",{className:"grid grid-cols-[minmax(8rem,0.4fr)_1fr] gap-3",children:[(0,e.jsx)(D,{value:b.field,compact:!0}),(0,e.jsx)(D,{value:b.value,compact:!0})]},b.field.base64))}),(0,e.jsx)(m,{variant:"ghost",size:"icon-sm",className:"rounded-none text-muted-foreground hover:text-destructive",disabled:a,onClick:()=>t({action:"deleteStream",id:c.id}),"aria-label":`Delete stream entry ${c.id}`,children:(0,e.jsx)(_,{})})]},c.id))})},cs=({detail:s,act:r,pending:t,onLoadFull:a,onDownload:i,streamDirection:n,onStreamDirectionChange:l})=>{const o=s.value;switch(o.kind){case"string":return(0,e.jsx)(ss,{value:o.value,truncated:o.truncated,act:r,pending:t,onLoadFull:a,onDownload:i});case"hash":return(0,e.jsx)(ts,{value:o,total:s.length,act:r,pending:t});case"list":return(0,e.jsx)(ns,{value:o,revision:s.revision,total:s.length,act:r,pending:t});case"set":return(0,e.jsx)(is,{value:o,total:s.length,act:r,pending:t});case"zset":return(0,e.jsx)(os,{value:o,total:s.length,act:r,pending:t});case"stream":return(0,e.jsx)(ds,{value:o,total:s.length,act:r,pending:t,direction:n,onDirectionChange:l});default:return(0,e.jsx)(P,{variant:"info",title:"Metadata only",message:"This Redis module type cannot be edited in this release.",className:"rounded-sm"})}},us=s=>{if(s.key.utf8===void 0)return null;const r=JSON.stringify(s.key.utf8);switch(s.type){case"string":return`GET ${r}`;case"hash":return`HGETALL ${r}`;case"list":return`LRANGE ${r} 0 -1`;case"set":return`SMEMBERS ${r}`;case"zset":return`ZRANGE ${r} 0 -1 WITHSCORES`;case"stream":return`XRANGE ${r} - + COUNT 100`;default:return null}},ms=s=>{switch(s.value.kind){case"hash":case"list":case"zset":case"stream":return s.value.entries.length;case"set":return s.value.members.length;default:return null}},hs=()=>{const s=he(),{selectedDatabase:r}=De(),{openOverlay:t}=Re(),{addQuery:a,updateQuery:i}=Ue(),[n,l]=Be("key"),[o,d]=(0,p.useState)(null),[h,c]=(0,p.useState)(null),b=h===n?"backward":"forward",u=He(n,o===n,b),{applyAction:M,deleteKey:G,isPending:C}=qe(),N=u.data?.pages,x=N?.[0],[z,v]=(0,p.useState)(!1),[I,L]=(0,p.useState)(null),T=x?.key.utf8??(x?`binary:${x.key.base64}`:""),E=x?us(x):null,R=(0,p.useMemo)(()=>{if(!x||!N||N.length===1)return x;const f=structuredClone(x);for(const g of N.slice(1))f.value.kind==="hash"&&g.value.kind==="hash"&&f.value.entries.push(...g.value.entries),f.value.kind==="list"&&g.value.kind==="list"&&f.value.entries.push(...g.value.entries),f.value.kind==="set"&&g.value.kind==="set"&&f.value.members.push(...g.value.members),f.value.kind==="zset"&&g.value.kind==="zset"&&f.value.entries.push(...g.value.entries),f.value.kind==="stream"&&g.value.kind==="stream"&&f.value.entries.push(...g.value.entries);return f},[x,N]),U=R?ms(R):null,H=async(f,g=!1)=>{if(!n||!x)return!1;try{const k=await M(n,{expectedRevision:x.revision,force:g,operation:f});return L(null),k.deleted?l(null):(k.key.base64||"-")!==n&&l(k.key.base64||"-"),!0}catch(k){return k.status===409&&L(f),!1}},oe=()=>{if(!E)return;const f=a(`redis: ${T.slice(0,40)}`);i(f,{query:E}),s({to:"/runner/$queryId",params:{queryId:f}})},de=async()=>{if(!n||!x||x.type!=="string")return;const f=[];let g=0,k=!0;for(;k;){const y=(await Ce({db:r??"",key:n,offset:g,expectedRevision:x.revision})).data.data;if(f.push(Ze(y.chunk.base64)),k=y.hasMore,y.hasMore&&(y.nextOffset===null||y.nextOffset<=g))throw new Error("Redis download made no forward progress");g=y.nextOffset??g}const ce=f.reduce((y,ue)=>y+ue.length,0),te=new Uint8Array(ce);let ae=0;for(const y of f)te.set(y,ae),ae+=y.length;const ne=URL.createObjectURL(new Blob([te.buffer])),V=document.createElement("a");V.href=ne,V.download=`${x.key.utf8?.replaceAll(/[^\w.-]+/g,"_")||"redis-value"}.bin`,V.click(),URL.revokeObjectURL(ne)};if(!n)return(0,e.jsx)("main",{className:"flex flex-1 items-center justify-center bg-background font-mono",children:(0,e.jsxs)("div",{className:"max-w-sm text-center",children:[(0,e.jsx)(be,{className:"mx-auto mb-3 size-5 text-muted-foreground"}),(0,e.jsx)("h1",{className:"text-sm font-medium text-foreground",children:"No key selected"}),(0,e.jsx)("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:"Select a key from the navigator or create one to inspect its value."}),(0,e.jsxs)(m,{variant:"outline",className:"mt-3",onClick:()=>t("redis-browser.create-key"),children:[(0,e.jsx)(ee,{})," Create key"]})]})});if(u.isLoading)return(0,e.jsx)("main",{className:"flex flex-1 items-center justify-center",children:(0,e.jsx)(Se,{})});if(u.error||!x||!R)return(0,e.jsx)("main",{className:"flex flex-1 items-center justify-center bg-background p-4",children:(0,e.jsxs)("div",{className:"w-full max-w-md text-center",children:[(0,e.jsx)(P,{variant:"error",title:"Unable to load key",message:u.error?.message??"The key no longer exists.",className:"rounded-sm text-start"}),(0,e.jsx)(m,{variant:"outline",className:"mt-4",onClick:()=>l(null),children:"Back to keyspace"})]})});const re=R.length!==null&&U!==null?Math.max(0,R.length-U):null;return(0,e.jsxs)("main",{className:"flex min-h-0 flex-1 flex-col bg-background font-mono",children:[(0,e.jsx)(es,{detail:x,label:T,loadedCount:U,fetchedAt:u.dataUpdatedAt,isFetching:u.isFetching,pending:C,command:E,act:H,onRefresh:()=>u.refetch(),onOpenRunner:oe,onDelete:()=>v(!0)},x.key.base64),(0,e.jsx)(Oe,{open:z,onOpenChange:v,children:(0,e.jsxs)($e,{children:[(0,e.jsxs)(Te,{children:[(0,e.jsx)(Ae,{children:"Delete key"}),(0,e.jsxs)(Pe,{children:["Are you sure you want to delete"," ",(0,e.jsx)("code",{className:"break-all text-foreground",children:T||"(empty key)"}),"? This action cannot be undone."]})]}),(0,e.jsxs)(Le,{children:[(0,e.jsx)(Me,{children:"Cancel"}),(0,e.jsx)(ze,{variant:"destructive",onClick:async()=>{v(!1);try{await G(n,x.revision),l(null)}catch{}},children:"Delete"})]})]})}),I&&(0,e.jsxs)("div",{className:"grid gap-2 border-b border-border p-2 sm:grid-cols-[1fr_auto] sm:items-center",children:[(0,e.jsx)(P,{variant:"warning",title:"Revision conflict",message:"This key changed on the server. Reload it or overwrite with the pending change.",className:"rounded-sm py-2"}),(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsx)(m,{variant:"outline",onClick:()=>{L(null),u.refetch()},children:"Reload"}),(0,e.jsx)(m,{disabled:C,onClick:()=>H(I,!0),children:"Overwrite"})]})]}),(0,e.jsx)("div",{className:"min-h-0 flex-1 overflow-auto",children:(0,e.jsxs)("section",{className:"p-3",children:[(0,e.jsx)(cs,{detail:R,act:H,pending:C,onLoadFull:()=>d(n),onDownload:()=>{we.promise(de(),{loading:"Downloading original Redis bytes…",success:"Redis value downloaded",error:f=>f.message||"Download failed"})},streamDirection:b,onStreamDirectionChange:f=>c(f==="backward"?n:null)},x.key.base64),u.hasNextPage&&(0,e.jsx)(m,{variant:"outline",className:"mt-3 w-full",onClick:()=>u.fetchNextPage(),disabled:u.isFetchingNextPage,children:u.isFetchingNextPage?"Loading…":x.type==="stream"&&b==="backward"?"Load 100 older entries":`Load next 100${re!==null?` (${re.toLocaleString()} remaining)`:""}`})]})})]})},Ds=hs;export{Ds as component};