planche 0.9.3 → 0.9.4

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 (75) hide show
  1. package/app/assets/{B4e4BJ-q.js → 2HDxyxt3.js} +1 -1
  2. package/app/assets/{DMmbl7oU.js → 2WcjYcT6.js} +1 -1
  3. package/app/assets/{B3qo2BmL.js → 34iJa-68.js} +1 -1
  4. package/app/assets/{aBt7vbXN.js → 62772Vyq.js} +1 -1
  5. package/app/assets/{XCH_yrJ8.js → 7hKKrols.js} +1 -1
  6. package/app/assets/{CtvJotUV.js → AR0v7sKO.js} +1 -1
  7. package/app/assets/B5FoXN4H.js +1 -0
  8. package/app/assets/{Xya13jwA.js → BB2_KYgp.js} +1 -1
  9. package/app/assets/{CCHDqJU3.js → BHsv1P4D.js} +1 -1
  10. package/app/assets/{Cv7B7xE1.js → BI5Ig187.js} +1 -1
  11. package/app/assets/{DyPVTkGX.js → BRKvj3qd.js} +1 -1
  12. package/app/assets/{BghfQrAj.js → BVZGLNq_.js} +1 -1
  13. package/app/assets/{CCBiFHWk.js → BWPrOT1U.js} +1 -1
  14. package/app/assets/{CMFMZu0I.js → BaTnCkNR.js} +1 -1
  15. package/app/assets/{BXogLn0j.js → BdhjYiGI.js} +1 -1
  16. package/app/assets/{D8_hwGjG.js → BihjBM79.js} +1 -1
  17. package/app/assets/{DpcElnaI.js → Bjx1jzlk.js} +1 -1
  18. package/app/assets/{uCGINy9d.js → BtBUwOf0.js} +1 -1
  19. package/app/assets/{CSjIZAje.js → Buf-_p3w.js} +1 -1
  20. package/app/assets/{C63wLpkg.js → BvkNY7SP.js} +1 -1
  21. package/app/assets/{mHq6YiMc.js → C-8Bh-gu.js} +1 -1
  22. package/app/assets/{D4aakMZ1.js → C1JbR1mO.js} +1 -1
  23. package/app/assets/{mA16m5gB.js → C3AWL5gC.js} +1 -1
  24. package/app/assets/{TqO-pPrr.js → C3aiaYZP.js} +1 -1
  25. package/app/assets/{Cu_sGzNJ.js → C76CctEl.js} +1 -1
  26. package/app/assets/{C3skRSMN.js → C82F2LSh.js} +1 -1
  27. package/app/assets/{_lYVFvcB.js → CCJEQIo6.js} +1 -1
  28. package/app/assets/{CSE_C1ca.js → CDfygETm.js} +1 -1
  29. package/app/assets/{BmnRSOWE.js → CGpFMM6B.js} +1 -1
  30. package/app/assets/{Ci1xBOLy.js → CH4cEkW4.js} +1 -1
  31. package/app/assets/{rSe5GrVH.js → CKUISE0C.js} +1 -1
  32. package/app/assets/{Bx57-46U.js → CN1CF2CU.js} +1 -1
  33. package/app/assets/{BFUEHSdO.js → CRYDH2ct.js} +1 -1
  34. package/app/assets/{DpPKm22O.js → CZRhmV_L.js} +2 -2
  35. package/app/assets/{D6SRSRpo.js → C_qmv4pB.js} +1 -1
  36. package/app/assets/{CgQ0qqq4.js → CcaDuuFY.js} +1 -1
  37. package/app/assets/{Dl3kZgxg.js → Cm-pfCIP.js} +1 -1
  38. package/app/assets/{C9jzAIEJ.js → Cme0nCT7.js} +1 -1
  39. package/app/assets/{Bsl10NAd.js → CoUCmmSB.js} +1 -1
  40. package/app/assets/{DtUkSj2L.js → CtsakJNi.js} +1 -1
  41. package/app/assets/{BYvM8E39.js → CxaujQob.js} +1 -1
  42. package/app/assets/{CYz610vE.js → CyX8oVsa.js} +1 -1
  43. package/app/assets/{baQnXYR8.js → D-DAzfgs.js} +1 -1
  44. package/app/assets/{X0frSBI-.js → D3VPMNTU.js} +1 -1
  45. package/app/assets/{B_zu4Zim.js → D4DxtYTA.js} +6 -6
  46. package/app/assets/{D2dO-cBr.js → D4c1cZWk.js} +1 -1
  47. package/app/assets/{BFxd4DZC.js → DG0u2CPf.js} +1 -1
  48. package/app/assets/{CYqQEBj7.js → DKObYbZY.js} +1 -1
  49. package/app/assets/{DU-Eln5x.js → DOy06rIE.js} +1 -1
  50. package/app/assets/{Uf0CXpNG.js → DT8Xdk78.js} +1 -1
  51. package/app/assets/{BFddfnRD.js → DXExbVos.js} +1 -1
  52. package/app/assets/{DBwwgHNb.js → DXQPcWS6.js} +1 -1
  53. package/app/assets/{CiL8zoYm.js → Dya0zxo6.js} +1 -1
  54. package/app/assets/{DdGvqbC0.js → IqMoIce-.js} +1 -1
  55. package/app/assets/{BNB2k8On.js → MeOkctzz.js} +1 -1
  56. package/app/assets/{B8kALM_o.js → NL8WOYEo.js} +1 -1
  57. package/app/assets/{D8dVzi6I.js → Ngd1VEiY.js} +1 -1
  58. package/app/assets/UEkRIZwQ.js +1 -0
  59. package/app/assets/{BGuDcBB_.js → UJzcIbfW.js} +1 -1
  60. package/app/assets/{cFpo8ItN.js → W81Xd8P5.js} +1 -1
  61. package/app/assets/{Bjupmf7v.js → Yn5aIyLX.js} +1 -1
  62. package/app/assets/{DP7G83e7.js → _N3A-NTc.js} +1 -1
  63. package/app/assets/{BLF41w4B.js → gvCOWBS0.js} +1 -1
  64. package/app/assets/{CAd2f6EE.js → iz6RnRcO.js} +1 -1
  65. package/app/assets/{DzRyVlxz.js → kTwcxyaO.js} +1 -1
  66. package/app/assets/{BanAYgsJ.js → oXAkF219.js} +1 -1
  67. package/app/assets/{ClHvsi-E.js → pDR31rvF.js} +1 -1
  68. package/app/assets/{DmDLn1hv.js → u9a-WHjb.js} +1 -1
  69. package/app/assets/{Ec3vNInq.js → yLCKuLgs.js} +1 -1
  70. package/app/assets/{CHn2dkeR.js → yfRSh-O-.js} +1 -1
  71. package/app/assets/{BPLdNS4h.js → zdvaVsTo.js} +1 -1
  72. package/app/index.html +19 -19
  73. package/package.json +1 -1
  74. package/app/assets/BEY3Hwp0.js +0 -1
  75. package/app/assets/BFw3KCAr.js +0 -1
@@ -1 +1 @@
1
- import{t as e}from"./CiL8zoYm.js";import{i as t,r as n}from"./Cu_sGzNJ.js";import{a as r,i,n as a,o,r as s,t as c}from"./DzRyVlxz.js";import"./DU-Eln5x.js";import{n as l}from"./D8_hwGjG.js";import{Y as u}from"./B_zu4Zim.js";var d=`<a href="mailto:planche.dev@gmail.com">planche.dev@gmail.com</a>`,f=`2 September 2026`,p=`Planche is made and operated by <strong>deploy</strong>, a sole proprietorship registered in the Republic of Korea and owned by Juwon Jeong (“we”, “us”), at 1114 Gyeongui-ro, 4th floor, Room 405, Paju-si, Gyeonggi-do, Republic of Korea. Contact: ${d}.`,m={title:`Terms of Service — Planche`,description:`The terms under which the Planche SQL client, the local agent and Planche Pro are provided.`,ogTitle:`Planche terms of service`,h1:`Terms of Service`,intro:`Last updated ${f}. These terms cover the website and web application at planche.dev, the local agent published on npm as <code>planche</code> and by the install scripts, and the Planche Pro subscription. By using any of them you agree to these terms. ${p}`,cta:`Open Planche`,static:!0,sections:[{heading:`1. What Planche is`,body:[`Planche is a SQL client. The application runs in your browser. For MySQL, MariaDB, PostgreSQL, SQL Server, Oracle and the hosted services it supports, a small program — the local agent — runs on your own computer, holds the database connections and answers the browser over the loopback interface. SQLite files are opened inside the browser itself.`,`We host the application as a static site and nothing else. Your connection profiles, passwords, queries and results travel between your browser, the agent on your machine and your databases; none of them pass through a server of ours. The <a href="{privacy}">privacy policy</a> lists the few things that do reach us or a service we use.`,`Planche is free to use for personal and commercial purposes without an account. A set of advanced features, listed on the <a href="{pricing}">pricing page</a>, requires a Pro licence.`]},{heading:`2. Licence to use the software`,body:[`We grant you a non-exclusive, non-transferable licence to use the Planche application and the local agent, on any number of computers you own or control, for the purpose of working with databases you are authorised to access.`,`You may not redistribute, sell, rent or sublicense Planche or the agent, offer either to third parties as part of a product or service, modify or create derivative works of them, reverse engineer or decompile them except where the law grants you that right regardless of this clause, or remove any copyright or proprietary notice. Planche is proprietary software; it is not open source.`,`The agent package ships with its own licence agreement (the <code>LICENSE</code> file in the package). For the agent, that agreement applies together with these terms; if the two differ, the package licence prevails for the copy you installed.`,`Planche includes third-party open-source components, each under its own licence. Those licences govern those components and nothing here limits the rights they give you. The list is at <a href="/third-party-notices.txt">third-party-notices.txt</a>.`]},{heading:`3. Planche Pro`,body:[`Pro is a subscription, billed monthly or yearly, that unlocks the features listed on the <a href="{pricing}">pricing page</a>. It is sold through a payment provider acting as our merchant of record and authorised reseller: the provider is the seller on the transaction, processes the payment, and collects and remits any VAT or sales tax that applies. The provider’s name, the price, the currency and any tax are shown at checkout before you pay, and the provider’s own terms apply to the purchase itself.`,`After payment you receive a licence key, on the order page and by email. A key is a signed statement of who bought it, which plan and for which period; the application verifies it on your computer without contacting anyone. A key covers <strong>one person</strong> on every computer that person uses. It may not be shared, published, or resold, and a key found published may be excluded from renewal. For several people, buy one licence each or write to us about a team licence.`,`Because a key is verified offline, it cannot be withdrawn before it expires. Keys are therefore issued for exactly the period that was paid for. While your subscription stays paid you receive a key that covers each new period; when it ends, the Pro features stop at the end of the last paid period and everything else keeps working. Nothing you have stored — profiles, history, saved files — is touched.`,`You can cancel at any time from the customer portal linked in your receipt, or by writing to us. Cancelling stops future charges; the current period runs to its end. Refunds are described in the <a href="{refund}">refund policy</a>.`,`If we change the price of Pro, the new price applies from your next renewal at the earliest, and we tell you by email at least 30 days before that renewal so you can cancel first.`]},{heading:`4. Connection sync`,body:[`Connection sync is an optional Pro feature that keeps your connection profiles on more than one computer. Using it means signing in with a GitHub or Google account; that is the only case in which an account exists. Your profiles are encrypted in the browser with a passphrase you choose before they are uploaded, and the passphrase never leaves your machine. We cannot read the vault and we cannot recover it if you lose the passphrase.`,`Sync is only offered on planche.dev. You can delete your account and vault from the application at any time, or by writing to us. We may discontinue sync with at least 30 days’ notice, during which your profiles remain available on every signed-in computer.`]},{heading:`5. AI features`,body:[`Some features can ask a language model to explain a failed statement or a query plan. They only work if you configure a provider, and what is sent goes from the agent on your computer directly to that provider, under that provider’s terms and privacy policy — not through us. The material sent is narrow: the statement with its secrets masked, the database’s own error message, and the column names of the tables the statement refers to. No rows, hosts or credentials.`,`A model’s answer can be wrong. Suggested statements are shown for you to review; running them is your decision, and section 7 applies to it.`]},{heading:`6. Acceptable use`,body:[`You may only use Planche with databases you own or are authorised to access. You may not use it to gain access you do not have, to interfere with a service, or in breach of any law that applies to you. You may not circumvent or disable the licence check, and you may not expose the local agent to the network in a way that lets others use it as a proxy to your databases or to other hosts.`]},{heading:`7. Your data, your responsibility`,body:[`Planche executes the SQL you give it, and SQL can change or delete data. The safeguards in the application — read-only connections, confirmation of destructive statements, dry run — are aids and not guarantees. You are responsible for keeping backups of your databases and for reviewing statements before you run them, and we accept no responsibility for the effect of a statement you ran.`,`Planche stores your connection profiles, and if you choose so your passwords, in your browser’s storage and, for the agent, in a directory under your home folder. Protecting that computer is your responsibility.`]},{heading:`8. Changes to the service`,body:[`We improve Planche continuously and may add, change or remove features. A feature that is free today may become part of Pro in a later version; a version you already have keeps working as it did. We may stop offering the hosted application at planche.dev; the agent can serve its own copy of the application, so an installed Planche keeps working without it.`]},{heading:`9. No warranty`,body:[`PLANCHE IS PROVIDED “AS IS” AND “AS AVAILABLE”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. We do not promise that it will be uninterrupted, error-free or compatible with every database version.`]},{heading:`10. Limitation of liability`,body:[`TO THE EXTENT PERMITTED BY LAW, WE ARE NOT LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES, OR FOR LOSS OF DATA, PROFITS OR BUSINESS, ARISING FROM OR IN CONNECTION WITH PLANCHE. OUR TOTAL LIABILITY FOR ALL CLAIMS TOGETHER IS LIMITED TO THE AMOUNT YOU PAID US FOR PLANCHE IN THE TWELVE MONTHS BEFORE THE CLAIM AROSE.`,`Nothing in these terms excludes or limits liability that cannot be excluded under the law that applies to you, including liability for intent or gross negligence, or any right you have as a consumer under mandatory law.`]},{heading:`11. Termination`,body:[`You can stop using Planche at any time; there is no account to close unless you use sync. We may end your licence if you materially breach these terms, in which case you must stop using the software. Sections 7, 9, 10 and 13 survive termination.`]},{heading:`12. Changes to these terms`,body:[`We may update these terms. The date at the top says when they last changed. A change that affects Pro subscribers materially is announced by email at least 30 days before it takes effect; continued use after that date is acceptance. If you do not agree, cancel before the change takes effect.`]},{heading:`13. Governing law`,body:[`These terms are governed by the laws of the Republic of Korea, and disputes are subject to the courts of Seoul, Republic of Korea. If you are a consumer, this does not take away the protection of the mandatory consumer laws of the country you live in, or your right to bring a claim there.`]},{heading:`14. Contact`,body:[`Questions about these terms: ${d}.`]}]};`${f}${p}`,`${d}`,`${f}${p}`,`${d}`,`${d}`;var h=m.sections,g=n();function _(e){return e.replace(/\{([a-z]+)\}/g,(e,t)=>t in u?u[t]:e).replace(/<a href="/g,`<a target="_blank" rel="noreferrer" href="`)}function v(){let n=l(e=>e.activeDialog),d=l(e=>e.closeDialog),{t:p}=t();return(0,g.jsx)(c,{open:n===`terms`,onOpenChange:e=>{e||d()},children:(0,g.jsxs)(a,{className:`flex max-h-[85vh] flex-col sm:max-w-[640px]`,children:[(0,g.jsxs)(r,{children:[(0,g.jsx)(o,{children:p(`terms.title`)}),(0,g.jsxs)(s,{children:[p(`terms.version`,{version:1}),` · `,p(`terms.updated`,{date:f})]})]}),(0,g.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded-md border bg-muted/40 p-4 text-sm`,children:[(0,g.jsx)(`p`,{className:`mb-3 text-xs text-muted-foreground`,children:p(`terms.englishOnly`)}),h.map(e=>(0,g.jsxs)(`section`,{className:`mb-4 last:mb-0`,children:[(0,g.jsx)(`h3`,{className:`mb-1 font-semibold`,children:e.heading}),e.body.map((e,t)=>(0,g.jsx)(`p`,{className:`mb-2 leading-relaxed text-muted-foreground last:mb-0 [&_a]:underline [&_a]:underline-offset-2 [&_code]:rounded [&_code]:bg-muted [&_code]:px-1`,dangerouslySetInnerHTML:{__html:_(e)}},t))]},e.heading))]}),(0,g.jsxs)(i,{className:`sm:justify-between`,children:[(0,g.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-xs`,children:[(0,g.jsx)(`a`,{href:u.terms,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:p(`terms.online`)}),(0,g.jsx)(`a`,{href:u.privacy,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:p(`terms.privacyLink`)}),(0,g.jsx)(`a`,{href:u.refund,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:p(`terms.refundLink`)})]}),(0,g.jsx)(e,{onClick:d,children:p(`settings.done`)})]})]})})}export{v as TermsDialog};
1
+ import{t as e}from"./Dya0zxo6.js";import{i as t,r as n}from"./C76CctEl.js";import{a as r,i,n as a,o,r as s,t as c}from"./kTwcxyaO.js";import"./DOy06rIE.js";import{n as l}from"./BihjBM79.js";import{Y as u}from"./D4DxtYTA.js";var d=`<a href="mailto:planche.dev@gmail.com">planche.dev@gmail.com</a>`,f=`2 September 2026`,p=`Planche is made and operated by <strong>deploy</strong>, a sole proprietorship registered in the Republic of Korea and owned by Juwon Jeong (“we”, “us”), at 1114 Gyeongui-ro, 4th floor, Room 405, Paju-si, Gyeonggi-do, Republic of Korea. Contact: ${d}.`,m={title:`Terms of Service — Planche`,description:`The terms under which the Planche SQL client, the local agent and Planche Pro are provided.`,ogTitle:`Planche terms of service`,h1:`Terms of Service`,intro:`Last updated ${f}. These terms cover the website and web application at planche.dev, the local agent published on npm as <code>planche</code> and by the install scripts, and the Planche Pro subscription. By using any of them you agree to these terms. ${p}`,cta:`Open Planche`,static:!0,sections:[{heading:`1. What Planche is`,body:[`Planche is a SQL client. The application runs in your browser. For MySQL, MariaDB, PostgreSQL, SQL Server, Oracle and the hosted services it supports, a small program — the local agent — runs on your own computer, holds the database connections and answers the browser over the loopback interface. SQLite files are opened inside the browser itself.`,`We host the application as a static site and nothing else. Your connection profiles, passwords, queries and results travel between your browser, the agent on your machine and your databases; none of them pass through a server of ours. The <a href="{privacy}">privacy policy</a> lists the few things that do reach us or a service we use.`,`Planche is free to use for personal and commercial purposes without an account. A set of advanced features, listed on the <a href="{pricing}">pricing page</a>, requires a Pro licence.`]},{heading:`2. Licence to use the software`,body:[`We grant you a non-exclusive, non-transferable licence to use the Planche application and the local agent, on any number of computers you own or control, for the purpose of working with databases you are authorised to access.`,`You may not redistribute, sell, rent or sublicense Planche or the agent, offer either to third parties as part of a product or service, modify or create derivative works of them, reverse engineer or decompile them except where the law grants you that right regardless of this clause, or remove any copyright or proprietary notice. Planche is proprietary software; it is not open source.`,`The agent package ships with its own licence agreement (the <code>LICENSE</code> file in the package). For the agent, that agreement applies together with these terms; if the two differ, the package licence prevails for the copy you installed.`,`Planche includes third-party open-source components, each under its own licence. Those licences govern those components and nothing here limits the rights they give you. The list is at <a href="/third-party-notices.txt">third-party-notices.txt</a>.`]},{heading:`3. Planche Pro`,body:[`Pro is a subscription, billed monthly or yearly, that unlocks the features listed on the <a href="{pricing}">pricing page</a>. It is sold through a payment provider acting as our merchant of record and authorised reseller: the provider is the seller on the transaction, processes the payment, and collects and remits any VAT or sales tax that applies. The provider’s name, the price, the currency and any tax are shown at checkout before you pay, and the provider’s own terms apply to the purchase itself.`,`After payment you receive a licence key, on the order page and by email. A key is a signed statement of who bought it, which plan and for which period; the application verifies it on your computer without contacting anyone. A key covers <strong>one person</strong> on every computer that person uses. It may not be shared, published, or resold, and a key found published may be excluded from renewal. For several people, buy one licence each or write to us about a team licence.`,`Because a key is verified offline, it cannot be withdrawn before it expires. Keys are therefore issued for exactly the period that was paid for. While your subscription stays paid you receive a key that covers each new period; when it ends, the Pro features stop at the end of the last paid period and everything else keeps working. Nothing you have stored — profiles, history, saved files — is touched.`,`You can cancel at any time from the customer portal linked in your receipt, or by writing to us. Cancelling stops future charges; the current period runs to its end. Refunds are described in the <a href="{refund}">refund policy</a>.`,`If we change the price of Pro, the new price applies from your next renewal at the earliest, and we tell you by email at least 30 days before that renewal so you can cancel first.`]},{heading:`4. Connection sync`,body:[`Connection sync is an optional Pro feature that keeps your connection profiles on more than one computer. Using it means signing in with a GitHub or Google account; that is the only case in which an account exists. Your profiles are encrypted in the browser with a passphrase you choose before they are uploaded, and the passphrase never leaves your machine. We cannot read the vault and we cannot recover it if you lose the passphrase.`,`Sync is only offered on planche.dev. You can delete your account and vault from the application at any time, or by writing to us. We may discontinue sync with at least 30 days’ notice, during which your profiles remain available on every signed-in computer.`]},{heading:`5. AI features`,body:[`Some features can ask a language model to explain a failed statement or a query plan. They only work if you configure a provider, and what is sent goes from the agent on your computer directly to that provider, under that provider’s terms and privacy policy — not through us. The material sent is narrow: the statement with its secrets masked, the database’s own error message, and the column names of the tables the statement refers to. No rows, hosts or credentials.`,`A model’s answer can be wrong. Suggested statements are shown for you to review; running them is your decision, and section 7 applies to it.`]},{heading:`6. Acceptable use`,body:[`You may only use Planche with databases you own or are authorised to access. You may not use it to gain access you do not have, to interfere with a service, or in breach of any law that applies to you. You may not circumvent or disable the licence check, and you may not expose the local agent to the network in a way that lets others use it as a proxy to your databases or to other hosts.`]},{heading:`7. Your data, your responsibility`,body:[`Planche executes the SQL you give it, and SQL can change or delete data. The safeguards in the application — read-only connections, confirmation of destructive statements, dry run — are aids and not guarantees. You are responsible for keeping backups of your databases and for reviewing statements before you run them, and we accept no responsibility for the effect of a statement you ran.`,`Planche stores your connection profiles, and if you choose so your passwords, in your browser’s storage and, for the agent, in a directory under your home folder. Protecting that computer is your responsibility.`]},{heading:`8. Changes to the service`,body:[`We improve Planche continuously and may add, change or remove features. A feature that is free today may become part of Pro in a later version; a version you already have keeps working as it did. We may stop offering the hosted application at planche.dev; the agent can serve its own copy of the application, so an installed Planche keeps working without it.`]},{heading:`9. No warranty`,body:[`PLANCHE IS PROVIDED “AS IS” AND “AS AVAILABLE”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. We do not promise that it will be uninterrupted, error-free or compatible with every database version.`]},{heading:`10. Limitation of liability`,body:[`TO THE EXTENT PERMITTED BY LAW, WE ARE NOT LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES, OR FOR LOSS OF DATA, PROFITS OR BUSINESS, ARISING FROM OR IN CONNECTION WITH PLANCHE. OUR TOTAL LIABILITY FOR ALL CLAIMS TOGETHER IS LIMITED TO THE AMOUNT YOU PAID US FOR PLANCHE IN THE TWELVE MONTHS BEFORE THE CLAIM AROSE.`,`Nothing in these terms excludes or limits liability that cannot be excluded under the law that applies to you, including liability for intent or gross negligence, or any right you have as a consumer under mandatory law.`]},{heading:`11. Termination`,body:[`You can stop using Planche at any time; there is no account to close unless you use sync. We may end your licence if you materially breach these terms, in which case you must stop using the software. Sections 7, 9, 10 and 13 survive termination.`]},{heading:`12. Changes to these terms`,body:[`We may update these terms. The date at the top says when they last changed. A change that affects Pro subscribers materially is announced by email at least 30 days before it takes effect; continued use after that date is acceptance. If you do not agree, cancel before the change takes effect.`]},{heading:`13. Governing law`,body:[`These terms are governed by the laws of the Republic of Korea, and disputes are subject to the courts of Seoul, Republic of Korea. If you are a consumer, this does not take away the protection of the mandatory consumer laws of the country you live in, or your right to bring a claim there.`]},{heading:`14. Contact`,body:[`Questions about these terms: ${d}.`]}]};`${f}${p}`,`${d}`,`${f}${p}`,`${d}`,`${d}`;var h=m.sections,g=n();function _(e){return e.replace(/\{([a-z]+)\}/g,(e,t)=>t in u?u[t]:e).replace(/<a href="/g,`<a target="_blank" rel="noreferrer" href="`)}function v(){let n=l(e=>e.activeDialog),d=l(e=>e.closeDialog),{t:p}=t();return(0,g.jsx)(c,{open:n===`terms`,onOpenChange:e=>{e||d()},children:(0,g.jsxs)(a,{className:`flex max-h-[85vh] flex-col sm:max-w-[640px]`,children:[(0,g.jsxs)(r,{children:[(0,g.jsx)(o,{children:p(`terms.title`)}),(0,g.jsxs)(s,{children:[p(`terms.version`,{version:1}),` · `,p(`terms.updated`,{date:f})]})]}),(0,g.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded-md border bg-muted/40 p-4 text-sm`,children:[(0,g.jsx)(`p`,{className:`mb-3 text-xs text-muted-foreground`,children:p(`terms.englishOnly`)}),h.map(e=>(0,g.jsxs)(`section`,{className:`mb-4 last:mb-0`,children:[(0,g.jsx)(`h3`,{className:`mb-1 font-semibold`,children:e.heading}),e.body.map((e,t)=>(0,g.jsx)(`p`,{className:`mb-2 leading-relaxed text-muted-foreground last:mb-0 [&_a]:underline [&_a]:underline-offset-2 [&_code]:rounded [&_code]:bg-muted [&_code]:px-1`,dangerouslySetInnerHTML:{__html:_(e)}},t))]},e.heading))]}),(0,g.jsxs)(i,{className:`sm:justify-between`,children:[(0,g.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-xs`,children:[(0,g.jsx)(`a`,{href:u.terms,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:p(`terms.online`)}),(0,g.jsx)(`a`,{href:u.privacy,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:p(`terms.privacyLink`)}),(0,g.jsx)(`a`,{href:u.refund,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:p(`terms.refundLink`)})]}),(0,g.jsx)(e,{onClick:d,children:p(`settings.done`)})]})]})})}export{v as TermsDialog};
@@ -1 +1 @@
1
- import{R as e}from"./CAd2f6EE.js";function t(e,n){for(let r of e)n(r),r.children.length>0&&t(r.children,n)}function n(e,t){for(let r of e){if(r.id===t)return r;let e=n(r.children,t);if(e)return e}return null}function r(t){return(t.type===e.DATABASE||t.type===e.SCHEMA)&&!!t.metadata?.database}function i(e){let n=[];return t(e,e=>{r(e)&&n.push(e.metadata.database)}),n}function a(n,r){let i=[];return t(n,t=>{t.type===e.TABLE&&t.metadata?.database===r&&i.push(t.text)}),i}function o(e,t){return t?n(e,t)?.metadata?.database??null:null}function s(t,r){if(!r)return null;let i=n(t,r);return!i||i.type!==e.TABLE?null:{database:i.metadata?.database??``,table:i.text}}function c(e){return e.find(e=>e.metadata?.catalog&&!e.metadata.unreachable)?.metadata?.catalog}export{s as a,o as i,n,a as o,i as r,t as s,c as t};
1
+ import{R as e}from"./iz6RnRcO.js";function t(e,n){for(let r of e)n(r),r.children.length>0&&t(r.children,n)}function n(e,t){for(let r of e){if(r.id===t)return r;let e=n(r.children,t);if(e)return e}return null}function r(t){return(t.type===e.DATABASE||t.type===e.SCHEMA)&&!!t.metadata?.database}function i(e){let n=[];return t(e,e=>{r(e)&&n.push(e.metadata.database)}),n}function a(n,r){let i=[];return t(n,t=>{t.type===e.TABLE&&t.metadata?.database===r&&i.push(t.text)}),i}function o(e,t){return t?n(e,t)?.metadata?.database??null:null}function s(t,r){if(!r)return null;let i=n(t,r);return!i||i.type!==e.TABLE?null:{database:i.metadata?.database??``,table:i.text}}function c(e){return e.find(e=>e.metadata?.catalog&&!e.metadata.unreachable)?.metadata?.catalog}export{s as a,o as i,n,a as o,i as r,t as s,c as t};
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{t as n}from"./CiL8zoYm.js";import{i as r,r as i}from"./Cu_sGzNJ.js";import{a,i as o,n as s,o as c,r as l,t as u}from"./DzRyVlxz.js";import{n as d,t as f}from"./D8_hwGjG.js";import{B as p,H as m,V as h,c as g,t as _}from"./B_zu4Zim.js";import{t as v}from"./CtvJotUV.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=d(e=>e.activeDialog),t=d(e=>e.closeDialog),i=f(`license`),{key:S,status:C,activate:w,clear:T}=p(),{t:E}=r(),[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)(h()?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)(u,{open:e===`license`,onOpenChange:e=>{e||t()},children:(0,b.jsxs)(s,{className:`max-h-[85vh] overflow-y-auto sm:max-w-[560px]`,onOpenAutoFocus:e=>{N.current&&(e.preventDefault(),N.current.focus())},children:[(0,b.jsx)(a,{children:(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,b.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,b.jsx)(_,{size:44}),(0,b.jsx)(m,{className:`absolute -right-2 -bottom-1 ml-0`})]}),(0,b.jsxs)(`div`,{className:`grid gap-1`,children:[(0,b.jsx)(c,{children:E(`pro.licenseTitle`)}),(0,b.jsx)(l,{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)(g,{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)(o,{children:[S&&(0,b.jsx)(n,{variant:`ghost`,onClick:()=>{T(),O(``)},children:E(`pro.remove`)}),j&&(0,b.jsx)(n,{disabled:k||!D.trim()||D.trim()===S,onClick:()=>{I()},children:E(`pro.activate`)}),(0,b.jsx)(n,{variant:`secondary`,onClick:t,children:E(`settings.done`)})]})]})})}export{S as LicenseDialog};
1
+ import{r as e}from"./hePW80VL.js";import{p as t}from"./CyX8oVsa.js";import{t as n}from"./Dya0zxo6.js";import{i as r,r as i}from"./C76CctEl.js";import{a,i as o,n as s,o as c,r as l,t as u}from"./kTwcxyaO.js";import{n as d,t as f}from"./BihjBM79.js";import{B as p,H as m,V as h,c as g,t as _}from"./D4DxtYTA.js";import{t as v}from"./AR0v7sKO.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=d(e=>e.activeDialog),t=d(e=>e.closeDialog),i=f(`license`),{key:S,status:C,activate:w,clear:T}=p(),{t:E}=r(),[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)(h()?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)(u,{open:e===`license`,onOpenChange:e=>{e||t()},children:(0,b.jsxs)(s,{className:`max-h-[85vh] overflow-y-auto sm:max-w-[560px]`,onOpenAutoFocus:e=>{N.current&&(e.preventDefault(),N.current.focus())},children:[(0,b.jsx)(a,{children:(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,b.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,b.jsx)(_,{size:44}),(0,b.jsx)(m,{className:`absolute -right-2 -bottom-1 ml-0`})]}),(0,b.jsxs)(`div`,{className:`grid gap-1`,children:[(0,b.jsx)(c,{children:E(`pro.licenseTitle`)}),(0,b.jsx)(l,{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)(g,{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)(o,{children:[S&&(0,b.jsx)(n,{variant:`ghost`,onClick:()=>{T(),O(``)},children:E(`pro.remove`)}),j&&(0,b.jsx)(n,{disabled:k||!D.trim()||D.trim()===S,onClick:()=>{I()},children:E(`pro.activate`)}),(0,b.jsx)(n,{variant:`secondary`,onClick:t,children:E(`settings.done`)})]})]})})}export{S as LicenseDialog};
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{i as n,r}from"./Cu_sGzNJ.js";import{F as i,t as a}from"./CAd2f6EE.js";import{t as o}from"./TqO-pPrr.js";import{n as s}from"./BmnRSOWE.js";var c=e(t(),1),l=r(),u=0;function d({connectionId:e}){let{t}=n(),r=a(t=>t.activeConnections.find(t=>t.id===e)?.readOnly??!1),[d,f]=(0,c.useState)(``),p=s(e,e=>e.type===`command`?{id:++u,time:e.time,db:e.db,client:e.client,command:e.args.map(i).join(` `)}:null),m=(0,c.useMemo)(()=>d?p.rows.filter(e=>e.command.toLowerCase().includes(d.toLowerCase())||e.client.includes(d)):p.rows,[p.rows,d]);return(0,l.jsx)(o,{title:t(`tools.redis.monitor`),onRefresh:async()=>{},error:p.error,onDismissError:p.dismissError,children:(0,l.jsxs)(`div`,{className:`flex h-full flex-col text-xs`,children:[(0,l.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center gap-2 border-b px-3 py-2`,children:[p.running?(0,l.jsx)(`button`,{type:`button`,onClick:p.stop,className:`h-7 rounded border bg-background px-2 text-muted-foreground hover:text-foreground`,children:t(`tools.stop`)}):(0,l.jsx)(`button`,{type:`button`,disabled:r,onClick:()=>void p.start({kind:`monitor`}),className:`h-7 rounded border border-primary/30 bg-primary/10 px-2 text-primary hover:bg-primary/20 disabled:opacity-40`,children:t(`tools.redis.startMonitor`)}),p.running&&(0,l.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,l.jsx)(`span`,{className:`size-2 animate-pulse rounded-full bg-red-500`}),t(`tools.redis.monitoring`)]}),(0,l.jsx)(`input`,{className:`h-7 w-64 rounded border bg-background px-2`,placeholder:t(`tools.filter`),value:d,onChange:e=>f(e.target.value)}),p.dropped>0&&(0,l.jsx)(`span`,{className:`text-catppuccin-yellow`,children:t(`tools.redis.dropped`,{count:p.dropped})}),(0,l.jsx)(`div`,{className:`flex-1`}),(0,l.jsx)(`button`,{type:`button`,onClick:p.clear,className:`h-7 rounded border bg-background px-2 text-muted-foreground hover:text-foreground`,children:t(`tools.clear`)})]}),(0,l.jsx)(`p`,{className:`flex-shrink-0 border-b bg-catppuccin-yellow/10 px-3 py-1.5 text-muted-foreground`,children:t(r?`tools.redis.monitorReadOnly`:`tools.redis.monitorWarning`)}),(0,l.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,l.jsxs)(`table`,{className:`w-full border-collapse`,children:[(0,l.jsx)(`thead`,{className:`sticky top-0 bg-muted text-left text-muted-foreground`,children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:`w-28 px-3 py-1.5`,children:t(`tools.redis.time`)}),(0,l.jsx)(`th`,{className:`w-14 px-3 py-1.5`,children:`db`}),(0,l.jsx)(`th`,{className:`w-44 px-3 py-1.5`,children:t(`tools.redis.client`)}),(0,l.jsx)(`th`,{className:`px-3 py-1.5`,children:t(`tools.redis.command`)})]})}),(0,l.jsx)(`tbody`,{children:m.map(e=>(0,l.jsxs)(`tr`,{className:`border-b border-border/50 hover:bg-muted/40`,children:[(0,l.jsxs)(`td`,{className:`whitespace-nowrap px-3 py-0.5 tabular-nums text-muted-foreground`,children:[new Date(e.time).toLocaleTimeString(void 0,{hour12:!1}),`.`,String(e.time%1e3).padStart(3,`0`)]}),(0,l.jsx)(`td`,{className:`px-3 py-0.5 font-mono`,children:e.db}),(0,l.jsx)(`td`,{className:`px-3 py-0.5 font-mono text-muted-foreground`,children:e.client}),(0,l.jsx)(`td`,{className:`break-all px-3 py-0.5 font-mono`,children:e.command})]},e.id))})]})}),p.rows.length>=2e3&&(0,l.jsx)(`p`,{className:`flex-shrink-0 border-t px-3 py-1 text-muted-foreground`,children:t(`tools.redis.feedLimit`,{count:2e3})})]})})}export{d as Monitor};
1
+ import{r as e}from"./hePW80VL.js";import{p as t}from"./CyX8oVsa.js";import{i as n,r}from"./C76CctEl.js";import{F as i,t as a}from"./iz6RnRcO.js";import{t as o}from"./C3aiaYZP.js";import{n as s}from"./CGpFMM6B.js";var c=e(t(),1),l=r(),u=0;function d({connectionId:e}){let{t}=n(),r=a(t=>t.activeConnections.find(t=>t.id===e)?.readOnly??!1),[d,f]=(0,c.useState)(``),p=s(e,e=>e.type===`command`?{id:++u,time:e.time,db:e.db,client:e.client,command:e.args.map(i).join(` `)}:null),m=(0,c.useMemo)(()=>d?p.rows.filter(e=>e.command.toLowerCase().includes(d.toLowerCase())||e.client.includes(d)):p.rows,[p.rows,d]);return(0,l.jsx)(o,{title:t(`tools.redis.monitor`),onRefresh:async()=>{},error:p.error,onDismissError:p.dismissError,children:(0,l.jsxs)(`div`,{className:`flex h-full flex-col text-xs`,children:[(0,l.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center gap-2 border-b px-3 py-2`,children:[p.running?(0,l.jsx)(`button`,{type:`button`,onClick:p.stop,className:`h-7 rounded border bg-background px-2 text-muted-foreground hover:text-foreground`,children:t(`tools.stop`)}):(0,l.jsx)(`button`,{type:`button`,disabled:r,onClick:()=>void p.start({kind:`monitor`}),className:`h-7 rounded border border-primary/30 bg-primary/10 px-2 text-primary hover:bg-primary/20 disabled:opacity-40`,children:t(`tools.redis.startMonitor`)}),p.running&&(0,l.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,l.jsx)(`span`,{className:`size-2 animate-pulse rounded-full bg-red-500`}),t(`tools.redis.monitoring`)]}),(0,l.jsx)(`input`,{className:`h-7 w-64 rounded border bg-background px-2`,placeholder:t(`tools.filter`),value:d,onChange:e=>f(e.target.value)}),p.dropped>0&&(0,l.jsx)(`span`,{className:`text-catppuccin-yellow`,children:t(`tools.redis.dropped`,{count:p.dropped})}),(0,l.jsx)(`div`,{className:`flex-1`}),(0,l.jsx)(`button`,{type:`button`,onClick:p.clear,className:`h-7 rounded border bg-background px-2 text-muted-foreground hover:text-foreground`,children:t(`tools.clear`)})]}),(0,l.jsx)(`p`,{className:`flex-shrink-0 border-b bg-catppuccin-yellow/10 px-3 py-1.5 text-muted-foreground`,children:t(r?`tools.redis.monitorReadOnly`:`tools.redis.monitorWarning`)}),(0,l.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,l.jsxs)(`table`,{className:`w-full border-collapse`,children:[(0,l.jsx)(`thead`,{className:`sticky top-0 bg-muted text-left text-muted-foreground`,children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:`w-28 px-3 py-1.5`,children:t(`tools.redis.time`)}),(0,l.jsx)(`th`,{className:`w-14 px-3 py-1.5`,children:`db`}),(0,l.jsx)(`th`,{className:`w-44 px-3 py-1.5`,children:t(`tools.redis.client`)}),(0,l.jsx)(`th`,{className:`px-3 py-1.5`,children:t(`tools.redis.command`)})]})}),(0,l.jsx)(`tbody`,{children:m.map(e=>(0,l.jsxs)(`tr`,{className:`border-b border-border/50 hover:bg-muted/40`,children:[(0,l.jsxs)(`td`,{className:`whitespace-nowrap px-3 py-0.5 tabular-nums text-muted-foreground`,children:[new Date(e.time).toLocaleTimeString(void 0,{hour12:!1}),`.`,String(e.time%1e3).padStart(3,`0`)]}),(0,l.jsx)(`td`,{className:`px-3 py-0.5 font-mono`,children:e.db}),(0,l.jsx)(`td`,{className:`px-3 py-0.5 font-mono text-muted-foreground`,children:e.client}),(0,l.jsx)(`td`,{className:`break-all px-3 py-0.5 font-mono`,children:e.command})]},e.id))})]})}),p.rows.length>=2e3&&(0,l.jsx)(`p`,{className:`flex-shrink-0 border-t px-3 py-1 text-muted-foreground`,children:t(`tools.redis.feedLimit`,{count:2e3})})]})})}export{d as Monitor};
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{i as n,t as r}from"./CiL8zoYm.js";import{i,n as a,r as o}from"./Cu_sGzNJ.js";import{a as s,i as c,n as l,o as u,t as d}from"./DzRyVlxz.js";import{I as f,t as p}from"./CAd2f6EE.js";import{n as m}from"./D8_hwGjG.js";import{a as h}from"./BghfQrAj.js";import{r as g}from"./Ci1xBOLy.js";import{a as _}from"./DpPKm22O.js";import{Et as v,Ut as y,c as b,qt as x,vt as S,wt as C}from"./B_zu4Zim.js";import{n as w,t as T}from"./XCH_yrJ8.js";var E=a(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),D=a(`user-plus`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`19`,x2:`19`,y1:`8`,y2:`14`,key:`1bvyxn`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]),O=e(t(),1),k=o();function A({databases:e,tables:t,onSelectScope:r}){let{t:a}=i(),[o,s]=(0,O.useState)(new Set),[c,l]=(0,O.useState)(`global`),u=(0,O.useCallback)(e=>{s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),d=[{id:`global`,text:a(`user.grantTree.globalPrivileges`),type:`global`,children:e.map(e=>({id:`db:${e}`,text:e,type:`database`,database:e,children:(t[e]??[]).map(t=>({id:`tbl:${e}.${t}`,text:t,type:`table`,database:e,table:t}))}))}];function f(e){l(e.id),r({level:e.type,database:e.database,table:e.table})}function p(e,t){let r=e.children&&e.children.length>0,i=o.has(e.id),a=c===e.id,s=E;return e.type===`database`&&(s=y),e.type===`table`&&(s=v),(0,k.jsxs)(`div`,{children:[(0,k.jsxs)(`div`,{className:n(`flex items-center gap-1 px-2 py-0.5 cursor-pointer text-sm hover:bg-accent rounded-sm`,a&&`bg-accent text-accent-foreground`),style:{paddingLeft:`${t*16+4}px`},onClick:()=>{f(e),r&&u(e.id)},children:[r?(0,k.jsx)(x,{className:n(`h-3 w-3 transition-transform shrink-0`,i&&`rotate-90`)}):(0,k.jsx)(`span`,{className:`w-3 shrink-0`}),(0,k.jsx)(s,{className:`h-4 w-4 text-muted-foreground shrink-0`}),(0,k.jsx)(`span`,{className:`truncate`,children:e.text})]}),i&&e.children?.map(e=>p(e,t+1))]},e.id)}return(0,k.jsx)(S,{className:`h-full`,children:(0,k.jsx)(`div`,{className:`py-1`,children:d.map(e=>p(e,0))})})}var j={Data:[`SELECT`,`INSERT`,`UPDATE`,`DELETE`],Structure:[`CREATE`,`ALTER`,`DROP`,`INDEX`,`REFERENCES`],Administration:[`GRANT OPTION`,`SUPER`,`PROCESS`,`RELOAD`,`SHUTDOWN`,`SHOW DATABASES`,`LOCK TABLES`,`EXECUTE`,`REPLICATION SLAVE`,`REPLICATION CLIENT`,`CREATE VIEW`,`SHOW VIEW`,`CREATE ROUTINE`,`ALTER ROUTINE`,`CREATE USER`,`EVENT`,`TRIGGER`,`CREATE TABLESPACE`]},M={Data:[`SELECT`,`INSERT`,`UPDATE`,`DELETE`],Structure:[`CREATE`,`ALTER`,`DROP`,`INDEX`,`REFERENCES`],Administration:[`GRANT OPTION`,`LOCK TABLES`,`EXECUTE`,`CREATE VIEW`,`SHOW VIEW`,`CREATE ROUTINE`,`ALTER ROUTINE`,`EVENT`,`TRIGGER`]},N={Data:[`SELECT`,`INSERT`,`UPDATE`,`DELETE`],Structure:[`CREATE`,`ALTER`,`DROP`,`INDEX`,`REFERENCES`],Administration:[`GRANT OPTION`,`TRIGGER`]},P={global:`user.privileges.globalTitle`,database:`user.privileges.databaseTitle`,table:`user.privileges.tableTitle`},F={Data:`user.privileges.categoryData`,Structure:`user.privileges.categoryStructure`,Administration:`user.privileges.categoryAdministration`};function I({scope:e,privileges:t,onChange:n}){let{t:a}=i(),o=(0,O.useMemo)(()=>e===`global`?j:e===`database`?M:N,[e]),s=(0,O.useMemo)(()=>Object.values(o).flat(),[o]);function c(e){n({...t,[e]:!t[e]})}function l(){let e={...t};for(let t of s)e[t]=!0;n(e)}function u(){let e={...t};for(let t of s)e[t]=!1;n(e)}return(0,k.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-2 p-2 border-b`,children:[(0,k.jsx)(`span`,{className:`text-sm font-medium`,children:a(P[e])}),(0,k.jsxs)(`div`,{className:`ml-auto flex gap-1`,children:[(0,k.jsx)(r,{variant:`outline`,size:`sm`,onClick:l,children:a(`user.privileges.checkAll`)}),(0,k.jsx)(r,{variant:`outline`,size:`sm`,onClick:u,children:a(`user.privileges.uncheckAll`)})]})]}),(0,k.jsx)(S,{className:`flex-1`,children:(0,k.jsx)(`div`,{className:`p-3 space-y-4`,children:Object.entries(o).map(([e,n])=>(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`h4`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-2`,children:F[e]?a(F[e]):e}),(0,k.jsx)(`div`,{className:`grid grid-cols-2 gap-1`,children:n.map(e=>(0,k.jsxs)(b,{className:`flex items-center gap-2 text-sm font-normal cursor-pointer py-1`,children:[(0,k.jsx)(`input`,{type:`checkbox`,checked:t[e]??!1,onChange:()=>c(e),className:`rounded border-input`}),e]},e))})]},e))})})]})}var L={SELECT:`Select_priv`,INSERT:`Insert_priv`,UPDATE:`Update_priv`,DELETE:`Delete_priv`,CREATE:`Create_priv`,ALTER:`Alter_priv`,DROP:`Drop_priv`,INDEX:`Index_priv`,REFERENCES:`References_priv`,"GRANT OPTION":`Grant_priv`,SUPER:`Super_priv`,PROCESS:`Process_priv`,RELOAD:`Reload_priv`,SHUTDOWN:`Shutdown_priv`,"SHOW DATABASES":`Show_db_priv`,"LOCK TABLES":`Lock_tables_priv`,EXECUTE:`Execute_priv`,"REPLICATION SLAVE":`Repl_slave_priv`,"REPLICATION CLIENT":`Repl_client_priv`,"CREATE VIEW":`Create_view_priv`,"SHOW VIEW":`Show_view_priv`,"CREATE ROUTINE":`Create_routine_priv`,"ALTER ROUTINE":`Alter_routine_priv`,"CREATE USER":`Create_user_priv`,EVENT:`Event_priv`,TRIGGER:`Trigger_priv`,"CREATE TABLESPACE":`Create_tablespace_priv`,"CREATE TEMPORARY TABLES":`Create_tmp_table_priv`,FILE:`File_priv`};function R(e){let t={};for(let n of e.split(`,`)){let e=n.trim().toUpperCase();e&&(t[e]=!0)}return t}function z(e){let t={};for(let[n,r]of Object.entries(L)){let i=e[r];i!==void 0&&(t[n]=String(i).toUpperCase()===`Y`)}return t}function B(e,t){let n=t=>e.quoteIdentifier(t);return t.level===`global`?`*.*`:t.level===`database`?`${n(t.database??``)}.*`:`${n(t.database??``)}.${n(t.table??``)}`}async function V(e,t,n,r,i){if(i.level===`global`){let i=await e(t.getQuery(`USER_PRIV`,n,r)),a=f(i)[0];return a?z(a):{}}if(i.level===`database`){let a=await e(t.getQuery(`USER_DATABASE_PRIV`,n,r)),o=f(a).find(e=>String(e.Db)===i.database);return o?z(o):{}}let a=await e(t.getQuery(`USER_TABLE_PRIV`,n,r)),o=f(a).find(e=>String(e.Db)===i.database&&String(e.Table_name)===i.table);return o?R(String(o.Table_priv??``)):{}}function H(e,t,n,r,i,a){let o=B(e,r),s=[],c=[],l=null;for(let e of new Set([...Object.keys(i),...Object.keys(a)])){let t=i[e]===!0,n=a[e]===!0;if(t!==n){if(e===`GRANT OPTION`){l=n;continue}(n?s:c).push(e)}}let u=[];if(s.length>0||l===!0){let r=s.length>0?s.join(`, `):`USAGE`;u.push(e.getQuery(`GRANT`,r,t,n,o,l===!0?`WITH GRANT OPTION`:``))}return c.length>0&&u.push(e.getQuery(`REVOKE`,c.join(`, `),t,n,o)),l===!1&&u.push(e.getQuery(`REVOKE`,`GRANT OPTION`,t,n,o)),u}function U(e){return p.getState().activeConnections.find(t=>t.id===e)?.serverConnectionId??null}function W(){let{t:e}=i(),{activeDialog:t,closeDialog:a,openDialog:o,setFooterMessage:f}=m(),v=p(e=>e.activeConnectionId)??``,y=w(e=>e.users[v]??T),b=w(e=>e.selectedUser[v]??null),x=w(e=>e.setSelectedUser),E=w(e=>e.removeUser),j=e=>x(v,e),M=(e,t)=>E(v,e,t),[N,P]=(0,O.useState)({level:`global`}),[F,L]=(0,O.useState)({}),[R,z]=(0,O.useState)([]),[B,W]=(0,O.useState)({}),[G,K]=(0,O.useState)({}),[q,J]=(0,O.useState)(!1),Y=t===`user-manager`;(0,O.useEffect)(()=>{if(!Y||!v)return;let e=U(v);if(!e)return;let t=!1;return g(v).introspect.listDatabases(h(e)).then(e=>{t||z(e)}).catch(()=>{t||z([])}),()=>{t=!0}},[Y,v]),(0,O.useEffect)(()=>{let e=N.database;if(!Y||!v||!e||B[e])return;let t=U(v);if(!t)return;let n=!1;return g(v).introspect.listTables(h(t),e).then(t=>{n||W(n=>({...n,[e]:t.map(e=>e.name)}))}).catch(()=>void 0),()=>{n=!0}},[Y,v,N.database,B]),(0,O.useEffect)(()=>{if(!Y||!v||!b){K({}),L({});return}let e=U(v);if(!e)return;let t=!1;return V(h(e),g(v),b.user,b.host,N).then(e=>{t||(K(e),L(e))}).catch(()=>{t||(K({}),L({}))}),()=>{t=!0}},[Y,v,b,N]);function X(e){e||(a(),j(null),P({level:`global`}),L({}))}let Z=(0,O.useCallback)(e=>{P(e),L({})},[]);function Q(){o(`user-add`)}async function $(){if(!b||!v)return;let{user:t,host:n}=b;J(!0);try{await _(v,g(v).getQuery(`DELETE_USER`,t,n)),M(n,t),j(null),f(e(`user.manager.removed`,{user:t,host:n}))}catch(e){f(e instanceof Error?e.message:String(e))}finally{J(!1)}}async function ee(){if(!b||!v){f(e(`user.manager.selectUserFirst`));return}let t=H(g(v),b.user,b.host,N,G,F);if(t.length===0){f(e(`user.manager.noChanges`));return}J(!0);try{for(let e of t)await _(v,e);K(F),f(e(`user.manager.applied`))}catch(e){f(e instanceof Error?e.message:String(e))}finally{J(!1)}}return(0,k.jsx)(d,{open:Y,onOpenChange:X,children:(0,k.jsxs)(l,{className:`sm:max-w-[80vw] max-h-[70vh] flex flex-col`,children:[(0,k.jsx)(s,{children:(0,k.jsx)(u,{children:e(`user.manager.title`)})}),(0,k.jsxs)(`div`,{className:`flex flex-1 gap-0 overflow-hidden min-h-0 border rounded-md`,children:[(0,k.jsxs)(`div`,{className:`w-[200px] shrink-0 border-r flex flex-col`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-1 p-2 border-b`,children:[(0,k.jsx)(r,{variant:`ghost`,size:`sm`,onClick:Q,title:e(`user.manager.addUser`),children:(0,k.jsx)(D,{className:`h-4 w-4`})}),(0,k.jsx)(r,{variant:`ghost`,size:`sm`,onClick:()=>void $(),disabled:!b||q,title:e(`user.manager.removeUser`),children:(0,k.jsx)(C,{className:`h-4 w-4`})})]}),(0,k.jsx)(S,{className:`flex-1`,children:(0,k.jsx)(`div`,{className:`py-1`,children:y.length===0?(0,k.jsx)(`div`,{className:`px-3 py-4 text-sm text-muted-foreground text-center`,children:e(`user.manager.noUsers`)}):y.map(e=>{let t=b?.user===e.user&&b?.host===e.host;return(0,k.jsx)(`div`,{className:n(`flex items-center gap-2 px-3 py-1.5 cursor-pointer text-sm hover:bg-accent`,t&&`bg-accent text-accent-foreground`),onClick:()=>j(e),children:(0,k.jsxs)(`span`,{className:`truncate`,children:[e.user,`@`,e.host]})},`${e.user}@${e.host}`)})})})]}),(0,k.jsxs)(`div`,{className:`w-[250px] shrink-0 border-r`,children:[(0,k.jsx)(`div`,{className:`p-2 border-b text-sm font-medium`,children:e(`user.manager.grantScope`)}),(0,k.jsx)(A,{connectionId:``,databases:R,tables:B,onSelectScope:Z})]}),(0,k.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,k.jsx)(I,{scope:N.level,privileges:F,onChange:L})})]}),(0,k.jsxs)(c,{children:[(0,k.jsx)(r,{onClick:()=>void ee(),disabled:q,children:e(`user.manager.apply`)}),(0,k.jsx)(r,{variant:`outline`,onClick:()=>X(!1),children:e(`user.manager.close`)})]})]})})}export{W as UserManagerDialog};
1
+ import{r as e}from"./hePW80VL.js";import{p as t}from"./CyX8oVsa.js";import{i as n,t as r}from"./Dya0zxo6.js";import{i,n as a,r as o}from"./C76CctEl.js";import{a as s,i as c,n as l,o as u,t as d}from"./kTwcxyaO.js";import{I as f,t as p}from"./iz6RnRcO.js";import{n as m}from"./BihjBM79.js";import{a as h}from"./BVZGLNq_.js";import{r as g}from"./CH4cEkW4.js";import{a as _}from"./CZRhmV_L.js";import{Et as v,Ut as y,c as b,qt as x,vt as S,wt as C}from"./D4DxtYTA.js";import{n as w,t as T}from"./7hKKrols.js";var E=a(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),D=a(`user-plus`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`19`,x2:`19`,y1:`8`,y2:`14`,key:`1bvyxn`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]),O=e(t(),1),k=o();function A({databases:e,tables:t,onSelectScope:r}){let{t:a}=i(),[o,s]=(0,O.useState)(new Set),[c,l]=(0,O.useState)(`global`),u=(0,O.useCallback)(e=>{s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),d=[{id:`global`,text:a(`user.grantTree.globalPrivileges`),type:`global`,children:e.map(e=>({id:`db:${e}`,text:e,type:`database`,database:e,children:(t[e]??[]).map(t=>({id:`tbl:${e}.${t}`,text:t,type:`table`,database:e,table:t}))}))}];function f(e){l(e.id),r({level:e.type,database:e.database,table:e.table})}function p(e,t){let r=e.children&&e.children.length>0,i=o.has(e.id),a=c===e.id,s=E;return e.type===`database`&&(s=y),e.type===`table`&&(s=v),(0,k.jsxs)(`div`,{children:[(0,k.jsxs)(`div`,{className:n(`flex items-center gap-1 px-2 py-0.5 cursor-pointer text-sm hover:bg-accent rounded-sm`,a&&`bg-accent text-accent-foreground`),style:{paddingLeft:`${t*16+4}px`},onClick:()=>{f(e),r&&u(e.id)},children:[r?(0,k.jsx)(x,{className:n(`h-3 w-3 transition-transform shrink-0`,i&&`rotate-90`)}):(0,k.jsx)(`span`,{className:`w-3 shrink-0`}),(0,k.jsx)(s,{className:`h-4 w-4 text-muted-foreground shrink-0`}),(0,k.jsx)(`span`,{className:`truncate`,children:e.text})]}),i&&e.children?.map(e=>p(e,t+1))]},e.id)}return(0,k.jsx)(S,{className:`h-full`,children:(0,k.jsx)(`div`,{className:`py-1`,children:d.map(e=>p(e,0))})})}var j={Data:[`SELECT`,`INSERT`,`UPDATE`,`DELETE`],Structure:[`CREATE`,`ALTER`,`DROP`,`INDEX`,`REFERENCES`],Administration:[`GRANT OPTION`,`SUPER`,`PROCESS`,`RELOAD`,`SHUTDOWN`,`SHOW DATABASES`,`LOCK TABLES`,`EXECUTE`,`REPLICATION SLAVE`,`REPLICATION CLIENT`,`CREATE VIEW`,`SHOW VIEW`,`CREATE ROUTINE`,`ALTER ROUTINE`,`CREATE USER`,`EVENT`,`TRIGGER`,`CREATE TABLESPACE`]},M={Data:[`SELECT`,`INSERT`,`UPDATE`,`DELETE`],Structure:[`CREATE`,`ALTER`,`DROP`,`INDEX`,`REFERENCES`],Administration:[`GRANT OPTION`,`LOCK TABLES`,`EXECUTE`,`CREATE VIEW`,`SHOW VIEW`,`CREATE ROUTINE`,`ALTER ROUTINE`,`EVENT`,`TRIGGER`]},N={Data:[`SELECT`,`INSERT`,`UPDATE`,`DELETE`],Structure:[`CREATE`,`ALTER`,`DROP`,`INDEX`,`REFERENCES`],Administration:[`GRANT OPTION`,`TRIGGER`]},P={global:`user.privileges.globalTitle`,database:`user.privileges.databaseTitle`,table:`user.privileges.tableTitle`},F={Data:`user.privileges.categoryData`,Structure:`user.privileges.categoryStructure`,Administration:`user.privileges.categoryAdministration`};function I({scope:e,privileges:t,onChange:n}){let{t:a}=i(),o=(0,O.useMemo)(()=>e===`global`?j:e===`database`?M:N,[e]),s=(0,O.useMemo)(()=>Object.values(o).flat(),[o]);function c(e){n({...t,[e]:!t[e]})}function l(){let e={...t};for(let t of s)e[t]=!0;n(e)}function u(){let e={...t};for(let t of s)e[t]=!1;n(e)}return(0,k.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-2 p-2 border-b`,children:[(0,k.jsx)(`span`,{className:`text-sm font-medium`,children:a(P[e])}),(0,k.jsxs)(`div`,{className:`ml-auto flex gap-1`,children:[(0,k.jsx)(r,{variant:`outline`,size:`sm`,onClick:l,children:a(`user.privileges.checkAll`)}),(0,k.jsx)(r,{variant:`outline`,size:`sm`,onClick:u,children:a(`user.privileges.uncheckAll`)})]})]}),(0,k.jsx)(S,{className:`flex-1`,children:(0,k.jsx)(`div`,{className:`p-3 space-y-4`,children:Object.entries(o).map(([e,n])=>(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`h4`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-2`,children:F[e]?a(F[e]):e}),(0,k.jsx)(`div`,{className:`grid grid-cols-2 gap-1`,children:n.map(e=>(0,k.jsxs)(b,{className:`flex items-center gap-2 text-sm font-normal cursor-pointer py-1`,children:[(0,k.jsx)(`input`,{type:`checkbox`,checked:t[e]??!1,onChange:()=>c(e),className:`rounded border-input`}),e]},e))})]},e))})})]})}var L={SELECT:`Select_priv`,INSERT:`Insert_priv`,UPDATE:`Update_priv`,DELETE:`Delete_priv`,CREATE:`Create_priv`,ALTER:`Alter_priv`,DROP:`Drop_priv`,INDEX:`Index_priv`,REFERENCES:`References_priv`,"GRANT OPTION":`Grant_priv`,SUPER:`Super_priv`,PROCESS:`Process_priv`,RELOAD:`Reload_priv`,SHUTDOWN:`Shutdown_priv`,"SHOW DATABASES":`Show_db_priv`,"LOCK TABLES":`Lock_tables_priv`,EXECUTE:`Execute_priv`,"REPLICATION SLAVE":`Repl_slave_priv`,"REPLICATION CLIENT":`Repl_client_priv`,"CREATE VIEW":`Create_view_priv`,"SHOW VIEW":`Show_view_priv`,"CREATE ROUTINE":`Create_routine_priv`,"ALTER ROUTINE":`Alter_routine_priv`,"CREATE USER":`Create_user_priv`,EVENT:`Event_priv`,TRIGGER:`Trigger_priv`,"CREATE TABLESPACE":`Create_tablespace_priv`,"CREATE TEMPORARY TABLES":`Create_tmp_table_priv`,FILE:`File_priv`};function R(e){let t={};for(let n of e.split(`,`)){let e=n.trim().toUpperCase();e&&(t[e]=!0)}return t}function z(e){let t={};for(let[n,r]of Object.entries(L)){let i=e[r];i!==void 0&&(t[n]=String(i).toUpperCase()===`Y`)}return t}function B(e,t){let n=t=>e.quoteIdentifier(t);return t.level===`global`?`*.*`:t.level===`database`?`${n(t.database??``)}.*`:`${n(t.database??``)}.${n(t.table??``)}`}async function V(e,t,n,r,i){if(i.level===`global`){let i=await e(t.getQuery(`USER_PRIV`,n,r)),a=f(i)[0];return a?z(a):{}}if(i.level===`database`){let a=await e(t.getQuery(`USER_DATABASE_PRIV`,n,r)),o=f(a).find(e=>String(e.Db)===i.database);return o?z(o):{}}let a=await e(t.getQuery(`USER_TABLE_PRIV`,n,r)),o=f(a).find(e=>String(e.Db)===i.database&&String(e.Table_name)===i.table);return o?R(String(o.Table_priv??``)):{}}function H(e,t,n,r,i,a){let o=B(e,r),s=[],c=[],l=null;for(let e of new Set([...Object.keys(i),...Object.keys(a)])){let t=i[e]===!0,n=a[e]===!0;if(t!==n){if(e===`GRANT OPTION`){l=n;continue}(n?s:c).push(e)}}let u=[];if(s.length>0||l===!0){let r=s.length>0?s.join(`, `):`USAGE`;u.push(e.getQuery(`GRANT`,r,t,n,o,l===!0?`WITH GRANT OPTION`:``))}return c.length>0&&u.push(e.getQuery(`REVOKE`,c.join(`, `),t,n,o)),l===!1&&u.push(e.getQuery(`REVOKE`,`GRANT OPTION`,t,n,o)),u}function U(e){return p.getState().activeConnections.find(t=>t.id===e)?.serverConnectionId??null}function W(){let{t:e}=i(),{activeDialog:t,closeDialog:a,openDialog:o,setFooterMessage:f}=m(),v=p(e=>e.activeConnectionId)??``,y=w(e=>e.users[v]??T),b=w(e=>e.selectedUser[v]??null),x=w(e=>e.setSelectedUser),E=w(e=>e.removeUser),j=e=>x(v,e),M=(e,t)=>E(v,e,t),[N,P]=(0,O.useState)({level:`global`}),[F,L]=(0,O.useState)({}),[R,z]=(0,O.useState)([]),[B,W]=(0,O.useState)({}),[G,K]=(0,O.useState)({}),[q,J]=(0,O.useState)(!1),Y=t===`user-manager`;(0,O.useEffect)(()=>{if(!Y||!v)return;let e=U(v);if(!e)return;let t=!1;return g(v).introspect.listDatabases(h(e)).then(e=>{t||z(e)}).catch(()=>{t||z([])}),()=>{t=!0}},[Y,v]),(0,O.useEffect)(()=>{let e=N.database;if(!Y||!v||!e||B[e])return;let t=U(v);if(!t)return;let n=!1;return g(v).introspect.listTables(h(t),e).then(t=>{n||W(n=>({...n,[e]:t.map(e=>e.name)}))}).catch(()=>void 0),()=>{n=!0}},[Y,v,N.database,B]),(0,O.useEffect)(()=>{if(!Y||!v||!b){K({}),L({});return}let e=U(v);if(!e)return;let t=!1;return V(h(e),g(v),b.user,b.host,N).then(e=>{t||(K(e),L(e))}).catch(()=>{t||(K({}),L({}))}),()=>{t=!0}},[Y,v,b,N]);function X(e){e||(a(),j(null),P({level:`global`}),L({}))}let Z=(0,O.useCallback)(e=>{P(e),L({})},[]);function Q(){o(`user-add`)}async function $(){if(!b||!v)return;let{user:t,host:n}=b;J(!0);try{await _(v,g(v).getQuery(`DELETE_USER`,t,n)),M(n,t),j(null),f(e(`user.manager.removed`,{user:t,host:n}))}catch(e){f(e instanceof Error?e.message:String(e))}finally{J(!1)}}async function ee(){if(!b||!v){f(e(`user.manager.selectUserFirst`));return}let t=H(g(v),b.user,b.host,N,G,F);if(t.length===0){f(e(`user.manager.noChanges`));return}J(!0);try{for(let e of t)await _(v,e);K(F),f(e(`user.manager.applied`))}catch(e){f(e instanceof Error?e.message:String(e))}finally{J(!1)}}return(0,k.jsx)(d,{open:Y,onOpenChange:X,children:(0,k.jsxs)(l,{className:`sm:max-w-[80vw] max-h-[70vh] flex flex-col`,children:[(0,k.jsx)(s,{children:(0,k.jsx)(u,{children:e(`user.manager.title`)})}),(0,k.jsxs)(`div`,{className:`flex flex-1 gap-0 overflow-hidden min-h-0 border rounded-md`,children:[(0,k.jsxs)(`div`,{className:`w-[200px] shrink-0 border-r flex flex-col`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-1 p-2 border-b`,children:[(0,k.jsx)(r,{variant:`ghost`,size:`sm`,onClick:Q,title:e(`user.manager.addUser`),children:(0,k.jsx)(D,{className:`h-4 w-4`})}),(0,k.jsx)(r,{variant:`ghost`,size:`sm`,onClick:()=>void $(),disabled:!b||q,title:e(`user.manager.removeUser`),children:(0,k.jsx)(C,{className:`h-4 w-4`})})]}),(0,k.jsx)(S,{className:`flex-1`,children:(0,k.jsx)(`div`,{className:`py-1`,children:y.length===0?(0,k.jsx)(`div`,{className:`px-3 py-4 text-sm text-muted-foreground text-center`,children:e(`user.manager.noUsers`)}):y.map(e=>{let t=b?.user===e.user&&b?.host===e.host;return(0,k.jsx)(`div`,{className:n(`flex items-center gap-2 px-3 py-1.5 cursor-pointer text-sm hover:bg-accent`,t&&`bg-accent text-accent-foreground`),onClick:()=>j(e),children:(0,k.jsxs)(`span`,{className:`truncate`,children:[e.user,`@`,e.host]})},`${e.user}@${e.host}`)})})})]}),(0,k.jsxs)(`div`,{className:`w-[250px] shrink-0 border-r`,children:[(0,k.jsx)(`div`,{className:`p-2 border-b text-sm font-medium`,children:e(`user.manager.grantScope`)}),(0,k.jsx)(A,{connectionId:``,databases:R,tables:B,onSelectScope:Z})]}),(0,k.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,k.jsx)(I,{scope:N.level,privileges:F,onChange:L})})]}),(0,k.jsxs)(c,{children:[(0,k.jsx)(r,{onClick:()=>void ee(),disabled:q,children:e(`user.manager.apply`)}),(0,k.jsx)(r,{variant:`outline`,onClick:()=>X(!1),children:e(`user.manager.close`)})]})]})})}export{W as UserManagerDialog};
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/R93pYE1w.js","assets/hePW80VL.js","assets/DeB5sJfy.js","assets/DOeLCbYG.js","assets/5E2RYjEs.js","assets/eRZ39OKr.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./hePW80VL.js";import{i as t}from"./C9jzAIEJ.js";import{r as n}from"./Nro86Y63.js";import{t as r}from"./CAd2f6EE.js";import{n as i}from"./D6SRSRpo.js";import{C as a,a as o}from"./BghfQrAj.js";import{n as s}from"./Ci1xBOLy.js";import{i as c,r as l}from"./CSjIZAje.js";var u=[`<=>`,`->>`,`->`,`<>`,`!=`,`<=`,`>=`,`<<`,`>>`,`:=`,`||`,`&&`];function d(e){return/[A-Za-z_$\u0080-\uFFFF]/.test(e)}function f(e){return/[A-Za-z0-9_$\u0080-\uFFFF]/.test(e)}function p(e){return e>=`0`&&e<=`9`}function m(e){return e===` `||e===` `||e===`
2
+ import{r as e}from"./hePW80VL.js";import{i as t}from"./Cme0nCT7.js";import{r as n}from"./Nro86Y63.js";import{t as r}from"./iz6RnRcO.js";import{n as i}from"./C_qmv4pB.js";import{C as a,a as o}from"./BVZGLNq_.js";import{n as s}from"./CH4cEkW4.js";import{i as c,r as l}from"./Buf-_p3w.js";var u=[`<=>`,`->>`,`->`,`<>`,`!=`,`<=`,`>=`,`<<`,`>>`,`:=`,`||`,`&&`];function d(e){return/[A-Za-z_$\u0080-\uFFFF]/.test(e)}function f(e){return/[A-Za-z0-9_$\u0080-\uFFFF]/.test(e)}function p(e){return e>=`0`&&e<=`9`}function m(e){return e===` `||e===` `||e===`
3
3
  `||e===`\r`||e===`\f`||e===`\v`}var h=class{input;syntax;pos=0;delimiter;significantInStatement=0;constructor(e,t,n=`;`){this.input=e,this.syntax=t,this.delimiter=n}tokenize(){let e=[];for(;this.pos<this.input.length;){let t=this.next();t.kind===`terminator`||t.kind===`delimiter_command`?this.significantInStatement=0:t.kind!==`space`&&t.kind!==`comment`&&this.significantInStatement++,e.push(t)}return e}atLineStart(e){let t=e-1;for(;t>=0&&(this.input[t]===` `||this.input[t]===` `);)t--;return t<0||this.input[t]===`
4
4
  `}make(e,t,n){let r=this.input.slice(t,n),i={kind:e,value:r,start:t,end:n};return e===`identifier`&&(i.upper=r.toUpperCase()),i}next(){let e=this.input,t=this.pos,n=e[t];if(m(n)){let n=t+1;for(;n<e.length&&m(e[n]);)n++;return this.pos=n,this.make(`space`,t,n)}if(e.startsWith(this.delimiter,t))return this.pos=t+this.delimiter.length,this.make(`terminator`,t,this.pos);if(n===`#`&&this.syntax.hashComments)return this.lineComment(t);if(n===`-`&&e[t+1]===`-`){let n=e[t+2];if(!this.syntax.dashCommentNeedsSpace||n===void 0||m(n))return this.lineComment(t)}if(n===`/`&&e[t+1]===`*`){let n=e.indexOf(`*/`,t+2);return this.pos=n===-1?e.length:n+2,this.make(`comment`,t,this.pos)}if(n===`$`&&this.syntax.dollarQuotes){let n=/^\$([A-Za-z_\u0080-\uFFFF][A-Za-z0-9_\u0080-\uFFFF]*)?\$/.exec(e.slice(t,t+64));if(n){let r=e.indexOf(n[0],t+n[0].length);return this.pos=r===-1?e.length:r+n[0].length,this.make(`string`,t,this.pos)}}if((n===`e`||n===`E`)&&e[t+1]===`'`&&this.syntax.dollarQuotes){this.pos=t+1;let e=this.quoted(t+1,`'`,`string`,!0);return this.make(`string`,t,e.end)}if(n===`'`)return this.quoted(t,`'`,`string`,this.syntax.backslashEscapes);if(n===`"`)return this.syntax.doubleQuoteIsIdentifier?this.quoted(t,`"`,`quoted_identifier`,!1):this.quoted(t,`"`,`string`,this.syntax.backslashEscapes);if((n===`x`||n===`X`||n===`b`||n===`B`||n===`n`||n===`N`)&&e[t+1]===`'`){this.pos=t+1;let e=this.quoted(t+1,`'`,`string`,this.syntax.backslashEscapes);return this.make(`string`,t,e.end)}if(n==="`")return this.quoted(t,"`",`quoted_identifier`,!1);if(n===`[`&&this.syntax.bracketIdentifiers){let n=e.indexOf(`]`,t+1);return this.pos=n===-1?e.length:n+1,this.make(`quoted_identifier`,t,this.pos)}if(p(n)||n===`.`&&p(e[t+1]??``))return this.number(t);if(n===`@`){let n=t+1;if(e[n]===`@`&&n++,e[n]===`'`||e[n]===`"`||e[n]==="`"){let r=e[n];this.pos=n;let i=this.quoted(n,r,`string`,this.syntax.backslashEscapes);return this.make(`variable`,t,i.end)}for(;n<e.length&&(f(e[n])||e[n]===`.`);)n++;return this.pos=n,this.make(`variable`,t,n)}if((n===`:`||n===`$`)&&d(e[t+1]??``)&&e[t+1]!==`$`){let n=t+1;for(;n<e.length&&f(e[n]);)n++;return this.pos=n,this.make(`variable`,t,n)}if(n===`?`){let n=t+1;for(;n<e.length&&p(e[n]);)n++;return this.pos=n,this.make(`placeholder`,t,n)}if(d(n)){let n=t+1;for(;n<e.length&&f(e[n])&&!e.startsWith(this.delimiter,n);)n++;let r=e.slice(t,n).toUpperCase();if(r===`DELIMITER`&&this.syntax.delimiterCommand&&this.significantInStatement===0){let r=n;for(;r<e.length&&(e[r]===` `||e[r]===` `);)r++;let i=r;for(;i<e.length&&!m(e[i]);)i++;if(i>r)return this.delimiter=e.slice(r,i),this.pos=i,this.make(`delimiter_command`,t,i)}if(r===`GO`&&this.syntax.goBatchSeparator&&this.atLineStart(t)){let r=n;for(;r<e.length&&(e[r]===` `||e[r]===` `);)r++;for(;r<e.length&&p(e[r]);)r++;for(;r<e.length&&(e[r]===` `||e[r]===` `||e[r]===`\r`);)r++;if(r>=e.length||e[r]===`
5
5
  `)return this.pos=r,this.make(`delimiter_command`,t,r)}return this.pos=n,this.make(`identifier`,t,n)}if(n===`/`&&this.syntax.plsqlBlocks&&this.atLineStart(t)){let n=t+1;for(;n<e.length&&(e[n]===` `||e[n]===` `||e[n]===`\r`);)n++;if(n>=e.length||e[n]===`
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{i as n,r,t as i}from"./Cu_sGzNJ.js";import{Mt as a}from"./B_zu4Zim.js";var o=e(t(),1),s=r(),c=5;function l({title:e,onRefresh:t,autoRefresh:r,actions:l,error:u,onDismissError:d,children:f}){let{t:p}=n(),[m,h]=(0,o.useState)(!1),[g,_]=(0,o.useState)(!1),v=(0,o.useRef)(t);(0,o.useEffect)(()=>{v.current=t},[t]),(0,o.useEffect)(()=>{if(!m)return;let e=setInterval(()=>{v.current()},c*1e3);return()=>clearInterval(e)},[m]);let y=async()=>{_(!0);try{await t()}finally{_(!1)}};return(0,s.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,s.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center gap-2 border-b bg-muted/30 px-3 py-1.5 text-xs`,children:[(0,s.jsx)(`span`,{className:`text-sm font-medium`,children:e}),(0,s.jsx)(`div`,{className:`flex-1`}),l,r&&(0,s.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5 text-muted-foreground`,children:[(0,s.jsx)(`input`,{type:`checkbox`,checked:m,onChange:e=>h(e.target.checked),className:`accent-primary`}),p(`tools.autoRefresh`,{seconds:c})]}),(0,s.jsxs)(`button`,{type:`button`,disabled:g,onClick:()=>void y(),className:`flex h-7 items-center gap-1 rounded border bg-background px-2 text-muted-foreground hover:text-foreground disabled:opacity-40`,children:[(0,s.jsx)(a,{className:`size-3 ${g?`animate-spin`:``}`}),p(`keyViewer.refresh`)]})]}),u&&(0,s.jsxs)(`div`,{className:`flex flex-shrink-0 items-start gap-2 border-b border-destructive/30 bg-destructive/10 px-3 py-1.5 text-xs text-destructive`,children:[(0,s.jsx)(`span`,{className:`flex-1 whitespace-pre-wrap`,children:u}),(0,s.jsx)(`button`,{type:`button`,onClick:d,children:(0,s.jsx)(i,{className:`size-3.5`})})]}),(0,s.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:f})]})}export{l as t};
1
+ import{r as e}from"./hePW80VL.js";import{p as t}from"./CyX8oVsa.js";import{i as n,r,t as i}from"./C76CctEl.js";import{Mt as a}from"./D4DxtYTA.js";var o=e(t(),1),s=r(),c=5;function l({title:e,onRefresh:t,autoRefresh:r,actions:l,error:u,onDismissError:d,children:f}){let{t:p}=n(),[m,h]=(0,o.useState)(!1),[g,_]=(0,o.useState)(!1),v=(0,o.useRef)(t);(0,o.useEffect)(()=>{v.current=t},[t]),(0,o.useEffect)(()=>{if(!m)return;let e=setInterval(()=>{v.current()},c*1e3);return()=>clearInterval(e)},[m]);let y=async()=>{_(!0);try{await t()}finally{_(!1)}};return(0,s.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,s.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center gap-2 border-b bg-muted/30 px-3 py-1.5 text-xs`,children:[(0,s.jsx)(`span`,{className:`text-sm font-medium`,children:e}),(0,s.jsx)(`div`,{className:`flex-1`}),l,r&&(0,s.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5 text-muted-foreground`,children:[(0,s.jsx)(`input`,{type:`checkbox`,checked:m,onChange:e=>h(e.target.checked),className:`accent-primary`}),p(`tools.autoRefresh`,{seconds:c})]}),(0,s.jsxs)(`button`,{type:`button`,disabled:g,onClick:()=>void y(),className:`flex h-7 items-center gap-1 rounded border bg-background px-2 text-muted-foreground hover:text-foreground disabled:opacity-40`,children:[(0,s.jsx)(a,{className:`size-3 ${g?`animate-spin`:``}`}),p(`keyViewer.refresh`)]})]}),u&&(0,s.jsxs)(`div`,{className:`flex flex-shrink-0 items-start gap-2 border-b border-destructive/30 bg-destructive/10 px-3 py-1.5 text-xs text-destructive`,children:[(0,s.jsx)(`span`,{className:`flex-1 whitespace-pre-wrap`,children:u}),(0,s.jsx)(`button`,{type:`button`,onClick:d,children:(0,s.jsx)(i,{className:`size-3.5`})})]}),(0,s.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:f})]})}export{l as t};
@@ -1 +1 @@
1
- import{r as e,t}from"./hePW80VL.js";import{c as n,p as r,u as i}from"./CYz610vE.js";var a=e(r()),o=(e,t,n,r)=>{let i=[n,{code:t,...r||{}}];if(e?.services?.logger?.forward)return e.services.logger.forward(i,`warn`,`react-i18next::`,!0);p(i[0])&&(i[0]=`react-i18next:: ${i[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...i):console?.warn&&console.warn(...i)},s={},c=(e,t,n,r)=>{p(n)&&s[n]||(p(n)&&(s[n]=new Date),o(e,t,n,r))},l=(e,t)=>()=>{if(e.isInitialized)t();else{let n=()=>{setTimeout(()=>{e.off(`initialized`,n)},0),t()};e.on(`initialized`,n)}},u=(e,t,n)=>{e.loadNamespaces(t,l(e,n))},d=(e,t,n,r)=>{if(p(n)&&(n=[n]),e.options.preload&&e.options.preload.indexOf(t)>-1)return u(e,n,r);n.forEach(t=>{e.options.ns.indexOf(t)<0&&e.options.ns.push(t)}),e.loadLanguages(t,l(e,r))},f=(e,t,n={})=>!t.languages||!t.languages.length?(c(t,`NO_LANGUAGES`,`i18n.languages were undefined or empty`,{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:n.lng,precheck:(t,r)=>{if(n.bindI18n&&n.bindI18n.indexOf(`languageChanging`)>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!r(t.isLanguageChangingTo,e))return!1}}),p=e=>typeof e==`string`,m=e=>typeof e==`object`&&!!e,h=(0,a.createContext)(),g=class{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(e=>{this.usedNamespaces[e]||(this.usedNamespaces[e]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}},_=t((e=>{var t=r();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:n,a=t.useState,o=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),v=t(((e,t)=>{t.exports=_()}))(),y={t:(e,t)=>{if(p(t))return t;if(m(t)&&p(t.defaultValue))return t.defaultValue;if(typeof e==`function`)return``;if(Array.isArray(e)){let t=e[e.length-1];return typeof t==`function`?``:t}return e},ready:!1},b=()=>()=>{},x=(e,t={})=>{let{i18n:r}=t,{i18n:o,defaultNS:s}=(0,a.useContext)(h)||{},l=r||o||n();l&&!l.reportNamespaces&&(l.reportNamespaces=new g),l||c(l,`NO_I18NEXT_INSTANCE`,`useTranslation: You will need to pass in an i18next instance by using initReactI18next or by passing it via props or context. In monorepo setups, make sure there is only one instance of react-i18next.`);let m=(0,a.useMemo)(()=>({...i(),...l?.options?.react,...t}),[l,t]),{useSuspense:_,keyPrefix:x}=m,S=e||s||l?.options?.defaultNS,C=p(S)?[S]:S||[`translation`],w=(0,a.useMemo)(()=>C,C);l?.reportNamespaces?.addUsedNamespaces?.(w);let T=(0,a.useRef)(0),E=(0,a.useCallback)(e=>{if(!l)return b;let{bindI18n:t,bindI18nStore:n}=m,r=()=>{T.current+=1,e()};return t&&l.on(t,r),n&&l.store.on(n,r),()=>{t&&t.split(` `).forEach(e=>l.off(e,r)),n&&n.split(` `).forEach(e=>l.store.off(e,r))}},[l,m]),D=(0,a.useRef)(),O=(0,a.useCallback)(()=>{if(!l)return y;let e=!!(l.isInitialized||l.initializedStoreOnce)&&w.every(e=>f(e,l,m)),n=t.lng||l.language,r=T.current,i=D.current;if(i&&i.ready===e&&i.lng===n&&i.keyPrefix===x&&i.revision===r)return i;let a={t:l.getFixedT(n,m.nsMode===`fallback`?w:w[0],x,{scopeNs:w}),ready:e,lng:n,keyPrefix:x,revision:r};return D.current=a,a},[l,w,x,m,t.lng]),[k,A]=(0,a.useState)(0),{t:j,ready:M}=(0,v.useSyncExternalStore)(E,O,O);(0,a.useEffect)(()=>{if(l&&!M&&!_){let e=()=>A(e=>e+1);t.lng?d(l,t.lng,w,e):u(l,w,e)}},[l,t.lng,w,M,_,k]);let N=l||{},P=(0,a.useRef)(null),F=(0,a.useRef)(),I=e=>{let t=Object.getOwnPropertyDescriptors(e);t.__original&&delete t.__original;let n=Object.create(Object.getPrototypeOf(e),t);if(!Object.prototype.hasOwnProperty.call(n,`__original`))try{Object.defineProperty(n,"__original",{value:e,writable:!1,enumerable:!1,configurable:!1})}catch{}return n},L=(0,a.useMemo)(()=>{let e=N,t=e?.language,n=e;e&&(P.current&&P.current.__original===e&&F.current===t?n=P.current:(n=I(e),P.current=n,F.current=t));let r=!M&&!_?(...e)=>(c(l,`USE_T_BEFORE_READY`,`useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t.`),j(...e)):j,i=[r,n,M];return i.t=r,i.i18n=n,i.ready=M,i},[j,N,M,N.resolvedLanguage,N.language,N.languages]);if(l&&_&&!M){let e=!1;try{e=!1}catch{}throw e&&c(l,`SUSPENDED_WHILE_LOADING`,`useTranslation: suspended while translations are loading (useSuspense is true by default). Add a <Suspense> boundary above this component, or set react.useSuspense: false in the i18next init options. https://react.i18next.com/latest/usetranslation-hook`),new Promise(e=>{let n=()=>e();t.lng?d(l,t.lng,w,n):u(l,w,n)})}return L},S=t((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),C=t(((e,t)=>{t.exports=S()})),w=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),T=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),E=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),D=e=>{let t=E(e);return t.charAt(0).toUpperCase()+t.slice(1)},O={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},k=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},A=(0,a.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:o,iconNode:s,...c},l)=>(0,a.createElement)(`svg`,{ref:l,...O,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:w(`lucide`,i),...!o&&!k(c)&&{"aria-hidden":`true`},...c},[...s.map(([e,t])=>(0,a.createElement)(e,t)),...Array.isArray(o)?o:[o]])),j=(e,t)=>{let n=(0,a.forwardRef)(({className:n,...r},i)=>(0,a.createElement)(A,{ref:i,iconNode:t,className:w(`lucide-${T(D(e))}`,`lucide-${e}`,n),...r}));return n.displayName=D(e),n},M=j(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);export{h as a,o as c,x as i,c as l,j as n,m as o,C as r,p as s,M as t};
1
+ import{r as e,t}from"./hePW80VL.js";import{c as n,p as r,u as i}from"./CyX8oVsa.js";var a=e(r()),o=(e,t,n,r)=>{let i=[n,{code:t,...r||{}}];if(e?.services?.logger?.forward)return e.services.logger.forward(i,`warn`,`react-i18next::`,!0);p(i[0])&&(i[0]=`react-i18next:: ${i[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...i):console?.warn&&console.warn(...i)},s={},c=(e,t,n,r)=>{p(n)&&s[n]||(p(n)&&(s[n]=new Date),o(e,t,n,r))},l=(e,t)=>()=>{if(e.isInitialized)t();else{let n=()=>{setTimeout(()=>{e.off(`initialized`,n)},0),t()};e.on(`initialized`,n)}},u=(e,t,n)=>{e.loadNamespaces(t,l(e,n))},d=(e,t,n,r)=>{if(p(n)&&(n=[n]),e.options.preload&&e.options.preload.indexOf(t)>-1)return u(e,n,r);n.forEach(t=>{e.options.ns.indexOf(t)<0&&e.options.ns.push(t)}),e.loadLanguages(t,l(e,r))},f=(e,t,n={})=>!t.languages||!t.languages.length?(c(t,`NO_LANGUAGES`,`i18n.languages were undefined or empty`,{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:n.lng,precheck:(t,r)=>{if(n.bindI18n&&n.bindI18n.indexOf(`languageChanging`)>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!r(t.isLanguageChangingTo,e))return!1}}),p=e=>typeof e==`string`,m=e=>typeof e==`object`&&!!e,h=(0,a.createContext)(),g=class{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(e=>{this.usedNamespaces[e]||(this.usedNamespaces[e]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}},_=t((e=>{var t=r();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:n,a=t.useState,o=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),v=t(((e,t)=>{t.exports=_()}))(),y={t:(e,t)=>{if(p(t))return t;if(m(t)&&p(t.defaultValue))return t.defaultValue;if(typeof e==`function`)return``;if(Array.isArray(e)){let t=e[e.length-1];return typeof t==`function`?``:t}return e},ready:!1},b=()=>()=>{},x=(e,t={})=>{let{i18n:r}=t,{i18n:o,defaultNS:s}=(0,a.useContext)(h)||{},l=r||o||n();l&&!l.reportNamespaces&&(l.reportNamespaces=new g),l||c(l,`NO_I18NEXT_INSTANCE`,`useTranslation: You will need to pass in an i18next instance by using initReactI18next or by passing it via props or context. In monorepo setups, make sure there is only one instance of react-i18next.`);let m=(0,a.useMemo)(()=>({...i(),...l?.options?.react,...t}),[l,t]),{useSuspense:_,keyPrefix:x}=m,S=e||s||l?.options?.defaultNS,C=p(S)?[S]:S||[`translation`],w=(0,a.useMemo)(()=>C,C);l?.reportNamespaces?.addUsedNamespaces?.(w);let T=(0,a.useRef)(0),E=(0,a.useCallback)(e=>{if(!l)return b;let{bindI18n:t,bindI18nStore:n}=m,r=()=>{T.current+=1,e()};return t&&l.on(t,r),n&&l.store.on(n,r),()=>{t&&t.split(` `).forEach(e=>l.off(e,r)),n&&n.split(` `).forEach(e=>l.store.off(e,r))}},[l,m]),D=(0,a.useRef)(),O=(0,a.useCallback)(()=>{if(!l)return y;let e=!!(l.isInitialized||l.initializedStoreOnce)&&w.every(e=>f(e,l,m)),n=t.lng||l.language,r=T.current,i=D.current;if(i&&i.ready===e&&i.lng===n&&i.keyPrefix===x&&i.revision===r)return i;let a={t:l.getFixedT(n,m.nsMode===`fallback`?w:w[0],x,{scopeNs:w}),ready:e,lng:n,keyPrefix:x,revision:r};return D.current=a,a},[l,w,x,m,t.lng]),[k,A]=(0,a.useState)(0),{t:j,ready:M}=(0,v.useSyncExternalStore)(E,O,O);(0,a.useEffect)(()=>{if(l&&!M&&!_){let e=()=>A(e=>e+1);t.lng?d(l,t.lng,w,e):u(l,w,e)}},[l,t.lng,w,M,_,k]);let N=l||{},P=(0,a.useRef)(null),F=(0,a.useRef)(),I=e=>{let t=Object.getOwnPropertyDescriptors(e);t.__original&&delete t.__original;let n=Object.create(Object.getPrototypeOf(e),t);if(!Object.prototype.hasOwnProperty.call(n,`__original`))try{Object.defineProperty(n,"__original",{value:e,writable:!1,enumerable:!1,configurable:!1})}catch{}return n},L=(0,a.useMemo)(()=>{let e=N,t=e?.language,n=e;e&&(P.current&&P.current.__original===e&&F.current===t?n=P.current:(n=I(e),P.current=n,F.current=t));let r=!M&&!_?(...e)=>(c(l,`USE_T_BEFORE_READY`,`useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t.`),j(...e)):j,i=[r,n,M];return i.t=r,i.i18n=n,i.ready=M,i},[j,N,M,N.resolvedLanguage,N.language,N.languages]);if(l&&_&&!M){let e=!1;try{e=!1}catch{}throw e&&c(l,`SUSPENDED_WHILE_LOADING`,`useTranslation: suspended while translations are loading (useSuspense is true by default). Add a <Suspense> boundary above this component, or set react.useSuspense: false in the i18next init options. https://react.i18next.com/latest/usetranslation-hook`),new Promise(e=>{let n=()=>e();t.lng?d(l,t.lng,w,n):u(l,w,n)})}return L},S=t((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),C=t(((e,t)=>{t.exports=S()})),w=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),T=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),E=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),D=e=>{let t=E(e);return t.charAt(0).toUpperCase()+t.slice(1)},O={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},k=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},A=(0,a.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:o,iconNode:s,...c},l)=>(0,a.createElement)(`svg`,{ref:l,...O,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:w(`lucide`,i),...!o&&!k(c)&&{"aria-hidden":`true`},...c},[...s.map(([e,t])=>(0,a.createElement)(e,t)),...Array.isArray(o)?o:[o]])),j=(e,t)=>{let n=(0,a.forwardRef)(({className:n,...r},i)=>(0,a.createElement)(A,{ref:i,iconNode:t,className:w(`lucide-${T(D(e))}`,`lucide-${e}`,n),...r}));return n.displayName=D(e),n},M=j(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);export{h as a,o as c,x as i,c as l,j as n,m as o,C as r,p as s,M as t};
@@ -1 +1 @@
1
- import{t as e}from"./CiL8zoYm.js";import{i as t,r as n}from"./Cu_sGzNJ.js";import{a as r,i,n as a,o,r as s,t as c}from"./DzRyVlxz.js";import{n as l}from"./D8_hwGjG.js";import{Y as u,t as d}from"./B_zu4Zim.js";var f=n(),p=`https://planche.dev`,m=`/third-party-notices.txt`;function h(){let n=l(e=>e.activeDialog),h=l(e=>e.closeDialog),{t:g}=t();return(0,f.jsx)(c,{open:n===`about`,onOpenChange:e=>{e||h()},children:(0,f.jsxs)(a,{className:`sm:max-w-[440px]`,children:[(0,f.jsx)(r,{children:(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(d,{size:44,className:`shrink-0`}),(0,f.jsxs)(`div`,{className:`grid gap-1`,children:[(0,f.jsx)(o,{children:g(`about.title`)}),(0,f.jsx)(s,{children:g(`about.tagline`)})]})]})}),(0,f.jsxs)(`div`,{className:`grid gap-3 text-sm`,children:[(0,f.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-4 gap-y-1`,children:[(0,f.jsx)(`dt`,{className:`text-muted-foreground`,children:g(`about.version`)}),(0,f.jsx)(`dd`,{children:`0.1.1`}),(0,f.jsx)(`dt`,{className:`text-muted-foreground`,children:g(`about.website`)}),(0,f.jsx)(`dd`,{children:(0,f.jsx)(`a`,{href:p,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:p})}),(0,f.jsx)(`dt`,{className:`text-muted-foreground`,children:g(`about.licenses`)}),(0,f.jsx)(`dd`,{children:(0,f.jsx)(`a`,{href:m,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:g(`about.licensesLink`)})}),(0,f.jsx)(`dt`,{className:`text-muted-foreground`,children:g(`about.legal`)}),(0,f.jsxs)(`dd`,{className:`flex gap-3`,children:[(0,f.jsx)(`a`,{href:u.terms,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:g(`about.terms`)}),(0,f.jsx)(`a`,{href:u.privacy,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:g(`about.privacy`)}),(0,f.jsx)(`a`,{href:u.refund,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:g(`about.refund`)})]})]}),(0,f.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`© 2026 Juwon Jeong. `,g(`about.rights`)]}),(0,f.jsx)(`p`,{className:`rounded-md border bg-muted/40 p-3 text-xs text-muted-foreground`,children:g(`about.disclaimer`)}),(0,f.jsxs)(`div`,{className:`rounded-md border border-amber-500/40 bg-amber-500/5 p-3 text-xs text-muted-foreground`,children:[(0,f.jsx)(`p`,{className:`mb-1 font-medium text-amber-600 dark:text-amber-400`,children:g(`pro.noticeTitle`)}),(0,f.jsx)(`p`,{children:g(`pro.notice`)})]})]}),(0,f.jsx)(i,{children:(0,f.jsx)(e,{onClick:h,children:g(`settings.done`)})})]})})}export{h as AboutDialog};
1
+ import{t as e}from"./Dya0zxo6.js";import{i as t,r as n}from"./C76CctEl.js";import{a as r,i,n as a,o,r as s,t as c}from"./kTwcxyaO.js";import{n as l}from"./BihjBM79.js";import{Y as u,t as d}from"./D4DxtYTA.js";var f=n(),p=`https://planche.dev`,m=`/third-party-notices.txt`;function h(){let n=l(e=>e.activeDialog),h=l(e=>e.closeDialog),{t:g}=t();return(0,f.jsx)(c,{open:n===`about`,onOpenChange:e=>{e||h()},children:(0,f.jsxs)(a,{className:`sm:max-w-[440px]`,children:[(0,f.jsx)(r,{children:(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(d,{size:44,className:`shrink-0`}),(0,f.jsxs)(`div`,{className:`grid gap-1`,children:[(0,f.jsx)(o,{children:g(`about.title`)}),(0,f.jsx)(s,{children:g(`about.tagline`)})]})]})}),(0,f.jsxs)(`div`,{className:`grid gap-3 text-sm`,children:[(0,f.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-4 gap-y-1`,children:[(0,f.jsx)(`dt`,{className:`text-muted-foreground`,children:g(`about.version`)}),(0,f.jsx)(`dd`,{children:`0.9.3`}),(0,f.jsx)(`dt`,{className:`text-muted-foreground`,children:g(`about.website`)}),(0,f.jsx)(`dd`,{children:(0,f.jsx)(`a`,{href:p,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:p})}),(0,f.jsx)(`dt`,{className:`text-muted-foreground`,children:g(`about.licenses`)}),(0,f.jsx)(`dd`,{children:(0,f.jsx)(`a`,{href:m,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:g(`about.licensesLink`)})}),(0,f.jsx)(`dt`,{className:`text-muted-foreground`,children:g(`about.legal`)}),(0,f.jsxs)(`dd`,{className:`flex gap-3`,children:[(0,f.jsx)(`a`,{href:u.terms,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:g(`about.terms`)}),(0,f.jsx)(`a`,{href:u.privacy,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:g(`about.privacy`)}),(0,f.jsx)(`a`,{href:u.refund,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:g(`about.refund`)})]})]}),(0,f.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`© 2026 Juwon Jeong. `,g(`about.rights`)]}),(0,f.jsx)(`p`,{className:`rounded-md border bg-muted/40 p-3 text-xs text-muted-foreground`,children:g(`about.disclaimer`)}),(0,f.jsxs)(`div`,{className:`rounded-md border border-amber-500/40 bg-amber-500/5 p-3 text-xs text-muted-foreground`,children:[(0,f.jsx)(`p`,{className:`mb-1 font-medium text-amber-600 dark:text-amber-400`,children:g(`pro.noticeTitle`)}),(0,f.jsx)(`p`,{children:g(`pro.notice`)})]})]}),(0,f.jsx)(i,{children:(0,f.jsx)(e,{onClick:h,children:g(`settings.done`)})})]})})}export{h as AboutDialog};
@@ -1,3 +1,3 @@
1
- import{r as e}from"./hePW80VL.js";import{o as t,p as n}from"./CYz610vE.js";import{t as r}from"./CiL8zoYm.js";import{i,r as a}from"./Cu_sGzNJ.js";import{a as o,i as s,n as c,o as l,t as u}from"./DzRyVlxz.js";import{a as d,i as f,n as p,r as m,t as h}from"./B3qo2BmL.js";import{R as g,t as _}from"./CAd2f6EE.js";import{n as v,t as y}from"./D8_hwGjG.js";import{n as b}from"./D6SRSRpo.js";import{a as x}from"./BghfQrAj.js";import{r as S}from"./Ci1xBOLy.js";import{p as ee}from"./DpPKm22O.js";import{F as te,G as C,c as w,l as ne}from"./B_zu4Zim.js";import{t as T}from"./CnYBZPf9.js";var E=e(n(),1);function D(e,t){let n=e==null?``:typeof e==`object`?JSON.stringify(e):String(e);return!(typeof e==`number`||typeof e==`bigint`||/^[-+]?\d+(\.\d+)?([eE][-+]?\d+)?$/.test(n))&&/^[=+\-@\t\r]/.test(n)&&(n=`'${n}`),n.includes(t)||n.includes(`"`)||n.includes(`
1
+ import{r as e}from"./hePW80VL.js";import{o as t,p as n}from"./CyX8oVsa.js";import{t as r}from"./Dya0zxo6.js";import{i,r as a}from"./C76CctEl.js";import{a as o,i as s,n as c,o as l,t as u}from"./kTwcxyaO.js";import{a as d,i as f,n as p,r as m,t as h}from"./34iJa-68.js";import{R as g,t as _}from"./iz6RnRcO.js";import{n as v,t as y}from"./BihjBM79.js";import{n as b}from"./C_qmv4pB.js";import{a as x}from"./BVZGLNq_.js";import{r as S}from"./CH4cEkW4.js";import{p as ee}from"./CZRhmV_L.js";import{F as te,G as C,c as w,l as ne}from"./D4DxtYTA.js";import{t as T}from"./CnYBZPf9.js";var E=e(n(),1);function D(e,t){let n=e==null?``:typeof e==`object`?JSON.stringify(e):String(e);return!(typeof e==`number`||typeof e==`bigint`||/^[-+]?\d+(\.\d+)?([eE][-+]?\d+)?$/.test(n))&&/^[=+\-@\t\r]/.test(n)&&(n=`'${n}`),n.includes(t)||n.includes(`"`)||n.includes(`
2
2
  `)||n.includes(`\r`)?`"${n.replace(/"/g,`""`)}"`:n}var O=(e,t)=>e.map(e=>D(e,t)).join(t)+`
3
3
  `,k=e=>e===` `,A=e=>k(e)?`TSV`:`CSV`,j=e=>k(e)?`.tsv`:`.csv`,M=e=>k(e)?`text/tab-separated-values`:`text/csv`;async function N(e,t){let n=T(e),r=M(t);if(typeof window.showSaveFilePicker==`function`)try{let e=await(await window.showSaveFilePicker({suggestedName:n,types:[{description:A(t),accept:{[r]:[j(t)]}}]})).createWritable();return await e.write(``),{write:t=>e.write(t),finish:()=>e.close(),abort:()=>e.abort()}}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)throw new P}let i=[``];return{write:async e=>{i.push(e)},finish:async()=>{let e=new Blob(i,{type:`${r};charset=utf-8;`}),t=URL.createObjectURL(e),a=document.createElement(`a`);a.href=t,a.download=n,a.click(),URL.revokeObjectURL(t)},abort:async()=>{i.length=0}}}var P=class extends Error{constructor(){super(`CSV export cancelled`)}};async function F(e){let n=await N(`${e.table}${j(e.delimiter)}`,e.delimiter),r=0;try{let i=await C({connectionId:e.connectionId,database:e.database,table:e.table,signal:e.signal,onProgress:e.onProgress}),a=i.fields.map(e=>e.name);e.includeHeaders&&await n.write(O(a,e.delimiter));for await(let t of i.pages)await n.write(t.map(t=>O(a.map(e=>t[e]),e.delimiter)).join(``)),r+=t.length;return await n.finish(),t(`export_csv`,{origin:`table`,rows:r,format:A(e.delimiter)}),r}catch(e){throw await n.abort().catch(()=>void 0),e}}function re(e,n,r,i,a){let o=e.map(e=>e.name),s=[``];i&&s.push(O(o,r));for(let e of n)s.push(O(o.map(t=>e[t]),r));let c=new Blob(s,{type:`${M(r)};charset=utf-8;`}),l=URL.createObjectURL(c),u=document.createElement(`a`);u.href=l,u.download=T(a??`query_result${j(r)}`),u.click(),URL.revokeObjectURL(l),t(`export_csv`,{origin:`result`,rows:n.length,format:A(r)})}var I=a(),ie=[{value:`,`,label:`database.csv.delimiterComma`},{value:` `,label:`database.csv.delimiterTab`},{value:`;`,label:`database.csv.delimiterSemicolon`},{value:`|`,label:`database.csv.delimiterPipe`}];function L(){let{t:e}=i(),{activeDialog:t,closeDialog:n}=v(),a=y(`export-csv`),C=_(e=>e.activeConnectionId),T=b(),D=t===`export-csv`,[O,A]=(0,E.useState)(`query_result`),[j,M]=(0,E.useState)(``),[N,L]=(0,E.useState)([]),[R,z]=(0,E.useState)(``),[B,V]=(0,E.useState)(`,`),[H,U]=(0,E.useState)(!0),[W,G]=(0,E.useState)(!1),[K,q]=(0,E.useState)(null),[J,Y]=(0,E.useState)(null),X=(0,E.useRef)(null),Z=k(B)?`TSV`:`CSV`,Q=()=>{if(a?.nodeText&&(a.nodeType===g.TABLE||a.nodeType===g.VIEW)){let e=a.metadata?.database;return{table:a.nodeText,database:typeof e==`string`?e:``}}if(!C)return null;let e=(T.tabs[C]??[]).find(e=>e.id===T.activeTabId[C]);return e?.sourceTable?{table:e.sourceTable.table,database:e.sourceTable.database}:null};(0,E.useEffect)(()=>{if(!D)return;let e=Q();V(a?.delimiter??`,`),e&&(M(e.table),A(`table_data`))},[D]),(0,E.useEffect)(()=>{if(!D||!C)return;let e=_.getState().activeConnections.find(e=>e.id===C);if(!e?.serverConnectionId)return;let t=!1;return(async()=>{try{let n=await S(C).introspect.listDatabases(x(e.serverConnectionId));if(t)return;L(n);let r=T.tabs[C]?.find(e=>e.id===T.activeTabId[C])?.database||``,i=Q()?.database||``;z(e=>n.includes(i)?i:n.includes(e)?e:n.includes(r)?r:n.length===1?n[0]:``)}catch{t||L([])}})(),()=>{t=!0}},[D,C]);function $(e){if(!e){if(W){X.current?.abort();return}n(),A(`query_result`),M(``),V(`,`),U(!0)}}async function ae(){if(!C)return;if(Y(null),O===`query_result`){let e=T.activeTabId[C],t=(T.tabs[C]??[]).find(t=>t.id===e)?.results?.[0];if(!t||t.rows.length===0)return;re(t.fields,t.rows,B,H),n();return}if(!j.trim()||!R)return;let t=new AbortController;X.current=t,G(!0),q({loaded:0,total:null});try{let r=await F({connectionId:C,database:R,table:j.trim(),delimiter:B,includeHeaders:H,onProgress:q,signal:t.signal});v.getState().setFooterMessage(e(`database.csv.done`,{count:r,table:j.trim(),format:Z})),n()}catch(e){!(e instanceof P)&&!(e instanceof ee&&t.signal.aborted)&&Y(e instanceof Error?e.message:String(e))}finally{G(!1),q(null),X.current=null}}let oe=K?.total?Math.min(100,Math.round(K.loaded/K.total*100)):null;return(0,I.jsx)(u,{open:D,onOpenChange:$,children:(0,I.jsxs)(c,{className:`sm:max-w-[450px]`,children:[(0,I.jsx)(o,{children:(0,I.jsx)(l,{children:e(`database.csv.title`,{format:Z})})}),(0,I.jsxs)(`div`,{className:`space-y-4`,children:[(0,I.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,I.jsx)(w,{children:e(`database.csv.target`)}),(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsxs)(`label`,{className:`flex items-center gap-2 text-sm cursor-pointer`,children:[(0,I.jsx)(`input`,{type:`radio`,name:`csv-target`,value:`query_result`,checked:O===`query_result`,onChange:()=>A(`query_result`)}),e(`database.csv.targetQueryResult`)]}),(0,I.jsxs)(`label`,{className:`flex items-center gap-2 text-sm cursor-pointer`,children:[(0,I.jsx)(`input`,{type:`radio`,name:`csv-target`,value:`table_data`,checked:O===`table_data`,onChange:()=>A(`table_data`)}),e(`database.csv.targetTableData`)]})]})]}),O===`table_data`&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,I.jsx)(w,{htmlFor:`csv-database`,children:e(`database.csv.database`)}),(0,I.jsxs)(h,{value:R,onValueChange:z,disabled:N.length===0,children:[(0,I.jsx)(f,{id:`csv-database`,className:`w-full`,children:(0,I.jsx)(d,{placeholder:e(`database.csv.databasePlaceholder`)})}),(0,I.jsx)(p,{children:N.map(e=>(0,I.jsx)(m,{value:e,children:e},e))})]})]}),(0,I.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,I.jsx)(w,{htmlFor:`csv-table-name`,children:e(`database.csv.tableName`)}),(0,I.jsx)(ne,{id:`csv-table-name`,value:j,onChange:e=>M(e.target.value),placeholder:e(`database.csv.tableNamePlaceholder`)})]})]}),(0,I.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,I.jsx)(w,{htmlFor:`csv-delimiter`,children:e(`database.csv.delimiter`)}),(0,I.jsxs)(h,{value:B,onValueChange:V,children:[(0,I.jsx)(f,{id:`csv-delimiter`,className:`w-full`,children:(0,I.jsx)(d,{})}),(0,I.jsx)(p,{children:ie.map(t=>(0,I.jsx)(m,{value:t.value,children:e(t.label)},t.value))})]})]}),(0,I.jsxs)(`label`,{className:`flex items-center gap-2 text-sm cursor-pointer`,children:[(0,I.jsx)(`input`,{type:`checkbox`,checked:H,onChange:e=>U(e.target.checked)}),e(`database.csv.includeHeaders`)]})]}),K&&(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsx)(te,{value:oe??0}),(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:K.total===null?e(`database.csv.progressUnknown`,{loaded:K.loaded}):e(`database.csv.progress`,{loaded:K.loaded,total:K.total})})]}),J&&(0,I.jsx)(`p`,{className:`text-sm text-destructive whitespace-pre-wrap`,children:J}),(0,I.jsxs)(s,{children:[(0,I.jsx)(r,{variant:`outline`,onClick:()=>$(!1),children:e(W?`database.csv.stop`:`database.csv.cancel`)}),(0,I.jsx)(r,{onClick:ae,disabled:W||O===`table_data`&&!j.trim(),children:e(W?`database.csv.downloading`:`database.csv.download`)})]})]})})}export{L as DownloadToCSVDialog};
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{o as t,p as n}from"./CYz610vE.js";import{t as r}from"./CiL8zoYm.js";import{i,r as a}from"./Cu_sGzNJ.js";import{a as o,i as s,n as c,o as l,t as u}from"./DzRyVlxz.js";import{a as d,i as f,n as p,r as m,t as h}from"./B3qo2BmL.js";import{t as ee}from"./CAd2f6EE.js";import{n as g,t as _}from"./D8_hwGjG.js";import{a as v}from"./BghfQrAj.js";import{r as y}from"./Ci1xBOLy.js";import{t as b}from"./BEY3Hwp0.js";import{$ as x,c as S,et as C,l as w}from"./B_zu4Zim.js";var T=e(n(),1),E=a(),D=e=>e instanceof Error?e.message:String(e);function O(){let{t:e}=i(),n=g(e=>e.activeDialog),a=g(e=>e.closeDialog),O=_(`link-column`),k=n===`link-column`&&!!O,A=O?.connectionId??``,j=ee(e=>e.activeConnections),M=j.filter(e=>e.serverConnectionId),N=C(e=>e.links),P=C(e=>e.setLink),F=C(e=>e.removeLink),I=O?x(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 y(L).introspect.listDatabases(v(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 y(L).introspect.listTables(v(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 y(L).introspect.listColumns(v(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}),b(`column_link`),t(`column_link_set`,{dbms:y(A).id,target_dbms:y(L).id,cross_database:K!==O.database,cross_connection:e}),a()}function ne(){O&&(F(A,O),a())}return(0,E.jsx)(u,{open:k,onOpenChange:e=>{e||a()},children:(0,E.jsxs)(c,{className:`sm:max-w-[460px]`,children:[(0,E.jsx)(o,{children:(0,E.jsx)(l,{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)(S,{children:e(`result.link.source`)}),(0,E.jsx)(w,{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)(S,{htmlFor:`link-conn`,children:e(`result.link.targetConnection`)}),(0,E.jsxs)(h,{value:L,onValueChange:e=>{R(e),Y(``),U([]),G([])},children:[(0,E.jsx)(f,{id:`link-conn`,className:`w-full`,children:(0,E.jsx)(d,{})}),(0,E.jsx)(p,{children:M.map(e=>(0,E.jsx)(m,{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)(S,{htmlFor:`link-db`,children:e(`result.link.targetDatabase`)}),(0,E.jsxs)(h,{value:K,onValueChange:e=>{q(e),Y(``),G([])},children:[(0,E.jsx)(f,{id:`link-db`,className:`w-full`,children:(0,E.jsx)(d,{})}),(0,E.jsx)(p,{children:B.map(e=>(0,E.jsx)(m,{value:e,children:e},e))})]})]}),(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(S,{htmlFor:`link-table`,children:e(`result.link.targetTable`)}),(0,E.jsxs)(h,{value:J,onValueChange:Y,disabled:H.length===0,children:[(0,E.jsx)(f,{id:`link-table`,className:`w-full`,children:(0,E.jsx)(d,{placeholder:e(`result.link.pickTable`)})}),(0,E.jsx)(p,{children:H.map(e=>(0,E.jsx)(m,{value:e,children:e},e))})]})]}),(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(S,{htmlFor:`link-column`,children:e(`result.link.targetColumn`)}),(0,E.jsxs)(h,{value:X,onValueChange:Z,disabled:W.length===0,children:[(0,E.jsx)(f,{id:`link-column`,className:`w-full`,children:(0,E.jsx)(d,{placeholder:e(`result.link.pickColumn`)})}),(0,E.jsx)(p,{children:W.map(e=>(0,E.jsx)(m,{value:e,children:e},e))})]})]}),Q&&(0,E.jsx)(`p`,{className:`text-xs text-destructive`,children:Q})]}),(0,E.jsxs)(s,{children:[I&&(0,E.jsx)(r,{variant:`destructive`,onClick:ne,className:`mr-auto`,children:e(`result.link.remove`)}),(0,E.jsx)(r,{variant:`outline`,onClick:a,children:e(`result.link.cancel`)}),(0,E.jsx)(r,{onClick:te,disabled:!K||!J||!X,children:e(`result.link.save`)})]})]})})}export{O as LinkColumnDialog};
1
+ import{r as e}from"./hePW80VL.js";import{o as t,p as n}from"./CyX8oVsa.js";import{t as r}from"./Dya0zxo6.js";import{i,r as a}from"./C76CctEl.js";import{a as o,i as s,n as c,o as l,t as u}from"./kTwcxyaO.js";import{a as d,i as f,n as p,r as m,t as h}from"./34iJa-68.js";import{t as ee}from"./iz6RnRcO.js";import{n as g,t as _}from"./BihjBM79.js";import{a as v}from"./BVZGLNq_.js";import{r as y}from"./CH4cEkW4.js";import{t as b}from"./UEkRIZwQ.js";import{$ as x,c as S,et as C,l as w}from"./D4DxtYTA.js";var T=e(n(),1),E=a(),D=e=>e instanceof Error?e.message:String(e);function O(){let{t:e}=i(),n=g(e=>e.activeDialog),a=g(e=>e.closeDialog),O=_(`link-column`),k=n===`link-column`&&!!O,A=O?.connectionId??``,j=ee(e=>e.activeConnections),M=j.filter(e=>e.serverConnectionId),N=C(e=>e.links),P=C(e=>e.setLink),F=C(e=>e.removeLink),I=O?x(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 y(L).introspect.listDatabases(v(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 y(L).introspect.listTables(v(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 y(L).introspect.listColumns(v(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}),b(`column_link`),t(`column_link_set`,{dbms:y(A).id,target_dbms:y(L).id,cross_database:K!==O.database,cross_connection:e}),a()}function ne(){O&&(F(A,O),a())}return(0,E.jsx)(u,{open:k,onOpenChange:e=>{e||a()},children:(0,E.jsxs)(c,{className:`sm:max-w-[460px]`,children:[(0,E.jsx)(o,{children:(0,E.jsx)(l,{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)(S,{children:e(`result.link.source`)}),(0,E.jsx)(w,{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)(S,{htmlFor:`link-conn`,children:e(`result.link.targetConnection`)}),(0,E.jsxs)(h,{value:L,onValueChange:e=>{R(e),Y(``),U([]),G([])},children:[(0,E.jsx)(f,{id:`link-conn`,className:`w-full`,children:(0,E.jsx)(d,{})}),(0,E.jsx)(p,{children:M.map(e=>(0,E.jsx)(m,{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)(S,{htmlFor:`link-db`,children:e(`result.link.targetDatabase`)}),(0,E.jsxs)(h,{value:K,onValueChange:e=>{q(e),Y(``),G([])},children:[(0,E.jsx)(f,{id:`link-db`,className:`w-full`,children:(0,E.jsx)(d,{})}),(0,E.jsx)(p,{children:B.map(e=>(0,E.jsx)(m,{value:e,children:e},e))})]})]}),(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(S,{htmlFor:`link-table`,children:e(`result.link.targetTable`)}),(0,E.jsxs)(h,{value:J,onValueChange:Y,disabled:H.length===0,children:[(0,E.jsx)(f,{id:`link-table`,className:`w-full`,children:(0,E.jsx)(d,{placeholder:e(`result.link.pickTable`)})}),(0,E.jsx)(p,{children:H.map(e=>(0,E.jsx)(m,{value:e,children:e},e))})]})]}),(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(S,{htmlFor:`link-column`,children:e(`result.link.targetColumn`)}),(0,E.jsxs)(h,{value:X,onValueChange:Z,disabled:W.length===0,children:[(0,E.jsx)(f,{id:`link-column`,className:`w-full`,children:(0,E.jsx)(d,{placeholder:e(`result.link.pickColumn`)})}),(0,E.jsx)(p,{children:W.map(e=>(0,E.jsx)(m,{value:e,children:e},e))})]})]}),Q&&(0,E.jsx)(`p`,{className:`text-xs text-destructive`,children:Q})]}),(0,E.jsxs)(s,{children:[I&&(0,E.jsx)(r,{variant:`destructive`,onClick:ne,className:`mr-auto`,children:e(`result.link.remove`)}),(0,E.jsx)(r,{variant:`outline`,onClick:a,children:e(`result.link.cancel`)}),(0,E.jsx)(r,{onClick:te,disabled:!K||!J||!X,children:e(`result.link.save`)})]})]})})}export{O as LinkColumnDialog};
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{t as n}from"./CAd2f6EE.js";import{y as r}from"./BPLdNS4h.js";import{t as i}from"./_zaonxnw.js";var a=e(t(),1),o=2e3;function s(e,t){let s=n(t=>t.activeConnections.find(t=>t.id===e)?.serverConnectionId??null),[c,l]=(0,a.useState)([]),[u,d]=(0,a.useState)(!1),[f,p]=(0,a.useState)(0),[m,h]=(0,a.useState)(null),g=(0,a.useRef)(null),_=(0,a.useRef)(t);(0,a.useEffect)(()=>{_.current=t},[t]);let v=(0,a.useCallback)(()=>{g.current?.(),g.current=null,d(!1)},[]),y=(0,a.useCallback)(async e=>{if(s){v(),h(null);try{g.current=await r({...e,connectionId:s},e=>{if(e.type===`dropped`)p(t=>t+e.count);else if(e.type===`error`)h(e.message);else{let t=_.current(e);t!==null&&l(e=>[t,...e].slice(0,o))}},()=>{g.current=null,d(!1)}),d(!0)}catch(e){h(i(e))}}},[s,v]);return(0,a.useEffect)(()=>()=>g.current?.(),[]),{rows:c,running:u,dropped:f,error:m,start:y,stop:v,clear:()=>{l([]),p(0)},dismissError:()=>h(null),connected:s!==null}}export{s as n,o as t};
1
+ import{r as e}from"./hePW80VL.js";import{p as t}from"./CyX8oVsa.js";import{t as n}from"./iz6RnRcO.js";import{y as r}from"./zdvaVsTo.js";import{t as i}from"./_zaonxnw.js";var a=e(t(),1),o=2e3;function s(e,t){let s=n(t=>t.activeConnections.find(t=>t.id===e)?.serverConnectionId??null),[c,l]=(0,a.useState)([]),[u,d]=(0,a.useState)(!1),[f,p]=(0,a.useState)(0),[m,h]=(0,a.useState)(null),g=(0,a.useRef)(null),_=(0,a.useRef)(t);(0,a.useEffect)(()=>{_.current=t},[t]);let v=(0,a.useCallback)(()=>{g.current?.(),g.current=null,d(!1)},[]),y=(0,a.useCallback)(async e=>{if(s){v(),h(null);try{g.current=await r({...e,connectionId:s},e=>{if(e.type===`dropped`)p(t=>t+e.count);else if(e.type===`error`)h(e.message);else{let t=_.current(e);t!==null&&l(e=>[t,...e].slice(0,o))}},()=>{g.current=null,d(!1)}),d(!0)}catch(e){h(i(e))}}},[s,v]);return(0,a.useEffect)(()=>()=>g.current?.(),[]),{rows:c,running:u,dropped:f,error:m,start:y,stop:v,clear:()=>{l([]),p(0)},dismissError:()=>h(null),connected:s!==null}}export{s as n,o as t};
@@ -1 +1 @@
1
- import{r as e}from"./Nro86Y63.js";import{M as t,t as n}from"./CAd2f6EE.js";function r(e){let r=n.getState().activeConnections.find(t=>t.id===e);return t(r)}function i(e){let r=n.getState().activeConnections.find(t=>t.serverConnectionId===e);return t(r)}function a(){return r(n.getState().activeConnectionId)}var o=class extends Error{constructor(e){super(`${e} does not support SQL`),this.name=`NotSqlEngineError`}};function s(t){if(!e(t))throw new o(t.label);return t}function c(e){return s(r(e))}function l(e){return s(i(e))}function u(){return s(a())}export{s as a,l as i,r as n,c as r,u as t};
1
+ import{r as e}from"./Nro86Y63.js";import{M as t,t as n}from"./iz6RnRcO.js";function r(e){let r=n.getState().activeConnections.find(t=>t.id===e);return t(r)}function i(e){let r=n.getState().activeConnections.find(t=>t.serverConnectionId===e);return t(r)}function a(){return r(n.getState().activeConnectionId)}var o=class extends Error{constructor(e){super(`${e} does not support SQL`),this.name=`NotSqlEngineError`}};function s(t){if(!e(t))throw new o(t.label);return t}function c(e){return s(r(e))}function l(e){return s(i(e))}function u(){return s(a())}export{s as a,l as i,r as n,c as r,u as t};
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{t as n}from"./CiL8zoYm.js";import{a as r}from"./C9jzAIEJ.js";import{i,r as a}from"./Cu_sGzNJ.js";import{a as o,i as s,n as c,o as l,t as u}from"./DzRyVlxz.js";import{t as d}from"./CAd2f6EE.js";import{n as f}from"./D8_hwGjG.js";import{l as p}from"./BghfQrAj.js";import{t as m}from"./Ci1xBOLy.js";import{C as h,S as g,T as _,b as v,l as y,vt as b,w as x,x as S}from"./B_zu4Zim.js";var C=e(t(),1),w=a();function T(){let e=d.getState();return e.activeConnections.find(t=>t.id===e.activeConnectionId)?.serverConnectionId??null}async function E(e){let t=T();if(!t)throw Error(r.t(`command.noActiveConnection`));let n=m().getQuery(e===`global`?`SHOW_GLOBAL_VARIABLES`:`SHOW_SESSION_VARIABLES`);return(await p(t,n)).records.map(e=>({Variable_name:e[0],Value:e[1]}))}function D(){let{t:e}=i(),{activeDialog:t,closeDialog:r,setFooterMessage:a}=f(),[d,p]=(0,C.useState)([]),[m,T]=(0,C.useState)(``),[D,O]=(0,C.useState)(`session`),k=t===`variables`,A=(0,C.useCallback)(t=>E(t).then(p).catch(t=>a(e(`command.variables.loadError`,{message:t instanceof Error?t.message:String(t)}))),[a,e]);(0,C.useEffect)(()=>{k&&A(D)},[k,D,A]);let j=(0,C.useMemo)(()=>{if(!m.trim())return d;let e=m.toLowerCase();return d.filter(t=>t.Variable_name.toLowerCase().includes(e)||t.Value.toLowerCase().includes(e))},[d,m]);function M(e){e||(T(``),r())}function N(e){O(e)}return(0,w.jsx)(u,{open:k,onOpenChange:M,children:(0,w.jsxs)(c,{className:`sm:max-w-[900px] max-h-[80vh] flex flex-col`,children:[(0,w.jsx)(o,{children:(0,w.jsx)(l,{children:e(`command.variables.title`)})}),(0,w.jsxs)(`div`,{className:`flex items-center gap-3 pb-2`,children:[(0,w.jsxs)(`div`,{className:`flex gap-1`,children:[(0,w.jsx)(n,{variant:D===`session`?`default`:`outline`,size:`sm`,onClick:()=>N(`session`),children:e(`command.scope.session`)}),(0,w.jsx)(n,{variant:D===`global`?`default`:`outline`,size:`sm`,onClick:()=>N(`global`),children:e(`command.scope.global`)})]}),(0,w.jsx)(y,{placeholder:e(`command.variables.filterPlaceholder`),value:m,onChange:e=>T(e.target.value),className:`max-w-xs`})]}),(0,w.jsx)(`div`,{className:`flex-1 border rounded-md overflow-hidden min-h-0`,children:(0,w.jsx)(b,{className:`h-[400px]`,children:(0,w.jsxs)(v,{children:[(0,w.jsx)(x,{children:(0,w.jsxs)(_,{children:[(0,w.jsx)(h,{className:`w-[300px]`,children:e(`command.variableName`)}),(0,w.jsx)(h,{children:e(`command.value`)})]})}),(0,w.jsx)(S,{children:j.length===0?(0,w.jsx)(_,{children:(0,w.jsx)(g,{colSpan:2,className:`text-center text-muted-foreground`,children:e(`command.variables.empty`)})}):j.map(e=>(0,w.jsxs)(_,{children:[(0,w.jsx)(g,{className:`font-mono text-xs`,children:e.Variable_name}),(0,w.jsx)(g,{className:`font-mono text-xs`,children:e.Value})]},e.Variable_name))})]})})}),(0,w.jsx)(s,{children:(0,w.jsx)(n,{variant:`outline`,onClick:()=>M(!1),children:e(`command.close`)})})]})})}export{D as VariablesDialog};
1
+ import{r as e}from"./hePW80VL.js";import{p as t}from"./CyX8oVsa.js";import{t as n}from"./Dya0zxo6.js";import{a as r}from"./Cme0nCT7.js";import{i,r as a}from"./C76CctEl.js";import{a as o,i as s,n as c,o as l,t as u}from"./kTwcxyaO.js";import{t as d}from"./iz6RnRcO.js";import{n as f}from"./BihjBM79.js";import{l as p}from"./BVZGLNq_.js";import{t as m}from"./CH4cEkW4.js";import{C as h,S as g,T as _,b as v,l as y,vt as b,w as x,x as S}from"./D4DxtYTA.js";var C=e(t(),1),w=a();function T(){let e=d.getState();return e.activeConnections.find(t=>t.id===e.activeConnectionId)?.serverConnectionId??null}async function E(e){let t=T();if(!t)throw Error(r.t(`command.noActiveConnection`));let n=m().getQuery(e===`global`?`SHOW_GLOBAL_VARIABLES`:`SHOW_SESSION_VARIABLES`);return(await p(t,n)).records.map(e=>({Variable_name:e[0],Value:e[1]}))}function D(){let{t:e}=i(),{activeDialog:t,closeDialog:r,setFooterMessage:a}=f(),[d,p]=(0,C.useState)([]),[m,T]=(0,C.useState)(``),[D,O]=(0,C.useState)(`session`),k=t===`variables`,A=(0,C.useCallback)(t=>E(t).then(p).catch(t=>a(e(`command.variables.loadError`,{message:t instanceof Error?t.message:String(t)}))),[a,e]);(0,C.useEffect)(()=>{k&&A(D)},[k,D,A]);let j=(0,C.useMemo)(()=>{if(!m.trim())return d;let e=m.toLowerCase();return d.filter(t=>t.Variable_name.toLowerCase().includes(e)||t.Value.toLowerCase().includes(e))},[d,m]);function M(e){e||(T(``),r())}function N(e){O(e)}return(0,w.jsx)(u,{open:k,onOpenChange:M,children:(0,w.jsxs)(c,{className:`sm:max-w-[900px] max-h-[80vh] flex flex-col`,children:[(0,w.jsx)(o,{children:(0,w.jsx)(l,{children:e(`command.variables.title`)})}),(0,w.jsxs)(`div`,{className:`flex items-center gap-3 pb-2`,children:[(0,w.jsxs)(`div`,{className:`flex gap-1`,children:[(0,w.jsx)(n,{variant:D===`session`?`default`:`outline`,size:`sm`,onClick:()=>N(`session`),children:e(`command.scope.session`)}),(0,w.jsx)(n,{variant:D===`global`?`default`:`outline`,size:`sm`,onClick:()=>N(`global`),children:e(`command.scope.global`)})]}),(0,w.jsx)(y,{placeholder:e(`command.variables.filterPlaceholder`),value:m,onChange:e=>T(e.target.value),className:`max-w-xs`})]}),(0,w.jsx)(`div`,{className:`flex-1 border rounded-md overflow-hidden min-h-0`,children:(0,w.jsx)(b,{className:`h-[400px]`,children:(0,w.jsxs)(v,{children:[(0,w.jsx)(x,{children:(0,w.jsxs)(_,{children:[(0,w.jsx)(h,{className:`w-[300px]`,children:e(`command.variableName`)}),(0,w.jsx)(h,{children:e(`command.value`)})]})}),(0,w.jsx)(S,{children:j.length===0?(0,w.jsx)(_,{children:(0,w.jsx)(g,{colSpan:2,className:`text-center text-muted-foreground`,children:e(`command.variables.empty`)})}):j.map(e=>(0,w.jsxs)(_,{children:[(0,w.jsx)(g,{className:`font-mono text-xs`,children:e.Variable_name}),(0,w.jsx)(g,{className:`font-mono text-xs`,children:e.Value})]},e.Variable_name))})]})})}),(0,w.jsx)(s,{children:(0,w.jsx)(n,{variant:`outline`,onClick:()=>M(!1),children:e(`command.close`)})})]})})}export{D as VariablesDialog};
@@ -1 +1 @@
1
- import{t as e}from"./CiL8zoYm.js";import{i as t,r as n}from"./Cu_sGzNJ.js";import{a as r,i,n as a,o,r as s,t as c}from"./DzRyVlxz.js";import{n as l,t as u}from"./DU-Eln5x.js";import{n as d}from"./D8_hwGjG.js";import{t as f}from"./BNB2k8On.js";var p=n();function m(){let n=d(e=>e.activeDialog),m=d(e=>e.closeDialog),h=l(),g=h.update,{t:_}=t();return(0,p.jsx)(c,{open:n===`safety-settings`,onOpenChange:e=>{e||m()},children:(0,p.jsxs)(a,{className:`sm:max-w-[560px]`,children:[(0,p.jsxs)(r,{children:[(0,p.jsx)(o,{children:_(`settings.title`)}),(0,p.jsx)(s,{children:_(`settings.description`)})]}),(0,p.jsxs)(`div`,{className:`grid gap-2`,children:[(0,p.jsx)(f,{id:`s-confirm`,checked:h.confirmDestructive,onChange:e=>g({confirmDestructive:e}),label:`Confirm destructive statements`,hint:`Ask before DROP TABLE/DATABASE, TRUNCATE, DELETE or UPDATE without WHERE, and ALTER … DROP COLUMN.`}),(0,p.jsx)(f,{id:`s-warn`,checked:h.warnInEditor,onChange:e=>g({warnInEditor:e}),label:`Warn in the editor`,hint:`Underline destructive statements and statements a read-only connection would refuse.`}),(0,p.jsx)(f,{id:`s-override`,checked:h.allowReadOnlyOverride,onChange:e=>g({allowReadOnlyOverride:e}),label:`Allow "Run anyway" on read-only connections`,hint:`When off, writes on a read-only connection are refused with no override.`}),(0,p.jsx)(f,{id:`s-preview`,checked:h.previewGridCommit,onChange:e=>g({previewGridCommit:e}),label:`Preview SQL before committing grid edits`,hint:`Show the generated UPDATE statements and ask for confirmation.`})]}),(0,p.jsxs)(i,{children:[(0,p.jsx)(e,{variant:`ghost`,onClick:()=>g(u),children:_(`settings.resetDefaults`)}),(0,p.jsx)(e,{onClick:m,children:_(`settings.done`)})]})]})})}export{m as SafetySettingsDialog};
1
+ import{t as e}from"./Dya0zxo6.js";import{i as t,r as n}from"./C76CctEl.js";import{a as r,i,n as a,o,r as s,t as c}from"./kTwcxyaO.js";import{n as l,t as u}from"./DOy06rIE.js";import{n as d}from"./BihjBM79.js";import{t as f}from"./MeOkctzz.js";var p=n();function m(){let n=d(e=>e.activeDialog),m=d(e=>e.closeDialog),h=l(),g=h.update,{t:_}=t();return(0,p.jsx)(c,{open:n===`safety-settings`,onOpenChange:e=>{e||m()},children:(0,p.jsxs)(a,{className:`sm:max-w-[560px]`,children:[(0,p.jsxs)(r,{children:[(0,p.jsx)(o,{children:_(`settings.title`)}),(0,p.jsx)(s,{children:_(`settings.description`)})]}),(0,p.jsxs)(`div`,{className:`grid gap-2`,children:[(0,p.jsx)(f,{id:`s-confirm`,checked:h.confirmDestructive,onChange:e=>g({confirmDestructive:e}),label:`Confirm destructive statements`,hint:`Ask before DROP TABLE/DATABASE, TRUNCATE, DELETE or UPDATE without WHERE, and ALTER … DROP COLUMN.`}),(0,p.jsx)(f,{id:`s-warn`,checked:h.warnInEditor,onChange:e=>g({warnInEditor:e}),label:`Warn in the editor`,hint:`Underline destructive statements and statements a read-only connection would refuse.`}),(0,p.jsx)(f,{id:`s-override`,checked:h.allowReadOnlyOverride,onChange:e=>g({allowReadOnlyOverride:e}),label:`Allow "Run anyway" on read-only connections`,hint:`When off, writes on a read-only connection are refused with no override.`}),(0,p.jsx)(f,{id:`s-preview`,checked:h.previewGridCommit,onChange:e=>g({previewGridCommit:e}),label:`Preview SQL before committing grid edits`,hint:`Show the generated UPDATE statements and ask for confirmation.`})]}),(0,p.jsxs)(i,{children:[(0,p.jsx)(e,{variant:`ghost`,onClick:()=>g(u),children:_(`settings.resetDefaults`)}),(0,p.jsx)(e,{onClick:m,children:_(`settings.done`)})]})]})})}export{m as SafetySettingsDialog};
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{t as n}from"./CiL8zoYm.js";import{i as r,r as i}from"./Cu_sGzNJ.js";import{a,i as o,n as s,o as c,t as l}from"./DzRyVlxz.js";import{t as u}from"./CAd2f6EE.js";import{n as d,t as f}from"./D8_hwGjG.js";import{a as p}from"./BghfQrAj.js";import{r as m}from"./Ci1xBOLy.js";import{a as h,h as g}from"./DpPKm22O.js";import{K as _,c as v,l as y,q as b}from"./B_zu4Zim.js";var x=e(t(),1),S=i();function C(){let{t:e}=r(),{activeDialog:t,closeDialog:i}=d(),C=f(`copy-database`),w=t===`copy-database`,T=C?.database??``,[E,D]=(0,x.useState)(``),[O,k]=(0,x.useState)(`structure_data`),[A,j]=(0,x.useState)(null),[M,N]=(0,x.useState)(null);function P(e){e||(i(),N(null),j(null),D(``),k(`structure_data`))}async function F(){let t=u.getState().activeConnectionId,n=E.trim();if(!t||!n||!T)return;N(null);let r=m(t),i=u.getState().activeConnections.find(e=>e.id===t);if(i?.serverConnectionId)try{j(e(`database.copy.creating`,{database:n})),await h(t,r.getQuery(`CREATE_DATABASE`,n,`utf8mb4`,`utf8mb4_general_ci`));let a=p(i.serverConnectionId),o=await r.introspect.listTables(a,T);for(let[r,i]of o.entries()){j(e(`database.copy.copying`,{table:i.name,index:r+1,total:o.length}));let a={connectionId:t,database:T,table:i.name},s={connectionId:t,database:n,table:i.name},c=await _(a,s);await b({source:a,target:s,mode:O,onConflict:`abort`,createSql:m(t).ddl.createTable(c)})}await g(t),P(!1)}catch(e){N(e instanceof Error?e.message:String(e))}finally{j(null)}}return(0,S.jsx)(l,{open:w,onOpenChange:P,children:(0,S.jsxs)(s,{className:`sm:max-w-[450px]`,children:[(0,S.jsx)(a,{children:(0,S.jsx)(c,{children:e(`database.copy.title`)})}),(0,S.jsxs)(`div`,{className:`space-y-4`,children:[(0,S.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,S.jsx)(v,{children:e(`database.copy.source`)}),(0,S.jsx)(y,{value:T,disabled:!0})]}),(0,S.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,S.jsx)(v,{htmlFor:`target-db-name`,children:e(`database.copy.target`)}),(0,S.jsx)(y,{id:`target-db-name`,value:E,onChange:e=>D(e.target.value),placeholder:e(`database.copy.targetPlaceholder`)})]}),(0,S.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,S.jsx)(v,{children:e(`database.copy.options`)}),(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsxs)(`label`,{className:`flex items-center gap-2 text-sm cursor-pointer`,children:[(0,S.jsx)(`input`,{type:`radio`,name:`copy-option`,value:`structure_data`,checked:O===`structure_data`,onChange:()=>k(`structure_data`)}),e(`database.copy.structureAndData`)]}),(0,S.jsxs)(`label`,{className:`flex items-center gap-2 text-sm cursor-pointer`,children:[(0,S.jsx)(`input`,{type:`radio`,name:`copy-option`,value:`structure_only`,checked:O===`structure_only`,onChange:()=>k(`structure_only`)}),e(`database.copy.structureOnly`)]})]})]})]}),A&&(0,S.jsx)(`p`,{className:`px-1 text-xs text-muted-foreground`,children:A}),M&&(0,S.jsx)(`p`,{className:`px-1 text-xs text-destructive leading-relaxed`,children:M}),(0,S.jsxs)(o,{children:[(0,S.jsx)(n,{variant:`outline`,onClick:()=>P(!1),children:e(`database.copy.cancel`)}),(0,S.jsx)(n,{onClick:()=>void F(),disabled:!E.trim()||A!==null,children:e(`database.copy.copy`)})]})]})})}export{C as CopyDatabaseDialog};
1
+ import{r as e}from"./hePW80VL.js";import{p as t}from"./CyX8oVsa.js";import{t as n}from"./Dya0zxo6.js";import{i as r,r as i}from"./C76CctEl.js";import{a,i as o,n as s,o as c,t as l}from"./kTwcxyaO.js";import{t as u}from"./iz6RnRcO.js";import{n as d,t as f}from"./BihjBM79.js";import{a as p}from"./BVZGLNq_.js";import{r as m}from"./CH4cEkW4.js";import{a as h,h as g}from"./CZRhmV_L.js";import{K as _,c as v,l as y,q as b}from"./D4DxtYTA.js";var x=e(t(),1),S=i();function C(){let{t:e}=r(),{activeDialog:t,closeDialog:i}=d(),C=f(`copy-database`),w=t===`copy-database`,T=C?.database??``,[E,D]=(0,x.useState)(``),[O,k]=(0,x.useState)(`structure_data`),[A,j]=(0,x.useState)(null),[M,N]=(0,x.useState)(null);function P(e){e||(i(),N(null),j(null),D(``),k(`structure_data`))}async function F(){let t=u.getState().activeConnectionId,n=E.trim();if(!t||!n||!T)return;N(null);let r=m(t),i=u.getState().activeConnections.find(e=>e.id===t);if(i?.serverConnectionId)try{j(e(`database.copy.creating`,{database:n})),await h(t,r.getQuery(`CREATE_DATABASE`,n,`utf8mb4`,`utf8mb4_general_ci`));let a=p(i.serverConnectionId),o=await r.introspect.listTables(a,T);for(let[r,i]of o.entries()){j(e(`database.copy.copying`,{table:i.name,index:r+1,total:o.length}));let a={connectionId:t,database:T,table:i.name},s={connectionId:t,database:n,table:i.name},c=await _(a,s);await b({source:a,target:s,mode:O,onConflict:`abort`,createSql:m(t).ddl.createTable(c)})}await g(t),P(!1)}catch(e){N(e instanceof Error?e.message:String(e))}finally{j(null)}}return(0,S.jsx)(l,{open:w,onOpenChange:P,children:(0,S.jsxs)(s,{className:`sm:max-w-[450px]`,children:[(0,S.jsx)(a,{children:(0,S.jsx)(c,{children:e(`database.copy.title`)})}),(0,S.jsxs)(`div`,{className:`space-y-4`,children:[(0,S.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,S.jsx)(v,{children:e(`database.copy.source`)}),(0,S.jsx)(y,{value:T,disabled:!0})]}),(0,S.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,S.jsx)(v,{htmlFor:`target-db-name`,children:e(`database.copy.target`)}),(0,S.jsx)(y,{id:`target-db-name`,value:E,onChange:e=>D(e.target.value),placeholder:e(`database.copy.targetPlaceholder`)})]}),(0,S.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,S.jsx)(v,{children:e(`database.copy.options`)}),(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsxs)(`label`,{className:`flex items-center gap-2 text-sm cursor-pointer`,children:[(0,S.jsx)(`input`,{type:`radio`,name:`copy-option`,value:`structure_data`,checked:O===`structure_data`,onChange:()=>k(`structure_data`)}),e(`database.copy.structureAndData`)]}),(0,S.jsxs)(`label`,{className:`flex items-center gap-2 text-sm cursor-pointer`,children:[(0,S.jsx)(`input`,{type:`radio`,name:`copy-option`,value:`structure_only`,checked:O===`structure_only`,onChange:()=>k(`structure_only`)}),e(`database.copy.structureOnly`)]})]})]})]}),A&&(0,S.jsx)(`p`,{className:`px-1 text-xs text-muted-foreground`,children:A}),M&&(0,S.jsx)(`p`,{className:`px-1 text-xs text-destructive leading-relaxed`,children:M}),(0,S.jsxs)(o,{children:[(0,S.jsx)(n,{variant:`outline`,onClick:()=>P(!1),children:e(`database.copy.cancel`)}),(0,S.jsx)(n,{onClick:()=>void F(),disabled:!E.trim()||A!==null,children:e(`database.copy.copy`)})]})]})})}export{C as CopyDatabaseDialog};
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/B_zu4Zim.js","assets/hePW80VL.js","assets/CYz610vE.js","assets/CiL8zoYm.js","assets/Cu_sGzNJ.js","assets/C9jzAIEJ.js","assets/BGuDcBB_.js","assets/DzRyVlxz.js","assets/D8dVzi6I.js","assets/eFSiW0Lh.js","assets/Nro86Y63.js","assets/CAd2f6EE.js","assets/DU-Eln5x.js","assets/BPLdNS4h.js","assets/Bit0Kfog.js","assets/D8_hwGjG.js","assets/D6SRSRpo.js","assets/BghfQrAj.js","assets/Ci1xBOLy.js","assets/DAFA-E1-.js","assets/CSjIZAje.js","assets/mA16m5gB.js","assets/BEY3Hwp0.js","assets/Bs5VSn0X.js","assets/92hmrkfN.css"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./hePW80VL.js";import{o as t,p as n}from"./CYz610vE.js";import{a as r,i}from"./C9jzAIEJ.js";import{n as a,r as o}from"./Nro86Y63.js";import{L as s,R as c,g as l,h as u,m as d,p as f,s as p,t as m}from"./CAd2f6EE.js";import{n as h}from"./DU-Eln5x.js";import{t as g}from"./Bit0Kfog.js";import{n as _}from"./D8_hwGjG.js";import{n as v}from"./D6SRSRpo.js";import{C as y,a as b,l as x}from"./BghfQrAj.js";import{i as ee,n as S,r as te}from"./Ci1xBOLy.js";import{i as ne}from"./DAFA-E1-.js";import{n as re,t as ie}from"./CSjIZAje.js";import{c as ae,d as C,f as w,l as oe,p as se,t as T}from"./mA16m5gB.js";function E(e){return m.getState().activeConnections.find(t=>t.id===e)?.database||ie(y.getState().trees[e]??[])}function ce(e,t,n,r){return S(e).tree.objectPath(t,n,r,E(e))}function D(e,t){return S(e).tree.namespacePath(t,E(e))}function O(e,t){for(let n of e){if(n.id===t)return n;let e=O(n.children,t);if(e)return e}return null}async function le(e,t,n){let r=y.getState;for(let i=0;i<t.length;i++){let a=r().trees[e];if(!a)return!1;let o=O(a,t[i]);if(!o)return!1;if(i===t.length-1)return r().setSelected(e,o.id),!0;o.children.length===0&&!o.isLeaf?await n(e,o):o.isExpanded||r().setExpanded(e,o.id,!0)}return!1}function k(e,t){for(let n of e){if(n.id===t)return n;let e=k(n.children,t);if(e)return e}return null}function A(e,t){let n=y.getState(),r=n.trees[e];if(!r||!t)return;let i=D(e,t),a=null;for(let t of i){let i=k(r,t);if(!i||(a=i,i.isLeaf))break;!i.isExpanded&&i.children.length>0&&n.setExpanded(e,i.id,!0)}!a||a.id!==i[i.length-1]||(n.setSelected(e,a.id),!a.isExpanded&&a.children.length>0&&n.setExpanded(e,a.id,!0))}var j=new Set;function M(e,n){let i=n.map(e=>e.metadata?.topology).find(e=>typeof e==`string`);if(!i||j.has(e))return;j.add(e);let a=m.getState().activeConnections.find(t=>t.id===e)?.dbms??`unknown`;t(`unsupported_topology`,{dbms:a,topology:i}),_.getState().setFooterMessage(r.t(`schema.topology.${i}`))}var N=e(n(),1);function ue(e,t,n){let r=[];function i(e){for(let n of e){if(r.push(n),n.id===t||n.children.length>0&&i(n.children))return!0;r.pop()}return!1}i(e);for(let e=r.length-1;e>=0;e--)if(r[e].type===n)return r[e];return null}function P(e,t){for(let n of e){if(n.id===t)return n;if(n.children.length>0){let e=P(n.children,t);if(e)return e}}return null}var F=g(`schemaTreeLoadingRoots`,()=>new Set);g(`schemaTreeCacheWriter`,()=>{let e={};return y.subscribe(t=>{if(t.trees!==e){for(let[n,r]of Object.entries(t.trees)){if(r===e[n])continue;let t=m.getState().activeConnections.find(e=>e.id===n);t&&f(t)&&u(n,l(t),r)}e=t.trees}})});function de(e,t,n){let r=e.tree,i={engine:e,run:t,database:n};return{loadRoot:()=>r.loadRoot(i),loadChildren:e=>r.loadChildren(i,e)}}function I(e){let t=m.getState().activeConnections.find(t=>t.id===e);return t?.serverConnectionId?de(S(e),b(t.serverConnectionId),t.database||void 0):null}function fe(){let{setTree:e,setChildren:t,setNodeMetadata:n,setLoading:i}=y(),a=(0,N.useCallback)(async t=>{let n=I(t);if(n&&!F.has(t)){F.add(t);try{let r=m.getState().activeConnections.find(e=>e.id===t),i=(r&&f(r)?await d(t,l(r)):null)??await n.loadRoot();e(t,i),M(t,i)}catch(n){let i=n instanceof Error?n.message:String(n);console.error(`Failed to load databases:`,n),_.getState().setFooterMessage(r.t(`schema.tree.loadDatabasesFailed`,{message:i})),e(t,[])}finally{F.delete(t)}}},[e]),o=(0,N.useCallback)(async(e,r)=>{if(!y.getState().trees[e])return;let a=I(e);if(a&&!r.isLeaf){i(e,r.id,!0);try{let i=await a.loadChildren(r);t(e,r.id,i),Promise.all(i.filter(e=>e.type===c.FOLDER&&e.metadata?.countable).map(async t=>{try{let r=await a.loadChildren(t);n(e,t.id,{count:r.length})}catch(e){console.error(`Failed to count ${t.text}:`,e)}}))}catch(t){console.error(`Failed to load children:`,t),i(e,r.id,!1)}}},[t,n,i]);return{loadDatabases:a,loadChildren:o,refreshNode:(0,N.useCallback)(async(e,t)=>{await o(e,t)},[o]),createNode:s,findNode:P,findAncestor:ue}}async function L(e,t){T(e,t);let n=y.getState().trees[e];if(!n||!t)return;let r=I(e);if(!r)return;let i=D(e,t),a=re(n,i[i.length-1]);!a||a.children.length===0||await Promise.all(a.children.filter(e=>e.type===c.FOLDER).map(async t=>{try{let n=await r.loadChildren(t),i=y.getState();(t.children.length>0||t.isExpanded)&&i.setChildren(e,t.id,n),t.metadata?.countable&&i.setNodeMetadata(e,t.id,{count:n.length})}catch(e){console.error(`Failed to refresh ${t.text}:`,e)}}))}async function R(e){T(e);let t=I(e);if(!t)return;let n=await z(t,y.getState().trees[e]??[],await t.loadRoot());y.getState().setTree(e,n),M(e,n)}async function z(e,t,n){let r=new Map(t.map(e=>[e.id,e]));return Promise.all(n.map(async t=>{let n=r.get(t.id);if(!n?.isExpanded||t.isLeaf)return t;try{let r=await e.loadChildren(t);return{...t,isExpanded:!0,children:await z(e,n.children,r)}}catch{return t}}))}var B=class extends Error{sql;constructor(e,t){super(e),this.name=`QueryError`,this.sql=t}},V=class extends Error{constructor(e=`Cancelled`){super(e),this.name=`ExecutionCancelled`}},pe=new Set([`SELECT`,`SHOW`,`EXPLAIN`,`DESCRIBE`,`DESC`,`HELP`,`VALUES`,`TABLE`,`WITH`,`USE`,`SET`,`CHECK`,`CHECKSUM`]);function H(e){return e.kind===`PRAGMA`?!e.sql.includes(`=`):!(!pe.has(e.kind)||e.destructive||e.kind===`SELECT`&&C(e,`INTO`))}var me=new Set([`INSERT`,`UPDATE`,`DELETE`,`REPLACE`,`MERGE`,`LOAD`]),he=new Set([`CREATE`,`ALTER`,`DROP`,`TRUNCATE`,`RENAME`,`GRANT`,`REVOKE`,`FLUSH`,`LOCK`,`UNLOCK`]),ge=new Set([`CREATE`,`ALTER`,`DROP`,`RENAME`]);function U(e){return me.has(e.kind)||!!e.destructive?.dataLoss}function W(e,t,n=`limit`){if(t<=0||e.kind!==`SELECT`||e.limit!==null||C(e,`LIMIT`)||C(e,`INTO`)||C(e,`FOR`)||C(e,`LOCK`))return{sql:e.sql,limited:!1};if(n===`top`){if(C(e,`TOP`)||C(e,`OFFSET`))return{sql:e.sql,limited:!1};let n=se(e);return n===-1?{sql:e.sql,limited:!1}:{sql:`${e.sql.slice(0,n)} TOP ${t}${e.sql.slice(n)}`,limited:!0}}return n===`fetch`?C(e,`FETCH`)||/\bROWNUM\b/i.test(e.sql)?{sql:e.sql,limited:!1}:{sql:`${e.sql} FETCH FIRST ${t} ROWS ONLY`,limited:!0}:{sql:`${e.sql} LIMIT ${t}`,limited:!0}}function _e(e){let t=e.destructive,n=t.names.length?t.names.join(`, `):r.t(`services.destructive.unknownTarget`);switch(t.action){case`DROP`:return`DROP ${t.objectType} ${n}`;case`TRUNCATE`:return`TRUNCATE ${n}`;case`DELETE_ALL`:return r.t(`services.destructive.deleteAll`,{target:n});case`UPDATE_ALL`:return r.t(`services.destructive.updateAll`,{target:n});case`ALTER_DROP`:return r.t(`services.destructive.alterDrop`,{target:n})}}function ve(e){return{text:e.sql,start:w(e),end:e.end,kind:e.kind,readOnly:H(e),dataLoss:e.destructive?.dataLoss?_e(e):null,stmt:e}}async function ye(e,t,n,r=ee(t),i){let o=new Set(e.fields.map(e=>e.orgTable).filter(Boolean));if(o.size!==1)return e;let s=[...o][0];try{let a=i??await r.introspect.getPrimaryKeys(b(t),n,s);a.length>0&&(e.primaryKeys=a)}catch{}return!e.primaryKeys?.length&&e.fields.some(e=>e.name===`_rowid_`)&&(e.primaryKeys=[a]),e}var be=50;function xe(e,t,n){return e.syntax.limitStyle===`top`?t.replace(/^SELECT\b/i,`SELECT TOP ${n}`):`${t} ${e.limitClause(n)}`}async function Se(e,t,n,r){let i=new Map;for(let a of n){let n=a.stmt;if(n.kind!==`UPDATE`&&n.kind!==`DELETE`)continue;let o=oe(n);if(!o)continue;let s=null,c=[],l=[],u,d=await x(t.serverConnId,o.count,r||void 0);if(d.success){let n=Number(d.records[0]?.[0]);s=Number.isFinite(n)?n:null;let i=await x(t.serverConnId,o.limited?o.select:xe(e,o.select,be),r||void 0);i.success?(c=i.fields.map(e=>e.name),l=i.records):u=i.message}else u=d.message;if(!await _.getState().requestDryRun({statement:n.sql,previewSql:o.select,count:s,fields:c,rows:l,truncated:s!==null&&l.length<s,error:u}))throw new V;s!==null&&i.set(a,s)}return i}function Ce(e){let t=new ae(e),n=()=>m.getState();return{statements(e){return t.statements(e).map(ve)},statementAtCursor(e,n){let r=t.statements(e);if(r.length===0)return null;let i=r.find(e=>n>=w(e)&&n<=e.end)??[...r].reverse().find(e=>e.end<=n)??r[0];return{sql:i.sql,start:w(i)}},async rewrite(e,t){if(!e.conn.scratchpad)return;let{materializeFederated:n}=await i(async()=>{let{materializeFederated:e}=await import(`./B_zu4Zim.js`).then(e=>e.U);return{materializeFederated:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]));for(let r of t)r.stmt.sql=await n(e.connId,r.stmt.sql),r.text=r.stmt.sql},previewWrites(t,n,r){return Se(e,t,n,r)},limitForEditor(t,n){let{sql:r,limited:i}=W(t.stmt,n,e.syntax.limitStyle);return{text:r,limited:i}},async beforeStatement(t,i,a){if(t.conn.transactionMode===`manual`&&e.capabilities.transactions&&i&&U(i.stmt)&&!n().transactionOpen[t.connId]){let i=await x(t.serverConnId,e.getQuery(`START_TRANSACTION`),a||void 0);if(!i.success)throw new B(i.message??r.t(`services.transaction.startFailed`));n().setTransactionOpen(t.connId,!0),_.getState().setFooterMessage(r.t(`services.transaction.started`))}},afterStatement(t,i,a){let o=i?.kind??``;o===`COMMIT`||o===`ROLLBACK`?n().setTransactionOpen(t.connId,!1):o===`START`||o===`BEGIN`?n().setTransactionOpen(t.connId,!0):he.has(o)&&n().transactionOpen[t.connId]&&e.capabilities.implicitCommitDdl&&(n().setTransactionOpen(t.connId,!1),_.getState().setFooterMessage(r.t(`services.transaction.implicitCommit`,{kind:o}))),ge.has(o)&&L(t.connId,a)},async enrichResult(t,n,r,i){await ye(n,t.serverConnId,r,e,i)},databaseAfter(e,t,n){return n||t.fields.length===0?null:t.fields.find(e=>e.db)?.db||null},readStructures(e,t,n,r,a){i(async()=>{let{readStructures:e}=await import(`./B_zu4Zim.js`).then(e=>e.at);return{readStructures:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24])).then(({readStructures:i})=>i(e,t,n.length>0?n.map(e=>({sql:e.stmt.sql,start:a===null?null:a+e.start})):[{sql:r,start:a}]))}}}function G(e){let t=[0];for(let n=0;n<e.length;n++)e[n]===`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/D4DxtYTA.js","assets/hePW80VL.js","assets/CyX8oVsa.js","assets/Dya0zxo6.js","assets/C76CctEl.js","assets/Cme0nCT7.js","assets/UJzcIbfW.js","assets/kTwcxyaO.js","assets/Ngd1VEiY.js","assets/eFSiW0Lh.js","assets/Nro86Y63.js","assets/iz6RnRcO.js","assets/DOy06rIE.js","assets/zdvaVsTo.js","assets/Bit0Kfog.js","assets/BihjBM79.js","assets/C_qmv4pB.js","assets/BVZGLNq_.js","assets/CH4cEkW4.js","assets/DAFA-E1-.js","assets/Buf-_p3w.js","assets/C3AWL5gC.js","assets/UEkRIZwQ.js","assets/Bs5VSn0X.js","assets/92hmrkfN.css"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./hePW80VL.js";import{o as t,p as n}from"./CyX8oVsa.js";import{a as r,i}from"./Cme0nCT7.js";import{n as a,r as o}from"./Nro86Y63.js";import{L as s,R as c,g as l,h as u,m as d,p as f,s as p,t as m}from"./iz6RnRcO.js";import{n as h}from"./DOy06rIE.js";import{t as g}from"./Bit0Kfog.js";import{n as _}from"./BihjBM79.js";import{n as v}from"./C_qmv4pB.js";import{C as y,a as b,l as x}from"./BVZGLNq_.js";import{i as ee,n as S,r as te}from"./CH4cEkW4.js";import{i as ne}from"./DAFA-E1-.js";import{n as re,t as ie}from"./Buf-_p3w.js";import{c as ae,d as C,f as w,l as oe,p as se,t as T}from"./C3AWL5gC.js";function E(e){return m.getState().activeConnections.find(t=>t.id===e)?.database||ie(y.getState().trees[e]??[])}function ce(e,t,n,r){return S(e).tree.objectPath(t,n,r,E(e))}function D(e,t){return S(e).tree.namespacePath(t,E(e))}function O(e,t){for(let n of e){if(n.id===t)return n;let e=O(n.children,t);if(e)return e}return null}async function le(e,t,n){let r=y.getState;for(let i=0;i<t.length;i++){let a=r().trees[e];if(!a)return!1;let o=O(a,t[i]);if(!o)return!1;if(i===t.length-1)return r().setSelected(e,o.id),!0;o.children.length===0&&!o.isLeaf?await n(e,o):o.isExpanded||r().setExpanded(e,o.id,!0)}return!1}function k(e,t){for(let n of e){if(n.id===t)return n;let e=k(n.children,t);if(e)return e}return null}function A(e,t){let n=y.getState(),r=n.trees[e];if(!r||!t)return;let i=D(e,t),a=null;for(let t of i){let i=k(r,t);if(!i||(a=i,i.isLeaf))break;!i.isExpanded&&i.children.length>0&&n.setExpanded(e,i.id,!0)}!a||a.id!==i[i.length-1]||(n.setSelected(e,a.id),!a.isExpanded&&a.children.length>0&&n.setExpanded(e,a.id,!0))}var j=new Set;function M(e,n){let i=n.map(e=>e.metadata?.topology).find(e=>typeof e==`string`);if(!i||j.has(e))return;j.add(e);let a=m.getState().activeConnections.find(t=>t.id===e)?.dbms??`unknown`;t(`unsupported_topology`,{dbms:a,topology:i}),_.getState().setFooterMessage(r.t(`schema.topology.${i}`))}var N=e(n(),1);function ue(e,t,n){let r=[];function i(e){for(let n of e){if(r.push(n),n.id===t||n.children.length>0&&i(n.children))return!0;r.pop()}return!1}i(e);for(let e=r.length-1;e>=0;e--)if(r[e].type===n)return r[e];return null}function P(e,t){for(let n of e){if(n.id===t)return n;if(n.children.length>0){let e=P(n.children,t);if(e)return e}}return null}var F=g(`schemaTreeLoadingRoots`,()=>new Set);g(`schemaTreeCacheWriter`,()=>{let e={};return y.subscribe(t=>{if(t.trees!==e){for(let[n,r]of Object.entries(t.trees)){if(r===e[n])continue;let t=m.getState().activeConnections.find(e=>e.id===n);t&&f(t)&&u(n,l(t),r)}e=t.trees}})});function de(e,t,n){let r=e.tree,i={engine:e,run:t,database:n};return{loadRoot:()=>r.loadRoot(i),loadChildren:e=>r.loadChildren(i,e)}}function I(e){let t=m.getState().activeConnections.find(t=>t.id===e);return t?.serverConnectionId?de(S(e),b(t.serverConnectionId),t.database||void 0):null}function fe(){let{setTree:e,setChildren:t,setNodeMetadata:n,setLoading:i}=y(),a=(0,N.useCallback)(async t=>{let n=I(t);if(n&&!F.has(t)){F.add(t);try{let r=m.getState().activeConnections.find(e=>e.id===t),i=(r&&f(r)?await d(t,l(r)):null)??await n.loadRoot();e(t,i),M(t,i)}catch(n){let i=n instanceof Error?n.message:String(n);console.error(`Failed to load databases:`,n),_.getState().setFooterMessage(r.t(`schema.tree.loadDatabasesFailed`,{message:i})),e(t,[])}finally{F.delete(t)}}},[e]),o=(0,N.useCallback)(async(e,r)=>{if(!y.getState().trees[e])return;let a=I(e);if(a&&!r.isLeaf){i(e,r.id,!0);try{let i=await a.loadChildren(r);t(e,r.id,i),Promise.all(i.filter(e=>e.type===c.FOLDER&&e.metadata?.countable).map(async t=>{try{let r=await a.loadChildren(t);n(e,t.id,{count:r.length})}catch(e){console.error(`Failed to count ${t.text}:`,e)}}))}catch(t){console.error(`Failed to load children:`,t),i(e,r.id,!1)}}},[t,n,i]);return{loadDatabases:a,loadChildren:o,refreshNode:(0,N.useCallback)(async(e,t)=>{await o(e,t)},[o]),createNode:s,findNode:P,findAncestor:ue}}async function L(e,t){T(e,t);let n=y.getState().trees[e];if(!n||!t)return;let r=I(e);if(!r)return;let i=D(e,t),a=re(n,i[i.length-1]);!a||a.children.length===0||await Promise.all(a.children.filter(e=>e.type===c.FOLDER).map(async t=>{try{let n=await r.loadChildren(t),i=y.getState();(t.children.length>0||t.isExpanded)&&i.setChildren(e,t.id,n),t.metadata?.countable&&i.setNodeMetadata(e,t.id,{count:n.length})}catch(e){console.error(`Failed to refresh ${t.text}:`,e)}}))}async function R(e){T(e);let t=I(e);if(!t)return;let n=await z(t,y.getState().trees[e]??[],await t.loadRoot());y.getState().setTree(e,n),M(e,n)}async function z(e,t,n){let r=new Map(t.map(e=>[e.id,e]));return Promise.all(n.map(async t=>{let n=r.get(t.id);if(!n?.isExpanded||t.isLeaf)return t;try{let r=await e.loadChildren(t);return{...t,isExpanded:!0,children:await z(e,n.children,r)}}catch{return t}}))}var B=class extends Error{sql;constructor(e,t){super(e),this.name=`QueryError`,this.sql=t}},V=class extends Error{constructor(e=`Cancelled`){super(e),this.name=`ExecutionCancelled`}},pe=new Set([`SELECT`,`SHOW`,`EXPLAIN`,`DESCRIBE`,`DESC`,`HELP`,`VALUES`,`TABLE`,`WITH`,`USE`,`SET`,`CHECK`,`CHECKSUM`]);function H(e){return e.kind===`PRAGMA`?!e.sql.includes(`=`):!(!pe.has(e.kind)||e.destructive||e.kind===`SELECT`&&C(e,`INTO`))}var me=new Set([`INSERT`,`UPDATE`,`DELETE`,`REPLACE`,`MERGE`,`LOAD`]),he=new Set([`CREATE`,`ALTER`,`DROP`,`TRUNCATE`,`RENAME`,`GRANT`,`REVOKE`,`FLUSH`,`LOCK`,`UNLOCK`]),ge=new Set([`CREATE`,`ALTER`,`DROP`,`RENAME`]);function U(e){return me.has(e.kind)||!!e.destructive?.dataLoss}function W(e,t,n=`limit`){if(t<=0||e.kind!==`SELECT`||e.limit!==null||C(e,`LIMIT`)||C(e,`INTO`)||C(e,`FOR`)||C(e,`LOCK`))return{sql:e.sql,limited:!1};if(n===`top`){if(C(e,`TOP`)||C(e,`OFFSET`))return{sql:e.sql,limited:!1};let n=se(e);return n===-1?{sql:e.sql,limited:!1}:{sql:`${e.sql.slice(0,n)} TOP ${t}${e.sql.slice(n)}`,limited:!0}}return n===`fetch`?C(e,`FETCH`)||/\bROWNUM\b/i.test(e.sql)?{sql:e.sql,limited:!1}:{sql:`${e.sql} FETCH FIRST ${t} ROWS ONLY`,limited:!0}:{sql:`${e.sql} LIMIT ${t}`,limited:!0}}function _e(e){let t=e.destructive,n=t.names.length?t.names.join(`, `):r.t(`services.destructive.unknownTarget`);switch(t.action){case`DROP`:return`DROP ${t.objectType} ${n}`;case`TRUNCATE`:return`TRUNCATE ${n}`;case`DELETE_ALL`:return r.t(`services.destructive.deleteAll`,{target:n});case`UPDATE_ALL`:return r.t(`services.destructive.updateAll`,{target:n});case`ALTER_DROP`:return r.t(`services.destructive.alterDrop`,{target:n})}}function ve(e){return{text:e.sql,start:w(e),end:e.end,kind:e.kind,readOnly:H(e),dataLoss:e.destructive?.dataLoss?_e(e):null,stmt:e}}async function ye(e,t,n,r=ee(t),i){let o=new Set(e.fields.map(e=>e.orgTable).filter(Boolean));if(o.size!==1)return e;let s=[...o][0];try{let a=i??await r.introspect.getPrimaryKeys(b(t),n,s);a.length>0&&(e.primaryKeys=a)}catch{}return!e.primaryKeys?.length&&e.fields.some(e=>e.name===`_rowid_`)&&(e.primaryKeys=[a]),e}var be=50;function xe(e,t,n){return e.syntax.limitStyle===`top`?t.replace(/^SELECT\b/i,`SELECT TOP ${n}`):`${t} ${e.limitClause(n)}`}async function Se(e,t,n,r){let i=new Map;for(let a of n){let n=a.stmt;if(n.kind!==`UPDATE`&&n.kind!==`DELETE`)continue;let o=oe(n);if(!o)continue;let s=null,c=[],l=[],u,d=await x(t.serverConnId,o.count,r||void 0);if(d.success){let n=Number(d.records[0]?.[0]);s=Number.isFinite(n)?n:null;let i=await x(t.serverConnId,o.limited?o.select:xe(e,o.select,be),r||void 0);i.success?(c=i.fields.map(e=>e.name),l=i.records):u=i.message}else u=d.message;if(!await _.getState().requestDryRun({statement:n.sql,previewSql:o.select,count:s,fields:c,rows:l,truncated:s!==null&&l.length<s,error:u}))throw new V;s!==null&&i.set(a,s)}return i}function Ce(e){let t=new ae(e),n=()=>m.getState();return{statements(e){return t.statements(e).map(ve)},statementAtCursor(e,n){let r=t.statements(e);if(r.length===0)return null;let i=r.find(e=>n>=w(e)&&n<=e.end)??[...r].reverse().find(e=>e.end<=n)??r[0];return{sql:i.sql,start:w(i)}},async rewrite(e,t){if(!e.conn.scratchpad)return;let{materializeFederated:n}=await i(async()=>{let{materializeFederated:e}=await import(`./D4DxtYTA.js`).then(e=>e.U);return{materializeFederated:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]));for(let r of t)r.stmt.sql=await n(e.connId,r.stmt.sql),r.text=r.stmt.sql},previewWrites(t,n,r){return Se(e,t,n,r)},limitForEditor(t,n){let{sql:r,limited:i}=W(t.stmt,n,e.syntax.limitStyle);return{text:r,limited:i}},async beforeStatement(t,i,a){if(t.conn.transactionMode===`manual`&&e.capabilities.transactions&&i&&U(i.stmt)&&!n().transactionOpen[t.connId]){let i=await x(t.serverConnId,e.getQuery(`START_TRANSACTION`),a||void 0);if(!i.success)throw new B(i.message??r.t(`services.transaction.startFailed`));n().setTransactionOpen(t.connId,!0),_.getState().setFooterMessage(r.t(`services.transaction.started`))}},afterStatement(t,i,a){let o=i?.kind??``;o===`COMMIT`||o===`ROLLBACK`?n().setTransactionOpen(t.connId,!1):o===`START`||o===`BEGIN`?n().setTransactionOpen(t.connId,!0):he.has(o)&&n().transactionOpen[t.connId]&&e.capabilities.implicitCommitDdl&&(n().setTransactionOpen(t.connId,!1),_.getState().setFooterMessage(r.t(`services.transaction.implicitCommit`,{kind:o}))),ge.has(o)&&L(t.connId,a)},async enrichResult(t,n,r,i){await ye(n,t.serverConnId,r,e,i)},databaseAfter(e,t,n){return n||t.fields.length===0?null:t.fields.find(e=>e.db)?.db||null},readStructures(e,t,n,r,a){i(async()=>{let{readStructures:e}=await import(`./D4DxtYTA.js`).then(e=>e.at);return{readStructures:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24])).then(({readStructures:i})=>i(e,t,n.length>0?n.map(e=>({sql:e.stmt.sql,start:a===null?null:a+e.start})):[{sql:r,start:a}]))}}}function G(e){let t=[0];for(let n=0;n<e.length;n++)e[n]===`
3
3
  `&&t.push(n+1);return t}function we(e){let{console:t}=e;return{statements(e){let n=G(e);return t.split(e).map(({text:i,line:a})=>{let o;try{o=t.classify(i)}catch(e){throw new B(r.t(`services.console.unreadable`,{line:a,message:e instanceof Error?e.message:String(e)}),i)}let s=(n[a-1]??0)+Math.max(0,e.slice(n[a-1]??0).indexOf(i));return{text:i,start:s,end:s+i.length,kind:o.name,readOnly:o.readOnly,dataLoss:o.dataLoss?i:null}})},statementAtCursor(e,n){let r=t.split(e);if(r.length===0)return null;let i=e.slice(0,n).split(`
4
4
  `).length,a=[...r].reverse().find(e=>e.line<=i)??r[0],o=G(e)[a.line-1]??0;return{sql:a.text,start:o+Math.max(0,e.slice(o).indexOf(a.text))}},afterStatement(e,n){n&&t.changesTree?.(n.text)&&R(e.connId)},databaseAfter(e){return e&&t.databaseAfter?t.databaseAfter(e.text):null}}}var K=new WeakMap;function q(e){let t=K.get(e);return t||(t=o(e)?Ce(e):we(e),K.set(e,t)),t}function Te(e){let t=e.fields??[],n=e.records??[];return{fields:t.map(e=>({name:e.name,type:e.type,orgTable:e.orgTable??e.table??``,orgName:e.orgName??e.name,db:e.db??``})),rows:n.map(e=>{let n={};return t.forEach((t,r)=>{n[t.name]=e[r]}),n}),affectedRows:e.affectedRows??0,insertId:e.insertId??0,message:e.message??(n.length>0?r.t(`services.query.rowsReturned`,{count:n.length}):r.t(`services.query.rowsAffected`,{count:e.affectedRows??0})),...e.reply===void 0?{}:{reply:e.reply}}}function Ee(e,t=0){let n=J();return n<=0?``:e.limitClause(n,t)}function J(){return h.getState().resultRowLimit}async function De(e){if(!h.getState().confirmDestructive)return!0;let t=e.filter(e=>e.dataLoss!==null);return t.length===0||_.getState().requestDestructiveConfirm({title:r.t(`services.destructive.title`,{count:t.length}),description:r.t(`services.destructive.description`),statements:t.map(e=>e.dataLoss),confirmLabel:r.t(`services.runAnyway`)})}async function Oe(e,t){if(!e.readOnly)return;let n=t.filter(e=>!e.readOnly);if(n.length===0)return;let i=`${e.hostName||e.host}`;if(!h.getState().allowReadOnlyOverride)throw new B(r.t(`services.readOnly.refused`,{label:i,count:n.length}));if(!await _.getState().requestDestructiveConfirm({title:r.t(`services.readOnly.title`,{label:i}),description:r.t(`services.readOnly.description`),statements:n.map(e=>e.text.length>120?e.text.slice(0,117)+`...`:e.text),confirmLabel:r.t(`services.runAnyway`)}))throw new V(`Cancelled: connection is read-only.`)}function Y(e,t){let n=m.getState(),i=n.activeConnections.find(t=>t.id===e);if(!i?.serverConnectionId)throw new B(r.t(`services.query.notConnected`));if(n.pendingReopen[e])throw new B(r.t(`services.query.fileNotOpen`));let a=S(e);return{ctx:{connId:e,serverConnId:i.serverConnectionId,conn:i,engine:a,tabId:t},adapter:q(a)}}async function X({ctx:e,adapter:t},n,r){let i=t.statements(n);if(await t.rewrite?.(e,i),await Oe(e.conn,i),!r.skipDestructiveConfirm&&!await De(i))throw new V;return i}async function Z({ctx:e,adapter:n},i,a){let{connId:o,serverConnId:s,tabId:c}=e,l=i.stmt?.kind??``;await n.beforeStatement?.(e,i.stmt,a);let u=await x(s,i.sql,a||void 0);if(!u.success){let n=u.message??r.t(`services.query.failed`);throw v.getState().recordExecution({connectionId:o,tabId:c,query:i.sql,database:a,executionTime:u.execTime,error:n,kind:l||void 0}),t(`query_execute`,{dbms:e.conn.dbms,kind:l||`unknown`,origin:c?`editor`:`app`,success:!1}),new B(n,i.sql)}let d=Te(u);return n.afterStatement?.(e,i.stmt,a),e.skipHistory||v.getState().recordExecution({connectionId:o,tabId:c,query:i.sql,database:a,executionTime:u.execTime,kind:l||void 0,...d.fields.length>0?{rowCount:d.rows.length}:{affectedRows:d.affectedRows}}),t(`query_execute`,{dbms:e.conn.dbms,kind:l||`unknown`,origin:c?`editor`:`app`,success:!0,exec_time_ms:Math.round(u.execTime??0)}),{qr:d,execTime:u.execTime}}async function ke(e,t,n={}){let i=Y(e,n.tabId??null),{ctx:a,adapter:o}=i;a.skipHistory=n.skipHistory;let s=t.trim();if(!s)throw new B(r.t(`services.query.nothingToExecute`));let c=await X(i,s,n),l=n.database??``;n.previewWrites&&h.getState().previewAffectedRows&&await o.previewWrites?.(a,c,l);let u=c.length>0?c.map(e=>({sql:e.text,stmt:e})):[{sql:s,stmt:null}],d=null;for(let e of u){let{qr:t}=await Z(i,e,l);n.primaryKeys&&t.fields.length>0&&l&&await o.enrichResult?.(a,t,l,Array.isArray(n.primaryKeys)?n.primaryKeys:void 0),d=t}return d}function Ae(e,t){return Q(e,t)?.sql??null}function Q(e,t){let n=v.getState().tabs[e]?.find(e=>e.id===t);if(!n)return null;let r=ne(e,t);if(r&&`selection`in r)return{sql:r.selection,start:r.start};let i=r&&`cursorOffset`in r?r.cursorOffset:n.query.length;return q(S(e)).statementAtCursor(n.query,i)}async function je(e,n,i={}){let a=()=>v.getState(),o=a().tabs[e]?.find(e=>e.id===n);if(!o)return;let s=(i.sql??o.query)?.trim();if(!s)return;let c,l;try{c=Y(e,n),l=await X(c,s,{})}catch(t){if(t instanceof V){t.message!==`Cancelled`&&a().setError(e,n,t.message);return}a().setError(e,n,t instanceof Error?t.message:String(t));return}let{ctx:u,adapter:d}=c,f=h.getState(),m=new Map;if(f.previewAffectedRows&&d.previewWrites)try{m=await d.previewWrites(u,l,o.database||``)}catch(e){if(e instanceof V)return;throw e}let g=m.size===1,_=l.length>0?l.map(e=>{let t=d.limitForEditor?.(e,f.resultRowLimit)??{text:e.text,limited:!1};return{sql:t.text,limited:t.limited,stmt:e}}):[{sql:s,limited:!1,stmt:null}];d.readStructures?.(e,n,l,s,i.sql?i.sqlOffset??null:0),a().captureRevision(e,n,`execute`),a().setExecuting(e,n,!0),a().setError(e,n,null);let y=[],b=o.database||``;try{for(let i of _){let{qr:o,execTime:s}=await Z(c,i,b);o.sql=i.stmt?.text??i.sql,o.executionTime=s,i.limited&&o.rows.length>=f.resultRowLimit&&(o.limited=!0,o.message=r.t(`services.query.rowsReturnedLimited`,{count:o.rows.length,limit:f.resultRowLimit}));let l=d.databaseAfter?.(i.stmt,o,b);l&&l!==b&&(b=l,a().setDatabase(e,n,b),A(e,b)),o.fields.length>0&&b&&await d.enrichResult?.(u,o,b);let p=g&&i.stmt?m.get(i.stmt):void 0;p!==void 0&&Number.isFinite(o.affectedRows)&&o.affectedRows!==p&&(o.warning=r.t(`services.query.dryRunMismatch`,{predicted:p,actual:o.affectedRows}),t(`dry_run_mismatch`,{dbms:u.conn.dbms,kind:i.stmt?.kind??`unknown`})),y.push(o)}a().setResults(e,n,y)}catch(t){y.length>0&&a().setResults(e,n,y),a().setError(e,n,t instanceof Error?t.message:String(t),t instanceof B?t.sql:null),t instanceof B&&p(`query_error`)}finally{a().setExecuting(e,n,!1)}}async function $(e,t){let n=m.getState(),i=n.activeConnections.find(t=>t.id===e);if(!i?.serverConnectionId)return;let a=te(e);try{let e=await x(i.serverConnectionId,a.getQuery(t));if(!e.success)throw new B(e.message??r.t(`services.transaction.commandFailed`,{name:t}));_.getState().setFooterMessage(t===`COMMIT`?r.t(`services.transaction.committed`):r.t(`services.transaction.rolledBack`))}catch(e){_.getState().setFooterMessage(r.t(`services.transaction.commandFailedWith`,{name:t,message:e instanceof Error?e.message:String(e)}))}finally{n.setTransactionOpen(e,!1)}}var Me=e=>$(e,`COMMIT`),Ne=e=>$(e,`ROLLBACK`);export{A as _,ke as a,Ee as c,H as d,V as f,fe as g,R as h,Ne as i,q as l,L as m,je as n,Q as o,B as p,Ae as r,J as s,Me as t,W as u,le as v,ce as y};
@@ -1 +1 @@
1
- import{t as e}from"./CYz610vE.js";import{i as t,t as n}from"./eFSiW0Lh.js";import{O as r,a as i,i as a,n as o,r as s}from"./CAd2f6EE.js";import{n as c}from"./DU-Eln5x.js";var l=200,u=Object.freeze([]);function d(e,t,n){return e.map(e=>e.id===t?{...e,...n}:e)}function f(e){let t=e;if(delete t.erdOpen,delete t.erdDatabase,t.tabs&&typeof t.tabs==`object`){let e=t.tabs;for(let t of Object.keys(e))e[t]=e[t].map(e=>{if(!Array.isArray(e.results)){let t={...e};return delete t.result,{...t,results:[]}}return e})}return t}var p=e()(t((e,t)=>({tabs:{},activeTabId:{},history:[],addQueryTab:(t,n)=>e(e=>{let r=e.tabs[t]??[];return{tabs:{...e.tabs,[t]:[...r,n]},activeTabId:{...e.activeTabId,[t]:n.id}}}),removeQueryTab:(e,n)=>t().removeQueryTabs(e,[n]),removeQueryTabs:(n,r)=>{for(let e of r)t().captureRevision(n,e,`close`);e(e=>{let t=new Set(r),i=(e.tabs[n]??[]).filter(e=>!t.has(e.id)),a=e.activeTabId[n],o=a&&t.has(a)?i.length>0?i[i.length-1].id:null:a;return{tabs:{...e.tabs,[n]:i},activeTabId:{...e.activeTabId,[n]:o}}})},reorderQueryTab:(t,n,r)=>e(e=>({tabs:{...e.tabs,[t]:i(e.tabs[t]??[],n,r)}})),setActiveQueryTab:(t,n)=>e(e=>({activeTabId:{...e.activeTabId,[t]:n}})),setEditorContent:(n,r,i)=>{e(e=>{let t=e.tabs[n]??[];return{tabs:{...e.tabs,[n]:d(t,r,{query:i})}}});let a=t().tabs[n]?.find(e=>e.id===r);a&&s(n,{docId:r,title:a.title,text:i,database:a.database,reason:`edit`})},setResults:(t,n,r)=>e(e=>{let i=e.tabs[t]??[];return{tabs:{...e.tabs,[t]:d(i,n,{results:r,isExecuting:!1,error:null})}}}),setExecuting:(t,n,r)=>e(e=>{let i=e.tabs[t]??[];return{tabs:{...e.tabs,[t]:d(i,n,{isExecuting:r})}}}),setPlan:(t,n,r)=>e(e=>{let i=e.tabs[t]??[];return{tabs:{...e.tabs,[t]:d(i,n,{plan:r})}}}),setGraphs:(t,n,r)=>e(e=>{let i=e.tabs[t];return i?{tabs:{...e.tabs,[t]:d(i,n,{graphs:r})}}:e}),setError:(t,n,r,i=null)=>e(e=>{let a=e.tabs[t]??[];return{tabs:{...e.tabs,[t]:d(a,n,{error:r,errorSql:r?i:null,...r?{isExecuting:!1}:{}})}}}),setDatabase:(t,n,r)=>e(e=>{let i=e.tabs[t]??[];return{tabs:{...e.tabs,[t]:d(i,n,{database:r})}}}),setSourceItem:(t,n,r)=>e(e=>({tabs:{...e.tabs,[t]:d(e.tabs[t]??[],n,{sourceItem:r,title:r.name})}})),setExecutionTime:(t,n,r)=>e(e=>{let i=e.tabs[t]??[];return{tabs:{...e.tabs,[t]:d(i,n,{executionTime:r})}}}),addHistory:t=>e(e=>({history:[t,...e.history].slice(0,500)})),recordExecution:({connectionId:e,tabId:n,query:i,database:a,executionTime:o,error:s,kind:c,rowCount:l,affectedRows:u})=>t().addHistory({id:crypto.randomUUID(),query:r(i),database:a,timestamp:Date.now(),executionTime:o,success:!s,connectionId:e,tabId:n??void 0,...s?{error:s}:{},...c?{kind:c}:{},...l==null?{}:{rowCount:l},...u==null?{}:{affectedRows:u}}),clearHistory:()=>e({history:[]}),captureRevision:(e,n,r)=>{let i=t().tabs[e]?.find(e=>e.id===n);i&&(o(e,n),a.getState().capture(e,{docId:n,title:i.title,text:i.query,database:i.database,reason:r}))}}),{name:`planche-query`,storage:n(),version:2,migrate:f,partialize:e=>({tabs:Object.fromEntries(Object.entries(e.tabs).map(([e,t])=>[e,t.map(e=>({...e,isExecuting:!1,results:[],plan:null,graphs:null,error:null,errorSql:null,executionTime:null}))])),activeTabId:e.activeTabId,history:c.getState().persistQueryHistory?e.history.slice(0,l):[]})}));export{p as n,u as t};
1
+ import{t as e}from"./CyX8oVsa.js";import{i as t,t as n}from"./eFSiW0Lh.js";import{O as r,a as i,i as a,n as o,r as s}from"./iz6RnRcO.js";import{n as c}from"./DOy06rIE.js";var l=200,u=Object.freeze([]);function d(e,t,n){return e.map(e=>e.id===t?{...e,...n}:e)}function f(e){let t=e;if(delete t.erdOpen,delete t.erdDatabase,t.tabs&&typeof t.tabs==`object`){let e=t.tabs;for(let t of Object.keys(e))e[t]=e[t].map(e=>{if(!Array.isArray(e.results)){let t={...e};return delete t.result,{...t,results:[]}}return e})}return t}var p=e()(t((e,t)=>({tabs:{},activeTabId:{},history:[],addQueryTab:(t,n)=>e(e=>{let r=e.tabs[t]??[];return{tabs:{...e.tabs,[t]:[...r,n]},activeTabId:{...e.activeTabId,[t]:n.id}}}),removeQueryTab:(e,n)=>t().removeQueryTabs(e,[n]),removeQueryTabs:(n,r)=>{for(let e of r)t().captureRevision(n,e,`close`);e(e=>{let t=new Set(r),i=(e.tabs[n]??[]).filter(e=>!t.has(e.id)),a=e.activeTabId[n],o=a&&t.has(a)?i.length>0?i[i.length-1].id:null:a;return{tabs:{...e.tabs,[n]:i},activeTabId:{...e.activeTabId,[n]:o}}})},reorderQueryTab:(t,n,r)=>e(e=>({tabs:{...e.tabs,[t]:i(e.tabs[t]??[],n,r)}})),setActiveQueryTab:(t,n)=>e(e=>({activeTabId:{...e.activeTabId,[t]:n}})),setEditorContent:(n,r,i)=>{e(e=>{let t=e.tabs[n]??[];return{tabs:{...e.tabs,[n]:d(t,r,{query:i})}}});let a=t().tabs[n]?.find(e=>e.id===r);a&&s(n,{docId:r,title:a.title,text:i,database:a.database,reason:`edit`})},setResults:(t,n,r)=>e(e=>{let i=e.tabs[t]??[];return{tabs:{...e.tabs,[t]:d(i,n,{results:r,isExecuting:!1,error:null})}}}),setExecuting:(t,n,r)=>e(e=>{let i=e.tabs[t]??[];return{tabs:{...e.tabs,[t]:d(i,n,{isExecuting:r})}}}),setPlan:(t,n,r)=>e(e=>{let i=e.tabs[t]??[];return{tabs:{...e.tabs,[t]:d(i,n,{plan:r})}}}),setGraphs:(t,n,r)=>e(e=>{let i=e.tabs[t];return i?{tabs:{...e.tabs,[t]:d(i,n,{graphs:r})}}:e}),setError:(t,n,r,i=null)=>e(e=>{let a=e.tabs[t]??[];return{tabs:{...e.tabs,[t]:d(a,n,{error:r,errorSql:r?i:null,...r?{isExecuting:!1}:{}})}}}),setDatabase:(t,n,r)=>e(e=>{let i=e.tabs[t]??[];return{tabs:{...e.tabs,[t]:d(i,n,{database:r})}}}),setSourceItem:(t,n,r)=>e(e=>({tabs:{...e.tabs,[t]:d(e.tabs[t]??[],n,{sourceItem:r,title:r.name})}})),setExecutionTime:(t,n,r)=>e(e=>{let i=e.tabs[t]??[];return{tabs:{...e.tabs,[t]:d(i,n,{executionTime:r})}}}),addHistory:t=>e(e=>({history:[t,...e.history].slice(0,500)})),recordExecution:({connectionId:e,tabId:n,query:i,database:a,executionTime:o,error:s,kind:c,rowCount:l,affectedRows:u})=>t().addHistory({id:crypto.randomUUID(),query:r(i),database:a,timestamp:Date.now(),executionTime:o,success:!s,connectionId:e,tabId:n??void 0,...s?{error:s}:{},...c?{kind:c}:{},...l==null?{}:{rowCount:l},...u==null?{}:{affectedRows:u}}),clearHistory:()=>e({history:[]}),captureRevision:(e,n,r)=>{let i=t().tabs[e]?.find(e=>e.id===n);i&&(o(e,n),a.getState().capture(e,{docId:n,title:i.title,text:i.query,database:i.database,reason:r}))}}),{name:`planche-query`,storage:n(),version:2,migrate:f,partialize:e=>({tabs:Object.fromEntries(Object.entries(e.tabs).map(([e,t])=>[e,t.map(e=>({...e,isExecuting:!1,results:[],plan:null,graphs:null,error:null,errorSql:null,executionTime:null}))])),activeTabId:e.activeTabId,history:c.getState().persistQueryHistory?e.history.slice(0,l):[]})}));export{p as n,u as t};
@@ -1 +1 @@
1
- import{n as e}from"./Cu_sGzNJ.js";var t=e(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]);export{t};
1
+ import{n as e}from"./C76CctEl.js";var t=e(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]);export{t};
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{t as n}from"./CiL8zoYm.js";import{i as r,r as i,t as a}from"./Cu_sGzNJ.js";import{t as o}from"./BFw3KCAr.js";import{t as s}from"./CAd2f6EE.js";import{n as c}from"./D8_hwGjG.js";import{n as l}from"./D6SRSRpo.js";import{n as u,o as d,s as f,t as p}from"./DAFA-E1-.js";import{Jt as m,c as h,l as g,ut as _}from"./B_zu4Zim.js";var v=e(t(),1),y=i();function b(){let{t:e}=r(),{activeDialog:t,closeDialog:i}=c(),[b,x]=(0,v.useState)(``),[S,C]=(0,v.useState)(``),[w,T]=(0,v.useState)(!1),[E,D]=(0,v.useState)(!1),[O,k]=(0,v.useState)(!1),[A,j]=(0,v.useState)(0),M=s(e=>e.activeConnectionId)??``,N=l(e=>M?e.activeTabId[M]:void 0)??``;if(t!==`find-replace`)return null;let P={query:b,caseSensitive:w,regex:E,wholeWord:O},F=M!==``&&N!==``&&b!==``;function I(){i()}function L(){j(F?u(M,N,P,`next`):0)}function R(){j(F?u(M,N,P,`prev`):0)}function z(){F&&j(f(M,N,P,S))}function B(){F&&(d(M,N,P,S),j(p(M,N,P)))}return(0,y.jsxs)(`div`,{className:`fixed top-12 right-4 z-50 bg-background border rounded-md shadow-lg p-3 w-[400px] space-y-2`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(g,{placeholder:e(`command.findReplace.findPlaceholder`),value:b,onChange:e=>x(e.target.value),onKeyDown:e=>{_(e)||(e.key===`Enter`&&(e.shiftKey?R():L()),e.key===`Escape`&&I())},className:`flex-1 h-7 text-sm`,autoFocus:!0}),(0,y.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap min-w-[60px] text-center`,children:A>0?e(`command.findReplace.found`,{count:A}):e(`command.findReplace.noResults`)}),(0,y.jsx)(n,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,onClick:R,title:e(`command.findReplace.previous`),children:(0,y.jsx)(o,{className:`h-4 w-4`})}),(0,y.jsx)(n,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,onClick:L,title:e(`command.findReplace.next`),children:(0,y.jsx)(m,{className:`h-4 w-4`})}),(0,y.jsx)(n,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,onClick:I,title:e(`command.findReplace.close`),children:(0,y.jsx)(a,{className:`h-4 w-4`})})]}),(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(g,{placeholder:e(`command.findReplace.replacePlaceholder`),value:S,onChange:e=>C(e.target.value),onKeyDown:e=>{e.key===`Escape`&&I()},className:`flex-1 h-7 text-sm`}),(0,y.jsx)(n,{variant:`outline`,size:`sm`,className:`h-7 text-xs`,onClick:z,children:e(`command.findReplace.replace`)}),(0,y.jsx)(n,{variant:`outline`,size:`sm`,className:`h-7 text-xs`,onClick:B,children:e(`command.findReplace.all`)})]}),(0,y.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,y.jsxs)(h,{className:`flex items-center gap-1.5 text-xs font-normal cursor-pointer`,children:[(0,y.jsx)(`input`,{type:`checkbox`,checked:w,onChange:e=>T(e.target.checked),className:`rounded border-input`}),e(`command.findReplace.caseSensitive`)]}),(0,y.jsxs)(h,{className:`flex items-center gap-1.5 text-xs font-normal cursor-pointer`,children:[(0,y.jsx)(`input`,{type:`checkbox`,checked:E,onChange:e=>D(e.target.checked),className:`rounded border-input`}),e(`command.findReplace.regex`)]}),(0,y.jsxs)(h,{className:`flex items-center gap-1.5 text-xs font-normal cursor-pointer`,children:[(0,y.jsx)(`input`,{type:`checkbox`,checked:O,onChange:e=>k(e.target.checked),className:`rounded border-input`}),e(`command.findReplace.wholeWord`)]})]})]})}export{b as FindReplaceDialog};
1
+ import{r as e}from"./hePW80VL.js";import{p as t}from"./CyX8oVsa.js";import{t as n}from"./Dya0zxo6.js";import{i as r,r as i,t as a}from"./C76CctEl.js";import{t as o}from"./B5FoXN4H.js";import{t as s}from"./iz6RnRcO.js";import{n as c}from"./BihjBM79.js";import{n as l}from"./C_qmv4pB.js";import{n as u,o as d,s as f,t as p}from"./DAFA-E1-.js";import{Jt as m,c as h,l as g,ut as _}from"./D4DxtYTA.js";var v=e(t(),1),y=i();function b(){let{t:e}=r(),{activeDialog:t,closeDialog:i}=c(),[b,x]=(0,v.useState)(``),[S,C]=(0,v.useState)(``),[w,T]=(0,v.useState)(!1),[E,D]=(0,v.useState)(!1),[O,k]=(0,v.useState)(!1),[A,j]=(0,v.useState)(0),M=s(e=>e.activeConnectionId)??``,N=l(e=>M?e.activeTabId[M]:void 0)??``;if(t!==`find-replace`)return null;let P={query:b,caseSensitive:w,regex:E,wholeWord:O},F=M!==``&&N!==``&&b!==``;function I(){i()}function L(){j(F?u(M,N,P,`next`):0)}function R(){j(F?u(M,N,P,`prev`):0)}function z(){F&&j(f(M,N,P,S))}function B(){F&&(d(M,N,P,S),j(p(M,N,P)))}return(0,y.jsxs)(`div`,{className:`fixed top-12 right-4 z-50 bg-background border rounded-md shadow-lg p-3 w-[400px] space-y-2`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(g,{placeholder:e(`command.findReplace.findPlaceholder`),value:b,onChange:e=>x(e.target.value),onKeyDown:e=>{_(e)||(e.key===`Enter`&&(e.shiftKey?R():L()),e.key===`Escape`&&I())},className:`flex-1 h-7 text-sm`,autoFocus:!0}),(0,y.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap min-w-[60px] text-center`,children:A>0?e(`command.findReplace.found`,{count:A}):e(`command.findReplace.noResults`)}),(0,y.jsx)(n,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,onClick:R,title:e(`command.findReplace.previous`),children:(0,y.jsx)(o,{className:`h-4 w-4`})}),(0,y.jsx)(n,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,onClick:L,title:e(`command.findReplace.next`),children:(0,y.jsx)(m,{className:`h-4 w-4`})}),(0,y.jsx)(n,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,onClick:I,title:e(`command.findReplace.close`),children:(0,y.jsx)(a,{className:`h-4 w-4`})})]}),(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(g,{placeholder:e(`command.findReplace.replacePlaceholder`),value:S,onChange:e=>C(e.target.value),onKeyDown:e=>{e.key===`Escape`&&I()},className:`flex-1 h-7 text-sm`}),(0,y.jsx)(n,{variant:`outline`,size:`sm`,className:`h-7 text-xs`,onClick:z,children:e(`command.findReplace.replace`)}),(0,y.jsx)(n,{variant:`outline`,size:`sm`,className:`h-7 text-xs`,onClick:B,children:e(`command.findReplace.all`)})]}),(0,y.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,y.jsxs)(h,{className:`flex items-center gap-1.5 text-xs font-normal cursor-pointer`,children:[(0,y.jsx)(`input`,{type:`checkbox`,checked:w,onChange:e=>T(e.target.checked),className:`rounded border-input`}),e(`command.findReplace.caseSensitive`)]}),(0,y.jsxs)(h,{className:`flex items-center gap-1.5 text-xs font-normal cursor-pointer`,children:[(0,y.jsx)(`input`,{type:`checkbox`,checked:E,onChange:e=>D(e.target.checked),className:`rounded border-input`}),e(`command.findReplace.regex`)]}),(0,y.jsxs)(h,{className:`flex items-center gap-1.5 text-xs font-normal cursor-pointer`,children:[(0,y.jsx)(`input`,{type:`checkbox`,checked:O,onChange:e=>k(e.target.checked),className:`rounded border-input`}),e(`command.findReplace.wholeWord`)]})]})]})}export{b as FindReplaceDialog};