planche 0.9.2 → 0.9.3

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 (69) hide show
  1. package/app/assets/92hmrkfN.css +2 -0
  2. package/app/assets/{G06qjCej.js → B3qo2BmL.js} +1 -1
  3. package/app/assets/{B4S-lOKS.js → B4e4BJ-q.js} +1 -1
  4. package/app/assets/{DF7EZh_S.js → B8kALM_o.js} +1 -1
  5. package/app/assets/BEY3Hwp0.js +1 -0
  6. package/app/assets/{D0Ya12SQ.js → BFUEHSdO.js} +1 -1
  7. package/app/assets/{Do7KpDxk.js → BFddfnRD.js} +1 -1
  8. package/app/assets/{C1kpKIsO.js → BFxd4DZC.js} +1 -1
  9. package/app/assets/{qRIRkBN0.js → BLF41w4B.js} +1 -1
  10. package/app/assets/{CrhJJH3f.js → BNB2k8On.js} +1 -1
  11. package/app/assets/{BjwrN_ch.js → BPLdNS4h.js} +1 -1
  12. package/app/assets/{CFu5QMhX.js → BTpuv2bS.js} +1 -1
  13. package/app/assets/{7jG9Xw-H.js → BXogLn0j.js} +1 -1
  14. package/app/assets/{CExE8dKz.js → B_zu4Zim.js} +184 -183
  15. package/app/assets/{tJkeLYCp.js → BanAYgsJ.js} +1 -1
  16. package/app/assets/{BkXrfAoR.js → BghfQrAj.js} +1 -1
  17. package/app/assets/{DaBfnZOJ.js → Bjupmf7v.js} +1 -1
  18. package/app/assets/{7jD5h8Yx.js → BkujllIu.js} +1 -1
  19. package/app/assets/{BixvbqFe.js → BmnRSOWE.js} +1 -1
  20. package/app/assets/{BhX9zWzC.js → Bsl10NAd.js} +1 -1
  21. package/app/assets/{BNB62Dfu.js → Bx57-46U.js} +1 -1
  22. package/app/assets/{DHZOxCSJ.js → C3skRSMN.js} +1 -1
  23. package/app/assets/{CrlnxAGW.js → C63wLpkg.js} +1 -1
  24. package/app/assets/{BDtsGuIR.js → C9jzAIEJ.js} +2 -2
  25. package/app/assets/{S7HbowYz.js → CAd2f6EE.js} +70 -70
  26. package/app/assets/{Djxg54qH.js → CCBiFHWk.js} +1 -1
  27. package/app/assets/{Bbx7_Uyd.js → CCHDqJU3.js} +1 -1
  28. package/app/assets/{CaU3pCK6.js → CHn2dkeR.js} +1 -1
  29. package/app/assets/{84VwJAQi.js → CMFMZu0I.js} +1 -1
  30. package/app/assets/{DzdX4vRD.js → CSE_C1ca.js} +1 -1
  31. package/app/assets/{B9dhM8vw.js → CSjIZAje.js} +1 -1
  32. package/app/assets/{CHx7zgT8.js → CYqQEBj7.js} +1 -1
  33. package/app/assets/{BRZhVXRC.js → Ci1xBOLy.js} +1 -1
  34. package/app/assets/{BTaXXwBP.js → ClHvsi-E.js} +1 -1
  35. package/app/assets/{CTnwm-29.js → CtvJotUV.js} +1 -1
  36. package/app/assets/{D3lUezEb.js → Cv7B7xE1.js} +1 -1
  37. package/app/assets/{DNHPk-9r.js → Cw4TnfXm.js} +1 -1
  38. package/app/assets/{C6712dxU.js → D2dO-cBr.js} +1 -1
  39. package/app/assets/{BMFLhX-x.js → D4aakMZ1.js} +1 -1
  40. package/app/assets/{C1gqjEN3.js → D6SRSRpo.js} +1 -1
  41. package/app/assets/{BSziALTN.js → DBwwgHNb.js} +1 -1
  42. package/app/assets/{W7D4Svcn.js → DMmbl7oU.js} +1 -1
  43. package/app/assets/{BMBWoD5w.js → DP7G83e7.js} +1 -1
  44. package/app/assets/{aIFwnVFr.js → DPKD37gk.js} +1 -1
  45. package/app/assets/{DTkqO0Em.js → DdGvqbC0.js} +1 -1
  46. package/app/assets/{kXDKfUfE.js → DjsycSVl.js} +1 -1
  47. package/app/assets/{D1kyupCL.js → Dl3kZgxg.js} +1 -1
  48. package/app/assets/{BEH9Jqkv.js → DmDLn1hv.js} +1 -1
  49. package/app/assets/{BnJGrP6V.js → DpPKm22O.js} +2 -2
  50. package/app/assets/{BrVnzO7b.js → DpcElnaI.js} +1 -1
  51. package/app/assets/{B7zF7RU4.js → DtUkSj2L.js} +1 -1
  52. package/app/assets/{ByKF67UY.js → DyPVTkGX.js} +1 -1
  53. package/app/assets/{BbOETtQZ.js → Ec3vNInq.js} +1 -1
  54. package/app/assets/{BQ1Rcyw6.js → TqO-pPrr.js} +1 -1
  55. package/app/assets/{DpEN2jyA.js → Uf0CXpNG.js} +1 -1
  56. package/app/assets/{BPmMKRmE.js → X0frSBI-.js} +1 -1
  57. package/app/assets/{DCHRj2vY.js → Xya13jwA.js} +1 -1
  58. package/app/assets/{CoZCOAph.js → _lYVFvcB.js} +1 -1
  59. package/app/assets/{CFUkTo-F.js → aBt7vbXN.js} +1 -1
  60. package/app/assets/{CRnmOOqq.js → baQnXYR8.js} +1 -1
  61. package/app/assets/{C77ZEZfM.js → cFpo8ItN.js} +1 -1
  62. package/app/assets/{DPyLA6Dl.js → mA16m5gB.js} +1 -1
  63. package/app/assets/{BGvsBpIS.js → mHq6YiMc.js} +1 -1
  64. package/app/assets/{D9QeXBOk.js → rSe5GrVH.js} +1 -1
  65. package/app/assets/{BPPUDpI0.js → uCGINy9d.js} +1 -1
  66. package/app/index.html +12 -12
  67. package/package.json +1 -1
  68. package/app/assets/9gOj-Ty3.js +0 -1
  69. package/app/assets/w46wk7KI.css +0 -2
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{i as n,r}from"./Cu_sGzNJ.js";import{t as i}from"./84VwJAQi.js";import{a,n as o,o as s,r as c,t as l}from"./Udlj1Cgf.js";import{t as u}from"./BQ1Rcyw6.js";var d=e(t(),1),f=r();function p({title:e,rows:t}){return(0,f.jsxs)(`div`,{className:`rounded-lg border bg-card p-3`,children:[(0,f.jsx)(`h3`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:e}),(0,f.jsx)(`dl`,{className:`grid grid-cols-[max-content_1fr] gap-x-4 gap-y-1 text-xs`,children:t.map(([e,t])=>(0,f.jsxs)(`div`,{className:`contents`,children:[(0,f.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,f.jsx)(`dd`,{className:`font-mono`,children:t??`—`})]},e))})]})}function m({connectionId:e,tabId:t}){let{t:r}=n(),m=i(e,t,``),[h,g]=(0,d.useState)(null),[_,v]=(0,d.useState)(null),[y,b]=(0,d.useState)(``),x=(0,d.useCallback)(async()=>{try{g(a(String(await m.read(`INFO`)))),v(null)}catch(e){v(e instanceof Error?e.message:String(e))}},[m]);(0,d.useEffect)(()=>{Promise.resolve().then(()=>x())},[x]);let S=e=>h?c(h,e):void 0,C=h?o(h):null,w=(0,d.useMemo)(()=>Object.entries(h?.keyspace??{}).map(([e,t])=>({db:e,...s(t)})),[h]),T=(0,d.useMemo)(()=>Object.entries(h??{}).flatMap(([e,t])=>Object.entries(t).map(([t,n])=>[e,t,n])).filter(([,e,t])=>!y||e.includes(y)||t.includes(y)),[h,y]);return(0,f.jsx)(u,{title:r(`tools.redis.server`),onRefresh:x,autoRefresh:!0,error:_,onDismissError:()=>v(null),children:h&&(0,f.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,f.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(260px,1fr))] gap-3`,children:[(0,f.jsx)(p,{title:r(`tools.redis.cardServer`),rows:[[`version`,S(`redis_version`)??S(`valkey_version`)],[`mode`,S(`redis_mode`)],[`uptime`,S(`uptime_in_seconds`)?l(Number(S(`uptime_in_seconds`))):void 0],[`os`,S(`os`)]]}),(0,f.jsx)(p,{title:r(`tools.redis.cardMemory`),rows:[[`used`,S(`used_memory_human`)],[`peak`,S(`used_memory_peak_human`)],[`maxmemory`,S(`maxmemory_human`)===`0B`?r(`tools.redis.unlimited`):S(`maxmemory_human`)],[`policy`,S(`maxmemory_policy`)],[`fragmentation`,S(`mem_fragmentation_ratio`)]]}),(0,f.jsx)(p,{title:r(`tools.redis.cardActivity`),rows:[[`ops/sec`,S(`instantaneous_ops_per_sec`)],[`hit rate`,C===null?void 0:`${(C*100).toFixed(1)}%`],[`clients`,S(`connected_clients`)],[`blocked`,S(`blocked_clients`)],[`evicted keys`,S(`evicted_keys`)],[`expired keys`,S(`expired_keys`)]]}),(0,f.jsx)(p,{title:r(`tools.redis.cardPersistence`),rows:[[`role`,S(`role`)],[`replicas`,S(`connected_slaves`)],[`last save`,S(`rdb_last_save_time`)?new Date(Number(S(`rdb_last_save_time`))*1e3).toLocaleString():void 0],[`changes since save`,S(`rdb_changes_since_last_save`)],[`AOF`,S(`aof_enabled`)===`1`?`on`:S(`aof_enabled`)===`0`?`off`:void 0]]})]}),(0,f.jsxs)(`section`,{children:[(0,f.jsx)(`h3`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:r(`tools.redis.keyspace`)}),(0,f.jsxs)(`table`,{className:`w-full max-w-2xl border-collapse text-xs`,children:[(0,f.jsx)(`thead`,{children:(0,f.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,f.jsx)(`th`,{className:`border-b py-1`,children:`db`}),(0,f.jsx)(`th`,{className:`border-b py-1 text-right`,children:`keys`}),(0,f.jsx)(`th`,{className:`border-b py-1 text-right`,children:`expires`}),(0,f.jsx)(`th`,{className:`border-b py-1 text-right`,children:`avg ttl`})]})}),(0,f.jsx)(`tbody`,{children:w.map(e=>(0,f.jsxs)(`tr`,{className:`border-b border-border/50`,children:[(0,f.jsx)(`td`,{className:`py-1 font-mono`,children:e.db}),(0,f.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:e.keys.toLocaleString()}),(0,f.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:e.expires.toLocaleString()}),(0,f.jsx)(`td`,{className:`py-1 text-right`,children:e.avgTtl?l(e.avgTtl/1e3):`—`})]},e.db))})]})]}),(0,f.jsxs)(`section`,{children:[(0,f.jsxs)(`div`,{className:`mb-2 flex items-center gap-3`,children:[(0,f.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:r(`tools.redis.allFields`)}),(0,f.jsx)(`input`,{className:`h-7 w-56 rounded border bg-background px-2 text-xs`,placeholder:r(`tools.filter`),value:y,onChange:e=>b(e.target.value)})]}),(0,f.jsx)(`table`,{className:`w-full border-collapse text-xs`,children:(0,f.jsx)(`tbody`,{children:T.map(([e,t,n])=>(0,f.jsxs)(`tr`,{className:`border-b border-border/40`,children:[(0,f.jsx)(`td`,{className:`w-28 py-0.5 text-muted-foreground`,children:e}),(0,f.jsx)(`td`,{className:`w-72 py-0.5 font-mono`,children:t}),(0,f.jsx)(`td`,{className:`break-all py-0.5 font-mono`,children:n})]},`${e}.${t}`))})})]})]})})}export{m as ServerInfo};
1
+ import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{i as n,r}from"./Cu_sGzNJ.js";import{t as i}from"./CMFMZu0I.js";import{a,n as o,o as s,r as c,t as l}from"./Udlj1Cgf.js";import{t as u}from"./TqO-pPrr.js";var d=e(t(),1),f=r();function p({title:e,rows:t}){return(0,f.jsxs)(`div`,{className:`rounded-lg border bg-card p-3`,children:[(0,f.jsx)(`h3`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:e}),(0,f.jsx)(`dl`,{className:`grid grid-cols-[max-content_1fr] gap-x-4 gap-y-1 text-xs`,children:t.map(([e,t])=>(0,f.jsxs)(`div`,{className:`contents`,children:[(0,f.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,f.jsx)(`dd`,{className:`font-mono`,children:t??`—`})]},e))})]})}function m({connectionId:e,tabId:t}){let{t:r}=n(),m=i(e,t,``),[h,g]=(0,d.useState)(null),[_,v]=(0,d.useState)(null),[y,b]=(0,d.useState)(``),x=(0,d.useCallback)(async()=>{try{g(a(String(await m.read(`INFO`)))),v(null)}catch(e){v(e instanceof Error?e.message:String(e))}},[m]);(0,d.useEffect)(()=>{Promise.resolve().then(()=>x())},[x]);let S=e=>h?c(h,e):void 0,C=h?o(h):null,w=(0,d.useMemo)(()=>Object.entries(h?.keyspace??{}).map(([e,t])=>({db:e,...s(t)})),[h]),T=(0,d.useMemo)(()=>Object.entries(h??{}).flatMap(([e,t])=>Object.entries(t).map(([t,n])=>[e,t,n])).filter(([,e,t])=>!y||e.includes(y)||t.includes(y)),[h,y]);return(0,f.jsx)(u,{title:r(`tools.redis.server`),onRefresh:x,autoRefresh:!0,error:_,onDismissError:()=>v(null),children:h&&(0,f.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,f.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(260px,1fr))] gap-3`,children:[(0,f.jsx)(p,{title:r(`tools.redis.cardServer`),rows:[[`version`,S(`redis_version`)??S(`valkey_version`)],[`mode`,S(`redis_mode`)],[`uptime`,S(`uptime_in_seconds`)?l(Number(S(`uptime_in_seconds`))):void 0],[`os`,S(`os`)]]}),(0,f.jsx)(p,{title:r(`tools.redis.cardMemory`),rows:[[`used`,S(`used_memory_human`)],[`peak`,S(`used_memory_peak_human`)],[`maxmemory`,S(`maxmemory_human`)===`0B`?r(`tools.redis.unlimited`):S(`maxmemory_human`)],[`policy`,S(`maxmemory_policy`)],[`fragmentation`,S(`mem_fragmentation_ratio`)]]}),(0,f.jsx)(p,{title:r(`tools.redis.cardActivity`),rows:[[`ops/sec`,S(`instantaneous_ops_per_sec`)],[`hit rate`,C===null?void 0:`${(C*100).toFixed(1)}%`],[`clients`,S(`connected_clients`)],[`blocked`,S(`blocked_clients`)],[`evicted keys`,S(`evicted_keys`)],[`expired keys`,S(`expired_keys`)]]}),(0,f.jsx)(p,{title:r(`tools.redis.cardPersistence`),rows:[[`role`,S(`role`)],[`replicas`,S(`connected_slaves`)],[`last save`,S(`rdb_last_save_time`)?new Date(Number(S(`rdb_last_save_time`))*1e3).toLocaleString():void 0],[`changes since save`,S(`rdb_changes_since_last_save`)],[`AOF`,S(`aof_enabled`)===`1`?`on`:S(`aof_enabled`)===`0`?`off`:void 0]]})]}),(0,f.jsxs)(`section`,{children:[(0,f.jsx)(`h3`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:r(`tools.redis.keyspace`)}),(0,f.jsxs)(`table`,{className:`w-full max-w-2xl border-collapse text-xs`,children:[(0,f.jsx)(`thead`,{children:(0,f.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,f.jsx)(`th`,{className:`border-b py-1`,children:`db`}),(0,f.jsx)(`th`,{className:`border-b py-1 text-right`,children:`keys`}),(0,f.jsx)(`th`,{className:`border-b py-1 text-right`,children:`expires`}),(0,f.jsx)(`th`,{className:`border-b py-1 text-right`,children:`avg ttl`})]})}),(0,f.jsx)(`tbody`,{children:w.map(e=>(0,f.jsxs)(`tr`,{className:`border-b border-border/50`,children:[(0,f.jsx)(`td`,{className:`py-1 font-mono`,children:e.db}),(0,f.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:e.keys.toLocaleString()}),(0,f.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:e.expires.toLocaleString()}),(0,f.jsx)(`td`,{className:`py-1 text-right`,children:e.avgTtl?l(e.avgTtl/1e3):`—`})]},e.db))})]})]}),(0,f.jsxs)(`section`,{children:[(0,f.jsxs)(`div`,{className:`mb-2 flex items-center gap-3`,children:[(0,f.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:r(`tools.redis.allFields`)}),(0,f.jsx)(`input`,{className:`h-7 w-56 rounded border bg-background px-2 text-xs`,placeholder:r(`tools.filter`),value:y,onChange:e=>b(e.target.value)})]}),(0,f.jsx)(`table`,{className:`w-full border-collapse text-xs`,children:(0,f.jsx)(`tbody`,{children:T.map(([e,t,n])=>(0,f.jsxs)(`tr`,{className:`border-b border-border/40`,children:[(0,f.jsx)(`td`,{className:`w-28 py-0.5 text-muted-foreground`,children:e}),(0,f.jsx)(`td`,{className:`w-72 py-0.5 font-mono`,children:t}),(0,f.jsx)(`td`,{className:`break-all py-0.5 font-mono`,children:n})]},`${e}.${t}`))})})]})]})})}export{m as ServerInfo};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./hePW80VL.js";import{o as t,p as n}from"./CYz610vE.js";import{t as r}from"./CiL8zoYm.js";import{i,r as a}from"./Cu_sGzNJ.js";import{a as o,i as s,n as c,o as l,t as u}from"./DzRyVlxz.js";import{a as d,i as f,n as p,r as m,t as h}from"./G06qjCej.js";import{t as g}from"./S7HbowYz.js";import{n as _,t as ee}from"./D8_hwGjG.js";import{a as v}from"./BkXrfAoR.js";import{r as y}from"./BRZhVXRC.js";import{t as te}from"./9gOj-Ty3.js";import{t as b}from"./Bs5VSn0X.js";import{c as x,dt as S,pt as ne}from"./CExE8dKz.js";var C=e(n(),1),w=[`VIEW`,`PROCEDURE`,`FUNCTION`,`TRIGGER`,`EVENT`];function T(e,t){return e.replace(/\bDEFINER\s*=\s*(?:`[^`]*`|'[^']*'|"[^"]*"|\w+)@(?:`[^`]*`|'[^']*'|"[^"]*"|[\w.%-]+)/gi,``).replace(/\bSQL SECURITY (?:DEFINER|INVOKER)\b/gi,``).replace(/\bALGORITHM\s*=\s*\w+/gi,``).replace(RegExp(`[\`"\\[]?${t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}[\`"\\]]?\\.`,`gi`),``).replace(/\s+/g,` `).replace(/;\s*$/,``).trim()}function E(e,t){let n=[];for(let r of w){let i=e.objects?.get(r),a=t.objects?.get(r);if(!i&&!a)continue;let o=[...new Set([...i?.keys()??[],...a?.keys()??[]])].sort();for(let s of o){let o=i?.get(s)??null,c=a?.get(s)??null,l;l=o?c?o.sql!==null&&c.sql!==null&&T(o.sql,e.database)===T(c.sql,t.database)?`identical`:`changed`:`missingInTarget`:`missingInSource`,n.push({type:r,name:s,status:l,source:o,target:c})}}return n}var D=e=>e.toLowerCase().replace(/\s+/g,` `).trim(),O=e=>e===null?null:e.trim().replace(/^'(.*)'(?:::\w+)?$/s,`$1`),k=e=>e.addedColumns.length+e.removedColumns.length+e.changedColumns.length+e.addedIndexes.length+e.removedIndexes.length+e.changedIndexes.length>0;function A(e,t){let n=[];return D(e.type)!==D(t.type)&&n.push(`type`),e.nullable!==t.nullable&&n.push(`nullable`),O(e.defaultValue)!==O(t.defaultValue)&&n.push(`default`),e.extra.toLowerCase()!==t.extra.toLowerCase()&&n.push(`extra`),n}var j=(e,t)=>e.type===t.type&&e.columns.length===t.columns.length&&e.columns.every((e,n)=>e===t.columns[n]);function M(e,t,n){let r=t.columns.get(e)??[],i=n.columns.get(e)??[],a=new Map(i.map(e=>[e.name,e])),o=new Map(r.map(e=>[e.name,e])),s={table:e,addedColumns:r.filter(e=>!a.has(e.name)),removedColumns:i.filter(e=>!o.has(e.name)),changedColumns:[],addedIndexes:[],removedIndexes:[],changedIndexes:[]};for(let e of r){let t=a.get(e.name);if(!t)continue;let n=A(e,t);n.length>0&&s.changedColumns.push({name:e.name,source:e,target:t,attributes:n})}let c=t.indexes.get(e)??[],l=n.indexes.get(e)??[],u=new Map(l.map(e=>[e.name,e])),d=new Map(c.map(e=>[e.name,e]));s.addedIndexes=c.filter(e=>!u.has(e.name)),s.removedIndexes=l.filter(e=>!d.has(e.name));for(let e of c){let t=u.get(e.name);t&&!j(e,t)&&s.changedIndexes.push({name:e.name,source:e,target:t})}return s}function N(e,t){let n=new Set(t.tables),r=new Set(e.tables),i={missingInTarget:[],missingInSource:[],changed:[],identical:[],objects:E(e,t)};for(let r of e.tables){if(!n.has(r)){i.missingInTarget.push(r);continue}let a=M(r,e,t);k(a)?i.changed.push(a):i.identical.push(r)}return i.missingInSource=t.tables.filter(e=>!r.has(e)),i}var P=e=>e.split(`
1
+ import{r as e}from"./hePW80VL.js";import{o as t,p as n}from"./CYz610vE.js";import{t as r}from"./CiL8zoYm.js";import{i,r as a}from"./Cu_sGzNJ.js";import{a as o,i as s,n as c,o as l,t as u}from"./DzRyVlxz.js";import{a as d,i as f,n as p,r as m,t as h}from"./B3qo2BmL.js";import{t as g}from"./CAd2f6EE.js";import{n as _,t as ee}from"./D8_hwGjG.js";import{a as v}from"./BghfQrAj.js";import{r as y}from"./Ci1xBOLy.js";import{t as te}from"./BEY3Hwp0.js";import{t as b}from"./Bs5VSn0X.js";import{c as x,dt as S,pt as ne}from"./B_zu4Zim.js";var C=e(n(),1),w=[`VIEW`,`PROCEDURE`,`FUNCTION`,`TRIGGER`,`EVENT`];function T(e,t){return e.replace(/\bDEFINER\s*=\s*(?:`[^`]*`|'[^']*'|"[^"]*"|\w+)@(?:`[^`]*`|'[^']*'|"[^"]*"|[\w.%-]+)/gi,``).replace(/\bSQL SECURITY (?:DEFINER|INVOKER)\b/gi,``).replace(/\bALGORITHM\s*=\s*\w+/gi,``).replace(RegExp(`[\`"\\[]?${t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}[\`"\\]]?\\.`,`gi`),``).replace(/\s+/g,` `).replace(/;\s*$/,``).trim()}function E(e,t){let n=[];for(let r of w){let i=e.objects?.get(r),a=t.objects?.get(r);if(!i&&!a)continue;let o=[...new Set([...i?.keys()??[],...a?.keys()??[]])].sort();for(let s of o){let o=i?.get(s)??null,c=a?.get(s)??null,l;l=o?c?o.sql!==null&&c.sql!==null&&T(o.sql,e.database)===T(c.sql,t.database)?`identical`:`changed`:`missingInTarget`:`missingInSource`,n.push({type:r,name:s,status:l,source:o,target:c})}}return n}var D=e=>e.toLowerCase().replace(/\s+/g,` `).trim(),O=e=>e===null?null:e.trim().replace(/^'(.*)'(?:::\w+)?$/s,`$1`),k=e=>e.addedColumns.length+e.removedColumns.length+e.changedColumns.length+e.addedIndexes.length+e.removedIndexes.length+e.changedIndexes.length>0;function A(e,t){let n=[];return D(e.type)!==D(t.type)&&n.push(`type`),e.nullable!==t.nullable&&n.push(`nullable`),O(e.defaultValue)!==O(t.defaultValue)&&n.push(`default`),e.extra.toLowerCase()!==t.extra.toLowerCase()&&n.push(`extra`),n}var j=(e,t)=>e.type===t.type&&e.columns.length===t.columns.length&&e.columns.every((e,n)=>e===t.columns[n]);function M(e,t,n){let r=t.columns.get(e)??[],i=n.columns.get(e)??[],a=new Map(i.map(e=>[e.name,e])),o=new Map(r.map(e=>[e.name,e])),s={table:e,addedColumns:r.filter(e=>!a.has(e.name)),removedColumns:i.filter(e=>!o.has(e.name)),changedColumns:[],addedIndexes:[],removedIndexes:[],changedIndexes:[]};for(let e of r){let t=a.get(e.name);if(!t)continue;let n=A(e,t);n.length>0&&s.changedColumns.push({name:e.name,source:e,target:t,attributes:n})}let c=t.indexes.get(e)??[],l=n.indexes.get(e)??[],u=new Map(l.map(e=>[e.name,e])),d=new Map(c.map(e=>[e.name,e]));s.addedIndexes=c.filter(e=>!u.has(e.name)),s.removedIndexes=l.filter(e=>!d.has(e.name));for(let e of c){let t=u.get(e.name);t&&!j(e,t)&&s.changedIndexes.push({name:e.name,source:e,target:t})}return s}function N(e,t){let n=new Set(t.tables),r=new Set(e.tables),i={missingInTarget:[],missingInSource:[],changed:[],identical:[],objects:E(e,t)};for(let r of e.tables){if(!n.has(r)){i.missingInTarget.push(r);continue}let a=M(r,e,t);k(a)?i.changed.push(a):i.identical.push(r)}return i.missingInSource=t.tables.filter(e=>!r.has(e)),i}var P=e=>e.split(`
2
2
  `).map(e=>`-- ${e}`).join(`
3
3
  `);function F(e,t,n,r,i={}){let a=n.ddl,o=r.database,s=e=>i.includeDrops?e:P(e),c=[`-- Schema sync: ${t.database} -> ${o} (${n.label})`,`-- Review before running. Statements that drop data are commented out unless "Include DROP statements" was checked.`,``];for(let r of e.missingInTarget)c.push(`-- Table ${r} is missing in the target`),c.push(I(r,t,n,o)),c.push(``);for(let t of e.changed){c.push(`-- Table ${t.table}`);for(let e of t.removedIndexes)c.push(s(a.dropIndex(o,t.table,e.name)));for(let e of t.changedIndexes)c.push(s(a.dropIndex(o,t.table,e.name)));for(let e of t.addedColumns)c.push(a.addColumn(o,t.table,e));for(let e of t.changedColumns){let r=a.alterColumn(o,t.table,e.source);c.push(r??P(`${n.label} cannot alter column ${e.name} in place (${e.attributes.join(`, `)}): recreate the table`))}for(let e of t.removedColumns)c.push(s(a.dropColumn(o,t.table,e.name)));for(let e of t.addedIndexes)c.push(a.createIndex(o,t.table,e));for(let e of t.changedIndexes)c.push(a.createIndex(o,t.table,e.source));c.push(``)}for(let t of e.missingInSource)c.push(`-- Table ${t} exists only in the target`),c.push(s(`DROP TABLE ${n.qualify(o,t)};`)),c.push(``);for(let t of e.objects){if(t.status===`identical`)continue;let e=`${t.type.charAt(0)}${t.type.slice(1).toLowerCase()} ${t.name}`,r=R(n,o,t);t.status===`missingInSource`?(c.push(`-- ${e} exists only in the target`),c.push(s(r))):(c.push(t.status===`changed`?`-- ${e} differs; recreated from the source`:`-- ${e} is missing in the target`),t.status===`changed`&&c.push(s(r)),c.push(t.source?.sql?z(t.source.sql):P(`the source engine did not return a CREATE statement for ${e}`))),c.push(``)}return c.join(`
4
4
  `).replace(/\n{3,}/g,`
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{i as n,r,t as i}from"./Cu_sGzNJ.js";import{Mt as a}from"./CExE8dKz.js";var o=e(t(),1),s=r(),c=5;function l({title:e,onRefresh:t,autoRefresh:r,actions:l,error:u,onDismissError:d,children:f}){let{t:p}=n(),[m,h]=(0,o.useState)(!1),[g,_]=(0,o.useState)(!1),v=(0,o.useRef)(t);(0,o.useEffect)(()=>{v.current=t},[t]),(0,o.useEffect)(()=>{if(!m)return;let e=setInterval(()=>{v.current()},c*1e3);return()=>clearInterval(e)},[m]);let y=async()=>{_(!0);try{await t()}finally{_(!1)}};return(0,s.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,s.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center gap-2 border-b bg-muted/30 px-3 py-1.5 text-xs`,children:[(0,s.jsx)(`span`,{className:`text-sm font-medium`,children:e}),(0,s.jsx)(`div`,{className:`flex-1`}),l,r&&(0,s.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5 text-muted-foreground`,children:[(0,s.jsx)(`input`,{type:`checkbox`,checked:m,onChange:e=>h(e.target.checked),className:`accent-primary`}),p(`tools.autoRefresh`,{seconds:c})]}),(0,s.jsxs)(`button`,{type:`button`,disabled:g,onClick:()=>void y(),className:`flex h-7 items-center gap-1 rounded border bg-background px-2 text-muted-foreground hover:text-foreground disabled:opacity-40`,children:[(0,s.jsx)(a,{className:`size-3 ${g?`animate-spin`:``}`}),p(`keyViewer.refresh`)]})]}),u&&(0,s.jsxs)(`div`,{className:`flex flex-shrink-0 items-start gap-2 border-b border-destructive/30 bg-destructive/10 px-3 py-1.5 text-xs text-destructive`,children:[(0,s.jsx)(`span`,{className:`flex-1 whitespace-pre-wrap`,children:u}),(0,s.jsx)(`button`,{type:`button`,onClick:d,children:(0,s.jsx)(i,{className:`size-3.5`})})]}),(0,s.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:f})]})}export{l as t};
1
+ import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{i as n,r,t as i}from"./Cu_sGzNJ.js";import{Mt as a}from"./B_zu4Zim.js";var o=e(t(),1),s=r(),c=5;function l({title:e,onRefresh:t,autoRefresh:r,actions:l,error:u,onDismissError:d,children:f}){let{t:p}=n(),[m,h]=(0,o.useState)(!1),[g,_]=(0,o.useState)(!1),v=(0,o.useRef)(t);(0,o.useEffect)(()=>{v.current=t},[t]),(0,o.useEffect)(()=>{if(!m)return;let e=setInterval(()=>{v.current()},c*1e3);return()=>clearInterval(e)},[m]);let y=async()=>{_(!0);try{await t()}finally{_(!1)}};return(0,s.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,s.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center gap-2 border-b bg-muted/30 px-3 py-1.5 text-xs`,children:[(0,s.jsx)(`span`,{className:`text-sm font-medium`,children:e}),(0,s.jsx)(`div`,{className:`flex-1`}),l,r&&(0,s.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5 text-muted-foreground`,children:[(0,s.jsx)(`input`,{type:`checkbox`,checked:m,onChange:e=>h(e.target.checked),className:`accent-primary`}),p(`tools.autoRefresh`,{seconds:c})]}),(0,s.jsxs)(`button`,{type:`button`,disabled:g,onClick:()=>void y(),className:`flex h-7 items-center gap-1 rounded border bg-background px-2 text-muted-foreground hover:text-foreground disabled:opacity-40`,children:[(0,s.jsx)(a,{className:`size-3 ${g?`animate-spin`:``}`}),p(`keyViewer.refresh`)]})]}),u&&(0,s.jsxs)(`div`,{className:`flex flex-shrink-0 items-start gap-2 border-b border-destructive/30 bg-destructive/10 px-3 py-1.5 text-xs text-destructive`,children:[(0,s.jsx)(`span`,{className:`flex-1 whitespace-pre-wrap`,children:u}),(0,s.jsx)(`button`,{type:`button`,onClick:d,children:(0,s.jsx)(i,{className:`size-3.5`})})]}),(0,s.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:f})]})}export{l as t};
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{o as t,p as n}from"./CYz610vE.js";import{a as r,i,l as a}from"./CiL8zoYm.js";import{r as o,t as s}from"./BDtsGuIR.js";import{i as c,n as l,r as u}from"./Cu_sGzNJ.js";import{C as d,a as f,d as p,f as m,l as h,n as g,o as _,r as v,s as y,t as b}from"./DzRyVlxz.js";import{t as x}from"./S7HbowYz.js";import{n as S,r as C}from"./DU-Eln5x.js";import{n as w}from"./D8_hwGjG.js";import{n as T,t as E}from"./C1gqjEN3.js";import{n as ee,t as D}from"./BkXrfAoR.js";import{i as O,t as k}from"./BnJGrP6V.js";import{$t as te,Dt as A,Et as j,H as M,It as N,Lt as ne,Mt as P,Nt as F,Ot as I,Pt as re,Q as ie,St as ae,Tt as oe,Ut as se,Vt as ce,W as le,Wt as ue,Yt as de,Z as fe,bt as pe,ht as me,it as he,jt as ge,kt as _e,nt as ve,rt as ye,tt as be,xt as xe,yt as Se,z as Ce,zt as we}from"./CExE8dKz.js";var Te=l(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),Ee=l(`copy-plus`,[[`line`,{x1:`15`,x2:`15`,y1:`12`,y2:`18`,key:`1p7wdc`}],[`line`,{x1:`12`,x2:`18`,y1:`15`,y2:`15`,key:`1nscbv`}],[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),De=l(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),Oe=l(`database-zap`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 15 21.84`,key:`14ibmq`}],[`path`,{d:`M21 5V8`,key:`1marbg`}],[`path`,{d:`M21 12L18 17H22L19 22`,key:`zafso`}],[`path`,{d:`M3 12A9 3 0 0 0 14.59 14.87`,key:`1y4wr8`}]]),ke=l(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),Ae=l(`file-spreadsheet`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]),je=l(`git-compare`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`path`,{d:`M11 18H8a2 2 0 0 1-2-2V9`,key:`19pyzm`}]]),Me=l(`git-compare-arrows`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`M12 18H7a2 2 0 0 1-2-2V9`,key:`16sdep`}],[`path`,{d:`m9 15 3 3-3 3`,key:`1m3kbl`}]]),Ne=l(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),Pe=l(`languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),Fe=l(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),Ie=l(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]),Le=l(`replace`,[[`path`,{d:`M14 4a1 1 0 0 1 1-1`,key:`dhj8ez`}],[`path`,{d:`M15 10a1 1 0 0 1-1-1`,key:`1mnyi5`}],[`path`,{d:`M21 4a1 1 0 0 0-1-1`,key:`sfs9ap`}],[`path`,{d:`M21 9a1 1 0 0 1-1 1`,key:`mp6qeo`}],[`path`,{d:`m3 7 3 3 3-3`,key:`x25e72`}],[`path`,{d:`M6 10V5a2 2 0 0 1 2-2h2`,key:`15xut4`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}]]),Re=l(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),ze=l(`scale`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`m19 8 3 8a5 5 0 0 1-6 0zV7`,key:`zcdpyk`}],[`path`,{d:`M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1`,key:`1yorad`}],[`path`,{d:`m5 8 3 8a5 5 0 0 1-6 0zV7`,key:`eua70x`}],[`path`,{d:`M7 21h10`,key:`1b0cd5`}]]),Be=l(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),Ve=l(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),He=l(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),Ue=l(`waypoints`,[[`path`,{d:`m10.586 5.414-5.172 5.172`,key:`4mc350`}],[`path`,{d:`m18.586 13.414-5.172 5.172`,key:`8c96vv`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`circle`,{cx:`12`,cy:`20`,r:`2`,key:`144qzu`}],[`circle`,{cx:`12`,cy:`4`,r:`2`,key:`muu5ef`}],[`circle`,{cx:`20`,cy:`12`,r:`2`,key:`1xzzfp`}],[`circle`,{cx:`4`,cy:`12`,r:`2`,key:`1hvhnz`}]]),L=e(n(),1),We=1,Ge=.9,Ke=.8,qe=.17,R=.1,z=.999,Je=.9999,B=.99,V=/[\\\/_+.#"@\[\(\{&]/,Ye=/[\\\/_+.#"@\[\(\{&]/g,Xe=/[\s-]/,H=/[\s-]/g;function U(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?We:B;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=U(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=We:V.test(e.charAt(l-1))?(d*=Ke,p=e.slice(i,l-1).match(Ye),p&&i>0&&(d*=z**+p.length)):Xe.test(e.charAt(l-1))?(d*=Ge,m=e.slice(i,l-1).match(H),m&&i>0&&(d*=z**+m.length)):(d*=qe,i>0&&(d*=z**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=Je)),(d<R&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=U(e,t,n,r,l+1,a+2,o),f*R>d&&(d=f*R)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Ze(e){return e.toLowerCase().replace(H,` `)}function Qe(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,U(e,t,Ze(e),Ze(t),0,0,{})}var W=`[cmdk-group=""]`,G=`[cmdk-group-items=""]`,$e=`[cmdk-group-heading=""]`,et=`[cmdk-item=""]`,tt=`${et}:not([aria-disabled="true"])`,nt=`cmdk-item-select`,K=`data-value`,rt=(e,t,n)=>Qe(e,t,n),it=L.createContext(void 0),q=()=>L.useContext(it),at=L.createContext(void 0),ot=()=>L.useContext(at),st=L.createContext(void 0),ct=L.forwardRef((e,t)=>{let n=X(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),i=X(()=>new Set),a=X(()=>new Map),o=X(()=>new Map),s=X(()=>new Set),c=yt(e),{label:l,children:u,value:f,onValueChange:p,filter:m,shouldFilter:h,loop:g,disablePointerSelection:_=!1,vimBindings:v=!0,...y}=e,b=d(),x=d(),S=d(),C=L.useRef(null),w=xt();Y(()=>{if(f!==void 0){let e=f.trim();n.current.value=e,T.emit()}},[f]),Y(()=>{w(6,te)},[]);let T=L.useMemo(()=>({subscribe:e=>(s.current.add(e),()=>s.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)k(),D(),w(1,O);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(S);e?e.focus():(i=document.getElementById(b))==null||i.focus()}if(w(7,()=>{n.current.selectedItemId=A()?.id,T.emit()}),r||w(5,te),c.current?.value!==void 0){let e=t??``;(o=(a=c.current).onValueChange)==null||o.call(a,e);return}}T.emit()}},emit:()=>{s.current.forEach(e=>e())}}),[]),E=L.useMemo(()=>({value:(e,t,r)=>{t!==o.current.get(e)?.value&&(o.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,ee(t,r)),w(2,()=>{D(),T.emit()}))},item:(e,t)=>(i.current.add(e),t&&(a.current.has(t)?a.current.get(t).add(e):a.current.set(t,new Set([e]))),w(3,()=>{k(),D(),n.current.value||O(),T.emit()}),()=>{o.current.delete(e),i.current.delete(e),n.current.filtered.items.delete(e);let t=A();w(4,()=>{k(),t?.getAttribute(`id`)===e&&O(),T.emit()})}),group:e=>(a.current.has(e)||a.current.set(e,new Set),()=>{o.current.delete(e),a.current.delete(e)}),filter:()=>c.current.shouldFilter,label:l||e[`aria-label`],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:b,inputId:S,labelId:x,listInnerRef:C}),[]);function ee(e,t){let r=c.current?.filter??rt;return e?r(e,n.current.search,t):0}function D(){if(!n.current.search||c.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=a.current.get(n),i=0;r.forEach(t=>{let n=e.get(t);i=Math.max(n,i)}),t.push([n,i])});let r=C.current;j().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(G);t?t.appendChild(e.parentElement===t?e:e.closest(`${G} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${G} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=C.current?.querySelector(`${W}[${K}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function O(){let e=j().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(K);T.setState(`value`,e||void 0)}function k(){if(!n.current.search||c.current.shouldFilter===!1){n.current.filtered.count=i.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of i.current){let r=ee(o.current.get(t)?.value??``,o.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of a.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function te(){var e;let t=A();t&&(t.parentElement?.firstChild===t&&((e=t.closest(W)?.querySelector($e))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function A(){return C.current?.querySelector(`${et}[aria-selected="true"]`)}function j(){return Array.from(C.current?.querySelectorAll(tt)||[])}function M(e){let t=j()[e];t&&T.setState(`value`,t.getAttribute(K))}function N(e){var t;let n=A(),r=j(),i=r.findIndex(e=>e===n),a=r[i+e];(t=c.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&T.setState(`value`,a.getAttribute(K))}function ne(e){let t=A()?.closest(W),n;for(;t&&!n;)t=e>0?_t(t,W):vt(t,W),n=t?.querySelector(tt);n?T.setState(`value`,n.getAttribute(K)):N(e)}let P=()=>M(j().length-1),F=e=>{e.preventDefault(),e.metaKey?P():e.altKey?ne(1):N(1)},I=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?ne(-1):N(-1)};return L.createElement(r.div,{ref:t,tabIndex:-1,...y,"cmdk-root":``,onKeyDown:e=>{var t;(t=y.onKeyDown)==null||t.call(y,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:v&&e.ctrlKey&&F(e);break;case`ArrowDown`:F(e);break;case`p`:case`k`:v&&e.ctrlKey&&I(e);break;case`ArrowUp`:I(e);break;case`Home`:e.preventDefault(),M(0);break;case`End`:e.preventDefault(),P();break;case`Enter`:{e.preventDefault();let t=A();if(t){let e=new Event(nt);t.dispatchEvent(e)}}}}},L.createElement(`label`,{"cmdk-label":``,htmlFor:E.inputId,id:E.labelId,style:Ct},l),Q(e,e=>L.createElement(at.Provider,{value:T},L.createElement(it.Provider,{value:E},e))))}),lt=L.forwardRef((e,t)=>{let n=d(),i=L.useRef(null),o=L.useContext(st),s=q(),c=yt(e),l=c.current?.forceMount??o?.forceMount;Y(()=>{if(!l)return s.item(n,o?.id)},[l]);let u=bt(n,i,[e.value,e.children,i],e.keywords),f=ot(),p=Z(e=>e.value&&e.value===u.current),m=Z(e=>l||s.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);L.useEffect(()=>{let t=i.current;if(!(!t||e.disabled))return t.addEventListener(nt,h),()=>t.removeEventListener(nt,h)},[m,e.onSelect,e.disabled]);function h(){var e,t;g(),(t=(e=c.current).onSelect)==null||t.call(e,u.current)}function g(){f.setState(`value`,u.current,!0)}if(!m)return null;let{disabled:_,value:v,onSelect:y,forceMount:b,keywords:x,...S}=e;return L.createElement(r.div,{ref:a(i,t),...S,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!_,"aria-selected":!!p,"data-disabled":!!_,"data-selected":!!p,onPointerMove:_||s.getDisablePointerSelection()?void 0:g,onClick:_?void 0:h},e.children)}),ut=L.forwardRef((e,t)=>{let{heading:n,children:i,forceMount:o,...s}=e,c=d(),l=L.useRef(null),u=L.useRef(null),f=d(),p=q(),m=Z(e=>o||p.filter()===!1?!0:!e.search||e.filtered.groups.has(c));Y(()=>p.group(c),[]),bt(c,l,[e.value,e.heading,u]);let h=L.useMemo(()=>({id:c,forceMount:o}),[o]);return L.createElement(r.div,{ref:a(l,t),...s,"cmdk-group":``,role:`presentation`,hidden:!m||void 0},n&&L.createElement(`div`,{ref:u,"cmdk-group-heading":``,"aria-hidden":!0,id:f},n),Q(e,e=>L.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?f:void 0},L.createElement(st.Provider,{value:h},e))))}),dt=L.forwardRef((e,t)=>{let{alwaysRender:n,...i}=e,o=L.useRef(null),s=Z(e=>!e.search);return!n&&!s?null:L.createElement(r.div,{ref:a(o,t),...i,"cmdk-separator":``,role:`separator`})}),ft=L.forwardRef((e,t)=>{let{onValueChange:n,...i}=e,a=e.value!=null,o=ot(),s=Z(e=>e.search),c=Z(e=>e.selectedItemId),l=q();return L.useEffect(()=>{e.value!=null&&o.setState(`search`,e.value)},[e.value]),L.createElement(r.input,{ref:t,...i,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":c,id:l.inputId,type:`text`,value:a?e.value:s,onChange:e=>{a||o.setState(`search`,e.target.value),n?.(e.target.value)}})}),pt=L.forwardRef((e,t)=>{let{children:n,label:i=`Suggestions`,...o}=e,s=L.useRef(null),c=L.useRef(null),l=Z(e=>e.selectedItemId),u=q();return L.useEffect(()=>{if(c.current&&s.current){let e=c.current,t=s.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),L.createElement(r.div,{ref:a(s,t),...o,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":l,"aria-label":i,id:u.listId},Q(e,e=>L.createElement(`div`,{ref:a(c,u.listInnerRef),"cmdk-list-sizer":``},e)))}),mt=L.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return L.createElement(y,{open:n,onOpenChange:r},L.createElement(m,{container:o},L.createElement(p,{"cmdk-overlay":``,className:i}),L.createElement(h,{"aria-label":e.label,"cmdk-dialog":``,className:a},L.createElement(ct,{ref:t,...s}))))}),ht=L.forwardRef((e,t)=>Z(e=>e.filtered.count===0)?L.createElement(r.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),gt=L.forwardRef((e,t)=>{let{progress:n,children:i,label:a=`Loading...`,...o}=e;return L.createElement(r.div,{ref:t,...o,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},Q(e,e=>L.createElement(`div`,{"aria-hidden":!0},e)))}),J=Object.assign(ct,{List:pt,Item:lt,Input:ft,Group:ut,Separator:dt,Dialog:mt,Empty:ht,Loading:gt});function _t(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function vt(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function yt(e){let t=L.useRef(e);return Y(()=>{t.current=e}),t}var Y=typeof window>`u`?L.useEffect:L.useLayoutEffect;function X(e){let t=L.useRef();return t.current===void 0&&(t.current=e()),t}function Z(e){let t=ot(),n=()=>e(t.snapshot());return L.useSyncExternalStore(t.subscribe,n,n)}function bt(e,t,n,r=[]){let i=L.useRef(),a=q();return Y(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(K,s),i.current=s}),i}var xt=()=>{let[e,t]=L.useState(),n=X(()=>new Map);return Y(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function St(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function Q({asChild:e,children:t},n){return e&&L.isValidElement(t)?L.cloneElement(St(t),{ref:t.ref},n(t.props.children)):n(t)}var Ct={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},$=u();function wt({className:e,...t}){return(0,$.jsx)(J,{"data-slot":`command`,className:i(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...t})}function Tt({title:e=`Command Palette`,description:t=`Search for a command to run...`,children:n,className:r,showCloseButton:a=!0,...o}){return(0,$.jsxs)(b,{...o,children:[(0,$.jsxs)(f,{className:`sr-only`,children:[(0,$.jsx)(_,{children:e}),(0,$.jsx)(v,{children:t})]}),(0,$.jsx)(g,{className:i(`overflow-hidden p-0`,r),showCloseButton:a,children:(0,$.jsx)(wt,{className:`**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5`,children:n})})]})}function Et({className:e,...t}){return(0,$.jsxs)(`div`,{"data-slot":`command-input-wrapper`,className:`flex h-9 items-center gap-2 border-b px-3`,children:[(0,$.jsx)(ge,{className:`size-4 shrink-0 opacity-50`}),(0,$.jsx)(J.Input,{"data-slot":`command-input`,className:i(`flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...t})]})}function Dt({className:e,...t}){return(0,$.jsx)(J.List,{"data-slot":`command-list`,className:i(`max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto`,e),...t})}function Ot({...e}){return(0,$.jsx)(J.Empty,{"data-slot":`command-empty`,className:`py-6 text-center text-sm`,...e})}function kt({className:e,...t}){return(0,$.jsx)(J.Group,{"data-slot":`command-group`,className:i(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function At({className:e,...t}){return(0,$.jsx)(J.Item,{"data-slot":`command-item`,className:i(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...t})}function jt({className:e,...t}){return(0,$.jsx)(`span`,{"data-slot":`command-shortcut`,className:i(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t})}var Mt={sky:`text-catppuccin-sky`,blue:`text-catppuccin-blue`,green:`text-catppuccin-green`,teal:`text-catppuccin-teal`,mauve:`text-catppuccin-mauve`,lavender:`text-catppuccin-lavender`,peach:`text-catppuccin-peach`,yellow:`text-catppuccin-yellow`,red:`text-catppuccin-red`};function Nt({theme:e}){let{background:t,blue:n,mauve:r,green:i}=e.colors;return(0,$.jsx)(`span`,{className:`flex size-5 shrink-0 overflow-hidden rounded-sm border border-catppuccin-surface2`,children:[t,n,r,i].map((e,t)=>(0,$.jsx)(`span`,{className:`flex-1`,style:{backgroundColor:e}},t))})}function Pt(){let{t:e}=c(),{activeDialog:n,closeDialog:r,openDialog:a}=w(),l=w(e=>e.setWelcomeVisible),u=w(e=>e.setFooterMessage),{executeCurrentQuery:d,executeCurrentStatement:f,executeWholeScript:p,addNewQueryTab:m,disconnectActive:h}=he(),{capabilities:g}=me(),_=C(),v=x(e=>e.activeConnections.find(t=>t.id===e.activeConnectionId)),y=x(e=>e.activeConnectionId?e.transactionOpen[e.activeConnectionId]??!1:!1),b=x(e=>e.updateProfile),ge=be(e=>e.themeId),We=be(e=>e.setTheme),Ge=S(e=>e.locale),Ke=S(e=>e.setLocale),qe=n===`quick-command`,R=v!==void 0,z=T(e=>{let t=x.getState().activeConnectionId;if(!t)return!1;let n=e.activeTabId[t];return(e.tabs[t]??E).find(e=>e.id===n)?.isExecuting??!1});async function Je(){let e=x.getState().activeConnectionId;if(!e)return;let t=ee(await D(e));t&&w.getState().setFooterMessage(t)}let B=(0,L.useCallback)(e=>{r(),e()},[r]),V=(0,L.useCallback)(e=>u(e instanceof Error?e.message:String(e)),[u]),Ye=()=>{let e=x.getState().activeConnectionId;e&&(ye.getState().openERD(e),t(`erd_open`),T.getState().setActiveQueryTab(e,`erd`))},Xe=[{heading:e(`palette.groups.connection`),commands:[{id:`connect`,label:e(`palette.commands.connect`),icon:Ie,tone:`sky`,shortcut:`Alt+N`,keywords:[`connect`,`server`,`profile`,`login`],disabled:!_,action:()=>B(()=>a(`connect`))},{id:`disconnect`,label:e(`palette.commands.disconnect`),icon:xe,tone:`red`,keywords:[`disconnect`,`close`],disabled:!R,action:()=>B(()=>{h()})},{id:`read-only`,label:e(`menu.connection.readOnly`),icon:ne,tone:`yellow`,keywords:[`read only`,`safety`,`guard`],disabled:!R,checked:v?.readOnly===!0,action:()=>B(()=>{v&&b(v.id,{readOnly:!v.readOnly})})},{id:`manual-transactions`,capability:`transactions`,label:e(`menu.connection.manualTransactions`),icon:we,tone:`lavender`,keywords:[`transaction`,`manual`,`autocommit`],disabled:!R,checked:v?.transactionMode===`manual`,action:()=>B(()=>{v&&b(v.id,{transactionMode:v.transactionMode===`manual`?`auto`:`manual`})})},{id:`commit`,capability:`transactions`,label:e(`toolbar.commit`),icon:de,tone:`green`,keywords:[`commit`,`transaction`],disabled:!y||!v,action:()=>B(()=>{v&&k(v.id).catch(V)})},{id:`rollback`,capability:`transactions`,label:e(`toolbar.rollback`),icon:ae,tone:`peach`,keywords:[`rollback`,`transaction`,`undo`],disabled:!y||!v,action:()=>B(()=>{v&&O(v.id).catch(V)})}]},{heading:e(`palette.groups.query`),commands:[{id:`execute`,label:e(`palette.commands.executeQuery`),icon:re,tone:`green`,shortcut:`F9`,keywords:[`run`,`execute`,`sql`],disabled:!R,action:()=>B(()=>{d()})},{id:`stop-query`,label:e(`result.running.stop`),icon:A,tone:`red`,keywords:[`stop`,`cancel`,`abort`,`kill`],disabled:!z,action:()=>B(()=>{Je()})},{id:`execute-statement`,label:e(`menu.query.executeStatementAtCursor`),icon:De,tone:`green`,shortcut:`Ctrl+Enter`,keywords:[`run`,`statement`,`cursor`],disabled:!R,action:()=>B(()=>{f()})},{id:`execute-script`,label:e(`menu.query.executeWholeScript`),icon:Be,tone:`teal`,shortcut:`Ctrl+Shift+Enter`,keywords:[`run`,`script`,`batch`],disabled:!R,action:()=>B(()=>{p()})},{id:`new-tab`,label:e(`palette.commands.newQueryTab`),icon:F,tone:`blue`,shortcut:`Alt+T`,keywords:[`new`,`tab`,`editor`],disabled:!R,action:()=>B(()=>m())},{id:`find-replace`,label:e(`menu.query.findReplace`),icon:Le,tone:`lavender`,keywords:[`find`,`replace`,`search`],disabled:!R,action:()=>B(()=>a(`find-replace`))},{id:`local-history`,label:e(`menu.query.localHistory`),icon:Ne,tone:`mauve`,keywords:[`history`,`snapshot`,`undo`],disabled:!R,action:()=>B(()=>a(`local-history`))}]},{heading:e(`palette.groups.database`),commands:[{id:`create-db`,capability:`multipleDatabases`,label:e(`palette.commands.createDatabase`),icon:se,tone:`blue`,keywords:[`create`,`database`,`schema`],disabled:!R,action:()=>B(()=>a(`create-database`))},{id:`alter-db`,capability:`multipleDatabases`,label:e(`menu.database.alter`),icon:Oe,tone:`blue`,keywords:[`alter`,`database`,`charset`],disabled:!R,action:()=>B(()=>a(`alter-database`))},{id:`copy-db`,capability:`multipleDatabases`,label:e(`menu.database.copy`),icon:ue,tone:`sky`,keywords:[`copy`,`clone`,`database`],disabled:!R,action:()=>B(()=>a(`copy-database`))},{id:`schema-diff`,label:e(`menu.database.compare`),icon:je,tone:`mauve`,keywords:[`compare`,`diff`,`schema`,`sync`],pro:`compare_schemas`,disabled:!R,action:()=>B(()=>a(`schema-diff`))},{id:`data-diff`,label:e(`menu.database.compareData`),icon:Me,tone:`mauve`,keywords:[`compare`,`diff`,`data`,`rows`],pro:`compare_data`,disabled:!R,action:()=>B(()=>a(`data-diff`))},{id:`group-by`,label:e(`menu.database.groupBy`),icon:_e,tone:`mauve`,keywords:[`group`,`count`,`aggregate`,`distinct`,`summary`],disabled:!R,action:()=>B(()=>a(`group-by`))}]},{heading:e(`palette.groups.table`),commands:[{id:`create-table`,label:e(`palette.commands.createTable`),icon:j,tone:`green`,keywords:[`create`,`table`],disabled:!R,action:()=>B(()=>a(`create-table`))},{id:`alter-table`,label:e(`palette.commands.alterTable`),icon:Se,tone:`yellow`,keywords:[`alter`,`table`,`column`],disabled:!R,action:()=>B(()=>a(`alter-table`))},{id:`duplicate-table`,label:e(`menu.table.duplicateStructure`),icon:Ee,tone:`teal`,keywords:[`duplicate`,`structure`,`table`],disabled:!R,action:()=>B(()=>a(`duplicate-table-structure`))}]},{heading:e(`menu.export.title`),commands:[{id:`export-csv`,label:e(`menu.export.csv`),icon:Ae,tone:`green`,keywords:[`export`,`csv`,`excel`],disabled:!R,action:()=>B(()=>a(`export-csv`))},{id:`export-html`,label:e(`menu.export.schemaHtml`),icon:ke,tone:`peach`,keywords:[`export`,`html`,`schema`,`documentation`],disabled:!R,action:()=>B(()=>a(`export-html`))}]},{heading:e(`palette.groups.tools`),commands:[{id:`process-list`,capability:`processList`,label:e(`palette.commands.processList`),icon:te,tone:`red`,keywords:[`process`,`kill`,`connections`],disabled:!R,action:()=>B(()=>a(`process-list`))},{id:`variables`,capability:`variables`,label:e(`palette.commands.serverVariables`),icon:Ve,tone:`lavender`,keywords:[`variables`,`server`,`settings`],disabled:!R,action:()=>B(()=>a(`variables`))},{id:`status`,capability:`status`,label:e(`palette.commands.serverStatus`),icon:oe,tone:`teal`,keywords:[`status`,`server`,`metrics`],disabled:!R,action:()=>B(()=>a(`status`))},{id:`flush`,capability:`flush`,label:e(`palette.commands.flush`),icon:P,tone:`peach`,keywords:[`flush`,`cache`,`reload`],disabled:!R,action:()=>B(()=>a(`flush`))},{id:`user-manager`,capability:`users`,label:e(`palette.commands.userManager`),icon:pe,tone:`blue`,keywords:[`users`,`grants`,`privileges`],disabled:!R,action:()=>B(()=>a(`user-manager`))},{id:`scratchpad`,label:e(`menu.tools.scratchpad`),icon:N,tone:`yellow`,keywords:[`scratchpad`,`sqlite`,`local`],pro:`scratchpad`,action:()=>B(()=>{ie().catch(V)})},{id:`federated`,label:e(`menu.tools.federated`),icon:Ue,tone:`mauve`,keywords:[`federated`,`cross`,`join`,`connections`],pro:`federated`,action:()=>B(()=>{le().catch(V)})},{id:`erd`,label:e(`menu.tools.viewErd`),icon:Fe,tone:`sky`,keywords:[`erd`,`diagram`,`relations`],disabled:!R,action:()=>B(Ye)}]},{heading:e(`menu.settings.theme`),commands:ve().map(e=>({id:`theme-${e.id}`,label:e.name,tone:`lavender`,keywords:[`theme`,`color`,`appearance`,`dark`,`light`,e.id],checked:ge===e.id,swatch:e,action:()=>B(()=>We(e.id))}))},{heading:e(`menu.settings.language`),commands:[`auto`,...s].map(t=>({id:`locale-${t}`,label:t===`auto`?e(`language.auto`,{name:e(`language.${o()}`)}):e(`language.${t}`),icon:Pe,tone:`teal`,keywords:[`language`,`locale`,`i18n`,t],checked:Ge===t,action:()=>B(()=>Ke(t))}))},{heading:e(`menu.settings.title`),commands:[{id:`safety-settings`,label:e(`menu.settings.safety`),icon:He,tone:`yellow`,keywords:[`safety`,`settings`,`row limit`,`preferences`],action:()=>B(()=>a(`safety-settings`))}]},{heading:e(`menu.help.title`),commands:[{id:`documentation`,label:e(`menu.help.documentation`),icon:Te,tone:`blue`,keywords:[`docs`,`documentation`,`manual`,`help`],action:()=>B(()=>{window.open(fe(),`_blank`,`noopener,noreferrer`)})},{id:`getting-started`,label:e(`menu.help.gettingStarted`),icon:Re,tone:`green`,keywords:[`welcome`,`onboarding`,`sample`,`getting started`],action:()=>B(()=>l(!0))},{id:`whats-new`,label:e(`menu.help.whatsNew`),icon:I,tone:`sky`,keywords:[`whats new`,`changelog`,`release`,`update`],action:()=>B(()=>a(`whats-new`,{all:!0}))},{id:`terms`,label:e(`menu.help.terms`),icon:ze,tone:`peach`,keywords:[`terms`,`privacy`,`legal`],action:()=>B(()=>a(`terms`))},{id:`about`,label:e(`menu.help.about`),icon:ce,tone:`sky`,keywords:[`about`,`version`,`agent`],action:()=>B(()=>a(`about`))}]}];function H(e){e||r()}let U=Xe.map(e=>({...e,commands:e.commands.filter(e=>!e.capability||g[e.capability])})).filter(e=>e.commands.length>0);return(0,$.jsxs)(Tt,{open:qe,onOpenChange:H,title:e(`palette.title`),description:e(`palette.description`),children:[(0,$.jsx)(Et,{placeholder:e(`palette.inputPlaceholder`)}),(0,$.jsxs)(Dt,{className:`max-h-[60vh]`,children:[(0,$.jsx)(Ot,{children:e(`palette.empty`)}),U.map(e=>(0,$.jsx)(kt,{heading:e.heading,children:e.commands.map(t=>(0,$.jsxs)(At,{value:`${e.heading} ${t.label}`,keywords:t.keywords,disabled:t.disabled,onSelect:()=>{(!t.pro||Ce(t.pro))&&t.action()},children:[t.swatch?(0,$.jsx)(Nt,{theme:t.swatch}):t.icon?(0,$.jsx)(t.icon,{className:i(`size-4`,Mt[t.tone])}):null,(0,$.jsx)(`span`,{className:`truncate`,children:t.label}),(0,$.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[t.pro&&(0,$.jsx)(M,{className:`ml-0`}),t.checked&&(0,$.jsx)(de,{className:`size-3.5 text-catppuccin-green`}),t.shortcut&&(0,$.jsx)(jt,{className:`ml-0`,children:t.shortcut})]})]},t.id))},e.heading))]})]})}export{Pt as QuickCommandPalette};
1
+ import{r as e}from"./hePW80VL.js";import{o as t,p as n}from"./CYz610vE.js";import{a as r,i,l as a}from"./CiL8zoYm.js";import{r as o,t as s}from"./C9jzAIEJ.js";import{i as c,n as l,r as u}from"./Cu_sGzNJ.js";import{C as d,a as f,d as p,f as m,l as h,n as g,o as _,r as v,s as y,t as b}from"./DzRyVlxz.js";import{t as x}from"./CAd2f6EE.js";import{n as S,r as C}from"./DU-Eln5x.js";import{n as w}from"./D8_hwGjG.js";import{n as T,t as E}from"./D6SRSRpo.js";import{n as ee,t as D}from"./BghfQrAj.js";import{i as O,t as k}from"./DpPKm22O.js";import{$t as te,Dt as A,Et as j,H as M,It as N,Lt as ne,Mt as P,Nt as F,Ot as I,Pt as re,Q as ie,St as ae,Tt as oe,Ut as se,Vt as ce,W as le,Wt as ue,Yt as de,Z as fe,bt as pe,ht as me,it as he,jt as ge,kt as _e,nt as ve,rt as ye,tt as be,xt as xe,yt as Se,z as Ce,zt as we}from"./B_zu4Zim.js";var Te=l(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),Ee=l(`copy-plus`,[[`line`,{x1:`15`,x2:`15`,y1:`12`,y2:`18`,key:`1p7wdc`}],[`line`,{x1:`12`,x2:`18`,y1:`15`,y2:`15`,key:`1nscbv`}],[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),De=l(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),Oe=l(`database-zap`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 15 21.84`,key:`14ibmq`}],[`path`,{d:`M21 5V8`,key:`1marbg`}],[`path`,{d:`M21 12L18 17H22L19 22`,key:`zafso`}],[`path`,{d:`M3 12A9 3 0 0 0 14.59 14.87`,key:`1y4wr8`}]]),ke=l(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),Ae=l(`file-spreadsheet`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]),je=l(`git-compare`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`path`,{d:`M11 18H8a2 2 0 0 1-2-2V9`,key:`19pyzm`}]]),Me=l(`git-compare-arrows`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`M12 18H7a2 2 0 0 1-2-2V9`,key:`16sdep`}],[`path`,{d:`m9 15 3 3-3 3`,key:`1m3kbl`}]]),Ne=l(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),Pe=l(`languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),Fe=l(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),Ie=l(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]),Le=l(`replace`,[[`path`,{d:`M14 4a1 1 0 0 1 1-1`,key:`dhj8ez`}],[`path`,{d:`M15 10a1 1 0 0 1-1-1`,key:`1mnyi5`}],[`path`,{d:`M21 4a1 1 0 0 0-1-1`,key:`sfs9ap`}],[`path`,{d:`M21 9a1 1 0 0 1-1 1`,key:`mp6qeo`}],[`path`,{d:`m3 7 3 3 3-3`,key:`x25e72`}],[`path`,{d:`M6 10V5a2 2 0 0 1 2-2h2`,key:`15xut4`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}]]),Re=l(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),ze=l(`scale`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`m19 8 3 8a5 5 0 0 1-6 0zV7`,key:`zcdpyk`}],[`path`,{d:`M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1`,key:`1yorad`}],[`path`,{d:`m5 8 3 8a5 5 0 0 1-6 0zV7`,key:`eua70x`}],[`path`,{d:`M7 21h10`,key:`1b0cd5`}]]),Be=l(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),Ve=l(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),He=l(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),Ue=l(`waypoints`,[[`path`,{d:`m10.586 5.414-5.172 5.172`,key:`4mc350`}],[`path`,{d:`m18.586 13.414-5.172 5.172`,key:`8c96vv`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`circle`,{cx:`12`,cy:`20`,r:`2`,key:`144qzu`}],[`circle`,{cx:`12`,cy:`4`,r:`2`,key:`muu5ef`}],[`circle`,{cx:`20`,cy:`12`,r:`2`,key:`1xzzfp`}],[`circle`,{cx:`4`,cy:`12`,r:`2`,key:`1hvhnz`}]]),L=e(n(),1),We=1,Ge=.9,Ke=.8,qe=.17,R=.1,z=.999,Je=.9999,B=.99,V=/[\\\/_+.#"@\[\(\{&]/,Ye=/[\\\/_+.#"@\[\(\{&]/g,Xe=/[\s-]/,H=/[\s-]/g;function U(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?We:B;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=U(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=We:V.test(e.charAt(l-1))?(d*=Ke,p=e.slice(i,l-1).match(Ye),p&&i>0&&(d*=z**+p.length)):Xe.test(e.charAt(l-1))?(d*=Ge,m=e.slice(i,l-1).match(H),m&&i>0&&(d*=z**+m.length)):(d*=qe,i>0&&(d*=z**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=Je)),(d<R&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=U(e,t,n,r,l+1,a+2,o),f*R>d&&(d=f*R)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Ze(e){return e.toLowerCase().replace(H,` `)}function Qe(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,U(e,t,Ze(e),Ze(t),0,0,{})}var W=`[cmdk-group=""]`,G=`[cmdk-group-items=""]`,$e=`[cmdk-group-heading=""]`,et=`[cmdk-item=""]`,tt=`${et}:not([aria-disabled="true"])`,nt=`cmdk-item-select`,K=`data-value`,rt=(e,t,n)=>Qe(e,t,n),it=L.createContext(void 0),q=()=>L.useContext(it),at=L.createContext(void 0),ot=()=>L.useContext(at),st=L.createContext(void 0),ct=L.forwardRef((e,t)=>{let n=X(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),i=X(()=>new Set),a=X(()=>new Map),o=X(()=>new Map),s=X(()=>new Set),c=yt(e),{label:l,children:u,value:f,onValueChange:p,filter:m,shouldFilter:h,loop:g,disablePointerSelection:_=!1,vimBindings:v=!0,...y}=e,b=d(),x=d(),S=d(),C=L.useRef(null),w=xt();Y(()=>{if(f!==void 0){let e=f.trim();n.current.value=e,T.emit()}},[f]),Y(()=>{w(6,te)},[]);let T=L.useMemo(()=>({subscribe:e=>(s.current.add(e),()=>s.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)k(),D(),w(1,O);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(S);e?e.focus():(i=document.getElementById(b))==null||i.focus()}if(w(7,()=>{n.current.selectedItemId=A()?.id,T.emit()}),r||w(5,te),c.current?.value!==void 0){let e=t??``;(o=(a=c.current).onValueChange)==null||o.call(a,e);return}}T.emit()}},emit:()=>{s.current.forEach(e=>e())}}),[]),E=L.useMemo(()=>({value:(e,t,r)=>{t!==o.current.get(e)?.value&&(o.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,ee(t,r)),w(2,()=>{D(),T.emit()}))},item:(e,t)=>(i.current.add(e),t&&(a.current.has(t)?a.current.get(t).add(e):a.current.set(t,new Set([e]))),w(3,()=>{k(),D(),n.current.value||O(),T.emit()}),()=>{o.current.delete(e),i.current.delete(e),n.current.filtered.items.delete(e);let t=A();w(4,()=>{k(),t?.getAttribute(`id`)===e&&O(),T.emit()})}),group:e=>(a.current.has(e)||a.current.set(e,new Set),()=>{o.current.delete(e),a.current.delete(e)}),filter:()=>c.current.shouldFilter,label:l||e[`aria-label`],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:b,inputId:S,labelId:x,listInnerRef:C}),[]);function ee(e,t){let r=c.current?.filter??rt;return e?r(e,n.current.search,t):0}function D(){if(!n.current.search||c.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=a.current.get(n),i=0;r.forEach(t=>{let n=e.get(t);i=Math.max(n,i)}),t.push([n,i])});let r=C.current;j().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(G);t?t.appendChild(e.parentElement===t?e:e.closest(`${G} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${G} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=C.current?.querySelector(`${W}[${K}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function O(){let e=j().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(K);T.setState(`value`,e||void 0)}function k(){if(!n.current.search||c.current.shouldFilter===!1){n.current.filtered.count=i.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of i.current){let r=ee(o.current.get(t)?.value??``,o.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of a.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function te(){var e;let t=A();t&&(t.parentElement?.firstChild===t&&((e=t.closest(W)?.querySelector($e))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function A(){return C.current?.querySelector(`${et}[aria-selected="true"]`)}function j(){return Array.from(C.current?.querySelectorAll(tt)||[])}function M(e){let t=j()[e];t&&T.setState(`value`,t.getAttribute(K))}function N(e){var t;let n=A(),r=j(),i=r.findIndex(e=>e===n),a=r[i+e];(t=c.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&T.setState(`value`,a.getAttribute(K))}function ne(e){let t=A()?.closest(W),n;for(;t&&!n;)t=e>0?_t(t,W):vt(t,W),n=t?.querySelector(tt);n?T.setState(`value`,n.getAttribute(K)):N(e)}let P=()=>M(j().length-1),F=e=>{e.preventDefault(),e.metaKey?P():e.altKey?ne(1):N(1)},I=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?ne(-1):N(-1)};return L.createElement(r.div,{ref:t,tabIndex:-1,...y,"cmdk-root":``,onKeyDown:e=>{var t;(t=y.onKeyDown)==null||t.call(y,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:v&&e.ctrlKey&&F(e);break;case`ArrowDown`:F(e);break;case`p`:case`k`:v&&e.ctrlKey&&I(e);break;case`ArrowUp`:I(e);break;case`Home`:e.preventDefault(),M(0);break;case`End`:e.preventDefault(),P();break;case`Enter`:{e.preventDefault();let t=A();if(t){let e=new Event(nt);t.dispatchEvent(e)}}}}},L.createElement(`label`,{"cmdk-label":``,htmlFor:E.inputId,id:E.labelId,style:Ct},l),Q(e,e=>L.createElement(at.Provider,{value:T},L.createElement(it.Provider,{value:E},e))))}),lt=L.forwardRef((e,t)=>{let n=d(),i=L.useRef(null),o=L.useContext(st),s=q(),c=yt(e),l=c.current?.forceMount??o?.forceMount;Y(()=>{if(!l)return s.item(n,o?.id)},[l]);let u=bt(n,i,[e.value,e.children,i],e.keywords),f=ot(),p=Z(e=>e.value&&e.value===u.current),m=Z(e=>l||s.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);L.useEffect(()=>{let t=i.current;if(!(!t||e.disabled))return t.addEventListener(nt,h),()=>t.removeEventListener(nt,h)},[m,e.onSelect,e.disabled]);function h(){var e,t;g(),(t=(e=c.current).onSelect)==null||t.call(e,u.current)}function g(){f.setState(`value`,u.current,!0)}if(!m)return null;let{disabled:_,value:v,onSelect:y,forceMount:b,keywords:x,...S}=e;return L.createElement(r.div,{ref:a(i,t),...S,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!_,"aria-selected":!!p,"data-disabled":!!_,"data-selected":!!p,onPointerMove:_||s.getDisablePointerSelection()?void 0:g,onClick:_?void 0:h},e.children)}),ut=L.forwardRef((e,t)=>{let{heading:n,children:i,forceMount:o,...s}=e,c=d(),l=L.useRef(null),u=L.useRef(null),f=d(),p=q(),m=Z(e=>o||p.filter()===!1?!0:!e.search||e.filtered.groups.has(c));Y(()=>p.group(c),[]),bt(c,l,[e.value,e.heading,u]);let h=L.useMemo(()=>({id:c,forceMount:o}),[o]);return L.createElement(r.div,{ref:a(l,t),...s,"cmdk-group":``,role:`presentation`,hidden:!m||void 0},n&&L.createElement(`div`,{ref:u,"cmdk-group-heading":``,"aria-hidden":!0,id:f},n),Q(e,e=>L.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?f:void 0},L.createElement(st.Provider,{value:h},e))))}),dt=L.forwardRef((e,t)=>{let{alwaysRender:n,...i}=e,o=L.useRef(null),s=Z(e=>!e.search);return!n&&!s?null:L.createElement(r.div,{ref:a(o,t),...i,"cmdk-separator":``,role:`separator`})}),ft=L.forwardRef((e,t)=>{let{onValueChange:n,...i}=e,a=e.value!=null,o=ot(),s=Z(e=>e.search),c=Z(e=>e.selectedItemId),l=q();return L.useEffect(()=>{e.value!=null&&o.setState(`search`,e.value)},[e.value]),L.createElement(r.input,{ref:t,...i,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":c,id:l.inputId,type:`text`,value:a?e.value:s,onChange:e=>{a||o.setState(`search`,e.target.value),n?.(e.target.value)}})}),pt=L.forwardRef((e,t)=>{let{children:n,label:i=`Suggestions`,...o}=e,s=L.useRef(null),c=L.useRef(null),l=Z(e=>e.selectedItemId),u=q();return L.useEffect(()=>{if(c.current&&s.current){let e=c.current,t=s.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),L.createElement(r.div,{ref:a(s,t),...o,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":l,"aria-label":i,id:u.listId},Q(e,e=>L.createElement(`div`,{ref:a(c,u.listInnerRef),"cmdk-list-sizer":``},e)))}),mt=L.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return L.createElement(y,{open:n,onOpenChange:r},L.createElement(m,{container:o},L.createElement(p,{"cmdk-overlay":``,className:i}),L.createElement(h,{"aria-label":e.label,"cmdk-dialog":``,className:a},L.createElement(ct,{ref:t,...s}))))}),ht=L.forwardRef((e,t)=>Z(e=>e.filtered.count===0)?L.createElement(r.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),gt=L.forwardRef((e,t)=>{let{progress:n,children:i,label:a=`Loading...`,...o}=e;return L.createElement(r.div,{ref:t,...o,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},Q(e,e=>L.createElement(`div`,{"aria-hidden":!0},e)))}),J=Object.assign(ct,{List:pt,Item:lt,Input:ft,Group:ut,Separator:dt,Dialog:mt,Empty:ht,Loading:gt});function _t(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function vt(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function yt(e){let t=L.useRef(e);return Y(()=>{t.current=e}),t}var Y=typeof window>`u`?L.useEffect:L.useLayoutEffect;function X(e){let t=L.useRef();return t.current===void 0&&(t.current=e()),t}function Z(e){let t=ot(),n=()=>e(t.snapshot());return L.useSyncExternalStore(t.subscribe,n,n)}function bt(e,t,n,r=[]){let i=L.useRef(),a=q();return Y(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(K,s),i.current=s}),i}var xt=()=>{let[e,t]=L.useState(),n=X(()=>new Map);return Y(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function St(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function Q({asChild:e,children:t},n){return e&&L.isValidElement(t)?L.cloneElement(St(t),{ref:t.ref},n(t.props.children)):n(t)}var Ct={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},$=u();function wt({className:e,...t}){return(0,$.jsx)(J,{"data-slot":`command`,className:i(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...t})}function Tt({title:e=`Command Palette`,description:t=`Search for a command to run...`,children:n,className:r,showCloseButton:a=!0,...o}){return(0,$.jsxs)(b,{...o,children:[(0,$.jsxs)(f,{className:`sr-only`,children:[(0,$.jsx)(_,{children:e}),(0,$.jsx)(v,{children:t})]}),(0,$.jsx)(g,{className:i(`overflow-hidden p-0`,r),showCloseButton:a,children:(0,$.jsx)(wt,{className:`**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5`,children:n})})]})}function Et({className:e,...t}){return(0,$.jsxs)(`div`,{"data-slot":`command-input-wrapper`,className:`flex h-9 items-center gap-2 border-b px-3`,children:[(0,$.jsx)(ge,{className:`size-4 shrink-0 opacity-50`}),(0,$.jsx)(J.Input,{"data-slot":`command-input`,className:i(`flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...t})]})}function Dt({className:e,...t}){return(0,$.jsx)(J.List,{"data-slot":`command-list`,className:i(`max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto`,e),...t})}function Ot({...e}){return(0,$.jsx)(J.Empty,{"data-slot":`command-empty`,className:`py-6 text-center text-sm`,...e})}function kt({className:e,...t}){return(0,$.jsx)(J.Group,{"data-slot":`command-group`,className:i(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function At({className:e,...t}){return(0,$.jsx)(J.Item,{"data-slot":`command-item`,className:i(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...t})}function jt({className:e,...t}){return(0,$.jsx)(`span`,{"data-slot":`command-shortcut`,className:i(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t})}var Mt={sky:`text-catppuccin-sky`,blue:`text-catppuccin-blue`,green:`text-catppuccin-green`,teal:`text-catppuccin-teal`,mauve:`text-catppuccin-mauve`,lavender:`text-catppuccin-lavender`,peach:`text-catppuccin-peach`,yellow:`text-catppuccin-yellow`,red:`text-catppuccin-red`};function Nt({theme:e}){let{background:t,blue:n,mauve:r,green:i}=e.colors;return(0,$.jsx)(`span`,{className:`flex size-5 shrink-0 overflow-hidden rounded-sm border border-catppuccin-surface2`,children:[t,n,r,i].map((e,t)=>(0,$.jsx)(`span`,{className:`flex-1`,style:{backgroundColor:e}},t))})}function Pt(){let{t:e}=c(),{activeDialog:n,closeDialog:r,openDialog:a}=w(),l=w(e=>e.setWelcomeVisible),u=w(e=>e.setFooterMessage),{executeCurrentQuery:d,executeCurrentStatement:f,executeWholeScript:p,addNewQueryTab:m,disconnectActive:h}=he(),{capabilities:g}=me(),_=C(),v=x(e=>e.activeConnections.find(t=>t.id===e.activeConnectionId)),y=x(e=>e.activeConnectionId?e.transactionOpen[e.activeConnectionId]??!1:!1),b=x(e=>e.updateProfile),ge=be(e=>e.themeId),We=be(e=>e.setTheme),Ge=S(e=>e.locale),Ke=S(e=>e.setLocale),qe=n===`quick-command`,R=v!==void 0,z=T(e=>{let t=x.getState().activeConnectionId;if(!t)return!1;let n=e.activeTabId[t];return(e.tabs[t]??E).find(e=>e.id===n)?.isExecuting??!1});async function Je(){let e=x.getState().activeConnectionId;if(!e)return;let t=ee(await D(e));t&&w.getState().setFooterMessage(t)}let B=(0,L.useCallback)(e=>{r(),e()},[r]),V=(0,L.useCallback)(e=>u(e instanceof Error?e.message:String(e)),[u]),Ye=()=>{let e=x.getState().activeConnectionId;e&&(ye.getState().openERD(e),t(`erd_open`),T.getState().setActiveQueryTab(e,`erd`))},Xe=[{heading:e(`palette.groups.connection`),commands:[{id:`connect`,label:e(`palette.commands.connect`),icon:Ie,tone:`sky`,shortcut:`Alt+N`,keywords:[`connect`,`server`,`profile`,`login`],disabled:!_,action:()=>B(()=>a(`connect`))},{id:`disconnect`,label:e(`palette.commands.disconnect`),icon:xe,tone:`red`,keywords:[`disconnect`,`close`],disabled:!R,action:()=>B(()=>{h()})},{id:`read-only`,label:e(`menu.connection.readOnly`),icon:ne,tone:`yellow`,keywords:[`read only`,`safety`,`guard`],disabled:!R,checked:v?.readOnly===!0,action:()=>B(()=>{v&&b(v.id,{readOnly:!v.readOnly})})},{id:`manual-transactions`,capability:`transactions`,label:e(`menu.connection.manualTransactions`),icon:we,tone:`lavender`,keywords:[`transaction`,`manual`,`autocommit`],disabled:!R,checked:v?.transactionMode===`manual`,action:()=>B(()=>{v&&b(v.id,{transactionMode:v.transactionMode===`manual`?`auto`:`manual`})})},{id:`commit`,capability:`transactions`,label:e(`toolbar.commit`),icon:de,tone:`green`,keywords:[`commit`,`transaction`],disabled:!y||!v,action:()=>B(()=>{v&&k(v.id).catch(V)})},{id:`rollback`,capability:`transactions`,label:e(`toolbar.rollback`),icon:ae,tone:`peach`,keywords:[`rollback`,`transaction`,`undo`],disabled:!y||!v,action:()=>B(()=>{v&&O(v.id).catch(V)})}]},{heading:e(`palette.groups.query`),commands:[{id:`execute`,label:e(`palette.commands.executeQuery`),icon:re,tone:`green`,shortcut:`F9`,keywords:[`run`,`execute`,`sql`],disabled:!R,action:()=>B(()=>{d()})},{id:`stop-query`,label:e(`result.running.stop`),icon:A,tone:`red`,keywords:[`stop`,`cancel`,`abort`,`kill`],disabled:!z,action:()=>B(()=>{Je()})},{id:`execute-statement`,label:e(`menu.query.executeStatementAtCursor`),icon:De,tone:`green`,shortcut:`Ctrl+Enter`,keywords:[`run`,`statement`,`cursor`],disabled:!R,action:()=>B(()=>{f()})},{id:`execute-script`,label:e(`menu.query.executeWholeScript`),icon:Be,tone:`teal`,shortcut:`Ctrl+Shift+Enter`,keywords:[`run`,`script`,`batch`],disabled:!R,action:()=>B(()=>{p()})},{id:`new-tab`,label:e(`palette.commands.newQueryTab`),icon:F,tone:`blue`,shortcut:`Alt+T`,keywords:[`new`,`tab`,`editor`],disabled:!R,action:()=>B(()=>m())},{id:`find-replace`,label:e(`menu.query.findReplace`),icon:Le,tone:`lavender`,keywords:[`find`,`replace`,`search`],disabled:!R,action:()=>B(()=>a(`find-replace`))},{id:`local-history`,label:e(`menu.query.localHistory`),icon:Ne,tone:`mauve`,keywords:[`history`,`snapshot`,`undo`],disabled:!R,action:()=>B(()=>a(`local-history`))}]},{heading:e(`palette.groups.database`),commands:[{id:`create-db`,capability:`multipleDatabases`,label:e(`palette.commands.createDatabase`),icon:se,tone:`blue`,keywords:[`create`,`database`,`schema`],disabled:!R,action:()=>B(()=>a(`create-database`))},{id:`alter-db`,capability:`multipleDatabases`,label:e(`menu.database.alter`),icon:Oe,tone:`blue`,keywords:[`alter`,`database`,`charset`],disabled:!R,action:()=>B(()=>a(`alter-database`))},{id:`copy-db`,capability:`multipleDatabases`,label:e(`menu.database.copy`),icon:ue,tone:`sky`,keywords:[`copy`,`clone`,`database`],disabled:!R,action:()=>B(()=>a(`copy-database`))},{id:`schema-diff`,label:e(`menu.database.compare`),icon:je,tone:`mauve`,keywords:[`compare`,`diff`,`schema`,`sync`],pro:`compare_schemas`,disabled:!R,action:()=>B(()=>a(`schema-diff`))},{id:`data-diff`,label:e(`menu.database.compareData`),icon:Me,tone:`mauve`,keywords:[`compare`,`diff`,`data`,`rows`],pro:`compare_data`,disabled:!R,action:()=>B(()=>a(`data-diff`))},{id:`group-by`,label:e(`menu.database.groupBy`),icon:_e,tone:`mauve`,keywords:[`group`,`count`,`aggregate`,`distinct`,`summary`],disabled:!R,action:()=>B(()=>a(`group-by`))}]},{heading:e(`palette.groups.table`),commands:[{id:`create-table`,label:e(`palette.commands.createTable`),icon:j,tone:`green`,keywords:[`create`,`table`],disabled:!R,action:()=>B(()=>a(`create-table`))},{id:`alter-table`,label:e(`palette.commands.alterTable`),icon:Se,tone:`yellow`,keywords:[`alter`,`table`,`column`],disabled:!R,action:()=>B(()=>a(`alter-table`))},{id:`duplicate-table`,label:e(`menu.table.duplicateStructure`),icon:Ee,tone:`teal`,keywords:[`duplicate`,`structure`,`table`],disabled:!R,action:()=>B(()=>a(`duplicate-table-structure`))}]},{heading:e(`menu.export.title`),commands:[{id:`export-csv`,label:e(`menu.export.csv`),icon:Ae,tone:`green`,keywords:[`export`,`csv`,`excel`],disabled:!R,action:()=>B(()=>a(`export-csv`))},{id:`export-html`,label:e(`menu.export.schemaHtml`),icon:ke,tone:`peach`,keywords:[`export`,`html`,`schema`,`documentation`],disabled:!R,action:()=>B(()=>a(`export-html`))}]},{heading:e(`palette.groups.tools`),commands:[{id:`process-list`,capability:`processList`,label:e(`palette.commands.processList`),icon:te,tone:`red`,keywords:[`process`,`kill`,`connections`],disabled:!R,action:()=>B(()=>a(`process-list`))},{id:`variables`,capability:`variables`,label:e(`palette.commands.serverVariables`),icon:Ve,tone:`lavender`,keywords:[`variables`,`server`,`settings`],disabled:!R,action:()=>B(()=>a(`variables`))},{id:`status`,capability:`status`,label:e(`palette.commands.serverStatus`),icon:oe,tone:`teal`,keywords:[`status`,`server`,`metrics`],disabled:!R,action:()=>B(()=>a(`status`))},{id:`flush`,capability:`flush`,label:e(`palette.commands.flush`),icon:P,tone:`peach`,keywords:[`flush`,`cache`,`reload`],disabled:!R,action:()=>B(()=>a(`flush`))},{id:`user-manager`,capability:`users`,label:e(`palette.commands.userManager`),icon:pe,tone:`blue`,keywords:[`users`,`grants`,`privileges`],disabled:!R,action:()=>B(()=>a(`user-manager`))},{id:`scratchpad`,label:e(`menu.tools.scratchpad`),icon:N,tone:`yellow`,keywords:[`scratchpad`,`sqlite`,`local`],pro:`scratchpad`,action:()=>B(()=>{ie().catch(V)})},{id:`federated`,label:e(`menu.tools.federated`),icon:Ue,tone:`mauve`,keywords:[`federated`,`cross`,`join`,`connections`],pro:`federated`,action:()=>B(()=>{le().catch(V)})},{id:`erd`,label:e(`menu.tools.viewErd`),icon:Fe,tone:`sky`,keywords:[`erd`,`diagram`,`relations`],disabled:!R,action:()=>B(Ye)}]},{heading:e(`menu.settings.theme`),commands:ve().map(e=>({id:`theme-${e.id}`,label:e.name,tone:`lavender`,keywords:[`theme`,`color`,`appearance`,`dark`,`light`,e.id],checked:ge===e.id,swatch:e,action:()=>B(()=>We(e.id))}))},{heading:e(`menu.settings.language`),commands:[`auto`,...s].map(t=>({id:`locale-${t}`,label:t===`auto`?e(`language.auto`,{name:e(`language.${o()}`)}):e(`language.${t}`),icon:Pe,tone:`teal`,keywords:[`language`,`locale`,`i18n`,t],checked:Ge===t,action:()=>B(()=>Ke(t))}))},{heading:e(`menu.settings.title`),commands:[{id:`safety-settings`,label:e(`menu.settings.safety`),icon:He,tone:`yellow`,keywords:[`safety`,`settings`,`row limit`,`preferences`],action:()=>B(()=>a(`safety-settings`))}]},{heading:e(`menu.help.title`),commands:[{id:`documentation`,label:e(`menu.help.documentation`),icon:Te,tone:`blue`,keywords:[`docs`,`documentation`,`manual`,`help`],action:()=>B(()=>{window.open(fe(),`_blank`,`noopener,noreferrer`)})},{id:`getting-started`,label:e(`menu.help.gettingStarted`),icon:Re,tone:`green`,keywords:[`welcome`,`onboarding`,`sample`,`getting started`],action:()=>B(()=>l(!0))},{id:`whats-new`,label:e(`menu.help.whatsNew`),icon:I,tone:`sky`,keywords:[`whats new`,`changelog`,`release`,`update`],action:()=>B(()=>a(`whats-new`,{all:!0}))},{id:`terms`,label:e(`menu.help.terms`),icon:ze,tone:`peach`,keywords:[`terms`,`privacy`,`legal`],action:()=>B(()=>a(`terms`))},{id:`about`,label:e(`menu.help.about`),icon:ce,tone:`sky`,keywords:[`about`,`version`,`agent`],action:()=>B(()=>a(`about`))}]}];function H(e){e||r()}let U=Xe.map(e=>({...e,commands:e.commands.filter(e=>!e.capability||g[e.capability])})).filter(e=>e.commands.length>0);return(0,$.jsxs)(Tt,{open:qe,onOpenChange:H,title:e(`palette.title`),description:e(`palette.description`),children:[(0,$.jsx)(Et,{placeholder:e(`palette.inputPlaceholder`)}),(0,$.jsxs)(Dt,{className:`max-h-[60vh]`,children:[(0,$.jsx)(Ot,{children:e(`palette.empty`)}),U.map(e=>(0,$.jsx)(kt,{heading:e.heading,children:e.commands.map(t=>(0,$.jsxs)(At,{value:`${e.heading} ${t.label}`,keywords:t.keywords,disabled:t.disabled,onSelect:()=>{(!t.pro||Ce(t.pro))&&t.action()},children:[t.swatch?(0,$.jsx)(Nt,{theme:t.swatch}):t.icon?(0,$.jsx)(t.icon,{className:i(`size-4`,Mt[t.tone])}):null,(0,$.jsx)(`span`,{className:`truncate`,children:t.label}),(0,$.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[t.pro&&(0,$.jsx)(M,{className:`ml-0`}),t.checked&&(0,$.jsx)(de,{className:`size-3.5 text-catppuccin-green`}),t.shortcut&&(0,$.jsx)(jt,{className:`ml-0`,children:t.shortcut})]})]},t.id))},e.heading))]})]})}export{Pt as QuickCommandPalette};
@@ -1,3 +1,3 @@
1
- import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{i as n,r,t as i}from"./Cu_sGzNJ.js";import{t as a}from"./CgQ0qqq4.js";import{P as o,R as s}from"./S7HbowYz.js";import{n as c}from"./D8_hwGjG.js";import{n as l}from"./C1gqjEN3.js";import{C as u}from"./BkXrfAoR.js";import{g as d}from"./BnJGrP6V.js";import{E as f,Ft as p,Gt as m,Mt as h,Nt as g,Yt as _,d as v,jt as y,pt as b,wt as x,y as S}from"./CExE8dKz.js";import{a as C,c as w,d as T,f as E,h as D,i as O,l as k,m as A,n as j,o as M,p as N,r as P,s as F,t as I,u as L}from"./B7zF7RU4.js";import{n as R}from"./84VwJAQi.js";var z=e(t(),1),B=r(),V=300;function H({columns:e,rows:t,rowKey:r,readOnly:a,onEdit:o,onDelete:s,addColumns:c,onAdd:l,addExtra:u}){let{t:d}=n(),[f,m]=(0,z.useState)(null),[h,v]=(0,z.useState)(!1),[y,b]=(0,z.useState)({}),[S,C]=(0,z.useState)(!1),w=async e=>{v(!0);try{await e()}catch{}finally{v(!1)}},T=e=>w(async()=>{!f||!o||(await o(e,f.column,f.value),m(null))}),E=()=>w(async()=>{l&&(await l(y),b({}),C(!1))});return(0,B.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[!a&&l&&c&&(0,B.jsx)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center gap-2 border-b px-3 py-1.5`,children:S?(0,B.jsxs)(B.Fragment,{children:[c.map(e=>(0,B.jsx)(`input`,{className:`h-7 rounded border bg-background px-2 text-xs ${e.numeric?`w-24`:`min-w-40 flex-1`}`,placeholder:e.label,value:y[e.key]??``,onChange:t=>b({...y,[e.key]:t.target.value}),onKeyDown:e=>{e.key===`Enter`&&E()}},e.key)),u,(0,B.jsxs)(`button`,{type:`button`,disabled:h,onClick:()=>void E(),className:`flex h-7 items-center gap-1 rounded border border-primary/30 bg-primary/10 px-2 text-xs text-primary hover:bg-primary/20 disabled:opacity-40`,children:[(0,B.jsx)(_,{className:`size-3`}),d(`keyViewer.add`)]}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>{C(!1),b({})},className:`flex h-7 items-center rounded border px-2 text-xs text-muted-foreground hover:text-foreground`,children:d(`keyViewer.cancel`)})]}):(0,B.jsxs)(`button`,{type:`button`,onClick:()=>C(!0),className:`flex h-7 items-center gap-1 rounded border bg-background px-2 text-xs text-muted-foreground hover:text-foreground`,children:[(0,B.jsx)(g,{className:`size-3`}),d(`keyViewer.addRow`)]})}),(0,B.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:[(0,B.jsxs)(`table`,{className:`w-full border-collapse text-xs`,children:[(0,B.jsx)(`thead`,{className:`sticky top-0 z-10 bg-muted`,children:(0,B.jsxs)(`tr`,{children:[e.map(e=>(0,B.jsx)(`th`,{className:`border-b px-3 py-1.5 text-left font-medium text-muted-foreground ${e.numeric?`w-28`:``}`,children:e.label},e.key)),!a&&(o||s)&&(0,B.jsx)(`th`,{className:`w-16 border-b`})]})}),(0,B.jsx)(`tbody`,{children:t.map((t,n)=>{let c=r(t,n);return(0,B.jsxs)(`tr`,{className:`group border-b border-border/50 hover:bg-muted/40`,children:[e.map(e=>{let n=f?.row===c&&f.column===e.key,r=t[e.key]??``;return(0,B.jsx)(`td`,{className:`px-3 py-1 align-top font-mono ${e.numeric?`text-right tabular-nums`:``}`,children:n?(0,B.jsxs)(`div`,{className:`flex items-start gap-1`,children:[(0,B.jsx)(`textarea`,{autoFocus:!0,className:`min-h-7 w-full resize-y rounded border bg-background px-1.5 py-1 font-mono text-xs`,rows:Math.min(8,Math.max(1,r.split(`
1
+ import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{i as n,r,t as i}from"./Cu_sGzNJ.js";import{t as a}from"./CgQ0qqq4.js";import{P as o,R as s}from"./CAd2f6EE.js";import{n as c}from"./D8_hwGjG.js";import{n as l}from"./D6SRSRpo.js";import{C as u}from"./BghfQrAj.js";import{g as d}from"./DpPKm22O.js";import{E as f,Ft as p,Gt as m,Mt as h,Nt as g,Yt as _,d as v,jt as y,pt as b,wt as x,y as S}from"./B_zu4Zim.js";import{a as C,c as w,d as T,f as E,h as D,i as O,l as k,m as A,n as j,o as M,p as N,r as P,s as F,t as I,u as L}from"./DtUkSj2L.js";import{n as R}from"./CMFMZu0I.js";var z=e(t(),1),B=r(),V=300;function H({columns:e,rows:t,rowKey:r,readOnly:a,onEdit:o,onDelete:s,addColumns:c,onAdd:l,addExtra:u}){let{t:d}=n(),[f,m]=(0,z.useState)(null),[h,v]=(0,z.useState)(!1),[y,b]=(0,z.useState)({}),[S,C]=(0,z.useState)(!1),w=async e=>{v(!0);try{await e()}catch{}finally{v(!1)}},T=e=>w(async()=>{!f||!o||(await o(e,f.column,f.value),m(null))}),E=()=>w(async()=>{l&&(await l(y),b({}),C(!1))});return(0,B.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[!a&&l&&c&&(0,B.jsx)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center gap-2 border-b px-3 py-1.5`,children:S?(0,B.jsxs)(B.Fragment,{children:[c.map(e=>(0,B.jsx)(`input`,{className:`h-7 rounded border bg-background px-2 text-xs ${e.numeric?`w-24`:`min-w-40 flex-1`}`,placeholder:e.label,value:y[e.key]??``,onChange:t=>b({...y,[e.key]:t.target.value}),onKeyDown:e=>{e.key===`Enter`&&E()}},e.key)),u,(0,B.jsxs)(`button`,{type:`button`,disabled:h,onClick:()=>void E(),className:`flex h-7 items-center gap-1 rounded border border-primary/30 bg-primary/10 px-2 text-xs text-primary hover:bg-primary/20 disabled:opacity-40`,children:[(0,B.jsx)(_,{className:`size-3`}),d(`keyViewer.add`)]}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>{C(!1),b({})},className:`flex h-7 items-center rounded border px-2 text-xs text-muted-foreground hover:text-foreground`,children:d(`keyViewer.cancel`)})]}):(0,B.jsxs)(`button`,{type:`button`,onClick:()=>C(!0),className:`flex h-7 items-center gap-1 rounded border bg-background px-2 text-xs text-muted-foreground hover:text-foreground`,children:[(0,B.jsx)(g,{className:`size-3`}),d(`keyViewer.addRow`)]})}),(0,B.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:[(0,B.jsxs)(`table`,{className:`w-full border-collapse text-xs`,children:[(0,B.jsx)(`thead`,{className:`sticky top-0 z-10 bg-muted`,children:(0,B.jsxs)(`tr`,{children:[e.map(e=>(0,B.jsx)(`th`,{className:`border-b px-3 py-1.5 text-left font-medium text-muted-foreground ${e.numeric?`w-28`:``}`,children:e.label},e.key)),!a&&(o||s)&&(0,B.jsx)(`th`,{className:`w-16 border-b`})]})}),(0,B.jsx)(`tbody`,{children:t.map((t,n)=>{let c=r(t,n);return(0,B.jsxs)(`tr`,{className:`group border-b border-border/50 hover:bg-muted/40`,children:[e.map(e=>{let n=f?.row===c&&f.column===e.key,r=t[e.key]??``;return(0,B.jsx)(`td`,{className:`px-3 py-1 align-top font-mono ${e.numeric?`text-right tabular-nums`:``}`,children:n?(0,B.jsxs)(`div`,{className:`flex items-start gap-1`,children:[(0,B.jsx)(`textarea`,{autoFocus:!0,className:`min-h-7 w-full resize-y rounded border bg-background px-1.5 py-1 font-mono text-xs`,rows:Math.min(8,Math.max(1,r.split(`
2
2
  `).length)),value:f.value,onChange:e=>m({...f,value:e.target.value}),onKeyDown:e=>{e.key===`Escape`&&m(null),e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&T(t)}}),(0,B.jsx)(`button`,{type:`button`,disabled:h,title:d(`keyViewer.save`),onClick:()=>void T(t),className:`rounded p-1 text-primary hover:bg-primary/10`,children:(0,B.jsx)(_,{className:`size-3.5`})}),(0,B.jsx)(`button`,{type:`button`,title:d(`keyViewer.cancel`),onClick:()=>m(null),className:`rounded p-1 text-muted-foreground hover:bg-muted`,children:(0,B.jsx)(i,{className:`size-3.5`})})]}):e.render?e.render(r):(0,B.jsx)(`span`,{className:`whitespace-pre-wrap break-all`,title:r.length>V?r:void 0,children:r.length>V?`${r.slice(0,V)}…`:r})},e.key)}),!a&&(o||s)&&(0,B.jsx)(`td`,{className:`px-1 py-1 align-top`,children:(0,B.jsxs)(`div`,{className:`flex justify-end gap-0.5 opacity-0 group-hover:opacity-100`,children:[o&&e.some(e=>e.editable)&&(0,B.jsx)(`button`,{type:`button`,title:d(`keyViewer.edit`),onClick:()=>{let n=e.find(e=>e.editable);m({row:c,column:n.key,value:t[n.key]??``})},className:`rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,B.jsx)(p,{className:`size-3`})}),s&&(0,B.jsx)(`button`,{type:`button`,disabled:h,title:d(`keyViewer.deleteRow`),onClick:()=>void w(()=>s(t)),className:`rounded p-1 text-muted-foreground hover:bg-destructive/10 hover:text-destructive`,children:(0,B.jsx)(x,{className:`size-3`})})]})})]},c)})})]}),t.length===0&&(0,B.jsx)(`p`,{className:`p-6 text-center text-xs text-muted-foreground`,children:d(`keyViewer.empty`)})]})]})}var U=e=>e instanceof Error?e.message:String(e);function W(e){let{access:t,onChanged:n,onError:r}=e;return(0,z.useCallback)(async(e,i)=>{try{await t.write(e),await i?.(),n()}catch(e){if(e instanceof Error&&e.name===`ExecutionCancelled`)return;throw r(U(e)),e}},[t,n,r])}function G({onApply:e}){let{t}=n(),[r,i]=(0,z.useState)(``);return(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(y,{className:`size-3.5 text-muted-foreground`}),(0,B.jsx)(`input`,{className:`h-7 w-56 rounded border bg-background px-2 text-xs`,placeholder:t(`keyViewer.filterPlaceholder`),value:r,onChange:e=>i(e.target.value),onKeyDown:t=>{t.key===`Enter`&&e(j(r))}})]})}function K({shown:e,total:t,hasMore:r,onMore:i,loading:a}){let{t:o}=n();return(0,B.jsxs)(`div`,{className:`flex flex-shrink-0 items-center gap-3 border-t px-3 py-1 text-xs text-muted-foreground`,children:[(0,B.jsx)(`span`,{children:t===null?o(`keyViewer.shown`,{count:e}):o(`keyViewer.shownOf`,{count:e,total:t})}),r&&(0,B.jsx)(`button`,{type:`button`,disabled:a,onClick:i,className:`rounded border bg-background px-2 py-0.5 hover:text-foreground disabled:opacity-40`,children:o(`keyViewer.loadMore`)})]})}function q({props:e,load:t,save:r}){let{t:i}=n(),[a,o]=(0,z.useState)(null),[s,c]=(0,z.useState)(``),[l,u]=(0,z.useState)(!1),[d,p]=(0,z.useState)(`preview`),[m,h]=(0,z.useState)(!1),{onError:g}=e,_=(0,z.useCallback)(async(e=!1)=>{try{let n=await t(e);o(n.text),c(n.text),u(n.partial)}catch(e){g(U(e))}},[t,g]);(0,z.useEffect)(()=>{Promise.resolve().then(()=>_())},[_]);let y=S(s),b=d===`preview`&&y.kind!==`text`,x=a!==null&&s!==a,C=async()=>{h(!0);try{await r(s),o(s)}catch{}finally{h(!1)}};if(a===null)return(0,B.jsx)(`p`,{className:`p-6 text-xs text-muted-foreground`,children:i(`keyViewer.loading`)});let w=e=>`rounded px-2 py-0.5 ${e?`bg-primary/15 text-primary`:`text-muted-foreground hover:text-foreground`}`;return(0,B.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,B.jsxs)(`div`,{className:`flex flex-shrink-0 items-center gap-2 border-b px-3 py-1.5 text-xs`,children:[y.kind!==`text`&&(0,B.jsxs)(`div`,{className:`flex items-center gap-0.5 rounded border p-0.5`,children:[(0,B.jsx)(`button`,{type:`button`,className:w(b),onClick:()=>p(`preview`),children:i(y.kind===`json`?`keyViewer.viewTree`:`keyViewer.viewHtml`)}),(0,B.jsx)(`button`,{type:`button`,className:w(!b),onClick:()=>p(`text`),children:i(`keyViewer.viewText`)})]}),!b&&y.kind===`json`&&!e.access.readOnly&&!l&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>c(A(s)??s),className:`rounded border bg-background px-2 py-0.5 text-muted-foreground hover:text-foreground`,children:i(`keyViewer.formatJson`)}),l&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`text-catppuccin-yellow`,children:i(`keyViewer.truncated`,{size:P(1048576)})}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>void _(!0),className:`rounded border bg-background px-2 py-0.5 text-muted-foreground hover:text-foreground`,children:i(`keyViewer.loadFull`)})]}),(0,B.jsx)(`div`,{className:`flex-1`}),!e.access.readOnly&&!l&&(0,B.jsxs)(B.Fragment,{children:[x&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>c(a),className:`rounded border bg-background px-2 py-0.5 text-muted-foreground hover:text-foreground`,children:i(`keyViewer.revert`)}),(0,B.jsx)(`button`,{type:`button`,disabled:!x||m,onClick:()=>void C(),className:`rounded border border-primary/30 bg-primary/10 px-2 py-0.5 text-primary hover:bg-primary/20 disabled:opacity-40`,children:i(`keyViewer.save`)})]})]}),b&&y.kind===`json`?(0,B.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto py-3 pl-7 pr-3 font-mono text-xs`,children:(0,B.jsx)(f,{value:y.document,defaultExpanded:!0})}):b&&y.kind===`html`?(0,B.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,B.jsx)(v,{html:s})}):(0,B.jsx)(`textarea`,{className:`min-h-0 flex-1 resize-none bg-background p-3 font-mono text-xs outline-none`,spellCheck:!1,readOnly:e.access.readOnly||l,value:s,onChange:e=>c(e.target.value)})]})}function J(e){let{access:t,keyName:n,length:r,ttl:i}=e,a=W(e),o=(0,z.useCallback)(async e=>{let i=!e&&r!==null&&r>1048576,a=await t.read(C.getString(n,i?I:void 0));return{text:a==null?``:String(a),partial:i}},[t,n,r]),s=(0,z.useCallback)(async e=>{try{await a(C.setString(n,e))}catch(t){if(!/syntax|KEEPTTL/i.test(U(t)))throw t;await a(C.setStringWithTtl(n,e,i))}},[a,n,i]);return(0,B.jsx)(q,{props:e,load:o,save:s})}function Y(e){let{access:t,keyName:n}=e,r=W(e),i=(0,z.useCallback)(async()=>{let e=await t.read(C.getJson(n));return{text:e==null?``:String(e),partial:!1}},[t,n]),a=(0,z.useCallback)(async e=>{JSON.parse(e),await r(C.setJson(n,e))},[r,n]);return(0,B.jsx)(q,{props:e,load:i,save:a})}function X(e,t,n){let{access:r,onError:i}=e,[a,o]=(0,z.useState)([]),[s,c]=(0,z.useState)(`0`),[l,u]=(0,z.useState)(``),[d,f]=(0,z.useState)(!1),[p,m]=(0,z.useState)(!1),h=(0,z.useCallback)(async(e,a,s)=>{f(!0);try{let i=e,l=[];do{let e=n(await r.read(t(i,a)));l.push(...e.items),i=e.cursor}while(i!==`0`&&l.length===0);o(e=>s?[...e,...l]:l),c(i),m(!0)}catch(e){i(U(e))}finally{f(!1)}},[r,t,n,i]);return(0,z.useEffect)(()=>{Promise.resolve().then(()=>h(`0`,l,!1))},[h,l]),{items:a,setItems:o,loading:d,started:p,hasMore:p&&s!==`0`,loadMore:()=>void h(s,l,!0),applyFilter:u,reload:()=>void h(`0`,l,!1)}}function Z(e){let{t}=n(),{keyName:r,length:i,access:a}=e,o=W(e),s=X(e,(0,z.useCallback)((e,t)=>C.scan(r,`hash`,e,t),[r]),w),c=[{key:`field`,label:t(`keyViewer.field`)},{key:`value`,label:t(`keyViewer.value`),editable:!0}];return(0,B.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,B.jsx)(`div`,{className:`flex flex-shrink-0 items-center gap-2 border-b px-3 py-1.5`,children:(0,B.jsx)(G,{onApply:s.applyFilter})}),(0,B.jsx)(H,{columns:c,rows:s.items.map(e=>({field:e.field,value:e.value})),rowKey:e=>e.field,readOnly:a.readOnly,onEdit:(e,t,n)=>o(C.hashSet(r,e.field,n),()=>{s.setItems(t=>t.map(t=>t.field===e.field?{...t,value:n}:t))}),onDelete:e=>o(C.hashDelete(r,e.field),()=>{s.setItems(t=>t.filter(t=>t.field!==e.field))}),addColumns:c.map(e=>({...e,editable:!1})),onAdd:e=>o(C.hashSet(r,e.field??``,e.value??``),s.reload)}),(0,B.jsx)(K,{shown:s.items.length,total:i,hasMore:s.hasMore,onMore:s.loadMore,loading:s.loading})]})}function Q(e){let{t}=n(),{keyName:r,length:i,access:a}=e,o=W(e),s=X(e,(0,z.useCallback)((e,t)=>C.scan(r,`set`,e,t),[r]),L),c=[{key:`member`,label:t(`keyViewer.member`)}];return(0,B.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,B.jsx)(`div`,{className:`flex flex-shrink-0 items-center gap-2 border-b px-3 py-1.5`,children:(0,B.jsx)(G,{onApply:s.applyFilter})}),(0,B.jsx)(H,{columns:c,rows:s.items.map(e=>({member:e})),rowKey:e=>e.member,readOnly:a.readOnly,onDelete:e=>o(C.setRemove(r,e.member),()=>{s.setItems(t=>t.filter(t=>t!==e.member))}),addColumns:c,onAdd:e=>o(C.setAdd(r,e.member??``),s.reload)}),(0,B.jsx)(K,{shown:s.items.length,total:i,hasMore:s.hasMore,onMore:s.loadMore,loading:s.loading})]})}function ee(e){let{t}=n(),{keyName:r,length:i,access:a}=e,o=W(e),s=X(e,(0,z.useCallback)((e,t)=>C.scan(r,`zset`,e,t),[r]),N),c=[{key:`member`,label:t(`keyViewer.member`)},{key:`score`,label:t(`keyViewer.score`),editable:!0,numeric:!0}],l=[...s.items].sort((e,t)=>Number(e.score)-Number(t.score)).map(e=>({member:e.member,score:e.score}));return(0,B.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,B.jsx)(`div`,{className:`flex flex-shrink-0 items-center gap-2 border-b px-3 py-1.5`,children:(0,B.jsx)(G,{onApply:s.applyFilter})}),(0,B.jsx)(H,{columns:c,rows:l,rowKey:e=>e.member,readOnly:a.readOnly,onEdit:(e,t,n)=>o(C.zsetAdd(r,e.member,n.trim()),()=>{s.setItems(t=>t.map(t=>t.member===e.member?{...t,score:n.trim()}:t))}),onDelete:e=>o(C.zsetRemove(r,e.member),()=>{s.setItems(t=>t.filter(t=>t.member!==e.member))}),addColumns:[{key:`member`,label:t(`keyViewer.member`)},{key:`score`,label:t(`keyViewer.score`),numeric:!0}],onAdd:e=>o(C.zsetAdd(r,e.member??``,(e.score??`0`).trim()||`0`),s.reload)}),(0,B.jsx)(K,{shown:s.items.length,total:i,hasMore:s.hasMore,onMore:s.loadMore,loading:s.loading})]})}function te(e){let{t}=n(),{keyName:r,length:i,access:a,onError:o}=e,s=W(e),[c,l]=(0,z.useState)([]),[u,d]=(0,z.useState)(!1),[f,p]=(0,z.useState)(!1),m=(0,z.useCallback)(async e=>{d(!0);try{let t=k(await a.read(C.listRange(r,e)));l(n=>e===0?t:[...n,...t])}catch(e){o(U(e))}finally{d(!1)}},[a,r,o]);(0,z.useEffect)(()=>{Promise.resolve().then(()=>m(0))},[m]);let h=[{key:`index`,label:t(`keyViewer.index`),numeric:!0},{key:`value`,label:t(`keyViewer.value`),editable:!0}];return(0,B.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,B.jsx)(H,{columns:h,rows:c.map((e,t)=>({index:String(t),value:e})),rowKey:e=>e.index,readOnly:a.readOnly,onEdit:(e,t,n)=>s(C.listSet(r,Number(e.index),n),()=>{l(t=>t.map((t,r)=>r===Number(e.index)?n:t))}),onDelete:async e=>{let t=M();await s(C.listSet(r,Number(e.index),t)),await s(C.listRemoveOne(r,t),()=>m(0))},addColumns:[{key:`value`,label:t(`keyViewer.value`)}],addExtra:(0,B.jsxs)(`select`,{value:f?`head`:`tail`,onChange:e=>p(e.target.value===`head`),className:`h-7 rounded border bg-background px-1 text-xs`,children:[(0,B.jsx)(`option`,{value:`tail`,children:t(`keyViewer.pushTail`)}),(0,B.jsx)(`option`,{value:`head`,children:t(`keyViewer.pushHead`)})]}),onAdd:e=>s(C.listPush(r,e.value??``,f),()=>m(0))}),(0,B.jsx)(K,{shown:c.length,total:i,hasMore:i!==null&&c.length<i,onMore:()=>void m(c.length),loading:u})]})}function ne(e){let{t}=n(),{keyName:r,length:i,access:a,onError:o}=e,s=W(e),[c,l]=(0,z.useState)([]),[u,d]=(0,z.useState)(!1),f=(0,z.useCallback)(async e=>{d(!0);try{let t=T(await a.read(C.streamRange(r,e)));l(n=>e?[...n,...t]:t)}catch(e){o(U(e))}finally{d(!1)}},[a,r,o]);(0,z.useEffect)(()=>{Promise.resolve().then(()=>f())},[f]);let p=c.map(e=>({id:e.id,fields:JSON.stringify(e.fields)})),m=[{key:`id`,label:t(`keyViewer.entryId`)},{key:`fields`,label:t(`keyViewer.fields`),render:e=>(0,B.jsx)(`dl`,{className:`grid grid-cols-[max-content_1fr] gap-x-3`,children:JSON.parse(e).map(([e,t],n)=>(0,B.jsxs)(`div`,{className:`contents`,children:[(0,B.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,B.jsx)(`dd`,{className:`break-all`,children:t})]},n))})}];return(0,B.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,B.jsx)(H,{columns:m,rows:p,rowKey:e=>e.id,readOnly:a.readOnly,onDelete:e=>s(C.streamDelete(r,e.id),()=>{l(t=>t.filter(t=>t.id!==e.id))}),addColumns:[{key:`fields`,label:t(`keyViewer.entryFieldsPlaceholder`)}],onAdd:e=>{let n=F((e.fields??``).replaceAll(`;`,`
3
3
  `));return n.length===0?(o(t(`keyViewer.entryFieldsRequired`)),Promise.reject(Error(t(`keyViewer.entryFieldsRequired`)))):s(C.streamAdd(r,n),()=>f())}}),(0,B.jsx)(K,{shown:c.length,total:i,hasMore:i!==null&&c.length<i,onMore:()=>void f(c[c.length-1]?.id),loading:u})]})}var re={string:J,hash:Z,list:te,set:Q,zset:ee,stream:ne,"ReJSON-RL":Y};function $(e,t,n,r=null){for(let i of e){if(i.type===s.KEY&&i.metadata?.database===t&&i.metadata.key===n)return r;let e=$(i.children,t,n,i);if(e)return e}return null}function ie({connectionId:e,tabId:t,item:r}){let{t:s}=n(),f=R(e,t,r),{loadChildren:g}=d(),[v,y]=(0,z.useState)(null),[S,w]=(0,z.useState)(!1),[T,k]=(0,z.useState)(null),[A,j]=(0,z.useState)(0),[M,N]=(0,z.useState)(null),[F,I]=(0,z.useState)(null),L=r.name,V=(0,z.useCallback)(async()=>{if(f.connected)try{let e=String(await f.read(C.type(L)));if(e===`none`){w(!0),y(null);return}let t=C.length(L,e),[n,r,i,a]=await Promise.all([f.read(C.ttl(L)),t?f.tryRead(t):Promise.resolve(null),f.tryRead(C.memory(L)),f.tryRead(C.encoding(L))]),o=E(n);w(o===`gone`),y({type:e,ttl:o===`gone`?null:o,length:D(r),memory:D(i),encoding:typeof a==`string`?a:null})}catch(e){k(e instanceof Error?e.message:String(e))}},[f,L]);(0,z.useEffect)(()=>{Promise.resolve().then(()=>V())},[V]);let H=(0,z.useCallback)(t=>{let n=$(u.getState().trees[e]??[],r.database,t);n&&g(e,n)},[e,r.database,g]),U=async e=>{try{k(null),await e()}catch(e){if(e instanceof Error&&e.name===`ExecutionCancelled`)return;k(e instanceof Error?e.message:String(e))}},W=n=>U(async()=>{if(!n||n===L){N(null);return}let i=await f.write(C.renameIfFree(L,n));if(Number(i)!==1)throw Error(s(`keyViewer.renameTaken`,{name:n}));N(null),H(L),l.getState().setSourceItem(e,t,{database:r.database,name:n})}),G=e=>U(async()=>{let t=Number(e);if(e.trim()===``)await f.write(C.persist(L));else if(!Number.isInteger(t)||t<=0)throw Error(s(`keyViewer.ttlInvalid`));else await f.write(C.expire(L,t));I(null),await V()}),K=()=>U(async()=>{let n=C.remove(L);await c.getState().requestDestructiveConfirm({title:s(`keyViewer.deleteTitle`,{name:L}),description:s(`keyViewer.deleteDescription`),statements:[n],confirmLabel:s(`keyViewer.delete`)})&&(await f.write(n,{confirmed:!0}),H(L),l.getState().removeQueryTab(e,t))}),q=()=>{v&&b(e,o(v.type,L),r.database,L)};if(!f.connected)return(0,B.jsx)(`p`,{className:`p-6 text-sm text-muted-foreground`,children:s(`keyViewer.notConnected`)});let J=v?re[v.type]:void 0,Y=`flex h-7 items-center gap-1 rounded border bg-background px-2 text-xs text-muted-foreground hover:text-foreground disabled:opacity-40`;return(0,B.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,B.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center gap-x-3 gap-y-1.5 border-b bg-muted/30 px-3 py-1.5 text-xs`,children:[v&&(0,B.jsx)(`span`,{className:`rounded bg-primary/15 px-1.5 py-0.5 font-mono text-[10px] font-semibold uppercase text-primary`,children:v.type===`ReJSON-RL`?`json`:v.type}),M===null?(0,B.jsxs)(`span`,{className:`flex items-center gap-1 font-mono text-sm font-medium`,children:[L,!f.readOnly&&!S&&(0,B.jsx)(`button`,{type:`button`,title:s(`keyViewer.rename`),onClick:()=>N(L),className:`rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,B.jsx)(p,{className:`size-3`})})]}):(0,B.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(`input`,{autoFocus:!0,className:`h-7 w-72 rounded border bg-background px-2 font-mono text-xs`,value:M,onChange:e=>N(e.target.value),onKeyDown:e=>{e.key===`Enter`&&W(M),e.key===`Escape`&&N(null)}}),(0,B.jsx)(`button`,{type:`button`,title:s(`keyViewer.save`),onClick:()=>void W(M),className:`rounded p-1 text-primary hover:bg-primary/10`,children:(0,B.jsx)(_,{className:`size-3.5`})}),(0,B.jsx)(`button`,{type:`button`,title:s(`keyViewer.cancel`),onClick:()=>N(null),className:`rounded p-1 text-muted-foreground hover:bg-muted`,children:(0,B.jsx)(i,{className:`size-3.5`})})]}),v&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-1 text-muted-foreground`,children:[(0,B.jsx)(m,{className:`size-3`}),F===null?(0,B.jsx)(`button`,{type:`button`,disabled:f.readOnly,onClick:()=>I(v.ttl===null?``:String(v.ttl)),className:`rounded px-1 hover:bg-muted hover:text-foreground disabled:hover:bg-transparent`,title:f.readOnly?void 0:s(`keyViewer.ttlEdit`),children:v.ttl===null?s(`keyViewer.noExpiry`):O(v.ttl)}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`input`,{autoFocus:!0,className:`h-6 w-24 rounded border bg-background px-1.5 text-xs`,placeholder:s(`keyViewer.ttlPlaceholder`),value:F,onChange:e=>I(e.target.value),onKeyDown:e=>{e.key===`Enter`&&G(F),e.key===`Escape`&&I(null)}}),(0,B.jsx)(`button`,{type:`button`,title:s(`keyViewer.save`),onClick:()=>void G(F),className:`rounded p-1 text-primary hover:bg-primary/10`,children:(0,B.jsx)(_,{className:`size-3.5`})}),(0,B.jsx)(`button`,{type:`button`,title:s(`keyViewer.cancel`),onClick:()=>I(null),className:`rounded p-1 hover:bg-muted`,children:(0,B.jsx)(i,{className:`size-3.5`})})]})]}),v.length!==null&&(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:s(v.type===`string`?`keyViewer.bytes`:`keyViewer.length`,{count:v.length})}),(0,B.jsx)(`span`,{className:`text-muted-foreground`,title:v.encoding?s(`keyViewer.encoding`,{encoding:v.encoding}):void 0,children:s(`keyViewer.memory`,{size:P(v.memory)})})]}),(0,B.jsx)(`div`,{className:`flex-1`}),(0,B.jsxs)(`button`,{type:`button`,className:Y,onClick:()=>{k(null),j(e=>e+1),V()},children:[(0,B.jsx)(h,{className:`size-3`}),s(`keyViewer.refresh`)]}),(0,B.jsxs)(`button`,{type:`button`,className:Y,disabled:!v,onClick:q,children:[(0,B.jsx)(a,{className:`size-3`}),s(`keyViewer.openInConsole`)]}),!f.readOnly&&!S&&(0,B.jsxs)(`button`,{type:`button`,className:`${Y} hover:border-destructive/40 hover:text-destructive`,onClick:()=>void K(),children:[(0,B.jsx)(x,{className:`size-3`}),s(`keyViewer.delete`)]})]}),T&&(0,B.jsxs)(`div`,{className:`flex flex-shrink-0 items-start gap-2 border-b border-destructive/30 bg-destructive/10 px-3 py-1.5 text-xs text-destructive`,children:[(0,B.jsx)(`span`,{className:`flex-1 whitespace-pre-wrap`,children:T}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>k(null),children:(0,B.jsx)(i,{className:`size-3.5`})})]}),S?(0,B.jsx)(`p`,{className:`p-6 text-sm text-muted-foreground`,children:s(`keyViewer.gone`)}):v?J?(0,B.jsx)(J,{access:f,keyName:L,length:v.length,ttl:v.ttl,onChanged:()=>void V(),onError:k},`${L}:${A}`):(0,B.jsx)(`p`,{className:`p-6 text-sm text-muted-foreground`,children:s(`keyViewer.unsupported`,{type:v.type})}):(0,B.jsx)(`p`,{className:`p-6 text-sm text-muted-foreground`,children:s(`keyViewer.loading`)})]})}export{ie as RedisKeyViewer};
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{i as n,r}from"./Cu_sGzNJ.js";import{F as i}from"./S7HbowYz.js";import{n as a}from"./D8_hwGjG.js";import{t as o}from"./84VwJAQi.js";import{s}from"./Udlj1Cgf.js";import{t as c}from"./BQ1Rcyw6.js";import{t as l}from"./_zaonxnw.js";var u=e(t(),1),d=r(),f=128;function p({connectionId:e,tabId:t}){let{t:r}=n(),p=o(e,t,``),[m,h]=(0,u.useState)(null),[g,_]=(0,u.useState)(null),[v,y]=(0,u.useState)(null),b=(0,u.useCallback)(async()=>{try{h(s(await p.read(`SLOWLOG GET ${f}`)));let e=await p.tryRead(`CONFIG GET slowlog-log-slower-than`);_(Array.isArray(e)&&e.length===2?String(e[1]):null),y(null)}catch(e){y(l(e))}},[p]);(0,u.useEffect)(()=>{Promise.resolve().then(()=>b())},[b]);let x=async()=>{if(await a.getState().requestDestructiveConfirm({title:r(`tools.redis.slowlogResetTitle`),description:r(`tools.redis.slowlogResetDescription`),statements:[`SLOWLOG RESET`],confirmLabel:r(`tools.redis.slowlogReset`)}))try{await p.write(`SLOWLOG RESET`,{confirmed:!0}),await b()}catch(e){e instanceof Error&&e.name===`ExecutionCancelled`||y(l(e))}};return(0,d.jsxs)(c,{title:r(`tools.redis.slowlog`),onRefresh:b,error:v,onDismissError:()=>y(null),actions:(0,d.jsxs)(d.Fragment,{children:[g!==null&&(0,d.jsx)(`span`,{className:`text-muted-foreground`,children:r(`tools.redis.slowlogThreshold`,{ms:(Number(g)/1e3).toLocaleString()})}),!p.readOnly&&(0,d.jsx)(`button`,{type:`button`,onClick:()=>void x(),className:`flex h-7 items-center rounded border bg-background px-2 text-muted-foreground hover:border-destructive/40 hover:text-destructive`,children:r(`tools.redis.slowlogReset`)})]}),children:[m&&m.length===0&&(0,d.jsx)(`p`,{className:`p-6 text-xs text-muted-foreground`,children:r(`tools.redis.slowlogEmpty`)}),m&&m.length>0&&(0,d.jsxs)(`table`,{className:`w-full border-collapse text-xs`,children:[(0,d.jsx)(`thead`,{className:`sticky top-0 bg-muted text-left text-muted-foreground`,children:(0,d.jsxs)(`tr`,{children:[(0,d.jsx)(`th`,{className:`px-3 py-1.5`,children:`id`}),(0,d.jsx)(`th`,{className:`px-3 py-1.5`,children:r(`tools.redis.time`)}),(0,d.jsx)(`th`,{className:`px-3 py-1.5 text-right`,children:r(`tools.redis.duration`)}),(0,d.jsx)(`th`,{className:`px-3 py-1.5`,children:r(`tools.redis.command`)}),(0,d.jsx)(`th`,{className:`px-3 py-1.5`,children:r(`tools.redis.client`)})]})}),(0,d.jsx)(`tbody`,{children:m.map(e=>(0,d.jsxs)(`tr`,{className:`border-b border-border/50 hover:bg-muted/40`,children:[(0,d.jsx)(`td`,{className:`px-3 py-1 tabular-nums text-muted-foreground`,children:e.id}),(0,d.jsx)(`td`,{className:`whitespace-nowrap px-3 py-1`,children:new Date(e.time*1e3).toLocaleString()}),(0,d.jsxs)(`td`,{className:`px-3 py-1 text-right tabular-nums`,children:[(e.durationMicros/1e3).toFixed(2),` ms`]}),(0,d.jsx)(`td`,{className:`break-all px-3 py-1 font-mono`,children:e.args.map(i).join(` `)}),(0,d.jsx)(`td`,{className:`px-3 py-1 font-mono text-muted-foreground`,children:[e.client,e.clientName].filter(Boolean).join(` · `)})]},e.id))})]})]})}export{p as SlowLog};
1
+ import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{i as n,r}from"./Cu_sGzNJ.js";import{F as i}from"./CAd2f6EE.js";import{n as a}from"./D8_hwGjG.js";import{t as o}from"./CMFMZu0I.js";import{s}from"./Udlj1Cgf.js";import{t as c}from"./TqO-pPrr.js";import{t as l}from"./_zaonxnw.js";var u=e(t(),1),d=r(),f=128;function p({connectionId:e,tabId:t}){let{t:r}=n(),p=o(e,t,``),[m,h]=(0,u.useState)(null),[g,_]=(0,u.useState)(null),[v,y]=(0,u.useState)(null),b=(0,u.useCallback)(async()=>{try{h(s(await p.read(`SLOWLOG GET ${f}`)));let e=await p.tryRead(`CONFIG GET slowlog-log-slower-than`);_(Array.isArray(e)&&e.length===2?String(e[1]):null),y(null)}catch(e){y(l(e))}},[p]);(0,u.useEffect)(()=>{Promise.resolve().then(()=>b())},[b]);let x=async()=>{if(await a.getState().requestDestructiveConfirm({title:r(`tools.redis.slowlogResetTitle`),description:r(`tools.redis.slowlogResetDescription`),statements:[`SLOWLOG RESET`],confirmLabel:r(`tools.redis.slowlogReset`)}))try{await p.write(`SLOWLOG RESET`,{confirmed:!0}),await b()}catch(e){e instanceof Error&&e.name===`ExecutionCancelled`||y(l(e))}};return(0,d.jsxs)(c,{title:r(`tools.redis.slowlog`),onRefresh:b,error:v,onDismissError:()=>y(null),actions:(0,d.jsxs)(d.Fragment,{children:[g!==null&&(0,d.jsx)(`span`,{className:`text-muted-foreground`,children:r(`tools.redis.slowlogThreshold`,{ms:(Number(g)/1e3).toLocaleString()})}),!p.readOnly&&(0,d.jsx)(`button`,{type:`button`,onClick:()=>void x(),className:`flex h-7 items-center rounded border bg-background px-2 text-muted-foreground hover:border-destructive/40 hover:text-destructive`,children:r(`tools.redis.slowlogReset`)})]}),children:[m&&m.length===0&&(0,d.jsx)(`p`,{className:`p-6 text-xs text-muted-foreground`,children:r(`tools.redis.slowlogEmpty`)}),m&&m.length>0&&(0,d.jsxs)(`table`,{className:`w-full border-collapse text-xs`,children:[(0,d.jsx)(`thead`,{className:`sticky top-0 bg-muted text-left text-muted-foreground`,children:(0,d.jsxs)(`tr`,{children:[(0,d.jsx)(`th`,{className:`px-3 py-1.5`,children:`id`}),(0,d.jsx)(`th`,{className:`px-3 py-1.5`,children:r(`tools.redis.time`)}),(0,d.jsx)(`th`,{className:`px-3 py-1.5 text-right`,children:r(`tools.redis.duration`)}),(0,d.jsx)(`th`,{className:`px-3 py-1.5`,children:r(`tools.redis.command`)}),(0,d.jsx)(`th`,{className:`px-3 py-1.5`,children:r(`tools.redis.client`)})]})}),(0,d.jsx)(`tbody`,{children:m.map(e=>(0,d.jsxs)(`tr`,{className:`border-b border-border/50 hover:bg-muted/40`,children:[(0,d.jsx)(`td`,{className:`px-3 py-1 tabular-nums text-muted-foreground`,children:e.id}),(0,d.jsx)(`td`,{className:`whitespace-nowrap px-3 py-1`,children:new Date(e.time*1e3).toLocaleString()}),(0,d.jsxs)(`td`,{className:`px-3 py-1 text-right tabular-nums`,children:[(e.durationMicros/1e3).toFixed(2),` ms`]}),(0,d.jsx)(`td`,{className:`break-all px-3 py-1 font-mono`,children:e.args.map(i).join(` `)}),(0,d.jsx)(`td`,{className:`px-3 py-1 font-mono text-muted-foreground`,children:[e.client,e.clientName].filter(Boolean).join(` · `)})]},e.id))})]})]})}export{p as SlowLog};
@@ -1,3 +1,3 @@
1
- import{r as e}from"./hePW80VL.js";import{o as t,p as n}from"./CYz610vE.js";import{t as r}from"./CiL8zoYm.js";import{i,r as a}from"./Cu_sGzNJ.js";import{a as o,i as s,n as c,o as l,t as u}from"./DzRyVlxz.js";import{a as d,i as f,n as p,r as m,t as h}from"./G06qjCej.js";import{R as g,t as _}from"./S7HbowYz.js";import{n as v,t as y}from"./D8_hwGjG.js";import{n as b}from"./C1gqjEN3.js";import{a as x}from"./BkXrfAoR.js";import{r as S}from"./BRZhVXRC.js";import{p as ee}from"./BnJGrP6V.js";import{F as te,G as C,c as w,l as ne}from"./CExE8dKz.js";import{t as T}from"./CnYBZPf9.js";var E=e(n(),1);function D(e,t){let n=e==null?``:typeof e==`object`?JSON.stringify(e):String(e);return!(typeof e==`number`||typeof e==`bigint`||/^[-+]?\d+(\.\d+)?([eE][-+]?\d+)?$/.test(n))&&/^[=+\-@\t\r]/.test(n)&&(n=`'${n}`),n.includes(t)||n.includes(`"`)||n.includes(`
1
+ import{r as e}from"./hePW80VL.js";import{o as t,p as n}from"./CYz610vE.js";import{t as r}from"./CiL8zoYm.js";import{i,r as a}from"./Cu_sGzNJ.js";import{a as o,i as s,n as c,o as l,t as u}from"./DzRyVlxz.js";import{a as d,i as f,n as p,r as m,t as h}from"./B3qo2BmL.js";import{R as g,t as _}from"./CAd2f6EE.js";import{n as v,t as y}from"./D8_hwGjG.js";import{n as b}from"./D6SRSRpo.js";import{a as x}from"./BghfQrAj.js";import{r as S}from"./Ci1xBOLy.js";import{p as ee}from"./DpPKm22O.js";import{F as te,G as C,c as w,l as ne}from"./B_zu4Zim.js";import{t as T}from"./CnYBZPf9.js";var E=e(n(),1);function D(e,t){let n=e==null?``:typeof e==`object`?JSON.stringify(e):String(e);return!(typeof e==`number`||typeof e==`bigint`||/^[-+]?\d+(\.\d+)?([eE][-+]?\d+)?$/.test(n))&&/^[=+\-@\t\r]/.test(n)&&(n=`'${n}`),n.includes(t)||n.includes(`"`)||n.includes(`
2
2
  `)||n.includes(`\r`)?`"${n.replace(/"/g,`""`)}"`:n}var O=(e,t)=>e.map(e=>D(e,t)).join(t)+`
3
3
  `,k=e=>e===` `,A=e=>k(e)?`TSV`:`CSV`,j=e=>k(e)?`.tsv`:`.csv`,M=e=>k(e)?`text/tab-separated-values`:`text/csv`;async function N(e,t){let n=T(e),r=M(t);if(typeof window.showSaveFilePicker==`function`)try{let e=await(await window.showSaveFilePicker({suggestedName:n,types:[{description:A(t),accept:{[r]:[j(t)]}}]})).createWritable();return await e.write(``),{write:t=>e.write(t),finish:()=>e.close(),abort:()=>e.abort()}}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)throw new P}let i=[``];return{write:async e=>{i.push(e)},finish:async()=>{let e=new Blob(i,{type:`${r};charset=utf-8;`}),t=URL.createObjectURL(e),a=document.createElement(`a`);a.href=t,a.download=n,a.click(),URL.revokeObjectURL(t)},abort:async()=>{i.length=0}}}var P=class extends Error{constructor(){super(`CSV export cancelled`)}};async function F(e){let n=await N(`${e.table}${j(e.delimiter)}`,e.delimiter),r=0;try{let i=await C({connectionId:e.connectionId,database:e.database,table:e.table,signal:e.signal,onProgress:e.onProgress}),a=i.fields.map(e=>e.name);e.includeHeaders&&await n.write(O(a,e.delimiter));for await(let t of i.pages)await n.write(t.map(t=>O(a.map(e=>t[e]),e.delimiter)).join(``)),r+=t.length;return await n.finish(),t(`export_csv`,{origin:`table`,rows:r,format:A(e.delimiter)}),r}catch(e){throw await n.abort().catch(()=>void 0),e}}function re(e,n,r,i,a){let o=e.map(e=>e.name),s=[``];i&&s.push(O(o,r));for(let e of n)s.push(O(o.map(t=>e[t]),r));let c=new Blob(s,{type:`${M(r)};charset=utf-8;`}),l=URL.createObjectURL(c),u=document.createElement(`a`);u.href=l,u.download=T(a??`query_result${j(r)}`),u.click(),URL.revokeObjectURL(l),t(`export_csv`,{origin:`result`,rows:n.length,format:A(r)})}var I=a(),ie=[{value:`,`,label:`database.csv.delimiterComma`},{value:` `,label:`database.csv.delimiterTab`},{value:`;`,label:`database.csv.delimiterSemicolon`},{value:`|`,label:`database.csv.delimiterPipe`}];function L(){let{t:e}=i(),{activeDialog:t,closeDialog:n}=v(),a=y(`export-csv`),C=_(e=>e.activeConnectionId),T=b(),D=t===`export-csv`,[O,A]=(0,E.useState)(`query_result`),[j,M]=(0,E.useState)(``),[N,L]=(0,E.useState)([]),[R,z]=(0,E.useState)(``),[B,V]=(0,E.useState)(`,`),[H,U]=(0,E.useState)(!0),[W,G]=(0,E.useState)(!1),[K,q]=(0,E.useState)(null),[J,Y]=(0,E.useState)(null),X=(0,E.useRef)(null),Z=k(B)?`TSV`:`CSV`,Q=()=>{if(a?.nodeText&&(a.nodeType===g.TABLE||a.nodeType===g.VIEW)){let e=a.metadata?.database;return{table:a.nodeText,database:typeof e==`string`?e:``}}if(!C)return null;let e=(T.tabs[C]??[]).find(e=>e.id===T.activeTabId[C]);return e?.sourceTable?{table:e.sourceTable.table,database:e.sourceTable.database}:null};(0,E.useEffect)(()=>{if(!D)return;let e=Q();V(a?.delimiter??`,`),e&&(M(e.table),A(`table_data`))},[D]),(0,E.useEffect)(()=>{if(!D||!C)return;let e=_.getState().activeConnections.find(e=>e.id===C);if(!e?.serverConnectionId)return;let t=!1;return(async()=>{try{let n=await S(C).introspect.listDatabases(x(e.serverConnectionId));if(t)return;L(n);let r=T.tabs[C]?.find(e=>e.id===T.activeTabId[C])?.database||``,i=Q()?.database||``;z(e=>n.includes(i)?i:n.includes(e)?e:n.includes(r)?r:n.length===1?n[0]:``)}catch{t||L([])}})(),()=>{t=!0}},[D,C]);function $(e){if(!e){if(W){X.current?.abort();return}n(),A(`query_result`),M(``),V(`,`),U(!0)}}async function ae(){if(!C)return;if(Y(null),O===`query_result`){let e=T.activeTabId[C],t=(T.tabs[C]??[]).find(t=>t.id===e)?.results?.[0];if(!t||t.rows.length===0)return;re(t.fields,t.rows,B,H),n();return}if(!j.trim()||!R)return;let t=new AbortController;X.current=t,G(!0),q({loaded:0,total:null});try{let r=await F({connectionId:C,database:R,table:j.trim(),delimiter:B,includeHeaders:H,onProgress:q,signal:t.signal});v.getState().setFooterMessage(e(`database.csv.done`,{count:r,table:j.trim(),format:Z})),n()}catch(e){!(e instanceof P)&&!(e instanceof ee&&t.signal.aborted)&&Y(e instanceof Error?e.message:String(e))}finally{G(!1),q(null),X.current=null}}let oe=K?.total?Math.min(100,Math.round(K.loaded/K.total*100)):null;return(0,I.jsx)(u,{open:D,onOpenChange:$,children:(0,I.jsxs)(c,{className:`sm:max-w-[450px]`,children:[(0,I.jsx)(o,{children:(0,I.jsx)(l,{children:e(`database.csv.title`,{format:Z})})}),(0,I.jsxs)(`div`,{className:`space-y-4`,children:[(0,I.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,I.jsx)(w,{children:e(`database.csv.target`)}),(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsxs)(`label`,{className:`flex items-center gap-2 text-sm cursor-pointer`,children:[(0,I.jsx)(`input`,{type:`radio`,name:`csv-target`,value:`query_result`,checked:O===`query_result`,onChange:()=>A(`query_result`)}),e(`database.csv.targetQueryResult`)]}),(0,I.jsxs)(`label`,{className:`flex items-center gap-2 text-sm cursor-pointer`,children:[(0,I.jsx)(`input`,{type:`radio`,name:`csv-target`,value:`table_data`,checked:O===`table_data`,onChange:()=>A(`table_data`)}),e(`database.csv.targetTableData`)]})]})]}),O===`table_data`&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,I.jsx)(w,{htmlFor:`csv-database`,children:e(`database.csv.database`)}),(0,I.jsxs)(h,{value:R,onValueChange:z,disabled:N.length===0,children:[(0,I.jsx)(f,{id:`csv-database`,className:`w-full`,children:(0,I.jsx)(d,{placeholder:e(`database.csv.databasePlaceholder`)})}),(0,I.jsx)(p,{children:N.map(e=>(0,I.jsx)(m,{value:e,children:e},e))})]})]}),(0,I.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,I.jsx)(w,{htmlFor:`csv-table-name`,children:e(`database.csv.tableName`)}),(0,I.jsx)(ne,{id:`csv-table-name`,value:j,onChange:e=>M(e.target.value),placeholder:e(`database.csv.tableNamePlaceholder`)})]})]}),(0,I.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,I.jsx)(w,{htmlFor:`csv-delimiter`,children:e(`database.csv.delimiter`)}),(0,I.jsxs)(h,{value:B,onValueChange:V,children:[(0,I.jsx)(f,{id:`csv-delimiter`,className:`w-full`,children:(0,I.jsx)(d,{})}),(0,I.jsx)(p,{children:ie.map(t=>(0,I.jsx)(m,{value:t.value,children:e(t.label)},t.value))})]})]}),(0,I.jsxs)(`label`,{className:`flex items-center gap-2 text-sm cursor-pointer`,children:[(0,I.jsx)(`input`,{type:`checkbox`,checked:H,onChange:e=>U(e.target.checked)}),e(`database.csv.includeHeaders`)]})]}),K&&(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsx)(te,{value:oe??0}),(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:K.total===null?e(`database.csv.progressUnknown`,{loaded:K.loaded}):e(`database.csv.progress`,{loaded:K.loaded,total:K.total})})]}),J&&(0,I.jsx)(`p`,{className:`text-sm text-destructive whitespace-pre-wrap`,children:J}),(0,I.jsxs)(s,{children:[(0,I.jsx)(r,{variant:`outline`,onClick:()=>$(!1),children:e(W?`database.csv.stop`:`database.csv.cancel`)}),(0,I.jsx)(r,{onClick:ae,disabled:W||O===`table_data`&&!j.trim(),children:e(W?`database.csv.downloading`:`database.csv.download`)})]})]})})}export{L as DownloadToCSVDialog};
@@ -1 +1 @@
1
- import{t as e}from"./CiL8zoYm.js";import{i as t,r as n}from"./Cu_sGzNJ.js";import{a as r,i,n as a,o,t as s}from"./DzRyVlxz.js";import{t as c}from"./S7HbowYz.js";import{n as l}from"./D8_hwGjG.js";import{l as u}from"./BkXrfAoR.js";var d=n(),f=[`FLUSH HOSTS`,`FLUSH LOGS`,`FLUSH PRIVILEGES`,`FLUSH STATUS`,`FLUSH TABLES`,`FLUSH THREADS`,`FLUSH QUERY CACHE`,`FLUSH DES_KEY_FILE`,`FLUSH RELAY LOGS`,`FLUSH SLOW LOGS`,`FLUSH BINARY LOGS`,`FLUSH ENGINE LOGS`,`FLUSH ERROR LOGS`,`FLUSH GENERAL LOGS`,`FLUSH USER_RESOURCES`,`FLUSH OPTIMIZER_COSTS`];function p(){let e=c.getState();return e.activeConnections.find(t=>t.id===e.activeConnectionId)?.serverConnectionId??null}function m(){let{t:n}=t(),{activeDialog:c,closeDialog:m,setFooterMessage:h}=l(),g=c===`flush`;function _(e){e||m()}async function v(e){let t=p();if(!t){h(n(`command.noActiveConnection`));return}try{await u(t,e),h(n(`command.flush.executed`,{command:e}))}catch(t){h(n(`command.flush.executeError`,{command:e,message:t instanceof Error?t.message:String(t)}))}}return(0,d.jsx)(s,{open:g,onOpenChange:_,children:(0,d.jsxs)(a,{className:`sm:max-w-[500px]`,children:[(0,d.jsx)(r,{children:(0,d.jsx)(o,{children:n(`command.flush.title`)})}),(0,d.jsx)(`div`,{className:`grid grid-cols-2 gap-2 py-2`,children:f.map(t=>(0,d.jsx)(e,{variant:`outline`,size:`sm`,className:`justify-start text-xs h-8`,onClick:()=>{v(t)},children:t},t))}),(0,d.jsx)(i,{children:(0,d.jsx)(e,{variant:`outline`,onClick:()=>_(!1),children:n(`command.close`)})})]})})}export{m as FlushDialog};
1
+ import{t as e}from"./CiL8zoYm.js";import{i as t,r as n}from"./Cu_sGzNJ.js";import{a as r,i,n as a,o,t as s}from"./DzRyVlxz.js";import{t as c}from"./CAd2f6EE.js";import{n as l}from"./D8_hwGjG.js";import{l as u}from"./BghfQrAj.js";var d=n(),f=[`FLUSH HOSTS`,`FLUSH LOGS`,`FLUSH PRIVILEGES`,`FLUSH STATUS`,`FLUSH TABLES`,`FLUSH THREADS`,`FLUSH QUERY CACHE`,`FLUSH DES_KEY_FILE`,`FLUSH RELAY LOGS`,`FLUSH SLOW LOGS`,`FLUSH BINARY LOGS`,`FLUSH ENGINE LOGS`,`FLUSH ERROR LOGS`,`FLUSH GENERAL LOGS`,`FLUSH USER_RESOURCES`,`FLUSH OPTIMIZER_COSTS`];function p(){let e=c.getState();return e.activeConnections.find(t=>t.id===e.activeConnectionId)?.serverConnectionId??null}function m(){let{t:n}=t(),{activeDialog:c,closeDialog:m,setFooterMessage:h}=l(),g=c===`flush`;function _(e){e||m()}async function v(e){let t=p();if(!t){h(n(`command.noActiveConnection`));return}try{await u(t,e),h(n(`command.flush.executed`,{command:e}))}catch(t){h(n(`command.flush.executeError`,{command:e,message:t instanceof Error?t.message:String(t)}))}}return(0,d.jsx)(s,{open:g,onOpenChange:_,children:(0,d.jsxs)(a,{className:`sm:max-w-[500px]`,children:[(0,d.jsx)(r,{children:(0,d.jsx)(o,{children:n(`command.flush.title`)})}),(0,d.jsx)(`div`,{className:`grid grid-cols-2 gap-2 py-2`,children:f.map(t=>(0,d.jsx)(e,{variant:`outline`,size:`sm`,className:`justify-start text-xs h-8`,onClick:()=>{v(t)},children:t},t))}),(0,d.jsx)(i,{children:(0,d.jsx)(e,{variant:`outline`,onClick:()=>_(!1),children:n(`command.close`)})})]})})}export{m as FlushDialog};
@@ -1 +1 @@
1
- import{t as e}from"./CiL8zoYm.js";import{i as t,r as n}from"./Cu_sGzNJ.js";import{a as r,i,n as a,o,r as s,t as c}from"./DzRyVlxz.js";import{a as l,i as u,n as d,r as f,t as p}from"./G06qjCej.js";import{n as m}from"./DU-Eln5x.js";import{n as h}from"./D8_hwGjG.js";import{c as g,l as _}from"./CExE8dKz.js";import{t as v}from"./CrhJJH3f.js";var y=n();function b(){let n=h(e=>e.activeDialog),b=h(e=>e.closeDialog),x=m(),S=x.update,{t:C}=t();return(0,y.jsx)(c,{open:n===`query-settings`,onOpenChange:e=>{e||b()},children:(0,y.jsxs)(a,{className:`sm:max-w-[560px]`,children:[(0,y.jsxs)(r,{children:[(0,y.jsx)(o,{children:C(`settings.query.title`)}),(0,y.jsx)(s,{children:C(`settings.query.description`)})]}),(0,y.jsxs)(`div`,{className:`grid gap-2`,children:[(0,y.jsx)(v,{id:`s-dryrun`,checked:x.previewAffectedRows,onChange:e=>S({previewAffectedRows:e}),pro:!0,label:`Dry run`,hint:`Before an UPDATE or DELETE runs, read its WHERE (joins included) as a SELECT and show how many rows it would change, with a sample of them, to confirm.`}),(0,y.jsxs)(`div`,{className:`grid grid-cols-[1fr_140px] items-center gap-3 rounded-md border p-3`,children:[(0,y.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,y.jsx)(g,{htmlFor:`s-limit`,className:`text-sm font-medium`,children:`Result row limit`}),(0,y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`LIMIT appended to SELECTs that have none. 0 disables.`})]}),(0,y.jsx)(_,{id:`s-limit`,type:`number`,min:0,step:100,value:x.resultRowLimit,onChange:e=>S({resultRowLimit:Math.max(0,Number(e.target.value)||0)})})]}),(0,y.jsxs)(`div`,{className:`grid grid-cols-[1fr_200px] items-center gap-3 rounded-md border p-3`,children:[(0,y.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,y.jsx)(`span`,{className:`text-sm font-medium`,children:`F9 / Run button executes`}),(0,y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Ctrl+Enter always runs the statement at the cursor; Ctrl+Shift+Enter the whole script.`})]}),(0,y.jsxs)(p,{value:x.executeScope,onValueChange:e=>S({executeScope:e}),children:[(0,y.jsx)(u,{children:(0,y.jsx)(l,{})}),(0,y.jsxs)(d,{children:[(0,y.jsx)(f,{value:`script`,children:`Whole script`}),(0,y.jsx)(f,{value:`statement`,children:`Statement at cursor`})]})]})]})]}),(0,y.jsx)(i,{children:(0,y.jsx)(e,{onClick:b,children:C(`settings.done`)})})]})})}export{b as QuerySettingsDialog};
1
+ import{t as e}from"./CiL8zoYm.js";import{i as t,r as n}from"./Cu_sGzNJ.js";import{a as r,i,n as a,o,r as s,t as c}from"./DzRyVlxz.js";import{a as l,i as u,n as d,r as f,t as p}from"./B3qo2BmL.js";import{n as m}from"./DU-Eln5x.js";import{n as h}from"./D8_hwGjG.js";import{c as g,l as _}from"./B_zu4Zim.js";import{t as v}from"./BNB2k8On.js";var y=n();function b(){let n=h(e=>e.activeDialog),b=h(e=>e.closeDialog),x=m(),S=x.update,{t:C}=t();return(0,y.jsx)(c,{open:n===`query-settings`,onOpenChange:e=>{e||b()},children:(0,y.jsxs)(a,{className:`sm:max-w-[560px]`,children:[(0,y.jsxs)(r,{children:[(0,y.jsx)(o,{children:C(`settings.query.title`)}),(0,y.jsx)(s,{children:C(`settings.query.description`)})]}),(0,y.jsxs)(`div`,{className:`grid gap-2`,children:[(0,y.jsx)(v,{id:`s-dryrun`,checked:x.previewAffectedRows,onChange:e=>S({previewAffectedRows:e}),pro:!0,label:`Dry run`,hint:`Before an UPDATE or DELETE runs, read its WHERE (joins included) as a SELECT and show how many rows it would change, with a sample of them, to confirm.`}),(0,y.jsxs)(`div`,{className:`grid grid-cols-[1fr_140px] items-center gap-3 rounded-md border p-3`,children:[(0,y.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,y.jsx)(g,{htmlFor:`s-limit`,className:`text-sm font-medium`,children:`Result row limit`}),(0,y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`LIMIT appended to SELECTs that have none. 0 disables.`})]}),(0,y.jsx)(_,{id:`s-limit`,type:`number`,min:0,step:100,value:x.resultRowLimit,onChange:e=>S({resultRowLimit:Math.max(0,Number(e.target.value)||0)})})]}),(0,y.jsxs)(`div`,{className:`grid grid-cols-[1fr_200px] items-center gap-3 rounded-md border p-3`,children:[(0,y.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,y.jsx)(`span`,{className:`text-sm font-medium`,children:`F9 / Run button executes`}),(0,y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Ctrl+Enter always runs the statement at the cursor; Ctrl+Shift+Enter the whole script.`})]}),(0,y.jsxs)(p,{value:x.executeScope,onValueChange:e=>S({executeScope:e}),children:[(0,y.jsx)(u,{children:(0,y.jsx)(l,{})}),(0,y.jsxs)(d,{children:[(0,y.jsx)(f,{value:`script`,children:`Whole script`}),(0,y.jsx)(f,{value:`statement`,children:`Statement at cursor`})]})]})]})]}),(0,y.jsx)(i,{children:(0,y.jsx)(e,{onClick:b,children:C(`settings.done`)})})]})})}export{b as QuerySettingsDialog};
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{n as t,o as n,p as r}from"./CYz610vE.js";import{t as i}from"./CiL8zoYm.js";import{i as a,r as o}from"./Cu_sGzNJ.js";import{a as s,i as c,n as l,o as ee,r as u,t as d}from"./DzRyVlxz.js";import{i as f,t as p}from"./S7HbowYz.js";import{n as m}from"./DU-Eln5x.js";import{n as h}from"./D8_hwGjG.js";import{n as g,t as _}from"./C1gqjEN3.js";import{O as v,dn as y,jt as b,l as x,pt as S,tt as C,vt as w,wt as T}from"./CExE8dKz.js";var E=e(r(),1),D=o(),O={execute:`command.localHistory.reason.execute`,edit:`command.localHistory.reason.edit`,replaced:`command.localHistory.reason.replaced`,restore:`command.localHistory.reason.restore`,close:`command.localHistory.reason.close`},k=Object.freeze([]);function A(e){let t=(Date.now()-e)/36e5;return t<1?`<1h`:t<24?`1-24h`:t<168?`1-7d`:`7d+`}function j(){let{t:e}=a(),r=h(e=>e.activeDialog),o=h(e=>e.closeDialog),j=h(e=>e.setFooterMessage),M=p(e=>e.activeConnectionId),N=g(e=>M?e.activeTabId[M]:null),P=g(e=>M?e.tabs[M]??_:_),F=f(e=>M?e.revisions[M]??k:k),I=m(e=>e.persistQueryHistory),L=C(e=>e.themeId),R=v(L),[z,B]=(0,E.useState)(!0),[V,H]=(0,E.useState)(``),[U,W]=(0,E.useState)(null),[G,K]=(0,E.useState)(`current`),q=P.find(e=>e.id===N),J=r===`local-history`;(0,E.useEffect)(()=>{if(!J)return;let e=N?F.filter(e=>e.docId===N).length:0;n(`local_history_open`,{revisions:t(F.length),tab_revisions:t(e)})},[J]);let Y=(0,E.useMemo)(()=>{let e=V.trim().toLowerCase();return F.filter(t=>z&&N&&t.docId!==N?!1:!e||t.text.toLowerCase().includes(e)||t.title.toLowerCase().includes(e))},[F,V,z,N]),X=q?.query??``,Z=Y.find(e=>e.id===U)??Y.find(e=>e.text!==X)??Y[0],Q=(0,E.useMemo)(()=>{if(!Z)return;let e=F.filter(e=>e.docId===Z.docId);return e[e.findIndex(e=>e.id===Z.id)+1]},[F,Z]),te=G===`current`?X:Q?.text??``;function $(e,t){n(`local_history_recover`,{action:e,reason:t.reason,age:A(t.timestamp),same_tab:t.docId===N,compare:G})}function ne(){if(!M||!N||!Z)return;$(`restore`,Z);let t=g.getState();t.captureRevision(M,N,`restore`),t.setEditorContent(M,N,Z.text),j(e(`command.localHistory.restored`)),o()}function re(){!M||!Z||($(`new_tab`,Z),S(M,Z.text,Z.database,Z.title),j(e(`command.localHistory.openedInTab`)),o())}function ie(e){M&&(f.getState().removeRevision(M,e.id),U===e.id&&W(null))}function ae(){M&&(f.getState().clearRevisions(M),W(null))}return(0,D.jsx)(d,{open:J,onOpenChange:e=>{e||o()},children:(0,D.jsxs)(l,{className:`flex max-h-[85vh] flex-col sm:max-w-[1000px]`,children:[(0,D.jsxs)(s,{children:[(0,D.jsx)(ee,{children:e(`command.localHistory.title`)}),(0,D.jsx)(u,{children:e(`command.localHistory.description`)})]}),!I&&(0,D.jsx)(`p`,{className:`rounded-md border border-dashed px-3 py-2 text-xs text-muted-foreground`,children:e(`command.localHistory.notPersisted`)}),(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,D.jsxs)(`div`,{className:`relative min-w-[200px] flex-1`,children:[(0,D.jsx)(b,{className:`absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,D.jsx)(x,{value:V,onChange:e=>H(e.target.value),placeholder:e(`command.localHistory.searchPlaceholder`),className:`h-8 pl-7 text-xs`})]}),(0,D.jsxs)(`div`,{className:`flex overflow-hidden rounded-md border`,children:[(0,D.jsx)(`button`,{type:`button`,onClick:()=>B(!0),className:`px-2 py-1 text-xs ${z?`bg-accent`:`hover:bg-accent/50`}`,children:e(`command.localHistory.scopeTab`)}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>B(!1),className:`border-l px-2 py-1 text-xs ${z?`hover:bg-accent/50`:`bg-accent`}`,children:e(`command.localHistory.scopeAll`)})]}),(0,D.jsxs)(`div`,{className:`flex overflow-hidden rounded-md border`,children:[(0,D.jsx)(`button`,{type:`button`,onClick:()=>K(`current`),className:`px-2 py-1 text-xs ${G===`current`?`bg-accent`:`hover:bg-accent/50`}`,children:e(`command.localHistory.compareCurrent`)}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>K(`previous`),className:`border-l px-2 py-1 text-xs ${G===`previous`?`bg-accent`:`hover:bg-accent/50`}`,children:e(`command.localHistory.comparePrevious`)})]})]}),Y.length===0?(0,D.jsx)(`div`,{className:`py-10 text-center text-sm text-muted-foreground`,children:F.length===0?e(`command.localHistory.empty`):e(`command.localHistory.noMatch`)}):(0,D.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-[260px_1fr] gap-3`,children:[(0,D.jsx)(w,{className:`h-[440px] rounded-md border`,children:(0,D.jsx)(`ul`,{className:`divide-y`,children:Y.map(t=>(0,D.jsxs)(`li`,{className:`group relative`,children:[(0,D.jsxs)(`button`,{type:`button`,onClick:()=>W(t.id),className:`flex w-full flex-col items-start gap-0.5 px-3 py-2 pr-8 text-left text-xs hover:bg-accent ${t.id===Z?.id?`bg-accent`:``}`,children:[(0,D.jsx)(`span`,{className:`font-medium`,children:new Date(t.timestamp).toLocaleString()}),(0,D.jsxs)(`span`,{className:`w-full truncate text-muted-foreground`,children:[t.title,` · `,e(O[t.reason]),` · `,e(`command.localHistory.chars`,{count:t.text.length})]})]}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>ie(t),title:e(`command.localHistory.delete`),className:`absolute right-1.5 top-1.5 rounded p-1 text-muted-foreground opacity-0 hover:bg-destructive/10 hover:text-destructive group-hover:opacity-100`,children:(0,D.jsx)(T,{className:`h-3.5 w-3.5`})})]},t.id))})}),(0,D.jsxs)(`div`,{className:`flex h-[440px] flex-col overflow-hidden rounded-md border`,children:[(0,D.jsx)(`div`,{className:`border-b bg-muted/40 px-3 py-1.5 text-xs text-muted-foreground`,children:G===`current`?e(`command.localHistory.diffAgainstCurrent`):Q?e(`command.localHistory.diffAgainstPrevious`,{time:new Date(Q.timestamp).toLocaleString()}):e(`command.localHistory.noPrevious`)}),(0,D.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,D.jsx)(y,{language:`sql`,theme:R,original:Z?.text??``,modified:te,options:{readOnly:!0,renderSideBySide:!1,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:12,renderOverviewRuler:!1}})})]})]}),(0,D.jsxs)(c,{className:`sm:justify-between`,children:[(0,D.jsx)(i,{variant:`ghost`,onClick:ae,disabled:F.length===0,children:e(`command.localHistory.clearAll`)}),(0,D.jsxs)(`div`,{className:`flex gap-2`,children:[(0,D.jsx)(i,{variant:`outline`,onClick:o,children:e(`command.close`)}),(0,D.jsx)(i,{variant:`outline`,onClick:re,disabled:!Z,children:e(`command.localHistory.openInNewTab`)}),(0,D.jsx)(i,{onClick:ne,disabled:!Z||!q,children:e(`command.localHistory.restore`)})]})]})]})})}export{j as LocalHistoryDialog};
1
+ import{r as e}from"./hePW80VL.js";import{n as t,o as n,p as r}from"./CYz610vE.js";import{t as i}from"./CiL8zoYm.js";import{i as a,r as o}from"./Cu_sGzNJ.js";import{a as s,i as c,n as l,o as ee,r as u,t as d}from"./DzRyVlxz.js";import{i as f,t as p}from"./CAd2f6EE.js";import{n as m}from"./DU-Eln5x.js";import{n as h}from"./D8_hwGjG.js";import{n as g,t as _}from"./D6SRSRpo.js";import{O as v,dn as y,jt as b,l as x,pt as S,tt as C,vt as w,wt as T}from"./B_zu4Zim.js";var E=e(r(),1),D=o(),O={execute:`command.localHistory.reason.execute`,edit:`command.localHistory.reason.edit`,replaced:`command.localHistory.reason.replaced`,restore:`command.localHistory.reason.restore`,close:`command.localHistory.reason.close`},k=Object.freeze([]);function A(e){let t=(Date.now()-e)/36e5;return t<1?`<1h`:t<24?`1-24h`:t<168?`1-7d`:`7d+`}function j(){let{t:e}=a(),r=h(e=>e.activeDialog),o=h(e=>e.closeDialog),j=h(e=>e.setFooterMessage),M=p(e=>e.activeConnectionId),N=g(e=>M?e.activeTabId[M]:null),P=g(e=>M?e.tabs[M]??_:_),F=f(e=>M?e.revisions[M]??k:k),I=m(e=>e.persistQueryHistory),L=C(e=>e.themeId),R=v(L),[z,B]=(0,E.useState)(!0),[V,H]=(0,E.useState)(``),[U,W]=(0,E.useState)(null),[G,K]=(0,E.useState)(`current`),q=P.find(e=>e.id===N),J=r===`local-history`;(0,E.useEffect)(()=>{if(!J)return;let e=N?F.filter(e=>e.docId===N).length:0;n(`local_history_open`,{revisions:t(F.length),tab_revisions:t(e)})},[J]);let Y=(0,E.useMemo)(()=>{let e=V.trim().toLowerCase();return F.filter(t=>z&&N&&t.docId!==N?!1:!e||t.text.toLowerCase().includes(e)||t.title.toLowerCase().includes(e))},[F,V,z,N]),X=q?.query??``,Z=Y.find(e=>e.id===U)??Y.find(e=>e.text!==X)??Y[0],Q=(0,E.useMemo)(()=>{if(!Z)return;let e=F.filter(e=>e.docId===Z.docId);return e[e.findIndex(e=>e.id===Z.id)+1]},[F,Z]),te=G===`current`?X:Q?.text??``;function $(e,t){n(`local_history_recover`,{action:e,reason:t.reason,age:A(t.timestamp),same_tab:t.docId===N,compare:G})}function ne(){if(!M||!N||!Z)return;$(`restore`,Z);let t=g.getState();t.captureRevision(M,N,`restore`),t.setEditorContent(M,N,Z.text),j(e(`command.localHistory.restored`)),o()}function re(){!M||!Z||($(`new_tab`,Z),S(M,Z.text,Z.database,Z.title),j(e(`command.localHistory.openedInTab`)),o())}function ie(e){M&&(f.getState().removeRevision(M,e.id),U===e.id&&W(null))}function ae(){M&&(f.getState().clearRevisions(M),W(null))}return(0,D.jsx)(d,{open:J,onOpenChange:e=>{e||o()},children:(0,D.jsxs)(l,{className:`flex max-h-[85vh] flex-col sm:max-w-[1000px]`,children:[(0,D.jsxs)(s,{children:[(0,D.jsx)(ee,{children:e(`command.localHistory.title`)}),(0,D.jsx)(u,{children:e(`command.localHistory.description`)})]}),!I&&(0,D.jsx)(`p`,{className:`rounded-md border border-dashed px-3 py-2 text-xs text-muted-foreground`,children:e(`command.localHistory.notPersisted`)}),(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,D.jsxs)(`div`,{className:`relative min-w-[200px] flex-1`,children:[(0,D.jsx)(b,{className:`absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,D.jsx)(x,{value:V,onChange:e=>H(e.target.value),placeholder:e(`command.localHistory.searchPlaceholder`),className:`h-8 pl-7 text-xs`})]}),(0,D.jsxs)(`div`,{className:`flex overflow-hidden rounded-md border`,children:[(0,D.jsx)(`button`,{type:`button`,onClick:()=>B(!0),className:`px-2 py-1 text-xs ${z?`bg-accent`:`hover:bg-accent/50`}`,children:e(`command.localHistory.scopeTab`)}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>B(!1),className:`border-l px-2 py-1 text-xs ${z?`hover:bg-accent/50`:`bg-accent`}`,children:e(`command.localHistory.scopeAll`)})]}),(0,D.jsxs)(`div`,{className:`flex overflow-hidden rounded-md border`,children:[(0,D.jsx)(`button`,{type:`button`,onClick:()=>K(`current`),className:`px-2 py-1 text-xs ${G===`current`?`bg-accent`:`hover:bg-accent/50`}`,children:e(`command.localHistory.compareCurrent`)}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>K(`previous`),className:`border-l px-2 py-1 text-xs ${G===`previous`?`bg-accent`:`hover:bg-accent/50`}`,children:e(`command.localHistory.comparePrevious`)})]})]}),Y.length===0?(0,D.jsx)(`div`,{className:`py-10 text-center text-sm text-muted-foreground`,children:F.length===0?e(`command.localHistory.empty`):e(`command.localHistory.noMatch`)}):(0,D.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-[260px_1fr] gap-3`,children:[(0,D.jsx)(w,{className:`h-[440px] rounded-md border`,children:(0,D.jsx)(`ul`,{className:`divide-y`,children:Y.map(t=>(0,D.jsxs)(`li`,{className:`group relative`,children:[(0,D.jsxs)(`button`,{type:`button`,onClick:()=>W(t.id),className:`flex w-full flex-col items-start gap-0.5 px-3 py-2 pr-8 text-left text-xs hover:bg-accent ${t.id===Z?.id?`bg-accent`:``}`,children:[(0,D.jsx)(`span`,{className:`font-medium`,children:new Date(t.timestamp).toLocaleString()}),(0,D.jsxs)(`span`,{className:`w-full truncate text-muted-foreground`,children:[t.title,` · `,e(O[t.reason]),` · `,e(`command.localHistory.chars`,{count:t.text.length})]})]}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>ie(t),title:e(`command.localHistory.delete`),className:`absolute right-1.5 top-1.5 rounded p-1 text-muted-foreground opacity-0 hover:bg-destructive/10 hover:text-destructive group-hover:opacity-100`,children:(0,D.jsx)(T,{className:`h-3.5 w-3.5`})})]},t.id))})}),(0,D.jsxs)(`div`,{className:`flex h-[440px] flex-col overflow-hidden rounded-md border`,children:[(0,D.jsx)(`div`,{className:`border-b bg-muted/40 px-3 py-1.5 text-xs text-muted-foreground`,children:G===`current`?e(`command.localHistory.diffAgainstCurrent`):Q?e(`command.localHistory.diffAgainstPrevious`,{time:new Date(Q.timestamp).toLocaleString()}):e(`command.localHistory.noPrevious`)}),(0,D.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,D.jsx)(y,{language:`sql`,theme:R,original:Z?.text??``,modified:te,options:{readOnly:!0,renderSideBySide:!1,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:12,renderOverviewRuler:!1}})})]})]}),(0,D.jsxs)(c,{className:`sm:justify-between`,children:[(0,D.jsx)(i,{variant:`ghost`,onClick:ae,disabled:F.length===0,children:e(`command.localHistory.clearAll`)}),(0,D.jsxs)(`div`,{className:`flex gap-2`,children:[(0,D.jsx)(i,{variant:`outline`,onClick:o,children:e(`command.close`)}),(0,D.jsx)(i,{variant:`outline`,onClick:re,disabled:!Z,children:e(`command.localHistory.openInNewTab`)}),(0,D.jsx)(i,{onClick:ne,disabled:!Z||!q,children:e(`command.localHistory.restore`)})]})]})]})})}export{j as LocalHistoryDialog};
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/R93pYE1w.js","assets/hePW80VL.js","assets/DeB5sJfy.js","assets/DOeLCbYG.js","assets/5E2RYjEs.js","assets/eRZ39OKr.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./hePW80VL.js";import{i as t}from"./BDtsGuIR.js";import{r as n}from"./Nro86Y63.js";import{t as r}from"./S7HbowYz.js";import{n as i}from"./C1gqjEN3.js";import{C as a,a as o}from"./BkXrfAoR.js";import{n as s}from"./BRZhVXRC.js";import{i as c,r as l}from"./B9dhM8vw.js";var u=[`<=>`,`->>`,`->`,`<>`,`!=`,`<=`,`>=`,`<<`,`>>`,`:=`,`||`,`&&`];function d(e){return/[A-Za-z_$\u0080-\uFFFF]/.test(e)}function f(e){return/[A-Za-z0-9_$\u0080-\uFFFF]/.test(e)}function p(e){return e>=`0`&&e<=`9`}function m(e){return e===` `||e===` `||e===`
2
+ import{r as e}from"./hePW80VL.js";import{i as t}from"./C9jzAIEJ.js";import{r as n}from"./Nro86Y63.js";import{t as r}from"./CAd2f6EE.js";import{n as i}from"./D6SRSRpo.js";import{C as a,a as o}from"./BghfQrAj.js";import{n as s}from"./Ci1xBOLy.js";import{i as c,r as l}from"./CSjIZAje.js";var u=[`<=>`,`->>`,`->`,`<>`,`!=`,`<=`,`>=`,`<<`,`>>`,`:=`,`||`,`&&`];function d(e){return/[A-Za-z_$\u0080-\uFFFF]/.test(e)}function f(e){return/[A-Za-z0-9_$\u0080-\uFFFF]/.test(e)}function p(e){return e>=`0`&&e<=`9`}function m(e){return e===` `||e===` `||e===`
3
3
  `||e===`\r`||e===`\f`||e===`\v`}var h=class{input;syntax;pos=0;delimiter;significantInStatement=0;constructor(e,t,n=`;`){this.input=e,this.syntax=t,this.delimiter=n}tokenize(){let e=[];for(;this.pos<this.input.length;){let t=this.next();t.kind===`terminator`||t.kind===`delimiter_command`?this.significantInStatement=0:t.kind!==`space`&&t.kind!==`comment`&&this.significantInStatement++,e.push(t)}return e}atLineStart(e){let t=e-1;for(;t>=0&&(this.input[t]===` `||this.input[t]===` `);)t--;return t<0||this.input[t]===`
4
4
  `}make(e,t,n){let r=this.input.slice(t,n),i={kind:e,value:r,start:t,end:n};return e===`identifier`&&(i.upper=r.toUpperCase()),i}next(){let e=this.input,t=this.pos,n=e[t];if(m(n)){let n=t+1;for(;n<e.length&&m(e[n]);)n++;return this.pos=n,this.make(`space`,t,n)}if(e.startsWith(this.delimiter,t))return this.pos=t+this.delimiter.length,this.make(`terminator`,t,this.pos);if(n===`#`&&this.syntax.hashComments)return this.lineComment(t);if(n===`-`&&e[t+1]===`-`){let n=e[t+2];if(!this.syntax.dashCommentNeedsSpace||n===void 0||m(n))return this.lineComment(t)}if(n===`/`&&e[t+1]===`*`){let n=e.indexOf(`*/`,t+2);return this.pos=n===-1?e.length:n+2,this.make(`comment`,t,this.pos)}if(n===`$`&&this.syntax.dollarQuotes){let n=/^\$([A-Za-z_\u0080-\uFFFF][A-Za-z0-9_\u0080-\uFFFF]*)?\$/.exec(e.slice(t,t+64));if(n){let r=e.indexOf(n[0],t+n[0].length);return this.pos=r===-1?e.length:r+n[0].length,this.make(`string`,t,this.pos)}}if((n===`e`||n===`E`)&&e[t+1]===`'`&&this.syntax.dollarQuotes){this.pos=t+1;let e=this.quoted(t+1,`'`,`string`,!0);return this.make(`string`,t,e.end)}if(n===`'`)return this.quoted(t,`'`,`string`,this.syntax.backslashEscapes);if(n===`"`)return this.syntax.doubleQuoteIsIdentifier?this.quoted(t,`"`,`quoted_identifier`,!1):this.quoted(t,`"`,`string`,this.syntax.backslashEscapes);if((n===`x`||n===`X`||n===`b`||n===`B`||n===`n`||n===`N`)&&e[t+1]===`'`){this.pos=t+1;let e=this.quoted(t+1,`'`,`string`,this.syntax.backslashEscapes);return this.make(`string`,t,e.end)}if(n==="`")return this.quoted(t,"`",`quoted_identifier`,!1);if(n===`[`&&this.syntax.bracketIdentifiers){let n=e.indexOf(`]`,t+1);return this.pos=n===-1?e.length:n+1,this.make(`quoted_identifier`,t,this.pos)}if(p(n)||n===`.`&&p(e[t+1]??``))return this.number(t);if(n===`@`){let n=t+1;if(e[n]===`@`&&n++,e[n]===`'`||e[n]===`"`||e[n]==="`"){let r=e[n];this.pos=n;let i=this.quoted(n,r,`string`,this.syntax.backslashEscapes);return this.make(`variable`,t,i.end)}for(;n<e.length&&(f(e[n])||e[n]===`.`);)n++;return this.pos=n,this.make(`variable`,t,n)}if((n===`:`||n===`$`)&&d(e[t+1]??``)&&e[t+1]!==`$`){let n=t+1;for(;n<e.length&&f(e[n]);)n++;return this.pos=n,this.make(`variable`,t,n)}if(n===`?`){let n=t+1;for(;n<e.length&&p(e[n]);)n++;return this.pos=n,this.make(`placeholder`,t,n)}if(d(n)){let n=t+1;for(;n<e.length&&f(e[n])&&!e.startsWith(this.delimiter,n);)n++;let r=e.slice(t,n).toUpperCase();if(r===`DELIMITER`&&this.syntax.delimiterCommand&&this.significantInStatement===0){let r=n;for(;r<e.length&&(e[r]===` `||e[r]===` `);)r++;let i=r;for(;i<e.length&&!m(e[i]);)i++;if(i>r)return this.delimiter=e.slice(r,i),this.pos=i,this.make(`delimiter_command`,t,i)}if(r===`GO`&&this.syntax.goBatchSeparator&&this.atLineStart(t)){let r=n;for(;r<e.length&&(e[r]===` `||e[r]===` `);)r++;for(;r<e.length&&p(e[r]);)r++;for(;r<e.length&&(e[r]===` `||e[r]===` `||e[r]===`\r`);)r++;if(r>=e.length||e[r]===`
5
5
  `)return this.pos=r,this.make(`delimiter_command`,t,r)}return this.pos=n,this.make(`identifier`,t,n)}if(n===`/`&&this.syntax.plsqlBlocks&&this.atLineStart(t)){let n=t+1;for(;n<e.length&&(e[n]===` `||e[n]===` `||e[n]===`\r`);)n++;if(n>=e.length||e[n]===`
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{i as n,r}from"./Cu_sGzNJ.js";import{F as i,t as a}from"./S7HbowYz.js";import{t as o}from"./BQ1Rcyw6.js";import{n as s}from"./BixvbqFe.js";var c=e(t(),1),l=r(),u=0;function d({connectionId:e}){let{t}=n(),r=a(t=>t.activeConnections.find(t=>t.id===e)?.readOnly??!1),[d,f]=(0,c.useState)(``),p=s(e,e=>e.type===`command`?{id:++u,time:e.time,db:e.db,client:e.client,command:e.args.map(i).join(` `)}:null),m=(0,c.useMemo)(()=>d?p.rows.filter(e=>e.command.toLowerCase().includes(d.toLowerCase())||e.client.includes(d)):p.rows,[p.rows,d]);return(0,l.jsx)(o,{title:t(`tools.redis.monitor`),onRefresh:async()=>{},error:p.error,onDismissError:p.dismissError,children:(0,l.jsxs)(`div`,{className:`flex h-full flex-col text-xs`,children:[(0,l.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center gap-2 border-b px-3 py-2`,children:[p.running?(0,l.jsx)(`button`,{type:`button`,onClick:p.stop,className:`h-7 rounded border bg-background px-2 text-muted-foreground hover:text-foreground`,children:t(`tools.stop`)}):(0,l.jsx)(`button`,{type:`button`,disabled:r,onClick:()=>void p.start({kind:`monitor`}),className:`h-7 rounded border border-primary/30 bg-primary/10 px-2 text-primary hover:bg-primary/20 disabled:opacity-40`,children:t(`tools.redis.startMonitor`)}),p.running&&(0,l.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,l.jsx)(`span`,{className:`size-2 animate-pulse rounded-full bg-red-500`}),t(`tools.redis.monitoring`)]}),(0,l.jsx)(`input`,{className:`h-7 w-64 rounded border bg-background px-2`,placeholder:t(`tools.filter`),value:d,onChange:e=>f(e.target.value)}),p.dropped>0&&(0,l.jsx)(`span`,{className:`text-catppuccin-yellow`,children:t(`tools.redis.dropped`,{count:p.dropped})}),(0,l.jsx)(`div`,{className:`flex-1`}),(0,l.jsx)(`button`,{type:`button`,onClick:p.clear,className:`h-7 rounded border bg-background px-2 text-muted-foreground hover:text-foreground`,children:t(`tools.clear`)})]}),(0,l.jsx)(`p`,{className:`flex-shrink-0 border-b bg-catppuccin-yellow/10 px-3 py-1.5 text-muted-foreground`,children:t(r?`tools.redis.monitorReadOnly`:`tools.redis.monitorWarning`)}),(0,l.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,l.jsxs)(`table`,{className:`w-full border-collapse`,children:[(0,l.jsx)(`thead`,{className:`sticky top-0 bg-muted text-left text-muted-foreground`,children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:`w-28 px-3 py-1.5`,children:t(`tools.redis.time`)}),(0,l.jsx)(`th`,{className:`w-14 px-3 py-1.5`,children:`db`}),(0,l.jsx)(`th`,{className:`w-44 px-3 py-1.5`,children:t(`tools.redis.client`)}),(0,l.jsx)(`th`,{className:`px-3 py-1.5`,children:t(`tools.redis.command`)})]})}),(0,l.jsx)(`tbody`,{children:m.map(e=>(0,l.jsxs)(`tr`,{className:`border-b border-border/50 hover:bg-muted/40`,children:[(0,l.jsxs)(`td`,{className:`whitespace-nowrap px-3 py-0.5 tabular-nums text-muted-foreground`,children:[new Date(e.time).toLocaleTimeString(void 0,{hour12:!1}),`.`,String(e.time%1e3).padStart(3,`0`)]}),(0,l.jsx)(`td`,{className:`px-3 py-0.5 font-mono`,children:e.db}),(0,l.jsx)(`td`,{className:`px-3 py-0.5 font-mono text-muted-foreground`,children:e.client}),(0,l.jsx)(`td`,{className:`break-all px-3 py-0.5 font-mono`,children:e.command})]},e.id))})]})}),p.rows.length>=2e3&&(0,l.jsx)(`p`,{className:`flex-shrink-0 border-t px-3 py-1 text-muted-foreground`,children:t(`tools.redis.feedLimit`,{count:2e3})})]})})}export{d as Monitor};
1
+ import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{i as n,r}from"./Cu_sGzNJ.js";import{F as i,t as a}from"./CAd2f6EE.js";import{t as o}from"./TqO-pPrr.js";import{n as s}from"./BmnRSOWE.js";var c=e(t(),1),l=r(),u=0;function d({connectionId:e}){let{t}=n(),r=a(t=>t.activeConnections.find(t=>t.id===e)?.readOnly??!1),[d,f]=(0,c.useState)(``),p=s(e,e=>e.type===`command`?{id:++u,time:e.time,db:e.db,client:e.client,command:e.args.map(i).join(` `)}:null),m=(0,c.useMemo)(()=>d?p.rows.filter(e=>e.command.toLowerCase().includes(d.toLowerCase())||e.client.includes(d)):p.rows,[p.rows,d]);return(0,l.jsx)(o,{title:t(`tools.redis.monitor`),onRefresh:async()=>{},error:p.error,onDismissError:p.dismissError,children:(0,l.jsxs)(`div`,{className:`flex h-full flex-col text-xs`,children:[(0,l.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center gap-2 border-b px-3 py-2`,children:[p.running?(0,l.jsx)(`button`,{type:`button`,onClick:p.stop,className:`h-7 rounded border bg-background px-2 text-muted-foreground hover:text-foreground`,children:t(`tools.stop`)}):(0,l.jsx)(`button`,{type:`button`,disabled:r,onClick:()=>void p.start({kind:`monitor`}),className:`h-7 rounded border border-primary/30 bg-primary/10 px-2 text-primary hover:bg-primary/20 disabled:opacity-40`,children:t(`tools.redis.startMonitor`)}),p.running&&(0,l.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,l.jsx)(`span`,{className:`size-2 animate-pulse rounded-full bg-red-500`}),t(`tools.redis.monitoring`)]}),(0,l.jsx)(`input`,{className:`h-7 w-64 rounded border bg-background px-2`,placeholder:t(`tools.filter`),value:d,onChange:e=>f(e.target.value)}),p.dropped>0&&(0,l.jsx)(`span`,{className:`text-catppuccin-yellow`,children:t(`tools.redis.dropped`,{count:p.dropped})}),(0,l.jsx)(`div`,{className:`flex-1`}),(0,l.jsx)(`button`,{type:`button`,onClick:p.clear,className:`h-7 rounded border bg-background px-2 text-muted-foreground hover:text-foreground`,children:t(`tools.clear`)})]}),(0,l.jsx)(`p`,{className:`flex-shrink-0 border-b bg-catppuccin-yellow/10 px-3 py-1.5 text-muted-foreground`,children:t(r?`tools.redis.monitorReadOnly`:`tools.redis.monitorWarning`)}),(0,l.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,l.jsxs)(`table`,{className:`w-full border-collapse`,children:[(0,l.jsx)(`thead`,{className:`sticky top-0 bg-muted text-left text-muted-foreground`,children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:`w-28 px-3 py-1.5`,children:t(`tools.redis.time`)}),(0,l.jsx)(`th`,{className:`w-14 px-3 py-1.5`,children:`db`}),(0,l.jsx)(`th`,{className:`w-44 px-3 py-1.5`,children:t(`tools.redis.client`)}),(0,l.jsx)(`th`,{className:`px-3 py-1.5`,children:t(`tools.redis.command`)})]})}),(0,l.jsx)(`tbody`,{children:m.map(e=>(0,l.jsxs)(`tr`,{className:`border-b border-border/50 hover:bg-muted/40`,children:[(0,l.jsxs)(`td`,{className:`whitespace-nowrap px-3 py-0.5 tabular-nums text-muted-foreground`,children:[new Date(e.time).toLocaleTimeString(void 0,{hour12:!1}),`.`,String(e.time%1e3).padStart(3,`0`)]}),(0,l.jsx)(`td`,{className:`px-3 py-0.5 font-mono`,children:e.db}),(0,l.jsx)(`td`,{className:`px-3 py-0.5 font-mono text-muted-foreground`,children:e.client}),(0,l.jsx)(`td`,{className:`break-all px-3 py-0.5 font-mono`,children:e.command})]},e.id))})]})}),p.rows.length>=2e3&&(0,l.jsx)(`p`,{className:`flex-shrink-0 border-t px-3 py-1 text-muted-foreground`,children:t(`tools.redis.feedLimit`,{count:2e3})})]})})}export{d as Monitor};
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{t as n}from"./CiL8zoYm.js";import{a as r}from"./BDtsGuIR.js";import{i,r as a}from"./Cu_sGzNJ.js";import{a as o,i as s,n as c,o as l,t as u}from"./DzRyVlxz.js";import{t as d}from"./S7HbowYz.js";import{n as f}from"./D8_hwGjG.js";import{l as p}from"./BkXrfAoR.js";import{t as m}from"./BRZhVXRC.js";import{C as h,S as g,T as _,b as v,l as y,vt as b,w as x,x as S}from"./CExE8dKz.js";var C=e(t(),1),w=a();function T(){let e=d.getState();return e.activeConnections.find(t=>t.id===e.activeConnectionId)?.serverConnectionId??null}async function E(e){let t=T();if(!t)throw Error(r.t(`command.noActiveConnection`));let n=m().getQuery(e===`global`?`SHOW_GLOBAL_VARIABLES`:`SHOW_SESSION_VARIABLES`);return(await p(t,n)).records.map(e=>({Variable_name:e[0],Value:e[1]}))}function D(){let{t:e}=i(),{activeDialog:t,closeDialog:r,setFooterMessage:a}=f(),[d,p]=(0,C.useState)([]),[m,T]=(0,C.useState)(``),[D,O]=(0,C.useState)(`session`),k=t===`variables`,A=(0,C.useCallback)(t=>E(t).then(p).catch(t=>a(e(`command.variables.loadError`,{message:t instanceof Error?t.message:String(t)}))),[a,e]);(0,C.useEffect)(()=>{k&&A(D)},[k,D,A]);let j=(0,C.useMemo)(()=>{if(!m.trim())return d;let e=m.toLowerCase();return d.filter(t=>t.Variable_name.toLowerCase().includes(e)||t.Value.toLowerCase().includes(e))},[d,m]);function M(e){e||(T(``),r())}function N(e){O(e)}return(0,w.jsx)(u,{open:k,onOpenChange:M,children:(0,w.jsxs)(c,{className:`sm:max-w-[900px] max-h-[80vh] flex flex-col`,children:[(0,w.jsx)(o,{children:(0,w.jsx)(l,{children:e(`command.variables.title`)})}),(0,w.jsxs)(`div`,{className:`flex items-center gap-3 pb-2`,children:[(0,w.jsxs)(`div`,{className:`flex gap-1`,children:[(0,w.jsx)(n,{variant:D===`session`?`default`:`outline`,size:`sm`,onClick:()=>N(`session`),children:e(`command.scope.session`)}),(0,w.jsx)(n,{variant:D===`global`?`default`:`outline`,size:`sm`,onClick:()=>N(`global`),children:e(`command.scope.global`)})]}),(0,w.jsx)(y,{placeholder:e(`command.variables.filterPlaceholder`),value:m,onChange:e=>T(e.target.value),className:`max-w-xs`})]}),(0,w.jsx)(`div`,{className:`flex-1 border rounded-md overflow-hidden min-h-0`,children:(0,w.jsx)(b,{className:`h-[400px]`,children:(0,w.jsxs)(v,{children:[(0,w.jsx)(x,{children:(0,w.jsxs)(_,{children:[(0,w.jsx)(h,{className:`w-[300px]`,children:e(`command.variableName`)}),(0,w.jsx)(h,{children:e(`command.value`)})]})}),(0,w.jsx)(S,{children:j.length===0?(0,w.jsx)(_,{children:(0,w.jsx)(g,{colSpan:2,className:`text-center text-muted-foreground`,children:e(`command.variables.empty`)})}):j.map(e=>(0,w.jsxs)(_,{children:[(0,w.jsx)(g,{className:`font-mono text-xs`,children:e.Variable_name}),(0,w.jsx)(g,{className:`font-mono text-xs`,children:e.Value})]},e.Variable_name))})]})})}),(0,w.jsx)(s,{children:(0,w.jsx)(n,{variant:`outline`,onClick:()=>M(!1),children:e(`command.close`)})})]})})}export{D as VariablesDialog};
1
+ import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{t as n}from"./CiL8zoYm.js";import{a as r}from"./C9jzAIEJ.js";import{i,r as a}from"./Cu_sGzNJ.js";import{a as o,i as s,n as c,o as l,t as u}from"./DzRyVlxz.js";import{t as d}from"./CAd2f6EE.js";import{n as f}from"./D8_hwGjG.js";import{l as p}from"./BghfQrAj.js";import{t as m}from"./Ci1xBOLy.js";import{C as h,S as g,T as _,b as v,l as y,vt as b,w as x,x as S}from"./B_zu4Zim.js";var C=e(t(),1),w=a();function T(){let e=d.getState();return e.activeConnections.find(t=>t.id===e.activeConnectionId)?.serverConnectionId??null}async function E(e){let t=T();if(!t)throw Error(r.t(`command.noActiveConnection`));let n=m().getQuery(e===`global`?`SHOW_GLOBAL_VARIABLES`:`SHOW_SESSION_VARIABLES`);return(await p(t,n)).records.map(e=>({Variable_name:e[0],Value:e[1]}))}function D(){let{t:e}=i(),{activeDialog:t,closeDialog:r,setFooterMessage:a}=f(),[d,p]=(0,C.useState)([]),[m,T]=(0,C.useState)(``),[D,O]=(0,C.useState)(`session`),k=t===`variables`,A=(0,C.useCallback)(t=>E(t).then(p).catch(t=>a(e(`command.variables.loadError`,{message:t instanceof Error?t.message:String(t)}))),[a,e]);(0,C.useEffect)(()=>{k&&A(D)},[k,D,A]);let j=(0,C.useMemo)(()=>{if(!m.trim())return d;let e=m.toLowerCase();return d.filter(t=>t.Variable_name.toLowerCase().includes(e)||t.Value.toLowerCase().includes(e))},[d,m]);function M(e){e||(T(``),r())}function N(e){O(e)}return(0,w.jsx)(u,{open:k,onOpenChange:M,children:(0,w.jsxs)(c,{className:`sm:max-w-[900px] max-h-[80vh] flex flex-col`,children:[(0,w.jsx)(o,{children:(0,w.jsx)(l,{children:e(`command.variables.title`)})}),(0,w.jsxs)(`div`,{className:`flex items-center gap-3 pb-2`,children:[(0,w.jsxs)(`div`,{className:`flex gap-1`,children:[(0,w.jsx)(n,{variant:D===`session`?`default`:`outline`,size:`sm`,onClick:()=>N(`session`),children:e(`command.scope.session`)}),(0,w.jsx)(n,{variant:D===`global`?`default`:`outline`,size:`sm`,onClick:()=>N(`global`),children:e(`command.scope.global`)})]}),(0,w.jsx)(y,{placeholder:e(`command.variables.filterPlaceholder`),value:m,onChange:e=>T(e.target.value),className:`max-w-xs`})]}),(0,w.jsx)(`div`,{className:`flex-1 border rounded-md overflow-hidden min-h-0`,children:(0,w.jsx)(b,{className:`h-[400px]`,children:(0,w.jsxs)(v,{children:[(0,w.jsx)(x,{children:(0,w.jsxs)(_,{children:[(0,w.jsx)(h,{className:`w-[300px]`,children:e(`command.variableName`)}),(0,w.jsx)(h,{children:e(`command.value`)})]})}),(0,w.jsx)(S,{children:j.length===0?(0,w.jsx)(_,{children:(0,w.jsx)(g,{colSpan:2,className:`text-center text-muted-foreground`,children:e(`command.variables.empty`)})}):j.map(e=>(0,w.jsxs)(_,{children:[(0,w.jsx)(g,{className:`font-mono text-xs`,children:e.Variable_name}),(0,w.jsx)(g,{className:`font-mono text-xs`,children:e.Value})]},e.Variable_name))})]})})}),(0,w.jsx)(s,{children:(0,w.jsx)(n,{variant:`outline`,onClick:()=>M(!1),children:e(`command.close`)})})]})})}export{D as VariablesDialog};
@@ -1 +1 @@
1
- import{t as e}from"./CiL8zoYm.js";import{i as t,r as n}from"./Cu_sGzNJ.js";import{a as r,i,n as a,o,r as s,t as c}from"./DzRyVlxz.js";import"./DU-Eln5x.js";import{n as l}from"./D8_hwGjG.js";import{Y as u}from"./CExE8dKz.js";var d=`<a href="mailto:planche.dev@gmail.com">planche.dev@gmail.com</a>`,f=`2 September 2026`,p=`Planche is made and operated by <strong>deploy</strong>, a sole proprietorship registered in the Republic of Korea and owned by Juwon Jeong (“we”, “us”), at 1114 Gyeongui-ro, 4th floor, Room 405, Paju-si, Gyeonggi-do, Republic of Korea. Contact: ${d}.`,m={title:`Terms of Service — Planche`,description:`The terms under which the Planche SQL client, the local agent and Planche Pro are provided.`,ogTitle:`Planche terms of service`,h1:`Terms of Service`,intro:`Last updated ${f}. These terms cover the website and web application at planche.dev, the local agent published on npm as <code>planche</code> and by the install scripts, and the Planche Pro subscription. By using any of them you agree to these terms. ${p}`,cta:`Open Planche`,static:!0,sections:[{heading:`1. What Planche is`,body:[`Planche is a SQL client. The application runs in your browser. For MySQL, MariaDB, PostgreSQL, SQL Server, Oracle and the hosted services it supports, a small program — the local agent — runs on your own computer, holds the database connections and answers the browser over the loopback interface. SQLite files are opened inside the browser itself.`,`We host the application as a static site and nothing else. Your connection profiles, passwords, queries and results travel between your browser, the agent on your machine and your databases; none of them pass through a server of ours. The <a href="{privacy}">privacy policy</a> lists the few things that do reach us or a service we use.`,`Planche is free to use for personal and commercial purposes without an account. A set of advanced features, listed on the <a href="{pricing}">pricing page</a>, requires a Pro licence.`]},{heading:`2. Licence to use the software`,body:[`We grant you a non-exclusive, non-transferable licence to use the Planche application and the local agent, on any number of computers you own or control, for the purpose of working with databases you are authorised to access.`,`You may not redistribute, sell, rent or sublicense Planche or the agent, offer either to third parties as part of a product or service, modify or create derivative works of them, reverse engineer or decompile them except where the law grants you that right regardless of this clause, or remove any copyright or proprietary notice. Planche is proprietary software; it is not open source.`,`The agent package ships with its own licence agreement (the <code>LICENSE</code> file in the package). For the agent, that agreement applies together with these terms; if the two differ, the package licence prevails for the copy you installed.`,`Planche includes third-party open-source components, each under its own licence. Those licences govern those components and nothing here limits the rights they give you. The list is at <a href="/third-party-notices.txt">third-party-notices.txt</a>.`]},{heading:`3. Planche Pro`,body:[`Pro is a subscription, billed monthly or yearly, that unlocks the features listed on the <a href="{pricing}">pricing page</a>. It is sold through a payment provider acting as our merchant of record and authorised reseller: the provider is the seller on the transaction, processes the payment, and collects and remits any VAT or sales tax that applies. The provider’s name, the price, the currency and any tax are shown at checkout before you pay, and the provider’s own terms apply to the purchase itself.`,`After payment you receive a licence key, on the order page and by email. A key is a signed statement of who bought it, which plan and for which period; the application verifies it on your computer without contacting anyone. A key covers <strong>one person</strong> on every computer that person uses. It may not be shared, published, or resold, and a key found published may be excluded from renewal. For several people, buy one licence each or write to us about a team licence.`,`Because a key is verified offline, it cannot be withdrawn before it expires. Keys are therefore issued for exactly the period that was paid for. While your subscription stays paid you receive a key that covers each new period; when it ends, the Pro features stop at the end of the last paid period and everything else keeps working. Nothing you have stored — profiles, history, saved files — is touched.`,`You can cancel at any time from the customer portal linked in your receipt, or by writing to us. Cancelling stops future charges; the current period runs to its end. Refunds are described in the <a href="{refund}">refund policy</a>.`,`If we change the price of Pro, the new price applies from your next renewal at the earliest, and we tell you by email at least 30 days before that renewal so you can cancel first.`]},{heading:`4. Connection sync`,body:[`Connection sync is an optional Pro feature that keeps your connection profiles on more than one computer. Using it means signing in with a GitHub or Google account; that is the only case in which an account exists. Your profiles are encrypted in the browser with a passphrase you choose before they are uploaded, and the passphrase never leaves your machine. We cannot read the vault and we cannot recover it if you lose the passphrase.`,`Sync is only offered on planche.dev. You can delete your account and vault from the application at any time, or by writing to us. We may discontinue sync with at least 30 days’ notice, during which your profiles remain available on every signed-in computer.`]},{heading:`5. AI features`,body:[`Some features can ask a language model to explain a failed statement or a query plan. They only work if you configure a provider, and what is sent goes from the agent on your computer directly to that provider, under that provider’s terms and privacy policy — not through us. The material sent is narrow: the statement with its secrets masked, the database’s own error message, and the column names of the tables the statement refers to. No rows, hosts or credentials.`,`A model’s answer can be wrong. Suggested statements are shown for you to review; running them is your decision, and section 7 applies to it.`]},{heading:`6. Acceptable use`,body:[`You may only use Planche with databases you own or are authorised to access. You may not use it to gain access you do not have, to interfere with a service, or in breach of any law that applies to you. You may not circumvent or disable the licence check, and you may not expose the local agent to the network in a way that lets others use it as a proxy to your databases or to other hosts.`]},{heading:`7. Your data, your responsibility`,body:[`Planche executes the SQL you give it, and SQL can change or delete data. The safeguards in the application — read-only connections, confirmation of destructive statements, dry run — are aids and not guarantees. You are responsible for keeping backups of your databases and for reviewing statements before you run them, and we accept no responsibility for the effect of a statement you ran.`,`Planche stores your connection profiles, and if you choose so your passwords, in your browser’s storage and, for the agent, in a directory under your home folder. Protecting that computer is your responsibility.`]},{heading:`8. Changes to the service`,body:[`We improve Planche continuously and may add, change or remove features. A feature that is free today may become part of Pro in a later version; a version you already have keeps working as it did. We may stop offering the hosted application at planche.dev; the agent can serve its own copy of the application, so an installed Planche keeps working without it.`]},{heading:`9. No warranty`,body:[`PLANCHE IS PROVIDED “AS IS” AND “AS AVAILABLE”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. We do not promise that it will be uninterrupted, error-free or compatible with every database version.`]},{heading:`10. Limitation of liability`,body:[`TO THE EXTENT PERMITTED BY LAW, WE ARE NOT LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES, OR FOR LOSS OF DATA, PROFITS OR BUSINESS, ARISING FROM OR IN CONNECTION WITH PLANCHE. OUR TOTAL LIABILITY FOR ALL CLAIMS TOGETHER IS LIMITED TO THE AMOUNT YOU PAID US FOR PLANCHE IN THE TWELVE MONTHS BEFORE THE CLAIM AROSE.`,`Nothing in these terms excludes or limits liability that cannot be excluded under the law that applies to you, including liability for intent or gross negligence, or any right you have as a consumer under mandatory law.`]},{heading:`11. Termination`,body:[`You can stop using Planche at any time; there is no account to close unless you use sync. We may end your licence if you materially breach these terms, in which case you must stop using the software. Sections 7, 9, 10 and 13 survive termination.`]},{heading:`12. Changes to these terms`,body:[`We may update these terms. The date at the top says when they last changed. A change that affects Pro subscribers materially is announced by email at least 30 days before it takes effect; continued use after that date is acceptance. If you do not agree, cancel before the change takes effect.`]},{heading:`13. Governing law`,body:[`These terms are governed by the laws of the Republic of Korea, and disputes are subject to the courts of Seoul, Republic of Korea. If you are a consumer, this does not take away the protection of the mandatory consumer laws of the country you live in, or your right to bring a claim there.`]},{heading:`14. Contact`,body:[`Questions about these terms: ${d}.`]}]};`${f}${p}`,`${d}`,`${f}${p}`,`${d}`,`${d}`;var h=m.sections,g=n();function _(e){return e.replace(/\{([a-z]+)\}/g,(e,t)=>t in u?u[t]:e).replace(/<a href="/g,`<a target="_blank" rel="noreferrer" href="`)}function v(){let n=l(e=>e.activeDialog),d=l(e=>e.closeDialog),{t:p}=t();return(0,g.jsx)(c,{open:n===`terms`,onOpenChange:e=>{e||d()},children:(0,g.jsxs)(a,{className:`flex max-h-[85vh] flex-col sm:max-w-[640px]`,children:[(0,g.jsxs)(r,{children:[(0,g.jsx)(o,{children:p(`terms.title`)}),(0,g.jsxs)(s,{children:[p(`terms.version`,{version:1}),` · `,p(`terms.updated`,{date:f})]})]}),(0,g.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded-md border bg-muted/40 p-4 text-sm`,children:[(0,g.jsx)(`p`,{className:`mb-3 text-xs text-muted-foreground`,children:p(`terms.englishOnly`)}),h.map(e=>(0,g.jsxs)(`section`,{className:`mb-4 last:mb-0`,children:[(0,g.jsx)(`h3`,{className:`mb-1 font-semibold`,children:e.heading}),e.body.map((e,t)=>(0,g.jsx)(`p`,{className:`mb-2 leading-relaxed text-muted-foreground last:mb-0 [&_a]:underline [&_a]:underline-offset-2 [&_code]:rounded [&_code]:bg-muted [&_code]:px-1`,dangerouslySetInnerHTML:{__html:_(e)}},t))]},e.heading))]}),(0,g.jsxs)(i,{className:`sm:justify-between`,children:[(0,g.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-xs`,children:[(0,g.jsx)(`a`,{href:u.terms,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:p(`terms.online`)}),(0,g.jsx)(`a`,{href:u.privacy,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:p(`terms.privacyLink`)}),(0,g.jsx)(`a`,{href:u.refund,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:p(`terms.refundLink`)})]}),(0,g.jsx)(e,{onClick:d,children:p(`settings.done`)})]})]})})}export{v as TermsDialog};
1
+ import{t as e}from"./CiL8zoYm.js";import{i as t,r as n}from"./Cu_sGzNJ.js";import{a as r,i,n as a,o,r as s,t as c}from"./DzRyVlxz.js";import"./DU-Eln5x.js";import{n as l}from"./D8_hwGjG.js";import{Y as u}from"./B_zu4Zim.js";var d=`<a href="mailto:planche.dev@gmail.com">planche.dev@gmail.com</a>`,f=`2 September 2026`,p=`Planche is made and operated by <strong>deploy</strong>, a sole proprietorship registered in the Republic of Korea and owned by Juwon Jeong (“we”, “us”), at 1114 Gyeongui-ro, 4th floor, Room 405, Paju-si, Gyeonggi-do, Republic of Korea. Contact: ${d}.`,m={title:`Terms of Service — Planche`,description:`The terms under which the Planche SQL client, the local agent and Planche Pro are provided.`,ogTitle:`Planche terms of service`,h1:`Terms of Service`,intro:`Last updated ${f}. These terms cover the website and web application at planche.dev, the local agent published on npm as <code>planche</code> and by the install scripts, and the Planche Pro subscription. By using any of them you agree to these terms. ${p}`,cta:`Open Planche`,static:!0,sections:[{heading:`1. What Planche is`,body:[`Planche is a SQL client. The application runs in your browser. For MySQL, MariaDB, PostgreSQL, SQL Server, Oracle and the hosted services it supports, a small program — the local agent — runs on your own computer, holds the database connections and answers the browser over the loopback interface. SQLite files are opened inside the browser itself.`,`We host the application as a static site and nothing else. Your connection profiles, passwords, queries and results travel between your browser, the agent on your machine and your databases; none of them pass through a server of ours. The <a href="{privacy}">privacy policy</a> lists the few things that do reach us or a service we use.`,`Planche is free to use for personal and commercial purposes without an account. A set of advanced features, listed on the <a href="{pricing}">pricing page</a>, requires a Pro licence.`]},{heading:`2. Licence to use the software`,body:[`We grant you a non-exclusive, non-transferable licence to use the Planche application and the local agent, on any number of computers you own or control, for the purpose of working with databases you are authorised to access.`,`You may not redistribute, sell, rent or sublicense Planche or the agent, offer either to third parties as part of a product or service, modify or create derivative works of them, reverse engineer or decompile them except where the law grants you that right regardless of this clause, or remove any copyright or proprietary notice. Planche is proprietary software; it is not open source.`,`The agent package ships with its own licence agreement (the <code>LICENSE</code> file in the package). For the agent, that agreement applies together with these terms; if the two differ, the package licence prevails for the copy you installed.`,`Planche includes third-party open-source components, each under its own licence. Those licences govern those components and nothing here limits the rights they give you. The list is at <a href="/third-party-notices.txt">third-party-notices.txt</a>.`]},{heading:`3. Planche Pro`,body:[`Pro is a subscription, billed monthly or yearly, that unlocks the features listed on the <a href="{pricing}">pricing page</a>. It is sold through a payment provider acting as our merchant of record and authorised reseller: the provider is the seller on the transaction, processes the payment, and collects and remits any VAT or sales tax that applies. The provider’s name, the price, the currency and any tax are shown at checkout before you pay, and the provider’s own terms apply to the purchase itself.`,`After payment you receive a licence key, on the order page and by email. A key is a signed statement of who bought it, which plan and for which period; the application verifies it on your computer without contacting anyone. A key covers <strong>one person</strong> on every computer that person uses. It may not be shared, published, or resold, and a key found published may be excluded from renewal. For several people, buy one licence each or write to us about a team licence.`,`Because a key is verified offline, it cannot be withdrawn before it expires. Keys are therefore issued for exactly the period that was paid for. While your subscription stays paid you receive a key that covers each new period; when it ends, the Pro features stop at the end of the last paid period and everything else keeps working. Nothing you have stored — profiles, history, saved files — is touched.`,`You can cancel at any time from the customer portal linked in your receipt, or by writing to us. Cancelling stops future charges; the current period runs to its end. Refunds are described in the <a href="{refund}">refund policy</a>.`,`If we change the price of Pro, the new price applies from your next renewal at the earliest, and we tell you by email at least 30 days before that renewal so you can cancel first.`]},{heading:`4. Connection sync`,body:[`Connection sync is an optional Pro feature that keeps your connection profiles on more than one computer. Using it means signing in with a GitHub or Google account; that is the only case in which an account exists. Your profiles are encrypted in the browser with a passphrase you choose before they are uploaded, and the passphrase never leaves your machine. We cannot read the vault and we cannot recover it if you lose the passphrase.`,`Sync is only offered on planche.dev. You can delete your account and vault from the application at any time, or by writing to us. We may discontinue sync with at least 30 days’ notice, during which your profiles remain available on every signed-in computer.`]},{heading:`5. AI features`,body:[`Some features can ask a language model to explain a failed statement or a query plan. They only work if you configure a provider, and what is sent goes from the agent on your computer directly to that provider, under that provider’s terms and privacy policy — not through us. The material sent is narrow: the statement with its secrets masked, the database’s own error message, and the column names of the tables the statement refers to. No rows, hosts or credentials.`,`A model’s answer can be wrong. Suggested statements are shown for you to review; running them is your decision, and section 7 applies to it.`]},{heading:`6. Acceptable use`,body:[`You may only use Planche with databases you own or are authorised to access. You may not use it to gain access you do not have, to interfere with a service, or in breach of any law that applies to you. You may not circumvent or disable the licence check, and you may not expose the local agent to the network in a way that lets others use it as a proxy to your databases or to other hosts.`]},{heading:`7. Your data, your responsibility`,body:[`Planche executes the SQL you give it, and SQL can change or delete data. The safeguards in the application — read-only connections, confirmation of destructive statements, dry run — are aids and not guarantees. You are responsible for keeping backups of your databases and for reviewing statements before you run them, and we accept no responsibility for the effect of a statement you ran.`,`Planche stores your connection profiles, and if you choose so your passwords, in your browser’s storage and, for the agent, in a directory under your home folder. Protecting that computer is your responsibility.`]},{heading:`8. Changes to the service`,body:[`We improve Planche continuously and may add, change or remove features. A feature that is free today may become part of Pro in a later version; a version you already have keeps working as it did. We may stop offering the hosted application at planche.dev; the agent can serve its own copy of the application, so an installed Planche keeps working without it.`]},{heading:`9. No warranty`,body:[`PLANCHE IS PROVIDED “AS IS” AND “AS AVAILABLE”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. We do not promise that it will be uninterrupted, error-free or compatible with every database version.`]},{heading:`10. Limitation of liability`,body:[`TO THE EXTENT PERMITTED BY LAW, WE ARE NOT LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES, OR FOR LOSS OF DATA, PROFITS OR BUSINESS, ARISING FROM OR IN CONNECTION WITH PLANCHE. OUR TOTAL LIABILITY FOR ALL CLAIMS TOGETHER IS LIMITED TO THE AMOUNT YOU PAID US FOR PLANCHE IN THE TWELVE MONTHS BEFORE THE CLAIM AROSE.`,`Nothing in these terms excludes or limits liability that cannot be excluded under the law that applies to you, including liability for intent or gross negligence, or any right you have as a consumer under mandatory law.`]},{heading:`11. Termination`,body:[`You can stop using Planche at any time; there is no account to close unless you use sync. We may end your licence if you materially breach these terms, in which case you must stop using the software. Sections 7, 9, 10 and 13 survive termination.`]},{heading:`12. Changes to these terms`,body:[`We may update these terms. The date at the top says when they last changed. A change that affects Pro subscribers materially is announced by email at least 30 days before it takes effect; continued use after that date is acceptance. If you do not agree, cancel before the change takes effect.`]},{heading:`13. Governing law`,body:[`These terms are governed by the laws of the Republic of Korea, and disputes are subject to the courts of Seoul, Republic of Korea. If you are a consumer, this does not take away the protection of the mandatory consumer laws of the country you live in, or your right to bring a claim there.`]},{heading:`14. Contact`,body:[`Questions about these terms: ${d}.`]}]};`${f}${p}`,`${d}`,`${f}${p}`,`${d}`,`${d}`;var h=m.sections,g=n();function _(e){return e.replace(/\{([a-z]+)\}/g,(e,t)=>t in u?u[t]:e).replace(/<a href="/g,`<a target="_blank" rel="noreferrer" href="`)}function v(){let n=l(e=>e.activeDialog),d=l(e=>e.closeDialog),{t:p}=t();return(0,g.jsx)(c,{open:n===`terms`,onOpenChange:e=>{e||d()},children:(0,g.jsxs)(a,{className:`flex max-h-[85vh] flex-col sm:max-w-[640px]`,children:[(0,g.jsxs)(r,{children:[(0,g.jsx)(o,{children:p(`terms.title`)}),(0,g.jsxs)(s,{children:[p(`terms.version`,{version:1}),` · `,p(`terms.updated`,{date:f})]})]}),(0,g.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded-md border bg-muted/40 p-4 text-sm`,children:[(0,g.jsx)(`p`,{className:`mb-3 text-xs text-muted-foreground`,children:p(`terms.englishOnly`)}),h.map(e=>(0,g.jsxs)(`section`,{className:`mb-4 last:mb-0`,children:[(0,g.jsx)(`h3`,{className:`mb-1 font-semibold`,children:e.heading}),e.body.map((e,t)=>(0,g.jsx)(`p`,{className:`mb-2 leading-relaxed text-muted-foreground last:mb-0 [&_a]:underline [&_a]:underline-offset-2 [&_code]:rounded [&_code]:bg-muted [&_code]:px-1`,dangerouslySetInnerHTML:{__html:_(e)}},t))]},e.heading))]}),(0,g.jsxs)(i,{className:`sm:justify-between`,children:[(0,g.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-xs`,children:[(0,g.jsx)(`a`,{href:u.terms,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:p(`terms.online`)}),(0,g.jsx)(`a`,{href:u.privacy,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:p(`terms.privacyLink`)}),(0,g.jsx)(`a`,{href:u.refund,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:p(`terms.refundLink`)})]}),(0,g.jsx)(e,{onClick:d,children:p(`settings.done`)})]})]})})}export{v as TermsDialog};
package/app/index.html CHANGED
@@ -50,32 +50,32 @@
50
50
  "offers": { "@type": "Offer", "price": "0", "priceCurrency": "USD" }
51
51
  }
52
52
  </script>
53
- <script type="module" crossorigin src="/assets/CExE8dKz.js"></script>
53
+ <script type="module" crossorigin src="/assets/B_zu4Zim.js"></script>
54
54
  <link rel="modulepreload" crossorigin href="/assets/hePW80VL.js">
55
55
  <link rel="modulepreload" crossorigin href="/assets/CYz610vE.js">
56
56
  <link rel="modulepreload" crossorigin href="/assets/Cu_sGzNJ.js">
57
57
  <link rel="modulepreload" crossorigin href="/assets/CiL8zoYm.js">
58
- <link rel="modulepreload" crossorigin href="/assets/BDtsGuIR.js">
58
+ <link rel="modulepreload" crossorigin href="/assets/C9jzAIEJ.js">
59
59
  <link rel="modulepreload" crossorigin href="/assets/DzRyVlxz.js">
60
60
  <link rel="modulepreload" crossorigin href="/assets/BGuDcBB_.js">
61
61
  <link rel="modulepreload" crossorigin href="/assets/D8dVzi6I.js">
62
62
  <link rel="modulepreload" crossorigin href="/assets/eFSiW0Lh.js">
63
63
  <link rel="modulepreload" crossorigin href="/assets/Nro86Y63.js">
64
64
  <link rel="modulepreload" crossorigin href="/assets/DU-Eln5x.js">
65
- <link rel="modulepreload" crossorigin href="/assets/S7HbowYz.js">
65
+ <link rel="modulepreload" crossorigin href="/assets/CAd2f6EE.js">
66
66
  <link rel="modulepreload" crossorigin href="/assets/Bit0Kfog.js">
67
- <link rel="modulepreload" crossorigin href="/assets/BjwrN_ch.js">
67
+ <link rel="modulepreload" crossorigin href="/assets/BPLdNS4h.js">
68
68
  <link rel="modulepreload" crossorigin href="/assets/D8_hwGjG.js">
69
- <link rel="modulepreload" crossorigin href="/assets/C1gqjEN3.js">
70
- <link rel="modulepreload" crossorigin href="/assets/BkXrfAoR.js">
71
- <link rel="modulepreload" crossorigin href="/assets/BRZhVXRC.js">
69
+ <link rel="modulepreload" crossorigin href="/assets/D6SRSRpo.js">
70
+ <link rel="modulepreload" crossorigin href="/assets/BghfQrAj.js">
71
+ <link rel="modulepreload" crossorigin href="/assets/Ci1xBOLy.js">
72
72
  <link rel="modulepreload" crossorigin href="/assets/DAFA-E1-.js">
73
- <link rel="modulepreload" crossorigin href="/assets/B9dhM8vw.js">
74
- <link rel="modulepreload" crossorigin href="/assets/DPyLA6Dl.js">
75
- <link rel="modulepreload" crossorigin href="/assets/BnJGrP6V.js">
76
- <link rel="modulepreload" crossorigin href="/assets/9gOj-Ty3.js">
73
+ <link rel="modulepreload" crossorigin href="/assets/CSjIZAje.js">
74
+ <link rel="modulepreload" crossorigin href="/assets/mA16m5gB.js">
75
+ <link rel="modulepreload" crossorigin href="/assets/DpPKm22O.js">
76
+ <link rel="modulepreload" crossorigin href="/assets/BEY3Hwp0.js">
77
77
  <link rel="modulepreload" crossorigin href="/assets/Bs5VSn0X.js">
78
- <link rel="stylesheet" crossorigin href="/assets/w46wk7KI.css">
78
+ <link rel="stylesheet" crossorigin href="/assets/92hmrkfN.css">
79
79
  </head>
80
80
  <body>
81
81
  <div id="boot">Loading…</div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "planche",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
4
  "description": "Local agent for Planche — lets the browser-based Planche database client reach MySQL/MariaDB/PostgreSQL/SQLite/SQL Server/Oracle/Neon/Supabase/Cloudflare D1 databases, Redis, Elasticsearch/OpenSearch and local Durable Object storage from your machine.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "homepage": "https://planche.dev",
@@ -1 +0,0 @@
1
- import{c as e}from"./S7HbowYz.js";import{S as t}from"./BjwrN_ch.js";function n(n){t(n),e(n)}export{n as t};