planche 0.8.5 → 0.8.6

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 (39) hide show
  1. package/app/assets/{C3bMAsUp.js → 2rC1LDx2.js} +1 -1
  2. package/app/assets/{C4il2fft.js → B-yXhF3b.js} +1 -1
  3. package/app/assets/{D7Ze5md9.js → B1lNzsWx.js} +3 -3
  4. package/app/assets/{CkgLFvM5.js → B1mA7CRG.js} +1 -1
  5. package/app/assets/{fCzQKDqY.js → B3UjY7jq.js} +1 -1
  6. package/app/assets/{DiaA_DOW.js → B4JrGAXR.js} +1 -1
  7. package/app/assets/{D_2UqK4k.js → BGIwW6nZ.js} +1 -1
  8. package/app/assets/{og5dTmtH.js → BM_rLXLv.js} +1 -1
  9. package/app/assets/{DFNc4ghA.js → BP4mxS6-.js} +1 -1
  10. package/app/assets/{dxLVUFtU.js → BV9jV2YU.js} +1 -1
  11. package/app/assets/{Dd9Cr3e8.js → BgDlbKXF.js} +1 -1
  12. package/app/assets/{DmejZTwI.js → BluggY4N.js} +1 -1
  13. package/app/assets/{qbvehL2h.js → Bm1X7uTX.js} +1 -1
  14. package/app/assets/{RIOwEE7M.js → BuiqFOkR.js} +1 -1
  15. package/app/assets/{IzH8qyLi.js → Bxa5htLS.js} +1 -1
  16. package/app/assets/{DnjY8W6t.js → CAHFhps_.js} +1 -1
  17. package/app/assets/{QBd1UkiI.js → CB6XKkDn.js} +1 -1
  18. package/app/assets/{Bpg8LzYe.js → CFQ-2DAt.js} +1 -1
  19. package/app/assets/{1E6FYbv2.js → CPgI8it1.js} +1 -1
  20. package/app/assets/{BGOnv2_O.js → CQieSTGh.js} +1 -1
  21. package/app/assets/{B5OocgEJ.js → Cd_45PFU.js} +1 -1
  22. package/app/assets/{S4Oofhu9.js → Cl5bGhXD.js} +1 -1
  23. package/app/assets/{DlKZCiMg.js → CnOZTyPx.js} +2 -2
  24. package/app/assets/D3Eb1tV7.css +2 -0
  25. package/app/assets/{BunrDTHn.js → DKjjOKsl.js} +1 -1
  26. package/app/assets/{Cx_chT_j.js → DsAlsNTl.js} +1 -1
  27. package/app/assets/{cc05Z2oj.js → DtU_PUOl.js} +1 -1
  28. package/app/assets/{BIjF9ulh.js → DyJPwVZe.js} +1 -1
  29. package/app/assets/{B8xQ2o-X.js → NYrZ_KG4.js} +1 -1
  30. package/app/assets/{Dh3YJ3G1.js → XlrBcEaO.js} +1 -1
  31. package/app/assets/{B3uI9Ppb.js → YjhzJVQZ.js} +1 -1
  32. package/app/assets/{DGD5v9rw.js → bDuhhOB6.js} +1 -1
  33. package/app/assets/{COIa4uoZ.js → mSiUHQYe.js} +1 -1
  34. package/app/assets/{FnB_uI57.js → ohBkXlZt.js} +1 -1
  35. package/app/assets/{DZH-tLW-.js → pp1UmAJW.js} +1 -1
  36. package/app/assets/{NY_tAtcY.js → vKCvRvxP.js} +1 -1
  37. package/app/index.html +3 -3
  38. package/package.json +1 -1
  39. package/app/assets/B-Mrqvrb.css +0 -2
@@ -1 +1 @@
1
- import{l as e,m as t}from"./CKOS5Y-e.js";import{t as n}from"./neLPq0_M.js";import{Lt as r}from"./D7Ze5md9.js";var i={currency:`USD`,annualPerMonth:8,annualTotal:96,monthly:10},a=e=>`$${e}`,o=e(),s=`https://planche.dev/pricing/`;function c({highlight:e,innerRef:c}){let{t:l}=t(),u=e?[e,...n.filter(t=>t!==e)]:[...n];return(0,o.jsxs)(`div`,{className:`grid gap-3 rounded-xl border border-primary/50 bg-muted/20 p-4 shadow-[inset_0_0_0_1px_hsl(var(--primary)/0.15)]`,children:[(0,o.jsx)(`p`,{className:`text-[0.7rem] font-semibold uppercase tracking-[0.09em] text-muted-foreground`,children:`Pro`}),(0,o.jsxs)(`div`,{className:`grid gap-1`,children:[(0,o.jsxs)(`p`,{className:`flex items-baseline gap-1.5`,children:[(0,o.jsx)(`span`,{className:`text-3xl font-semibold leading-none text-foreground`,children:a(i.annualPerMonth)}),(0,o.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:l(`pro.perMonth`)})]}),(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l(`pro.priceNote`,{annual:a(i.annualTotal),monthly:a(i.monthly)})})]}),(0,o.jsx)(`ul`,{className:`grid gap-2 text-xs`,children:u.map(t=>(0,o.jsxs)(`li`,{className:`flex gap-2`,children:[(0,o.jsx)(r,{className:`mt-0.5 size-3 shrink-0 ${t===e?`text-primary`:`text-emerald-500/80`}`}),(0,o.jsxs)(`span`,{className:`grid gap-0.5`,children:[(0,o.jsx)(`span`,{className:t===e?`font-medium text-foreground`:`text-foreground/90`,children:l(`pro.features.${t}`)}),(0,o.jsx)(`span`,{className:`text-muted-foreground`,children:l(`pro.featureDetails.${t}`)})]})]},t))}),(0,o.jsx)(`a`,{ref:c,href:s,target:`_blank`,rel:`noreferrer`,className:`rounded-md bg-primary px-4 py-2 text-center text-sm font-medium text-primary-foreground hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:l(`pro.pricing`)})]})}export{c as t};
1
+ import{l as e,m as t}from"./CKOS5Y-e.js";import{t as n}from"./neLPq0_M.js";import{Lt as r}from"./B1lNzsWx.js";var i={currency:`USD`,annualPerMonth:8,annualTotal:96,monthly:10},a=e=>`$${e}`,o=e(),s=`https://planche.dev/pricing/`;function c({highlight:e,innerRef:c}){let{t:l}=t(),u=e?[e,...n.filter(t=>t!==e)]:[...n];return(0,o.jsxs)(`div`,{className:`grid gap-3 rounded-xl border border-primary/50 bg-muted/20 p-4 shadow-[inset_0_0_0_1px_hsl(var(--primary)/0.15)]`,children:[(0,o.jsx)(`p`,{className:`text-[0.7rem] font-semibold uppercase tracking-[0.09em] text-muted-foreground`,children:`Pro`}),(0,o.jsxs)(`div`,{className:`grid gap-1`,children:[(0,o.jsxs)(`p`,{className:`flex items-baseline gap-1.5`,children:[(0,o.jsx)(`span`,{className:`text-3xl font-semibold leading-none text-foreground`,children:a(i.annualPerMonth)}),(0,o.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:l(`pro.perMonth`)})]}),(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l(`pro.priceNote`,{annual:a(i.annualTotal),monthly:a(i.monthly)})})]}),(0,o.jsx)(`ul`,{className:`grid gap-2 text-xs`,children:u.map(t=>(0,o.jsxs)(`li`,{className:`flex gap-2`,children:[(0,o.jsx)(r,{className:`mt-0.5 size-3 shrink-0 ${t===e?`text-primary`:`text-emerald-500/80`}`}),(0,o.jsxs)(`span`,{className:`grid gap-0.5`,children:[(0,o.jsx)(`span`,{className:t===e?`font-medium text-foreground`:`text-foreground/90`,children:l(`pro.features.${t}`)}),(0,o.jsx)(`span`,{className:`text-muted-foreground`,children:l(`pro.featureDetails.${t}`)})]})]},t))}),(0,o.jsx)(`a`,{ref:c,href:s,target:`_blank`,rel:`noreferrer`,className:`rounded-md bg-primary px-4 py-2 text-center text-sm font-medium text-primary-foreground hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:l(`pro.pricing`)})]})}export{c as t};
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{h as t,n}from"./XzPc-eVf.js";import{l as r,m as i,t as a}from"./CKOS5Y-e.js";import{At as o,I as s,M as c,N as l,P as u,c as d,l as f,tt as p}from"./D7Ze5md9.js";import{a as m,i as h,n as g,o as _,r as v,t as y}from"./DxuXBECK.js";import{t as b}from"./CkgLFvM5.js";var x=e(t(),1);function S(){let e=s(e=>e.status.state===`valid`);return!u()||e}var C=r(),w={offline:`sync.offline`,server:`sync.serverError`,unauthorized:`sync.serverError`,conflict:`sync.serverError`,"bad-passphrase":`sync.wrongPassphrase`,malformed:`sync.wrongPassphrase`,unsupported:`sync.serverError`};function T(){let e=n(e=>e.activeDialog),t=n(e=>e.closeDialog),{phase:r,user:s,busy:u,error:T,lastSyncedAt:E,vault:D,refresh:O,createVault:k,unlock:A,push:j,signOut:M,forgetVault:N,closeAccount:P,setError:F}=c(),{t:I}=i(),L=S(),[R,z]=(0,x.useState)(``),[B,V]=(0,x.useState)(``),[H,U]=(0,x.useState)(!1),[W,G]=(0,x.useState)(!1);(0,x.useEffect)(()=>{O()},[O]);let K=R.length>0&&R.length<10,q=B.length>0&&R!==B,J=R.length>=10&&R===B,Y=T?I(w[T]??`sync.serverError`):null,X=D?Object.keys(D.profiles).length:0,Z=()=>{z(``),V(``),F(null)};return(0,C.jsx)(y,{open:e===`sync`,onOpenChange:e=>{e||t()},children:(0,C.jsxs)(g,{className:`max-h-[85vh] overflow-y-auto sm:max-w-[560px]`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,C.jsxs)(m,{children:[(0,C.jsx)(_,{children:I(`sync.title`)}),(0,C.jsxs)(v,{children:[I(`sync.description`),s&&(0,C.jsx)(`span`,{className:`mt-1 block text-xs`,children:I(`sync.signedInAs`,{email:s.email??s.id})})]})]}),(0,C.jsxs)(`div`,{className:`grid gap-3 text-sm`,children:[(0,C.jsx)(`p`,{className:`rounded-md border bg-muted/40 p-3 text-xs text-muted-foreground`,children:I(`sync.stored`)}),r===`unavailable`&&(0,C.jsx)(`p`,{className:`rounded-md border border-amber-500/40 bg-amber-500/5 p-3 text-xs text-amber-600 dark:text-amber-400`,children:p()?I(`sync.unavailable`):I(`sync.notDeployed`)}),r===`signed-out`&&(0,C.jsxs)(a,{onClick:()=>{window.location.href=l(`github`,window.location.href)},children:[(0,C.jsx)(o,{className:`size-4`}),I(`sync.signIn`)]}),s&&!L&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:I(`sync.needsPro`)}),(0,C.jsx)(b,{highlight:`sync`})]}),L&&r===`no-vault`&&(0,C.jsxs)(`div`,{className:`grid gap-2`,children:[(0,C.jsx)(`p`,{className:`text-sm font-medium`,children:I(`sync.createTitle`)}),(0,C.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:I(`sync.createHint`)}),(0,C.jsx)(d,{htmlFor:`sync-pass`,children:I(`sync.passphrase`)}),(0,C.jsx)(f,{id:`sync-pass`,type:`password`,autoComplete:`new-password`,value:R,onChange:e=>{z(e.target.value),F(null)}}),(0,C.jsx)(d,{htmlFor:`sync-confirm`,children:I(`sync.confirm`)}),(0,C.jsx)(f,{id:`sync-confirm`,type:`password`,autoComplete:`new-password`,value:B,onChange:e=>{V(e.target.value),F(null)}}),K&&(0,C.jsx)(`p`,{className:`text-xs text-destructive`,children:I(`sync.tooShort`,{count:10})}),q&&(0,C.jsx)(`p`,{className:`text-xs text-destructive`,children:I(`sync.mismatch`)}),(0,C.jsx)(a,{disabled:!J||u,onClick:()=>{k(R).then(Z)},children:I(`sync.enable`)})]}),L&&r===`locked`&&(0,C.jsxs)(`div`,{className:`grid gap-2`,children:[(0,C.jsx)(`p`,{className:`text-sm font-medium`,children:I(`sync.unlockTitle`)}),(0,C.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:I(`sync.unlockHint`)}),(0,C.jsx)(d,{htmlFor:`sync-unlock`,children:I(`sync.passphrase`)}),(0,C.jsx)(f,{id:`sync-unlock`,type:`password`,autoComplete:`current-password`,value:R,onChange:e=>{z(e.target.value),F(null)}}),(0,C.jsx)(a,{disabled:!R||u,onClick:()=>{A(R).then(Z)},children:I(`sync.unlock`)})]}),L&&r===`ready`&&(0,C.jsxs)(`div`,{className:`grid gap-2`,children:[(0,C.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[E?I(`sync.lastSynced`,{when:new Date(E).toLocaleString()}):I(`sync.neverSynced`),` · `,I(`sync.profiles`,{count:X})]}),(0,C.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,C.jsx)(a,{variant:`secondary`,disabled:u,onClick:()=>{U(!1),j()},children:I(`sync.syncNow`)}),(0,C.jsx)(a,{variant:`ghost`,disabled:u,onClick:()=>{c.getState().lock(),Z()},children:I(`sync.changePassphrase`)})]}),H?(0,C.jsxs)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/5 p-3`,children:[(0,C.jsx)(`p`,{className:`mb-2 text-xs`,children:I(`sync.deleteVaultConfirm`)}),(0,C.jsxs)(`div`,{className:`flex gap-2`,children:[(0,C.jsx)(a,{variant:`destructive`,disabled:u,onClick:()=>{N().then(()=>U(!1))},children:I(`sync.deleteVault`)}),(0,C.jsx)(a,{variant:`ghost`,onClick:()=>U(!1),children:I(`settings.done`)})]})]}):(0,C.jsx)(a,{variant:`ghost`,className:`justify-start px-0 text-destructive`,onClick:()=>U(!0),children:I(`sync.deleteVault`)})]}),s&&(W?(0,C.jsxs)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/5 p-3`,children:[(0,C.jsx)(`p`,{className:`mb-2 text-xs`,children:I(`sync.deleteAccountConfirm`)}),(0,C.jsxs)(`div`,{className:`flex gap-2`,children:[(0,C.jsx)(a,{variant:`destructive`,disabled:u,onClick:()=>{P().then(()=>G(!1))},children:I(`sync.deleteAccount`)}),(0,C.jsx)(a,{variant:`ghost`,onClick:()=>G(!1),children:I(`settings.done`)})]})]}):(0,C.jsx)(`button`,{type:`button`,onClick:()=>G(!0),className:`w-fit rounded-sm text-xs text-muted-foreground underline underline-offset-2 hover:text-destructive focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,children:I(`sync.deleteAccount`)})),u&&(0,C.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:I(`sync.working`)}),Y&&(0,C.jsx)(`p`,{className:`text-xs text-destructive`,children:Y})]}),(0,C.jsxs)(h,{children:[s&&(0,C.jsx)(a,{variant:`ghost`,disabled:u,onClick:()=>{M().then(Z)},children:I(`sync.signOut`)}),(0,C.jsx)(a,{onClick:t,children:I(`settings.done`)})]})]})})}export{T as SyncDialog};
1
+ import{r as e}from"./hePW80VL.js";import{h as t,n}from"./XzPc-eVf.js";import{l as r,m as i,t as a}from"./CKOS5Y-e.js";import{At as o,I as s,M as c,N as l,P as u,c as d,l as f,tt as p}from"./B1lNzsWx.js";import{a as m,i as h,n as g,o as _,r as v,t as y}from"./DxuXBECK.js";import{t as b}from"./B1mA7CRG.js";var x=e(t(),1);function S(){let e=s(e=>e.status.state===`valid`);return!u()||e}var C=r(),w={offline:`sync.offline`,server:`sync.serverError`,unauthorized:`sync.serverError`,conflict:`sync.serverError`,"bad-passphrase":`sync.wrongPassphrase`,malformed:`sync.wrongPassphrase`,unsupported:`sync.serverError`};function T(){let e=n(e=>e.activeDialog),t=n(e=>e.closeDialog),{phase:r,user:s,busy:u,error:T,lastSyncedAt:E,vault:D,refresh:O,createVault:k,unlock:A,push:j,signOut:M,forgetVault:N,closeAccount:P,setError:F}=c(),{t:I}=i(),L=S(),[R,z]=(0,x.useState)(``),[B,V]=(0,x.useState)(``),[H,U]=(0,x.useState)(!1),[W,G]=(0,x.useState)(!1);(0,x.useEffect)(()=>{O()},[O]);let K=R.length>0&&R.length<10,q=B.length>0&&R!==B,J=R.length>=10&&R===B,Y=T?I(w[T]??`sync.serverError`):null,X=D?Object.keys(D.profiles).length:0,Z=()=>{z(``),V(``),F(null)};return(0,C.jsx)(y,{open:e===`sync`,onOpenChange:e=>{e||t()},children:(0,C.jsxs)(g,{className:`max-h-[85vh] overflow-y-auto sm:max-w-[560px]`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,C.jsxs)(m,{children:[(0,C.jsx)(_,{children:I(`sync.title`)}),(0,C.jsxs)(v,{children:[I(`sync.description`),s&&(0,C.jsx)(`span`,{className:`mt-1 block text-xs`,children:I(`sync.signedInAs`,{email:s.email??s.id})})]})]}),(0,C.jsxs)(`div`,{className:`grid gap-3 text-sm`,children:[(0,C.jsx)(`p`,{className:`rounded-md border bg-muted/40 p-3 text-xs text-muted-foreground`,children:I(`sync.stored`)}),r===`unavailable`&&(0,C.jsx)(`p`,{className:`rounded-md border border-amber-500/40 bg-amber-500/5 p-3 text-xs text-amber-600 dark:text-amber-400`,children:p()?I(`sync.unavailable`):I(`sync.notDeployed`)}),r===`signed-out`&&(0,C.jsxs)(a,{onClick:()=>{window.location.href=l(`github`,window.location.href)},children:[(0,C.jsx)(o,{className:`size-4`}),I(`sync.signIn`)]}),s&&!L&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:I(`sync.needsPro`)}),(0,C.jsx)(b,{highlight:`sync`})]}),L&&r===`no-vault`&&(0,C.jsxs)(`div`,{className:`grid gap-2`,children:[(0,C.jsx)(`p`,{className:`text-sm font-medium`,children:I(`sync.createTitle`)}),(0,C.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:I(`sync.createHint`)}),(0,C.jsx)(d,{htmlFor:`sync-pass`,children:I(`sync.passphrase`)}),(0,C.jsx)(f,{id:`sync-pass`,type:`password`,autoComplete:`new-password`,value:R,onChange:e=>{z(e.target.value),F(null)}}),(0,C.jsx)(d,{htmlFor:`sync-confirm`,children:I(`sync.confirm`)}),(0,C.jsx)(f,{id:`sync-confirm`,type:`password`,autoComplete:`new-password`,value:B,onChange:e=>{V(e.target.value),F(null)}}),K&&(0,C.jsx)(`p`,{className:`text-xs text-destructive`,children:I(`sync.tooShort`,{count:10})}),q&&(0,C.jsx)(`p`,{className:`text-xs text-destructive`,children:I(`sync.mismatch`)}),(0,C.jsx)(a,{disabled:!J||u,onClick:()=>{k(R).then(Z)},children:I(`sync.enable`)})]}),L&&r===`locked`&&(0,C.jsxs)(`div`,{className:`grid gap-2`,children:[(0,C.jsx)(`p`,{className:`text-sm font-medium`,children:I(`sync.unlockTitle`)}),(0,C.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:I(`sync.unlockHint`)}),(0,C.jsx)(d,{htmlFor:`sync-unlock`,children:I(`sync.passphrase`)}),(0,C.jsx)(f,{id:`sync-unlock`,type:`password`,autoComplete:`current-password`,value:R,onChange:e=>{z(e.target.value),F(null)}}),(0,C.jsx)(a,{disabled:!R||u,onClick:()=>{A(R).then(Z)},children:I(`sync.unlock`)})]}),L&&r===`ready`&&(0,C.jsxs)(`div`,{className:`grid gap-2`,children:[(0,C.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[E?I(`sync.lastSynced`,{when:new Date(E).toLocaleString()}):I(`sync.neverSynced`),` · `,I(`sync.profiles`,{count:X})]}),(0,C.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,C.jsx)(a,{variant:`secondary`,disabled:u,onClick:()=>{U(!1),j()},children:I(`sync.syncNow`)}),(0,C.jsx)(a,{variant:`ghost`,disabled:u,onClick:()=>{c.getState().lock(),Z()},children:I(`sync.changePassphrase`)})]}),H?(0,C.jsxs)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/5 p-3`,children:[(0,C.jsx)(`p`,{className:`mb-2 text-xs`,children:I(`sync.deleteVaultConfirm`)}),(0,C.jsxs)(`div`,{className:`flex gap-2`,children:[(0,C.jsx)(a,{variant:`destructive`,disabled:u,onClick:()=>{N().then(()=>U(!1))},children:I(`sync.deleteVault`)}),(0,C.jsx)(a,{variant:`ghost`,onClick:()=>U(!1),children:I(`settings.done`)})]})]}):(0,C.jsx)(a,{variant:`ghost`,className:`justify-start px-0 text-destructive`,onClick:()=>U(!0),children:I(`sync.deleteVault`)})]}),s&&(W?(0,C.jsxs)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/5 p-3`,children:[(0,C.jsx)(`p`,{className:`mb-2 text-xs`,children:I(`sync.deleteAccountConfirm`)}),(0,C.jsxs)(`div`,{className:`flex gap-2`,children:[(0,C.jsx)(a,{variant:`destructive`,disabled:u,onClick:()=>{P().then(()=>G(!1))},children:I(`sync.deleteAccount`)}),(0,C.jsx)(a,{variant:`ghost`,onClick:()=>G(!1),children:I(`settings.done`)})]})]}):(0,C.jsx)(`button`,{type:`button`,onClick:()=>G(!0),className:`w-fit rounded-sm text-xs text-muted-foreground underline underline-offset-2 hover:text-destructive focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,children:I(`sync.deleteAccount`)})),u&&(0,C.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:I(`sync.working`)}),Y&&(0,C.jsx)(`p`,{className:`text-xs text-destructive`,children:Y})]}),(0,C.jsxs)(h,{children:[s&&(0,C.jsx)(a,{variant:`ghost`,disabled:u,onClick:()=>{M().then(Z)},children:I(`sync.signOut`)}),(0,C.jsx)(a,{onClick:t,children:I(`settings.done`)})]})]})})}export{T as SyncDialog};
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{h as t,n,t as r}from"./XzPc-eVf.js";import{l as i,m as a,t as o}from"./CKOS5Y-e.js";import{I as s,L as c,R as l,c as u,t as d}from"./D7Ze5md9.js";import{a as f,i as p,n as m,o as h,r as g,t as _}from"./DxuXBECK.js";import{t as v}from"./CkgLFvM5.js";var y=e(t(),1),b=i();function x(e){return e.state===`invalid`?e.reason===`no-public-key`?`pro.notConfigured`:e.reason===`no-webcrypto`?`pro.noWebcrypto`:`pro.invalidKey`:null}function S(){let e=n(e=>e.activeDialog),t=n(e=>e.closeDialog),i=r(`license`),{key:S,status:C,activate:w,clear:T}=s(),{t:E}=a(),[D,O]=(0,y.useState)(S),[k,A]=(0,y.useState)(!1),[j,M]=(0,y.useState)(!i?.feature||!!S),N=(0,y.useRef)(null),[P,F]=(0,y.useState)(c()?null:E(`pro.notConfigured`)),I=async()=>{A(!0);let e=x(await w(D.trim()));F(e?E(e):null),A(!1)},L=C.state===`valid`||C.state===`expired`?C.claim:null,R=i?.feature?E(`pro.blocked`,{feature:E(`pro.features.${i.feature}`)}):null;return(0,b.jsx)(_,{open:e===`license`,onOpenChange:e=>{e||t()},children:(0,b.jsxs)(m,{className:`max-h-[85vh] overflow-y-auto sm:max-w-[560px]`,onOpenAutoFocus:e=>{N.current&&(e.preventDefault(),N.current.focus())},children:[(0,b.jsx)(f,{children:(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,b.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,b.jsx)(d,{size:44}),(0,b.jsx)(l,{className:`absolute -right-2 -bottom-1 ml-0`})]}),(0,b.jsxs)(`div`,{className:`grid gap-1`,children:[(0,b.jsx)(h,{children:E(`pro.licenseTitle`)}),(0,b.jsx)(g,{children:R??E(`pro.licenseDescription`)})]})]})}),(0,b.jsxs)(`div`,{className:`grid gap-3 text-sm`,children:[C.state===`valid`&&(0,b.jsxs)(`div`,{className:`rounded-md border border-emerald-500/40 bg-emerald-500/5 p-3 text-xs`,children:[(0,b.jsx)(`p`,{className:`font-medium text-emerald-600 dark:text-emerald-400`,children:E(`pro.active`)}),(0,b.jsx)(`p`,{className:`text-muted-foreground`,children:E(`pro.licensedTo`,{email:L?.sub})}),(0,b.jsx)(`p`,{className:`text-muted-foreground`,children:E(`pro.validUntil`,{date:L?.exp})})]}),C.state===`expired`&&(0,b.jsx)(`p`,{className:`rounded-md border border-amber-500/40 bg-amber-500/5 p-3 text-xs text-amber-600 dark:text-amber-400`,children:E(`pro.expiredOn`,{date:L?.exp})}),R&&(0,b.jsx)(v,{highlight:i?.feature,innerRef:N}),!j&&(0,b.jsx)(`button`,{type:`button`,onClick:()=>M(!0),className:`w-fit rounded-sm text-xs text-muted-foreground underline underline-offset-2 hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,children:E(`pro.haveKey`)}),(0,b.jsxs)(`div`,{className:j?`grid gap-1.5`:`hidden`,children:[(0,b.jsx)(u,{htmlFor:`license-key`,children:E(`pro.keyLabel`)}),(0,b.jsx)(`textarea`,{id:`license-key`,value:D,onChange:e=>{O(e.target.value),F(null)},spellCheck:!1,rows:3,className:`w-full resize-none rounded-md border bg-transparent p-2 font-mono text-xs outline-none focus-visible:ring-1 focus-visible:ring-ring`}),P&&(0,b.jsx)(`p`,{className:`text-xs text-destructive`,children:P})]})]}),(0,b.jsxs)(p,{children:[S&&(0,b.jsx)(o,{variant:`ghost`,onClick:()=>{T(),O(``)},children:E(`pro.remove`)}),j&&(0,b.jsx)(o,{disabled:k||!D.trim()||D.trim()===S,onClick:()=>{I()},children:E(`pro.activate`)}),(0,b.jsx)(o,{variant:`secondary`,onClick:t,children:E(`settings.done`)})]})]})})}export{S as LicenseDialog};
1
+ import{r as e}from"./hePW80VL.js";import{h as t,n,t as r}from"./XzPc-eVf.js";import{l as i,m as a,t as o}from"./CKOS5Y-e.js";import{I as s,L as c,R as l,c as u,t as d}from"./B1lNzsWx.js";import{a as f,i as p,n as m,o as h,r as g,t as _}from"./DxuXBECK.js";import{t as v}from"./B1mA7CRG.js";var y=e(t(),1),b=i();function x(e){return e.state===`invalid`?e.reason===`no-public-key`?`pro.notConfigured`:e.reason===`no-webcrypto`?`pro.noWebcrypto`:`pro.invalidKey`:null}function S(){let e=n(e=>e.activeDialog),t=n(e=>e.closeDialog),i=r(`license`),{key:S,status:C,activate:w,clear:T}=s(),{t:E}=a(),[D,O]=(0,y.useState)(S),[k,A]=(0,y.useState)(!1),[j,M]=(0,y.useState)(!i?.feature||!!S),N=(0,y.useRef)(null),[P,F]=(0,y.useState)(c()?null:E(`pro.notConfigured`)),I=async()=>{A(!0);let e=x(await w(D.trim()));F(e?E(e):null),A(!1)},L=C.state===`valid`||C.state===`expired`?C.claim:null,R=i?.feature?E(`pro.blocked`,{feature:E(`pro.features.${i.feature}`)}):null;return(0,b.jsx)(_,{open:e===`license`,onOpenChange:e=>{e||t()},children:(0,b.jsxs)(m,{className:`max-h-[85vh] overflow-y-auto sm:max-w-[560px]`,onOpenAutoFocus:e=>{N.current&&(e.preventDefault(),N.current.focus())},children:[(0,b.jsx)(f,{children:(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,b.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,b.jsx)(d,{size:44}),(0,b.jsx)(l,{className:`absolute -right-2 -bottom-1 ml-0`})]}),(0,b.jsxs)(`div`,{className:`grid gap-1`,children:[(0,b.jsx)(h,{children:E(`pro.licenseTitle`)}),(0,b.jsx)(g,{children:R??E(`pro.licenseDescription`)})]})]})}),(0,b.jsxs)(`div`,{className:`grid gap-3 text-sm`,children:[C.state===`valid`&&(0,b.jsxs)(`div`,{className:`rounded-md border border-emerald-500/40 bg-emerald-500/5 p-3 text-xs`,children:[(0,b.jsx)(`p`,{className:`font-medium text-emerald-600 dark:text-emerald-400`,children:E(`pro.active`)}),(0,b.jsx)(`p`,{className:`text-muted-foreground`,children:E(`pro.licensedTo`,{email:L?.sub})}),(0,b.jsx)(`p`,{className:`text-muted-foreground`,children:E(`pro.validUntil`,{date:L?.exp})})]}),C.state===`expired`&&(0,b.jsx)(`p`,{className:`rounded-md border border-amber-500/40 bg-amber-500/5 p-3 text-xs text-amber-600 dark:text-amber-400`,children:E(`pro.expiredOn`,{date:L?.exp})}),R&&(0,b.jsx)(v,{highlight:i?.feature,innerRef:N}),!j&&(0,b.jsx)(`button`,{type:`button`,onClick:()=>M(!0),className:`w-fit rounded-sm text-xs text-muted-foreground underline underline-offset-2 hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,children:E(`pro.haveKey`)}),(0,b.jsxs)(`div`,{className:j?`grid gap-1.5`:`hidden`,children:[(0,b.jsx)(u,{htmlFor:`license-key`,children:E(`pro.keyLabel`)}),(0,b.jsx)(`textarea`,{id:`license-key`,value:D,onChange:e=>{O(e.target.value),F(null)},spellCheck:!1,rows:3,className:`w-full resize-none rounded-md border bg-transparent p-2 font-mono text-xs outline-none focus-visible:ring-1 focus-visible:ring-ring`}),P&&(0,b.jsx)(`p`,{className:`text-xs text-destructive`,children:P})]})]}),(0,b.jsxs)(p,{children:[S&&(0,b.jsx)(o,{variant:`ghost`,onClick:()=>{T(),O(``)},children:E(`pro.remove`)}),j&&(0,b.jsx)(o,{disabled:k||!D.trim()||D.trim()===S,onClick:()=>{I()},children:E(`pro.activate`)}),(0,b.jsx)(o,{variant:`secondary`,onClick:t,children:E(`settings.done`)})]})]})})}export{S as LicenseDialog};
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{h as t}from"./XzPc-eVf.js";import{b as n,l as r,o as i,p as a,s as o,u as s}from"./CKOS5Y-e.js";import{S as c,_ as l,b as u,d,f,g as p,h as m,m as h,p as g,u as _,v,x as y,y as b}from"./CZQ1r4zz.js";import{t as x}from"./CmJ3siBN.js";import{Gt as S,Ht as C,It as w,Jt as T,Kt as E,Lt as D,Ut as O,Wt as k,Yt as A,qt as j}from"./D7Ze5md9.js";var M=e(n(),1),N=e(t(),1),P=Object.defineProperty,ee=(e,t)=>P(e,`name`,{value:t,configurable:!0});function F(e){let t=N.useRef({value:e,previous:e});return N.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}ee(F,`usePrevious`);var I=r(),L=Object.defineProperty,R=(e,t)=>L(e,`name`,{value:t,configurable:!0}),z=[` `,`Enter`,`ArrowUp`,`ArrowDown`],B=[` `,`Enter`],V=`Select`,[H,U,W]=T(V),[G,te]=c(V,[W,E]),K=E(),[ne,q]=G(V),[re,ie]=G(V);function J(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:u,name:d,autoComplete:f,disabled:p,required:m,form:h,internal_do_not_use_render:g}=e,_=K(t),[v,y]=N.useState(null),[x,C]=N.useState(null),[w,T]=N.useState(!1),E=j(u),[D,O]=b({prop:r,defaultProp:i??!1,onChange:a,caller:V}),[k,A]=b({prop:o,defaultProp:s,onChange:c,caller:V}),M=N.useRef(null),P=N.useRef(k);N.useEffect(()=>{let e=h?v?.ownerDocument.getElementById(h):v?.form;if(e instanceof HTMLFormElement){let t=R(()=>A(P.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[h,v,A]);let ee=!v||!!h||!!v.closest(`form`),[F,L]=N.useState(new Set),z=l(),B=Array.from(F).map(e=>e.props.value).join(`;`),U=N.useCallback(e=>{L(t=>new Set(t).add(e))},[]),W=N.useCallback(e=>{L(t=>{let n=new Set(t);return n.delete(e),n})},[]),G={required:m,trigger:v,onTriggerChange:y,valueNode:x,onValueNodeChange:C,valueNodeHasChildren:w,onValueNodeHasChildrenChange:T,contentId:z,value:k,onValueChange:A,open:D,onOpenChange:O,dir:E,triggerPointerDownPosRef:M,disabled:p,name:d,autoComplete:f,form:h,nativeOptions:F,nativeSelectKey:B,isFormControl:ee};return(0,I.jsx)(S,{..._,children:(0,I.jsx)(ne,{scope:t,...G,children:(0,I.jsx)(H.Provider,{scope:t,children:(0,I.jsx)(re,{scope:t,onNativeOptionAdd:U,onNativeOptionRemove:W,children:Ve(g)?g(G):n})})})})}R(J,`SelectProvider`);var ae=R(e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,I.jsx)(J,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,I.jsxs)(I.Fragment,{children:[n,e?(0,I.jsx)(Be,{__scopeSelect:t}):null]})})},`Select`),oe=`SelectTrigger`,se=N.forwardRef(R(function(e,t){let{__scopeSelect:n,disabled:r=!1,...i}=e,s=K(n),c=q(oe,n),l=c.disabled||r,u=a(t,c.onTriggerChange),d=U(n),f=N.useRef(`touch`),[p,m,h]=He(e=>{let t=d().filter(e=>!e.disabled),n=Ue(t,e,t.find(e=>e.value===c.value));n!==void 0&&c.onValueChange(n.value)}),g=R(e=>{l||(c.onOpenChange(!0),h()),e&&(c.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})},`handleOpen`);return(0,I.jsx)(O,{asChild:!0,...s,children:(0,I.jsx)(o.button,{type:`button`,role:`combobox`,"aria-controls":c.open?c.contentId:void 0,"aria-expanded":c.open,"aria-required":c.required,"aria-autocomplete":`none`,dir:c.dir,"data-state":c.open?`open`:`closed`,disabled:l,"data-disabled":l?``:void 0,"data-placeholder":$(c.value)?``:void 0,...i,ref:u,onClick:y(i.onClick,e=>{e.currentTarget.focus(),f.current!==`mouse`&&g(e)}),onPointerDown:y(i.onPointerDown,e=>{f.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(g(e),e.preventDefault())}),onKeyDown:y(i.onKeyDown,e=>{let t=p.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&m(e.key),!(t&&e.key===` `)&&z.includes(e.key)&&(g(),e.preventDefault())})})})},`SelectTrigger`)),ce=`SelectValue`,le=N.forwardRef(R(function(e,t){let{__scopeSelect:n,className:r,style:i,children:s,placeholder:c=``,...l}=e,d=q(ce,n),{onValueNodeHasChildrenChange:f}=d,p=s!==void 0,m=a(t,d.onValueNodeChange);u(()=>{f(p)},[f,p]);let h=$(d.value);return(0,I.jsx)(o.span,{...l,asChild:!h&&l.asChild,ref:m,style:{pointerEvents:`none`},children:(0,I.jsx)(N.Fragment,{children:h?c:s},h?`placeholder`:`value`)})},`SelectValue`)),ue=N.forwardRef(R(function(e,t){let{__scopeSelect:n,children:r,...i}=e;return(0,I.jsx)(o.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})},`SelectIcon`)),[de,fe]=G(`SelectPortal`,{forceMount:void 0}),pe=R(e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,I.jsx)(de,{scope:e.__scopeSelect,forceMount:n,children:(0,I.jsx)(g,{asChild:!0,...r})})},`SelectPortal`),Y=`SelectContent`,me=N.forwardRef(R(function(e,t){let n=fe(Y,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=q(Y,e.__scopeSelect),[o,s]=N.useState();return u(()=>{s(new DocumentFragment)},[]),(0,I.jsx)(v,{present:r||a.open,children:({present:e})=>e?(0,I.jsx)(ve,{...i,ref:t}):(0,I.jsx)(he,{...i,fragment:o})})},`SelectContent`)),he=N.forwardRef(R(function(e,t){let{__scopeSelect:n,children:r,fragment:i}=e;return i?M.createPortal((0,I.jsx)(ge,{scope:n,children:(0,I.jsx)(H.Slot,{scope:n,children:(0,I.jsx)(`div`,{ref:t,children:r})})}),i):null},`SelectContentFragment`)),X=10,[ge,Z]=G(Y),_e=s(`SelectContent.RemoveScroll`),ve=N.forwardRef(R(function(e,t){let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:o,onPointerDownOutside:s,side:c,sideOffset:l,align:u,alignOffset:p,arrowPadding:g,collisionBoundary:v,collisionPadding:b,sticky:x,hideWhenDetached:S,avoidCollisions:C,...w}=e,T=q(Y,n),[E,D]=N.useState(null),[O,k]=N.useState(null),A=a(t,D),[j,M]=N.useState(null),[P,ee]=N.useState(null),F=U(n),[L,z]=N.useState(!1),B=N.useRef(!1);N.useEffect(()=>{if(E)return _(E)},[E]),f();let V=N.useCallback(e=>{let[t,...n]=F().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&O&&(O.scrollTop=0),n===r&&O&&(O.scrollTop=O.scrollHeight),n?.focus(),document.activeElement!==i))return},[F,O]),H=N.useCallback(()=>V([j,E]),[V,j,E]);N.useEffect(()=>{L&&H()},[L,H]);let{onOpenChange:W,triggerPointerDownPosRef:G}=T;N.useEffect(()=>{if(E){let e={x:0,y:0},t=R(t=>{e={x:Math.abs(Math.round(t.pageX)-(G.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(G.current?.y??0))}},`handlePointerMove`),n=R(n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(E)||W(!1),document.removeEventListener(`pointermove`,t),G.current=null},`handlePointerUp`);return G.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[E,W,G]),N.useEffect(()=>{let e=R(()=>W(!1),`close`);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[W]);let[te,K]=He(e=>{let t=F().filter(e=>!e.disabled),n=Ue(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),ne=N.useCallback((e,t,n)=>{let r=!B.current&&!n;(T.value!==void 0&&T.value===t||r)&&(M(e),r&&(B.current=!0))},[T.value]),re=N.useCallback(()=>E?.focus(),[E]),ie=N.useCallback((e,t,n)=>{let r=!B.current&&!n;(T.value!==void 0&&T.value===t||r)&&ee(e)},[T.value]),J=r===`popper`?be:ye,ae=J===be?{side:c,sideOffset:l,align:u,alignOffset:p,arrowPadding:g,collisionBoundary:v,collisionPadding:b,sticky:x,hideWhenDetached:S,avoidCollisions:C}:{};return(0,I.jsx)(ge,{scope:n,content:E,viewport:O,onViewportChange:k,itemRefCallback:ne,selectedItem:j,onItemLeave:re,itemTextRefCallback:ie,focusSelectedItem:H,selectedItemText:P,position:r,isPositioned:L,searchRef:te,children:(0,I.jsx)(d,{as:_e,allowPinchZoom:!0,children:(0,I.jsx)(h,{asChild:!0,trapped:T.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:y(i,e=>{T.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,I.jsx)(m,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:(0,I.jsx)(J,{role:`listbox`,id:T.contentId,"data-state":T.open?`open`:`closed`,dir:T.dir,onContextMenu:e=>e.preventDefault(),...w,...ae,onPlaced:()=>z(!0),ref:A,style:{display:`flex`,flexDirection:`column`,outline:`none`,...w.style},onKeyDown:y(w.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&K(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=F().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>V(t)),e.preventDefault()}})})})})})})},`SelectContentImpl`)),ye=N.forwardRef(R(function(e,t){let{__scopeSelect:n,onPlaced:r,...i}=e,s=q(Y,n),c=Z(Y,n),[l,d]=N.useState(null),[f,p]=N.useState(null),m=a(t,p),h=U(n),g=N.useRef(!1),_=N.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:b,focusSelectedItem:x}=c,S=N.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&f&&v&&y&&b){let e=s.trigger.getBoundingClientRect(),t=f.getBoundingClientRect(),n=s.valueNode.getBoundingClientRect(),i=b.getBoundingClientRect();if(s.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,s=e.width+o,c=Math.max(s,t.width),u=window.innerWidth-X,d=C(a,[X,Math.max(X,u-c)]);l.style.minWidth=s+`px`,l.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,s=e.width+o,c=Math.max(s,t.width),u=window.innerWidth-X,d=C(a,[X,Math.max(X,u-c)]);l.style.minWidth=s+`px`,l.style.right=d+`px`}let a=h(),o=window.innerHeight-X*2,c=v.scrollHeight,u=window.getComputedStyle(f),d=parseInt(u.borderTopWidth,10),p=parseInt(u.paddingTop,10),m=parseInt(u.borderBottomWidth,10),_=parseInt(u.paddingBottom,10),x=d+p+c+_+m,S=Math.min(y.offsetHeight*5,x),w=window.getComputedStyle(v),T=parseInt(w.paddingTop,10),E=parseInt(w.paddingBottom,10),D=e.top+e.height/2-X,O=o-D,k=y.offsetHeight/2,A=y.offsetTop+k,j=d+p+A,M=x-j;if(j<=D){let e=a.length>0&&y===a[a.length-1].ref.current;l.style.bottom=`0px`;let t=f.clientHeight-v.offsetTop-v.offsetHeight,n=j+Math.max(O,k+(e?E:0)+t+m);l.style.height=n+`px`}else{let e=a.length>0&&y===a[0].ref.current;l.style.top=`0px`;let t=Math.max(D,d+v.offsetTop+(e?T:0)+k)+M;l.style.height=t+`px`,v.scrollTop=j-D+v.offsetTop}l.style.margin=`${X}px 0`,l.style.minHeight=S+`px`,l.style.maxHeight=o+`px`,r?.(),requestAnimationFrame(()=>g.current=!0)}},[h,s.trigger,s.valueNode,l,f,v,y,b,s.dir,r]);u(()=>S(),[S]);let[w,T]=N.useState();u(()=>{f&&T(window.getComputedStyle(f).zIndex)},[f]);let E=N.useCallback(e=>{e&&_.current===!0&&(S(),x?.(),_.current=!1)},[S,x]);return(0,I.jsx)(xe,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:g,onScrollButtonChange:E,children:(0,I.jsx)(`div`,{ref:d,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:w},children:(0,I.jsx)(o.div,{...i,ref:m,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})},`SelectItemAlignedPosition`)),be=N.forwardRef(R(function(e,t){let{__scopeSelect:n,align:r=`start`,collisionPadding:i=X,...a}=e,o=K(n);return(0,I.jsx)(k,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})},`SelectPopperPosition`)),[xe,Se]=G(Y,{}),Ce=`SelectViewport`,we=N.forwardRef(R(function(e,t){let{__scopeSelect:n,nonce:r,...i}=e,s=Z(Ce,n),c=Se(Ce,n),l=a(t,s.onViewportChange),u=N.useRef(0);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,I.jsx)(H.Slot,{scope:n,children:(0,I.jsx)(o.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:l,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:y(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=c;if(r?.current&&n){let e=Math.abs(u.current-t.scrollTop);if(e>0){let r=window.innerHeight-X*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}u.current=t.scrollTop})})})]})},`SelectViewport`)),[Te,Ee]=G(`SelectGroup`),De=`SelectItem`,[Oe,ke]=G(De),Ae=N.forwardRef(R(function(e,t){let{__scopeSelect:n,value:r,disabled:i=!1,textValue:s,...c}=e,u=q(De,n),d=Z(De,n),f=u.value===r,[m,h]=N.useState(s??``),[g,_]=N.useState(!1),v=p(e=>d.itemRefCallback?.(e,r,i)),b=a(t,v),x=l(),S=N.useRef(`touch`),C=R(()=>{i||(u.onValueChange(r),u.onOpenChange(!1))},`handleSelect`);return(0,I.jsx)(Oe,{scope:n,value:r,disabled:i,textId:x,isSelected:f,onItemTextChange:N.useCallback(e=>{h(t=>t||(e?.textContent??``).trim())},[]),children:(0,I.jsx)(H.ItemSlot,{scope:n,value:r,disabled:i,textValue:m,children:(0,I.jsx)(o.div,{role:`option`,"aria-labelledby":x,"data-highlighted":g?``:void 0,"aria-selected":f&&g,"data-state":f?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...c,ref:b,onFocus:y(c.onFocus,()=>_(!0)),onBlur:y(c.onBlur,()=>_(!1)),onClick:y(c.onClick,()=>{S.current!==`mouse`&&C()}),onPointerUp:y(c.onPointerUp,()=>{S.current===`mouse`&&C()}),onPointerDown:y(c.onPointerDown,e=>{S.current=e.pointerType}),onPointerMove:y(c.onPointerMove,e=>{S.current=e.pointerType,i?d.onItemLeave?.():S.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:y(c.onPointerLeave,e=>{e.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:y(c.onKeyDown,e=>{i||e.target!==e.currentTarget||(d.searchRef?.current===``||e.key!==` `)&&(B.includes(e.key)&&C(),e.key===` `&&e.preventDefault())})})})})},`SelectItem`)),Q=`SelectItemText`,je=N.forwardRef(R(function(e,t){let{__scopeSelect:n,className:r,style:i,...s}=e,c=q(Q,n),l=Z(Q,n),d=ke(Q,n),f=ie(Q,n),[m,h]=N.useState(null),g=p(e=>l.itemTextRefCallback?.(e,d.value,d.disabled)),_=a(t,h,d.onItemTextChange,g),v=m?.textContent,y=N.useMemo(()=>(0,I.jsx)(`option`,{value:d.value,disabled:d.disabled,children:v},d.value),[d.disabled,d.value,v]),{onNativeOptionAdd:b,onNativeOptionRemove:x}=f;return u(()=>(b(y),()=>x(y)),[b,x,y]),(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(o.span,{id:d.textId,...s,ref:_}),d.isSelected&&c.valueNode&&!c.valueNodeHasChildren&&!$(c.value)?M.createPortal(s.children,c.valueNode):null]})},`SelectItemText`)),Me=`SelectItemIndicator`,Ne=N.forwardRef(R(function(e,t){let{__scopeSelect:n,...r}=e;return ke(Me,n).isSelected?(0,I.jsx)(o.span,{"aria-hidden":!0,...r,ref:t}):null},`SelectItemIndicator`)),Pe=`SelectScrollUpButton`,Fe=N.forwardRef(R(function(e,t){let n=Z(Pe,e.__scopeSelect),r=Se(Pe,e.__scopeSelect),[i,o]=N.useState(!1),s=a(t,r.onScrollButtonChange);return u(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;o(e)};R(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,I.jsx)(Re,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null},`SelectScrollUpButton`)),Ie=`SelectScrollDownButton`,Le=N.forwardRef(R(function(e,t){let n=Z(Ie,e.__scopeSelect),r=Se(Ie,e.__scopeSelect),[i,o]=N.useState(!1),s=a(t,r.onScrollButtonChange);return u(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;o(n)};R(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,I.jsx)(Re,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null},`SelectScrollDownButton`)),Re=N.forwardRef(R(function(e,t){let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Z(`SelectScrollButton`,n),s=N.useRef(null),c=U(n),l=N.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return N.useEffect(()=>()=>l(),[l]),u(()=>{c().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[c]),(0,I.jsx)(o.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:y(i.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:y(i.onPointerMove,()=>{a.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:y(i.onPointerLeave,()=>{l()})})},`SelectScrollButtonImpl`)),ze=`SelectBubbleInput`,Be=N.forwardRef(R(function({__scopeSelect:e,...t},n){let r=q(ze,e),{value:i,onValueChange:s,required:c,disabled:l,name:u,autoComplete:d,form:f}=r,{nativeOptions:p,nativeSelectKey:m}=r,h=N.useRef(null),g=a(n,h),_=i??``,v=F(_),y=Array.from(p).some(e=>(e.props.value??``)===``);return N.useEffect(()=>{let e=h.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(v!==_&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,_),e.dispatchEvent(t)}},[v,_]),(0,I.jsxs)(o.select,{"aria-hidden":!0,required:c,tabIndex:-1,name:u,autoComplete:d,disabled:l,form:f,onChange:e=>s(e.target.value),...t,style:{...A,...t.style},ref:g,defaultValue:_,children:[$(i)&&!y?(0,I.jsx)(`option`,{value:``}):null,Array.from(p)]},m)},`SelectBubbleInput`));function Ve(e){return typeof e==`function`}R(Ve,`isFunction`);function $(e){return e===``||e===void 0}R($,`shouldShowPlaceholder`);function He(e){let t=p(e),n=N.useRef(``),r=N.useRef(0),i=N.useCallback(e=>{let i=n.current+e;t(i),R((function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))}),`updateSearch`)(i)},[t]),a=N.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return N.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}R(He,`useTypeaheadSearch`);function Ue(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=We(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}R(Ue,`findNextItem`);function We(e,t){return e.map((n,r)=>e[(t+r)%e.length])}R(We,`wrapArray`);function Ge({...e}){return(0,I.jsx)(ae,{"data-slot":`select`,...e})}function Ke({...e}){return(0,I.jsx)(le,{"data-slot":`select-value`,...e})}function qe({className:e,size:t=`default`,children:n,...r}){return(0,I.jsxs)(se,{"data-slot":`select-trigger`,"data-size":t,className:i(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,I.jsx)(ue,{asChild:!0,children:(0,I.jsx)(w,{className:`size-4 opacity-50`})})]})}function Je({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...a}){return(0,I.jsx)(pe,{children:(0,I.jsxs)(me,{"data-slot":`select-content`,className:i(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover 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`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...a,children:[(0,I.jsx)(Xe,{}),(0,I.jsx)(we,{className:i(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,I.jsx)(Ze,{})]})})}function Ye({className:e,children:t,...n}){return(0,I.jsxs)(Ae,{"data-slot":`select-item`,className:i(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,I.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,I.jsx)(Ne,{children:(0,I.jsx)(D,{className:`size-4`})})}),(0,I.jsx)(je,{children:t})]})}function Xe({className:e,...t}){return(0,I.jsx)(Fe,{"data-slot":`select-scroll-up-button`,className:i(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,I.jsx)(x,{className:`size-4`})})}function Ze({className:e,...t}){return(0,I.jsx)(Le,{"data-slot":`select-scroll-down-button`,className:i(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,I.jsx)(w,{className:`size-4`})})}export{Ke as a,qe as i,Je as n,Ye as r,Ge as t};
1
+ import{r as e}from"./hePW80VL.js";import{h as t}from"./XzPc-eVf.js";import{b as n,l as r,o as i,p as a,s as o,u as s}from"./CKOS5Y-e.js";import{S as c,_ as l,b as u,d,f,g as p,h as m,m as h,p as g,u as _,v,x as y,y as b}from"./CZQ1r4zz.js";import{t as x}from"./CmJ3siBN.js";import{Gt as S,Ht as C,It as w,Jt as T,Kt as E,Lt as D,Ut as O,Wt as k,Yt as A,qt as j}from"./B1lNzsWx.js";var M=e(n(),1),N=e(t(),1),P=Object.defineProperty,ee=(e,t)=>P(e,`name`,{value:t,configurable:!0});function F(e){let t=N.useRef({value:e,previous:e});return N.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}ee(F,`usePrevious`);var I=r(),L=Object.defineProperty,R=(e,t)=>L(e,`name`,{value:t,configurable:!0}),z=[` `,`Enter`,`ArrowUp`,`ArrowDown`],B=[` `,`Enter`],V=`Select`,[H,U,W]=T(V),[G,te]=c(V,[W,E]),K=E(),[ne,q]=G(V),[re,ie]=G(V);function J(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:u,name:d,autoComplete:f,disabled:p,required:m,form:h,internal_do_not_use_render:g}=e,_=K(t),[v,y]=N.useState(null),[x,C]=N.useState(null),[w,T]=N.useState(!1),E=j(u),[D,O]=b({prop:r,defaultProp:i??!1,onChange:a,caller:V}),[k,A]=b({prop:o,defaultProp:s,onChange:c,caller:V}),M=N.useRef(null),P=N.useRef(k);N.useEffect(()=>{let e=h?v?.ownerDocument.getElementById(h):v?.form;if(e instanceof HTMLFormElement){let t=R(()=>A(P.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[h,v,A]);let ee=!v||!!h||!!v.closest(`form`),[F,L]=N.useState(new Set),z=l(),B=Array.from(F).map(e=>e.props.value).join(`;`),U=N.useCallback(e=>{L(t=>new Set(t).add(e))},[]),W=N.useCallback(e=>{L(t=>{let n=new Set(t);return n.delete(e),n})},[]),G={required:m,trigger:v,onTriggerChange:y,valueNode:x,onValueNodeChange:C,valueNodeHasChildren:w,onValueNodeHasChildrenChange:T,contentId:z,value:k,onValueChange:A,open:D,onOpenChange:O,dir:E,triggerPointerDownPosRef:M,disabled:p,name:d,autoComplete:f,form:h,nativeOptions:F,nativeSelectKey:B,isFormControl:ee};return(0,I.jsx)(S,{..._,children:(0,I.jsx)(ne,{scope:t,...G,children:(0,I.jsx)(H.Provider,{scope:t,children:(0,I.jsx)(re,{scope:t,onNativeOptionAdd:U,onNativeOptionRemove:W,children:Ve(g)?g(G):n})})})})}R(J,`SelectProvider`);var ae=R(e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,I.jsx)(J,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,I.jsxs)(I.Fragment,{children:[n,e?(0,I.jsx)(Be,{__scopeSelect:t}):null]})})},`Select`),oe=`SelectTrigger`,se=N.forwardRef(R(function(e,t){let{__scopeSelect:n,disabled:r=!1,...i}=e,s=K(n),c=q(oe,n),l=c.disabled||r,u=a(t,c.onTriggerChange),d=U(n),f=N.useRef(`touch`),[p,m,h]=He(e=>{let t=d().filter(e=>!e.disabled),n=Ue(t,e,t.find(e=>e.value===c.value));n!==void 0&&c.onValueChange(n.value)}),g=R(e=>{l||(c.onOpenChange(!0),h()),e&&(c.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})},`handleOpen`);return(0,I.jsx)(O,{asChild:!0,...s,children:(0,I.jsx)(o.button,{type:`button`,role:`combobox`,"aria-controls":c.open?c.contentId:void 0,"aria-expanded":c.open,"aria-required":c.required,"aria-autocomplete":`none`,dir:c.dir,"data-state":c.open?`open`:`closed`,disabled:l,"data-disabled":l?``:void 0,"data-placeholder":$(c.value)?``:void 0,...i,ref:u,onClick:y(i.onClick,e=>{e.currentTarget.focus(),f.current!==`mouse`&&g(e)}),onPointerDown:y(i.onPointerDown,e=>{f.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(g(e),e.preventDefault())}),onKeyDown:y(i.onKeyDown,e=>{let t=p.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&m(e.key),!(t&&e.key===` `)&&z.includes(e.key)&&(g(),e.preventDefault())})})})},`SelectTrigger`)),ce=`SelectValue`,le=N.forwardRef(R(function(e,t){let{__scopeSelect:n,className:r,style:i,children:s,placeholder:c=``,...l}=e,d=q(ce,n),{onValueNodeHasChildrenChange:f}=d,p=s!==void 0,m=a(t,d.onValueNodeChange);u(()=>{f(p)},[f,p]);let h=$(d.value);return(0,I.jsx)(o.span,{...l,asChild:!h&&l.asChild,ref:m,style:{pointerEvents:`none`},children:(0,I.jsx)(N.Fragment,{children:h?c:s},h?`placeholder`:`value`)})},`SelectValue`)),ue=N.forwardRef(R(function(e,t){let{__scopeSelect:n,children:r,...i}=e;return(0,I.jsx)(o.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})},`SelectIcon`)),[de,fe]=G(`SelectPortal`,{forceMount:void 0}),pe=R(e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,I.jsx)(de,{scope:e.__scopeSelect,forceMount:n,children:(0,I.jsx)(g,{asChild:!0,...r})})},`SelectPortal`),Y=`SelectContent`,me=N.forwardRef(R(function(e,t){let n=fe(Y,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=q(Y,e.__scopeSelect),[o,s]=N.useState();return u(()=>{s(new DocumentFragment)},[]),(0,I.jsx)(v,{present:r||a.open,children:({present:e})=>e?(0,I.jsx)(ve,{...i,ref:t}):(0,I.jsx)(he,{...i,fragment:o})})},`SelectContent`)),he=N.forwardRef(R(function(e,t){let{__scopeSelect:n,children:r,fragment:i}=e;return i?M.createPortal((0,I.jsx)(ge,{scope:n,children:(0,I.jsx)(H.Slot,{scope:n,children:(0,I.jsx)(`div`,{ref:t,children:r})})}),i):null},`SelectContentFragment`)),X=10,[ge,Z]=G(Y),_e=s(`SelectContent.RemoveScroll`),ve=N.forwardRef(R(function(e,t){let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:o,onPointerDownOutside:s,side:c,sideOffset:l,align:u,alignOffset:p,arrowPadding:g,collisionBoundary:v,collisionPadding:b,sticky:x,hideWhenDetached:S,avoidCollisions:C,...w}=e,T=q(Y,n),[E,D]=N.useState(null),[O,k]=N.useState(null),A=a(t,D),[j,M]=N.useState(null),[P,ee]=N.useState(null),F=U(n),[L,z]=N.useState(!1),B=N.useRef(!1);N.useEffect(()=>{if(E)return _(E)},[E]),f();let V=N.useCallback(e=>{let[t,...n]=F().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&O&&(O.scrollTop=0),n===r&&O&&(O.scrollTop=O.scrollHeight),n?.focus(),document.activeElement!==i))return},[F,O]),H=N.useCallback(()=>V([j,E]),[V,j,E]);N.useEffect(()=>{L&&H()},[L,H]);let{onOpenChange:W,triggerPointerDownPosRef:G}=T;N.useEffect(()=>{if(E){let e={x:0,y:0},t=R(t=>{e={x:Math.abs(Math.round(t.pageX)-(G.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(G.current?.y??0))}},`handlePointerMove`),n=R(n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(E)||W(!1),document.removeEventListener(`pointermove`,t),G.current=null},`handlePointerUp`);return G.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[E,W,G]),N.useEffect(()=>{let e=R(()=>W(!1),`close`);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[W]);let[te,K]=He(e=>{let t=F().filter(e=>!e.disabled),n=Ue(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),ne=N.useCallback((e,t,n)=>{let r=!B.current&&!n;(T.value!==void 0&&T.value===t||r)&&(M(e),r&&(B.current=!0))},[T.value]),re=N.useCallback(()=>E?.focus(),[E]),ie=N.useCallback((e,t,n)=>{let r=!B.current&&!n;(T.value!==void 0&&T.value===t||r)&&ee(e)},[T.value]),J=r===`popper`?be:ye,ae=J===be?{side:c,sideOffset:l,align:u,alignOffset:p,arrowPadding:g,collisionBoundary:v,collisionPadding:b,sticky:x,hideWhenDetached:S,avoidCollisions:C}:{};return(0,I.jsx)(ge,{scope:n,content:E,viewport:O,onViewportChange:k,itemRefCallback:ne,selectedItem:j,onItemLeave:re,itemTextRefCallback:ie,focusSelectedItem:H,selectedItemText:P,position:r,isPositioned:L,searchRef:te,children:(0,I.jsx)(d,{as:_e,allowPinchZoom:!0,children:(0,I.jsx)(h,{asChild:!0,trapped:T.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:y(i,e=>{T.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,I.jsx)(m,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:(0,I.jsx)(J,{role:`listbox`,id:T.contentId,"data-state":T.open?`open`:`closed`,dir:T.dir,onContextMenu:e=>e.preventDefault(),...w,...ae,onPlaced:()=>z(!0),ref:A,style:{display:`flex`,flexDirection:`column`,outline:`none`,...w.style},onKeyDown:y(w.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&K(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=F().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>V(t)),e.preventDefault()}})})})})})})},`SelectContentImpl`)),ye=N.forwardRef(R(function(e,t){let{__scopeSelect:n,onPlaced:r,...i}=e,s=q(Y,n),c=Z(Y,n),[l,d]=N.useState(null),[f,p]=N.useState(null),m=a(t,p),h=U(n),g=N.useRef(!1),_=N.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:b,focusSelectedItem:x}=c,S=N.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&f&&v&&y&&b){let e=s.trigger.getBoundingClientRect(),t=f.getBoundingClientRect(),n=s.valueNode.getBoundingClientRect(),i=b.getBoundingClientRect();if(s.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,s=e.width+o,c=Math.max(s,t.width),u=window.innerWidth-X,d=C(a,[X,Math.max(X,u-c)]);l.style.minWidth=s+`px`,l.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,s=e.width+o,c=Math.max(s,t.width),u=window.innerWidth-X,d=C(a,[X,Math.max(X,u-c)]);l.style.minWidth=s+`px`,l.style.right=d+`px`}let a=h(),o=window.innerHeight-X*2,c=v.scrollHeight,u=window.getComputedStyle(f),d=parseInt(u.borderTopWidth,10),p=parseInt(u.paddingTop,10),m=parseInt(u.borderBottomWidth,10),_=parseInt(u.paddingBottom,10),x=d+p+c+_+m,S=Math.min(y.offsetHeight*5,x),w=window.getComputedStyle(v),T=parseInt(w.paddingTop,10),E=parseInt(w.paddingBottom,10),D=e.top+e.height/2-X,O=o-D,k=y.offsetHeight/2,A=y.offsetTop+k,j=d+p+A,M=x-j;if(j<=D){let e=a.length>0&&y===a[a.length-1].ref.current;l.style.bottom=`0px`;let t=f.clientHeight-v.offsetTop-v.offsetHeight,n=j+Math.max(O,k+(e?E:0)+t+m);l.style.height=n+`px`}else{let e=a.length>0&&y===a[0].ref.current;l.style.top=`0px`;let t=Math.max(D,d+v.offsetTop+(e?T:0)+k)+M;l.style.height=t+`px`,v.scrollTop=j-D+v.offsetTop}l.style.margin=`${X}px 0`,l.style.minHeight=S+`px`,l.style.maxHeight=o+`px`,r?.(),requestAnimationFrame(()=>g.current=!0)}},[h,s.trigger,s.valueNode,l,f,v,y,b,s.dir,r]);u(()=>S(),[S]);let[w,T]=N.useState();u(()=>{f&&T(window.getComputedStyle(f).zIndex)},[f]);let E=N.useCallback(e=>{e&&_.current===!0&&(S(),x?.(),_.current=!1)},[S,x]);return(0,I.jsx)(xe,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:g,onScrollButtonChange:E,children:(0,I.jsx)(`div`,{ref:d,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:w},children:(0,I.jsx)(o.div,{...i,ref:m,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})},`SelectItemAlignedPosition`)),be=N.forwardRef(R(function(e,t){let{__scopeSelect:n,align:r=`start`,collisionPadding:i=X,...a}=e,o=K(n);return(0,I.jsx)(k,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})},`SelectPopperPosition`)),[xe,Se]=G(Y,{}),Ce=`SelectViewport`,we=N.forwardRef(R(function(e,t){let{__scopeSelect:n,nonce:r,...i}=e,s=Z(Ce,n),c=Se(Ce,n),l=a(t,s.onViewportChange),u=N.useRef(0);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,I.jsx)(H.Slot,{scope:n,children:(0,I.jsx)(o.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:l,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:y(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=c;if(r?.current&&n){let e=Math.abs(u.current-t.scrollTop);if(e>0){let r=window.innerHeight-X*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}u.current=t.scrollTop})})})]})},`SelectViewport`)),[Te,Ee]=G(`SelectGroup`),De=`SelectItem`,[Oe,ke]=G(De),Ae=N.forwardRef(R(function(e,t){let{__scopeSelect:n,value:r,disabled:i=!1,textValue:s,...c}=e,u=q(De,n),d=Z(De,n),f=u.value===r,[m,h]=N.useState(s??``),[g,_]=N.useState(!1),v=p(e=>d.itemRefCallback?.(e,r,i)),b=a(t,v),x=l(),S=N.useRef(`touch`),C=R(()=>{i||(u.onValueChange(r),u.onOpenChange(!1))},`handleSelect`);return(0,I.jsx)(Oe,{scope:n,value:r,disabled:i,textId:x,isSelected:f,onItemTextChange:N.useCallback(e=>{h(t=>t||(e?.textContent??``).trim())},[]),children:(0,I.jsx)(H.ItemSlot,{scope:n,value:r,disabled:i,textValue:m,children:(0,I.jsx)(o.div,{role:`option`,"aria-labelledby":x,"data-highlighted":g?``:void 0,"aria-selected":f&&g,"data-state":f?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...c,ref:b,onFocus:y(c.onFocus,()=>_(!0)),onBlur:y(c.onBlur,()=>_(!1)),onClick:y(c.onClick,()=>{S.current!==`mouse`&&C()}),onPointerUp:y(c.onPointerUp,()=>{S.current===`mouse`&&C()}),onPointerDown:y(c.onPointerDown,e=>{S.current=e.pointerType}),onPointerMove:y(c.onPointerMove,e=>{S.current=e.pointerType,i?d.onItemLeave?.():S.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:y(c.onPointerLeave,e=>{e.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:y(c.onKeyDown,e=>{i||e.target!==e.currentTarget||(d.searchRef?.current===``||e.key!==` `)&&(B.includes(e.key)&&C(),e.key===` `&&e.preventDefault())})})})})},`SelectItem`)),Q=`SelectItemText`,je=N.forwardRef(R(function(e,t){let{__scopeSelect:n,className:r,style:i,...s}=e,c=q(Q,n),l=Z(Q,n),d=ke(Q,n),f=ie(Q,n),[m,h]=N.useState(null),g=p(e=>l.itemTextRefCallback?.(e,d.value,d.disabled)),_=a(t,h,d.onItemTextChange,g),v=m?.textContent,y=N.useMemo(()=>(0,I.jsx)(`option`,{value:d.value,disabled:d.disabled,children:v},d.value),[d.disabled,d.value,v]),{onNativeOptionAdd:b,onNativeOptionRemove:x}=f;return u(()=>(b(y),()=>x(y)),[b,x,y]),(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(o.span,{id:d.textId,...s,ref:_}),d.isSelected&&c.valueNode&&!c.valueNodeHasChildren&&!$(c.value)?M.createPortal(s.children,c.valueNode):null]})},`SelectItemText`)),Me=`SelectItemIndicator`,Ne=N.forwardRef(R(function(e,t){let{__scopeSelect:n,...r}=e;return ke(Me,n).isSelected?(0,I.jsx)(o.span,{"aria-hidden":!0,...r,ref:t}):null},`SelectItemIndicator`)),Pe=`SelectScrollUpButton`,Fe=N.forwardRef(R(function(e,t){let n=Z(Pe,e.__scopeSelect),r=Se(Pe,e.__scopeSelect),[i,o]=N.useState(!1),s=a(t,r.onScrollButtonChange);return u(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;o(e)};R(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,I.jsx)(Re,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null},`SelectScrollUpButton`)),Ie=`SelectScrollDownButton`,Le=N.forwardRef(R(function(e,t){let n=Z(Ie,e.__scopeSelect),r=Se(Ie,e.__scopeSelect),[i,o]=N.useState(!1),s=a(t,r.onScrollButtonChange);return u(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;o(n)};R(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,I.jsx)(Re,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null},`SelectScrollDownButton`)),Re=N.forwardRef(R(function(e,t){let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Z(`SelectScrollButton`,n),s=N.useRef(null),c=U(n),l=N.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return N.useEffect(()=>()=>l(),[l]),u(()=>{c().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[c]),(0,I.jsx)(o.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:y(i.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:y(i.onPointerMove,()=>{a.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:y(i.onPointerLeave,()=>{l()})})},`SelectScrollButtonImpl`)),ze=`SelectBubbleInput`,Be=N.forwardRef(R(function({__scopeSelect:e,...t},n){let r=q(ze,e),{value:i,onValueChange:s,required:c,disabled:l,name:u,autoComplete:d,form:f}=r,{nativeOptions:p,nativeSelectKey:m}=r,h=N.useRef(null),g=a(n,h),_=i??``,v=F(_),y=Array.from(p).some(e=>(e.props.value??``)===``);return N.useEffect(()=>{let e=h.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(v!==_&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,_),e.dispatchEvent(t)}},[v,_]),(0,I.jsxs)(o.select,{"aria-hidden":!0,required:c,tabIndex:-1,name:u,autoComplete:d,disabled:l,form:f,onChange:e=>s(e.target.value),...t,style:{...A,...t.style},ref:g,defaultValue:_,children:[$(i)&&!y?(0,I.jsx)(`option`,{value:``}):null,Array.from(p)]},m)},`SelectBubbleInput`));function Ve(e){return typeof e==`function`}R(Ve,`isFunction`);function $(e){return e===``||e===void 0}R($,`shouldShowPlaceholder`);function He(e){let t=p(e),n=N.useRef(``),r=N.useRef(0),i=N.useCallback(e=>{let i=n.current+e;t(i),R((function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))}),`updateSearch`)(i)},[t]),a=N.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return N.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}R(He,`useTypeaheadSearch`);function Ue(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=We(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}R(Ue,`findNextItem`);function We(e,t){return e.map((n,r)=>e[(t+r)%e.length])}R(We,`wrapArray`);function Ge({...e}){return(0,I.jsx)(ae,{"data-slot":`select`,...e})}function Ke({...e}){return(0,I.jsx)(le,{"data-slot":`select-value`,...e})}function qe({className:e,size:t=`default`,children:n,...r}){return(0,I.jsxs)(se,{"data-slot":`select-trigger`,"data-size":t,className:i(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,I.jsx)(ue,{asChild:!0,children:(0,I.jsx)(w,{className:`size-4 opacity-50`})})]})}function Je({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...a}){return(0,I.jsx)(pe,{children:(0,I.jsxs)(me,{"data-slot":`select-content`,className:i(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover 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`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...a,children:[(0,I.jsx)(Xe,{}),(0,I.jsx)(we,{className:i(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,I.jsx)(Ze,{})]})})}function Ye({className:e,children:t,...n}){return(0,I.jsxs)(Ae,{"data-slot":`select-item`,className:i(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,I.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,I.jsx)(Ne,{children:(0,I.jsx)(D,{className:`size-4`})})}),(0,I.jsx)(je,{children:t})]})}function Xe({className:e,...t}){return(0,I.jsx)(Fe,{"data-slot":`select-scroll-up-button`,className:i(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,I.jsx)(x,{className:`size-4`})})}function Ze({className:e,...t}){return(0,I.jsx)(Le,{"data-slot":`select-scroll-down-button`,className:i(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,I.jsx)(w,{className:`size-4`})})}export{Ke as a,qe as i,Je as n,Ye as r,Ge as t};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./hePW80VL.js";import{h as t,n}from"./XzPc-eVf.js";import{l as r,m as i,t as a}from"./CKOS5Y-e.js";import{a as o,i as s,n as c,r as l,t as u}from"./D_2UqK4k.js";import{t as d}from"./DTxGpkJp.js";import{n as f}from"./CChaTOPr.js";import{S as p,a as m}from"./Cw_LYT6k.js";import{n as h}from"./DbRMSZEW.js";import{o as g,r as _}from"./BM5G_YA7.js";import{c as v,ct as y}from"./D7Ze5md9.js";import{a as b,i as x,n as S,o as C,t as w}from"./DxuXBECK.js";import{t as T}from"./CnYBZPf9.js";var E=e(t(),1),D=r();function O(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}function k(){let{t:e}=i(),{activeDialog:t,closeDialog:r}=n(),{activeConnectionId:k,activeConnections:A}=d(),{trees:j}=p(),M=f(),N=t===`export-html`,P=(0,E.useMemo)(()=>k?_(j[k]??[]):[],[k,j]),F=(0,E.useMemo)(()=>{if(!k)return``;let e=M.activeTabId[k];return(M.tabs[k]??[]).find(t=>t.id===e)?.database||``},[k,M.activeTabId,M.tabs]),[I,L]=(0,E.useState)(``),R=(0,E.useMemo)(()=>!k||!I?[]:g(j[k]??[],I),[k,I,j]),[z,B]=(0,E.useState)([]),[V,H]=(0,E.useState)(!0),[U,W]=(0,E.useState)(!0),[G,K]=(0,E.useState)(!0),[q,J]=(0,E.useState)(!1);(0,E.useEffect)(()=>{N&&F&&L(F)},[N,F]);function Y(e){e||(r(),L(``),B([]),H(!0),W(!0),K(!0))}function X(e){B(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}function Z(){B(R.length===z.length?[]:[...R])}async function Q(){if(z.length===0||!k)return;let t=A.find(e=>e.id===k);if(!t?.serverConnectionId)return;J(!0);let{introspect:n}=h(k),i=m(t.serverConnectionId),a=(e,t,n)=>{let r=`<h3>${O(e)}</h3>\n<table border="1" cellpadding="4" cellspacing="0">\n`;r+=`<tr>${t.map(e=>`<th>${O(e)}</th>`).join(``)}</tr>\n`;for(let e of n)r+=`<tr>${e.map(e=>`<td>${O(e==null?`NULL`:String(e))}</td>`).join(``)}</tr>\n`;return r+`</table>
1
+ import{r as e}from"./hePW80VL.js";import{h as t,n}from"./XzPc-eVf.js";import{l as r,m as i,t as a}from"./CKOS5Y-e.js";import{a as o,i as s,n as c,r as l,t as u}from"./BGIwW6nZ.js";import{t as d}from"./DTxGpkJp.js";import{n as f}from"./CChaTOPr.js";import{S as p,a as m}from"./Cw_LYT6k.js";import{n as h}from"./DbRMSZEW.js";import{o as g,r as _}from"./BM5G_YA7.js";import{c as v,ct as y}from"./B1lNzsWx.js";import{a as b,i as x,n as S,o as C,t as w}from"./DxuXBECK.js";import{t as T}from"./CnYBZPf9.js";var E=e(t(),1),D=r();function O(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}function k(){let{t:e}=i(),{activeDialog:t,closeDialog:r}=n(),{activeConnectionId:k,activeConnections:A}=d(),{trees:j}=p(),M=f(),N=t===`export-html`,P=(0,E.useMemo)(()=>k?_(j[k]??[]):[],[k,j]),F=(0,E.useMemo)(()=>{if(!k)return``;let e=M.activeTabId[k];return(M.tabs[k]??[]).find(t=>t.id===e)?.database||``},[k,M.activeTabId,M.tabs]),[I,L]=(0,E.useState)(``),R=(0,E.useMemo)(()=>!k||!I?[]:g(j[k]??[],I),[k,I,j]),[z,B]=(0,E.useState)([]),[V,H]=(0,E.useState)(!0),[U,W]=(0,E.useState)(!0),[G,K]=(0,E.useState)(!0),[q,J]=(0,E.useState)(!1);(0,E.useEffect)(()=>{N&&F&&L(F)},[N,F]);function Y(e){e||(r(),L(``),B([]),H(!0),W(!0),K(!0))}function X(e){B(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}function Z(){B(R.length===z.length?[]:[...R])}async function Q(){if(z.length===0||!k)return;let t=A.find(e=>e.id===k);if(!t?.serverConnectionId)return;J(!0);let{introspect:n}=h(k),i=m(t.serverConnectionId),a=(e,t,n)=>{let r=`<h3>${O(e)}</h3>\n<table border="1" cellpadding="4" cellspacing="0">\n`;r+=`<tr>${t.map(e=>`<th>${O(e)}</th>`).join(``)}</tr>\n`;for(let e of n)r+=`<tr>${e.map(e=>`<td>${O(e==null?`NULL`:String(e))}</td>`).join(``)}</tr>\n`;return r+`</table>
2
2
  `};try{let t=[];for(let r of z){let o=`<h2>${O(r)}</h2>\n`;if(V){let t=await n.listColumns(i,I,r);t.length>0&&(o+=a(e(`database.html.sectionColumns`),[`Field`,`Type`,`Null`,`Key`,`Default`,`Extra`,`Comment`],t.map(e=>[e.name,e.type,e.nullable?`YES`:`NO`,e.key,e.defaultValue,e.extra,e.comment])))}if(U){let t=await n.listIndexes(i,I,r);t.length>0&&(o+=a(e(`database.html.sectionIndexes`),[`Key_name`,`Type`,`Columns`],t.map(e=>[e.name,e.type,e.columns.join(`, `)])))}if(G){let t=await n.getTableInfo(i,I,r);t&&(o+=a(e(`database.html.sectionProperties`),[`Name`,`Engine`,`Collation`,`Rows`,`Data_length`,`Create_time`,`Update_time`,`Comment`],[[t.name,t.engine,t.collation,t.rows,t.dataLength,t.createTime,t.updateTime,t.comment]]))}t.push(o)}let r=`<!DOCTYPE html>
3
3
  <html lang="en">
4
4
  <head>
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{c as t,h as n,n as r}from"./XzPc-eVf.js";import{a as i,f as a,l as o,m as s,o as c,s as l}from"./CKOS5Y-e.js";import{r as u,t as d}from"./ClyAuDY9.js";import{_ as f,a as p,o as m,r as h,t as g}from"./CZQ1r4zz.js";import{t as _}from"./DTxGpkJp.js";import{n as v,r as y}from"./BBSxV90W.js";import{n as b,t as ee}from"./CChaTOPr.js";import{n as x,t as S}from"./Cw_LYT6k.js";import{c as C,i as w}from"./DlKZCiMg.js";import{$ as T,B as te,Ct as E,Dt as D,F as O,K as ne,Lt as k,Mt as A,Q as j,R as M,St as re,Tt as N,Vt as ie,X as P,Z as ae,_t as oe,bt as se,dt as ce,ft as le,gt as ue,ht as de,jt as fe,kt as pe,lt as me,ot as he,q as ge,ut as _e,vt as ve,wt as ye,xt as be}from"./D7Ze5md9.js";import{a as xe,n as F,o as Se,r as Ce,t as we}from"./DxuXBECK.js";var Te=i(`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=i(`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=i(`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=i(`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=i(`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=i(`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=i(`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=i(`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=i(`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=i(`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=i(`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=i(`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=i(`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=i(`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=i(`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=i(`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=i(`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=i(`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=i(`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`}]]),I=e(n(),1),L=1,We=.9,Ge=.8,Ke=.17,R=.1,z=.999,qe=.9999,B=.99,V=/[\\\/_+.#"@\[\(\{&]/,Je=/[\\\/_+.#"@\[\(\{&]/g,Ye=/[\s-]/,Xe=/[\s-]/g;function H(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?L: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=H(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=L:V.test(e.charAt(l-1))?(d*=Ge,p=e.slice(i,l-1).match(Je),p&&i>0&&(d*=z**+p.length)):Ye.test(e.charAt(l-1))?(d*=We,m=e.slice(i,l-1).match(Xe),m&&i>0&&(d*=z**+m.length)):(d*=Ke,i>0&&(d*=z**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=qe)),(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=H(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(Xe,` `)}function Qe(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,H(e,t,Ze(e),Ze(t),0,0,{})}var U=`[cmdk-group=""]`,W=`[cmdk-group-items=""]`,$e=`[cmdk-group-heading=""]`,et=`[cmdk-item=""]`,tt=`${et}:not([aria-disabled="true"])`,nt=`cmdk-item-select`,G=`data-value`,rt=(e,t,n)=>Qe(e,t,n),it=I.createContext(void 0),K=()=>I.useContext(it),at=I.createContext(void 0),q=()=>I.useContext(at),ot=I.createContext(void 0),st=I.forwardRef((e,t)=>{let n=X(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=X(()=>new Set),i=X(()=>new Map),a=X(()=>new Map),o=X(()=>new Set),s=vt(e),{label:c,children:u,value:d,onValueChange:p,filter:m,shouldFilter:h,loop:g,disablePointerSelection:_=!1,vimBindings:v=!0,...y}=e,b=f(),ee=f(),x=f(),S=I.useRef(null),C=bt();Y(()=>{if(d!==void 0){let e=d.trim();n.current.value=e,w.emit()}},[d]),Y(()=>{C(6,ne)},[]);let w=I.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.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`)O(),E(),C(1,D);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(x);e?e.focus():(i=document.getElementById(b))==null||i.focus()}if(C(7,()=>{n.current.selectedItemId=k()?.id,w.emit()}),r||C(5,ne),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}w.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),T=I.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,te(t,r)),C(2,()=>{E(),w.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),C(3,()=>{O(),E(),n.current.value||D(),w.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=k();C(4,()=>{O(),t?.getAttribute(`id`)===e&&D(),w.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:b,inputId:x,labelId:ee,listInnerRef:S}),[]);function te(e,t){let r=s.current?.filter??rt;return e?r(e,n.current.search,t):0}function E(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=S.current;A().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(W);t?t.appendChild(e.parentElement===t?e:e.closest(`${W} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${W} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=S.current?.querySelector(`${U}[${G}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function D(){let e=A().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(G);w.setState(`value`,e||void 0)}function O(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=te(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.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 ne(){var e;let t=k();t&&(t.parentElement?.firstChild===t&&((e=t.closest(U)?.querySelector($e))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function k(){return S.current?.querySelector(`${et}[aria-selected="true"]`)}function A(){return Array.from(S.current?.querySelectorAll(tt)||[])}function j(e){let t=A()[e];t&&w.setState(`value`,t.getAttribute(G))}function M(e){var t;let n=k(),r=A(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&w.setState(`value`,a.getAttribute(G))}function re(e){let t=k()?.closest(U),n;for(;t&&!n;)t=e>0?gt(t,U):_t(t,U),n=t?.querySelector(tt);n?w.setState(`value`,n.getAttribute(G)):M(e)}let N=()=>j(A().length-1),ie=e=>{e.preventDefault(),e.metaKey?N():e.altKey?re(1):M(1)},P=e=>{e.preventDefault(),e.metaKey?j(0):e.altKey?re(-1):M(-1)};return I.createElement(l.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&&ie(e);break;case`ArrowDown`:ie(e);break;case`p`:case`k`:v&&e.ctrlKey&&P(e);break;case`ArrowUp`:P(e);break;case`Home`:e.preventDefault(),j(0);break;case`End`:e.preventDefault(),N();break;case`Enter`:{e.preventDefault();let t=k();if(t){let e=new Event(nt);t.dispatchEvent(e)}}}}},I.createElement(`label`,{"cmdk-label":``,htmlFor:T.inputId,id:T.labelId,style:St},c),Q(e,e=>I.createElement(at.Provider,{value:w},I.createElement(it.Provider,{value:T},e))))}),ct=I.forwardRef((e,t)=>{let n=f(),r=I.useRef(null),i=I.useContext(ot),o=K(),s=vt(e),c=s.current?.forceMount??i?.forceMount;Y(()=>{if(!c)return o.item(n,i?.id)},[c]);let u=yt(n,r,[e.value,e.children,r],e.keywords),d=q(),p=Z(e=>e.value&&e.value===u.current),m=Z(e=>c||o.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);I.useEffect(()=>{let t=r.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=s.current).onSelect)==null||t.call(e,u.current)}function g(){d.setState(`value`,u.current,!0)}if(!m)return null;let{disabled:_,value:v,onSelect:y,forceMount:b,keywords:ee,...x}=e;return I.createElement(l.div,{ref:a(r,t),...x,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!_,"aria-selected":!!p,"data-disabled":!!_,"data-selected":!!p,onPointerMove:_||o.getDisablePointerSelection()?void 0:g,onClick:_?void 0:h},e.children)}),lt=I.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...o}=e,s=f(),c=I.useRef(null),u=I.useRef(null),d=f(),p=K(),m=Z(e=>i||p.filter()===!1?!0:!e.search||e.filtered.groups.has(s));Y(()=>p.group(s),[]),yt(s,c,[e.value,e.heading,u]);let h=I.useMemo(()=>({id:s,forceMount:i}),[i]);return I.createElement(l.div,{ref:a(c,t),...o,"cmdk-group":``,role:`presentation`,hidden:!m||void 0},n&&I.createElement(`div`,{ref:u,"cmdk-group-heading":``,"aria-hidden":!0,id:d},n),Q(e,e=>I.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?d:void 0},I.createElement(ot.Provider,{value:h},e))))}),ut=I.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=I.useRef(null),o=Z(e=>!e.search);return!n&&!o?null:I.createElement(l.div,{ref:a(i,t),...r,"cmdk-separator":``,role:`separator`})}),dt=I.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=q(),o=Z(e=>e.search),s=Z(e=>e.selectedItemId),c=K();return I.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),I.createElement(l.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),ft=I.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,o=I.useRef(null),s=I.useRef(null),c=Z(e=>e.selectedItemId),u=K();return I.useEffect(()=>{if(s.current&&o.current){let e=s.current,t=o.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)}}},[]),I.createElement(l.div,{ref:a(o,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":c,"aria-label":r,id:u.listId},Q(e,e=>I.createElement(`div`,{ref:a(s,u.listInnerRef),"cmdk-list-sizer":``},e)))}),pt=I.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return I.createElement(g,{open:n,onOpenChange:r},I.createElement(m,{container:o},I.createElement(p,{"cmdk-overlay":``,className:i}),I.createElement(h,{"aria-label":e.label,"cmdk-dialog":``,className:a},I.createElement(st,{ref:t,...s}))))}),mt=I.forwardRef((e,t)=>Z(e=>e.filtered.count===0)?I.createElement(l.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),ht=I.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return I.createElement(l.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},Q(e,e=>I.createElement(`div`,{"aria-hidden":!0},e)))}),J=Object.assign(st,{List:ft,Item:ct,Input:dt,Group:lt,Separator:ut,Dialog:pt,Empty:mt,Loading:ht});function gt(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function _t(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function vt(e){let t=I.useRef(e);return Y(()=>{t.current=e}),t}var Y=typeof window>`u`?I.useEffect:I.useLayoutEffect;function X(e){let t=I.useRef();return t.current===void 0&&(t.current=e()),t}function Z(e){let t=q(),n=()=>e(t.snapshot());return I.useSyncExternalStore(t.subscribe,n,n)}function yt(e,t,n,r=[]){let i=I.useRef(),a=K();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(G,s),i.current=s}),i}var bt=()=>{let[e,t]=I.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 xt(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&&I.isValidElement(t)?I.cloneElement(xt(t),{ref:t.ref},n(t.props.children)):n(t)}var St={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},$=o();function Ct({className:e,...t}){return(0,$.jsx)(J,{"data-slot":`command`,className:c(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...t})}function wt({title:e=`Command Palette`,description:t=`Search for a command to run...`,children:n,className:r,showCloseButton:i=!0,...a}){return(0,$.jsxs)(we,{...a,children:[(0,$.jsxs)(xe,{className:`sr-only`,children:[(0,$.jsx)(Se,{children:e}),(0,$.jsx)(Ce,{children:t})]}),(0,$.jsx)(F,{className:c(`overflow-hidden p-0`,r),showCloseButton:i,children:(0,$.jsx)(Ct,{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 Tt({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)(se,{className:`size-4 shrink-0 opacity-50`}),(0,$.jsx)(J.Input,{"data-slot":`command-input`,className:c(`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 Et({className:e,...t}){return(0,$.jsx)(J.List,{"data-slot":`command-list`,className:c(`max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto`,e),...t})}function Dt({...e}){return(0,$.jsx)(J.Empty,{"data-slot":`command-empty`,className:`py-6 text-center text-sm`,...e})}function Ot({className:e,...t}){return(0,$.jsx)(J.Group,{"data-slot":`command-group`,className:c(`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 kt({className:e,...t}){return(0,$.jsx)(J.Item,{"data-slot":`command-item`,className:c(`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 At({className:e,...t}){return(0,$.jsx)(`span`,{"data-slot":`command-shortcut`,className:c(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t})}var jt={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 Mt({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 Nt(){let{t:e}=s(),{activeDialog:n,closeDialog:i,openDialog:a}=r(),o=r(e=>e.setWelcomeVisible),l=r(e=>e.setFooterMessage),{executeCurrentQuery:f,executeCurrentStatement:p,executeWholeScript:m,addNewQueryTab:h,disconnectActive:g}=T(),{capabilities:se}=he(),xe=y(),F=_(e=>e.activeConnections.find(t=>t.id===e.activeConnectionId)),Se=_(e=>e.activeConnectionId?e.transactionOpen[e.activeConnectionId]??!1:!1),Ce=_(e=>e.updateProfile),we=P(e=>e.themeId),L=P(e=>e.setTheme),We=v(e=>e.locale),Ge=v(e=>e.setLocale),Ke=n===`quick-command`,R=F!==void 0,z=b(e=>{let t=_.getState().activeConnectionId;if(!t)return!1;let n=e.activeTabId[t];return(e.tabs[t]??ee).find(e=>e.id===n)?.isExecuting??!1});async function qe(){let e=_.getState().activeConnectionId;if(!e)return;let t=x(await S(e));t&&r.getState().setFooterMessage(t)}let B=(0,I.useCallback)(e=>{i(),e()},[i]),V=(0,I.useCallback)(e=>l(e instanceof Error?e.message:String(e)),[l]),Je=()=>{let e=_.getState().activeConnectionId;e&&(j.getState().openERD(e),t(`erd_open`),b.getState().setActiveQueryTab(e,`erd`))},Ye=[{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:!xe,action:()=>B(()=>a(`connect`))},{id:`disconnect`,label:e(`palette.commands.disconnect`),icon:ce,tone:`red`,keywords:[`disconnect`,`close`],disabled:!R,action:()=>B(()=>{g()})},{id:`read-only`,label:e(`menu.connection.readOnly`),icon:N,tone:`yellow`,keywords:[`read only`,`safety`,`guard`],disabled:!R,checked:F?.readOnly===!0,action:()=>B(()=>{F&&Ce(F.id,{readOnly:!F.readOnly})})},{id:`manual-transactions`,capability:`transactions`,label:e(`menu.connection.manualTransactions`),icon:D,tone:`lavender`,keywords:[`transaction`,`manual`,`autocommit`],disabled:!R,checked:F?.transactionMode===`manual`,action:()=>B(()=>{F&&Ce(F.id,{transactionMode:F.transactionMode===`manual`?`auto`:`manual`})})},{id:`commit`,capability:`transactions`,label:e(`toolbar.commit`),icon:k,tone:`green`,keywords:[`commit`,`transaction`],disabled:!Se||!F,action:()=>B(()=>{F&&w(F.id).catch(V)})},{id:`rollback`,capability:`transactions`,label:e(`toolbar.rollback`),icon:le,tone:`peach`,keywords:[`rollback`,`transaction`,`undo`],disabled:!Se||!F,action:()=>B(()=>{F&&C(F.id).catch(V)})}]},{heading:e(`palette.groups.query`),commands:[{id:`execute`,label:e(`palette.commands.executeQuery`),icon:E,tone:`green`,shortcut:`F9`,keywords:[`run`,`execute`,`sql`],disabled:!R,action:()=>B(()=>{f()})},{id:`stop-query`,label:e(`result.running.stop`),icon:oe,tone:`red`,keywords:[`stop`,`cancel`,`abort`,`kill`],disabled:!z,action:()=>B(()=>{qe()})},{id:`execute-statement`,label:e(`menu.query.executeStatementAtCursor`),icon:De,tone:`green`,shortcut:`Ctrl+Enter`,keywords:[`run`,`statement`,`cursor`],disabled:!R,action:()=>B(()=>{p()})},{id:`execute-script`,label:e(`menu.query.executeWholeScript`),icon:Be,tone:`teal`,shortcut:`Ctrl+Shift+Enter`,keywords:[`run`,`script`,`batch`],disabled:!R,action:()=>B(()=>{m()})},{id:`new-tab`,label:e(`palette.commands.newQueryTab`),icon:re,tone:`blue`,shortcut:`Alt+T`,keywords:[`new`,`tab`,`editor`],disabled:!R,action:()=>B(()=>h())},{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:fe,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:A,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:ve,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:ue,tone:`green`,keywords:[`create`,`table`],disabled:!R,action:()=>B(()=>a(`create-table`))},{id:`alter-table`,label:e(`palette.commands.alterTable`),icon:me,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:ie,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:de,tone:`teal`,keywords:[`status`,`server`,`metrics`],disabled:!R,action:()=>B(()=>a(`status`))},{id:`flush`,capability:`flush`,label:e(`palette.commands.flush`),icon:be,tone:`peach`,keywords:[`flush`,`cache`,`reload`],disabled:!R,action:()=>B(()=>a(`flush`))},{id:`user-manager`,capability:`users`,label:e(`palette.commands.userManager`),icon:_e,tone:`blue`,keywords:[`users`,`grants`,`privileges`],disabled:!R,action:()=>B(()=>a(`user-manager`))},{id:`scratchpad`,label:e(`menu.tools.scratchpad`),icon:ye,tone:`yellow`,keywords:[`scratchpad`,`sqlite`,`local`],pro:`scratchpad`,action:()=>B(()=>{ge().catch(V)})},{id:`federated`,label:e(`menu.tools.federated`),icon:Ue,tone:`mauve`,keywords:[`federated`,`cross`,`join`,`connections`],pro:`federated`,action:()=>B(()=>{te().catch(V)})},{id:`erd`,label:e(`menu.tools.viewErd`),icon:Fe,tone:`sky`,keywords:[`erd`,`diagram`,`relations`],disabled:!R,action:()=>B(Je)}]},{heading:e(`menu.settings.theme`),commands:ae().map(e=>({id:`theme-${e.id}`,label:e.name,tone:`lavender`,keywords:[`theme`,`color`,`appearance`,`dark`,`light`,e.id],checked:we===e.id,swatch:e,action:()=>B(()=>L(e.id))}))},{heading:e(`menu.settings.language`),commands:[`auto`,...d].map(t=>({id:`locale-${t}`,label:t===`auto`?e(`language.auto`,{name:e(`language.${u()}`)}):e(`language.${t}`),icon:Pe,tone:`teal`,keywords:[`language`,`locale`,`i18n`,t],checked:We===t,action:()=>B(()=>Ge(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(ne(),`_blank`,`noopener,noreferrer`)})},{id:`getting-started`,label:e(`menu.help.gettingStarted`),icon:Re,tone:`green`,keywords:[`welcome`,`onboarding`,`sample`,`getting started`],action:()=>B(()=>o(!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:pe,tone:`sky`,keywords:[`about`,`version`,`agent`],action:()=>B(()=>a(`about`))}]}];function Xe(e){e||i()}let H=Ye.map(e=>({...e,commands:e.commands.filter(e=>!e.capability||se[e.capability])})).filter(e=>e.commands.length>0);return(0,$.jsxs)(wt,{open:Ke,onOpenChange:Xe,title:e(`palette.title`),description:e(`palette.description`),children:[(0,$.jsx)(Tt,{placeholder:e(`palette.inputPlaceholder`)}),(0,$.jsxs)(Et,{className:`max-h-[60vh]`,children:[(0,$.jsx)(Dt,{children:e(`palette.empty`)}),H.map(e=>(0,$.jsx)(Ot,{heading:e.heading,children:e.commands.map(t=>(0,$.jsxs)(kt,{value:`${e.heading} ${t.label}`,keywords:t.keywords,disabled:t.disabled,onSelect:()=>{(!t.pro||O(t.pro))&&t.action()},children:[t.swatch?(0,$.jsx)(Mt,{theme:t.swatch}):t.icon?(0,$.jsx)(t.icon,{className:c(`size-4`,jt[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)(k,{className:`size-3.5 text-catppuccin-green`}),t.shortcut&&(0,$.jsx)(At,{className:`ml-0`,children:t.shortcut})]})]},t.id))},e.heading))]})]})}export{Nt as QuickCommandPalette};
1
+ import{r as e}from"./hePW80VL.js";import{c as t,h as n,n as r}from"./XzPc-eVf.js";import{a as i,f as a,l as o,m as s,o as c,s as l}from"./CKOS5Y-e.js";import{r as u,t as d}from"./ClyAuDY9.js";import{_ as f,a as p,o as m,r as h,t as g}from"./CZQ1r4zz.js";import{t as _}from"./DTxGpkJp.js";import{n as v,r as y}from"./BBSxV90W.js";import{n as b,t as ee}from"./CChaTOPr.js";import{n as x,t as S}from"./Cw_LYT6k.js";import{c as C,i as w}from"./CnOZTyPx.js";import{$ as T,B as te,Ct as E,Dt as D,F as O,K as ne,Lt as k,Mt as A,Q as j,R as M,St as re,Tt as N,Vt as ie,X as P,Z as ae,_t as oe,bt as se,dt as ce,ft as le,gt as ue,ht as de,jt as fe,kt as pe,lt as me,ot as he,q as ge,ut as _e,vt as ve,wt as ye,xt as be}from"./B1lNzsWx.js";import{a as xe,n as F,o as Se,r as Ce,t as we}from"./DxuXBECK.js";var Te=i(`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=i(`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=i(`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=i(`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=i(`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=i(`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=i(`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=i(`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=i(`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=i(`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=i(`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=i(`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=i(`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=i(`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=i(`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=i(`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=i(`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=i(`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=i(`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`}]]),I=e(n(),1),L=1,We=.9,Ge=.8,Ke=.17,R=.1,z=.999,qe=.9999,B=.99,V=/[\\\/_+.#"@\[\(\{&]/,Je=/[\\\/_+.#"@\[\(\{&]/g,Ye=/[\s-]/,Xe=/[\s-]/g;function H(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?L: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=H(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=L:V.test(e.charAt(l-1))?(d*=Ge,p=e.slice(i,l-1).match(Je),p&&i>0&&(d*=z**+p.length)):Ye.test(e.charAt(l-1))?(d*=We,m=e.slice(i,l-1).match(Xe),m&&i>0&&(d*=z**+m.length)):(d*=Ke,i>0&&(d*=z**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=qe)),(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=H(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(Xe,` `)}function Qe(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,H(e,t,Ze(e),Ze(t),0,0,{})}var U=`[cmdk-group=""]`,W=`[cmdk-group-items=""]`,$e=`[cmdk-group-heading=""]`,et=`[cmdk-item=""]`,tt=`${et}:not([aria-disabled="true"])`,nt=`cmdk-item-select`,G=`data-value`,rt=(e,t,n)=>Qe(e,t,n),it=I.createContext(void 0),K=()=>I.useContext(it),at=I.createContext(void 0),q=()=>I.useContext(at),ot=I.createContext(void 0),st=I.forwardRef((e,t)=>{let n=X(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=X(()=>new Set),i=X(()=>new Map),a=X(()=>new Map),o=X(()=>new Set),s=vt(e),{label:c,children:u,value:d,onValueChange:p,filter:m,shouldFilter:h,loop:g,disablePointerSelection:_=!1,vimBindings:v=!0,...y}=e,b=f(),ee=f(),x=f(),S=I.useRef(null),C=bt();Y(()=>{if(d!==void 0){let e=d.trim();n.current.value=e,w.emit()}},[d]),Y(()=>{C(6,ne)},[]);let w=I.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.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`)O(),E(),C(1,D);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(x);e?e.focus():(i=document.getElementById(b))==null||i.focus()}if(C(7,()=>{n.current.selectedItemId=k()?.id,w.emit()}),r||C(5,ne),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}w.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),T=I.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,te(t,r)),C(2,()=>{E(),w.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),C(3,()=>{O(),E(),n.current.value||D(),w.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=k();C(4,()=>{O(),t?.getAttribute(`id`)===e&&D(),w.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:b,inputId:x,labelId:ee,listInnerRef:S}),[]);function te(e,t){let r=s.current?.filter??rt;return e?r(e,n.current.search,t):0}function E(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=S.current;A().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(W);t?t.appendChild(e.parentElement===t?e:e.closest(`${W} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${W} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=S.current?.querySelector(`${U}[${G}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function D(){let e=A().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(G);w.setState(`value`,e||void 0)}function O(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=te(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.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 ne(){var e;let t=k();t&&(t.parentElement?.firstChild===t&&((e=t.closest(U)?.querySelector($e))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function k(){return S.current?.querySelector(`${et}[aria-selected="true"]`)}function A(){return Array.from(S.current?.querySelectorAll(tt)||[])}function j(e){let t=A()[e];t&&w.setState(`value`,t.getAttribute(G))}function M(e){var t;let n=k(),r=A(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&w.setState(`value`,a.getAttribute(G))}function re(e){let t=k()?.closest(U),n;for(;t&&!n;)t=e>0?gt(t,U):_t(t,U),n=t?.querySelector(tt);n?w.setState(`value`,n.getAttribute(G)):M(e)}let N=()=>j(A().length-1),ie=e=>{e.preventDefault(),e.metaKey?N():e.altKey?re(1):M(1)},P=e=>{e.preventDefault(),e.metaKey?j(0):e.altKey?re(-1):M(-1)};return I.createElement(l.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&&ie(e);break;case`ArrowDown`:ie(e);break;case`p`:case`k`:v&&e.ctrlKey&&P(e);break;case`ArrowUp`:P(e);break;case`Home`:e.preventDefault(),j(0);break;case`End`:e.preventDefault(),N();break;case`Enter`:{e.preventDefault();let t=k();if(t){let e=new Event(nt);t.dispatchEvent(e)}}}}},I.createElement(`label`,{"cmdk-label":``,htmlFor:T.inputId,id:T.labelId,style:St},c),Q(e,e=>I.createElement(at.Provider,{value:w},I.createElement(it.Provider,{value:T},e))))}),ct=I.forwardRef((e,t)=>{let n=f(),r=I.useRef(null),i=I.useContext(ot),o=K(),s=vt(e),c=s.current?.forceMount??i?.forceMount;Y(()=>{if(!c)return o.item(n,i?.id)},[c]);let u=yt(n,r,[e.value,e.children,r],e.keywords),d=q(),p=Z(e=>e.value&&e.value===u.current),m=Z(e=>c||o.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);I.useEffect(()=>{let t=r.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=s.current).onSelect)==null||t.call(e,u.current)}function g(){d.setState(`value`,u.current,!0)}if(!m)return null;let{disabled:_,value:v,onSelect:y,forceMount:b,keywords:ee,...x}=e;return I.createElement(l.div,{ref:a(r,t),...x,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!_,"aria-selected":!!p,"data-disabled":!!_,"data-selected":!!p,onPointerMove:_||o.getDisablePointerSelection()?void 0:g,onClick:_?void 0:h},e.children)}),lt=I.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...o}=e,s=f(),c=I.useRef(null),u=I.useRef(null),d=f(),p=K(),m=Z(e=>i||p.filter()===!1?!0:!e.search||e.filtered.groups.has(s));Y(()=>p.group(s),[]),yt(s,c,[e.value,e.heading,u]);let h=I.useMemo(()=>({id:s,forceMount:i}),[i]);return I.createElement(l.div,{ref:a(c,t),...o,"cmdk-group":``,role:`presentation`,hidden:!m||void 0},n&&I.createElement(`div`,{ref:u,"cmdk-group-heading":``,"aria-hidden":!0,id:d},n),Q(e,e=>I.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?d:void 0},I.createElement(ot.Provider,{value:h},e))))}),ut=I.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=I.useRef(null),o=Z(e=>!e.search);return!n&&!o?null:I.createElement(l.div,{ref:a(i,t),...r,"cmdk-separator":``,role:`separator`})}),dt=I.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=q(),o=Z(e=>e.search),s=Z(e=>e.selectedItemId),c=K();return I.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),I.createElement(l.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),ft=I.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,o=I.useRef(null),s=I.useRef(null),c=Z(e=>e.selectedItemId),u=K();return I.useEffect(()=>{if(s.current&&o.current){let e=s.current,t=o.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)}}},[]),I.createElement(l.div,{ref:a(o,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":c,"aria-label":r,id:u.listId},Q(e,e=>I.createElement(`div`,{ref:a(s,u.listInnerRef),"cmdk-list-sizer":``},e)))}),pt=I.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return I.createElement(g,{open:n,onOpenChange:r},I.createElement(m,{container:o},I.createElement(p,{"cmdk-overlay":``,className:i}),I.createElement(h,{"aria-label":e.label,"cmdk-dialog":``,className:a},I.createElement(st,{ref:t,...s}))))}),mt=I.forwardRef((e,t)=>Z(e=>e.filtered.count===0)?I.createElement(l.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),ht=I.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return I.createElement(l.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},Q(e,e=>I.createElement(`div`,{"aria-hidden":!0},e)))}),J=Object.assign(st,{List:ft,Item:ct,Input:dt,Group:lt,Separator:ut,Dialog:pt,Empty:mt,Loading:ht});function gt(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function _t(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function vt(e){let t=I.useRef(e);return Y(()=>{t.current=e}),t}var Y=typeof window>`u`?I.useEffect:I.useLayoutEffect;function X(e){let t=I.useRef();return t.current===void 0&&(t.current=e()),t}function Z(e){let t=q(),n=()=>e(t.snapshot());return I.useSyncExternalStore(t.subscribe,n,n)}function yt(e,t,n,r=[]){let i=I.useRef(),a=K();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(G,s),i.current=s}),i}var bt=()=>{let[e,t]=I.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 xt(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&&I.isValidElement(t)?I.cloneElement(xt(t),{ref:t.ref},n(t.props.children)):n(t)}var St={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},$=o();function Ct({className:e,...t}){return(0,$.jsx)(J,{"data-slot":`command`,className:c(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...t})}function wt({title:e=`Command Palette`,description:t=`Search for a command to run...`,children:n,className:r,showCloseButton:i=!0,...a}){return(0,$.jsxs)(we,{...a,children:[(0,$.jsxs)(xe,{className:`sr-only`,children:[(0,$.jsx)(Se,{children:e}),(0,$.jsx)(Ce,{children:t})]}),(0,$.jsx)(F,{className:c(`overflow-hidden p-0`,r),showCloseButton:i,children:(0,$.jsx)(Ct,{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 Tt({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)(se,{className:`size-4 shrink-0 opacity-50`}),(0,$.jsx)(J.Input,{"data-slot":`command-input`,className:c(`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 Et({className:e,...t}){return(0,$.jsx)(J.List,{"data-slot":`command-list`,className:c(`max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto`,e),...t})}function Dt({...e}){return(0,$.jsx)(J.Empty,{"data-slot":`command-empty`,className:`py-6 text-center text-sm`,...e})}function Ot({className:e,...t}){return(0,$.jsx)(J.Group,{"data-slot":`command-group`,className:c(`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 kt({className:e,...t}){return(0,$.jsx)(J.Item,{"data-slot":`command-item`,className:c(`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 At({className:e,...t}){return(0,$.jsx)(`span`,{"data-slot":`command-shortcut`,className:c(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t})}var jt={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 Mt({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 Nt(){let{t:e}=s(),{activeDialog:n,closeDialog:i,openDialog:a}=r(),o=r(e=>e.setWelcomeVisible),l=r(e=>e.setFooterMessage),{executeCurrentQuery:f,executeCurrentStatement:p,executeWholeScript:m,addNewQueryTab:h,disconnectActive:g}=T(),{capabilities:se}=he(),xe=y(),F=_(e=>e.activeConnections.find(t=>t.id===e.activeConnectionId)),Se=_(e=>e.activeConnectionId?e.transactionOpen[e.activeConnectionId]??!1:!1),Ce=_(e=>e.updateProfile),we=P(e=>e.themeId),L=P(e=>e.setTheme),We=v(e=>e.locale),Ge=v(e=>e.setLocale),Ke=n===`quick-command`,R=F!==void 0,z=b(e=>{let t=_.getState().activeConnectionId;if(!t)return!1;let n=e.activeTabId[t];return(e.tabs[t]??ee).find(e=>e.id===n)?.isExecuting??!1});async function qe(){let e=_.getState().activeConnectionId;if(!e)return;let t=x(await S(e));t&&r.getState().setFooterMessage(t)}let B=(0,I.useCallback)(e=>{i(),e()},[i]),V=(0,I.useCallback)(e=>l(e instanceof Error?e.message:String(e)),[l]),Je=()=>{let e=_.getState().activeConnectionId;e&&(j.getState().openERD(e),t(`erd_open`),b.getState().setActiveQueryTab(e,`erd`))},Ye=[{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:!xe,action:()=>B(()=>a(`connect`))},{id:`disconnect`,label:e(`palette.commands.disconnect`),icon:ce,tone:`red`,keywords:[`disconnect`,`close`],disabled:!R,action:()=>B(()=>{g()})},{id:`read-only`,label:e(`menu.connection.readOnly`),icon:N,tone:`yellow`,keywords:[`read only`,`safety`,`guard`],disabled:!R,checked:F?.readOnly===!0,action:()=>B(()=>{F&&Ce(F.id,{readOnly:!F.readOnly})})},{id:`manual-transactions`,capability:`transactions`,label:e(`menu.connection.manualTransactions`),icon:D,tone:`lavender`,keywords:[`transaction`,`manual`,`autocommit`],disabled:!R,checked:F?.transactionMode===`manual`,action:()=>B(()=>{F&&Ce(F.id,{transactionMode:F.transactionMode===`manual`?`auto`:`manual`})})},{id:`commit`,capability:`transactions`,label:e(`toolbar.commit`),icon:k,tone:`green`,keywords:[`commit`,`transaction`],disabled:!Se||!F,action:()=>B(()=>{F&&w(F.id).catch(V)})},{id:`rollback`,capability:`transactions`,label:e(`toolbar.rollback`),icon:le,tone:`peach`,keywords:[`rollback`,`transaction`,`undo`],disabled:!Se||!F,action:()=>B(()=>{F&&C(F.id).catch(V)})}]},{heading:e(`palette.groups.query`),commands:[{id:`execute`,label:e(`palette.commands.executeQuery`),icon:E,tone:`green`,shortcut:`F9`,keywords:[`run`,`execute`,`sql`],disabled:!R,action:()=>B(()=>{f()})},{id:`stop-query`,label:e(`result.running.stop`),icon:oe,tone:`red`,keywords:[`stop`,`cancel`,`abort`,`kill`],disabled:!z,action:()=>B(()=>{qe()})},{id:`execute-statement`,label:e(`menu.query.executeStatementAtCursor`),icon:De,tone:`green`,shortcut:`Ctrl+Enter`,keywords:[`run`,`statement`,`cursor`],disabled:!R,action:()=>B(()=>{p()})},{id:`execute-script`,label:e(`menu.query.executeWholeScript`),icon:Be,tone:`teal`,shortcut:`Ctrl+Shift+Enter`,keywords:[`run`,`script`,`batch`],disabled:!R,action:()=>B(()=>{m()})},{id:`new-tab`,label:e(`palette.commands.newQueryTab`),icon:re,tone:`blue`,shortcut:`Alt+T`,keywords:[`new`,`tab`,`editor`],disabled:!R,action:()=>B(()=>h())},{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:fe,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:A,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:ve,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:ue,tone:`green`,keywords:[`create`,`table`],disabled:!R,action:()=>B(()=>a(`create-table`))},{id:`alter-table`,label:e(`palette.commands.alterTable`),icon:me,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:ie,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:de,tone:`teal`,keywords:[`status`,`server`,`metrics`],disabled:!R,action:()=>B(()=>a(`status`))},{id:`flush`,capability:`flush`,label:e(`palette.commands.flush`),icon:be,tone:`peach`,keywords:[`flush`,`cache`,`reload`],disabled:!R,action:()=>B(()=>a(`flush`))},{id:`user-manager`,capability:`users`,label:e(`palette.commands.userManager`),icon:_e,tone:`blue`,keywords:[`users`,`grants`,`privileges`],disabled:!R,action:()=>B(()=>a(`user-manager`))},{id:`scratchpad`,label:e(`menu.tools.scratchpad`),icon:ye,tone:`yellow`,keywords:[`scratchpad`,`sqlite`,`local`],pro:`scratchpad`,action:()=>B(()=>{ge().catch(V)})},{id:`federated`,label:e(`menu.tools.federated`),icon:Ue,tone:`mauve`,keywords:[`federated`,`cross`,`join`,`connections`],pro:`federated`,action:()=>B(()=>{te().catch(V)})},{id:`erd`,label:e(`menu.tools.viewErd`),icon:Fe,tone:`sky`,keywords:[`erd`,`diagram`,`relations`],disabled:!R,action:()=>B(Je)}]},{heading:e(`menu.settings.theme`),commands:ae().map(e=>({id:`theme-${e.id}`,label:e.name,tone:`lavender`,keywords:[`theme`,`color`,`appearance`,`dark`,`light`,e.id],checked:we===e.id,swatch:e,action:()=>B(()=>L(e.id))}))},{heading:e(`menu.settings.language`),commands:[`auto`,...d].map(t=>({id:`locale-${t}`,label:t===`auto`?e(`language.auto`,{name:e(`language.${u()}`)}):e(`language.${t}`),icon:Pe,tone:`teal`,keywords:[`language`,`locale`,`i18n`,t],checked:We===t,action:()=>B(()=>Ge(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(ne(),`_blank`,`noopener,noreferrer`)})},{id:`getting-started`,label:e(`menu.help.gettingStarted`),icon:Re,tone:`green`,keywords:[`welcome`,`onboarding`,`sample`,`getting started`],action:()=>B(()=>o(!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:pe,tone:`sky`,keywords:[`about`,`version`,`agent`],action:()=>B(()=>a(`about`))}]}];function Xe(e){e||i()}let H=Ye.map(e=>({...e,commands:e.commands.filter(e=>!e.capability||se[e.capability])})).filter(e=>e.commands.length>0);return(0,$.jsxs)(wt,{open:Ke,onOpenChange:Xe,title:e(`palette.title`),description:e(`palette.description`),children:[(0,$.jsx)(Tt,{placeholder:e(`palette.inputPlaceholder`)}),(0,$.jsxs)(Et,{className:`max-h-[60vh]`,children:[(0,$.jsx)(Dt,{children:e(`palette.empty`)}),H.map(e=>(0,$.jsx)(Ot,{heading:e.heading,children:e.commands.map(t=>(0,$.jsxs)(kt,{value:`${e.heading} ${t.label}`,keywords:t.keywords,disabled:t.disabled,onSelect:()=>{(!t.pro||O(t.pro))&&t.action()},children:[t.swatch?(0,$.jsx)(Mt,{theme:t.swatch}):t.icon?(0,$.jsx)(t.icon,{className:c(`size-4`,jt[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)(k,{className:`size-3.5 text-catppuccin-green`}),t.shortcut&&(0,$.jsx)(At,{className:`ml-0`,children:t.shortcut})]})]},t.id))},e.heading))]})]})}export{Nt as QuickCommandPalette};
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{h as t,n,t as r}from"./XzPc-eVf.js";import{l as i,m as a,t as o}from"./CKOS5Y-e.js";import{a as s,i as c,n as l,r as u,t as d}from"./D_2UqK4k.js";import{f,t as p}from"./DTxGpkJp.js";import{E as m,O as h,T as g,a as _,f as v,m as y}from"./BdPEUnLq.js";import{n as b}from"./CChaTOPr.js";import{S as x,d as S,g as C,i as w,l as T,r as E}from"./Cw_LYT6k.js";import{n as D,t as O}from"./C1RY7wUM.js";import{A as k,C as A,F as j,R as M,S as N,a as P,b as F,c as I,ct as ee,i as te,k as L,l as R,n as ne,nt as z,o as B,r as re,s as V,u as H,v as ie,x as U,y as ae,yt as oe}from"./D7Ze5md9.js";import{a as se,i as ce,n as le,o as ue,t as de}from"./DxuXBECK.js";var W=e(t(),1),G=new Set([`postgres:`,`postgresql:`]);function K(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(!G.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 q=new Set([`localhost`,`127.0.0.1`,`[::1]`,`::1`,`0.0.0.0`]);async function J(e,t){let n;try{let t=new URL(e);if(!q.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 Y=i(),X=[`utf8`,`utf8mb4`,`latin1`,`ascii`,`euckr`,`sjis`,`big5`],Z={enabled:!1,host:``,port:22,user:``,auth:`key`};function Q({label:e,htmlFor:t,children:n}){return(0,Y.jsxs)(`div`,{className:`grid grid-cols-[120px_minmax(0,1fr)] items-center gap-2`,children:[(0,Y.jsx)(I,{htmlFor:t,children:e}),n]})}function fe({value:e,onChange:t}){let{t:n}=a();function r(n,r){t({...e,[n]:r})}let[i,f]=(0,W.useState)([]),p=e.dbms===`d1`?e.devUrl??``:``;(0,W.useEffect)(()=>{if(!p){f([]);return}let e=new AbortController,t=setTimeout(()=>{J(p,e.signal).then(f)},300);return()=>{clearTimeout(t),e.abort()}},[p]);let g=e.dbms===`sqlite`,_=e.transport??`browser`,v=g&&_===`browser`,y=m.has(e.dbms),b=e.dbms===`d1`,x=e.dbms===`do`,S=O.find(t=>t.id===e.dbms)?.capabilities,C=e.ssh??Z,[w,E]=(0,W.useState)(``),D=w.trim()===``?`empty`:K(w)?`applied`:`invalid`,A=e.dbms===`supabase`&&e.port===6543;function N(n){E(n);let r=K(n);r&&t({...e,host:r.host??e.host,port:r.port??O.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 P(n){t({...e,ssh:{...C,...n}})}async function F(e){e&&P({privateKey:await e.text(),privateKeyName:e.name})}return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,Y.jsx)(Q,{label:n(`connection.form.hostName`),htmlFor:`conn-hostName`,children:(0,Y.jsx)(R,{id:`conn-hostName`,placeholder:n(`connection.form.hostNamePlaceholder`),value:e.hostName,onChange:e=>r(`hostName`,e.target.value)})}),(0,Y.jsx)(Q,{label:n(`connection.form.dataSource`),children:(0,Y.jsxs)(d,{value:e.dbms,onValueChange:n=>{let r=O.find(e=>e.id===n);if(!r)return;let i=r.id,a=m.has(i)||i===`d1`||i===`do`;E(``),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||y||b||x?V(i):e.user,devUrl:i===`do`?e.devUrl||`http://localhost:8787`:e.devUrl,database:e.database&&!a&&!y&&!b&&!x?e.database:B(i)??e.database})},children:[(0,Y.jsx)(c,{id:`conn-dbms`,className:`w-full`,children:(0,Y.jsx)(s,{})}),(0,Y.jsx)(l,{children:O.map(e=>(0,Y.jsx)(u,{value:e.id,children:(0,Y.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(H,{dbms:e.id}),e.label]})},e.id))})]})}),y&&(0,Y.jsx)(Q,{label:n(`connection.form.connectionString`),htmlFor:`conn-uri`,children:(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.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:w,onChange:e=>N(e.target.value)}),(0,Y.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`)})]})}),g&&(0,Y.jsxs)(Q,{label:n(`connection.form.openVia`),children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,Y.jsxs)(`label`,{className:`flex items-center gap-1.5 text-sm cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`radio`,name:`transport`,value:`browser`,checked:_===`browser`,onChange:()=>r(`transport`,`browser`),className:`accent-primary`}),n(`connection.form.viaBrowser`)]}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-1.5 text-sm cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`radio`,name:`transport`,value:`tunnel`,checked:_===`tunnel`,onChange:()=>r(`transport`,`tunnel`),className:`accent-primary`}),n(`connection.form.viaAgent`)]})]}),(0,Y.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(_===`browser`?`connection.form.viaBrowserHint`:`connection.form.viaAgentHint`)})]}),v?(0,Y.jsx)(Q,{label:n(`connection.form.databaseFile`),children:(0,Y.jsxs)(`div`,{className:`min-w-0 text-xs text-muted-foreground leading-relaxed`,children:[e.file?(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 break-all text-foreground`,title:e.file,children:e.file}),(0,Y.jsx)(o,{type:`button`,variant:`outline`,size:`sm`,className:`h-6 shrink-0 px-2 text-xs`,onClick:()=>{T(e.id),r(`file`,``)},children:n(`connection.form.changeFile`)})]}):(0,Y.jsx)(`p`,{children:n(`connection.form.filePickerHint`)}),(0,Y.jsx)(`p`,{className:`mt-1`,children:n(`connection.form.fileRememberedHint`)})]})}):null,!v&&(0,Y.jsx)(Q,{label:n(`connection.form.authToken`),htmlFor:`conn-authToken`,children:(0,Y.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())})}),v?null:x?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Q,{label:n(`connection.form.doDevUrl`),htmlFor:`conn-do-url`,children:(0,Y.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,Y.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.doHint`)}),(0,Y.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.doLimitsHint`)})]}):b?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Q,{label:n(`connection.form.d1DevUrl`),htmlFor:`conn-d1-dev`,children:(0,Y.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,Y.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.d1DevUrlHint`)}),(0,Y.jsx)(Q,{label:n(`connection.form.d1AccountId`),htmlFor:`conn-d1-account`,children:(0,Y.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,Y.jsx)(Q,{label:n(`connection.form.d1DatabaseId`),htmlFor:`conn-d1-database`,children:i.length>0?(0,Y.jsxs)(d,{value:e.databaseId??``,onValueChange:e=>r(`databaseId`,e),children:[(0,Y.jsx)(c,{id:`conn-d1-database`,children:(0,Y.jsx)(s,{placeholder:n(`connection.form.d1PickDatabase`)})}),(0,Y.jsx)(l,{children:i.map(e=>(0,Y.jsxs)(u,{value:e.id,children:[e.name,` · `,e.id]},e.id))})]}):(0,Y.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,Y.jsx)(Q,{label:n(`connection.form.d1ApiToken`),htmlFor:`conn-pass`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(R,{id:`conn-pass`,type:`password`,autoComplete:`new-password`,value:e.pass,onChange:e=>r(`pass`,e.target.value.trim())}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs whitespace-nowrap cursor-pointer`,title:n(`connection.form.savePasswordHint`),children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:e.savePassword??!0,onChange:e=>r(`savePassword`,e.target.checked)}),n(`connection.form.savePassword`)]})]})}),(0,Y.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.d1Hint`)}),(0,Y.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.d1LimitsHint`)})]}):g?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Q,{label:n(`connection.form.databaseFile`),htmlFor:`conn-file`,children:(0,Y.jsx)(R,{id:`conn-file`,placeholder:n(`connection.form.filePathPlaceholder`),value:e.file??``,onChange:e=>r(`file`,e.target.value)})}),(0,Y.jsx)(Q,{label:n(`connection.form.createIfMissing`),htmlFor:`conn-create`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.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,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`connection.form.createIfMissingHint`)})]})})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Q,{label:n(`connection.form.host`),htmlFor:`conn-host`,children:(0,Y.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,Y.jsx)(Q,{label:n(`connection.form.port`),htmlFor:`conn-port`,children:(0,Y.jsx)(R,{id:`conn-port`,type:`number`,value:e.port,onChange:t=>r(`port`,Number(t.target.value)||O.find(t=>t.id===e.dbms)?.defaultPort||3306)})}),A&&(0,Y.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`)}),(h(e.dbms)||e.dbms===`mssql`||e.dbms===`oracle`)&&(0,Y.jsx)(Q,{label:e.dbms===`oracle`?n(`connection.form.serviceName`):n(`connection.form.database`),htmlFor:`conn-database`,children:(0,Y.jsx)(R,{id:`conn-database`,placeholder:B(e.dbms),value:e.database??``,onChange:e=>r(`database`,e.target.value.trim())})}),(0,Y.jsx)(Q,{label:n(`connection.form.user`),htmlFor:`conn-user`,children:(0,Y.jsx)(R,{id:`conn-user`,autoComplete:`off`,placeholder:V(e.dbms),value:e.user,onChange:e=>r(`user`,e.target.value)})}),(0,Y.jsx)(Q,{label:n(`connection.form.password`),htmlFor:`conn-pass`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(R,{id:`conn-pass`,type:`password`,autoComplete:`new-password`,value:e.pass,onChange:e=>r(`pass`,e.target.value)}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs whitespace-nowrap cursor-pointer`,title:n(`connection.form.savePasswordHint`),children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:e.savePassword??!0,onChange:e=>r(`savePassword`,e.target.checked)}),n(`connection.form.savePassword`)]})]})}),y&&(0,Y.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.managedTlsHint`)}),!y&&e.dbms!==`oracle`&&(0,Y.jsx)(Q,{label:n(`connection.form.tls`),children:(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,Y.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs cursor-pointer`,children:[(0,Y.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,Y.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs cursor-pointer ${e.ssl?``:`opacity-50`}`,title:n(`connection.form.tlsVerifyHint`),children:[(0,Y.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`)]})]})}),!y&&(0,Y.jsx)(Q,{label:n(`connection.form.charset`),children:(0,Y.jsxs)(d,{value:e.charset,onValueChange:e=>r(`charset`,e),children:[(0,Y.jsx)(c,{className:`w-full`,children:(0,Y.jsx)(s,{})}),(0,Y.jsx)(l,{children:X.map(e=>(0,Y.jsx)(u,{value:e,children:e},e))})]})})]}),!g&&!y&&!b&&!x&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.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,Y.jsx)(M,{className:`ml-2`})]}),(0,Y.jsx)(Q,{label:n(`connection.form.sshTunnel`),htmlFor:`conn-ssh`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`input`,{id:`conn-ssh`,type:`checkbox`,checked:C.enabled,onChange:e=>{(!e.target.checked||j(`ssh_tunnel`))&&P({enabled:e.target.checked})},className:`size-4 accent-primary cursor-pointer`}),(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`connection.form.sshTunnelHint`)})]})}),C.enabled&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Q,{label:n(`connection.form.sshHost`),htmlFor:`conn-ssh-host`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(R,{id:`conn-ssh-host`,placeholder:n(`connection.form.sshHostPlaceholder`),value:C.host,onChange:e=>P({host:e.target.value.trim()})}),(0,Y.jsx)(R,{"aria-label":n(`connection.form.sshPort`),type:`number`,className:`w-24 shrink-0`,value:C.port,onChange:e=>P({port:Number(e.target.value)||22})})]})}),(0,Y.jsx)(Q,{label:n(`connection.form.sshUser`),htmlFor:`conn-ssh-user`,children:(0,Y.jsx)(R,{id:`conn-ssh-user`,placeholder:n(`connection.form.sshUserPlaceholder`),value:C.user,onChange:e=>P({user:e.target.value.trim()})})}),(0,Y.jsx)(Q,{label:n(`connection.form.sshAuth`),children:(0,Y.jsxs)(d,{value:C.auth,onValueChange:e=>P({auth:e}),children:[(0,Y.jsx)(c,{className:`w-full`,children:(0,Y.jsx)(s,{})}),(0,Y.jsxs)(l,{children:[(0,Y.jsx)(u,{value:`key`,children:n(`connection.form.sshAuthKey`)}),(0,Y.jsx)(u,{value:`password`,children:n(`connection.form.sshAuthPassword`)}),(0,Y.jsx)(u,{value:`agent`,children:n(`connection.form.sshAuthAgent`)})]})]})}),C.auth===`password`&&(0,Y.jsx)(Q,{label:n(`connection.form.sshPassword`),htmlFor:`conn-ssh-pass`,children:(0,Y.jsx)(R,{id:`conn-ssh-pass`,type:`password`,autoComplete:`new-password`,value:C.password??``,onChange:e=>P({password:e.target.value})})}),C.auth===`key`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Q,{label:n(`connection.form.sshKey`),htmlFor:`conn-ssh-key`,children:(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`input`,{id:`conn-ssh-key`,type:`file`,className:`hidden`,onChange:e=>{F(e.target.files?.[0]),e.target.value=``}}),(0,Y.jsx)(o,{type:`button`,variant:`outline`,size:`sm`,className:`h-7 shrink-0 px-2 text-xs`,onClick:()=>document.getElementById(`conn-ssh-key`)?.click(),children:C.privateKey?n(`connection.form.changeFile`):n(`connection.form.sshKeyPick`)}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-xs text-muted-foreground`,title:C.privateKeyName,children:C.privateKey?C.privateKeyName||n(`connection.form.sshKeyLoaded`):n(`connection.form.sshKeyHint`)})]})}),(0,Y.jsx)(Q,{label:n(`connection.form.sshPassphrase`),htmlFor:`conn-ssh-passphrase`,children:(0,Y.jsx)(R,{id:`conn-ssh-passphrase`,type:`password`,autoComplete:`new-password`,placeholder:n(`connection.form.sshPassphrasePlaceholder`),value:C.passphrase??``,onChange:e=>P({passphrase:e.target.value})})})]}),C.auth===`agent`&&(0,Y.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.sshAuthAgentHint`)}),(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.sshTargetHint`)}),(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.sshSecretsHint`)})]})]}),(0,Y.jsx)(Q,{label:n(`connection.form.autoConnection`),htmlFor:`conn-auto`,children:(0,Y.jsx)(`div`,{className:`flex items-center`,children:(0,Y.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,Y.jsx)(`div`,{className:`mt-1 border-t pt-3 text-xs font-medium text-muted-foreground`,children:n(`connection.form.safety`)}),(0,Y.jsx)(Q,{label:n(`connection.form.environment`),children:(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[L.map(t=>{let n=(e.environmentColor??`none`)===t.id;return(0,Y.jsx)(`button`,{type:`button`,title:k(t.id),"aria-label":k(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,Y.jsx)(`span`,{className:`ml-1 text-xs text-muted-foreground`,children:n(`connection.form.environmentHint`)})]})}),(0,Y.jsx)(Q,{label:n(`connection.form.readOnly`),htmlFor:`conn-readonly`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.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,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`connection.form.readOnlyHint`)})]})}),S?.transactions!==!1&&(0,Y.jsx)(Q,{label:n(`connection.form.transactions`),children:(0,Y.jsxs)(d,{value:e.transactionMode??`auto`,onValueChange:e=>r(`transactionMode`,e),children:[(0,Y.jsx)(c,{className:`w-full`,children:(0,Y.jsx)(s,{})}),(0,Y.jsxs)(l,{children:[(0,Y.jsx)(u,{value:`auto`,children:n(`connection.form.txAuto`)}),(0,Y.jsx)(u,{value:`manual`,children:n(`connection.form.txManual`)})]})]})})]})}function $(){let{t:e}=a(),{activeDialog:t,closeDialog:i,showMessage:s}=n(),[c,l]=(0,W.useState)(!1),{savedConnections:u,addSavedConnection:d,updateSavedConnection:m,deleteSavedConnection:h,openConnection:T}=p(),O=r(`connect`)?.profileId,[k,j]=(0,W.useState)(()=>O??null),[M,I]=(0,W.useState)(()=>{let e=O?u.find(e=>e.id===O):void 0;return e?{...e}:null}),L=t===`connect`,[R,B]=(0,W.useState)(null),[V,G]=(0,W.useState)(null),K=z(e=>e.url),q=z(e=>e.token);(0,W.useEffect)(()=>{if(!L)return;let e=!1;return(async()=>{try{let t=await _();if(e||t.state!==`online`||!t.gateway){e||B(null);return}let n=await v();e||(B({name:n.gateway,profiles:n.profiles}),G(null))}catch(t){e||G(t instanceof Error?t.message:String(t))}})(),()=>{e=!0}},[L,K,q]);function J(t){let r=u.find(e=>e.gatewayProfile===t.name);if(r){Z(r);return}let i=re(t);d(i),Z(i),n.getState().setFooterMessage(e(`connection.dialog.gatewayAdded`,{name:t.name}))}function X(e){e||(i(),j(null),I(null))}function Z(e){j(e.id),I({...e})}function Q(e){I(e),m(e.id,e)}function $(){let e=P();d(e),j(e.id),I(e)}function pe(){k&&(h(k),j(null),I(null))}let[me,he]=(0,W.useState)(!1),ge=b(e=>e.addQueryTab);function _e(t){let n=p.getState().activeConnections.some(e=>e.id===t.id);if(T(t),x.getState().removeTree(t.id),f(t.id),n){i(),j(null),I(null);return}ge(t.id,{id:`tab-${Date.now()}`,title:e(`connection.dialog.firstQueryTab`),query:``,database:``,isExecuting:!1,results:[],error:null,executionTime:null}),i(),j(null),I(null)}async function ve(t){let r=await E(t.id,{interactive:!0});if(!r)return;let i={...t,file:r.fileName,serverConnectionId:r.connectionId};m(t.id,{file:r.fileName}),_e(i),p.getState().setFileDetached(t.id,r.fileDetached),r.restoredUnsaved?n.getState().setFooterMessage(e(r.diskChanged?`connection.dialog.restoredUnsavedDiskChanged`:`connection.dialog.restoredUnsaved`,{file:r.fileName})):r.wal&&!r.walApplied?n.getState().setFooterMessage(e(`connection.dialog.walPending`,{file:r.fileName})):r.walApplied&&n.getState().setFooterMessage(e(`connection.dialog.walApplied`,{file:r.fileName}))}async function ye(t,r){try{return await r(t)}catch(i){let a=y(i);if(!a||!(`ssh`in t)||!t.ssh||!await n.getState().requestDestructiveConfirm({title:e(`connection.dialog.hostKeyTitle`),description:e(`connection.dialog.hostKeyDescription`,a),confirmLabel:e(`connection.dialog.hostKeyAccept`)}))throw i;return r({...t,ssh:{...t.ssh,acceptHostKey:a.fingerprint}})}}async function be(){if(M){he(!0);try{if(S(M)===`browser`){await ve(M);return}let t=await ye(g(M),e=>w(e,M.authToken||void 0));t.success?_e({...M,serverConnectionId:t.connectionId}):s({tone:`error`,title:e(`connection.dialog.connectFailedTitle`),description:t.message??e(`connection.dialog.unknownError`)})}catch(t){s({tone:`error`,title:e(`connection.dialog.connectFailedTitle`),description:t instanceof Error?t.message:String(t)})}finally{he(!1)}}}async function xe(){if(M){if(S(M)===`browser`){s({tone:`info`,title:e(`connection.dialog.testConnection`),description:e(`connection.dialog.browserTestHint`)});return}l(!0);try{let t=await ye(g(M),e=>C(e,M.authToken||void 0));t.success?s({tone:`success`,title:e(`connection.dialog.testSuccess`),description:e(`connection.dialog.testSuccessDescription`)}):s({tone:`error`,title:e(`connection.dialog.testFailedTitle`),description:t.message??e(`connection.dialog.unknownError`)})}catch(t){s({tone:`error`,title:e(`connection.dialog.testFailedTitle`),description:t instanceof Error?t.message:String(t)})}finally{l(!1)}}}return(0,Y.jsx)(de,{open:L,onOpenChange:X,children:(0,Y.jsxs)(le,{className:`sm:max-w-[1100px] h-[85vh] max-h-[85vh] flex flex-col`,children:[(0,Y.jsx)(se,{children:(0,Y.jsx)(ue,{children:e(`connection.dialog.title`)})}),(0,Y.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,Y.jsx)(oe,{className:`mt-0.5 size-4 shrink-0 text-catppuccin-green`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{children:e(`connection.dialog.privacy`)})]}),(0,Y.jsxs)(`div`,{className:`flex flex-1 gap-4 overflow-hidden min-h-0`,children:[(0,Y.jsxs)(`div`,{className:`w-[460px] shrink-0 border rounded-md overflow-hidden flex flex-col`,children:[(R||V)&&(0,Y.jsxs)(`div`,{className:`border-b p-2 text-xs space-y-1 max-h-40 overflow-auto`,children:[(0,Y.jsxs)(`p`,{className:`font-medium`,children:[e(`connection.dialog.gatewayTitle`),R?` — ${R.name}`:``]}),V&&(0,Y.jsx)(`p`,{className:`text-destructive`,children:e(`connection.dialog.gatewayLoadFailed`,{error:V})}),R?.profiles.map(t=>(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Y.jsxs)(`span`,{className:`flex items-center gap-1.5 truncate`,children:[(0,Y.jsx)(H,{dbms:ne[t.driver],className:`size-3.5`}),(0,Y.jsx)(`span`,{className:`truncate`,children:t.name}),(0,Y.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,t.readOnly?e(`connection.dialog.gatewayReadOnly`):e(`connection.dialog.gatewayWritable`),`)`]})]}),(0,Y.jsx)(o,{size:`sm`,variant:`outline`,className:`h-6 px-2 text-xs`,onClick:()=>J(t),children:e(`connection.dialog.gatewayAdd`)})]},t.name))]}),(0,Y.jsx)(ee,{className:`h-full`,children:(0,Y.jsxs)(ie,{className:`table-fixed`,children:[(0,Y.jsx)(N,{children:(0,Y.jsxs)(A,{children:[(0,Y.jsx)(U,{className:`w-[32%]`,children:e(`connection.dialog.colHostName`)}),(0,Y.jsx)(U,{className:`w-[40%]`,children:e(`connection.dialog.colTarget`)}),(0,Y.jsx)(U,{className:`w-[28%]`,children:e(`connection.dialog.colDbms`)})]})}),(0,Y.jsx)(ae,{children:u.length===0?(0,Y.jsx)(A,{children:(0,Y.jsx)(F,{colSpan:3,className:`text-center text-muted-foreground`,children:e(`connection.dialog.noSaved`)})}):u.map(t=>(0,Y.jsxs)(A,{"data-state":k===t.id?`selected`:void 0,className:`cursor-pointer`,onClick:()=>Z(t),onDoubleClick:()=>{Z(t),be()},children:[(0,Y.jsx)(F,{className:`truncate font-medium`,title:t.hostName,children:t.hostName||e(`connection.dialog.unnamed`)}),(0,Y.jsx)(F,{className:`truncate`,title:t.dbms===`sqlite`?t.file:t.dbms===`d1`?t.databaseId:t.dbms===`do`?t.devUrl:`${t.user}@${t.host}:${t.port}`,children:t.dbms===`sqlite`?t.file||(S(t)===`browser`?e(`connection.dialog.pickOnConnect`):e(`connection.dialog.noFile`)):t.dbms===`d1`?t.databaseId||`—`:t.dbms===`do`?t.devUrl||`—`:`${t.user}@${t.host}:${t.port}`}),(0,Y.jsx)(F,{className:`truncate`,title:D(t.dbms).label,children:(0,Y.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(H,{dbms:t.dbms,className:`size-3.5`}),(0,Y.jsx)(`span`,{className:`truncate`,children:D(t.dbms).label})]})})]},t.id))})]})})]}),(0,Y.jsx)(`div`,{className:`flex-1 border rounded-md overflow-auto`,children:M?(0,Y.jsxs)(Y.Fragment,{children:[S(M)!==`browser`&&(0,Y.jsx)(`div`,{className:`p-4 pb-0`,children:(0,Y.jsx)(te,{})}),M.gatewayProfile?(0,Y.jsxs)(`div`,{className:`p-4 space-y-2 text-sm`,children:[(0,Y.jsxs)(`p`,{className:`font-medium flex items-center gap-2`,children:[(0,Y.jsx)(H,{dbms:M.dbms,className:`size-4`}),M.hostName]}),(0,Y.jsx)(`p`,{className:`text-muted-foreground`,children:e(`connection.dialog.gatewayProfileHint`,{name:M.gatewayProfile})}),(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[M.readOnly?e(`connection.dialog.gatewayReadOnly`):e(`connection.dialog.gatewayWritable`),M.database?` · ${M.database}`:``]})]}):(0,Y.jsx)(fe,{value:M,onChange:Q})]}):(0,Y.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground text-sm`,children:e(`connection.dialog.selectPrompt`)})})]}),(0,Y.jsxs)(ce,{className:`sm:justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(o,{variant:`outline`,onClick:$,children:e(`connection.dialog.addNew`)}),(0,Y.jsx)(o,{variant:`destructive`,onClick:pe,disabled:!k,children:e(`connection.dialog.delete`)})]}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(o,{variant:`outline`,onClick:xe,disabled:!M||c,children:e(`connection.dialog.testConnection`)}),(0,Y.jsx)(o,{onClick:be,disabled:!M||me,children:e(`connection.dialog.connect`)}),(0,Y.jsx)(o,{variant:`outline`,onClick:()=>X(!1),children:e(`connection.dialog.close`)})]})]})]})})}export{$ as ConnectDialog};
1
+ import{r as e}from"./hePW80VL.js";import{h as t,n,t as r}from"./XzPc-eVf.js";import{l as i,m as a,t as o}from"./CKOS5Y-e.js";import{a as s,i as c,n as l,r as u,t as d}from"./BGIwW6nZ.js";import{f,t as p}from"./DTxGpkJp.js";import{E as m,O as h,T as g,a as _,f as v,m as y}from"./BdPEUnLq.js";import{n as b}from"./CChaTOPr.js";import{S as x,d as S,g as C,i as w,l as T,r as E}from"./Cw_LYT6k.js";import{n as D,t as O}from"./C1RY7wUM.js";import{A as k,C as A,F as j,R as M,S as N,a as P,b as F,c as I,ct as ee,i as te,k as L,l as R,n as ne,nt as z,o as B,r as re,s as V,u as H,v as ie,x as U,y as ae,yt as oe}from"./B1lNzsWx.js";import{a as se,i as ce,n as le,o as ue,t as de}from"./DxuXBECK.js";var W=e(t(),1),G=new Set([`postgres:`,`postgresql:`]);function K(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(!G.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 q=new Set([`localhost`,`127.0.0.1`,`[::1]`,`::1`,`0.0.0.0`]);async function J(e,t){let n;try{let t=new URL(e);if(!q.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 Y=i(),X=[`utf8`,`utf8mb4`,`latin1`,`ascii`,`euckr`,`sjis`,`big5`],Z={enabled:!1,host:``,port:22,user:``,auth:`key`};function Q({label:e,htmlFor:t,children:n}){return(0,Y.jsxs)(`div`,{className:`grid grid-cols-[120px_minmax(0,1fr)] items-center gap-2`,children:[(0,Y.jsx)(I,{htmlFor:t,children:e}),n]})}function fe({value:e,onChange:t}){let{t:n}=a();function r(n,r){t({...e,[n]:r})}let[i,f]=(0,W.useState)([]),p=e.dbms===`d1`?e.devUrl??``:``;(0,W.useEffect)(()=>{if(!p){f([]);return}let e=new AbortController,t=setTimeout(()=>{J(p,e.signal).then(f)},300);return()=>{clearTimeout(t),e.abort()}},[p]);let g=e.dbms===`sqlite`,_=e.transport??`browser`,v=g&&_===`browser`,y=m.has(e.dbms),b=e.dbms===`d1`,x=e.dbms===`do`,S=O.find(t=>t.id===e.dbms)?.capabilities,C=e.ssh??Z,[w,E]=(0,W.useState)(``),D=w.trim()===``?`empty`:K(w)?`applied`:`invalid`,A=e.dbms===`supabase`&&e.port===6543;function N(n){E(n);let r=K(n);r&&t({...e,host:r.host??e.host,port:r.port??O.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 P(n){t({...e,ssh:{...C,...n}})}async function F(e){e&&P({privateKey:await e.text(),privateKeyName:e.name})}return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,Y.jsx)(Q,{label:n(`connection.form.hostName`),htmlFor:`conn-hostName`,children:(0,Y.jsx)(R,{id:`conn-hostName`,placeholder:n(`connection.form.hostNamePlaceholder`),value:e.hostName,onChange:e=>r(`hostName`,e.target.value)})}),(0,Y.jsx)(Q,{label:n(`connection.form.dataSource`),children:(0,Y.jsxs)(d,{value:e.dbms,onValueChange:n=>{let r=O.find(e=>e.id===n);if(!r)return;let i=r.id,a=m.has(i)||i===`d1`||i===`do`;E(``),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||y||b||x?V(i):e.user,devUrl:i===`do`?e.devUrl||`http://localhost:8787`:e.devUrl,database:e.database&&!a&&!y&&!b&&!x?e.database:B(i)??e.database})},children:[(0,Y.jsx)(c,{id:`conn-dbms`,className:`w-full`,children:(0,Y.jsx)(s,{})}),(0,Y.jsx)(l,{children:O.map(e=>(0,Y.jsx)(u,{value:e.id,children:(0,Y.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(H,{dbms:e.id}),e.label]})},e.id))})]})}),y&&(0,Y.jsx)(Q,{label:n(`connection.form.connectionString`),htmlFor:`conn-uri`,children:(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.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:w,onChange:e=>N(e.target.value)}),(0,Y.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`)})]})}),g&&(0,Y.jsxs)(Q,{label:n(`connection.form.openVia`),children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,Y.jsxs)(`label`,{className:`flex items-center gap-1.5 text-sm cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`radio`,name:`transport`,value:`browser`,checked:_===`browser`,onChange:()=>r(`transport`,`browser`),className:`accent-primary`}),n(`connection.form.viaBrowser`)]}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-1.5 text-sm cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`radio`,name:`transport`,value:`tunnel`,checked:_===`tunnel`,onChange:()=>r(`transport`,`tunnel`),className:`accent-primary`}),n(`connection.form.viaAgent`)]})]}),(0,Y.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(_===`browser`?`connection.form.viaBrowserHint`:`connection.form.viaAgentHint`)})]}),v?(0,Y.jsx)(Q,{label:n(`connection.form.databaseFile`),children:(0,Y.jsxs)(`div`,{className:`min-w-0 text-xs text-muted-foreground leading-relaxed`,children:[e.file?(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 break-all text-foreground`,title:e.file,children:e.file}),(0,Y.jsx)(o,{type:`button`,variant:`outline`,size:`sm`,className:`h-6 shrink-0 px-2 text-xs`,onClick:()=>{T(e.id),r(`file`,``)},children:n(`connection.form.changeFile`)})]}):(0,Y.jsx)(`p`,{children:n(`connection.form.filePickerHint`)}),(0,Y.jsx)(`p`,{className:`mt-1`,children:n(`connection.form.fileRememberedHint`)})]})}):null,!v&&(0,Y.jsx)(Q,{label:n(`connection.form.authToken`),htmlFor:`conn-authToken`,children:(0,Y.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())})}),v?null:x?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Q,{label:n(`connection.form.doDevUrl`),htmlFor:`conn-do-url`,children:(0,Y.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,Y.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.doHint`)}),(0,Y.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.doLimitsHint`)})]}):b?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Q,{label:n(`connection.form.d1DevUrl`),htmlFor:`conn-d1-dev`,children:(0,Y.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,Y.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.d1DevUrlHint`)}),(0,Y.jsx)(Q,{label:n(`connection.form.d1AccountId`),htmlFor:`conn-d1-account`,children:(0,Y.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,Y.jsx)(Q,{label:n(`connection.form.d1DatabaseId`),htmlFor:`conn-d1-database`,children:i.length>0?(0,Y.jsxs)(d,{value:e.databaseId??``,onValueChange:e=>r(`databaseId`,e),children:[(0,Y.jsx)(c,{id:`conn-d1-database`,children:(0,Y.jsx)(s,{placeholder:n(`connection.form.d1PickDatabase`)})}),(0,Y.jsx)(l,{children:i.map(e=>(0,Y.jsxs)(u,{value:e.id,children:[e.name,` · `,e.id]},e.id))})]}):(0,Y.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,Y.jsx)(Q,{label:n(`connection.form.d1ApiToken`),htmlFor:`conn-pass`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(R,{id:`conn-pass`,type:`password`,autoComplete:`new-password`,value:e.pass,onChange:e=>r(`pass`,e.target.value.trim())}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs whitespace-nowrap cursor-pointer`,title:n(`connection.form.savePasswordHint`),children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:e.savePassword??!0,onChange:e=>r(`savePassword`,e.target.checked)}),n(`connection.form.savePassword`)]})]})}),(0,Y.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.d1Hint`)}),(0,Y.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.d1LimitsHint`)})]}):g?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Q,{label:n(`connection.form.databaseFile`),htmlFor:`conn-file`,children:(0,Y.jsx)(R,{id:`conn-file`,placeholder:n(`connection.form.filePathPlaceholder`),value:e.file??``,onChange:e=>r(`file`,e.target.value)})}),(0,Y.jsx)(Q,{label:n(`connection.form.createIfMissing`),htmlFor:`conn-create`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.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,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`connection.form.createIfMissingHint`)})]})})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Q,{label:n(`connection.form.host`),htmlFor:`conn-host`,children:(0,Y.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,Y.jsx)(Q,{label:n(`connection.form.port`),htmlFor:`conn-port`,children:(0,Y.jsx)(R,{id:`conn-port`,type:`number`,value:e.port,onChange:t=>r(`port`,Number(t.target.value)||O.find(t=>t.id===e.dbms)?.defaultPort||3306)})}),A&&(0,Y.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`)}),(h(e.dbms)||e.dbms===`mssql`||e.dbms===`oracle`)&&(0,Y.jsx)(Q,{label:e.dbms===`oracle`?n(`connection.form.serviceName`):n(`connection.form.database`),htmlFor:`conn-database`,children:(0,Y.jsx)(R,{id:`conn-database`,placeholder:B(e.dbms),value:e.database??``,onChange:e=>r(`database`,e.target.value.trim())})}),(0,Y.jsx)(Q,{label:n(`connection.form.user`),htmlFor:`conn-user`,children:(0,Y.jsx)(R,{id:`conn-user`,autoComplete:`off`,placeholder:V(e.dbms),value:e.user,onChange:e=>r(`user`,e.target.value)})}),(0,Y.jsx)(Q,{label:n(`connection.form.password`),htmlFor:`conn-pass`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(R,{id:`conn-pass`,type:`password`,autoComplete:`new-password`,value:e.pass,onChange:e=>r(`pass`,e.target.value)}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs whitespace-nowrap cursor-pointer`,title:n(`connection.form.savePasswordHint`),children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:e.savePassword??!0,onChange:e=>r(`savePassword`,e.target.checked)}),n(`connection.form.savePassword`)]})]})}),y&&(0,Y.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.managedTlsHint`)}),!y&&e.dbms!==`oracle`&&(0,Y.jsx)(Q,{label:n(`connection.form.tls`),children:(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,Y.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs cursor-pointer`,children:[(0,Y.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,Y.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs cursor-pointer ${e.ssl?``:`opacity-50`}`,title:n(`connection.form.tlsVerifyHint`),children:[(0,Y.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`)]})]})}),!y&&(0,Y.jsx)(Q,{label:n(`connection.form.charset`),children:(0,Y.jsxs)(d,{value:e.charset,onValueChange:e=>r(`charset`,e),children:[(0,Y.jsx)(c,{className:`w-full`,children:(0,Y.jsx)(s,{})}),(0,Y.jsx)(l,{children:X.map(e=>(0,Y.jsx)(u,{value:e,children:e},e))})]})})]}),!g&&!y&&!b&&!x&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.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,Y.jsx)(M,{className:`ml-2`})]}),(0,Y.jsx)(Q,{label:n(`connection.form.sshTunnel`),htmlFor:`conn-ssh`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`input`,{id:`conn-ssh`,type:`checkbox`,checked:C.enabled,onChange:e=>{(!e.target.checked||j(`ssh_tunnel`))&&P({enabled:e.target.checked})},className:`size-4 accent-primary cursor-pointer`}),(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`connection.form.sshTunnelHint`)})]})}),C.enabled&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Q,{label:n(`connection.form.sshHost`),htmlFor:`conn-ssh-host`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(R,{id:`conn-ssh-host`,placeholder:n(`connection.form.sshHostPlaceholder`),value:C.host,onChange:e=>P({host:e.target.value.trim()})}),(0,Y.jsx)(R,{"aria-label":n(`connection.form.sshPort`),type:`number`,className:`w-24 shrink-0`,value:C.port,onChange:e=>P({port:Number(e.target.value)||22})})]})}),(0,Y.jsx)(Q,{label:n(`connection.form.sshUser`),htmlFor:`conn-ssh-user`,children:(0,Y.jsx)(R,{id:`conn-ssh-user`,placeholder:n(`connection.form.sshUserPlaceholder`),value:C.user,onChange:e=>P({user:e.target.value.trim()})})}),(0,Y.jsx)(Q,{label:n(`connection.form.sshAuth`),children:(0,Y.jsxs)(d,{value:C.auth,onValueChange:e=>P({auth:e}),children:[(0,Y.jsx)(c,{className:`w-full`,children:(0,Y.jsx)(s,{})}),(0,Y.jsxs)(l,{children:[(0,Y.jsx)(u,{value:`key`,children:n(`connection.form.sshAuthKey`)}),(0,Y.jsx)(u,{value:`password`,children:n(`connection.form.sshAuthPassword`)}),(0,Y.jsx)(u,{value:`agent`,children:n(`connection.form.sshAuthAgent`)})]})]})}),C.auth===`password`&&(0,Y.jsx)(Q,{label:n(`connection.form.sshPassword`),htmlFor:`conn-ssh-pass`,children:(0,Y.jsx)(R,{id:`conn-ssh-pass`,type:`password`,autoComplete:`new-password`,value:C.password??``,onChange:e=>P({password:e.target.value})})}),C.auth===`key`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Q,{label:n(`connection.form.sshKey`),htmlFor:`conn-ssh-key`,children:(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`input`,{id:`conn-ssh-key`,type:`file`,className:`hidden`,onChange:e=>{F(e.target.files?.[0]),e.target.value=``}}),(0,Y.jsx)(o,{type:`button`,variant:`outline`,size:`sm`,className:`h-7 shrink-0 px-2 text-xs`,onClick:()=>document.getElementById(`conn-ssh-key`)?.click(),children:C.privateKey?n(`connection.form.changeFile`):n(`connection.form.sshKeyPick`)}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-xs text-muted-foreground`,title:C.privateKeyName,children:C.privateKey?C.privateKeyName||n(`connection.form.sshKeyLoaded`):n(`connection.form.sshKeyHint`)})]})}),(0,Y.jsx)(Q,{label:n(`connection.form.sshPassphrase`),htmlFor:`conn-ssh-passphrase`,children:(0,Y.jsx)(R,{id:`conn-ssh-passphrase`,type:`password`,autoComplete:`new-password`,placeholder:n(`connection.form.sshPassphrasePlaceholder`),value:C.passphrase??``,onChange:e=>P({passphrase:e.target.value})})})]}),C.auth===`agent`&&(0,Y.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.sshAuthAgentHint`)}),(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.sshTargetHint`)}),(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.sshSecretsHint`)})]})]}),(0,Y.jsx)(Q,{label:n(`connection.form.autoConnection`),htmlFor:`conn-auto`,children:(0,Y.jsx)(`div`,{className:`flex items-center`,children:(0,Y.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,Y.jsx)(`div`,{className:`mt-1 border-t pt-3 text-xs font-medium text-muted-foreground`,children:n(`connection.form.safety`)}),(0,Y.jsx)(Q,{label:n(`connection.form.environment`),children:(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[L.map(t=>{let n=(e.environmentColor??`none`)===t.id;return(0,Y.jsx)(`button`,{type:`button`,title:k(t.id),"aria-label":k(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,Y.jsx)(`span`,{className:`ml-1 text-xs text-muted-foreground`,children:n(`connection.form.environmentHint`)})]})}),(0,Y.jsx)(Q,{label:n(`connection.form.readOnly`),htmlFor:`conn-readonly`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.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,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`connection.form.readOnlyHint`)})]})}),S?.transactions!==!1&&(0,Y.jsx)(Q,{label:n(`connection.form.transactions`),children:(0,Y.jsxs)(d,{value:e.transactionMode??`auto`,onValueChange:e=>r(`transactionMode`,e),children:[(0,Y.jsx)(c,{className:`w-full`,children:(0,Y.jsx)(s,{})}),(0,Y.jsxs)(l,{children:[(0,Y.jsx)(u,{value:`auto`,children:n(`connection.form.txAuto`)}),(0,Y.jsx)(u,{value:`manual`,children:n(`connection.form.txManual`)})]})]})})]})}function $(){let{t:e}=a(),{activeDialog:t,closeDialog:i,showMessage:s}=n(),[c,l]=(0,W.useState)(!1),{savedConnections:u,addSavedConnection:d,updateSavedConnection:m,deleteSavedConnection:h,openConnection:T}=p(),O=r(`connect`)?.profileId,[k,j]=(0,W.useState)(()=>O??null),[M,I]=(0,W.useState)(()=>{let e=O?u.find(e=>e.id===O):void 0;return e?{...e}:null}),L=t===`connect`,[R,B]=(0,W.useState)(null),[V,G]=(0,W.useState)(null),K=z(e=>e.url),q=z(e=>e.token);(0,W.useEffect)(()=>{if(!L)return;let e=!1;return(async()=>{try{let t=await _();if(e||t.state!==`online`||!t.gateway){e||B(null);return}let n=await v();e||(B({name:n.gateway,profiles:n.profiles}),G(null))}catch(t){e||G(t instanceof Error?t.message:String(t))}})(),()=>{e=!0}},[L,K,q]);function J(t){let r=u.find(e=>e.gatewayProfile===t.name);if(r){Z(r);return}let i=re(t);d(i),Z(i),n.getState().setFooterMessage(e(`connection.dialog.gatewayAdded`,{name:t.name}))}function X(e){e||(i(),j(null),I(null))}function Z(e){j(e.id),I({...e})}function Q(e){I(e),m(e.id,e)}function $(){let e=P();d(e),j(e.id),I(e)}function pe(){k&&(h(k),j(null),I(null))}let[me,he]=(0,W.useState)(!1),ge=b(e=>e.addQueryTab);function _e(t){let n=p.getState().activeConnections.some(e=>e.id===t.id);if(T(t),x.getState().removeTree(t.id),f(t.id),n){i(),j(null),I(null);return}ge(t.id,{id:`tab-${Date.now()}`,title:e(`connection.dialog.firstQueryTab`),query:``,database:``,isExecuting:!1,results:[],error:null,executionTime:null}),i(),j(null),I(null)}async function ve(t){let r=await E(t.id,{interactive:!0});if(!r)return;let i={...t,file:r.fileName,serverConnectionId:r.connectionId};m(t.id,{file:r.fileName}),_e(i),p.getState().setFileDetached(t.id,r.fileDetached),r.restoredUnsaved?n.getState().setFooterMessage(e(r.diskChanged?`connection.dialog.restoredUnsavedDiskChanged`:`connection.dialog.restoredUnsaved`,{file:r.fileName})):r.wal&&!r.walApplied?n.getState().setFooterMessage(e(`connection.dialog.walPending`,{file:r.fileName})):r.walApplied&&n.getState().setFooterMessage(e(`connection.dialog.walApplied`,{file:r.fileName}))}async function ye(t,r){try{return await r(t)}catch(i){let a=y(i);if(!a||!(`ssh`in t)||!t.ssh||!await n.getState().requestDestructiveConfirm({title:e(`connection.dialog.hostKeyTitle`),description:e(`connection.dialog.hostKeyDescription`,a),confirmLabel:e(`connection.dialog.hostKeyAccept`)}))throw i;return r({...t,ssh:{...t.ssh,acceptHostKey:a.fingerprint}})}}async function be(){if(M){he(!0);try{if(S(M)===`browser`){await ve(M);return}let t=await ye(g(M),e=>w(e,M.authToken||void 0));t.success?_e({...M,serverConnectionId:t.connectionId}):s({tone:`error`,title:e(`connection.dialog.connectFailedTitle`),description:t.message??e(`connection.dialog.unknownError`)})}catch(t){s({tone:`error`,title:e(`connection.dialog.connectFailedTitle`),description:t instanceof Error?t.message:String(t)})}finally{he(!1)}}}async function xe(){if(M){if(S(M)===`browser`){s({tone:`info`,title:e(`connection.dialog.testConnection`),description:e(`connection.dialog.browserTestHint`)});return}l(!0);try{let t=await ye(g(M),e=>C(e,M.authToken||void 0));t.success?s({tone:`success`,title:e(`connection.dialog.testSuccess`),description:e(`connection.dialog.testSuccessDescription`)}):s({tone:`error`,title:e(`connection.dialog.testFailedTitle`),description:t.message??e(`connection.dialog.unknownError`)})}catch(t){s({tone:`error`,title:e(`connection.dialog.testFailedTitle`),description:t instanceof Error?t.message:String(t)})}finally{l(!1)}}}return(0,Y.jsx)(de,{open:L,onOpenChange:X,children:(0,Y.jsxs)(le,{className:`sm:max-w-[1100px] h-[85vh] max-h-[85vh] flex flex-col`,children:[(0,Y.jsx)(se,{children:(0,Y.jsx)(ue,{children:e(`connection.dialog.title`)})}),(0,Y.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,Y.jsx)(oe,{className:`mt-0.5 size-4 shrink-0 text-catppuccin-green`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{children:e(`connection.dialog.privacy`)})]}),(0,Y.jsxs)(`div`,{className:`flex flex-1 gap-4 overflow-hidden min-h-0`,children:[(0,Y.jsxs)(`div`,{className:`w-[460px] shrink-0 border rounded-md overflow-hidden flex flex-col`,children:[(R||V)&&(0,Y.jsxs)(`div`,{className:`border-b p-2 text-xs space-y-1 max-h-40 overflow-auto`,children:[(0,Y.jsxs)(`p`,{className:`font-medium`,children:[e(`connection.dialog.gatewayTitle`),R?` — ${R.name}`:``]}),V&&(0,Y.jsx)(`p`,{className:`text-destructive`,children:e(`connection.dialog.gatewayLoadFailed`,{error:V})}),R?.profiles.map(t=>(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Y.jsxs)(`span`,{className:`flex items-center gap-1.5 truncate`,children:[(0,Y.jsx)(H,{dbms:ne[t.driver],className:`size-3.5`}),(0,Y.jsx)(`span`,{className:`truncate`,children:t.name}),(0,Y.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,t.readOnly?e(`connection.dialog.gatewayReadOnly`):e(`connection.dialog.gatewayWritable`),`)`]})]}),(0,Y.jsx)(o,{size:`sm`,variant:`outline`,className:`h-6 px-2 text-xs`,onClick:()=>J(t),children:e(`connection.dialog.gatewayAdd`)})]},t.name))]}),(0,Y.jsx)(ee,{className:`h-full`,children:(0,Y.jsxs)(ie,{className:`table-fixed`,children:[(0,Y.jsx)(N,{children:(0,Y.jsxs)(A,{children:[(0,Y.jsx)(U,{className:`w-[32%]`,children:e(`connection.dialog.colHostName`)}),(0,Y.jsx)(U,{className:`w-[40%]`,children:e(`connection.dialog.colTarget`)}),(0,Y.jsx)(U,{className:`w-[28%]`,children:e(`connection.dialog.colDbms`)})]})}),(0,Y.jsx)(ae,{children:u.length===0?(0,Y.jsx)(A,{children:(0,Y.jsx)(F,{colSpan:3,className:`text-center text-muted-foreground`,children:e(`connection.dialog.noSaved`)})}):u.map(t=>(0,Y.jsxs)(A,{"data-state":k===t.id?`selected`:void 0,className:`cursor-pointer`,onClick:()=>Z(t),onDoubleClick:()=>{Z(t),be()},children:[(0,Y.jsx)(F,{className:`truncate font-medium`,title:t.hostName,children:t.hostName||e(`connection.dialog.unnamed`)}),(0,Y.jsx)(F,{className:`truncate`,title:t.dbms===`sqlite`?t.file:t.dbms===`d1`?t.databaseId:t.dbms===`do`?t.devUrl:`${t.user}@${t.host}:${t.port}`,children:t.dbms===`sqlite`?t.file||(S(t)===`browser`?e(`connection.dialog.pickOnConnect`):e(`connection.dialog.noFile`)):t.dbms===`d1`?t.databaseId||`—`:t.dbms===`do`?t.devUrl||`—`:`${t.user}@${t.host}:${t.port}`}),(0,Y.jsx)(F,{className:`truncate`,title:D(t.dbms).label,children:(0,Y.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(H,{dbms:t.dbms,className:`size-3.5`}),(0,Y.jsx)(`span`,{className:`truncate`,children:D(t.dbms).label})]})})]},t.id))})]})})]}),(0,Y.jsx)(`div`,{className:`flex-1 border rounded-md overflow-auto`,children:M?(0,Y.jsxs)(Y.Fragment,{children:[S(M)!==`browser`&&(0,Y.jsx)(`div`,{className:`p-4 pb-0`,children:(0,Y.jsx)(te,{})}),M.gatewayProfile?(0,Y.jsxs)(`div`,{className:`p-4 space-y-2 text-sm`,children:[(0,Y.jsxs)(`p`,{className:`font-medium flex items-center gap-2`,children:[(0,Y.jsx)(H,{dbms:M.dbms,className:`size-4`}),M.hostName]}),(0,Y.jsx)(`p`,{className:`text-muted-foreground`,children:e(`connection.dialog.gatewayProfileHint`,{name:M.gatewayProfile})}),(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[M.readOnly?e(`connection.dialog.gatewayReadOnly`):e(`connection.dialog.gatewayWritable`),M.database?` · ${M.database}`:``]})]}):(0,Y.jsx)(fe,{value:M,onChange:Q})]}):(0,Y.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground text-sm`,children:e(`connection.dialog.selectPrompt`)})})]}),(0,Y.jsxs)(ce,{className:`sm:justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(o,{variant:`outline`,onClick:$,children:e(`connection.dialog.addNew`)}),(0,Y.jsx)(o,{variant:`destructive`,onClick:pe,disabled:!k,children:e(`connection.dialog.delete`)})]}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(o,{variant:`outline`,onClick:xe,disabled:!M||c,children:e(`connection.dialog.testConnection`)}),(0,Y.jsx)(o,{onClick:be,disabled:!M||me,children:e(`connection.dialog.connect`)}),(0,Y.jsx)(o,{variant:`outline`,onClick:()=>X(!1),children:e(`connection.dialog.close`)})]})]})]})})}export{$ as ConnectDialog};
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{h as t,n}from"./XzPc-eVf.js";import{a as r,i,l as a,m as o,t as s}from"./CKOS5Y-e.js";import{a as c}from"./ClyAuDY9.js";import{t as l}from"./DTxGpkJp.js";import{c as u}from"./Cw_LYT6k.js";import{t as d}from"./DbRMSZEW.js";import{Bt as f,C as p,Lt as ee,Mt as te,S as ne,Vt as re,b as m,bt as ie,v as h,x as g,xt as _,y as v,zt as ae}from"./D7Ze5md9.js";import{a as oe,i as se,n as ce,o as le,t as ue}from"./DxuXBECK.js";var de=r(`list-ordered`,[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]),y=r(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),b=r(`skull`,[[`path`,{d:`m12.5 17-.5-1-.5 1h1z`,key:`3me087`}],[`path`,{d:`M15 22a1 1 0 0 0 1-1v-1a2 2 0 0 0 1.56-3.25 8 8 0 1 0-11.12 0A2 2 0 0 0 8 20v1a1 1 0 0 0 1 1z`,key:`1o5pge`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}]]),x=r(`timer`,[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]),S=e(t(),1),C=a(),w=10,fe=[2,5,10,30];function T(){let e=l.getState();return e.activeConnections.find(t=>t.id===e.activeConnectionId)?.serverConnectionId??null}async function pe(){let e=T();if(!e)throw Error(c.t(`command.noActiveConnection`));let t=await u(e,d().getQuery(`SHOW_PROCESS_LIST`));return t.records.map(e=>{let n={};return t.fields.forEach((t,r)=>{n[t.name]=e[r]}),{...n,Id:String(n.Id)}})}function E(e){return/^(sleep|idle)/i.test(e.Command??``)}function me(e){return/lock/i.test(e.State??``)}function he(e){return/PROCESSLIST|pg_stat_activity/i.test(e.Info??``)}function D(e){let t=Number(e.Time);return Number.isFinite(t)?t:0}function O(e){return e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m ${e%60}s`:`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`}function k({icon:e,label:t,value:n,tone:r}){return(0,C.jsxs)(`div`,{className:`flex min-w-[120px] flex-1 items-center gap-2.5 rounded-md border bg-muted/30 px-3 py-1.5`,children:[(0,C.jsx)(`div`,{className:`flex size-7 shrink-0 items-center justify-center rounded-md [&_svg]:size-3.5 ${r===`warn`?`bg-catppuccin-yellow/15 text-catppuccin-yellow`:`bg-primary/10 text-primary`}`,children:e}),(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsx)(`div`,{className:`text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:t}),(0,C.jsx)(`div`,{className:`truncate text-sm font-semibold tabular-nums`,children:n})]})]})}function A(){let{t:e}=o(),{activeDialog:t,closeDialog:r,setFooterMessage:a,requestDestructiveConfirm:c}=n(),[l,A]=(0,S.useState)([]),[j,M]=(0,S.useState)(!1),[N,P]=(0,S.useState)(5),[F,I]=(0,S.useState)(null),[L,R]=(0,S.useState)(``),[z,ge]=(0,S.useState)(!1),[B,_e]=(0,S.useState)(!0),[V,H]=(0,S.useState)(!1),[U,ve]=(0,S.useState)(null),[W,G]=(0,S.useState)(!1),K=(0,S.useRef)(null),q=t===`process-list`,J=(0,S.useCallback)(()=>Promise.resolve().then(()=>(H(!0),pe())).then(e=>{A(e),ve(new Date)}).catch(t=>a(e(`command.processList.loadError`,{message:t instanceof Error?t.message:String(t)}))).finally(()=>H(!1)),[a,e]);(0,S.useEffect)(()=>{q&&J()},[q,J]),(0,S.useEffect)(()=>(K.current&&=(clearInterval(K.current),null),j&&q&&(K.current=setInterval(()=>{J()},N*1e3)),()=>{K.current&&=(clearInterval(K.current),null)}),[j,N,q,J]);function Y(e){e||(M(!1),I(null),R(``),r())}let X=(0,S.useMemo)(()=>{let e=l.filter(E).length,t=l.filter(e=>!E(e)).reduce((e,t)=>Math.max(e,D(t)),0);return{total:l.length,active:l.length-e,idle:e,longest:t}},[l]),Z=(0,S.useMemo)(()=>{let e=L.trim().toLowerCase();return l.filter(t=>z&&E(t)?!1:!e||[t.Id,t.User,t.Host,t.db,t.Command,t.State,t.Info].some(t=>(t??``).toString().toLowerCase().includes(e))).sort((e,t)=>B?D(t)-D(e):D(e)-D(t))},[l,L,z,B]),Q=l.find(e=>e.Id===F)??null,ye=(0,S.useCallback)(()=>{Q?.Info&&navigator.clipboard.writeText(Q.Info).then(()=>{G(!0),setTimeout(()=>G(!1),1500)})},[Q]);async function $(t){let n=t??F;if(!n){a(e(`command.processList.selectToKill`));return}let r=T();if(!r)return;let i=l.find(e=>e.Id===n),o=d().getQuery(`KILL_QUERY`,String(n));if(await c({title:e(`command.processList.killConfirmTitle`,{id:n}),description:e(`command.processList.killConfirmDescription`,{user:i?.User??`?`,host:i?.Host??`?`}),confirmLabel:e(`command.processList.killProcess`),statements:[o]}))try{await u(r,o),a(e(`command.processList.killed`,{id:n})),F===n&&I(null),J()}catch(t){a(e(`command.processList.killError`,{message:t instanceof Error?t.message:String(t)}))}}return(0,C.jsx)(ue,{open:q,onOpenChange:Y,children:(0,C.jsxs)(ce,{className:`flex max-h-[85vh] flex-col sm:max-w-[1000px]`,children:[(0,C.jsx)(oe,{children:(0,C.jsxs)(le,{className:`flex items-center gap-2`,children:[e(`command.processList.title`),U&&(0,C.jsx)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:e(`command.processList.updatedAt`,{time:U.toLocaleTimeString(void 0,{hour12:!1})})})]})}),(0,C.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,C.jsx)(k,{icon:(0,C.jsx)(de,{}),label:e(`command.processList.stats.total`),value:X.total}),(0,C.jsx)(k,{icon:(0,C.jsx)(re,{}),label:e(`command.processList.stats.active`),value:X.active}),(0,C.jsx)(k,{icon:(0,C.jsx)(y,{}),label:e(`command.processList.stats.idle`),value:X.idle}),(0,C.jsx)(k,{icon:(0,C.jsx)(x,{}),label:e(`command.processList.stats.longest`),value:O(X.longest),tone:X.longest>=w?`warn`:void 0})]}),(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,C.jsxs)(`div`,{className:`relative`,children:[(0,C.jsx)(ie,{className:`pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground`}),(0,C.jsx)(`input`,{className:`h-7 w-56 rounded border bg-background pl-7 pr-6 text-xs placeholder:text-muted-foreground`,placeholder:e(`command.processList.filterPlaceholder`),value:L,onChange:e=>R(e.target.value)}),L&&(0,C.jsx)(`button`,{type:`button`,className:`absolute right-1.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,onClick:()=>R(``),children:(0,C.jsx)(i,{className:`size-3`})})]}),(0,C.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5 text-xs`,children:[(0,C.jsx)(`input`,{type:`checkbox`,className:`accent-primary`,checked:z,onChange:e=>ge(e.target.checked)}),e(`command.processList.hideIdle`)]}),(0,C.jsx)(`div`,{className:`flex-1`}),(0,C.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5 text-xs`,children:[(0,C.jsx)(`input`,{type:`checkbox`,className:`accent-primary`,checked:j,onChange:e=>M(e.target.checked)}),e(`command.processList.autoRefresh`)]}),(0,C.jsx)(`select`,{className:`h-7 rounded border bg-background px-1.5 text-xs disabled:opacity-50`,value:N,onChange:e=>P(Number(e.target.value)),disabled:!j,children:fe.map(e=>(0,C.jsxs)(`option`,{value:e,children:[e,`s`]},e))}),(0,C.jsxs)(s,{variant:`outline`,size:`sm`,className:`h-7`,onClick:()=>{J()},disabled:V,children:[(0,C.jsx)(_,{className:`mr-1 size-3.5 ${V?`animate-spin`:``}`}),e(`command.processList.refresh`)]})]}),(0,C.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded-md border`,children:(0,C.jsxs)(h,{className:`text-xs`,children:[(0,C.jsx)(ne,{className:`sticky top-0 z-10 bg-background`,children:(0,C.jsxs)(p,{children:[(0,C.jsx)(g,{className:`w-[70px]`,children:e(`command.processList.columns.id`)}),(0,C.jsx)(g,{className:`w-[100px]`,children:e(`command.processList.columns.user`)}),(0,C.jsx)(g,{className:`w-[130px]`,children:e(`command.processList.columns.host`)}),(0,C.jsx)(g,{className:`w-[100px]`,children:e(`command.processList.columns.db`)}),(0,C.jsx)(g,{className:`w-[90px]`,children:e(`command.processList.columns.command`)}),(0,C.jsx)(g,{className:`w-[80px] cursor-pointer select-none`,onClick:()=>_e(e=>!e),children:(0,C.jsxs)(`span`,{className:`flex items-center gap-1`,children:[e(`command.processList.columns.time`),B?(0,C.jsx)(f,{className:`size-3 text-primary`}):(0,C.jsx)(ae,{className:`size-3 text-primary`})]})}),(0,C.jsx)(g,{className:`w-[130px]`,children:e(`command.processList.columns.state`)}),(0,C.jsx)(g,{children:e(`command.processList.columns.info`)}),(0,C.jsx)(g,{className:`w-[50px]`})]})}),(0,C.jsx)(v,{children:Z.length===0?(0,C.jsx)(p,{children:(0,C.jsx)(m,{colSpan:9,className:`py-8 text-center text-muted-foreground`,children:l.length===0?e(`command.processList.empty`):e(`command.processList.noMatch`)})}):Z.map(t=>{let n=E(t),r=D(t),i=!n&&r>=w,a=me(t),o=he(t);return(0,C.jsxs)(p,{"data-state":F===t.Id?`selected`:void 0,className:`cursor-pointer ${n?`text-muted-foreground`:``} ${a?`bg-destructive/5`:i?`bg-catppuccin-yellow/5`:``}`,onClick:()=>I(t.Id),children:[(0,C.jsx)(m,{className:`font-mono tabular-nums`,children:(0,C.jsxs)(`span`,{className:`flex items-center gap-1`,children:[t.Id,o&&(0,C.jsx)(`span`,{className:`rounded bg-primary/10 px-1 text-[9px] font-semibold text-primary`,title:e(`command.processList.selfHint`),children:e(`command.processList.self`)})]})}),(0,C.jsx)(m,{children:t.User}),(0,C.jsx)(m,{className:`font-mono`,children:t.Host}),(0,C.jsx)(m,{className:`font-mono`,children:t.db??``}),(0,C.jsx)(m,{children:(0,C.jsx)(`span`,{className:`rounded px-1.5 py-px text-[10px] font-medium ${n?`bg-muted`:`bg-green-500/10 text-green-600 dark:text-green-400`}`,children:t.Command})}),(0,C.jsx)(m,{className:`tabular-nums ${i?`font-semibold text-catppuccin-yellow`:``}`,children:O(r)}),(0,C.jsx)(m,{className:a?`font-medium text-destructive`:``,children:t.State}),(0,C.jsx)(m,{className:`max-w-[260px] truncate font-mono`,title:t.Info??``,children:t.Info??``}),(0,C.jsx)(m,{className:`text-right`,children:(0,C.jsx)(`button`,{type:`button`,className:`rounded p-1 text-muted-foreground hover:bg-destructive/10 hover:text-destructive`,title:e(`command.processList.kill`),onClick:e=>{e.stopPropagation(),$(t.Id)},children:(0,C.jsx)(b,{className:`size-3.5`})})})]},t.Id)})})]})}),Q&&(0,C.jsxs)(`div`,{className:`shrink-0 rounded-md border`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2 border-b bg-muted/30 px-3 py-1`,children:[(0,C.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:e(`command.processList.statementOf`,{id:Q.Id})}),(0,C.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[Q.User,`@`,Q.Host,Q.db?` · ${Q.db}`:``]}),(0,C.jsx)(`div`,{className:`flex-1`}),(0,C.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-40`,onClick:ye,disabled:!Q.Info,children:[W?(0,C.jsx)(ee,{className:`size-3`}):(0,C.jsx)(te,{className:`size-3`}),e(W?`command.processList.copied`:`command.processList.copy`)]})]}),(0,C.jsx)(`pre`,{className:`max-h-32 overflow-auto whitespace-pre-wrap break-words px-3 py-2 font-mono text-xs`,children:Q.Info||(0,C.jsx)(`span`,{className:`italic text-muted-foreground`,children:e(`command.processList.noStatement`)})})]}),(0,C.jsxs)(se,{children:[(0,C.jsx)(s,{variant:`destructive`,onClick:()=>{$()},disabled:!F,children:e(`command.processList.killProcess`)}),(0,C.jsx)(s,{variant:`outline`,onClick:()=>Y(!1),children:e(`command.close`)})]})]})})}export{A as ProcessListDialog};
1
+ import{r as e}from"./hePW80VL.js";import{h as t,n}from"./XzPc-eVf.js";import{a as r,i,l as a,m as o,t as s}from"./CKOS5Y-e.js";import{a as c}from"./ClyAuDY9.js";import{t as l}from"./DTxGpkJp.js";import{c as u}from"./Cw_LYT6k.js";import{t as d}from"./DbRMSZEW.js";import{Bt as f,C as p,Lt as ee,Mt as te,S as ne,Vt as re,b as m,bt as ie,v as h,x as g,xt as _,y as v,zt as ae}from"./B1lNzsWx.js";import{a as oe,i as se,n as ce,o as le,t as ue}from"./DxuXBECK.js";var de=r(`list-ordered`,[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]),y=r(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),b=r(`skull`,[[`path`,{d:`m12.5 17-.5-1-.5 1h1z`,key:`3me087`}],[`path`,{d:`M15 22a1 1 0 0 0 1-1v-1a2 2 0 0 0 1.56-3.25 8 8 0 1 0-11.12 0A2 2 0 0 0 8 20v1a1 1 0 0 0 1 1z`,key:`1o5pge`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}]]),x=r(`timer`,[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]),S=e(t(),1),C=a(),w=10,fe=[2,5,10,30];function T(){let e=l.getState();return e.activeConnections.find(t=>t.id===e.activeConnectionId)?.serverConnectionId??null}async function pe(){let e=T();if(!e)throw Error(c.t(`command.noActiveConnection`));let t=await u(e,d().getQuery(`SHOW_PROCESS_LIST`));return t.records.map(e=>{let n={};return t.fields.forEach((t,r)=>{n[t.name]=e[r]}),{...n,Id:String(n.Id)}})}function E(e){return/^(sleep|idle)/i.test(e.Command??``)}function me(e){return/lock/i.test(e.State??``)}function he(e){return/PROCESSLIST|pg_stat_activity/i.test(e.Info??``)}function D(e){let t=Number(e.Time);return Number.isFinite(t)?t:0}function O(e){return e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m ${e%60}s`:`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`}function k({icon:e,label:t,value:n,tone:r}){return(0,C.jsxs)(`div`,{className:`flex min-w-[120px] flex-1 items-center gap-2.5 rounded-md border bg-muted/30 px-3 py-1.5`,children:[(0,C.jsx)(`div`,{className:`flex size-7 shrink-0 items-center justify-center rounded-md [&_svg]:size-3.5 ${r===`warn`?`bg-catppuccin-yellow/15 text-catppuccin-yellow`:`bg-primary/10 text-primary`}`,children:e}),(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsx)(`div`,{className:`text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:t}),(0,C.jsx)(`div`,{className:`truncate text-sm font-semibold tabular-nums`,children:n})]})]})}function A(){let{t:e}=o(),{activeDialog:t,closeDialog:r,setFooterMessage:a,requestDestructiveConfirm:c}=n(),[l,A]=(0,S.useState)([]),[j,M]=(0,S.useState)(!1),[N,P]=(0,S.useState)(5),[F,I]=(0,S.useState)(null),[L,R]=(0,S.useState)(``),[z,ge]=(0,S.useState)(!1),[B,_e]=(0,S.useState)(!0),[V,H]=(0,S.useState)(!1),[U,ve]=(0,S.useState)(null),[W,G]=(0,S.useState)(!1),K=(0,S.useRef)(null),q=t===`process-list`,J=(0,S.useCallback)(()=>Promise.resolve().then(()=>(H(!0),pe())).then(e=>{A(e),ve(new Date)}).catch(t=>a(e(`command.processList.loadError`,{message:t instanceof Error?t.message:String(t)}))).finally(()=>H(!1)),[a,e]);(0,S.useEffect)(()=>{q&&J()},[q,J]),(0,S.useEffect)(()=>(K.current&&=(clearInterval(K.current),null),j&&q&&(K.current=setInterval(()=>{J()},N*1e3)),()=>{K.current&&=(clearInterval(K.current),null)}),[j,N,q,J]);function Y(e){e||(M(!1),I(null),R(``),r())}let X=(0,S.useMemo)(()=>{let e=l.filter(E).length,t=l.filter(e=>!E(e)).reduce((e,t)=>Math.max(e,D(t)),0);return{total:l.length,active:l.length-e,idle:e,longest:t}},[l]),Z=(0,S.useMemo)(()=>{let e=L.trim().toLowerCase();return l.filter(t=>z&&E(t)?!1:!e||[t.Id,t.User,t.Host,t.db,t.Command,t.State,t.Info].some(t=>(t??``).toString().toLowerCase().includes(e))).sort((e,t)=>B?D(t)-D(e):D(e)-D(t))},[l,L,z,B]),Q=l.find(e=>e.Id===F)??null,ye=(0,S.useCallback)(()=>{Q?.Info&&navigator.clipboard.writeText(Q.Info).then(()=>{G(!0),setTimeout(()=>G(!1),1500)})},[Q]);async function $(t){let n=t??F;if(!n){a(e(`command.processList.selectToKill`));return}let r=T();if(!r)return;let i=l.find(e=>e.Id===n),o=d().getQuery(`KILL_QUERY`,String(n));if(await c({title:e(`command.processList.killConfirmTitle`,{id:n}),description:e(`command.processList.killConfirmDescription`,{user:i?.User??`?`,host:i?.Host??`?`}),confirmLabel:e(`command.processList.killProcess`),statements:[o]}))try{await u(r,o),a(e(`command.processList.killed`,{id:n})),F===n&&I(null),J()}catch(t){a(e(`command.processList.killError`,{message:t instanceof Error?t.message:String(t)}))}}return(0,C.jsx)(ue,{open:q,onOpenChange:Y,children:(0,C.jsxs)(ce,{className:`flex max-h-[85vh] flex-col sm:max-w-[1000px]`,children:[(0,C.jsx)(oe,{children:(0,C.jsxs)(le,{className:`flex items-center gap-2`,children:[e(`command.processList.title`),U&&(0,C.jsx)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:e(`command.processList.updatedAt`,{time:U.toLocaleTimeString(void 0,{hour12:!1})})})]})}),(0,C.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,C.jsx)(k,{icon:(0,C.jsx)(de,{}),label:e(`command.processList.stats.total`),value:X.total}),(0,C.jsx)(k,{icon:(0,C.jsx)(re,{}),label:e(`command.processList.stats.active`),value:X.active}),(0,C.jsx)(k,{icon:(0,C.jsx)(y,{}),label:e(`command.processList.stats.idle`),value:X.idle}),(0,C.jsx)(k,{icon:(0,C.jsx)(x,{}),label:e(`command.processList.stats.longest`),value:O(X.longest),tone:X.longest>=w?`warn`:void 0})]}),(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,C.jsxs)(`div`,{className:`relative`,children:[(0,C.jsx)(ie,{className:`pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground`}),(0,C.jsx)(`input`,{className:`h-7 w-56 rounded border bg-background pl-7 pr-6 text-xs placeholder:text-muted-foreground`,placeholder:e(`command.processList.filterPlaceholder`),value:L,onChange:e=>R(e.target.value)}),L&&(0,C.jsx)(`button`,{type:`button`,className:`absolute right-1.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,onClick:()=>R(``),children:(0,C.jsx)(i,{className:`size-3`})})]}),(0,C.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5 text-xs`,children:[(0,C.jsx)(`input`,{type:`checkbox`,className:`accent-primary`,checked:z,onChange:e=>ge(e.target.checked)}),e(`command.processList.hideIdle`)]}),(0,C.jsx)(`div`,{className:`flex-1`}),(0,C.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5 text-xs`,children:[(0,C.jsx)(`input`,{type:`checkbox`,className:`accent-primary`,checked:j,onChange:e=>M(e.target.checked)}),e(`command.processList.autoRefresh`)]}),(0,C.jsx)(`select`,{className:`h-7 rounded border bg-background px-1.5 text-xs disabled:opacity-50`,value:N,onChange:e=>P(Number(e.target.value)),disabled:!j,children:fe.map(e=>(0,C.jsxs)(`option`,{value:e,children:[e,`s`]},e))}),(0,C.jsxs)(s,{variant:`outline`,size:`sm`,className:`h-7`,onClick:()=>{J()},disabled:V,children:[(0,C.jsx)(_,{className:`mr-1 size-3.5 ${V?`animate-spin`:``}`}),e(`command.processList.refresh`)]})]}),(0,C.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded-md border`,children:(0,C.jsxs)(h,{className:`text-xs`,children:[(0,C.jsx)(ne,{className:`sticky top-0 z-10 bg-background`,children:(0,C.jsxs)(p,{children:[(0,C.jsx)(g,{className:`w-[70px]`,children:e(`command.processList.columns.id`)}),(0,C.jsx)(g,{className:`w-[100px]`,children:e(`command.processList.columns.user`)}),(0,C.jsx)(g,{className:`w-[130px]`,children:e(`command.processList.columns.host`)}),(0,C.jsx)(g,{className:`w-[100px]`,children:e(`command.processList.columns.db`)}),(0,C.jsx)(g,{className:`w-[90px]`,children:e(`command.processList.columns.command`)}),(0,C.jsx)(g,{className:`w-[80px] cursor-pointer select-none`,onClick:()=>_e(e=>!e),children:(0,C.jsxs)(`span`,{className:`flex items-center gap-1`,children:[e(`command.processList.columns.time`),B?(0,C.jsx)(f,{className:`size-3 text-primary`}):(0,C.jsx)(ae,{className:`size-3 text-primary`})]})}),(0,C.jsx)(g,{className:`w-[130px]`,children:e(`command.processList.columns.state`)}),(0,C.jsx)(g,{children:e(`command.processList.columns.info`)}),(0,C.jsx)(g,{className:`w-[50px]`})]})}),(0,C.jsx)(v,{children:Z.length===0?(0,C.jsx)(p,{children:(0,C.jsx)(m,{colSpan:9,className:`py-8 text-center text-muted-foreground`,children:l.length===0?e(`command.processList.empty`):e(`command.processList.noMatch`)})}):Z.map(t=>{let n=E(t),r=D(t),i=!n&&r>=w,a=me(t),o=he(t);return(0,C.jsxs)(p,{"data-state":F===t.Id?`selected`:void 0,className:`cursor-pointer ${n?`text-muted-foreground`:``} ${a?`bg-destructive/5`:i?`bg-catppuccin-yellow/5`:``}`,onClick:()=>I(t.Id),children:[(0,C.jsx)(m,{className:`font-mono tabular-nums`,children:(0,C.jsxs)(`span`,{className:`flex items-center gap-1`,children:[t.Id,o&&(0,C.jsx)(`span`,{className:`rounded bg-primary/10 px-1 text-[9px] font-semibold text-primary`,title:e(`command.processList.selfHint`),children:e(`command.processList.self`)})]})}),(0,C.jsx)(m,{children:t.User}),(0,C.jsx)(m,{className:`font-mono`,children:t.Host}),(0,C.jsx)(m,{className:`font-mono`,children:t.db??``}),(0,C.jsx)(m,{children:(0,C.jsx)(`span`,{className:`rounded px-1.5 py-px text-[10px] font-medium ${n?`bg-muted`:`bg-green-500/10 text-green-600 dark:text-green-400`}`,children:t.Command})}),(0,C.jsx)(m,{className:`tabular-nums ${i?`font-semibold text-catppuccin-yellow`:``}`,children:O(r)}),(0,C.jsx)(m,{className:a?`font-medium text-destructive`:``,children:t.State}),(0,C.jsx)(m,{className:`max-w-[260px] truncate font-mono`,title:t.Info??``,children:t.Info??``}),(0,C.jsx)(m,{className:`text-right`,children:(0,C.jsx)(`button`,{type:`button`,className:`rounded p-1 text-muted-foreground hover:bg-destructive/10 hover:text-destructive`,title:e(`command.processList.kill`),onClick:e=>{e.stopPropagation(),$(t.Id)},children:(0,C.jsx)(b,{className:`size-3.5`})})})]},t.Id)})})]})}),Q&&(0,C.jsxs)(`div`,{className:`shrink-0 rounded-md border`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2 border-b bg-muted/30 px-3 py-1`,children:[(0,C.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:e(`command.processList.statementOf`,{id:Q.Id})}),(0,C.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[Q.User,`@`,Q.Host,Q.db?` · ${Q.db}`:``]}),(0,C.jsx)(`div`,{className:`flex-1`}),(0,C.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-40`,onClick:ye,disabled:!Q.Info,children:[W?(0,C.jsx)(ee,{className:`size-3`}):(0,C.jsx)(te,{className:`size-3`}),e(W?`command.processList.copied`:`command.processList.copy`)]})]}),(0,C.jsx)(`pre`,{className:`max-h-32 overflow-auto whitespace-pre-wrap break-words px-3 py-2 font-mono text-xs`,children:Q.Info||(0,C.jsx)(`span`,{className:`italic text-muted-foreground`,children:e(`command.processList.noStatement`)})})]}),(0,C.jsxs)(se,{children:[(0,C.jsx)(s,{variant:`destructive`,onClick:()=>{$()},disabled:!F,children:e(`command.processList.killProcess`)}),(0,C.jsx)(s,{variant:`outline`,onClick:()=>Y(!1),children:e(`command.close`)})]})]})})}export{A as ProcessListDialog};
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{c as t,h as n,n as r,t as i}from"./XzPc-eVf.js";import{l as a,m as o,t as s}from"./CKOS5Y-e.js";import{a as c,i as l,n as u,r as d,t as f}from"./D_2UqK4k.js";import{t as p}from"./DTxGpkJp.js";import{a as m}from"./Cw_LYT6k.js";import{n as h}from"./DbRMSZEW.js";import{t as ee}from"./B3LyCSVJ.js";import{J as g,Y as _,c as v,l as y}from"./D7Ze5md9.js";import{a as b,i as x,n as S,o as C,t as w}from"./DxuXBECK.js";var T=e(n(),1),E=a(),D=e=>e instanceof Error?e.message:String(e);function O(){let{t:e}=o(),n=r(e=>e.activeDialog),a=r(e=>e.closeDialog),O=i(`link-column`),k=n===`link-column`&&!!O,A=O?.connectionId??``,j=p(e=>e.activeConnections),M=j.filter(e=>e.serverConnectionId),N=_(e=>e.links),P=_(e=>e.setLink),F=_(e=>e.removeLink),I=O?g(N,A,O.database,O.table).find(e=>e.column===O.column)??null:null,[L,R]=(0,T.useState)(I?.targetConnectionId??A),z=j.find(e=>e.id===L)?.serverConnectionId,[B,V]=(0,T.useState)([]),[H,U]=(0,T.useState)([]),[W,G]=(0,T.useState)([]),[K,q]=(0,T.useState)(I?.targetDatabase??O?.database??``),[J,Y]=(0,T.useState)(I?.targetTable??``),[X,Z]=(0,T.useState)(I?.targetColumn??``),[Q,$]=(0,T.useState)(null);if((0,T.useEffect)(()=>{if(!k||!z)return;let e=!1;return(async()=>{try{let t=await h(L).introspect.listDatabases(m(z));if(e)return;V(t),q(e=>t.includes(e)?e:t[0]??``)}catch(t){e||$(D(t))}})(),()=>{e=!0}},[k,z,L]),(0,T.useEffect)(()=>{if(!k||!z||!K)return;let e=!1;return(async()=>{try{let t=await h(L).introspect.listTables(m(z),K);if(e)return;U(t.map(e=>e.name))}catch(t){e||$(D(t))}})(),()=>{e=!0}},[k,z,L,K]),(0,T.useEffect)(()=>{if(!k||!z||!K||!J)return;let e=!1;return(async()=>{try{let t=await h(L).introspect.listColumns(m(z),K,J);if(e)return;G(t.map(e=>e.name)),Z(e=>t.some(t=>t.name===e)?e:t.find(e=>e.key===`PRI`)?.name??t[0]?.name??``)}catch(t){e||$(D(t))}})(),()=>{e=!0}},[k,z,L,K,J]),!O)return null;function te(){if(!O||!K||!J||!X)return;let e=L!==A;P(A,{database:O.database,table:O.table,column:O.column,...e?{targetConnectionId:L}:{},targetDatabase:K,targetTable:J,targetColumn:X}),ee(`column_link`),t(`column_link_set`,{dbms:h(A).id,target_dbms:h(L).id,cross_database:K!==O.database,cross_connection:e}),a()}function ne(){O&&(F(A,O),a())}return(0,E.jsx)(w,{open:k,onOpenChange:e=>{e||a()},children:(0,E.jsxs)(S,{className:`sm:max-w-[460px]`,children:[(0,E.jsx)(b,{children:(0,E.jsx)(C,{children:e(`result.link.title`)})}),(0,E.jsxs)(`div`,{className:`space-y-4`,children:[(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(v,{children:e(`result.link.source`)}),(0,E.jsx)(y,{value:`${O.database}.${O.table}.${O.column}`,disabled:!0})]}),(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`result.link.hint`)}),(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(v,{htmlFor:`link-conn`,children:e(`result.link.targetConnection`)}),(0,E.jsxs)(f,{value:L,onValueChange:e=>{R(e),Y(``),U([]),G([])},children:[(0,E.jsx)(l,{id:`link-conn`,className:`w-full`,children:(0,E.jsx)(c,{})}),(0,E.jsx)(u,{children:M.map(e=>(0,E.jsx)(d,{value:e.id,children:e.hostName||e.host||e.file||e.id},e.id))})]})]}),(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(v,{htmlFor:`link-db`,children:e(`result.link.targetDatabase`)}),(0,E.jsxs)(f,{value:K,onValueChange:e=>{q(e),Y(``),G([])},children:[(0,E.jsx)(l,{id:`link-db`,className:`w-full`,children:(0,E.jsx)(c,{})}),(0,E.jsx)(u,{children:B.map(e=>(0,E.jsx)(d,{value:e,children:e},e))})]})]}),(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(v,{htmlFor:`link-table`,children:e(`result.link.targetTable`)}),(0,E.jsxs)(f,{value:J,onValueChange:Y,disabled:H.length===0,children:[(0,E.jsx)(l,{id:`link-table`,className:`w-full`,children:(0,E.jsx)(c,{placeholder:e(`result.link.pickTable`)})}),(0,E.jsx)(u,{children:H.map(e=>(0,E.jsx)(d,{value:e,children:e},e))})]})]}),(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(v,{htmlFor:`link-column`,children:e(`result.link.targetColumn`)}),(0,E.jsxs)(f,{value:X,onValueChange:Z,disabled:W.length===0,children:[(0,E.jsx)(l,{id:`link-column`,className:`w-full`,children:(0,E.jsx)(c,{placeholder:e(`result.link.pickColumn`)})}),(0,E.jsx)(u,{children:W.map(e=>(0,E.jsx)(d,{value:e,children:e},e))})]})]}),Q&&(0,E.jsx)(`p`,{className:`text-xs text-destructive`,children:Q})]}),(0,E.jsxs)(x,{children:[I&&(0,E.jsx)(s,{variant:`destructive`,onClick:ne,className:`mr-auto`,children:e(`result.link.remove`)}),(0,E.jsx)(s,{variant:`outline`,onClick:a,children:e(`result.link.cancel`)}),(0,E.jsx)(s,{onClick:te,disabled:!K||!J||!X,children:e(`result.link.save`)})]})]})})}export{O as LinkColumnDialog};
1
+ import{r as e}from"./hePW80VL.js";import{c as t,h as n,n as r,t as i}from"./XzPc-eVf.js";import{l as a,m as o,t as s}from"./CKOS5Y-e.js";import{a as c,i as l,n as u,r as d,t as f}from"./BGIwW6nZ.js";import{t as p}from"./DTxGpkJp.js";import{a as m}from"./Cw_LYT6k.js";import{n as h}from"./DbRMSZEW.js";import{t as ee}from"./B3LyCSVJ.js";import{J as g,Y as _,c as v,l as y}from"./B1lNzsWx.js";import{a as b,i as x,n as S,o as C,t as w}from"./DxuXBECK.js";var T=e(n(),1),E=a(),D=e=>e instanceof Error?e.message:String(e);function O(){let{t:e}=o(),n=r(e=>e.activeDialog),a=r(e=>e.closeDialog),O=i(`link-column`),k=n===`link-column`&&!!O,A=O?.connectionId??``,j=p(e=>e.activeConnections),M=j.filter(e=>e.serverConnectionId),N=_(e=>e.links),P=_(e=>e.setLink),F=_(e=>e.removeLink),I=O?g(N,A,O.database,O.table).find(e=>e.column===O.column)??null:null,[L,R]=(0,T.useState)(I?.targetConnectionId??A),z=j.find(e=>e.id===L)?.serverConnectionId,[B,V]=(0,T.useState)([]),[H,U]=(0,T.useState)([]),[W,G]=(0,T.useState)([]),[K,q]=(0,T.useState)(I?.targetDatabase??O?.database??``),[J,Y]=(0,T.useState)(I?.targetTable??``),[X,Z]=(0,T.useState)(I?.targetColumn??``),[Q,$]=(0,T.useState)(null);if((0,T.useEffect)(()=>{if(!k||!z)return;let e=!1;return(async()=>{try{let t=await h(L).introspect.listDatabases(m(z));if(e)return;V(t),q(e=>t.includes(e)?e:t[0]??``)}catch(t){e||$(D(t))}})(),()=>{e=!0}},[k,z,L]),(0,T.useEffect)(()=>{if(!k||!z||!K)return;let e=!1;return(async()=>{try{let t=await h(L).introspect.listTables(m(z),K);if(e)return;U(t.map(e=>e.name))}catch(t){e||$(D(t))}})(),()=>{e=!0}},[k,z,L,K]),(0,T.useEffect)(()=>{if(!k||!z||!K||!J)return;let e=!1;return(async()=>{try{let t=await h(L).introspect.listColumns(m(z),K,J);if(e)return;G(t.map(e=>e.name)),Z(e=>t.some(t=>t.name===e)?e:t.find(e=>e.key===`PRI`)?.name??t[0]?.name??``)}catch(t){e||$(D(t))}})(),()=>{e=!0}},[k,z,L,K,J]),!O)return null;function te(){if(!O||!K||!J||!X)return;let e=L!==A;P(A,{database:O.database,table:O.table,column:O.column,...e?{targetConnectionId:L}:{},targetDatabase:K,targetTable:J,targetColumn:X}),ee(`column_link`),t(`column_link_set`,{dbms:h(A).id,target_dbms:h(L).id,cross_database:K!==O.database,cross_connection:e}),a()}function ne(){O&&(F(A,O),a())}return(0,E.jsx)(w,{open:k,onOpenChange:e=>{e||a()},children:(0,E.jsxs)(S,{className:`sm:max-w-[460px]`,children:[(0,E.jsx)(b,{children:(0,E.jsx)(C,{children:e(`result.link.title`)})}),(0,E.jsxs)(`div`,{className:`space-y-4`,children:[(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(v,{children:e(`result.link.source`)}),(0,E.jsx)(y,{value:`${O.database}.${O.table}.${O.column}`,disabled:!0})]}),(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`result.link.hint`)}),(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(v,{htmlFor:`link-conn`,children:e(`result.link.targetConnection`)}),(0,E.jsxs)(f,{value:L,onValueChange:e=>{R(e),Y(``),U([]),G([])},children:[(0,E.jsx)(l,{id:`link-conn`,className:`w-full`,children:(0,E.jsx)(c,{})}),(0,E.jsx)(u,{children:M.map(e=>(0,E.jsx)(d,{value:e.id,children:e.hostName||e.host||e.file||e.id},e.id))})]})]}),(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(v,{htmlFor:`link-db`,children:e(`result.link.targetDatabase`)}),(0,E.jsxs)(f,{value:K,onValueChange:e=>{q(e),Y(``),G([])},children:[(0,E.jsx)(l,{id:`link-db`,className:`w-full`,children:(0,E.jsx)(c,{})}),(0,E.jsx)(u,{children:B.map(e=>(0,E.jsx)(d,{value:e,children:e},e))})]})]}),(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(v,{htmlFor:`link-table`,children:e(`result.link.targetTable`)}),(0,E.jsxs)(f,{value:J,onValueChange:Y,disabled:H.length===0,children:[(0,E.jsx)(l,{id:`link-table`,className:`w-full`,children:(0,E.jsx)(c,{placeholder:e(`result.link.pickTable`)})}),(0,E.jsx)(u,{children:H.map(e=>(0,E.jsx)(d,{value:e,children:e},e))})]})]}),(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(v,{htmlFor:`link-column`,children:e(`result.link.targetColumn`)}),(0,E.jsxs)(f,{value:X,onValueChange:Z,disabled:W.length===0,children:[(0,E.jsx)(l,{id:`link-column`,className:`w-full`,children:(0,E.jsx)(c,{placeholder:e(`result.link.pickColumn`)})}),(0,E.jsx)(u,{children:W.map(e=>(0,E.jsx)(d,{value:e,children:e},e))})]})]}),Q&&(0,E.jsx)(`p`,{className:`text-xs text-destructive`,children:Q})]}),(0,E.jsxs)(x,{children:[I&&(0,E.jsx)(s,{variant:`destructive`,onClick:ne,className:`mr-auto`,children:e(`result.link.remove`)}),(0,E.jsx)(s,{variant:`outline`,onClick:a,children:e(`result.link.cancel`)}),(0,E.jsx)(s,{onClick:te,disabled:!K||!J||!X,children:e(`result.link.save`)})]})]})})}export{O as LinkColumnDialog};