planche 0.9.3 → 0.9.5

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 (82) hide show
  1. package/app/assets/{DpPKm22O.js → 15ORcG2N.js} +2 -2
  2. package/app/assets/{DmDLn1hv.js → Ahsdniz8.js} +1 -1
  3. package/app/assets/B5qa5yLu.js +1 -0
  4. package/app/assets/{C3skRSMN.js → B7sbjdEF.js} +1 -1
  5. package/app/assets/BCNsD3zL.js +1 -0
  6. package/app/assets/{XCH_yrJ8.js → BLX_0Iuc.js} +1 -1
  7. package/app/assets/{BPLdNS4h.js → BQ0kaqOO.js} +1 -1
  8. package/app/assets/{DzRyVlxz.js → BTOj30GE.js} +1 -1
  9. package/app/assets/{CSjIZAje.js → BXxY3z0A.js} +1 -1
  10. package/app/assets/{mHq6YiMc.js → BdU74M5l.js} +1 -1
  11. package/app/assets/{CYz610vE.js → BeP_ukJr.js} +1 -1
  12. package/app/assets/Bfg3uD4T.css +2 -0
  13. package/app/assets/{BNB2k8On.js → BfuyTuMK.js} +1 -1
  14. package/app/assets/{DjsycSVl.js → Bh2UJoox.js} +1 -1
  15. package/app/assets/{BTpuv2bS.js → BhLxz3YC.js} +1 -1
  16. package/app/assets/{B4e4BJ-q.js → BiLp3cou.js} +1 -1
  17. package/app/assets/{BXogLn0j.js → BoyxPMVw.js} +1 -1
  18. package/app/assets/{DyPVTkGX.js → Bu90AfVd.js} +1 -1
  19. package/app/assets/{B3qo2BmL.js → Bv67Bucf.js} +1 -1
  20. package/app/assets/{C63wLpkg.js → BvbKV2Ph.js} +1 -1
  21. package/app/assets/{CSE_C1ca.js → By6P807S.js} +1 -1
  22. package/app/assets/{C9jzAIEJ.js → Byi789lS.js} +2 -2
  23. package/app/assets/{aBt7vbXN.js → C9opSbIc.js} +1 -1
  24. package/app/assets/{CHn2dkeR.js → C9slUGvf.js} +1 -1
  25. package/app/assets/{D4aakMZ1.js → CC3-IIwu.js} +1 -1
  26. package/app/assets/{X0frSBI-.js → CGqyAL2g.js} +1 -1
  27. package/app/assets/{DMmbl7oU.js → CKXJnmcw.js} +1 -1
  28. package/app/assets/{Bx57-46U.js → CMCx7NXl.js} +1 -1
  29. package/app/assets/{BLF41w4B.js → CMfcs7CX.js} +1 -1
  30. package/app/assets/{DPKD37gk.js → COVjACfp.js} +1 -1
  31. package/app/assets/{mA16m5gB.js → CSN2XEIP.js} +1 -1
  32. package/app/assets/{baQnXYR8.js → CZXoH3lk.js} +1 -1
  33. package/app/assets/{DpcElnaI.js → Ce8qkYMi.js} +1 -1
  34. package/app/assets/{DtUkSj2L.js → CelfLV5M.js} +1 -1
  35. package/app/assets/{uCGINy9d.js → CgvdcEWD.js} +1 -1
  36. package/app/assets/{BkujllIu.js → ClNpo19j.js} +1 -1
  37. package/app/assets/{CCBiFHWk.js → CuJxaCIZ.js} +1 -1
  38. package/app/assets/{Xya13jwA.js → CxVt8Vsf.js} +1 -1
  39. package/app/assets/{D2dO-cBr.js → Cxx1wla0.js} +1 -1
  40. package/app/assets/{CYqQEBj7.js → CyrKbLfo.js} +1 -1
  41. package/app/assets/{Ci1xBOLy.js → D41s9TGC.js} +1 -1
  42. package/app/assets/{BFddfnRD.js → D7Waxc8J.js} +1 -1
  43. package/app/assets/{D6SRSRpo.js → DB8Yfa-s.js} +1 -1
  44. package/app/assets/{TqO-pPrr.js → DW_MDklv.js} +1 -1
  45. package/app/assets/{CiL8zoYm.js → DXIGhA87.js} +1 -1
  46. package/app/assets/{Cu_sGzNJ.js → DZh9ctSS.js} +1 -1
  47. package/app/assets/{B_zu4Zim.js → Dg41U79W.js} +104 -104
  48. package/app/assets/{D8_hwGjG.js → DhVLQTui.js} +1 -1
  49. package/app/assets/{Cv7B7xE1.js → Di2WcKpj.js} +1 -1
  50. package/app/assets/{Bjupmf7v.js → Dlrlafts.js} +1 -1
  51. package/app/assets/{CCHDqJU3.js → DmQd5C4r.js} +1 -1
  52. package/app/assets/{ClHvsi-E.js → DmcF58Zy.js} +1 -1
  53. package/app/assets/{BFUEHSdO.js → DtfcGn7m.js} +1 -1
  54. package/app/assets/{CtvJotUV.js → DxPm34X2.js} +1 -1
  55. package/app/assets/{BanAYgsJ.js → ExkVtCby.js} +1 -1
  56. package/app/assets/{DdGvqbC0.js → ILIkaKLK.js} +1 -1
  57. package/app/assets/{DBwwgHNb.js → L7C8avu_.js} +1 -1
  58. package/app/assets/{CAd2f6EE.js → LVFEf5KC.js} +1 -1
  59. package/app/assets/{BghfQrAj.js → MpwA8CBH.js} +1 -1
  60. package/app/assets/{CgQ0qqq4.js → PDN9zqKI.js} +1 -1
  61. package/app/assets/{D8dVzi6I.js → PtmN2Kre.js} +1 -1
  62. package/app/assets/{rSe5GrVH.js → W9OfWY-V.js} +1 -1
  63. package/app/assets/{B8kALM_o.js → Y4o42QOf.js} +1 -1
  64. package/app/assets/{BFxd4DZC.js → _b2c4unB.js} +1 -1
  65. package/app/assets/{Uf0CXpNG.js → c3wgXM5y.js} +1 -1
  66. package/app/assets/{BmnRSOWE.js → clStr2A7.js} +1 -1
  67. package/app/assets/{DP7G83e7.js → fJSgP8kO.js} +1 -1
  68. package/app/assets/{DU-Eln5x.js → j8iiZuT2.js} +1 -1
  69. package/app/assets/{Dl3kZgxg.js → k417yOYE.js} +1 -1
  70. package/app/assets/{BYvM8E39.js → kOcXvaMR.js} +1 -1
  71. package/app/assets/{Ec3vNInq.js → lULYdyyn.js} +1 -1
  72. package/app/assets/{cFpo8ItN.js → rwxgujx6.js} +1 -1
  73. package/app/assets/{BGuDcBB_.js → sPLCZ3dr.js} +1 -1
  74. package/app/assets/{Bsl10NAd.js → sbeapBbo.js} +1 -1
  75. package/app/assets/{CMFMZu0I.js → uHjP6NCK.js} +1 -1
  76. package/app/assets/{Cw4TnfXm.js → vYaMeuUS.js} +1 -1
  77. package/app/assets/{_lYVFvcB.js → z8yMMV5K.js} +1 -1
  78. package/app/index.html +20 -20
  79. package/package.json +1 -1
  80. package/app/assets/92hmrkfN.css +0 -2
  81. package/app/assets/BEY3Hwp0.js +0 -1
  82. package/app/assets/BFw3KCAr.js +0 -1
@@ -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"./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
+ import{r as e}from"./hePW80VL.js";import{o as t,p as n}from"./BeP_ukJr.js";import{a as r,i,l as a}from"./DXIGhA87.js";import{r as o,t as s}from"./Byi789lS.js";import{i as c,n as l,r as u}from"./DZh9ctSS.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"./BTOj30GE.js";import{t as x}from"./LVFEf5KC.js";import{n as S,r as C}from"./j8iiZuT2.js";import{n as w}from"./DhVLQTui.js";import{n as T,t as E}from"./DB8Yfa-s.js";import{n as ee,t as D}from"./MpwA8CBH.js";import{i as O,t as k}from"./15ORcG2N.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"./Dg41U79W.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 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{t as n}from"./CAd2f6EE.js";import{y as r}from"./BPLdNS4h.js";import{t as i}from"./_zaonxnw.js";var a=e(t(),1),o=2e3;function s(e,t){let s=n(t=>t.activeConnections.find(t=>t.id===e)?.serverConnectionId??null),[c,l]=(0,a.useState)([]),[u,d]=(0,a.useState)(!1),[f,p]=(0,a.useState)(0),[m,h]=(0,a.useState)(null),g=(0,a.useRef)(null),_=(0,a.useRef)(t);(0,a.useEffect)(()=>{_.current=t},[t]);let v=(0,a.useCallback)(()=>{g.current?.(),g.current=null,d(!1)},[]),y=(0,a.useCallback)(async e=>{if(s){v(),h(null);try{g.current=await r({...e,connectionId:s},e=>{if(e.type===`dropped`)p(t=>t+e.count);else if(e.type===`error`)h(e.message);else{let t=_.current(e);t!==null&&l(e=>[t,...e].slice(0,o))}},()=>{g.current=null,d(!1)}),d(!0)}catch(e){h(i(e))}}},[s,v]);return(0,a.useEffect)(()=>()=>g.current?.(),[]),{rows:c,running:u,dropped:f,error:m,start:y,stop:v,clear:()=>{l([]),p(0)},dismissError:()=>h(null),connected:s!==null}}export{s as n,o as t};
1
+ import{r as e}from"./hePW80VL.js";import{p as t}from"./BeP_ukJr.js";import{t as n}from"./LVFEf5KC.js";import{y as r}from"./BQ0kaqOO.js";import{t as i}from"./_zaonxnw.js";var a=e(t(),1),o=2e3;function s(e,t){let s=n(t=>t.activeConnections.find(t=>t.id===e)?.serverConnectionId??null),[c,l]=(0,a.useState)([]),[u,d]=(0,a.useState)(!1),[f,p]=(0,a.useState)(0),[m,h]=(0,a.useState)(null),g=(0,a.useRef)(null),_=(0,a.useRef)(t);(0,a.useEffect)(()=>{_.current=t},[t]);let v=(0,a.useCallback)(()=>{g.current?.(),g.current=null,d(!1)},[]),y=(0,a.useCallback)(async e=>{if(s){v(),h(null);try{g.current=await r({...e,connectionId:s},e=>{if(e.type===`dropped`)p(t=>t+e.count);else if(e.type===`error`)h(e.message);else{let t=_.current(e);t!==null&&l(e=>[t,...e].slice(0,o))}},()=>{g.current=null,d(!1)}),d(!0)}catch(e){h(i(e))}}},[s,v]);return(0,a.useEffect)(()=>()=>g.current?.(),[]),{rows:c,running:u,dropped:f,error:m,start:y,stop:v,clear:()=>{l([]),p(0)},dismissError:()=>h(null),connected:s!==null}}export{s as n,o 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,t as a,u as o}from"./CiL8zoYm.js";import{i as s,r as c}from"./Cu_sGzNJ.js";import{C as l,D as u,O as d,T as f,a as p,i as m,n as ee,o as h,t as g}from"./DzRyVlxz.js";import{a as _,i as v,n as y,r as b,t as x}from"./B3qo2BmL.js";import{r as S,t as C}from"./Nro86Y63.js";import{A as w,f as T,j as E,t as D,w as O}from"./CAd2f6EE.js";import{O as k,g as A,m as te,o as ne}from"./BPLdNS4h.js";import{n as j,t as re}from"./D8_hwGjG.js";import{n as ie}from"./D6SRSRpo.js";import{C as ae,_ as oe,f as M,i as se,r as ce,u as N}from"./BghfQrAj.js";import{At as le,C as ue,H as de,Jt as fe,N as pe,P as me,S as P,T as F,a as he,an as I,b as ge,c as L,ct as _e,en as ve,i as ye,in as be,l as R,lt as xe,n as Se,nn as Ce,o as z,r as we,rn as Te,s as B,st as Ee,tn as V,u as H,vt as De,w as Oe,x as ke,z as Ae}from"./B_zu4Zim.js";import{t as U}from"./CnYBZPf9.js";var W=e(n(),1),G=c(),K=Object.defineProperty,q=(e,t)=>K(e,`name`,{value:t,configurable:!0}),je=`DropdownMenu`,[Me,Ne]=d(je,[I]),J=I(),[Pe,Fe]=Me(je),Ie=q(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=J(t),u=W.useRef(null),[d,p]=f({prop:i,defaultProp:a??!1,onChange:o,caller:je});return(0,G.jsx)(Pe,{scope:t,triggerId:l(),triggerRef:u,contentId:l(),open:d,onOpenChange:p,onOpenToggle:W.useCallback(()=>p(e=>!e),[p]),modal:s,children:(0,G.jsx)(be,{...c,open:d,onOpenChange:p,dir:r,modal:s,children:n})})},`DropdownMenu`),Le=`DropdownMenuTrigger`,Re=W.forwardRef(q(function(e,t){let{__scopeDropdownMenu:n,disabled:i=!1,...a}=e,s=Fe(Le,n),c=J(n),l=o(t,s.triggerRef);return(0,G.jsx)(ve,{asChild:!0,...c,children:(0,G.jsx)(r.button,{type:`button`,id:s.triggerId,"aria-haspopup":`menu`,"aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?`open`:`closed`,"data-disabled":i?``:void 0,disabled:i,...a,ref:l,onPointerDown:u(e.onPointerDown,e=>{!i&&e.button===0&&e.ctrlKey===!1&&(s.onOpenToggle(),s.open||e.preventDefault())}),onKeyDown:u(e.onKeyDown,e=>{i||([`Enter`,` `].includes(e.key)&&s.onOpenToggle(),e.key===`ArrowDown`&&s.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),ze=q(e=>{let{__scopeDropdownMenu:t,...n}=e,r=J(t);return(0,G.jsx)(Te,{...r,...n})},`DropdownMenuPortal`),Be=`DropdownMenuContent`,Ve=W.forwardRef(q(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Fe(Be,n),a=J(n),o=W.useRef(!1);return(0,G.jsx)(V,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:u(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:u(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuContent`)),He=W.forwardRef(q(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=J(n);return(0,G.jsx)(Ce,{...i,...r,ref:t})},`DropdownMenuItem`)),Ue=Ie,We=Re,Ge=ze,Ke=Ve,qe=He,Je=new Set([`postgres:`,`postgresql:`]);function Ye(e){let t=e.trim().replace(/^psql\s+(['"])?/,``).replace(/['"]$/,``);if(!/^postgres(ql)?:\/\//i.test(t))return null;let n;try{n=new URL(t)}catch{return null}if(!Je.has(n.protocol.toLowerCase())||!n.hostname)return null;let r=e=>{try{return decodeURIComponent(e)}catch{return e}},i={host:n.hostname};n.port&&(i.port=Number(n.port)),n.username&&(i.user=r(n.username)),n.password&&(i.pass=r(n.password));let a=r(n.pathname.replace(/^\//,``));return a&&(i.database=a),i}var Xe=new Set([`localhost`,`127.0.0.1`,`[::1]`,`::1`,`0.0.0.0`]);async function Ze(e,t){let n;try{let t=new URL(e);if(!Xe.has(t.hostname.toLowerCase()))return[];n=t.origin}catch{return[]}try{let e=await fetch(`${n}/cdn-cgi/local/explorer/api/d1/database`,{signal:t});if(!e.ok)return[];let r=await e.json(),i=new Map;for(let e of r.result??[])e.uuid&&i.set(e.uuid,{name:e.name??e.uuid,id:e.uuid});return[...i.values()]}catch{return[]}}var Qe=[`utf8`,`utf8mb4`,`latin1`,`ascii`,`euckr`,`sjis`,`big5`],$e={enabled:!1,host:``,port:22,user:``,auth:`key`};function Y({label:e,htmlFor:t,children:n}){return(0,G.jsxs)(`div`,{className:`grid grid-cols-[120px_minmax(0,1fr)] items-center gap-2`,children:[(0,G.jsx)(L,{htmlFor:t,children:e}),n]})}function et({value:e,onChange:t}){let{t:n}=s();function r(n,r){t({...e,[n]:r})}let[i,o]=(0,W.useState)([]),c=e.dbms===`d1`?e.devUrl??``:``;(0,W.useEffect)(()=>{if(!c){o([]);return}let e=new AbortController,t=setTimeout(()=>{Ze(c,e.signal).then(o)},300);return()=>{clearTimeout(t),e.abort()}},[c]);let l=e.dbms===`sqlite`,u=e.transport??`browser`,d=l&&u===`browser`,f=C.has(e.dbms),p=e.dbms===`d1`,m=e.dbms===`do`,ee=w.find(t=>t.id===e.dbms)?.capabilities,h=e.ssh??$e,[g,T]=(0,W.useState)(``),D=g.trim()===``?`empty`:Ye(g)?`applied`:`invalid`,O=e.dbms===`supabase`&&e.port===6543;function k(n){T(n);let r=Ye(n);r&&t({...e,host:r.host??e.host,port:r.port??w.find(t=>t.id===e.dbms)?.defaultPort??e.port,user:r.user??e.user,pass:r.pass??e.pass,database:r.database??e.database})}function A(n){t({...e,ssh:{...h,...n}})}async function te(e){e&&A({privateKey:await e.text(),privateKeyName:e.name})}return(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,G.jsx)(Y,{label:n(`connection.form.hostName`),htmlFor:`conn-hostName`,children:(0,G.jsx)(R,{id:`conn-hostName`,placeholder:n(`connection.form.hostNamePlaceholder`),value:e.hostName,onChange:e=>r(`hostName`,e.target.value)})}),(0,G.jsx)(Y,{label:n(`connection.form.dataSource`),children:(0,G.jsxs)(x,{value:e.dbms,onValueChange:n=>{let r=w.find(e=>e.id===n);if(!r)return;let i=r.id,a=C.has(i)||i===`d1`||i===`do`;T(``),t({...e,dbms:i,transactionMode:r.capabilities.transactions?e.transactionMode:`auto`,port:r.defaultPort??e.port,host:a&&e.host===`localhost`?``:!a&&e.host===``?`localhost`:e.host,user:a||f||p||m||e.user===B(e.dbms)?B(i):e.user,devUrl:i===`do`?e.devUrl||`http://localhost:8787`:e.devUrl,database:e.database&&!a&&!f&&!p&&!m?e.database:z(i)??e.database})},children:[(0,G.jsx)(v,{id:`conn-dbms`,className:`w-full`,children:(0,G.jsx)(_,{})}),(0,G.jsx)(y,{children:w.map(e=>(0,G.jsx)(b,{value:e.id,children:(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(H,{dbms:e.id}),e.label]})},e.id))})]})}),f&&(0,G.jsx)(Y,{label:n(`connection.form.connectionString`),htmlFor:`conn-uri`,children:(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(R,{id:`conn-uri`,type:`password`,autoComplete:`new-password`,spellCheck:!1,className:`font-mono text-xs`,placeholder:e.dbms===`neon`?`postgresql://neondb_owner:npg_…@ep-….neon.tech/neondb?sslmode=require`:`postgresql://postgres.[ref]:[password]@aws-0-….pooler.supabase.com:5432/postgres`,value:g,onChange:e=>k(e.target.value)}),(0,G.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed ${D===`invalid`?`text-destructive`:`text-muted-foreground`}`,children:n(D===`invalid`?`connection.form.connectionStringInvalid`:D===`applied`?`connection.form.connectionStringApplied`:e.dbms===`neon`?`connection.form.neonHint`:`connection.form.supabaseHint`)})]})}),l&&(0,G.jsxs)(Y,{label:n(`connection.form.openVia`),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,G.jsxs)(`label`,{className:`flex items-center gap-1.5 text-sm cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`radio`,name:`transport`,value:`browser`,checked:u===`browser`,onChange:()=>r(`transport`,`browser`),className:`accent-primary`}),n(`connection.form.viaBrowser`)]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-1.5 text-sm cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`radio`,name:`transport`,value:`tunnel`,checked:u===`tunnel`,onChange:()=>r(`transport`,`tunnel`),className:`accent-primary`}),n(`connection.form.viaAgent`)]})]}),(0,G.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(u===`browser`?`connection.form.viaBrowserHint`:`connection.form.viaAgentHint`)})]}),d?(0,G.jsx)(Y,{label:n(`connection.form.databaseFile`),children:(0,G.jsxs)(`div`,{className:`min-w-0 text-xs text-muted-foreground leading-relaxed`,children:[e.file?(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,G.jsx)(`span`,{className:`min-w-0 break-all text-foreground`,title:e.file,children:e.file}),(0,G.jsx)(a,{type:`button`,variant:`outline`,size:`sm`,className:`h-6 shrink-0 px-2 text-xs`,onClick:()=>{N(e.id),r(`file`,``)},children:n(`connection.form.changeFile`)})]}):(0,G.jsx)(`p`,{children:n(`connection.form.filePickerHint`)}),(0,G.jsx)(`p`,{className:`mt-1`,children:n(`connection.form.fileRememberedHint`)})]})}):null,!d&&(0,G.jsx)(Y,{label:n(`connection.form.authToken`),htmlFor:`conn-authToken`,children:(0,G.jsx)(R,{id:`conn-authToken`,type:`password`,autoComplete:`new-password`,placeholder:n(`connection.form.authTokenPlaceholder`),value:e.authToken,onChange:e=>r(`authToken`,e.target.value.trim())})}),d?null:m?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{label:n(`connection.form.doDevUrl`),htmlFor:`conn-do-url`,children:(0,G.jsx)(R,{id:`conn-do-url`,className:`font-mono text-xs`,spellCheck:!1,placeholder:`http://localhost:8787`,value:e.devUrl??``,onChange:e=>r(`devUrl`,e.target.value.trim())})}),(0,G.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.doHint`)}),(0,G.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.doLimitsHint`)})]}):p?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{label:n(`connection.form.d1DevUrl`),htmlFor:`conn-d1-dev`,children:(0,G.jsx)(R,{id:`conn-d1-dev`,autoComplete:`off`,className:`font-mono text-xs`,spellCheck:!1,placeholder:`http://localhost:8787`,value:e.devUrl??``,onChange:e=>r(`devUrl`,e.target.value.trim())})}),(0,G.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.d1DevUrlHint`)}),(0,G.jsx)(Y,{label:n(`connection.form.d1AccountId`),htmlFor:`conn-d1-account`,children:(0,G.jsx)(R,{id:`conn-d1-account`,autoComplete:`off`,className:`font-mono text-xs`,spellCheck:!1,placeholder:`023e105f4ecef8ad9ca31a8372d0c353`,value:e.accountId??``,onChange:e=>r(`accountId`,e.target.value.trim())})}),(0,G.jsx)(Y,{label:n(`connection.form.d1DatabaseId`),htmlFor:`conn-d1-database`,children:i.length>0?(0,G.jsxs)(x,{value:e.databaseId??``,onValueChange:e=>r(`databaseId`,e),children:[(0,G.jsx)(v,{id:`conn-d1-database`,children:(0,G.jsx)(_,{placeholder:n(`connection.form.d1PickDatabase`)})}),(0,G.jsx)(y,{children:i.map(e=>(0,G.jsxs)(b,{value:e.id,children:[e.name,` · `,e.id]},e.id))})]}):(0,G.jsx)(R,{id:`conn-d1-database`,autoComplete:`off`,className:`font-mono text-xs`,spellCheck:!1,placeholder:`xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`,value:e.databaseId??``,onChange:e=>r(`databaseId`,e.target.value.trim())})}),(0,G.jsx)(Y,{label:n(`connection.form.d1ApiToken`),htmlFor:`conn-pass`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(R,{id:`conn-pass`,type:`password`,autoComplete:`new-password`,value:e.pass,onChange:e=>r(`pass`,e.target.value.trim())}),(0,G.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs whitespace-nowrap cursor-pointer`,title:n(`connection.form.savePasswordHint`),children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:e.savePassword??!0,onChange:e=>r(`savePassword`,e.target.checked)}),n(`connection.form.savePassword`)]})]})}),(0,G.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.d1Hint`)}),(0,G.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.d1LimitsHint`)})]}):l?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{label:n(`connection.form.databaseFile`),htmlFor:`conn-file`,children:(0,G.jsx)(R,{id:`conn-file`,placeholder:n(`connection.form.filePathPlaceholder`),value:e.file??``,onChange:e=>r(`file`,e.target.value)})}),(0,G.jsx)(Y,{label:n(`connection.form.createIfMissing`),htmlFor:`conn-create`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{id:`conn-create`,type:`checkbox`,checked:e.createIfMissing??!1,onChange:e=>r(`createIfMissing`,e.target.checked),className:`size-4 accent-primary cursor-pointer`}),(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`connection.form.createIfMissingHint`)})]})})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{label:n(`connection.form.host`),htmlFor:`conn-host`,children:(0,G.jsx)(R,{id:`conn-host`,placeholder:e.dbms===`neon`?`ep-….aws.neon.tech`:e.dbms===`supabase`?`aws-0-….pooler.supabase.com`:`localhost`,value:e.host,onChange:e=>r(`host`,e.target.value)})}),(0,G.jsx)(Y,{label:n(`connection.form.port`),htmlFor:`conn-port`,children:(0,G.jsx)(R,{id:`conn-port`,type:`number`,value:e.port,onChange:t=>r(`port`,Number(t.target.value)||w.find(t=>t.id===e.dbms)?.defaultPort||3306)})}),O&&(0,G.jsx)(`p`,{className:`col-start-2 rounded-md border border-yellow-500/40 bg-yellow-500/10 px-2 py-1.5 text-xs leading-relaxed text-foreground`,children:n(`connection.form.supabasePoolerWarning`)}),z(e.dbms)!==void 0&&(0,G.jsx)(Y,{label:e.dbms===`oracle`?n(`connection.form.serviceName`):n(`connection.form.database`),htmlFor:`conn-database`,children:(0,G.jsx)(R,{id:`conn-database`,placeholder:z(e.dbms),value:e.database??``,onChange:e=>r(`database`,e.target.value.trim())})}),(0,G.jsx)(Y,{label:n(`connection.form.user`),htmlFor:`conn-user`,children:(0,G.jsx)(R,{id:`conn-user`,autoComplete:`off`,placeholder:B(e.dbms),value:e.user,onChange:e=>r(`user`,e.target.value)})}),(0,G.jsx)(Y,{label:n(`connection.form.password`),htmlFor:`conn-pass`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(R,{id:`conn-pass`,type:`password`,autoComplete:`new-password`,value:e.pass,onChange:e=>r(`pass`,e.target.value)}),(0,G.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs whitespace-nowrap cursor-pointer`,title:n(`connection.form.savePasswordHint`),children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:e.savePassword??!0,onChange:e=>r(`savePassword`,e.target.checked)}),n(`connection.form.savePassword`)]})]})}),f&&(0,G.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.managedTlsHint`)}),(()=>{let t=E(e.dbms),r=`formHint`in t?t.formHint:void 0;return r?(0,G.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(r)}):null})(),!f&&e.dbms!==`oracle`&&(0,G.jsx)(Y,{label:n(`connection.form.tls`),children:(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,G.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:e.ssl??!1,onChange:e=>r(`ssl`,e.target.checked),className:`size-4 accent-primary`}),n(`connection.form.tlsEnable`)]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs cursor-pointer ${e.ssl?``:`opacity-50`}`,title:n(`connection.form.tlsVerifyHint`),children:[(0,G.jsx)(`input`,{type:`checkbox`,disabled:!e.ssl,checked:e.sslVerify??!1,onChange:e=>r(`sslVerify`,e.target.checked),className:`size-4 accent-primary`}),n(`connection.form.tlsVerify`)]})]})}),!f&&S(E(e.dbms))&&(0,G.jsx)(Y,{label:n(`connection.form.charset`),children:(0,G.jsxs)(x,{value:e.charset,onValueChange:e=>r(`charset`,e),children:[(0,G.jsx)(v,{className:`w-full`,children:(0,G.jsx)(_,{})}),(0,G.jsx)(y,{children:Qe.map(e=>(0,G.jsx)(b,{value:e,children:e},e))})]})})]}),!l&&!f&&!p&&!m&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`mt-1 flex items-center border-t pt-3 text-xs font-medium text-muted-foreground`,children:[n(`connection.form.ssh`),(0,G.jsx)(de,{className:`ml-2`})]}),(0,G.jsx)(Y,{label:n(`connection.form.sshTunnel`),htmlFor:`conn-ssh`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{id:`conn-ssh`,type:`checkbox`,checked:h.enabled,onChange:e=>{(!e.target.checked||Ae(`ssh_tunnel`))&&A({enabled:e.target.checked})},className:`size-4 accent-primary cursor-pointer`}),(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`connection.form.sshTunnelHint`)})]})}),h.enabled&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{label:n(`connection.form.sshHost`),htmlFor:`conn-ssh-host`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(R,{id:`conn-ssh-host`,placeholder:n(`connection.form.sshHostPlaceholder`),value:h.host,onChange:e=>A({host:e.target.value.trim()})}),(0,G.jsx)(R,{"aria-label":n(`connection.form.sshPort`),type:`number`,className:`w-24 shrink-0`,value:h.port,onChange:e=>A({port:Number(e.target.value)||22})})]})}),(0,G.jsx)(Y,{label:n(`connection.form.sshUser`),htmlFor:`conn-ssh-user`,children:(0,G.jsx)(R,{id:`conn-ssh-user`,placeholder:n(`connection.form.sshUserPlaceholder`),value:h.user,onChange:e=>A({user:e.target.value.trim()})})}),(0,G.jsx)(Y,{label:n(`connection.form.sshAuth`),children:(0,G.jsxs)(x,{value:h.auth,onValueChange:e=>A({auth:e}),children:[(0,G.jsx)(v,{className:`w-full`,children:(0,G.jsx)(_,{})}),(0,G.jsxs)(y,{children:[(0,G.jsx)(b,{value:`key`,children:n(`connection.form.sshAuthKey`)}),(0,G.jsx)(b,{value:`password`,children:n(`connection.form.sshAuthPassword`)}),(0,G.jsx)(b,{value:`agent`,children:n(`connection.form.sshAuthAgent`)})]})]})}),h.auth===`password`&&(0,G.jsx)(Y,{label:n(`connection.form.sshPassword`),htmlFor:`conn-ssh-pass`,children:(0,G.jsx)(R,{id:`conn-ssh-pass`,type:`password`,autoComplete:`new-password`,value:h.password??``,onChange:e=>A({password:e.target.value})})}),h.auth===`key`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{label:n(`connection.form.sshKey`),htmlFor:`conn-ssh-key`,children:(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(`input`,{id:`conn-ssh-key`,type:`file`,className:`hidden`,onChange:e=>{te(e.target.files?.[0]),e.target.value=``}}),(0,G.jsx)(a,{type:`button`,variant:`outline`,size:`sm`,className:`h-7 shrink-0 px-2 text-xs`,onClick:()=>document.getElementById(`conn-ssh-key`)?.click(),children:h.privateKey?n(`connection.form.changeFile`):n(`connection.form.sshKeyPick`)}),(0,G.jsx)(`span`,{className:`min-w-0 truncate text-xs text-muted-foreground`,title:h.privateKeyName,children:h.privateKey?h.privateKeyName||n(`connection.form.sshKeyLoaded`):n(`connection.form.sshKeyHint`)})]})}),(0,G.jsx)(Y,{label:n(`connection.form.sshPassphrase`),htmlFor:`conn-ssh-passphrase`,children:(0,G.jsx)(R,{id:`conn-ssh-passphrase`,type:`password`,autoComplete:`new-password`,placeholder:n(`connection.form.sshPassphrasePlaceholder`),value:h.passphrase??``,onChange:e=>A({passphrase:e.target.value})})})]}),h.auth===`agent`&&(0,G.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.sshAuthAgentHint`)}),(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.sshTargetHint`)}),(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.sshSecretsHint`)})]})]}),(0,G.jsx)(Y,{label:n(`connection.form.autoConnection`),htmlFor:`conn-auto`,children:(0,G.jsx)(`div`,{className:`flex items-center`,children:(0,G.jsx)(`input`,{id:`conn-auto`,type:`checkbox`,checked:e.autoConnection,onChange:e=>r(`autoConnection`,e.target.checked),className:`size-4 accent-primary cursor-pointer`})})}),(0,G.jsx)(`div`,{className:`mt-1 border-t pt-3 text-xs font-medium text-muted-foreground`,children:n(`connection.form.safety`)}),(0,G.jsx)(Y,{label:n(`connection.form.environment`),children:(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[pe.map(t=>{let n=(e.environmentColor??`none`)===t.id;return(0,G.jsx)(`button`,{type:`button`,title:me(t.id),"aria-label":me(t.id),"aria-pressed":n,onClick:()=>r(`environmentColor`,t.id),className:`size-6 rounded-full border-2 transition-transform ${n?`scale-110 border-foreground`:`border-transparent hover:scale-105`}`,style:{background:t.id===`none`?`repeating-linear-gradient(45deg, transparent, transparent 3px, var(--muted-foreground) 3px, var(--muted-foreground) 4px)`:t.hex}},t.id)}),(0,G.jsx)(`span`,{className:`ml-1 text-xs text-muted-foreground`,children:n(`connection.form.environmentHint`)})]})}),(0,G.jsx)(Y,{label:n(`connection.form.readOnly`),htmlFor:`conn-readonly`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{id:`conn-readonly`,type:`checkbox`,checked:e.readOnly??!1,onChange:e=>r(`readOnly`,e.target.checked),className:`size-4 accent-primary cursor-pointer`}),(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`connection.form.readOnlyHint`)})]})}),ee?.transactions!==!1&&(0,G.jsx)(Y,{label:n(`connection.form.transactions`),children:(0,G.jsxs)(x,{value:e.transactionMode??`auto`,onValueChange:e=>r(`transactionMode`,e),children:[(0,G.jsx)(v,{className:`w-full`,children:(0,G.jsx)(_,{})}),(0,G.jsxs)(y,{children:[(0,G.jsx)(b,{value:`auto`,children:n(`connection.form.txAuto`)}),(0,G.jsx)(b,{value:`manual`,children:n(`connection.form.txManual`)})]})]})})]})}var tt=[`id`,`serverConnectionId`,`sample`,`scratchpad`,`autoConnection`];function nt(e){return!e.sample&&!e.scratchpad}function rt(e,t,n=new Date){let r=t?e:O(e),i={...r};for(let e of tt)delete i[e];if(i.pass||delete i.pass,i.authToken||delete i.authToken,r.ssh){let e={...r.ssh};for(let t of[`password`,`passphrase`,`privateKey`])e[t]||delete e[t];i.ssh=e}return{planche:`connection`,version:1,exportedAt:n.toISOString(),secrets:t,connection:i}}function it(e){let t;try{t=JSON.parse(e)}catch{throw Error(`Not a JSON file`)}let n=t;if(!n||n.planche!==`connection`||!n.connection||typeof n.connection!=`object`)throw Error(`Not a Planche connection file`);if(typeof n.connection.dbms!=`string`||!n.connection.dbms)throw Error(`The connection has no database type`);return n}var X=(e,t=``)=>typeof e==`string`?e:t,Z=e=>typeof e==`boolean`?e:void 0,at=(e,t)=>typeof e==`number`&&Number.isFinite(e)?e:t,Q=e=>e===void 0||e===``?void 0:e;function ot(e){if(!e||typeof e!=`object`)return;let t=e,n=t.auth===`key`||t.auth===`agent`?t.auth:`password`;return{enabled:t.enabled===!0,host:X(t.host),port:at(t.port,22),user:X(t.user),auth:n,password:Q(X(t.password)),privateKey:Q(X(t.privateKey)),privateKeyName:Q(X(t.privateKeyName)),passphrase:Q(X(t.passphrase))}}function st(e,t,n=crypto.randomUUID()){let r=e.connection,i=Z(r.savePassword),a={id:n,hostName:ct(X(r.hostName),t),host:X(r.host),user:X(r.user),pass:X(r.pass),charset:X(r.charset,`utf8`),port:at(r.port,0),dbms:r.dbms,database:Q(X(r.database)),transport:r.transport===`tunnel`||r.transport===`browser`?r.transport:void 0,file:Q(X(r.file)),createIfMissing:Z(r.createIfMissing),ssl:Z(r.ssl),sslVerify:Z(r.sslVerify),accountId:Q(X(r.accountId)),databaseId:Q(X(r.databaseId)),devUrl:Q(X(r.devUrl)),ssh:ot(r.ssh),gatewayProfile:Q(X(r.gatewayProfile)),autoConnection:!1,savePassword:i??!0,authToken:X(r.authToken),readOnly:Z(r.readOnly),environmentColor:Q(X(r.environmentColor)),transactionMode:Q(X(r.transactionMode))};for(let e of Object.keys(a))a[e]===void 0&&delete a[e];return a}function ct(e,t){if(!e||!t.some(t=>t.hostName===e))return e;for(let n=2;;n++){let r=`${e} (${n})`;if(!t.some(e=>e.hostName===r))return r}}async function lt(e,t,n=`application/json`){let r=U(e);if(typeof window.showSaveFilePicker==`function`)try{let e=await(await window.showSaveFilePicker({suggestedName:r,types:[{accept:{[n]:[`.${r.split(`.`).pop()??`txt`}`]}}]})).createWritable();return await e.write(t),await e.close(),!0}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return!1}let i=URL.createObjectURL(new Blob([t],{type:n})),a=document.createElement(`a`);return a.href=i,a.download=r,a.click(),URL.revokeObjectURL(i),!0}function ut(e=`.json,application/json`){return new Promise(t=>{let n=document.createElement(`input`);n.type=`file`,n.accept=e,n.onchange=async()=>{let e=n.files?.[0];t(e?await e.text():null)},n.oncancel=()=>t(null),n.click()})}function dt({...e}){return(0,G.jsx)(Ue,{"data-slot":`dropdown-menu`,...e})}function ft({...e}){return(0,G.jsx)(We,{"data-slot":`dropdown-menu-trigger`,...e})}function pt({className:e,sideOffset:t=4,...n}){return(0,G.jsx)(Ge,{children:(0,G.jsx)(Ke,{"data-slot":`dropdown-menu-content`,sideOffset:t,className:i(`z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...n})})}function mt({className:e,inset:t,variant:n=`default`,...r}){return(0,G.jsx)(qe,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:i(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!`,e),...r})}function $(e,n,r){let i=_e(r);return t(`connection_error`,{action:e,dbms:n,reason:i}),Ee(i)}function ht(){let{t:e}=s(),{activeDialog:t,closeDialog:n,showMessage:r}=j(),[i,o]=(0,W.useState)(!1),{savedConnections:c,addSavedConnection:l,updateSavedConnection:u,deleteSavedConnection:d,openConnection:f}=D(),_=re(`connect`)?.profileId,[v,y]=(0,W.useState)(()=>_??null),[b,x]=(0,W.useState)(()=>{let e=_?c.find(e=>e.id===_):void 0;return e?{...e}:null}),S=t===`connect`,[C,w]=(0,W.useState)(null),[O,N]=(0,W.useState)(null),de=xe(e=>e.url),pe=xe(e=>e.token);(0,W.useEffect)(()=>{if(!S)return;let e=!1;return(async()=>{try{let t=await ne();if(e||t.state!==`online`||!t.gateway){e||w(null);return}let n=await te();e||(w({name:n.gateway,profiles:n.profiles}),N(null))}catch(t){e||N(t instanceof Error?t.message:String(t))}})(),()=>{e=!0}},[S,de,pe]);function me(t){let n=c.find(e=>e.gatewayProfile===t.name);if(n){L(n);return}let r=we(t);l(r),L(r),j.getState().setFooterMessage(e(`connection.dialog.gatewayAdded`,{name:t.name}))}function I(e){e||(n(),y(null),x(null))}function L(e){y(e.id),x({...e})}function _e(e){x(e),u(e.id,e)}function ve(){let e=he();l(e),y(e.id),x(e)}function be(){v&&(d(v),y(null),x(null))}async function R(t){let n=c.find(e=>e.id===v);if(!n||!nt(n))return;let r=n.hostName||e(`connection.dialog.unnamed`),i=rt(D.getState().resolveCredentials(n),t);await lt(`planche-connection-${r}.json`,JSON.stringify(i,null,2))&&j.getState().setFooterMessage(e(`connection.dialog.exported`,{name:r}))}async function Ce(){let t=await ut();if(t!==null)try{let n=st(it(t),D.getState().savedConnections);l(n),y(n.id),x(n),j.getState().setFooterMessage(e(`connection.dialog.imported`,{name:n.hostName||e(`connection.dialog.unnamed`)}))}catch(t){r({tone:`error`,title:e(`connection.dialog.importFailedTitle`),description:t instanceof Error?t.message:String(t)})}}let z=v!==null&&c.some(e=>e.id===v&&nt(e)),[Te,B]=(0,W.useState)(!1),Ee=ie(e=>e.addQueryTab);function V(t){let r=D.getState().activeConnections.some(e=>e.id===t.id);if(f(t),ae.getState().removeTree(t.id),T(t.id),r){n(),y(null),x(null);return}Ee(t.id,{id:`tab-${Date.now()}`,title:e(`connection.dialog.firstQueryTab`),query:``,database:``,isExecuting:!1,results:[],error:null,executionTime:null}),n(),y(null),x(null)}async function Ae(t){let n=await ce(t.id,{interactive:!0});if(!n)return;let r={...t,file:n.fileName,serverConnectionId:n.connectionId};u(t.id,{file:n.fileName}),V(r),D.getState().setFileDetached(t.id,n.fileDetached),n.restoredUnsaved?j.getState().setFooterMessage(e(n.diskChanged?`connection.dialog.restoredUnsavedDiskChanged`:`connection.dialog.restoredUnsaved`,{file:n.fileName})):n.wal&&!n.walApplied?j.getState().setFooterMessage(e(`connection.dialog.walPending`,{file:n.fileName})):n.walApplied&&j.getState().setFooterMessage(e(`connection.dialog.walApplied`,{file:n.fileName}))}async function U(t,n){try{return await n(t)}catch(r){let i=A(r);if(!i||!(`ssh`in t)||!t.ssh||!await j.getState().requestDestructiveConfirm({title:e(`connection.dialog.hostKeyTitle`),description:e(`connection.dialog.hostKeyDescription`,i),confirmLabel:e(`connection.dialog.hostKeyAccept`)}))throw r;return n({...t,ssh:{...t.ssh,acceptHostKey:i.fingerprint}})}}async function K(){if(b){B(!0);try{if(M(b)===`browser`){await Ae(b);return}let t=await U(k(b),e=>se(e,b.authToken||void 0));if(t.success)V({...b,serverConnectionId:t.connectionId});else{let n=$(`connect`,b.dbms,Error(t.message??``));r({tone:`error`,title:e(`connection.dialog.connectFailedTitle`),description:t.message??e(`connection.dialog.unknownError`),...n})}}catch(t){let n=$(`connect`,b.dbms,t);r({tone:`error`,title:e(`connection.dialog.connectFailedTitle`),description:t instanceof Error?t.message:String(t),...n})}finally{B(!1)}}}async function q(){if(b){if(M(b)===`browser`){r({tone:`info`,title:e(`connection.dialog.testConnection`),description:e(`connection.dialog.browserTestHint`)});return}o(!0);try{let t=await U(k(b),e=>oe(e,b.authToken||void 0));if(t.success)r({tone:`success`,title:e(`connection.dialog.testSuccess`),description:e(`connection.dialog.testSuccessDescription`)});else{let n=$(`test`,b.dbms,Error(t.message??``));r({tone:`error`,title:e(`connection.dialog.testFailedTitle`),description:t.message??e(`connection.dialog.unknownError`),...n})}}catch(t){let n=$(`test`,b.dbms,t);r({tone:`error`,title:e(`connection.dialog.testFailedTitle`),description:t instanceof Error?t.message:String(t),...n})}finally{o(!1)}}}return(0,G.jsx)(g,{open:S,onOpenChange:I,children:(0,G.jsxs)(ee,{className:`sm:max-w-[1100px] h-[85vh] max-h-[85vh] flex flex-col`,children:[(0,G.jsx)(p,{children:(0,G.jsx)(h,{children:e(`connection.dialog.title`)})}),(0,G.jsxs)(`p`,{className:`flex items-start gap-2 rounded-md border border-catppuccin-green/40 bg-catppuccin-green/10 px-3 py-2 text-xs leading-relaxed text-foreground`,children:[(0,G.jsx)(le,{className:`mt-0.5 size-4 shrink-0 text-catppuccin-green`,"aria-hidden":!0}),(0,G.jsx)(`span`,{children:e(`connection.dialog.privacy`)})]}),(0,G.jsxs)(`div`,{className:`flex flex-1 gap-4 overflow-hidden min-h-0`,children:[(0,G.jsxs)(`div`,{className:`w-[460px] shrink-0 border rounded-md overflow-hidden flex flex-col`,children:[(C||O)&&(0,G.jsxs)(`div`,{className:`border-b p-2 text-xs space-y-1 max-h-40 overflow-auto`,children:[(0,G.jsxs)(`p`,{className:`font-medium`,children:[e(`connection.dialog.gatewayTitle`),C?` — ${C.name}`:``]}),O&&(0,G.jsx)(`p`,{className:`text-destructive`,children:e(`connection.dialog.gatewayLoadFailed`,{error:O})}),C?.profiles.map(t=>(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5 truncate`,children:[(0,G.jsx)(H,{dbms:Se[t.driver],className:`size-3.5`}),(0,G.jsx)(`span`,{className:`truncate`,children:t.name}),(0,G.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,t.readOnly?e(`connection.dialog.gatewayReadOnly`):e(`connection.dialog.gatewayWritable`),`)`]})]}),(0,G.jsx)(a,{size:`sm`,variant:`outline`,className:`h-6 px-2 text-xs`,onClick:()=>me(t),children:e(`connection.dialog.gatewayAdd`)})]},t.name))]}),(0,G.jsx)(De,{className:`h-full`,children:(0,G.jsxs)(ge,{className:`table-fixed`,children:[(0,G.jsx)(Oe,{children:(0,G.jsxs)(F,{children:[(0,G.jsx)(ue,{className:`w-[32%]`,children:e(`connection.dialog.colHostName`)}),(0,G.jsx)(ue,{className:`w-[40%]`,children:e(`connection.dialog.colTarget`)}),(0,G.jsx)(ue,{className:`w-[28%]`,children:e(`connection.dialog.colDbms`)})]})}),(0,G.jsx)(ke,{children:c.length===0?(0,G.jsx)(F,{children:(0,G.jsx)(P,{colSpan:3,className:`text-center text-muted-foreground`,children:e(`connection.dialog.noSaved`)})}):c.map(t=>(0,G.jsxs)(F,{"data-state":v===t.id?`selected`:void 0,className:`cursor-pointer`,onClick:()=>L(t),onDoubleClick:()=>{L(t),K()},children:[(0,G.jsx)(P,{className:`truncate font-medium`,title:t.hostName,children:t.hostName||e(`connection.dialog.unnamed`)}),(0,G.jsx)(P,{className:`truncate`,title:t.dbms===`sqlite`?t.file:t.dbms===`d1`?t.databaseId:t.dbms===`do`?t.devUrl:`${t.user?`${t.user}@`:``}${t.host}:${t.port}`,children:t.dbms===`sqlite`?t.file||(M(t)===`browser`?e(`connection.dialog.pickOnConnect`):e(`connection.dialog.noFile`)):t.dbms===`d1`?t.databaseId||`—`:t.dbms===`do`?t.devUrl||`—`:`${t.user?`${t.user}@`:``}${t.host}:${t.port}`}),(0,G.jsx)(P,{className:`truncate`,title:E(t.dbms).label,children:(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(H,{dbms:t.dbms,className:`size-3.5`}),(0,G.jsx)(`span`,{className:`truncate`,children:E(t.dbms).label})]})})]},t.id))})]})})]}),(0,G.jsx)(`div`,{className:`flex-1 border rounded-md overflow-auto`,children:b?(0,G.jsxs)(G.Fragment,{children:[M(b)!==`browser`&&(0,G.jsx)(`div`,{className:`p-4 pb-0`,children:(0,G.jsx)(ye,{})}),b.gatewayProfile?(0,G.jsxs)(`div`,{className:`p-4 space-y-2 text-sm`,children:[(0,G.jsxs)(`p`,{className:`font-medium flex items-center gap-2`,children:[(0,G.jsx)(H,{dbms:b.dbms,className:`size-4`}),b.hostName]}),(0,G.jsx)(`p`,{className:`text-muted-foreground`,children:e(`connection.dialog.gatewayProfileHint`,{name:b.gatewayProfile})}),(0,G.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[b.readOnly?e(`connection.dialog.gatewayReadOnly`):e(`connection.dialog.gatewayWritable`),b.database?` · ${b.database}`:``]})]}):(0,G.jsx)(et,{value:b,onChange:_e})]}):(0,G.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground text-sm`,children:e(`connection.dialog.selectPrompt`)})})]}),(0,G.jsxs)(m,{className:`sm:justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(a,{variant:`outline`,onClick:ve,children:e(`connection.dialog.addNew`)}),(0,G.jsx)(a,{variant:`destructive`,onClick:be,disabled:!v,children:e(`connection.dialog.delete`)}),(0,G.jsxs)(dt,{children:[(0,G.jsx)(ft,{asChild:!0,children:(0,G.jsxs)(a,{variant:`outline`,disabled:!z,children:[e(`connection.dialog.export`),(0,G.jsx)(fe,{className:`ml-1 size-3.5`,"aria-hidden":!0})]})}),(0,G.jsxs)(pt,{align:`start`,children:[(0,G.jsx)(mt,{onSelect:()=>void R(!1),children:e(`connection.dialog.exportWithoutSecrets`)}),(0,G.jsx)(mt,{onSelect:()=>void R(!0),children:e(`connection.dialog.exportWithSecrets`)})]})]}),(0,G.jsx)(a,{variant:`outline`,onClick:()=>void Ce(),children:e(`connection.dialog.import`)})]}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(a,{variant:`outline`,onClick:q,disabled:!b||i,children:e(`connection.dialog.testConnection`)}),(0,G.jsx)(a,{onClick:K,disabled:!b||Te,children:e(`connection.dialog.connect`)}),(0,G.jsx)(a,{variant:`outline`,onClick:()=>I(!1),children:e(`connection.dialog.close`)})]})]})]})})}export{ht as ConnectDialog};
1
+ import{r as e}from"./hePW80VL.js";import{o as t,p as n}from"./BeP_ukJr.js";import{a as r,i,t as a,u as o}from"./DXIGhA87.js";import{i as s,r as c}from"./DZh9ctSS.js";import{C as l,D as u,O as d,T as f,a as p,i as m,n as ee,o as h,t as g}from"./BTOj30GE.js";import{a as _,i as v,n as y,r as b,t as x}from"./Bv67Bucf.js";import{r as S,t as C}from"./Nro86Y63.js";import{A as w,f as T,j as E,t as D,w as O}from"./LVFEf5KC.js";import{O as k,g as A,m as te,o as ne}from"./BQ0kaqOO.js";import{n as j,t as re}from"./DhVLQTui.js";import{n as ie}from"./DB8Yfa-s.js";import{C as ae,_ as oe,f as M,i as se,r as ce,u as N}from"./MpwA8CBH.js";import{At as le,C as ue,H as de,Jt as fe,N as pe,P as me,S as P,T as F,a as he,an as I,b as ge,c as L,ct as _e,en as ve,i as ye,in as be,l as R,lt as xe,n as Se,nn as Ce,o as z,r as we,rn as Te,s as B,st as Ee,tn as V,u as H,vt as De,w as Oe,x as ke,z as Ae}from"./Dg41U79W.js";import{t as U}from"./CnYBZPf9.js";var W=e(n(),1),G=c(),K=Object.defineProperty,q=(e,t)=>K(e,`name`,{value:t,configurable:!0}),je=`DropdownMenu`,[Me,Ne]=d(je,[I]),J=I(),[Pe,Fe]=Me(je),Ie=q(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=J(t),u=W.useRef(null),[d,p]=f({prop:i,defaultProp:a??!1,onChange:o,caller:je});return(0,G.jsx)(Pe,{scope:t,triggerId:l(),triggerRef:u,contentId:l(),open:d,onOpenChange:p,onOpenToggle:W.useCallback(()=>p(e=>!e),[p]),modal:s,children:(0,G.jsx)(be,{...c,open:d,onOpenChange:p,dir:r,modal:s,children:n})})},`DropdownMenu`),Le=`DropdownMenuTrigger`,Re=W.forwardRef(q(function(e,t){let{__scopeDropdownMenu:n,disabled:i=!1,...a}=e,s=Fe(Le,n),c=J(n),l=o(t,s.triggerRef);return(0,G.jsx)(ve,{asChild:!0,...c,children:(0,G.jsx)(r.button,{type:`button`,id:s.triggerId,"aria-haspopup":`menu`,"aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?`open`:`closed`,"data-disabled":i?``:void 0,disabled:i,...a,ref:l,onPointerDown:u(e.onPointerDown,e=>{!i&&e.button===0&&e.ctrlKey===!1&&(s.onOpenToggle(),s.open||e.preventDefault())}),onKeyDown:u(e.onKeyDown,e=>{i||([`Enter`,` `].includes(e.key)&&s.onOpenToggle(),e.key===`ArrowDown`&&s.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),ze=q(e=>{let{__scopeDropdownMenu:t,...n}=e,r=J(t);return(0,G.jsx)(Te,{...r,...n})},`DropdownMenuPortal`),Be=`DropdownMenuContent`,Ve=W.forwardRef(q(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Fe(Be,n),a=J(n),o=W.useRef(!1);return(0,G.jsx)(V,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:u(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:u(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuContent`)),He=W.forwardRef(q(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=J(n);return(0,G.jsx)(Ce,{...i,...r,ref:t})},`DropdownMenuItem`)),Ue=Ie,We=Re,Ge=ze,Ke=Ve,qe=He,Je=new Set([`postgres:`,`postgresql:`]);function Ye(e){let t=e.trim().replace(/^psql\s+(['"])?/,``).replace(/['"]$/,``);if(!/^postgres(ql)?:\/\//i.test(t))return null;let n;try{n=new URL(t)}catch{return null}if(!Je.has(n.protocol.toLowerCase())||!n.hostname)return null;let r=e=>{try{return decodeURIComponent(e)}catch{return e}},i={host:n.hostname};n.port&&(i.port=Number(n.port)),n.username&&(i.user=r(n.username)),n.password&&(i.pass=r(n.password));let a=r(n.pathname.replace(/^\//,``));return a&&(i.database=a),i}var Xe=new Set([`localhost`,`127.0.0.1`,`[::1]`,`::1`,`0.0.0.0`]);async function Ze(e,t){let n;try{let t=new URL(e);if(!Xe.has(t.hostname.toLowerCase()))return[];n=t.origin}catch{return[]}try{let e=await fetch(`${n}/cdn-cgi/local/explorer/api/d1/database`,{signal:t});if(!e.ok)return[];let r=await e.json(),i=new Map;for(let e of r.result??[])e.uuid&&i.set(e.uuid,{name:e.name??e.uuid,id:e.uuid});return[...i.values()]}catch{return[]}}var Qe=[`utf8`,`utf8mb4`,`latin1`,`ascii`,`euckr`,`sjis`,`big5`],$e={enabled:!1,host:``,port:22,user:``,auth:`key`};function Y({label:e,htmlFor:t,children:n}){return(0,G.jsxs)(`div`,{className:`grid grid-cols-[120px_minmax(0,1fr)] items-center gap-2`,children:[(0,G.jsx)(L,{htmlFor:t,children:e}),n]})}function et({value:e,onChange:t}){let{t:n}=s();function r(n,r){t({...e,[n]:r})}let[i,o]=(0,W.useState)([]),c=e.dbms===`d1`?e.devUrl??``:``;(0,W.useEffect)(()=>{if(!c){o([]);return}let e=new AbortController,t=setTimeout(()=>{Ze(c,e.signal).then(o)},300);return()=>{clearTimeout(t),e.abort()}},[c]);let l=e.dbms===`sqlite`,u=e.transport??`browser`,d=l&&u===`browser`,f=C.has(e.dbms),p=e.dbms===`d1`,m=e.dbms===`do`,ee=w.find(t=>t.id===e.dbms)?.capabilities,h=e.ssh??$e,[g,T]=(0,W.useState)(``),D=g.trim()===``?`empty`:Ye(g)?`applied`:`invalid`,O=e.dbms===`supabase`&&e.port===6543;function k(n){T(n);let r=Ye(n);r&&t({...e,host:r.host??e.host,port:r.port??w.find(t=>t.id===e.dbms)?.defaultPort??e.port,user:r.user??e.user,pass:r.pass??e.pass,database:r.database??e.database})}function A(n){t({...e,ssh:{...h,...n}})}async function te(e){e&&A({privateKey:await e.text(),privateKeyName:e.name})}return(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,G.jsx)(Y,{label:n(`connection.form.hostName`),htmlFor:`conn-hostName`,children:(0,G.jsx)(R,{id:`conn-hostName`,placeholder:n(`connection.form.hostNamePlaceholder`),value:e.hostName,onChange:e=>r(`hostName`,e.target.value)})}),(0,G.jsx)(Y,{label:n(`connection.form.dataSource`),children:(0,G.jsxs)(x,{value:e.dbms,onValueChange:n=>{let r=w.find(e=>e.id===n);if(!r)return;let i=r.id,a=C.has(i)||i===`d1`||i===`do`;T(``),t({...e,dbms:i,transactionMode:r.capabilities.transactions?e.transactionMode:`auto`,port:r.defaultPort??e.port,host:a&&e.host===`localhost`?``:!a&&e.host===``?`localhost`:e.host,user:a||f||p||m||e.user===B(e.dbms)?B(i):e.user,devUrl:i===`do`?e.devUrl||`http://localhost:8787`:e.devUrl,database:e.database&&!a&&!f&&!p&&!m?e.database:z(i)??e.database})},children:[(0,G.jsx)(v,{id:`conn-dbms`,className:`w-full`,children:(0,G.jsx)(_,{})}),(0,G.jsx)(y,{children:w.map(e=>(0,G.jsx)(b,{value:e.id,children:(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(H,{dbms:e.id}),e.label]})},e.id))})]})}),f&&(0,G.jsx)(Y,{label:n(`connection.form.connectionString`),htmlFor:`conn-uri`,children:(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(R,{id:`conn-uri`,type:`password`,autoComplete:`new-password`,spellCheck:!1,className:`font-mono text-xs`,placeholder:e.dbms===`neon`?`postgresql://neondb_owner:npg_…@ep-….neon.tech/neondb?sslmode=require`:`postgresql://postgres.[ref]:[password]@aws-0-….pooler.supabase.com:5432/postgres`,value:g,onChange:e=>k(e.target.value)}),(0,G.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed ${D===`invalid`?`text-destructive`:`text-muted-foreground`}`,children:n(D===`invalid`?`connection.form.connectionStringInvalid`:D===`applied`?`connection.form.connectionStringApplied`:e.dbms===`neon`?`connection.form.neonHint`:`connection.form.supabaseHint`)})]})}),l&&(0,G.jsxs)(Y,{label:n(`connection.form.openVia`),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,G.jsxs)(`label`,{className:`flex items-center gap-1.5 text-sm cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`radio`,name:`transport`,value:`browser`,checked:u===`browser`,onChange:()=>r(`transport`,`browser`),className:`accent-primary`}),n(`connection.form.viaBrowser`)]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-1.5 text-sm cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`radio`,name:`transport`,value:`tunnel`,checked:u===`tunnel`,onChange:()=>r(`transport`,`tunnel`),className:`accent-primary`}),n(`connection.form.viaAgent`)]})]}),(0,G.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(u===`browser`?`connection.form.viaBrowserHint`:`connection.form.viaAgentHint`)})]}),d?(0,G.jsx)(Y,{label:n(`connection.form.databaseFile`),children:(0,G.jsxs)(`div`,{className:`min-w-0 text-xs text-muted-foreground leading-relaxed`,children:[e.file?(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,G.jsx)(`span`,{className:`min-w-0 break-all text-foreground`,title:e.file,children:e.file}),(0,G.jsx)(a,{type:`button`,variant:`outline`,size:`sm`,className:`h-6 shrink-0 px-2 text-xs`,onClick:()=>{N(e.id),r(`file`,``)},children:n(`connection.form.changeFile`)})]}):(0,G.jsx)(`p`,{children:n(`connection.form.filePickerHint`)}),(0,G.jsx)(`p`,{className:`mt-1`,children:n(`connection.form.fileRememberedHint`)})]})}):null,!d&&(0,G.jsx)(Y,{label:n(`connection.form.authToken`),htmlFor:`conn-authToken`,children:(0,G.jsx)(R,{id:`conn-authToken`,type:`password`,autoComplete:`new-password`,placeholder:n(`connection.form.authTokenPlaceholder`),value:e.authToken,onChange:e=>r(`authToken`,e.target.value.trim())})}),d?null:m?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{label:n(`connection.form.doDevUrl`),htmlFor:`conn-do-url`,children:(0,G.jsx)(R,{id:`conn-do-url`,className:`font-mono text-xs`,spellCheck:!1,placeholder:`http://localhost:8787`,value:e.devUrl??``,onChange:e=>r(`devUrl`,e.target.value.trim())})}),(0,G.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.doHint`)}),(0,G.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.doLimitsHint`)})]}):p?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{label:n(`connection.form.d1DevUrl`),htmlFor:`conn-d1-dev`,children:(0,G.jsx)(R,{id:`conn-d1-dev`,autoComplete:`off`,className:`font-mono text-xs`,spellCheck:!1,placeholder:`http://localhost:8787`,value:e.devUrl??``,onChange:e=>r(`devUrl`,e.target.value.trim())})}),(0,G.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.d1DevUrlHint`)}),(0,G.jsx)(Y,{label:n(`connection.form.d1AccountId`),htmlFor:`conn-d1-account`,children:(0,G.jsx)(R,{id:`conn-d1-account`,autoComplete:`off`,className:`font-mono text-xs`,spellCheck:!1,placeholder:`023e105f4ecef8ad9ca31a8372d0c353`,value:e.accountId??``,onChange:e=>r(`accountId`,e.target.value.trim())})}),(0,G.jsx)(Y,{label:n(`connection.form.d1DatabaseId`),htmlFor:`conn-d1-database`,children:i.length>0?(0,G.jsxs)(x,{value:e.databaseId??``,onValueChange:e=>r(`databaseId`,e),children:[(0,G.jsx)(v,{id:`conn-d1-database`,children:(0,G.jsx)(_,{placeholder:n(`connection.form.d1PickDatabase`)})}),(0,G.jsx)(y,{children:i.map(e=>(0,G.jsxs)(b,{value:e.id,children:[e.name,` · `,e.id]},e.id))})]}):(0,G.jsx)(R,{id:`conn-d1-database`,autoComplete:`off`,className:`font-mono text-xs`,spellCheck:!1,placeholder:`xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`,value:e.databaseId??``,onChange:e=>r(`databaseId`,e.target.value.trim())})}),(0,G.jsx)(Y,{label:n(`connection.form.d1ApiToken`),htmlFor:`conn-pass`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(R,{id:`conn-pass`,type:`password`,autoComplete:`new-password`,value:e.pass,onChange:e=>r(`pass`,e.target.value.trim())}),(0,G.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs whitespace-nowrap cursor-pointer`,title:n(`connection.form.savePasswordHint`),children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:e.savePassword??!0,onChange:e=>r(`savePassword`,e.target.checked)}),n(`connection.form.savePassword`)]})]})}),(0,G.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.d1Hint`)}),(0,G.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.d1LimitsHint`)})]}):l?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{label:n(`connection.form.databaseFile`),htmlFor:`conn-file`,children:(0,G.jsx)(R,{id:`conn-file`,placeholder:n(`connection.form.filePathPlaceholder`),value:e.file??``,onChange:e=>r(`file`,e.target.value)})}),(0,G.jsx)(Y,{label:n(`connection.form.createIfMissing`),htmlFor:`conn-create`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{id:`conn-create`,type:`checkbox`,checked:e.createIfMissing??!1,onChange:e=>r(`createIfMissing`,e.target.checked),className:`size-4 accent-primary cursor-pointer`}),(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`connection.form.createIfMissingHint`)})]})})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{label:n(`connection.form.host`),htmlFor:`conn-host`,children:(0,G.jsx)(R,{id:`conn-host`,placeholder:e.dbms===`neon`?`ep-….aws.neon.tech`:e.dbms===`supabase`?`aws-0-….pooler.supabase.com`:`localhost`,value:e.host,onChange:e=>r(`host`,e.target.value)})}),(0,G.jsx)(Y,{label:n(`connection.form.port`),htmlFor:`conn-port`,children:(0,G.jsx)(R,{id:`conn-port`,type:`number`,value:e.port,onChange:t=>r(`port`,Number(t.target.value)||w.find(t=>t.id===e.dbms)?.defaultPort||3306)})}),O&&(0,G.jsx)(`p`,{className:`col-start-2 rounded-md border border-yellow-500/40 bg-yellow-500/10 px-2 py-1.5 text-xs leading-relaxed text-foreground`,children:n(`connection.form.supabasePoolerWarning`)}),z(e.dbms)!==void 0&&(0,G.jsx)(Y,{label:e.dbms===`oracle`?n(`connection.form.serviceName`):n(`connection.form.database`),htmlFor:`conn-database`,children:(0,G.jsx)(R,{id:`conn-database`,placeholder:z(e.dbms),value:e.database??``,onChange:e=>r(`database`,e.target.value.trim())})}),(0,G.jsx)(Y,{label:n(`connection.form.user`),htmlFor:`conn-user`,children:(0,G.jsx)(R,{id:`conn-user`,autoComplete:`off`,placeholder:B(e.dbms),value:e.user,onChange:e=>r(`user`,e.target.value)})}),(0,G.jsx)(Y,{label:n(`connection.form.password`),htmlFor:`conn-pass`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(R,{id:`conn-pass`,type:`password`,autoComplete:`new-password`,value:e.pass,onChange:e=>r(`pass`,e.target.value)}),(0,G.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs whitespace-nowrap cursor-pointer`,title:n(`connection.form.savePasswordHint`),children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:e.savePassword??!0,onChange:e=>r(`savePassword`,e.target.checked)}),n(`connection.form.savePassword`)]})]})}),f&&(0,G.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.managedTlsHint`)}),(()=>{let t=E(e.dbms),r=`formHint`in t?t.formHint:void 0;return r?(0,G.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(r)}):null})(),!f&&e.dbms!==`oracle`&&(0,G.jsx)(Y,{label:n(`connection.form.tls`),children:(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,G.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:e.ssl??!1,onChange:e=>r(`ssl`,e.target.checked),className:`size-4 accent-primary`}),n(`connection.form.tlsEnable`)]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs cursor-pointer ${e.ssl?``:`opacity-50`}`,title:n(`connection.form.tlsVerifyHint`),children:[(0,G.jsx)(`input`,{type:`checkbox`,disabled:!e.ssl,checked:e.sslVerify??!1,onChange:e=>r(`sslVerify`,e.target.checked),className:`size-4 accent-primary`}),n(`connection.form.tlsVerify`)]})]})}),!f&&S(E(e.dbms))&&(0,G.jsx)(Y,{label:n(`connection.form.charset`),children:(0,G.jsxs)(x,{value:e.charset,onValueChange:e=>r(`charset`,e),children:[(0,G.jsx)(v,{className:`w-full`,children:(0,G.jsx)(_,{})}),(0,G.jsx)(y,{children:Qe.map(e=>(0,G.jsx)(b,{value:e,children:e},e))})]})})]}),!l&&!f&&!p&&!m&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`mt-1 flex items-center border-t pt-3 text-xs font-medium text-muted-foreground`,children:[n(`connection.form.ssh`),(0,G.jsx)(de,{className:`ml-2`})]}),(0,G.jsx)(Y,{label:n(`connection.form.sshTunnel`),htmlFor:`conn-ssh`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{id:`conn-ssh`,type:`checkbox`,checked:h.enabled,onChange:e=>{(!e.target.checked||Ae(`ssh_tunnel`))&&A({enabled:e.target.checked})},className:`size-4 accent-primary cursor-pointer`}),(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`connection.form.sshTunnelHint`)})]})}),h.enabled&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{label:n(`connection.form.sshHost`),htmlFor:`conn-ssh-host`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(R,{id:`conn-ssh-host`,placeholder:n(`connection.form.sshHostPlaceholder`),value:h.host,onChange:e=>A({host:e.target.value.trim()})}),(0,G.jsx)(R,{"aria-label":n(`connection.form.sshPort`),type:`number`,className:`w-24 shrink-0`,value:h.port,onChange:e=>A({port:Number(e.target.value)||22})})]})}),(0,G.jsx)(Y,{label:n(`connection.form.sshUser`),htmlFor:`conn-ssh-user`,children:(0,G.jsx)(R,{id:`conn-ssh-user`,placeholder:n(`connection.form.sshUserPlaceholder`),value:h.user,onChange:e=>A({user:e.target.value.trim()})})}),(0,G.jsx)(Y,{label:n(`connection.form.sshAuth`),children:(0,G.jsxs)(x,{value:h.auth,onValueChange:e=>A({auth:e}),children:[(0,G.jsx)(v,{className:`w-full`,children:(0,G.jsx)(_,{})}),(0,G.jsxs)(y,{children:[(0,G.jsx)(b,{value:`key`,children:n(`connection.form.sshAuthKey`)}),(0,G.jsx)(b,{value:`password`,children:n(`connection.form.sshAuthPassword`)}),(0,G.jsx)(b,{value:`agent`,children:n(`connection.form.sshAuthAgent`)})]})]})}),h.auth===`password`&&(0,G.jsx)(Y,{label:n(`connection.form.sshPassword`),htmlFor:`conn-ssh-pass`,children:(0,G.jsx)(R,{id:`conn-ssh-pass`,type:`password`,autoComplete:`new-password`,value:h.password??``,onChange:e=>A({password:e.target.value})})}),h.auth===`key`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{label:n(`connection.form.sshKey`),htmlFor:`conn-ssh-key`,children:(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(`input`,{id:`conn-ssh-key`,type:`file`,className:`hidden`,onChange:e=>{te(e.target.files?.[0]),e.target.value=``}}),(0,G.jsx)(a,{type:`button`,variant:`outline`,size:`sm`,className:`h-7 shrink-0 px-2 text-xs`,onClick:()=>document.getElementById(`conn-ssh-key`)?.click(),children:h.privateKey?n(`connection.form.changeFile`):n(`connection.form.sshKeyPick`)}),(0,G.jsx)(`span`,{className:`min-w-0 truncate text-xs text-muted-foreground`,title:h.privateKeyName,children:h.privateKey?h.privateKeyName||n(`connection.form.sshKeyLoaded`):n(`connection.form.sshKeyHint`)})]})}),(0,G.jsx)(Y,{label:n(`connection.form.sshPassphrase`),htmlFor:`conn-ssh-passphrase`,children:(0,G.jsx)(R,{id:`conn-ssh-passphrase`,type:`password`,autoComplete:`new-password`,placeholder:n(`connection.form.sshPassphrasePlaceholder`),value:h.passphrase??``,onChange:e=>A({passphrase:e.target.value})})})]}),h.auth===`agent`&&(0,G.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.sshAuthAgentHint`)}),(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.sshTargetHint`)}),(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.sshSecretsHint`)})]})]}),(0,G.jsx)(Y,{label:n(`connection.form.autoConnection`),htmlFor:`conn-auto`,children:(0,G.jsx)(`div`,{className:`flex items-center`,children:(0,G.jsx)(`input`,{id:`conn-auto`,type:`checkbox`,checked:e.autoConnection,onChange:e=>r(`autoConnection`,e.target.checked),className:`size-4 accent-primary cursor-pointer`})})}),(0,G.jsx)(`div`,{className:`mt-1 border-t pt-3 text-xs font-medium text-muted-foreground`,children:n(`connection.form.safety`)}),(0,G.jsx)(Y,{label:n(`connection.form.environment`),children:(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[pe.map(t=>{let n=(e.environmentColor??`none`)===t.id;return(0,G.jsx)(`button`,{type:`button`,title:me(t.id),"aria-label":me(t.id),"aria-pressed":n,onClick:()=>r(`environmentColor`,t.id),className:`size-6 rounded-full border-2 transition-transform ${n?`scale-110 border-foreground`:`border-transparent hover:scale-105`}`,style:{background:t.id===`none`?`repeating-linear-gradient(45deg, transparent, transparent 3px, var(--muted-foreground) 3px, var(--muted-foreground) 4px)`:t.hex}},t.id)}),(0,G.jsx)(`span`,{className:`ml-1 text-xs text-muted-foreground`,children:n(`connection.form.environmentHint`)})]})}),(0,G.jsx)(Y,{label:n(`connection.form.readOnly`),htmlFor:`conn-readonly`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{id:`conn-readonly`,type:`checkbox`,checked:e.readOnly??!1,onChange:e=>r(`readOnly`,e.target.checked),className:`size-4 accent-primary cursor-pointer`}),(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`connection.form.readOnlyHint`)})]})}),ee?.transactions!==!1&&(0,G.jsx)(Y,{label:n(`connection.form.transactions`),children:(0,G.jsxs)(x,{value:e.transactionMode??`auto`,onValueChange:e=>r(`transactionMode`,e),children:[(0,G.jsx)(v,{className:`w-full`,children:(0,G.jsx)(_,{})}),(0,G.jsxs)(y,{children:[(0,G.jsx)(b,{value:`auto`,children:n(`connection.form.txAuto`)}),(0,G.jsx)(b,{value:`manual`,children:n(`connection.form.txManual`)})]})]})})]})}var tt=[`id`,`serverConnectionId`,`sample`,`scratchpad`,`autoConnection`];function nt(e){return!e.sample&&!e.scratchpad}function rt(e,t,n=new Date){let r=t?e:O(e),i={...r};for(let e of tt)delete i[e];if(i.pass||delete i.pass,i.authToken||delete i.authToken,r.ssh){let e={...r.ssh};for(let t of[`password`,`passphrase`,`privateKey`])e[t]||delete e[t];i.ssh=e}return{planche:`connection`,version:1,exportedAt:n.toISOString(),secrets:t,connection:i}}function it(e){let t;try{t=JSON.parse(e)}catch{throw Error(`Not a JSON file`)}let n=t;if(!n||n.planche!==`connection`||!n.connection||typeof n.connection!=`object`)throw Error(`Not a Planche connection file`);if(typeof n.connection.dbms!=`string`||!n.connection.dbms)throw Error(`The connection has no database type`);return n}var X=(e,t=``)=>typeof e==`string`?e:t,Z=e=>typeof e==`boolean`?e:void 0,at=(e,t)=>typeof e==`number`&&Number.isFinite(e)?e:t,Q=e=>e===void 0||e===``?void 0:e;function ot(e){if(!e||typeof e!=`object`)return;let t=e,n=t.auth===`key`||t.auth===`agent`?t.auth:`password`;return{enabled:t.enabled===!0,host:X(t.host),port:at(t.port,22),user:X(t.user),auth:n,password:Q(X(t.password)),privateKey:Q(X(t.privateKey)),privateKeyName:Q(X(t.privateKeyName)),passphrase:Q(X(t.passphrase))}}function st(e,t,n=crypto.randomUUID()){let r=e.connection,i=Z(r.savePassword),a={id:n,hostName:ct(X(r.hostName),t),host:X(r.host),user:X(r.user),pass:X(r.pass),charset:X(r.charset,`utf8`),port:at(r.port,0),dbms:r.dbms,database:Q(X(r.database)),transport:r.transport===`tunnel`||r.transport===`browser`?r.transport:void 0,file:Q(X(r.file)),createIfMissing:Z(r.createIfMissing),ssl:Z(r.ssl),sslVerify:Z(r.sslVerify),accountId:Q(X(r.accountId)),databaseId:Q(X(r.databaseId)),devUrl:Q(X(r.devUrl)),ssh:ot(r.ssh),gatewayProfile:Q(X(r.gatewayProfile)),autoConnection:!1,savePassword:i??!0,authToken:X(r.authToken),readOnly:Z(r.readOnly),environmentColor:Q(X(r.environmentColor)),transactionMode:Q(X(r.transactionMode))};for(let e of Object.keys(a))a[e]===void 0&&delete a[e];return a}function ct(e,t){if(!e||!t.some(t=>t.hostName===e))return e;for(let n=2;;n++){let r=`${e} (${n})`;if(!t.some(e=>e.hostName===r))return r}}async function lt(e,t,n=`application/json`){let r=U(e);if(typeof window.showSaveFilePicker==`function`)try{let e=await(await window.showSaveFilePicker({suggestedName:r,types:[{accept:{[n]:[`.${r.split(`.`).pop()??`txt`}`]}}]})).createWritable();return await e.write(t),await e.close(),!0}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return!1}let i=URL.createObjectURL(new Blob([t],{type:n})),a=document.createElement(`a`);return a.href=i,a.download=r,a.click(),URL.revokeObjectURL(i),!0}function ut(e=`.json,application/json`){return new Promise(t=>{let n=document.createElement(`input`);n.type=`file`,n.accept=e,n.onchange=async()=>{let e=n.files?.[0];t(e?await e.text():null)},n.oncancel=()=>t(null),n.click()})}function dt({...e}){return(0,G.jsx)(Ue,{"data-slot":`dropdown-menu`,...e})}function ft({...e}){return(0,G.jsx)(We,{"data-slot":`dropdown-menu-trigger`,...e})}function pt({className:e,sideOffset:t=4,...n}){return(0,G.jsx)(Ge,{children:(0,G.jsx)(Ke,{"data-slot":`dropdown-menu-content`,sideOffset:t,className:i(`z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...n})})}function mt({className:e,inset:t,variant:n=`default`,...r}){return(0,G.jsx)(qe,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:i(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!`,e),...r})}function $(e,n,r){let i=_e(r);return t(`connection_error`,{action:e,dbms:n,reason:i}),Ee(i)}function ht(){let{t:e}=s(),{activeDialog:t,closeDialog:n,showMessage:r}=j(),[i,o]=(0,W.useState)(!1),{savedConnections:c,addSavedConnection:l,updateSavedConnection:u,deleteSavedConnection:d,openConnection:f}=D(),_=re(`connect`)?.profileId,[v,y]=(0,W.useState)(()=>_??null),[b,x]=(0,W.useState)(()=>{let e=_?c.find(e=>e.id===_):void 0;return e?{...e}:null}),S=t===`connect`,[C,w]=(0,W.useState)(null),[O,N]=(0,W.useState)(null),de=xe(e=>e.url),pe=xe(e=>e.token);(0,W.useEffect)(()=>{if(!S)return;let e=!1;return(async()=>{try{let t=await ne();if(e||t.state!==`online`||!t.gateway){e||w(null);return}let n=await te();e||(w({name:n.gateway,profiles:n.profiles}),N(null))}catch(t){e||N(t instanceof Error?t.message:String(t))}})(),()=>{e=!0}},[S,de,pe]);function me(t){let n=c.find(e=>e.gatewayProfile===t.name);if(n){L(n);return}let r=we(t);l(r),L(r),j.getState().setFooterMessage(e(`connection.dialog.gatewayAdded`,{name:t.name}))}function I(e){e||(n(),y(null),x(null))}function L(e){y(e.id),x({...e})}function _e(e){x(e),u(e.id,e)}function ve(){let e=he();l(e),y(e.id),x(e)}function be(){v&&(d(v),y(null),x(null))}async function R(t){let n=c.find(e=>e.id===v);if(!n||!nt(n))return;let r=n.hostName||e(`connection.dialog.unnamed`),i=rt(D.getState().resolveCredentials(n),t);await lt(`planche-connection-${r}.json`,JSON.stringify(i,null,2))&&j.getState().setFooterMessage(e(`connection.dialog.exported`,{name:r}))}async function Ce(){let t=await ut();if(t!==null)try{let n=st(it(t),D.getState().savedConnections);l(n),y(n.id),x(n),j.getState().setFooterMessage(e(`connection.dialog.imported`,{name:n.hostName||e(`connection.dialog.unnamed`)}))}catch(t){r({tone:`error`,title:e(`connection.dialog.importFailedTitle`),description:t instanceof Error?t.message:String(t)})}}let z=v!==null&&c.some(e=>e.id===v&&nt(e)),[Te,B]=(0,W.useState)(!1),Ee=ie(e=>e.addQueryTab);function V(t){let r=D.getState().activeConnections.some(e=>e.id===t.id);if(f(t),ae.getState().removeTree(t.id),T(t.id),r){n(),y(null),x(null);return}Ee(t.id,{id:`tab-${Date.now()}`,title:e(`connection.dialog.firstQueryTab`),query:``,database:``,isExecuting:!1,results:[],error:null,executionTime:null}),n(),y(null),x(null)}async function Ae(t){let n=await ce(t.id,{interactive:!0});if(!n)return;let r={...t,file:n.fileName,serverConnectionId:n.connectionId};u(t.id,{file:n.fileName}),V(r),D.getState().setFileDetached(t.id,n.fileDetached),n.restoredUnsaved?j.getState().setFooterMessage(e(n.diskChanged?`connection.dialog.restoredUnsavedDiskChanged`:`connection.dialog.restoredUnsaved`,{file:n.fileName})):n.wal&&!n.walApplied?j.getState().setFooterMessage(e(`connection.dialog.walPending`,{file:n.fileName})):n.walApplied&&j.getState().setFooterMessage(e(`connection.dialog.walApplied`,{file:n.fileName}))}async function U(t,n){try{return await n(t)}catch(r){let i=A(r);if(!i||!(`ssh`in t)||!t.ssh||!await j.getState().requestDestructiveConfirm({title:e(`connection.dialog.hostKeyTitle`),description:e(`connection.dialog.hostKeyDescription`,i),confirmLabel:e(`connection.dialog.hostKeyAccept`)}))throw r;return n({...t,ssh:{...t.ssh,acceptHostKey:i.fingerprint}})}}async function K(){if(b){B(!0);try{if(M(b)===`browser`){await Ae(b);return}let t=await U(k(b),e=>se(e,b.authToken||void 0));if(t.success)V({...b,serverConnectionId:t.connectionId});else{let n=$(`connect`,b.dbms,Error(t.message??``));r({tone:`error`,title:e(`connection.dialog.connectFailedTitle`),description:t.message??e(`connection.dialog.unknownError`),...n})}}catch(t){let n=$(`connect`,b.dbms,t);r({tone:`error`,title:e(`connection.dialog.connectFailedTitle`),description:t instanceof Error?t.message:String(t),...n})}finally{B(!1)}}}async function q(){if(b){if(M(b)===`browser`){r({tone:`info`,title:e(`connection.dialog.testConnection`),description:e(`connection.dialog.browserTestHint`)});return}o(!0);try{let t=await U(k(b),e=>oe(e,b.authToken||void 0));if(t.success)r({tone:`success`,title:e(`connection.dialog.testSuccess`),description:e(`connection.dialog.testSuccessDescription`)});else{let n=$(`test`,b.dbms,Error(t.message??``));r({tone:`error`,title:e(`connection.dialog.testFailedTitle`),description:t.message??e(`connection.dialog.unknownError`),...n})}}catch(t){let n=$(`test`,b.dbms,t);r({tone:`error`,title:e(`connection.dialog.testFailedTitle`),description:t instanceof Error?t.message:String(t),...n})}finally{o(!1)}}}return(0,G.jsx)(g,{open:S,onOpenChange:I,children:(0,G.jsxs)(ee,{className:`sm:max-w-[1100px] h-[85vh] max-h-[85vh] flex flex-col`,children:[(0,G.jsx)(p,{children:(0,G.jsx)(h,{children:e(`connection.dialog.title`)})}),(0,G.jsxs)(`p`,{className:`flex items-start gap-2 rounded-md border border-catppuccin-green/40 bg-catppuccin-green/10 px-3 py-2 text-xs leading-relaxed text-foreground`,children:[(0,G.jsx)(le,{className:`mt-0.5 size-4 shrink-0 text-catppuccin-green`,"aria-hidden":!0}),(0,G.jsx)(`span`,{children:e(`connection.dialog.privacy`)})]}),(0,G.jsxs)(`div`,{className:`flex flex-1 gap-4 overflow-hidden min-h-0`,children:[(0,G.jsxs)(`div`,{className:`w-[460px] shrink-0 border rounded-md overflow-hidden flex flex-col`,children:[(C||O)&&(0,G.jsxs)(`div`,{className:`border-b p-2 text-xs space-y-1 max-h-40 overflow-auto`,children:[(0,G.jsxs)(`p`,{className:`font-medium`,children:[e(`connection.dialog.gatewayTitle`),C?` — ${C.name}`:``]}),O&&(0,G.jsx)(`p`,{className:`text-destructive`,children:e(`connection.dialog.gatewayLoadFailed`,{error:O})}),C?.profiles.map(t=>(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5 truncate`,children:[(0,G.jsx)(H,{dbms:Se[t.driver],className:`size-3.5`}),(0,G.jsx)(`span`,{className:`truncate`,children:t.name}),(0,G.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,t.readOnly?e(`connection.dialog.gatewayReadOnly`):e(`connection.dialog.gatewayWritable`),`)`]})]}),(0,G.jsx)(a,{size:`sm`,variant:`outline`,className:`h-6 px-2 text-xs`,onClick:()=>me(t),children:e(`connection.dialog.gatewayAdd`)})]},t.name))]}),(0,G.jsx)(De,{className:`h-full`,children:(0,G.jsxs)(ge,{className:`table-fixed`,children:[(0,G.jsx)(Oe,{children:(0,G.jsxs)(F,{children:[(0,G.jsx)(ue,{className:`w-[32%]`,children:e(`connection.dialog.colHostName`)}),(0,G.jsx)(ue,{className:`w-[40%]`,children:e(`connection.dialog.colTarget`)}),(0,G.jsx)(ue,{className:`w-[28%]`,children:e(`connection.dialog.colDbms`)})]})}),(0,G.jsx)(ke,{children:c.length===0?(0,G.jsx)(F,{children:(0,G.jsx)(P,{colSpan:3,className:`text-center text-muted-foreground`,children:e(`connection.dialog.noSaved`)})}):c.map(t=>(0,G.jsxs)(F,{"data-state":v===t.id?`selected`:void 0,className:`cursor-pointer`,onClick:()=>L(t),onDoubleClick:()=>{L(t),K()},children:[(0,G.jsx)(P,{className:`truncate font-medium`,title:t.hostName,children:t.hostName||e(`connection.dialog.unnamed`)}),(0,G.jsx)(P,{className:`truncate`,title:t.dbms===`sqlite`?t.file:t.dbms===`d1`?t.databaseId:t.dbms===`do`?t.devUrl:`${t.user?`${t.user}@`:``}${t.host}:${t.port}`,children:t.dbms===`sqlite`?t.file||(M(t)===`browser`?e(`connection.dialog.pickOnConnect`):e(`connection.dialog.noFile`)):t.dbms===`d1`?t.databaseId||`—`:t.dbms===`do`?t.devUrl||`—`:`${t.user?`${t.user}@`:``}${t.host}:${t.port}`}),(0,G.jsx)(P,{className:`truncate`,title:E(t.dbms).label,children:(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(H,{dbms:t.dbms,className:`size-3.5`}),(0,G.jsx)(`span`,{className:`truncate`,children:E(t.dbms).label})]})})]},t.id))})]})})]}),(0,G.jsx)(`div`,{className:`flex-1 border rounded-md overflow-auto`,children:b?(0,G.jsxs)(G.Fragment,{children:[M(b)!==`browser`&&(0,G.jsx)(`div`,{className:`p-4 pb-0`,children:(0,G.jsx)(ye,{})}),b.gatewayProfile?(0,G.jsxs)(`div`,{className:`p-4 space-y-2 text-sm`,children:[(0,G.jsxs)(`p`,{className:`font-medium flex items-center gap-2`,children:[(0,G.jsx)(H,{dbms:b.dbms,className:`size-4`}),b.hostName]}),(0,G.jsx)(`p`,{className:`text-muted-foreground`,children:e(`connection.dialog.gatewayProfileHint`,{name:b.gatewayProfile})}),(0,G.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[b.readOnly?e(`connection.dialog.gatewayReadOnly`):e(`connection.dialog.gatewayWritable`),b.database?` · ${b.database}`:``]})]}):(0,G.jsx)(et,{value:b,onChange:_e})]}):(0,G.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground text-sm`,children:e(`connection.dialog.selectPrompt`)})})]}),(0,G.jsxs)(m,{className:`sm:justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(a,{variant:`outline`,onClick:ve,children:e(`connection.dialog.addNew`)}),(0,G.jsx)(a,{variant:`destructive`,onClick:be,disabled:!v,children:e(`connection.dialog.delete`)}),(0,G.jsxs)(dt,{children:[(0,G.jsx)(ft,{asChild:!0,children:(0,G.jsxs)(a,{variant:`outline`,disabled:!z,children:[e(`connection.dialog.export`),(0,G.jsx)(fe,{className:`ml-1 size-3.5`,"aria-hidden":!0})]})}),(0,G.jsxs)(pt,{align:`start`,children:[(0,G.jsx)(mt,{onSelect:()=>void R(!1),children:e(`connection.dialog.exportWithoutSecrets`)}),(0,G.jsx)(mt,{onSelect:()=>void R(!0),children:e(`connection.dialog.exportWithSecrets`)})]})]}),(0,G.jsx)(a,{variant:`outline`,onClick:()=>void Ce(),children:e(`connection.dialog.import`)})]}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(a,{variant:`outline`,onClick:q,disabled:!b||i,children:e(`connection.dialog.testConnection`)}),(0,G.jsx)(a,{onClick:K,disabled:!b||Te,children:e(`connection.dialog.connect`)}),(0,G.jsx)(a,{variant:`outline`,onClick:()=>I(!1),children:e(`connection.dialog.close`)})]})]})]})})}export{ht as ConnectDialog};
@@ -1 +1 @@
1
- import{o as e,t}from"./CYz610vE.js";import{i as n,t as r}from"./eFSiW0Lh.js";var i={anthropic:`claude-opus-5`,"anthropic-profile":`claude-opus-5`,openai:`gpt-4o`,gemini:`gemini-2.5-flash`,cli:`claude`};function a(e,t){let n=e.trim();return n===``||Object.values(i).includes(n)?i[t]:e}var o=[{id:`2026-10-03`,agent:`0.9.0`,title:{en:`Redis, Elasticsearch and OpenSearch connections`,ko:`Redis, Elasticsearch, OpenSearch 연결 추가`,ja:`Redis・Elasticsearch・OpenSearch に接続できるようになりました`,zh:`现在可以连接 Redis、Elasticsearch 和 OpenSearch`,de:`Verbindungen zu Redis, Elasticsearch und OpenSearch`,fr:`Connexions Redis, Elasticsearch et OpenSearch`},items:{en:[`In “Connect to Database”, pick Redis and the tree on the left lists <code>db0</code>, <code>db1</code> and so on. Keys like <code>user:1</code> and <code>user:2</code> are grouped under a <code>user</code> folder. Double-click a key to edit it in a view that fits its type.`,`Type redis-cli commands in a console tab. Commands and the key names already loaded in the tree autocomplete.`,`Redis tools are in the Tools menu, or right-click an empty spot in the tree. Memory analysis shows how much memory each prefix and type takes and lists the 50 biggest keys; it analyses 20,000 keys in about a second. Delete by pattern shows the matching keys first and only deletes after you type the pattern again. Server info, slow log, client list, Pub/Sub and MONITOR are there too.`,`You can also pick Elasticsearch 8 or OpenSearch 2 in “Connect to Database”. Write requests the way you would in Kibana Dev Tools, e.g. <code>GET /orders/_search</code>, and press Ctrl+Enter (Cmd+Enter on a Mac); hits come back as a table. Right-click a row to open the document, edit its JSON and save. If someone changed it since you opened it, Planche reports a conflict instead of overwriting.`,`Click a grid cell that holds HTML and you see the rendered page; scripts in it do not run. The text, JSON and HTML viewers are bigger and have a full-screen button.`],ko:[`‘데이터베이스에 연결’ 창에서 Redis를 고르면 왼쪽 트리에 <code>db0</code>, <code>db1</code>…이 나옵니다. <code>user:1</code>, <code>user:2</code> 같은 키는 <code>user</code> 폴더 아래에 모입니다. 키를 더블클릭하면 타입에 맞는 편집 화면이 열립니다.`,`콘솔 탭에서는 redis-cli 명령을 그대로 입력하면 됩니다. 명령어와 트리에 불러온 키 이름이 자동완성됩니다.`,`Redis 도구는 도구 메뉴에서 열 수 있고, 트리 빈 곳을 우클릭해도 됩니다. 메모리 분석은 접두사와 타입별로 메모리를 얼마나 쓰는지, 가장 큰 키 50개가 무엇인지 보여 줍니다. 키 2만 개를 1초 정도면 훑습니다. 패턴으로 키 지우기는 지워질 키를 먼저 보여 주고, 패턴을 한 번 더 입력해야 지웁니다. 서버 정보, 슬로 로그, 클라이언트 목록, Pub/Sub, MONITOR도 여기서 엽니다.`,`Elasticsearch 8과 OpenSearch 2도 ‘데이터베이스에 연결’ 창에서 고를 수 있습니다. 콘솔에 Kibana Dev Tools처럼 <code>GET /orders/_search</code>를 쓰고 Ctrl+Enter(맥은 Cmd+Enter)를 누르면 검색 결과가 표로 나옵니다. 행을 우클릭해 문서를 열면 JSON을 고쳐서 저장할 수 있습니다. 문서를 연 뒤 다른 곳에서 내용이 바뀌었다면 덮어쓰지 않고 충돌이라고 알려 줍니다.`,`HTML이 든 그리드 셀을 클릭하면 렌더링된 페이지가 보입니다. 그 안의 스크립트는 실행되지 않습니다. 텍스트·JSON·HTML 뷰어 창도 커졌고 전체 화면 버튼이 생겼습니다.`],ja:[`「データベースに接続」で Redis を選ぶと、左のツリーに <code>db0</code>、<code>db1</code>… が並びます。<code>user:1</code> や <code>user:2</code> のようなキーは <code>user</code> フォルダにまとまります。キーをダブルクリックすると、型に合った編集画面が開きます。`,`コンソールタブには redis-cli のコマンドをそのまま入力できます。コマンド名と、ツリーに読み込んだキー名が補完されます。`,`Redis のツールは「ツール」メニューにあり、ツリーの空いているところを右クリックしても開けます。メモリ分析では、プレフィックスごと・型ごとのメモリ使用量と、大きいキーの上位 50 件が分かります。2 万キーなら 1 秒ほどで終わります。パターンによるキー削除は、削除対象のキーを先に一覧表示し、パターンをもう一度入力したときだけ削除します。サーバー情報、スローログ、クライアント一覧、Pub/Sub、MONITOR もここから開きます。`,`Elasticsearch 8 と OpenSearch 2 も「データベースに接続」から選べます。コンソールに Kibana Dev Tools と同じ書き方で <code>GET /orders/_search</code> と書き、Ctrl+Enter(Mac は Cmd+Enter)を押すと検索結果が表で返ってきます。行を右クリックしてドキュメントを開けば、JSON を直して保存できます。開いた後にほかで書き換えられていた場合は、上書きせず、競合が起きたことを知らせます。`,`HTML が入ったセルをクリックすると、描画されたページとして表示されます。中のスクリプトは実行されません。テキスト・JSON・HTML のビューアは大きくなり、全画面ボタンも付きました。`],zh:[`在“连接到数据库”中选择 Redis,左侧树中会列出 <code>db0</code>、<code>db1</code> 等数据库。像 <code>user:1</code>、<code>user:2</code> 这样的键会归到 <code>user</code> 文件夹下。双击一个键,会按它的类型打开对应的编辑界面。`,`在控制台标签页里可以直接输入 redis-cli 命令,命令名和树里已加载的键名都会自动补全。`,`Redis 工具在“工具”菜单里,在树的空白处右键也能找到。内存分析会告诉你每个前缀、每种类型各占多少内存,并列出最大的 50 个键;2 万个键大约 1 秒就能分析完。按模式删除键会先列出将被删除的键,要再输入一次模式才会真正删除。服务器信息、慢日志、客户端列表、Pub/Sub 和 MONITOR 也都从这里打开。`,`也可以在“连接到数据库”中选择 Elasticsearch 8 或 OpenSearch 2。在控制台里像在 Kibana Dev Tools 中那样写 <code>GET /orders/_search</code>,按 Ctrl+Enter(Mac 上是 Cmd+Enter),搜索结果会以表格返回。右键某一行可以打开该文档,修改 JSON 后保存;如果在你打开之后文档已被别人改过,Planche 会提示冲突,而不会直接覆盖。`,`单元格里存的是 HTML 时,点击即可看到渲染后的页面,其中的脚本不会执行。文本、JSON 和 HTML 查看器也变大了,并加了全屏按钮。`],de:[`Wählen Sie unter „Mit Datenbank verbinden“ Redis aus, dann zeigt der Baum links <code>db0</code>, <code>db1</code> usw. Schlüssel wie <code>user:1</code> und <code>user:2</code> landen in einem Ordner <code>user</code>. Ein Doppelklick auf einen Schlüssel öffnet ihn in einer Ansicht, die zu seinem Typ passt.`,`In einem Konsolen-Tab tippen Sie redis-cli-Befehle so, wie Sie es gewohnt sind. Befehle und die bereits im Baum geladenen Schlüsselnamen werden vervollständigt.`,`Die Redis-Werkzeuge finden Sie im Menü „Werkzeuge“ oder per Rechtsklick auf eine freie Stelle im Baum. Die Speicheranalyse zeigt, wie viel Speicher jedes Präfix und jeder Typ belegt, und listet die 50 größten Schlüssel; die Analyse von 20.000 Schlüsseln dauert etwa eine Sekunde. „Nach Muster löschen“ zeigt zuerst, welche Schlüssel betroffen sind, und löscht erst, wenn Sie das Muster noch einmal eingeben. Serverinfo, Slow Log, Client-Liste, Pub/Sub und MONITOR öffnen Sie dort ebenfalls.`,`Unter „Mit Datenbank verbinden“ können Sie auch Elasticsearch 8 oder OpenSearch 2 auswählen. Schreiben Sie Anfragen wie in den Kibana Dev Tools, etwa <code>GET /orders/_search</code>, und drücken Sie Strg+Enter (auf dem Mac Cmd+Enter); die Treffer kommen als Tabelle zurück. Per Rechtsklick auf eine Zeile öffnen Sie das Dokument, ändern das JSON und speichern. Hat jemand anderes es inzwischen geändert, meldet Planche einen Konflikt, statt es zu überschreiben.`,`Steht in einer Zelle HTML, sehen Sie nach einem Klick die gerenderte Seite; Skripte darin laufen nicht. Die Text-, JSON- und HTML-Viewer sind größer und haben jetzt eine Vollbild-Schaltfläche.`],fr:[`Choisissez Redis dans « Se connecter à une base de données » : l’arborescence à gauche affiche <code>db0</code>, <code>db1</code>, etc. Les clés comme <code>user:1</code> et <code>user:2</code> sont rangées dans un dossier <code>user</code>. Un double-clic sur une clé l’ouvre dans une vue adaptée à son type.`,`Dans un onglet console, tapez vos commandes redis-cli telles quelles. Les commandes et les noms de clés déjà chargés dans l’arborescence se complètent automatiquement.`,`Les outils Redis s’ouvrent depuis le menu Outils ou d’un clic droit sur une zone vide de l’arborescence. L’analyse mémoire montre combien de mémoire occupe chaque préfixe et chaque type, et liste les 50 plus grosses clés ; l’analyse de 20 000 clés prend environ une seconde. La suppression par motif affiche d’abord les clés concernées et ne supprime qu’une fois le motif retapé. Les infos serveur, le slow log, la liste des clients, Pub/Sub et MONITOR s’ouvrent au même endroit.`,`Vous pouvez aussi choisir Elasticsearch 8 ou OpenSearch 2 dans « Se connecter à une base de données ». Écrivez vos requêtes comme dans Kibana Dev Tools, par exemple <code>GET /orders/_search</code>, puis Ctrl+Entrée (Cmd+Entrée sur Mac) : les résultats arrivent sous forme de tableau. Faites un clic droit sur une ligne pour ouvrir le document, modifier son JSON et l’enregistrer. Si quelqu’un l’a modifié entre-temps, Planche signale un conflit au lieu de l’écraser.`,`Quand une cellule contient du HTML, un clic affiche la page rendue ; les scripts qu’elle contient ne s’exécutent pas. Les visionneuses texte, JSON et HTML sont plus grandes et ont un bouton plein écran.`]}}],s=[`en`,`ko`,`ja`,`zh`,`de`,`fr`];function c(){return o[0]?.id??``}function l(e,t=3){return o.filter(t=>!e||t.id>e).slice(0,t)}var u={confirmDestructive:!0,warnInEditor:!0,previewAffectedRows:!0,allowReadOnlyOverride:!0,previewGridCommit:!0,resultRowLimit:500,executeScope:`script`},d=t()(n(t=>({...u,locale:`auto`,onboardingDismissed:!1,termsAcceptedVersion:0,changelogSeen:``,analyticsEnabled:!0,persistQueryHistory:!0,aiPreferences:{provider:`anthropic`,model:i.anthropic,baseUrl:``,remember:!1},update:e=>t(e),setOnboardingDismissed:e=>t({onboardingDismissed:e}),acceptTerms:()=>{e(`terms_accept`,{version:1}),t(e=>({termsAcceptedVersion:1,changelogSeen:e.termsAcceptedVersion===0&&!e.changelogSeen?c():e.changelogSeen}))},markChangelogSeen:()=>t({changelogSeen:c()}),setLocale:n=>{e(`locale_change`,{locale:n}),t({locale:n})},setAnalyticsEnabled:e=>t({analyticsEnabled:e}),setPersistQueryHistory:e=>t({persistQueryHistory:e}),setAiPreferences:e=>t(t=>({aiPreferences:{...t.aiPreferences,...e}}))}),{name:`planche-settings`,storage:r()})),f=()=>d(e=>e.termsAcceptedVersion>=1);export{s as a,o as i,d as n,l as o,f as r,a as s,u as t};
1
+ import{o as e,t}from"./BeP_ukJr.js";import{i as n,t as r}from"./eFSiW0Lh.js";var i={anthropic:`claude-opus-5`,"anthropic-profile":`claude-opus-5`,openai:`gpt-4o`,gemini:`gemini-2.5-flash`,cli:`claude`};function a(e,t){let n=e.trim();return n===``||Object.values(i).includes(n)?i[t]:e}var o=[{id:`2026-10-03`,agent:`0.9.0`,title:{en:`Redis, Elasticsearch and OpenSearch connections`,ko:`Redis, Elasticsearch, OpenSearch 연결 추가`,ja:`Redis・Elasticsearch・OpenSearch に接続できるようになりました`,zh:`现在可以连接 Redis、Elasticsearch 和 OpenSearch`,de:`Verbindungen zu Redis, Elasticsearch und OpenSearch`,fr:`Connexions Redis, Elasticsearch et OpenSearch`},items:{en:[`In “Connect to Database”, pick Redis and the tree on the left lists <code>db0</code>, <code>db1</code> and so on. Keys like <code>user:1</code> and <code>user:2</code> are grouped under a <code>user</code> folder. Double-click a key to edit it in a view that fits its type.`,`Type redis-cli commands in a console tab. Commands and the key names already loaded in the tree autocomplete.`,`Redis tools are in the Tools menu, or right-click an empty spot in the tree. Memory analysis shows how much memory each prefix and type takes and lists the 50 biggest keys; it analyses 20,000 keys in about a second. Delete by pattern shows the matching keys first and only deletes after you type the pattern again. Server info, slow log, client list, Pub/Sub and MONITOR are there too.`,`You can also pick Elasticsearch 8 or OpenSearch 2 in “Connect to Database”. Write requests the way you would in Kibana Dev Tools, e.g. <code>GET /orders/_search</code>, and press Ctrl+Enter (Cmd+Enter on a Mac); hits come back as a table. Right-click a row to open the document, edit its JSON and save. If someone changed it since you opened it, Planche reports a conflict instead of overwriting.`,`Click a grid cell that holds HTML and you see the rendered page; scripts in it do not run. The text, JSON and HTML viewers are bigger and have a full-screen button.`],ko:[`‘데이터베이스에 연결’ 창에서 Redis를 고르면 왼쪽 트리에 <code>db0</code>, <code>db1</code>…이 나옵니다. <code>user:1</code>, <code>user:2</code> 같은 키는 <code>user</code> 폴더 아래에 모입니다. 키를 더블클릭하면 타입에 맞는 편집 화면이 열립니다.`,`콘솔 탭에서는 redis-cli 명령을 그대로 입력하면 됩니다. 명령어와 트리에 불러온 키 이름이 자동완성됩니다.`,`Redis 도구는 도구 메뉴에서 열 수 있고, 트리 빈 곳을 우클릭해도 됩니다. 메모리 분석은 접두사와 타입별로 메모리를 얼마나 쓰는지, 가장 큰 키 50개가 무엇인지 보여 줍니다. 키 2만 개를 1초 정도면 훑습니다. 패턴으로 키 지우기는 지워질 키를 먼저 보여 주고, 패턴을 한 번 더 입력해야 지웁니다. 서버 정보, 슬로 로그, 클라이언트 목록, Pub/Sub, MONITOR도 여기서 엽니다.`,`Elasticsearch 8과 OpenSearch 2도 ‘데이터베이스에 연결’ 창에서 고를 수 있습니다. 콘솔에 Kibana Dev Tools처럼 <code>GET /orders/_search</code>를 쓰고 Ctrl+Enter(맥은 Cmd+Enter)를 누르면 검색 결과가 표로 나옵니다. 행을 우클릭해 문서를 열면 JSON을 고쳐서 저장할 수 있습니다. 문서를 연 뒤 다른 곳에서 내용이 바뀌었다면 덮어쓰지 않고 충돌이라고 알려 줍니다.`,`HTML이 든 그리드 셀을 클릭하면 렌더링된 페이지가 보입니다. 그 안의 스크립트는 실행되지 않습니다. 텍스트·JSON·HTML 뷰어 창도 커졌고 전체 화면 버튼이 생겼습니다.`],ja:[`「データベースに接続」で Redis を選ぶと、左のツリーに <code>db0</code>、<code>db1</code>… が並びます。<code>user:1</code> や <code>user:2</code> のようなキーは <code>user</code> フォルダにまとまります。キーをダブルクリックすると、型に合った編集画面が開きます。`,`コンソールタブには redis-cli のコマンドをそのまま入力できます。コマンド名と、ツリーに読み込んだキー名が補完されます。`,`Redis のツールは「ツール」メニューにあり、ツリーの空いているところを右クリックしても開けます。メモリ分析では、プレフィックスごと・型ごとのメモリ使用量と、大きいキーの上位 50 件が分かります。2 万キーなら 1 秒ほどで終わります。パターンによるキー削除は、削除対象のキーを先に一覧表示し、パターンをもう一度入力したときだけ削除します。サーバー情報、スローログ、クライアント一覧、Pub/Sub、MONITOR もここから開きます。`,`Elasticsearch 8 と OpenSearch 2 も「データベースに接続」から選べます。コンソールに Kibana Dev Tools と同じ書き方で <code>GET /orders/_search</code> と書き、Ctrl+Enter(Mac は Cmd+Enter)を押すと検索結果が表で返ってきます。行を右クリックしてドキュメントを開けば、JSON を直して保存できます。開いた後にほかで書き換えられていた場合は、上書きせず、競合が起きたことを知らせます。`,`HTML が入ったセルをクリックすると、描画されたページとして表示されます。中のスクリプトは実行されません。テキスト・JSON・HTML のビューアは大きくなり、全画面ボタンも付きました。`],zh:[`在“连接到数据库”中选择 Redis,左侧树中会列出 <code>db0</code>、<code>db1</code> 等数据库。像 <code>user:1</code>、<code>user:2</code> 这样的键会归到 <code>user</code> 文件夹下。双击一个键,会按它的类型打开对应的编辑界面。`,`在控制台标签页里可以直接输入 redis-cli 命令,命令名和树里已加载的键名都会自动补全。`,`Redis 工具在“工具”菜单里,在树的空白处右键也能找到。内存分析会告诉你每个前缀、每种类型各占多少内存,并列出最大的 50 个键;2 万个键大约 1 秒就能分析完。按模式删除键会先列出将被删除的键,要再输入一次模式才会真正删除。服务器信息、慢日志、客户端列表、Pub/Sub 和 MONITOR 也都从这里打开。`,`也可以在“连接到数据库”中选择 Elasticsearch 8 或 OpenSearch 2。在控制台里像在 Kibana Dev Tools 中那样写 <code>GET /orders/_search</code>,按 Ctrl+Enter(Mac 上是 Cmd+Enter),搜索结果会以表格返回。右键某一行可以打开该文档,修改 JSON 后保存;如果在你打开之后文档已被别人改过,Planche 会提示冲突,而不会直接覆盖。`,`单元格里存的是 HTML 时,点击即可看到渲染后的页面,其中的脚本不会执行。文本、JSON 和 HTML 查看器也变大了,并加了全屏按钮。`],de:[`Wählen Sie unter „Mit Datenbank verbinden“ Redis aus, dann zeigt der Baum links <code>db0</code>, <code>db1</code> usw. Schlüssel wie <code>user:1</code> und <code>user:2</code> landen in einem Ordner <code>user</code>. Ein Doppelklick auf einen Schlüssel öffnet ihn in einer Ansicht, die zu seinem Typ passt.`,`In einem Konsolen-Tab tippen Sie redis-cli-Befehle so, wie Sie es gewohnt sind. Befehle und die bereits im Baum geladenen Schlüsselnamen werden vervollständigt.`,`Die Redis-Werkzeuge finden Sie im Menü „Werkzeuge“ oder per Rechtsklick auf eine freie Stelle im Baum. Die Speicheranalyse zeigt, wie viel Speicher jedes Präfix und jeder Typ belegt, und listet die 50 größten Schlüssel; die Analyse von 20.000 Schlüsseln dauert etwa eine Sekunde. „Nach Muster löschen“ zeigt zuerst, welche Schlüssel betroffen sind, und löscht erst, wenn Sie das Muster noch einmal eingeben. Serverinfo, Slow Log, Client-Liste, Pub/Sub und MONITOR öffnen Sie dort ebenfalls.`,`Unter „Mit Datenbank verbinden“ können Sie auch Elasticsearch 8 oder OpenSearch 2 auswählen. Schreiben Sie Anfragen wie in den Kibana Dev Tools, etwa <code>GET /orders/_search</code>, und drücken Sie Strg+Enter (auf dem Mac Cmd+Enter); die Treffer kommen als Tabelle zurück. Per Rechtsklick auf eine Zeile öffnen Sie das Dokument, ändern das JSON und speichern. Hat jemand anderes es inzwischen geändert, meldet Planche einen Konflikt, statt es zu überschreiben.`,`Steht in einer Zelle HTML, sehen Sie nach einem Klick die gerenderte Seite; Skripte darin laufen nicht. Die Text-, JSON- und HTML-Viewer sind größer und haben jetzt eine Vollbild-Schaltfläche.`],fr:[`Choisissez Redis dans « Se connecter à une base de données » : l’arborescence à gauche affiche <code>db0</code>, <code>db1</code>, etc. Les clés comme <code>user:1</code> et <code>user:2</code> sont rangées dans un dossier <code>user</code>. Un double-clic sur une clé l’ouvre dans une vue adaptée à son type.`,`Dans un onglet console, tapez vos commandes redis-cli telles quelles. Les commandes et les noms de clés déjà chargés dans l’arborescence se complètent automatiquement.`,`Les outils Redis s’ouvrent depuis le menu Outils ou d’un clic droit sur une zone vide de l’arborescence. L’analyse mémoire montre combien de mémoire occupe chaque préfixe et chaque type, et liste les 50 plus grosses clés ; l’analyse de 20 000 clés prend environ une seconde. La suppression par motif affiche d’abord les clés concernées et ne supprime qu’une fois le motif retapé. Les infos serveur, le slow log, la liste des clients, Pub/Sub et MONITOR s’ouvrent au même endroit.`,`Vous pouvez aussi choisir Elasticsearch 8 ou OpenSearch 2 dans « Se connecter à une base de données ». Écrivez vos requêtes comme dans Kibana Dev Tools, par exemple <code>GET /orders/_search</code>, puis Ctrl+Entrée (Cmd+Entrée sur Mac) : les résultats arrivent sous forme de tableau. Faites un clic droit sur une ligne pour ouvrir le document, modifier son JSON et l’enregistrer. Si quelqu’un l’a modifié entre-temps, Planche signale un conflit au lieu de l’écraser.`,`Quand une cellule contient du HTML, un clic affiche la page rendue ; les scripts qu’elle contient ne s’exécutent pas. Les visionneuses texte, JSON et HTML sont plus grandes et ont un bouton plein écran.`]}}],s=[`en`,`ko`,`ja`,`zh`,`de`,`fr`];function c(){return o[0]?.id??``}function l(e,t=3){return o.filter(t=>!e||t.id>e).slice(0,t)}var u={confirmDestructive:!0,warnInEditor:!0,previewAffectedRows:!0,allowReadOnlyOverride:!0,previewGridCommit:!0,resultRowLimit:500,executeScope:`script`},d=t()(n(t=>({...u,locale:`auto`,onboardingDismissed:!1,termsAcceptedVersion:0,changelogSeen:``,analyticsEnabled:!0,persistQueryHistory:!0,aiPreferences:{provider:`anthropic`,model:i.anthropic,baseUrl:``,remember:!1},update:e=>t(e),setOnboardingDismissed:e=>t({onboardingDismissed:e}),acceptTerms:()=>{e(`terms_accept`,{version:1}),t(e=>({termsAcceptedVersion:1,changelogSeen:e.termsAcceptedVersion===0&&!e.changelogSeen?c():e.changelogSeen}))},markChangelogSeen:()=>t({changelogSeen:c()}),setLocale:n=>{e(`locale_change`,{locale:n}),t({locale:n})},setAnalyticsEnabled:e=>t({analyticsEnabled:e}),setPersistQueryHistory:e=>t({persistQueryHistory:e}),setAiPreferences:e=>t(t=>({aiPreferences:{...t.aiPreferences,...e}}))}),{name:`planche-settings`,storage:r()})),f=()=>d(e=>e.termsAcceptedVersion>=1);export{s as a,o as i,d as n,l as o,f as r,a as s,u as t};
@@ -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{i as r,r as i,t as a}from"./Cu_sGzNJ.js";import{t as o}from"./BFw3KCAr.js";import{t as s}from"./CAd2f6EE.js";import{n as c}from"./D8_hwGjG.js";import{n as l}from"./D6SRSRpo.js";import{n as u,o as d,s as f,t as p}from"./DAFA-E1-.js";import{Jt as m,c as h,l as g,ut as _}from"./B_zu4Zim.js";var v=e(t(),1),y=i();function b(){let{t:e}=r(),{activeDialog:t,closeDialog:i}=c(),[b,x]=(0,v.useState)(``),[S,C]=(0,v.useState)(``),[w,T]=(0,v.useState)(!1),[E,D]=(0,v.useState)(!1),[O,k]=(0,v.useState)(!1),[A,j]=(0,v.useState)(0),M=s(e=>e.activeConnectionId)??``,N=l(e=>M?e.activeTabId[M]:void 0)??``;if(t!==`find-replace`)return null;let P={query:b,caseSensitive:w,regex:E,wholeWord:O},F=M!==``&&N!==``&&b!==``;function I(){i()}function L(){j(F?u(M,N,P,`next`):0)}function R(){j(F?u(M,N,P,`prev`):0)}function z(){F&&j(f(M,N,P,S))}function B(){F&&(d(M,N,P,S),j(p(M,N,P)))}return(0,y.jsxs)(`div`,{className:`fixed top-12 right-4 z-50 bg-background border rounded-md shadow-lg p-3 w-[400px] space-y-2`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(g,{placeholder:e(`command.findReplace.findPlaceholder`),value:b,onChange:e=>x(e.target.value),onKeyDown:e=>{_(e)||(e.key===`Enter`&&(e.shiftKey?R():L()),e.key===`Escape`&&I())},className:`flex-1 h-7 text-sm`,autoFocus:!0}),(0,y.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap min-w-[60px] text-center`,children:A>0?e(`command.findReplace.found`,{count:A}):e(`command.findReplace.noResults`)}),(0,y.jsx)(n,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,onClick:R,title:e(`command.findReplace.previous`),children:(0,y.jsx)(o,{className:`h-4 w-4`})}),(0,y.jsx)(n,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,onClick:L,title:e(`command.findReplace.next`),children:(0,y.jsx)(m,{className:`h-4 w-4`})}),(0,y.jsx)(n,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,onClick:I,title:e(`command.findReplace.close`),children:(0,y.jsx)(a,{className:`h-4 w-4`})})]}),(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(g,{placeholder:e(`command.findReplace.replacePlaceholder`),value:S,onChange:e=>C(e.target.value),onKeyDown:e=>{e.key===`Escape`&&I()},className:`flex-1 h-7 text-sm`}),(0,y.jsx)(n,{variant:`outline`,size:`sm`,className:`h-7 text-xs`,onClick:z,children:e(`command.findReplace.replace`)}),(0,y.jsx)(n,{variant:`outline`,size:`sm`,className:`h-7 text-xs`,onClick:B,children:e(`command.findReplace.all`)})]}),(0,y.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,y.jsxs)(h,{className:`flex items-center gap-1.5 text-xs font-normal cursor-pointer`,children:[(0,y.jsx)(`input`,{type:`checkbox`,checked:w,onChange:e=>T(e.target.checked),className:`rounded border-input`}),e(`command.findReplace.caseSensitive`)]}),(0,y.jsxs)(h,{className:`flex items-center gap-1.5 text-xs font-normal cursor-pointer`,children:[(0,y.jsx)(`input`,{type:`checkbox`,checked:E,onChange:e=>D(e.target.checked),className:`rounded border-input`}),e(`command.findReplace.regex`)]}),(0,y.jsxs)(h,{className:`flex items-center gap-1.5 text-xs font-normal cursor-pointer`,children:[(0,y.jsx)(`input`,{type:`checkbox`,checked:O,onChange:e=>k(e.target.checked),className:`rounded border-input`}),e(`command.findReplace.wholeWord`)]})]})]})}export{b as FindReplaceDialog};
1
+ import{r as e}from"./hePW80VL.js";import{p as t}from"./BeP_ukJr.js";import{t as n}from"./DXIGhA87.js";import{i as r,r as i,t as a}from"./DZh9ctSS.js";import{t as o}from"./BCNsD3zL.js";import{t as s}from"./LVFEf5KC.js";import{n as c}from"./DhVLQTui.js";import{n as l}from"./DB8Yfa-s.js";import{n as u,o as d,s as f,t as p}from"./DAFA-E1-.js";import{Jt as m,c as h,l as g,ut as _}from"./Dg41U79W.js";var v=e(t(),1),y=i();function b(){let{t:e}=r(),{activeDialog:t,closeDialog:i}=c(),[b,x]=(0,v.useState)(``),[S,C]=(0,v.useState)(``),[w,T]=(0,v.useState)(!1),[E,D]=(0,v.useState)(!1),[O,k]=(0,v.useState)(!1),[A,j]=(0,v.useState)(0),M=s(e=>e.activeConnectionId)??``,N=l(e=>M?e.activeTabId[M]:void 0)??``;if(t!==`find-replace`)return null;let P={query:b,caseSensitive:w,regex:E,wholeWord:O},F=M!==``&&N!==``&&b!==``;function I(){i()}function L(){j(F?u(M,N,P,`next`):0)}function R(){j(F?u(M,N,P,`prev`):0)}function z(){F&&j(f(M,N,P,S))}function B(){F&&(d(M,N,P,S),j(p(M,N,P)))}return(0,y.jsxs)(`div`,{className:`fixed top-12 right-4 z-50 bg-background border rounded-md shadow-lg p-3 w-[400px] space-y-2`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(g,{placeholder:e(`command.findReplace.findPlaceholder`),value:b,onChange:e=>x(e.target.value),onKeyDown:e=>{_(e)||(e.key===`Enter`&&(e.shiftKey?R():L()),e.key===`Escape`&&I())},className:`flex-1 h-7 text-sm`,autoFocus:!0}),(0,y.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap min-w-[60px] text-center`,children:A>0?e(`command.findReplace.found`,{count:A}):e(`command.findReplace.noResults`)}),(0,y.jsx)(n,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,onClick:R,title:e(`command.findReplace.previous`),children:(0,y.jsx)(o,{className:`h-4 w-4`})}),(0,y.jsx)(n,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,onClick:L,title:e(`command.findReplace.next`),children:(0,y.jsx)(m,{className:`h-4 w-4`})}),(0,y.jsx)(n,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,onClick:I,title:e(`command.findReplace.close`),children:(0,y.jsx)(a,{className:`h-4 w-4`})})]}),(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(g,{placeholder:e(`command.findReplace.replacePlaceholder`),value:S,onChange:e=>C(e.target.value),onKeyDown:e=>{e.key===`Escape`&&I()},className:`flex-1 h-7 text-sm`}),(0,y.jsx)(n,{variant:`outline`,size:`sm`,className:`h-7 text-xs`,onClick:z,children:e(`command.findReplace.replace`)}),(0,y.jsx)(n,{variant:`outline`,size:`sm`,className:`h-7 text-xs`,onClick:B,children:e(`command.findReplace.all`)})]}),(0,y.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,y.jsxs)(h,{className:`flex items-center gap-1.5 text-xs font-normal cursor-pointer`,children:[(0,y.jsx)(`input`,{type:`checkbox`,checked:w,onChange:e=>T(e.target.checked),className:`rounded border-input`}),e(`command.findReplace.caseSensitive`)]}),(0,y.jsxs)(h,{className:`flex items-center gap-1.5 text-xs font-normal cursor-pointer`,children:[(0,y.jsx)(`input`,{type:`checkbox`,checked:E,onChange:e=>D(e.target.checked),className:`rounded border-input`}),e(`command.findReplace.regex`)]}),(0,y.jsxs)(h,{className:`flex items-center gap-1.5 text-xs font-normal cursor-pointer`,children:[(0,y.jsx)(`input`,{type:`checkbox`,checked:O,onChange:e=>k(e.target.checked),className:`rounded border-input`}),e(`command.findReplace.wholeWord`)]})]})]})}export{b as FindReplaceDialog};
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{r as n}from"./Cu_sGzNJ.js";import{a as r,o as i}from"./Udlj1Cgf.js";var a=e(t(),1),o=n();function s({access:e,value:t,onChange:n,disabled:s,version:c=0}){let[l,u]=(0,a.useState)([]);(0,a.useEffect)(()=>{let t=!1;return e.tryRead(`INFO keyspace`).then(e=>{t||typeof e!=`string`||u(Object.entries(r(e).keyspace??{}).map(([e,t])=>({db:e,keys:i(t).keys})))}),()=>{t=!0}},[e,c]);let d=l.some(e=>e.db===t)?l:[{db:t,keys:NaN},...l];return(0,o.jsx)(`select`,{value:t,disabled:s,onChange:e=>n(e.target.value),className:`h-7 rounded border bg-background px-1 text-xs`,children:d.map(e=>(0,o.jsxs)(`option`,{value:e.db,children:[e.db,Number.isFinite(e.keys)?` (${e.keys.toLocaleString()})`:``]},e.db))})}export{s as t};
1
+ import{r as e}from"./hePW80VL.js";import{p as t}from"./BeP_ukJr.js";import{r as n}from"./DZh9ctSS.js";import{a as r,o as i}from"./Udlj1Cgf.js";var a=e(t(),1),o=n();function s({access:e,value:t,onChange:n,disabled:s,version:c=0}){let[l,u]=(0,a.useState)([]);(0,a.useEffect)(()=>{let t=!1;return e.tryRead(`INFO keyspace`).then(e=>{t||typeof e!=`string`||u(Object.entries(r(e).keyspace??{}).map(([e,t])=>({db:e,keys:i(t).keys})))}),()=>{t=!0}},[e,c]);let d=l.some(e=>e.db===t)?l:[{db:t,keys:NaN},...l];return(0,o.jsx)(`select`,{value:t,disabled:s,onChange:e=>n(e.target.value),className:`h-7 rounded border bg-background px-1 text-xs`,children:d.map(e=>(0,o.jsxs)(`option`,{value:e.db,children:[e.db,Number.isFinite(e.keys)?` (${e.keys.toLocaleString()})`:``]},e.db))})}export{s as t};
@@ -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"./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(`
1
+ import{r as e}from"./hePW80VL.js";import{o as t,p as n}from"./BeP_ukJr.js";import{t as r}from"./DXIGhA87.js";import{i,r as a}from"./DZh9ctSS.js";import{a as o,i as s,n as c,o as l,t as u}from"./BTOj30GE.js";import{a as d,i as f,n as p,r as m,t as h}from"./Bv67Bucf.js";import{t as g}from"./LVFEf5KC.js";import{n as _,t as ee}from"./DhVLQTui.js";import{a as v}from"./MpwA8CBH.js";import{r as y}from"./D41s9TGC.js";import{t as te}from"./B5qa5yLu.js";import{t as b}from"./Bs5VSn0X.js";import{c as x,dt as S,pt as ne}from"./Dg41U79W.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{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
+ import{r as e}from"./hePW80VL.js";import{n as t,o as n,p as r}from"./BeP_ukJr.js";import{t as i}from"./DXIGhA87.js";import{i as a,r as o}from"./DZh9ctSS.js";import{a as s,i as c,n as l,o as ee,r as u,t as d}from"./BTOj30GE.js";import{i as f,t as p}from"./LVFEf5KC.js";import{n as m}from"./j8iiZuT2.js";import{n as h}from"./DhVLQTui.js";import{n as g,t as _}from"./DB8Yfa-s.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"./Dg41U79W.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 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{a as n,s as r,u as i}from"./CiL8zoYm.js";import{r as a}from"./Cu_sGzNJ.js";import{O as o}from"./DzRyVlxz.js";var s=e(t(),1),c=a(),l=Object.defineProperty,u=(e,t)=>l(e,`name`,{value:t,configurable:!0}),d=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),f=s.forwardRef(u(function(e,t){return(0,c.jsx)(n.span,{...e,ref:t,style:{...d,...e.style}})},`VisuallyHidden`)),p=Object.defineProperty,m=(e,t)=>p(e,`name`,{value:t,configurable:!0});function h(e){let t=e+`CollectionProvider`,[n,a]=o(t),[l,u]=n(t,{collectionRef:{current:null},itemMap:new Map}),d=m(e=>{let{scope:t,children:n}=e,r=s.useRef(null),i=s.useRef(new Map).current;return(0,c.jsx)(l,{scope:t,itemMap:i,collectionRef:r,children:n})},`CollectionProvider`);d.displayName=t;let f=e+`CollectionSlot`,p=r(f),h=s.forwardRef((e,t)=>{let{scope:n,children:r}=e,a=u(f,n),o=i(t,a.collectionRef);return(0,c.jsx)(p,{ref:o,children:r})});h.displayName=f;let g=e+`CollectionItemSlot`,_=`data-radix-collection-item`,v=r(g),y=s.forwardRef((e,t)=>{let{scope:n,children:r,...a}=e,o=s.useRef(null),l=i(t,o),d=u(g,n);return s.useEffect(()=>(d.itemMap.set(o,{ref:o,...a}),()=>void d.itemMap.delete(o))),(0,c.jsx)(v,{[_]:``,ref:l,children:r})});y.displayName=g;function b(t){let n=u(e+`CollectionConsumer`,t);return s.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${_}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return m(b,`useCollection`),[{Provider:d,Slot:h,ItemSlot:y},b,a]}m(h,`createCollection`);var g=new WeakMap,_=class e extends Map{static{m(this,`OrderedDict`)}#e;constructor(e){super(e),this.#e=[...super.keys()],g.set(this,!0)}set(e,t){return g.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,n){let r=this.has(t),i=this.#e.length,a=b(e),o=a>=0?a:i+a,s=o<0||o>=i?-1:o;if(s===this.size||r&&s===this.size-1||s===-1)return this.set(t,n),this;let c=this.size+ +!r;a<0&&o++;let l=[...this.#e],u,d=!1;for(let e=o;e<c;e++)if(o===e){let i=l[e];l[e]===t&&(i=l[e+1]),r&&this.delete(t),u=this.get(i),this.set(t,n)}else{!d&&l[e-1]===t&&(d=!0);let n=l[d?e:e-1],r=u;u=this.get(n),this.delete(n),this.set(n,r)}return this}with(t,n,r){let i=new e(this);return i.insert(t,n,r),i}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r,t,n)}after(e){let t=this.#e.indexOf(e);if(t=t===-1||t===this.size-1?-1:t+1,t!==-1)return this.entryAt(t)}setAfter(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r+1,t,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return t!==void 0&&this.delete(t)}at(e){let t=v(this.#e,e);if(t!==void 0)return this.get(t)}entryAt(e){let t=v(this.#e,e);if(t!==void 0)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return v(this.#e,e)}from(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return r;n++}}findIndex(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return n;n++}return-1}filter(t,n){let r=[],i=0;for(let e of this)Reflect.apply(t,n,[e,i,this])&&r.push(e),i++;return new e(r)}map(t,n){let r=[],i=0;for(let e of this)r.push([e[0],Reflect.apply(t,n,[e,i,this])]),i++;return new e(r)}reduce(...e){let[t,n]=e,r=0,i=n??this.at(0);for(let n of this)i=r===0&&e.length===1?n:Reflect.apply(t,this,[i,n,r,this]),r++;return i}reduceRight(...e){let[t,n]=e,r=n??this.at(-1);for(let n=this.size-1;n>=0;n--){let i=this.at(n);r=n===this.size-1&&e.length===1?i:Reflect.apply(t,this,[r,i,n,this])}return r}toSorted(t){let n=[...this.entries()].sort(t);return new e(n)}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let n=this.keyAt(e),r=this.get(n);t.set(n,r)}return t}toSpliced(...t){let n=[...this.entries()];return n.splice(...t),new e(n)}slice(t,n){let r=new e,i=this.size-1;if(t===void 0)return r;t<0&&(t+=this.size),n!==void 0&&n>0&&(i=n-1);for(let e=t;e<=i;e++){let t=this.keyAt(e),n=this.get(t);r.set(t,n)}return r}every(e,t){let n=0;for(let r of this){if(!Reflect.apply(e,t,[r,n,this]))return!1;n++}return!0}some(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return!0;n++}return!1}};function v(e,t){if(`at`in Array.prototype)return Array.prototype.at.call(e,t);let n=y(e,t);return n===-1?void 0:e[n]}m(v,`at`);function y(e,t){let n=e.length,r=b(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}m(y,`toSafeIndex`);function b(e){return e!==e||e===0?0:Math.trunc(e)}m(b,`toSafeInteger`);function x(e){let t=e+`CollectionProvider`,[n,a]=o(t),[l,u]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new _,setItemMap:m(()=>void 0,`setItemMap`)}),d=m(({state:e,...t})=>e?(0,c.jsx)(p,{...t,state:e}):(0,c.jsx)(f,{...t}),`CollectionProvider`);d.displayName=t;let f=m(e=>{let t=C();return(0,c.jsx)(p,{...e,state:t})},`CollectionInit`);f.displayName=t+`Init`;let p=m(e=>{let{scope:t,children:n,state:r}=e,a=s.useRef(null),[o,u]=s.useState(null),d=i(a,u),[f,p]=r;return s.useEffect(()=>{if(!o)return;let e=T(()=>{});return e.observe(o,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[o]),(0,c.jsx)(l,{scope:t,itemMap:f,setItemMap:p,collectionRef:d,collectionRefObject:a,collectionElement:o,children:n})},`CollectionProviderImpl`);p.displayName=t+`Impl`;let h=e+`CollectionSlot`,g=r(h),v=s.forwardRef((e,t)=>{let{scope:n,children:r}=e,a=u(h,n),o=i(t,a.collectionRef);return(0,c.jsx)(g,{ref:o,children:r})});v.displayName=h;let y=e+`CollectionItemSlot`,b=r(y),x=s.forwardRef((e,t)=>{let{scope:n,children:r,...a}=e,o=s.useRef(null),[l,d]=s.useState(null),f=i(t,o,d),{setItemMap:p}=u(y,n),m=s.useRef(a);S(m.current,a)||(m.current=a);let h=m.current;return s.useEffect(()=>{let e=h;return p(t=>l?t.has(l)?t.set(l,{...e,element:l}).toSorted(w):(t.set(l,{...e,element:l}),t.toSorted(w)):t),()=>{p(e=>!l||!e.has(l)?e:(e.delete(l),new _(e)))}},[l,h,p]),(0,c.jsx)(b,{"data-radix-collection-item":``,ref:f,children:r})});x.displayName=y;function C(){return s.useState(new _)}m(C,`useInitCollection`);function E(t){let{itemMap:n}=u(e+`CollectionConsumer`,t);return n}return m(E,`useCollection`),[{Provider:d,Slot:v,ItemSlot:x},{createCollectionScope:a,useCollection:E,useInitCollection:C}]}m(x,`createCollection`);function S(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||e[r]!==t[r])return!1;return!0}m(S,`shallowEqual`);function C(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}m(C,`isElementPreceding`);function w(e,t){return!e[1].element||!t[1].element?0:C(e[1].element,t[1].element)?-1:1}m(w,`sortByDocumentPosition`);function T(e){return new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){e();return}})}m(T,`getChildListObserver`);export{f as n,d as r,h as t};
1
+ import{r as e}from"./hePW80VL.js";import{p as t}from"./BeP_ukJr.js";import{a as n,s as r,u as i}from"./DXIGhA87.js";import{r as a}from"./DZh9ctSS.js";import{O as o}from"./BTOj30GE.js";var s=e(t(),1),c=a(),l=Object.defineProperty,u=(e,t)=>l(e,`name`,{value:t,configurable:!0}),d=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),f=s.forwardRef(u(function(e,t){return(0,c.jsx)(n.span,{...e,ref:t,style:{...d,...e.style}})},`VisuallyHidden`)),p=Object.defineProperty,m=(e,t)=>p(e,`name`,{value:t,configurable:!0});function h(e){let t=e+`CollectionProvider`,[n,a]=o(t),[l,u]=n(t,{collectionRef:{current:null},itemMap:new Map}),d=m(e=>{let{scope:t,children:n}=e,r=s.useRef(null),i=s.useRef(new Map).current;return(0,c.jsx)(l,{scope:t,itemMap:i,collectionRef:r,children:n})},`CollectionProvider`);d.displayName=t;let f=e+`CollectionSlot`,p=r(f),h=s.forwardRef((e,t)=>{let{scope:n,children:r}=e,a=u(f,n),o=i(t,a.collectionRef);return(0,c.jsx)(p,{ref:o,children:r})});h.displayName=f;let g=e+`CollectionItemSlot`,_=`data-radix-collection-item`,v=r(g),y=s.forwardRef((e,t)=>{let{scope:n,children:r,...a}=e,o=s.useRef(null),l=i(t,o),d=u(g,n);return s.useEffect(()=>(d.itemMap.set(o,{ref:o,...a}),()=>void d.itemMap.delete(o))),(0,c.jsx)(v,{[_]:``,ref:l,children:r})});y.displayName=g;function b(t){let n=u(e+`CollectionConsumer`,t);return s.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${_}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return m(b,`useCollection`),[{Provider:d,Slot:h,ItemSlot:y},b,a]}m(h,`createCollection`);var g=new WeakMap,_=class e extends Map{static{m(this,`OrderedDict`)}#e;constructor(e){super(e),this.#e=[...super.keys()],g.set(this,!0)}set(e,t){return g.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,n){let r=this.has(t),i=this.#e.length,a=b(e),o=a>=0?a:i+a,s=o<0||o>=i?-1:o;if(s===this.size||r&&s===this.size-1||s===-1)return this.set(t,n),this;let c=this.size+ +!r;a<0&&o++;let l=[...this.#e],u,d=!1;for(let e=o;e<c;e++)if(o===e){let i=l[e];l[e]===t&&(i=l[e+1]),r&&this.delete(t),u=this.get(i),this.set(t,n)}else{!d&&l[e-1]===t&&(d=!0);let n=l[d?e:e-1],r=u;u=this.get(n),this.delete(n),this.set(n,r)}return this}with(t,n,r){let i=new e(this);return i.insert(t,n,r),i}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r,t,n)}after(e){let t=this.#e.indexOf(e);if(t=t===-1||t===this.size-1?-1:t+1,t!==-1)return this.entryAt(t)}setAfter(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r+1,t,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return t!==void 0&&this.delete(t)}at(e){let t=v(this.#e,e);if(t!==void 0)return this.get(t)}entryAt(e){let t=v(this.#e,e);if(t!==void 0)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return v(this.#e,e)}from(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return r;n++}}findIndex(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return n;n++}return-1}filter(t,n){let r=[],i=0;for(let e of this)Reflect.apply(t,n,[e,i,this])&&r.push(e),i++;return new e(r)}map(t,n){let r=[],i=0;for(let e of this)r.push([e[0],Reflect.apply(t,n,[e,i,this])]),i++;return new e(r)}reduce(...e){let[t,n]=e,r=0,i=n??this.at(0);for(let n of this)i=r===0&&e.length===1?n:Reflect.apply(t,this,[i,n,r,this]),r++;return i}reduceRight(...e){let[t,n]=e,r=n??this.at(-1);for(let n=this.size-1;n>=0;n--){let i=this.at(n);r=n===this.size-1&&e.length===1?i:Reflect.apply(t,this,[r,i,n,this])}return r}toSorted(t){let n=[...this.entries()].sort(t);return new e(n)}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let n=this.keyAt(e),r=this.get(n);t.set(n,r)}return t}toSpliced(...t){let n=[...this.entries()];return n.splice(...t),new e(n)}slice(t,n){let r=new e,i=this.size-1;if(t===void 0)return r;t<0&&(t+=this.size),n!==void 0&&n>0&&(i=n-1);for(let e=t;e<=i;e++){let t=this.keyAt(e),n=this.get(t);r.set(t,n)}return r}every(e,t){let n=0;for(let r of this){if(!Reflect.apply(e,t,[r,n,this]))return!1;n++}return!0}some(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return!0;n++}return!1}};function v(e,t){if(`at`in Array.prototype)return Array.prototype.at.call(e,t);let n=y(e,t);return n===-1?void 0:e[n]}m(v,`at`);function y(e,t){let n=e.length,r=b(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}m(y,`toSafeIndex`);function b(e){return e!==e||e===0?0:Math.trunc(e)}m(b,`toSafeInteger`);function x(e){let t=e+`CollectionProvider`,[n,a]=o(t),[l,u]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new _,setItemMap:m(()=>void 0,`setItemMap`)}),d=m(({state:e,...t})=>e?(0,c.jsx)(p,{...t,state:e}):(0,c.jsx)(f,{...t}),`CollectionProvider`);d.displayName=t;let f=m(e=>{let t=C();return(0,c.jsx)(p,{...e,state:t})},`CollectionInit`);f.displayName=t+`Init`;let p=m(e=>{let{scope:t,children:n,state:r}=e,a=s.useRef(null),[o,u]=s.useState(null),d=i(a,u),[f,p]=r;return s.useEffect(()=>{if(!o)return;let e=T(()=>{});return e.observe(o,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[o]),(0,c.jsx)(l,{scope:t,itemMap:f,setItemMap:p,collectionRef:d,collectionRefObject:a,collectionElement:o,children:n})},`CollectionProviderImpl`);p.displayName=t+`Impl`;let h=e+`CollectionSlot`,g=r(h),v=s.forwardRef((e,t)=>{let{scope:n,children:r}=e,a=u(h,n),o=i(t,a.collectionRef);return(0,c.jsx)(g,{ref:o,children:r})});v.displayName=h;let y=e+`CollectionItemSlot`,b=r(y),x=s.forwardRef((e,t)=>{let{scope:n,children:r,...a}=e,o=s.useRef(null),[l,d]=s.useState(null),f=i(t,o,d),{setItemMap:p}=u(y,n),m=s.useRef(a);S(m.current,a)||(m.current=a);let h=m.current;return s.useEffect(()=>{let e=h;return p(t=>l?t.has(l)?t.set(l,{...e,element:l}).toSorted(w):(t.set(l,{...e,element:l}),t.toSorted(w)):t),()=>{p(e=>!l||!e.has(l)?e:(e.delete(l),new _(e)))}},[l,h,p]),(0,c.jsx)(b,{"data-radix-collection-item":``,ref:f,children:r})});x.displayName=y;function C(){return s.useState(new _)}m(C,`useInitCollection`);function E(t){let{itemMap:n}=u(e+`CollectionConsumer`,t);return n}return m(E,`useCollection`),[{Provider:d,Slot:v,ItemSlot:x},{createCollectionScope:a,useCollection:E,useInitCollection:C}]}m(x,`createCollection`);function S(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||e[r]!==t[r])return!1;return!0}m(S,`shallowEqual`);function C(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}m(C,`isElementPreceding`);function w(e,t){return!e[1].element||!t[1].element?0:C(e[1].element,t[1].element)?-1:1}m(w,`sortByDocumentPosition`);function T(e){return new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){e();return}})}m(T,`getChildListObserver`);export{f as n,d as r,h as t};
@@ -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{i as r,r as i}from"./Cu_sGzNJ.js";import{a,i as o,n as s,o as c,t as l}from"./DzRyVlxz.js";import{a as u,i as d,n as f,r as p,t as m}from"./B3qo2BmL.js";import{t as h}from"./CAd2f6EE.js";import{n as g}from"./D8_hwGjG.js";import{r as _}from"./Ci1xBOLy.js";import{a as v,h as y}from"./DpPKm22O.js";import{c as b,l as x}from"./B_zu4Zim.js";var S=e(t(),1),C=i(),w=[`utf8mb4`,`utf8`,`latin1`,`ascii`,`binary`,`cp1251`,`euckr`,`gb2312`,`gbk`,`sjis`,`ucs2`,`utf16`,`utf32`],T={utf8mb4:[`utf8mb4_general_ci`,`utf8mb4_unicode_ci`,`utf8mb4_bin`,`utf8mb4_0900_ai_ci`],utf8:[`utf8_general_ci`,`utf8_unicode_ci`,`utf8_bin`],latin1:[`latin1_swedish_ci`,`latin1_general_ci`,`latin1_bin`],ascii:[`ascii_general_ci`,`ascii_bin`],binary:[`binary`],cp1251:[`cp1251_general_ci`,`cp1251_bin`],euckr:[`euckr_korean_ci`,`euckr_bin`],gb2312:[`gb2312_chinese_ci`,`gb2312_bin`],gbk:[`gbk_chinese_ci`,`gbk_bin`],sjis:[`sjis_japanese_ci`,`sjis_bin`],ucs2:[`ucs2_general_ci`,`ucs2_unicode_ci`,`ucs2_bin`],utf16:[`utf16_general_ci`,`utf16_unicode_ci`,`utf16_bin`],utf32:[`utf32_general_ci`,`utf32_unicode_ci`,`utf32_bin`]};function E(){let{t:e}=r(),{activeDialog:t,closeDialog:i}=g(),E=t===`create-database`,[D,O]=(0,S.useState)(``),[k,A]=(0,S.useState)(`utf8mb4`),[j,M]=(0,S.useState)(`utf8mb4_general_ci`),[N,P]=(0,S.useState)(!1),[F,I]=(0,S.useState)(null);function L(e){e||(i(),I(null),O(``),A(`utf8mb4`),M(`utf8mb4_general_ci`))}function R(e){A(e);let t=T[e];M(t?.[0]??``)}async function z(){let e=h.getState().activeConnectionId,t=D.trim();if(!(!e||!t)){I(null),P(!0);try{let n=_(e).getQuery(`CREATE_DATABASE`,t,k,j);await v(e,n),await y(e),L(!1)}catch(e){I(e instanceof Error?e.message:String(e))}finally{P(!1)}}}let B=T[k]??[];return(0,C.jsx)(l,{open:E,onOpenChange:L,children:(0,C.jsxs)(s,{className:`sm:max-w-[450px]`,children:[(0,C.jsx)(a,{children:(0,C.jsx)(c,{children:e(`database.create.title`)})}),(0,C.jsxs)(`div`,{className:`space-y-4`,children:[(0,C.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,C.jsx)(b,{htmlFor:`db-name`,children:e(`database.create.name`)}),(0,C.jsx)(x,{id:`db-name`,value:D,onChange:e=>O(e.target.value),placeholder:e(`database.create.namePlaceholder`)})]}),(0,C.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,C.jsx)(b,{htmlFor:`db-charset`,children:e(`database.create.charset`)}),(0,C.jsxs)(m,{value:k,onValueChange:R,children:[(0,C.jsx)(d,{id:`db-charset`,className:`w-full`,children:(0,C.jsx)(u,{})}),(0,C.jsx)(f,{children:w.map(e=>(0,C.jsx)(p,{value:e,children:e},e))})]})]}),(0,C.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,C.jsx)(b,{htmlFor:`db-collation`,children:e(`database.create.collation`)}),(0,C.jsxs)(m,{value:j,onValueChange:M,children:[(0,C.jsx)(d,{id:`db-collation`,className:`w-full`,children:(0,C.jsx)(u,{})}),(0,C.jsx)(f,{children:B.map(e=>(0,C.jsx)(p,{value:e,children:e},e))})]})]})]}),F&&(0,C.jsx)(`p`,{className:`px-1 text-xs text-destructive leading-relaxed`,children:F}),(0,C.jsxs)(o,{children:[(0,C.jsx)(n,{variant:`outline`,onClick:()=>L(!1),children:e(`database.create.cancel`)}),(0,C.jsx)(n,{onClick:()=>void z(),disabled:!D.trim()||N,children:e(`database.create.create`)})]})]})})}export{E as CreateDatabaseDialog};
1
+ import{r as e}from"./hePW80VL.js";import{p as t}from"./BeP_ukJr.js";import{t as n}from"./DXIGhA87.js";import{i as r,r as i}from"./DZh9ctSS.js";import{a,i as o,n as s,o as c,t as l}from"./BTOj30GE.js";import{a as u,i as d,n as f,r as p,t as m}from"./Bv67Bucf.js";import{t as h}from"./LVFEf5KC.js";import{n as g}from"./DhVLQTui.js";import{r as _}from"./D41s9TGC.js";import{a as v,h as y}from"./15ORcG2N.js";import{c as b,l as x}from"./Dg41U79W.js";var S=e(t(),1),C=i(),w=[`utf8mb4`,`utf8`,`latin1`,`ascii`,`binary`,`cp1251`,`euckr`,`gb2312`,`gbk`,`sjis`,`ucs2`,`utf16`,`utf32`],T={utf8mb4:[`utf8mb4_general_ci`,`utf8mb4_unicode_ci`,`utf8mb4_bin`,`utf8mb4_0900_ai_ci`],utf8:[`utf8_general_ci`,`utf8_unicode_ci`,`utf8_bin`],latin1:[`latin1_swedish_ci`,`latin1_general_ci`,`latin1_bin`],ascii:[`ascii_general_ci`,`ascii_bin`],binary:[`binary`],cp1251:[`cp1251_general_ci`,`cp1251_bin`],euckr:[`euckr_korean_ci`,`euckr_bin`],gb2312:[`gb2312_chinese_ci`,`gb2312_bin`],gbk:[`gbk_chinese_ci`,`gbk_bin`],sjis:[`sjis_japanese_ci`,`sjis_bin`],ucs2:[`ucs2_general_ci`,`ucs2_unicode_ci`,`ucs2_bin`],utf16:[`utf16_general_ci`,`utf16_unicode_ci`,`utf16_bin`],utf32:[`utf32_general_ci`,`utf32_unicode_ci`,`utf32_bin`]};function E(){let{t:e}=r(),{activeDialog:t,closeDialog:i}=g(),E=t===`create-database`,[D,O]=(0,S.useState)(``),[k,A]=(0,S.useState)(`utf8mb4`),[j,M]=(0,S.useState)(`utf8mb4_general_ci`),[N,P]=(0,S.useState)(!1),[F,I]=(0,S.useState)(null);function L(e){e||(i(),I(null),O(``),A(`utf8mb4`),M(`utf8mb4_general_ci`))}function R(e){A(e);let t=T[e];M(t?.[0]??``)}async function z(){let e=h.getState().activeConnectionId,t=D.trim();if(!(!e||!t)){I(null),P(!0);try{let n=_(e).getQuery(`CREATE_DATABASE`,t,k,j);await v(e,n),await y(e),L(!1)}catch(e){I(e instanceof Error?e.message:String(e))}finally{P(!1)}}}let B=T[k]??[];return(0,C.jsx)(l,{open:E,onOpenChange:L,children:(0,C.jsxs)(s,{className:`sm:max-w-[450px]`,children:[(0,C.jsx)(a,{children:(0,C.jsx)(c,{children:e(`database.create.title`)})}),(0,C.jsxs)(`div`,{className:`space-y-4`,children:[(0,C.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,C.jsx)(b,{htmlFor:`db-name`,children:e(`database.create.name`)}),(0,C.jsx)(x,{id:`db-name`,value:D,onChange:e=>O(e.target.value),placeholder:e(`database.create.namePlaceholder`)})]}),(0,C.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,C.jsx)(b,{htmlFor:`db-charset`,children:e(`database.create.charset`)}),(0,C.jsxs)(m,{value:k,onValueChange:R,children:[(0,C.jsx)(d,{id:`db-charset`,className:`w-full`,children:(0,C.jsx)(u,{})}),(0,C.jsx)(f,{children:w.map(e=>(0,C.jsx)(p,{value:e,children:e},e))})]})]}),(0,C.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,C.jsx)(b,{htmlFor:`db-collation`,children:e(`database.create.collation`)}),(0,C.jsxs)(m,{value:j,onValueChange:M,children:[(0,C.jsx)(d,{id:`db-collation`,className:`w-full`,children:(0,C.jsx)(u,{})}),(0,C.jsx)(f,{children:B.map(e=>(0,C.jsx)(p,{value:e,children:e},e))})]})]})]}),F&&(0,C.jsx)(`p`,{className:`px-1 text-xs text-destructive leading-relaxed`,children:F}),(0,C.jsxs)(o,{children:[(0,C.jsx)(n,{variant:`outline`,onClick:()=>L(!1),children:e(`database.create.cancel`)}),(0,C.jsx)(n,{onClick:()=>void z(),disabled:!D.trim()||N,children:e(`database.create.create`)})]})]})})}export{E as CreateDatabaseDialog};
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{t as n}from"./CAd2f6EE.js";import{a as r,c as i}from"./BghfQrAj.js";import{a}from"./DpPKm22O.js";var o=e(t(),1);function s(e,t,n){return c(e,t,n.database)}function c(e,t,s){let c=n(t=>t.activeConnections.find(t=>t.id===e)?.serverConnectionId??null),l=n(t=>t.activeConnections.find(t=>t.id===e)?.readOnly??!1),u=(0,o.useCallback)(async(e,t)=>{if(!c)throw Error(`Not connected`);return(await r(c)(e,(t??s)||void 0)).reply},[c,s]),d=(0,o.useCallback)(async(e,t)=>{if(!c)throw Error(`Not connected`);return(await i(c,e,(t??s)||void 0)).map(e=>e.success?e.reply:Error(e.message))},[c,s]),f=(0,o.useCallback)(async e=>{try{return await u(e)}catch{return null}},[u]),p=(0,o.useCallback)(async(n,r={})=>{let i=await a(e,n,{database:r.database??s,tabId:t,skipDestructiveConfirm:r.confirmed,skipHistory:r.skipHistory});return i.rows[0]?Object.values(i.rows[0])[0]:null},[e,t,s]);return(0,o.useMemo)(()=>({connected:c!==null,readOnly:l,read:u,tryRead:f,readBatch:d,write:p}),[c,l,u,f,d,p])}export{s as n,c as t};
1
+ import{r as e}from"./hePW80VL.js";import{p as t}from"./BeP_ukJr.js";import{t as n}from"./LVFEf5KC.js";import{a as r,c as i}from"./MpwA8CBH.js";import{a}from"./15ORcG2N.js";var o=e(t(),1);function s(e,t,n){return c(e,t,n.database)}function c(e,t,s){let c=n(t=>t.activeConnections.find(t=>t.id===e)?.serverConnectionId??null),l=n(t=>t.activeConnections.find(t=>t.id===e)?.readOnly??!1),u=(0,o.useCallback)(async(e,t)=>{if(!c)throw Error(`Not connected`);return(await r(c)(e,(t??s)||void 0)).reply},[c,s]),d=(0,o.useCallback)(async(e,t)=>{if(!c)throw Error(`Not connected`);return(await i(c,e,(t??s)||void 0)).map(e=>e.success?e.reply:Error(e.message))},[c,s]),f=(0,o.useCallback)(async e=>{try{return await u(e)}catch{return null}},[u]),p=(0,o.useCallback)(async(n,r={})=>{let i=await a(e,n,{database:r.database??s,tabId:t,skipDestructiveConfirm:r.confirmed,skipHistory:r.skipHistory});return i.rows[0]?Object.values(i.rows[0])[0]:null},[e,t,s]);return(0,o.useMemo)(()=>({connected:c!==null,readOnly:l,read:u,tryRead:f,readBatch:d,write:p}),[c,l,u,f,d,p])}export{s as n,c as t};