planche 0.7.6 → 0.7.7
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.
- package/LICENSE +66 -0
- package/THIRD-PARTY-NOTICES.md +3668 -0
- package/app/assets/AboutDialog-CwxQS9-3.js +1 -0
- package/app/assets/{ConnectDialog-Bu2hPwDR.js → ConnectDialog-BNJnQcBX.js} +1 -1
- package/app/assets/{CopyDatabaseDialog-ChOc_aHQ.js → CopyDatabaseDialog-Gsai81KV.js} +1 -1
- package/app/assets/{CopyTableDialog-DnuH4LY7.js → CopyTableDialog-Bk8AC6tJ.js} +1 -1
- package/app/assets/{CreateDatabaseDialog-DxJWfyxB.js → CreateDatabaseDialog-Bzm0FfTH.js} +1 -1
- package/app/assets/{DataDiffDialog-Cn-eGt63.js → DataDiffDialog-PJeuNu0W.js} +1 -1
- package/app/assets/{DownloadToCSVDialog-DOj_AAnH.js → DownloadToCSVDialog-Bqw6Rhd1.js} +1 -1
- package/app/assets/{EditSchemaDialog-UhHglHzS.js → EditSchemaDialog-u5dIJ2gT.js} +1 -1
- package/app/assets/{FindReplaceDialog-DYEerBXx.js → FindReplaceDialog-BlS9158P.js} +1 -1
- package/app/assets/{FlushDialog-Dddl8R1h.js → FlushDialog-BJ7t14hx.js} +1 -1
- package/app/assets/{LinkColumnDialog-DbBY5TGQ.js → LinkColumnDialog-BhyQve5r.js} +1 -1
- package/app/assets/{LocalHistoryDialog-Nojvlhmz.js → LocalHistoryDialog-B0ytB5Y-.js} +1 -1
- package/app/assets/{ProcessListDialog-C460XY2M.js → ProcessListDialog-BKF1MRZ-.js} +1 -1
- package/app/assets/{QuickCommandPalette-Crdl1lBX.js → QuickCommandPalette-DzyPCRTc.js} +1 -1
- package/app/assets/{RowFormDialog-A8wtwTwI.js → RowFormDialog-DpqKxTg4.js} +1 -1
- package/app/assets/{SafetySettingsDialog-Mny69ZOZ.js → SafetySettingsDialog-BSB29OYt.js} +1 -1
- package/app/assets/{SchemaDiffDialog-Bv_hurif.js → SchemaDiffDialog-CW7Db6W_.js} +1 -1
- package/app/assets/{SchemaToHTMLDialog-BBskyW7d.js → SchemaToHTMLDialog-BZWaSeWl.js} +1 -1
- package/app/assets/{StatusDialog-C46oDW7W.js → StatusDialog-DYctXfMc.js} +1 -1
- package/app/assets/{TermsDialog-CSYNiNpB.js → TermsDialog-Bj_qh6sW.js} +1 -1
- package/app/assets/{UserAddDialog-DeXw9R9S.js → UserAddDialog-CbHCH74s.js} +1 -1
- package/app/assets/{UserManagerDialog-DVESBSWa.js → UserManagerDialog-DD-EVqkB.js} +1 -1
- package/app/assets/{VariablesDialog-BrHFb0LI.js → VariablesDialog-BG6lVLna.js} +1 -1
- package/app/assets/{button-BGQhw-yz.js → button-BRD_vJ8s.js} +1 -1
- package/app/assets/chevron-up-DVdt2433.js +1 -0
- package/app/assets/{connection-store-B9-4NAfR.js → connection-store-Cn79Ey1H.js} +1 -1
- package/app/assets/{database-DUBVz1in.js → database-DT05D7dO.js} +1 -1
- package/app/assets/de-CC5Txb37.js +2 -0
- package/app/assets/{dialog-z_ZHxAMN.js → dialog-1MXGAorC.js} +1 -1
- package/app/assets/{dist-R-HWeP5h.js → dist-BnghYOTd.js} +1 -1
- package/app/assets/{dist-Dfw8x01G.js → dist-Bo6CxCQ0.js} +1 -1
- package/app/assets/{dist-eK8CwLw8.js → dist-DGLzi2V0.js} +1 -1
- package/app/assets/{engine-DRzYxvTs.js → engine-tGsnPQEm.js} +1 -1
- package/app/assets/fr-DuwjnnAw.js +2 -0
- package/app/assets/{i18n-DyTdEJ5X.js → i18n-BBZ4HyyF.js} +2 -2
- package/app/assets/ja-B8MYtGo3.js +2 -0
- package/app/assets/ko-lJaJ15rE.js +2 -0
- package/app/assets/{main-DEK4mnDt.js → main-kdBvc1j0.js} +3 -3
- package/app/assets/{query-execution-DItl2TUQ.js → query-execution-COPkS7hB.js} +3 -3
- package/app/assets/{query-store-fCiE0iiG.js → query-store-Cu277RoH.js} +1 -1
- package/app/assets/{select-BoGTNqvN.js → select-CY6U-FwY.js} +1 -1
- package/app/assets/{settings-store-MJead_iM.js → settings-store-hXzC7s8K.js} +1 -1
- package/app/assets/{table-copy-DXLY7yKq.js → table-copy-DxuAqxW1.js} +1 -1
- package/app/assets/{ui-store-DWSBgCoR.js → ui-store-VGM_km-l.js} +1 -1
- package/app/assets/{use-engine-5vf18JRu.js → use-engine-CkfCgSB4.js} +1 -1
- package/app/assets/{user-store-D_BMKTT2.js → user-store-dpr5Uk1B.js} +1 -1
- package/app/assets/zh-DXC_ymYM.js +2 -0
- package/app/index.html +15 -15
- package/app/third-party-notices.txt +3668 -0
- package/package.json +4 -2
- package/app/assets/AboutDialog-DNnLylHg.js +0 -1
- package/app/assets/chevron-up-C8Exvnh_.js +0 -1
- package/app/assets/de-BqVlEtp8.js +0 -2
- package/app/assets/fr-BPECqiBp.js +0 -2
- package/app/assets/ja-DF-AzUTw.js +0 -2
- package/app/assets/ko-DqL1zlOi.js +0 -2
- package/app/assets/zh-GURsrn7-.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ConnectDialog-
|
|
2
|
-
import{_ as e,c as t,d as n,g as r,h as i,i as a,l as o,m as s,n as c,o as l,p as u,r as d,s as f}from"./ui-store-DWSBgCoR.js";import{_ as p,a as m,b as h,c as g,d as _,g as v,h as y,i as b,l as x,m as S,n as C,o as w,p as T,r as ee,s as E,t as te,u as ne,v as re,y as ie}from"./button-BGQhw-yz.js";import{a as ae,i as oe,n as se,o as ce,r as le,t as ue}from"./i18n-DyTdEJ5X.js";import{S as de,_ as fe,a as pe,b as me,c as he,d as ge,f as _e,g as ve,h as ye,i as be,l as xe,m as Se,n as Ce,o as we,p as Te,r as Ee,s as De,t as Oe,u as ke,v as Ae,x as je,y as Me}from"./dist-R-HWeP5h.js";import{n as Ne,t as Pe}from"./dist-eK8CwLw8.js";import{a as Fe,i as Ie,n as Le,r as Re,t as ze}from"./dist-Dfw8x01G.js";import{i as Be,t as Ve}from"./app-storage-B6v72zLH.js";import{r as He,t as Ue}from"./connection-store-B9-4NAfR.js";import{n as We,t as Ge}from"./query-store-fCiE0iiG.js";import{n as Ke,r as qe}from"./settings-store-MJead_iM.js";import{A as Je,C as Ye,D as Xe,E as Ze,O as Qe,S as $e,_ as et,a as tt,b as nt,c as rt,d as it,f as at,g as ot,h as st,i as ct,k as lt,l as ut,n as dt,o as ft,p as pt,r as mt,t as ht,u as gt,v as _t,w as vt,x as yt,y as bt}from"./database-DUBVz1in.js";import{_ as xt,a as St,b as Ct,c as wt,d as Tt,f as Et,g as Dt,h as Ot,i as kt,l as At,m as jt,n as Mt,o as Nt,p as Pt,r as Ft,s as It,t as Lt,u as Rt,v as zt,x as Bt,y as Vt}from"./query-execution-DItl2TUQ.js";import{i as Ht,n as Ut,o as Wt,t as Gt}from"./dbms-Bsjvyvsp.js";import{n as Kt,r as qt}from"./engine-DRzYxvTs.js";import{a as Jt,i as Yt,s as Xt}from"./schema-nodes-D3-cz2Xk.js";import{n as Zt,t as Qt}from"./use-engine-5vf18JRu.js";import{r as $t}from"./table-copy-DXLY7yKq.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var en=i((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,te());else{var t=n(l);t!==null&&ie(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function ee(){return g?!0:!(e.unstable_now()-T<w)}function E(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&ee());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ie(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?te():S=!1}}}var te;if(typeof y==`function`)te=function(){y(E)};else if(typeof MessageChannel<`u`){var ne=new MessageChannel,re=ne.port2;ne.port1.onmessage=E,te=function(){re.postMessage(null)}}else te=function(){_(E,0)};function ie(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,ie(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,te()))),r},e.unstable_shouldYield=ee,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),tn=i(((e,t)=>{t.exports=en()})),nn=i((e=>{var t=tn(),n=s(),r=h();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function c(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(o(e)!==e)throw Error(i(188))}function d(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return u(a),e;if(s===r)return u(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,l=a.child;l;){if(l===n){c=!0,n=a,r=s;break}if(l===r){c=!0,r=a,n=s;break}l=l.sibling}if(!c){for(l=s.child;l;){if(l===n){c=!0,n=s,r=a;break}if(l===r){c=!0,r=s,n=a;break}l=l.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var p=Object.assign,m=Symbol.for(`react.element`),g=Symbol.for(`react.transitional.element`),_=Symbol.for(`react.portal`),v=Symbol.for(`react.fragment`),y=Symbol.for(`react.strict_mode`),b=Symbol.for(`react.profiler`),x=Symbol.for(`react.consumer`),S=Symbol.for(`react.context`),C=Symbol.for(`react.forward_ref`),w=Symbol.for(`react.suspense`),T=Symbol.for(`react.suspense_list`),ee=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),te=Symbol.for(`react.activity`),ne=Symbol.for(`react.memo_cache_sentinel`),re=Symbol.iterator;function ie(e){return typeof e!=`object`||!e?null:(e=re&&e[re]||e[`@@iterator`],typeof e==`function`?e:null)}var ae=Symbol.for(`react.client.reference`);function oe(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ae?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case v:return`Fragment`;case b:return`Profiler`;case y:return`StrictMode`;case w:return`Suspense`;case T:return`SuspenseList`;case te:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case _:return`Portal`;case S:return e.displayName||`Context`;case x:return(e._context.displayName||`Context`)+`.Consumer`;case C:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ee:return t=e.displayName||null,t===null?oe(e.type)||`Memo`:t;case E:t=e._payload,e=e._init;try{return oe(e(t))}catch{}}return null}var se=Array.isArray,ce=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,le=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ue={pending:!1,data:null,method:null,action:null},de=[],fe=-1;function pe(e){return{current:e}}function me(e){0>fe||(e.current=de[fe],de[fe]=null,fe--)}function he(e,t){fe++,de[fe]=e.current,e.current=t}var ge=pe(null),_e=pe(null),ve=pe(null),ye=pe(null);function be(e,t){switch(he(ve,t),he(_e,e),he(ge,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?$d(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=$d(t),e=ef(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}me(ge),he(ge,e)}function xe(){me(ge),me(_e),me(ve)}function Se(e){e.memoizedState!==null&&he(ye,e);var t=ge.current,n=ef(t,e.type);t!==n&&(he(_e,e),he(ge,n))}function Ce(e){_e.current===e&&(me(ge),me(_e)),ye.current===e&&(me(ye),up._currentValue=ue)}var we,Te;function Ee(e){if(we===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);we=t&&t[1]||``,Te=-1<e.stack.indexOf(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ConnectDialog-BNJnQcBX.js","assets/ui-store-VGM_km-l.js","assets/button-BRD_vJ8s.js","assets/select-CY6U-FwY.js","assets/dist-BnghYOTd.js","assets/dist-DGLzi2V0.js","assets/dist-Bo6CxCQ0.js","assets/chevron-up-DVdt2433.js","assets/connection-store-Cn79Ey1H.js","assets/app-storage-B6v72zLH.js","assets/query-store-Cu277RoH.js","assets/settings-store-hXzC7s8K.js","assets/database-DT05D7dO.js","assets/i18n-BBZ4HyyF.js","assets/dbms-Bsjvyvsp.js","assets/dialog-1MXGAorC.js","assets/CreateDatabaseDialog-Bzm0FfTH.js","assets/CopyDatabaseDialog-Gsai81KV.js","assets/DownloadToCSVDialog-Bqw6Rhd1.js","assets/query-execution-COPkS7hB.js","assets/engine-tGsnPQEm.js","assets/schema-nodes-D3-cz2Xk.js","assets/file-name-CnYBZPf9.js","assets/SchemaToHTMLDialog-BZWaSeWl.js","assets/CopyTableDialog-Bk8AC6tJ.js","assets/table-copy-DxuAqxW1.js","assets/table-definition-Bs5VSn0X.js","assets/LinkColumnDialog-BhyQve5r.js","assets/DataDiffDialog-PJeuNu0W.js","assets/SchemaDiffDialog-CW7Db6W_.js","assets/EditSchemaDialog-u5dIJ2gT.js","assets/use-engine-CkfCgSB4.js","assets/UserManagerDialog-DD-EVqkB.js","assets/user-store-dpr5Uk1B.js","assets/UserAddDialog-CbHCH74s.js","assets/ProcessListDialog-BKF1MRZ-.js","assets/VariablesDialog-BG6lVLna.js","assets/StatusDialog-DYctXfMc.js","assets/FlushDialog-BJ7t14hx.js","assets/FindReplaceDialog-BlS9158P.js","assets/SafetySettingsDialog-BSB29OYt.js","assets/LocalHistoryDialog-B0ytB5Y-.js","assets/AboutDialog-CwxQS9-3.js","assets/TermsDialog-Bj_qh6sW.js","assets/RowFormDialog-DpqKxTg4.js","assets/QuickCommandPalette-DzyPCRTc.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as e,c as t,d as n,g as r,h as i,i as a,l as o,m as s,n as c,o as l,p as u,r as d,s as f}from"./ui-store-VGM_km-l.js";import{_ as p,a as m,b as h,c as g,d as _,g as v,h as y,i as b,l as x,m as S,n as C,o as w,p as T,r as ee,s as E,t as te,u as ne,v as re,y as ie}from"./button-BRD_vJ8s.js";import{a as ae,i as oe,n as se,o as ce,r as le,t as ue}from"./i18n-BBZ4HyyF.js";import{S as de,_ as fe,a as pe,b as me,c as he,d as ge,f as _e,g as ve,h as ye,i as be,l as xe,m as Se,n as Ce,o as we,p as Te,r as Ee,s as De,t as Oe,u as ke,v as Ae,x as je,y as Me}from"./dist-BnghYOTd.js";import{n as Ne,t as Pe}from"./dist-DGLzi2V0.js";import{a as Fe,i as Ie,n as Le,r as Re,t as ze}from"./dist-Bo6CxCQ0.js";import{i as Be,t as Ve}from"./app-storage-B6v72zLH.js";import{r as He,t as Ue}from"./connection-store-Cn79Ey1H.js";import{n as We,t as Ge}from"./query-store-Cu277RoH.js";import{n as Ke,r as qe}from"./settings-store-hXzC7s8K.js";import{A as Je,C as Ye,D as Xe,E as Ze,O as Qe,S as $e,_ as et,a as tt,b as nt,c as rt,d as it,f as at,g as ot,h as st,i as ct,k as lt,l as ut,n as dt,o as ft,p as pt,r as mt,t as ht,u as gt,v as _t,w as vt,x as yt,y as bt}from"./database-DT05D7dO.js";import{_ as xt,a as St,b as Ct,c as wt,d as Tt,f as Et,g as Dt,h as Ot,i as kt,l as At,m as jt,n as Mt,o as Nt,p as Pt,r as Ft,s as It,t as Lt,u as Rt,v as zt,x as Bt,y as Vt}from"./query-execution-COPkS7hB.js";import{i as Ht,n as Ut,o as Wt,t as Gt}from"./dbms-Bsjvyvsp.js";import{n as Kt,r as qt}from"./engine-tGsnPQEm.js";import{a as Jt,i as Yt,s as Xt}from"./schema-nodes-D3-cz2Xk.js";import{n as Zt,t as Qt}from"./use-engine-CkfCgSB4.js";import{r as $t}from"./table-copy-DxuAqxW1.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var en=i((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,te());else{var t=n(l);t!==null&&ie(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function ee(){return g?!0:!(e.unstable_now()-T<w)}function E(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&ee());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ie(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?te():S=!1}}}var te;if(typeof y==`function`)te=function(){y(E)};else if(typeof MessageChannel<`u`){var ne=new MessageChannel,re=ne.port2;ne.port1.onmessage=E,te=function(){re.postMessage(null)}}else te=function(){_(E,0)};function ie(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,ie(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,te()))),r},e.unstable_shouldYield=ee,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),tn=i(((e,t)=>{t.exports=en()})),nn=i((e=>{var t=tn(),n=s(),r=h();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function c(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(o(e)!==e)throw Error(i(188))}function d(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return u(a),e;if(s===r)return u(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,l=a.child;l;){if(l===n){c=!0,n=a,r=s;break}if(l===r){c=!0,r=a,n=s;break}l=l.sibling}if(!c){for(l=s.child;l;){if(l===n){c=!0,n=s,r=a;break}if(l===r){c=!0,r=s,n=a;break}l=l.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var p=Object.assign,m=Symbol.for(`react.element`),g=Symbol.for(`react.transitional.element`),_=Symbol.for(`react.portal`),v=Symbol.for(`react.fragment`),y=Symbol.for(`react.strict_mode`),b=Symbol.for(`react.profiler`),x=Symbol.for(`react.consumer`),S=Symbol.for(`react.context`),C=Symbol.for(`react.forward_ref`),w=Symbol.for(`react.suspense`),T=Symbol.for(`react.suspense_list`),ee=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),te=Symbol.for(`react.activity`),ne=Symbol.for(`react.memo_cache_sentinel`),re=Symbol.iterator;function ie(e){return typeof e!=`object`||!e?null:(e=re&&e[re]||e[`@@iterator`],typeof e==`function`?e:null)}var ae=Symbol.for(`react.client.reference`);function oe(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ae?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case v:return`Fragment`;case b:return`Profiler`;case y:return`StrictMode`;case w:return`Suspense`;case T:return`SuspenseList`;case te:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case _:return`Portal`;case S:return e.displayName||`Context`;case x:return(e._context.displayName||`Context`)+`.Consumer`;case C:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ee:return t=e.displayName||null,t===null?oe(e.type)||`Memo`:t;case E:t=e._payload,e=e._init;try{return oe(e(t))}catch{}}return null}var se=Array.isArray,ce=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,le=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ue={pending:!1,data:null,method:null,action:null},de=[],fe=-1;function pe(e){return{current:e}}function me(e){0>fe||(e.current=de[fe],de[fe]=null,fe--)}function he(e,t){fe++,de[fe]=e.current,e.current=t}var ge=pe(null),_e=pe(null),ve=pe(null),ye=pe(null);function be(e,t){switch(he(ve,t),he(_e,e),he(ge,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?$d(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=$d(t),e=ef(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}me(ge),he(ge,e)}function xe(){me(ge),me(_e),me(ve)}function Se(e){e.memoizedState!==null&&he(ye,e);var t=ge.current,n=ef(t,e.type);t!==n&&(he(_e,e),he(ge,n))}function Ce(e){_e.current===e&&(me(ge),me(_e)),ye.current===e&&(me(ye),up._currentValue=ue)}var we,Te;function Ee(e){if(we===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);we=t&&t[1]||``,Te=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+we+e+Te}var De=!1;function Oe(e,t){if(!e||De)return``;De=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
5
5
|
`),l=s.split(`
|
|
@@ -920,7 +920,7 @@ WHERE`).replace(/\s+;$/,`;`),s,ae.t(`query.tabs.queryTitle`,{n:(We.getState().ta
|
|
|
920
920
|
`));break;case`json`:Vt(JSON.stringify(n.map(e=>Object.fromEntries(e)),null,2));break;case`insert`:{if(!It)return;let e=r.map(e=>Ee.quoteIdentifier(e)).join(`, `);Vt(n.map(t=>`INSERT INTO ${Ee.qualify(It.database,It.table)} (${e}) VALUES (${t.map(([,e])=>Ee.quoteLiteral(e)).join(`, `)});`).join(`
|
|
921
921
|
`))}}},[zt,It,Ee]),Gt=(0,D.useCallback)(async t=>{if(!Fe)return;let n=Fe.fields.filter(e=>!y5(e.name)),i=t.map(e=>Object.fromEntries(zt(e))),a=Ue.getState().activeConnections.find(t=>t.id===e);try{let{connectionId:e,table:t}=await dXe({table:It?.table??`result`,fields:n,rows:i,sourceDbms:a?.dbms??`unknown`});c.getState().setFooterMessage(r(`result.grid.sentToScratchpad`,{count:i.length,table:t})),XXe(e,`main`,t)}catch(e){e instanceof Lt||c.getState().setFooterMessage(e instanceof Error?e.message:String(e))}},[Fe,zt,e,It,r]),Kt=(0,D.useCallback)((e,t)=>{t!=null&&(g(e),v(String(t)),x(`equals`),St({field:e,value:String(t),mode:`equals`}))},[St]),qt=(0,D.useCallback)(e=>{if(e>=$e){vt(new Set([e]));return}Se(t=>new Set(t).add(e)),Oe(null)},[$e,vt]),Jt=(0,D.useCallback)((t,n)=>{n!=null&&ZXe(t.targetConnectionId??e,t.targetDatabase,t.targetTable,t.targetColumn,String(n))},[e]),Yt=(0,D.useMemo)(()=>Fe?new Map(Fe.fields.map(e=>[e.name,e.type])):new Map,[Fe]),Xt=(0,D.useMemo)(()=>!Fe||Fe.fields.length===0?[]:Fe.fields.filter(e=>!y5(e.name)).map(e=>U2e.accessor(t=>t[e.name],{id:e.name,header:e.name,cell:e=>{let t=e.getValue();if(t===null)return(0,$.jsx)(`span`,{className:`text-muted-foreground italic`,children:`NULL`});let n=m7(t);return n===null?String(t):(0,$.jsx)(H2e,{value:t,jsonString:n})}})),[Fe]),Qt=it,$t=TQe({data:Qt,columns:Xt,state:{sorting:o,columnVisibility:p},onSortingChange:s,onColumnVisibilityChange:m,getCoreRowModel:yQe(),getSortedRowModel:bQe()}),{rows:en}=$t.getRowModel(),tn=GQe({count:en.length,getScrollElement:()=>a.current,estimateSize:()=>32,overscan:20});if(!Ie)return(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:r(`result.grid.noData`)});let nn=Fe.fields.filter(e=>!y5(e.name)).map(e=>e.name),rn=Qt.length===0,an=$t.getVisibleLeafColumns().length,on=nn.length-an,sn=40+$t.getVisibleLeafColumns().reduce((e,t)=>e+Ve(t.id),0);return(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center gap-2 border-b bg-muted/30 px-3 py-1.5`,children:[(Re||Le)&&(0,$.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:Re?`${Re.database}.${Re.table}`:Le?`${Le.database}.${Le.table}`:``}),Ze&&(0,$.jsx)(`span`,{className:`rounded border border-catppuccin-yellow/50 px-1.5 py-px text-[10px] font-medium uppercase text-catppuccin-yellow`,title:Ze,children:Ze}),(Re||Le)&&(0,$.jsx)(`div`,{className:`mx-1 h-4 w-px bg-border`}),Qe&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{type:`button`,className:`flex h-7 items-center gap-1 rounded border px-2 text-xs disabled:opacity-40 bg-primary/10 text-primary border-primary/30 hover:bg-primary/20 disabled:hover:bg-primary/10`,onClick:()=>void Et(),disabled:!nt||je,children:[(0,$.jsx)(E8,{className:`size-3`}),r(`result.grid.commit`)]}),(0,$.jsxs)(`button`,{type:`button`,className:`flex h-7 items-center gap-1 rounded border bg-background px-2 text-xs text-muted-foreground hover:text-foreground disabled:opacity-40 disabled:hover:text-muted-foreground`,onClick:ht,disabled:!nt,children:[(0,$.jsx)(NYe,{className:`size-3`}),r(`result.grid.discard`)]}),(0,$.jsx)(`div`,{className:`mx-1 h-4 w-px bg-border`}),(0,$.jsxs)(C8,{children:[(0,$.jsx)(w8,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`flex h-7 items-center rounded border bg-background px-1.5 text-xs text-muted-foreground hover:text-foreground disabled:opacity-40`,onClick:_t,disabled:je,"aria-label":r(`result.grid.addRow`),children:(0,$.jsx)(B8,{className:`size-3.5`})})}),(0,$.jsx)(T8,{side:`bottom`,children:r(`result.grid.addRowHint`)})]}),(0,$.jsxs)(C8,{children:[(0,$.jsx)(w8,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`flex h-7 items-center rounded border bg-background px-1.5 text-xs text-muted-foreground hover:text-foreground disabled:opacity-40`,onClick:()=>Dt(`insert`),disabled:je,"aria-label":r(`result.grid.addRowForm`),children:(0,$.jsx)(wYe,{className:`size-3.5`})})}),(0,$.jsx)(T8,{side:`bottom`,children:r(`result.grid.addRowFormHint`)})]}),(0,$.jsxs)(`button`,{type:`button`,className:`flex h-7 items-center gap-1 rounded border bg-background px-2 text-xs text-muted-foreground hover:text-destructive disabled:opacity-40 disabled:hover:text-muted-foreground`,onClick:bt,disabled:Ce.size===0||je,title:r(`result.grid.deleteHint`),children:[(0,$.jsx)(G8,{className:`size-3`}),Ce.size>0?r(`result.grid.deleteCount`,{count:Ce.size}):r(`result.grid.delete`)]})]}),Le&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`mx-1 h-4 w-px bg-border`}),(0,$.jsxs)(`select`,{className:`h-7 rounded border bg-background px-1.5 text-xs`,value:h,onChange:e=>g(e.target.value),children:[(0,$.jsx)(`option`,{value:``,children:r(`result.grid.field`)}),nn.map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))]}),(0,$.jsxs)(`select`,{className:`h-7 rounded border bg-background px-1 text-xs`,value:y,onChange:e=>x(e.target.value),title:r(`result.grid.searchMode`),children:[(0,$.jsx)(`option`,{value:`contains`,children:r(`result.grid.contains`)}),(0,$.jsx)(`option`,{value:`equals`,children:r(`result.grid.equals`)})]}),(0,$.jsx)(`input`,{className:`h-7 w-36 rounded border bg-background px-2 text-xs placeholder:text-muted-foreground`,placeholder:r(`result.grid.searchPlaceholder`),value:_,onChange:e=>v(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Ot()}}),(0,$.jsx)(`button`,{type:`button`,className:`flex h-7 items-center rounded border bg-background px-1.5 text-muted-foreground hover:text-foreground`,onClick:Ot,children:(0,$.jsx)(U8,{className:`size-3.5`})}),_&&(0,$.jsx)(`button`,{type:`button`,className:`flex h-7 items-center rounded border bg-background px-1.5 text-muted-foreground hover:text-foreground`,onClick:kt,children:(0,$.jsx)(b,{className:`size-3.5`})}),(0,$.jsx)(`div`,{className:`mx-1 h-4 w-px bg-border`}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:r(`result.grid.orderBy`)}),(0,$.jsxs)(`select`,{className:`h-7 rounded border bg-background px-1.5 text-xs`,value:ce,onChange:e=>At(e.target.value),children:[(0,$.jsx)(`option`,{value:``,children:r(`result.grid.none`)}),nn.map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))]}),(0,$.jsxs)(`select`,{className:`h-7 rounded border bg-background px-1.5 text-xs`,value:ue,onChange:e=>jt(e.target.value),disabled:!ce,children:[(0,$.jsx)(`option`,{value:`ASC`,children:`ASC`}),(0,$.jsx)(`option`,{value:`DESC`,children:`DESC`})]}),(0,$.jsx)(`div`,{className:`mx-1 h-4 w-px bg-border`}),(0,$.jsxs)(C8,{children:[(0,$.jsx)(w8,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`flex h-7 items-center rounded border bg-background px-1.5 text-xs text-muted-foreground hover:text-foreground disabled:opacity-50`,onClick:Nt,disabled:fe,"aria-label":r(`result.grid.refresh`),children:(0,$.jsx)(V8,{className:`size-3.5 ${fe?`animate-spin`:``}`})})}),(0,$.jsx)(T8,{side:`bottom`,children:r(`result.grid.refresh`)})]}),ge>0&&(me>0||et)&&(0,$.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,$.jsx)(`button`,{type:`button`,className:`flex h-7 items-center rounded border bg-background px-1.5 hover:text-foreground disabled:opacity-40 disabled:hover:text-muted-foreground`,onClick:()=>Ct(me-1),disabled:me===0||fe||nt,title:r(nt?`result.grid.pagingBlocked`:`result.grid.prevPage`),children:(0,$.jsx)(iYe,{className:`size-3.5`})}),(0,$.jsx)(`span`,{className:`tabular-nums`,children:r(`result.grid.pageRange`,{from:me*ge+ +($e>0),to:me*ge+$e})}),(0,$.jsx)(`button`,{type:`button`,className:`flex h-7 items-center rounded border bg-background px-1.5 hover:text-foreground disabled:opacity-40 disabled:hover:text-muted-foreground`,onClick:()=>Ct(me+1),disabled:!et||fe||nt,title:r(nt?`result.grid.pagingBlocked`:`result.grid.nextPage`),children:(0,$.jsx)(O8,{className:`size-3.5`})})]}),t$e(C)&&(0,$.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,className:`flex h-7 items-center gap-1 rounded border px-2 text-xs ${T?`border-amber-500/50 bg-amber-500/10 text-amber-700 dark:text-amber-300`:`text-muted-foreground`}`,title:r(`result.grid.changesToggle`),onClick:()=>ee(e=>!e),children:r(`result.grid.changesSince`,{changed:C.changedCount,added:C.newRows.size,gone:C.goneCount})}),(0,$.jsx)(`button`,{type:`button`,className:`flex h-7 items-center rounded border bg-background px-1.5 text-muted-foreground hover:text-foreground`,title:r(`result.grid.changesDismiss`),onClick:()=>w(null),children:(0,$.jsx)(b,{className:`size-3.5`})})]})]}),(0,$.jsxs)(x7,{children:[(0,$.jsx)(S7,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,className:`ml-auto flex h-7 items-center gap-1 rounded border bg-background px-2 text-xs hover:text-foreground ${on>0?`text-primary border-primary/30`:`text-muted-foreground`}`,title:r(`result.grid.columns`),children:[(0,$.jsx)(M8,{className:`size-3.5`}),on>0?`${an}/${nn.length}`:r(`result.grid.columns`)]})}),(0,$.jsxs)(C7,{align:`end`,className:`w-56 p-2`,children:[(0,$.jsxs)(`div`,{className:`mb-1 flex items-center justify-between gap-2 border-b pb-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,className:`text-xs text-primary hover:underline disabled:opacity-40 disabled:no-underline`,onClick:()=>$t.toggleAllColumnsVisible(!0),disabled:on===0,children:r(`result.grid.showAllColumns`)}),(0,$.jsx)(`button`,{type:`button`,className:`text-xs text-primary hover:underline disabled:opacity-40 disabled:no-underline`,onClick:()=>$t.toggleAllColumnsVisible(!1),disabled:an===0,children:r(`result.grid.hideAllColumns`)}),(0,$.jsx)(`button`,{type:`button`,className:`text-xs text-primary hover:underline disabled:opacity-40 disabled:no-underline`,onClick:()=>{f({}),ze&&b7.getState().resetColumnWidths(ze)},disabled:Object.keys(d).length===0&&Object.keys(Be).length===0,children:r(`result.grid.resetWidths`)})]}),(0,$.jsx)(`div`,{className:`max-h-72 overflow-y-auto`,children:$t.getAllLeafColumns().map(e=>(0,$.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 rounded px-1.5 py-1 text-xs hover:bg-accent`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`accent-primary`,checked:e.getIsVisible(),onChange:e.getToggleVisibilityHandler()}),(0,$.jsx)(`span`,{className:`truncate`,title:e.id,children:e.id})]},e.id))})]})]})]}),i?.error&&(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start gap-2 border-b border-destructive/40 bg-destructive/10 px-3 py-1.5 text-xs text-destructive`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-pre-wrap break-words`,children:i.error}),(0,$.jsx)(`button`,{type:`button`,className:`shrink-0 opacity-70 hover:opacity-100`,onClick:()=>We.getState().setError(e,t,null),"aria-label":r(`result.grid.dismiss`),children:(0,$.jsx)(b,{className:`size-3`})})]}),(0,$.jsxs)(p5,{onOpenChange:e=>{e||te(null)},children:[(0,$.jsx)(m5,{asChild:!0,children:(0,$.jsx)(`div`,{ref:a,className:`flex-1 overflow-auto outline-none`,tabIndex:0,onKeyDown:e=>{De||e.key===`Escape`&&Ce.size>0&&we(new Set)},children:(0,$.jsxs)(KQe,{className:`min-w-full table-fixed [&_td]:bg-muted [&_td]:border-r [&_td]:border-border/60 [&_td:last-child]:border-r-0`,style:{width:sn},children:[(0,$.jsx)(qQe,{className:`sticky top-0 z-10 bg-catppuccin-crust shadow-[inset_0_-1px_0_var(--border)] [&_th]:h-8 [&_th]:bg-catppuccin-crust [&_th]:font-semibold [&_th]:text-foreground [&_th]:text-[11px]`,children:$t.getHeaderGroups().map(e=>(0,$.jsxs)(d7,{children:[(0,$.jsx)(f7,{className:`w-10 min-w-10 cursor-pointer select-none text-center !text-muted-foreground`,title:Ce.size===Qt.length&&Qt.length>0?r(`result.grid.clearSelection`):r(`result.grid.selectAll`),onClick:()=>{we(e=>e.size===Qt.length?new Set:new Set(Qt.map((e,t)=>t)))},children:`#`}),e.headers.map(e=>{let t=e.id,n=Le?ce===t?ue===`DESC`?`desc`:`asc`:!1:e.column.getIsSorted(),r=Ve(t);return(0,$.jsxs)(f7,{"data-header-id":t,className:`relative select-none`,style:{width:`${r}px`,minWidth:`${r}px`,maxWidth:`${r}px`},children:[(0,$.jsxs)(`div`,{className:`flex cursor-pointer items-center gap-1`,onClick:Le?()=>Mt(t):e.column.getToggleSortingHandler(),children:[(0,$.jsx)(`span`,{className:`truncate`,children:e.isPlaceholder?null:xQe(e.column.columnDef.header,e.getContext())}),n===`asc`&&(0,$.jsx)(tYe,{className:`size-3 shrink-0 text-primary`}),n===`desc`&&(0,$.jsx)(eYe,{className:`size-3 shrink-0 text-primary`})]}),(0,$.jsx)(`div`,{className:`absolute right-0 top-0 z-20 h-full w-1.5 cursor-col-resize hover:bg-primary/30`,onMouseDown:e=>Pt(e,t),onDoubleClick:e=>Ft(e,t)})]},e.id)})]},e.id))}),(0,$.jsxs)(JQe,{children:[tn.getVirtualItems().length>0&&(0,$.jsx)(`tr`,{style:{height:tn.getVirtualItems()[0].start}}),rn&&(0,$.jsx)(`tr`,{children:(0,$.jsxs)(`td`,{colSpan:an+1,className:`py-10 text-center text-sm text-muted-foreground`,children:[r(Le?`result.grid.emptyTable`:`result.grid.noRows`),Qe&&(0,$.jsxs)($.Fragment,{children:[` `,(0,$.jsx)(`button`,{type:`button`,className:`underline hover:text-foreground`,onClick:_t,children:r(`result.grid.addARow`)})]})]})}),tn.getVirtualItems().map(e=>{let t=en[e.index],n=t.index>=$e,i=xe.has(t.index),a=Ce.has(t.index),o=_e.has(t.index),s=i?`[&_td]:bg-destructive/10 [&_td]:line-through [&_td]:text-muted-foreground`:a?`[&_td]:bg-primary/15`:n?`[&_td]:bg-green-500/10`:o?`[&_td]:bg-orange-500/10`:T&&C?.newRows.has(t.index)?`[&_td]:bg-green-500/10`:e.index%2==1?`[&_td]:bg-muted/60`:void 0;return(0,$.jsxs)(d7,{className:s,"data-selected":a||void 0,children:[(0,$.jsx)(p7,{className:`group/num relative w-10 min-w-10 cursor-pointer select-none text-center text-xs tabular-nums !no-underline ${a?`!bg-primary/30 text-primary-foreground`:`text-muted-foreground`}`,title:r(i?`result.grid.markedForDeletion`:n?`result.grid.newRow`:`result.grid.clickToSelect`),onClick:e=>{if(i){xt(t.index);return}gt(t.index,e)},children:n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`group-hover/num:invisible`,children:`+`}),(0,$.jsx)(`button`,{type:`button`,className:`absolute inset-0 flex items-center justify-center text-destructive opacity-0 group-hover/num:opacity-100`,title:r(`result.grid.removeNewRow`),onClick:e=>{e.stopPropagation(),yt(t.index)},children:(0,$.jsx)(b,{className:`size-3.5`})})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:Qe&&!i?`group-hover/num:invisible`:``,children:t.index+1}),Qe&&!i&&(0,$.jsx)(`button`,{type:`button`,className:`absolute inset-0 flex items-center justify-center text-primary opacity-0 group-hover/num:opacity-100`,title:r(`result.grid.editRowForm`),onClick:e=>{e.stopPropagation(),Dt(`edit`,t.index)},children:(0,$.jsx)(z8,{className:`size-3`})})]})}),t.getVisibleCells().map(e=>{let n=e.column.id,a=Ve(n),o=t.index,s=De?.rowIdx===o&&De?.field===n,c=ut(o,n),l=t.original[n],u=lt(o,n,l),d=Yt.get(n)??``,f=T&&C?.changedCells.get(o)?.has(n)?{previous:C.changedCells.get(o).get(n)}:null,p=G2e(d),m=/datetime|timestamp/i.test(d);return(0,$.jsx)(p7,{"data-col-id":n,className:`relative ${Qe?`cursor-text`:``} ${c?`!text-orange-500 font-medium`:``} ${f?`!bg-amber-500/20`:``}`,title:f?r(`result.grid.previousValue`,{value:f.previous===null||f.previous===void 0?`NULL`:String(f.previous)}):_$e(_7(u),a)?_7(u):void 0,style:{width:`${a}px`,minWidth:`${a}px`,maxWidth:`${a}px`,overflow:s?`visible`:`hidden`,textOverflow:`ellipsis`},onContextMenu:()=>{te({rowIdx:o,column:n,value:u}),Ce.has(o)||(we(new Set([o])),Te.current=o)},onClick:e=>{if(e.shiftKey||e.metaKey||e.ctrlKey){e.preventDefault(),gt(o,e);return}s||((!Ce.has(o)||Ce.size>1)&>(o,e),!(!Qe||i)&&(typeof u==`object`&&u&&!ArrayBuffer.isView(u)||dt(o,n,u)))},children:s?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`invisible whitespace-nowrap`,children:u===null?`NULL`:String(u)}),(0,$.jsxs)(x7,{open:p,children:[(0,$.jsx)(x$e,{asChild:!0,children:(0,$.jsx)(`input`,{ref:Ne,className:`absolute inset-0 border-none bg-primary/10 px-2 py-0 text-sm outline-none ring-1 ring-inset ring-primary`,value:ke,onChange:e=>Ae(e.target.value),onKeyDown:e=>{e.key===`Enter`&&ft(),e.key===`Escape`&&pt(),e.stopPropagation()},onBlur:e=>{e.relatedTarget?.closest(`[data-slot="calendar"]`)||ft()},onClick:e=>e.stopPropagation()})}),p&&(0,$.jsx)(C7,{align:`start`,className:`w-auto p-0`,onOpenAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:(0,$.jsx)(z2e,{mode:`single`,selected:K2e(ke),onSelect:e=>{if(e){let t=Y2e(e,m);Ae(t),Ne.current?.focus()}},defaultMonth:K2e(ke)})})]})]}):u===null?(0,$.jsx)(`span`,{className:`italic ${c?`text-orange-500`:`text-muted-foreground`}`,children:`NULL`}):(()=>{let e=m7(u);if(e!==null)return(0,$.jsx)(H2e,{value:u,jsonString:e,edited:c,editable:Qe,onEdit:e=>mt(o,n,e)});let t=Rt.get(n);return t&&!i?(0,$.jsx)(`a`,{role:`link`,tabIndex:0,className:`cursor-pointer text-primary underline decoration-primary/40 underline-offset-2 hover:decoration-primary`,title:`${t.targetConnectionId?`${q2e(t.targetConnectionId)} · `:``}${t.targetDatabase}.${t.targetTable}.${t.targetColumn} = ${String(u)}`,onClick:e=>{e.stopPropagation(),Jt(t,u)},onKeyDown:e=>{e.key===`Enter`&&(e.stopPropagation(),Jt(t,u))},children:String(u)}):(0,$.jsx)(`span`,{children:String(u)})})()},e.id)})]},t.id)}),tn.getVirtualItems().length>0&&(0,$.jsx)(`tr`,{style:{height:tn.getTotalSize()-(tn.getVirtualItems().at(-1)?.end??0)}})]})]})})}),E&&(()=>{let t=It?Rt.get(E.column):void 0,n=E.value!==null&&E.value!==void 0,i=xe.has(E.rowIdx),a=Qe&&!i,o=!!It&&i5(oe,e,It.database,It.table).some(e=>e.column===E.column),s=Ht(E.rowIdx);return(0,$.jsxs)(h5,{className:`min-w-60`,children:[t&&(0,$.jsxs)(g5,{disabled:!n,onSelect:()=>Jt(t,E.value),children:[(0,$.jsx)(L8,{className:`size-3.5`}),r(`result.grid.followLink`,{table:t.targetTable,column:t.targetColumn})]}),It&&(0,$.jsxs)(g5,{onSelect:()=>ie(`link-column`,{connectionId:e,database:It.database,table:It.table,column:E.column}),children:[(0,$.jsx)(L8,{className:`size-3.5`}),r(t?`result.grid.editLink`:`result.grid.linkColumn`,{column:E.column})]}),o&&It&&(0,$.jsx)(g5,{onSelect:()=>se(e,{database:It.database,table:It.table,column:E.column}),children:r(`result.grid.removeLink`)}),Le&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(_5,{}),(0,$.jsxs)(g5,{disabled:!n,onSelect:()=>Kt(E.column,E.value),children:[(0,$.jsx)(U8,{className:`size-3.5`}),r(`result.grid.filterByValue`,{column:E.column})]}),_&&(0,$.jsx)(g5,{onSelect:kt,children:r(`result.grid.clearFilter`)})]}),(0,$.jsx)(_5,{}),(0,$.jsx)(g5,{disabled:!n,onSelect:()=>Vt(Bt(E.value)),children:r(`result.grid.copyValue`)}),(0,$.jsx)(g5,{onSelect:()=>Vt(E.column),children:r(`result.grid.copyColumnName`)}),(0,$.jsx)(_5,{}),(0,$.jsx)(g5,{onSelect:()=>Wt(s,`tsv`),children:r(`result.grid.copyRowsTsv`,{count:s.length})}),(0,$.jsx)(g5,{onSelect:()=>Wt(s,`csv`),children:r(`result.grid.copyRowsCsv`,{count:s.length})}),(0,$.jsx)(g5,{onSelect:()=>Wt(s,`json`),children:r(`result.grid.copyRowsJson`,{count:s.length})}),It&&(0,$.jsx)(g5,{onSelect:()=>Wt(s,`insert`),children:r(`result.grid.copyRowsInsert`,{count:s.length})}),a&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(_5,{}),(0,$.jsxs)(g5,{onSelect:()=>dt(E.rowIdx,E.column,E.value),children:[(0,$.jsx)(z8,{className:`size-3.5`}),r(`result.grid.editCell`)]}),(0,$.jsxs)(g5,{onSelect:()=>Dt(`edit`,E.rowIdx),children:[(0,$.jsx)(wYe,{className:`size-3.5`}),r(`result.grid.editRowForm`)]}),(0,$.jsx)(g5,{disabled:!n,onSelect:()=>mt(E.rowIdx,E.column,null),children:r(`result.grid.setNull`)}),(0,$.jsx)(g5,{onSelect:()=>mt(E.rowIdx,E.column,``),children:r(`result.grid.setEmpty`)}),(0,$.jsxs)(g5,{variant:`destructive`,onSelect:()=>{s.length>1?bt():qt(E.rowIdx)},children:[(0,$.jsx)(G8,{className:`size-3.5`}),r(`result.grid.deleteRowsPending`,{count:s.length})]})]}),i&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(_5,{}),(0,$.jsx)(g5,{onSelect:()=>xt(E.rowIdx),children:r(`result.grid.restoreRow`)})]}),(0,$.jsx)(_5,{}),!ae&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(g5,{onSelect:()=>{Gt(s)},children:[(0,$.jsx)(xYe,{className:`size-3.5`}),r(`result.grid.sendRowsToScratchpad`,{count:s.length})]}),it.length>s.length&&(0,$.jsxs)(g5,{onSelect:()=>{Gt(it.map((e,t)=>t).filter(e=>!xe.has(e)))},children:[(0,$.jsx)(xYe,{className:`size-3.5`}),r(`result.grid.sendAllToScratchpad`,{count:it.length-xe.size})]}),(0,$.jsx)(_5,{})]}),(0,$.jsxs)(g5,{onSelect:()=>m(e=>({...e,[E.column]:!1})),children:[(0,$.jsx)(M8,{className:`size-3.5`}),r(`result.grid.hideColumn`,{column:E.column})]})]})})()]}),(0,$.jsxs)(`div`,{className:`flex flex-shrink-0 items-center border-t px-3 py-1 text-xs text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:ye>0?r(`result.grid.rowsWithNew`,{count:$e,added:ye}):r(`result.grid.rows`,{count:$e})}),Le&&ce?(0,$.jsx)(`span`,{className:`ml-2`,children:r(`result.grid.sortedBy`,{column:ce,direction:ue})}):o.length>0&&(0,$.jsx)(`span`,{className:`ml-2`,children:r(`result.grid.sortedBy`,{column:o[0].id,direction:o[0].desc?`DESC`:`ASC`})}),Ce.size>0&&(0,$.jsx)(`span`,{className:`ml-2`,children:r(`result.grid.selected`,{count:Ce.size})}),nt&&(0,$.jsx)(`span`,{className:`ml-2 text-orange-500`,children:[tt>0?r(`result.grid.cellsModified`,{count:tt}):null,ye>0?r(`result.grid.newCount`,{count:ye}):null,xe.size>0?r(`result.grid.toDelete`,{count:xe.size}):null].filter(Boolean).join(`, `)})]})]})}function x9({icon:e,label:t,value:n,muted:r}){return(0,$.jsxs)(`div`,{className:`flex min-w-[140px] flex-1 items-center gap-3 rounded-md border bg-muted/30 px-3 py-2`,children:[(0,$.jsx)(`div`,{className:`flex size-8 shrink-0 items-center justify-center rounded-md bg-primary/10 text-primary [&_svg]:size-4`,children:e}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:t}),(0,$.jsx)(`div`,{className:`truncate text-sm font-semibold tabular-nums ${r?`text-muted-foreground`:``}`,children:n})]})]})}function Z2e(e){return e==null?`—`:e<1e3?`${e} ms`:`${(e/1e3).toFixed(2)} s`}function Q2e({connectionId:e,tabId:t}){let{t:n}=S(),r=We(t=>t.tabs[e]??Ge).find(e=>e.id===t),i=We(n=>n.history.find(n=>n.connectionId===e&&n.tabId===t)),[a,o]=(0,D.useState)(!1),s=(0,D.useCallback)(()=>{i&&navigator.clipboard.writeText(i.query).then(()=>{o(!0),setTimeout(()=>o(!1),1500)})},[i]),c=r?.results??[],l=r?.executionTime??null;if(c.length===0&&!i)return(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:n(`result.info.empty`)});let u=c.reduce((e,t)=>e+t.rows.length,0),d=c.reduce((e,t)=>e+(t.affectedRows||0),0),f=c.map(e=>e.insertId).filter(e=>e>0).pop();return(0,$.jsx)(f5,{className:`h-full`,children:(0,$.jsxs)(`div`,{className:`space-y-4 p-3 text-sm`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(x9,{icon:(0,$.jsx)(j8,{}),label:n(`result.info.executionTime`),value:Z2e(l),muted:l==null}),(0,$.jsx)(x9,{icon:(0,$.jsx)(gYe,{}),label:n(`result.info.resultSets`),value:c.length}),(0,$.jsx)(x9,{icon:(0,$.jsx)(H8,{}),label:n(`result.info.rowsReturned`),value:u.toLocaleString()}),(0,$.jsx)(x9,{icon:(0,$.jsx)(z8,{}),label:n(`result.info.affectedRows`),value:d.toLocaleString(),muted:d===0}),f!=null&&(0,$.jsx)(x9,{icon:(0,$.jsx)(fYe,{}),label:n(`result.info.insertId`),value:f})]}),i&&(0,$.jsxs)(`section`,{className:`rounded-md border`,children:[(0,$.jsxs)(`header`,{className:`flex items-center gap-2 border-b bg-muted/30 px-3 py-1.5`,children:[i.success?(0,$.jsx)(k8,{className:`size-3.5 text-green-500`}):(0,$.jsx)(A8,{className:`size-3.5 text-destructive`}),(0,$.jsx)(`span`,{className:`text-xs font-medium`,children:n(`result.info.lastQuery`)}),i.database&&(0,$.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-px font-mono text-[10px] text-muted-foreground`,children:i.database}),(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:new Date(i.timestamp).toLocaleString(void 0,{hour12:!1})}),(0,$.jsx)(`div`,{className:`flex-1`}),(0,$.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] text-muted-foreground hover:bg-muted hover:text-foreground`,onClick:s,children:[a?(0,$.jsx)(E8,{className:`size-3`}):(0,$.jsx)(N8,{className:`size-3`}),n(a?`result.info.copied`:`result.info.copy`)]})]}),(0,$.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap break-words px-3 py-2 font-mono text-xs`,children:i.query}),i.error&&(0,$.jsx)(`div`,{className:`border-t border-destructive/30 bg-destructive/10 px-3 py-1.5 text-xs text-destructive`,children:i.error})]}),c.map((e,t)=>{let r=new Set(e.primaryKeys??[]),i=e.fields.some(e=>e.orgName&&e.orgName!==e.name),a=Array.from(new Set(e.fields.map(e=>e.orgTable?`${e.db?e.db+`.`:``}${e.orgTable}`:``).filter(Boolean)));return(0,$.jsxs)(`section`,{className:`rounded-md border`,children:[(0,$.jsxs)(`header`,{className:`flex flex-wrap items-center gap-2 border-b bg-muted/30 px-3 py-1.5`,children:[(0,$.jsx)(`span`,{className:`rounded bg-primary/10 px-1.5 py-px text-[10px] font-semibold uppercase tracking-wide text-primary`,children:n(`result.info.resultN`,{n:t+1})}),e.sourceTable?(0,$.jsxs)(`span`,{className:`flex items-center gap-1 font-mono text-xs`,children:[(0,$.jsx)(W8,{className:`size-3 text-muted-foreground`}),e.sourceTable.database,`.`,e.sourceTable.table]}):a.length>0?(0,$.jsxs)(`span`,{className:`flex items-center gap-1 font-mono text-xs text-muted-foreground`,children:[(0,$.jsx)(W8,{className:`size-3`}),a.join(`, `)]}):null,(0,$.jsx)(`div`,{className:`flex-1`}),(0,$.jsx)(`span`,{className:`text-[11px] text-muted-foreground tabular-nums`,children:n(`result.info.rowsAndFields`,{rows:e.rows.length.toLocaleString(),fields:e.fields.length})}),e.affectedRows>0&&(0,$.jsxs)(`span`,{className:`text-[11px] text-muted-foreground tabular-nums`,children:[`· `,n(`result.info.affectedRows`),` `,e.affectedRows.toLocaleString()]})]}),e.message&&(0,$.jsx)(`div`,{className:`border-b px-3 py-1.5 font-mono text-xs text-muted-foreground`,children:e.message}),e.fields.length>0?(0,$.jsx)(`div`,{className:`overflow-x-auto`,children:(0,$.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{className:`border-b text-left text-[10px] uppercase tracking-wide text-muted-foreground`,children:[(0,$.jsx)(`th`,{className:`w-8 px-3 py-1.5 font-medium`,children:`#`}),(0,$.jsx)(`th`,{className:`px-3 py-1.5 font-medium`,children:n(`result.info.colName`)}),i&&(0,$.jsx)(`th`,{className:`px-3 py-1.5 font-medium`,children:n(`result.info.colOrigin`)}),(0,$.jsx)(`th`,{className:`px-3 py-1.5 font-medium`,children:n(`result.info.colType`)}),(0,$.jsx)(`th`,{className:`px-3 py-1.5 font-medium`,children:n(`result.info.colTable`)})]})}),(0,$.jsx)(`tbody`,{children:e.fields.map((e,t)=>{let a=r.has(e.orgName||e.name);return(0,$.jsxs)(`tr`,{className:`border-b border-border/50 last:border-b-0 hover:bg-muted/30`,children:[(0,$.jsx)(`td`,{className:`px-3 py-1 text-muted-foreground tabular-nums`,children:t+1}),(0,$.jsx)(`td`,{className:`px-3 py-1 font-mono`,children:(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[e.name,a&&(0,$.jsxs)(`span`,{title:n(`result.info.primaryKey`),className:`flex items-center gap-0.5 rounded border border-catppuccin-yellow/50 px-1 text-[9px] font-semibold text-catppuccin-yellow`,children:[(0,$.jsx)(mYe,{className:`size-2.5`}),`PK`]})]})}),i&&(0,$.jsx)(`td`,{className:`px-3 py-1 font-mono text-muted-foreground`,children:e.orgName&&e.orgName!==e.name?e.orgName:``}),(0,$.jsx)(`td`,{className:`px-3 py-1`,children:(0,$.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-px font-mono text-[11px]`,children:e.type||`—`})}),(0,$.jsx)(`td`,{className:`px-3 py-1 font-mono text-muted-foreground`,children:e.orgTable?`${e.db?e.db+`.`:``}${e.orgTable}`:``})]},`${e.name}-${t}`)})})]})}):(0,$.jsx)(`div`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:n(`result.info.noFields`)})]},t)})]})})}function $2e(e){return new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}function S9(e){let t=new Date(e);return`${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`}function e4e(e,t=160){let n=e.replace(/\s+/g,` `).trim();return n.length<=t?n:n.slice(0,t)+`…`}function t4e(e){return e<1e3?`${e} ms`:`${(e/1e3).toFixed(2)} s`}function n4e(e,t){let n=[],r=Date.now(),i=S9(r),a=S9(r-864e5);for(let r of e){let e=S9(r.timestamp),o=n[n.length-1];(!o||o.key!==e)&&(o={key:e,label:e===i?t(`result.history.today`):e===a?t(`result.history.yesterday`):new Date(r.timestamp).toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`2-digit`}),entries:[]},n.push(o)),o.entries.push(r)}return n}var r4e={SELECT:`bg-blue-500/10 text-blue-600 dark:text-blue-400`,INSERT:`bg-green-500/10 text-green-600 dark:text-green-400`,UPDATE:`bg-orange-500/10 text-orange-600 dark:text-orange-400`,DELETE:`bg-red-500/10 text-red-600 dark:text-red-400`};function i4e({connectionId:e}){let{t}=S(),n=We(e=>e.history),r=We(t=>t.activeTabId[e]??null),i=We(e=>e.clearHistory),a=We(e=>e.addHistory),o=c(e=>e.setFooterMessage),s=c(e=>e.requestDestructiveConfirm),[l,u]=(0,D.useState)(null),[d,f]=(0,D.useState)(``),[p,m]=(0,D.useState)(`all`),[h,g]=(0,D.useState)(!1),_=(0,D.useCallback)((e,n)=>{navigator.clipboard.writeText(n).then(()=>{u(e),o(t(`result.history.copied`)),setTimeout(()=>u(null),1500)})},[o,t]),v=(0,D.useCallback)((n,i)=>{let a=r?Vt(e,r):void 0;if(!a){_(n,i);return}let s=a.getModel(),c=a.getSelection();if(!s||!c){_(n,i);return}let l=s.getLineContent(c.startLineNumber),u=c.startColumn>1&&l.trim()!==``,d=i.trim(),f=(u?`
|
|
922
922
|
`:``)+d+(d.endsWith(`;`)?``:`;`)+`
|
|
923
|
-
`;a.executeEdits(`history`,[{range:c,text:f,forceMoveMarkers:!0}]),a.focus(),o(t(`result.history.inserted`))},[r,e,_,o,t]),y=(0,D.useMemo)(()=>n.filter(t=>!e||!t.connectionId||t.connectionId===e),[n,e]),x=(0,D.useCallback)(async()=>{if(!await s({title:t(`result.history.clearTitle`),description:t(`result.history.clearDescription`,{count:y.length}),confirmLabel:t(`result.history.clearConfirm`)}))return;let r=n.filter(t=>t.connectionId&&t.connectionId!==e);i();for(let e of[...r].reverse())a(e)},[s,t,y.length,n,e,i,a]),C=(0,D.useMemo)(()=>{let e=d.trim().toLowerCase();return y.filter(t=>!(p===`success`&&!t.success||p===`failed`&&t.success||h&&t.tabId!==r||e&&!t.query.toLowerCase().includes(e)&&!(t.database??``).toLowerCase().includes(e)&&!(t.error??``).toLowerCase().includes(e)))},[y,d,p,h,r]),w=(0,D.useMemo)(()=>n4e(C,t),[C,t]);if(y.length===0)return(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:t(`result.history.empty`)});let T=(e,t)=>(0,$.jsx)(`button`,{type:`button`,className:`rounded px-2 py-0.5 text-xs ${p===e?`bg-primary text-primary-foreground`:`text-muted-foreground hover:text-foreground`}`,onClick:()=>m(e),children:t});return(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center gap-2 border-b bg-muted/30 px-3 py-1.5`,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(U8,{className:`pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground`}),(0,$.jsx)(`input`,{className:`h-7 w-52 rounded border bg-background pl-7 pr-6 text-xs placeholder:text-muted-foreground`,placeholder:t(`result.history.searchPlaceholder`),value:d,onChange:e=>f(e.target.value)}),d&&(0,$.jsx)(`button`,{type:`button`,className:`absolute right-1.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,onClick:()=>f(``),children:(0,$.jsx)(b,{className:`size-3`})})]}),(0,$.jsxs)(`div`,{className:`flex items-center rounded border bg-background p-0.5`,children:[T(`all`,t(`result.history.all`)),T(`success`,t(`result.history.success`)),T(`failed`,t(`result.history.failed`))]}),(0,$.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5 text-xs`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`accent-primary`,checked:h,onChange:e=>g(e.target.checked)}),t(`result.history.thisTab`)]}),(0,$.jsx)(`div`,{className:`flex-1`}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:t(`result.history.count`,{count:C.length})}),(0,$.jsxs)(`button`,{type:`button`,className:`flex h-7 items-center gap-1 rounded border bg-background px-2 text-xs text-muted-foreground hover:text-destructive`,onClick:()=>void x(),children:[(0,$.jsx)(G8,{className:`size-3`}),t(`result.history.clear`)]})]}),(0,$.jsx)(f5,{className:`min-h-0 flex-1`,children:C.length===0?(0,$.jsx)(`div`,{className:`p-6 text-center text-sm text-muted-foreground`,children:t(`result.history.noMatch`)}):w.map(e=>(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`sticky top-0 z-10 border-b bg-background/95 px-3 py-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground backdrop-blur`,children:e.label}),(0,$.jsx)(`div`,{className:`divide-y divide-border/60 text-sm`,children:e.entries.map(e=>{let n=e.kind?.toUpperCase();return(0,$.jsxs)(`div`,{className:`group/row flex items-start gap-2 px-3 py-2 hover:bg-muted/50`,children:[(0,$.jsx)(`div`,{className:`mt-0.5 flex-shrink-0`,children:e.success?(0,$.jsx)(k8,{className:`size-4 text-green-500`}):(0,$.jsx)(A8,{className:`size-4 text-destructive`})}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 cursor-pointer`,onClick:()=>_(e.id,e.query),title:e.query,children:[(0,$.jsx)(`p`,{className:`break-words font-mono text-xs text-foreground`,children:e4e(e.query)}),(0,$.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-[11px] text-muted-foreground`,children:[(0,$.jsx)(`span`,{className:`tabular-nums`,children:$2e(e.timestamp)}),n&&(0,$.jsx)(`span`,{className:`rounded px-1 text-[9px] font-semibold ${r4e[n]??`bg-muted`}`,children:n}),e.database&&(0,$.jsx)(`span`,{className:`font-mono`,children:e.database}),e.rowCount!=null&&(0,$.jsxs)(`span`,{className:`flex items-center gap-0.5`,children:[(0,$.jsx)(H8,{className:`size-3`}),t(`result.history.rows`,{count:e.rowCount})]}),e.affectedRows!=null&&e.affectedRows>0&&(0,$.jsxs)(`span`,{className:`flex items-center gap-0.5`,children:[(0,$.jsx)(z8,{className:`size-3`}),t(`result.history.affected`,{count:e.affectedRows})]}),(0,$.jsxs)(`span`,{className:`flex items-center gap-0.5 tabular-nums`,children:[(0,$.jsx)(j8,{className:`size-3`}),t4e(e.executionTime)]})]}),e.error&&(0,$.jsx)(`p`,{className:`mt-0.5 break-words text-xs text-destructive`,children:e.error})]}),(0,$.jsxs)(`div`,{className:`mt-0.5 flex flex-shrink-0 items-center gap-0.5 opacity-0 group-hover/row:opacity-100`,children:[(0,$.jsx)(`button`,{type:`button`,className:`rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground`,title:t(`result.history.insert`),onClick:()=>v(e.id,e.query),children:(0,$.jsx)(lYe,{className:`size-3.5`})}),(0,$.jsx)(`button`,{type:`button`,className:`rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground`,title:t(`result.history.copy`),onClick:()=>_(e.id,e.query),children:l===e.id?(0,$.jsx)(E8,{className:`size-3.5 text-green-500`}):(0,$.jsx)(N8,{className:`size-3.5`})})]})]},e.id)})})]},e.key))})]})}var a4e=[];function o4e({connectionId:e,tabId:t}){let{t:n}=S(),r=We(t=>t.tabs[e]??Ge).find(e=>e.id===t),i=r?.results??a4e,[a,o]=(0,D.useState)({results:i,closed:new Set,activeTab:null}),s=a.results===i?a:{results:i,closed:new Set,activeTab:null},c=s.closed,l=(0,D.useMemo)(()=>i.map((e,t)=>({result:e,index:t})).filter(e=>e.result.fields.length>0),[i]),u=(0,D.useMemo)(()=>l.filter(e=>!c.has(e.index)),[l,c]),d=s.activeTab??(l.length>0?`result-${l[0].index}`:`message`),f=(0,D.useCallback)(e=>{o(t=>({...t.results===i?t:{results:i,closed:new Set},activeTab:e}))},[i]),p=(0,D.useRef)(!1);(0,D.useEffect)(()=>{if(p.current)return;let n=r?.sourceTable;!n||i.length>0||r?.isExecuting||(p.current=!0,We.getState().setExecuting(e,t,!0),(async()=>{try{let r=await v5(e,{database:n.database,table:n.table,tabId:t,page:0});r.sourceTable=n,We.getState().setResults(e,t,[r])}catch(n){let r=n instanceof Error?n.message:String(n);We.getState().setError(e,t,r)}})())},[r?.sourceTable,r?.isExecuting,i,e,t]);let m=(0,D.useCallback)((e,t)=>{e.stopPropagation(),o(e=>{let n=e.results===i?e:{results:i,closed:new Set,activeTab:null},r=new Set(n.closed);r.add(t);let a=d===`result-${t}`;return{results:i,closed:r,activeTab:a?`message`:n.activeTab}})},[i,d]);return(0,$.jsxs)(T5,{value:d,onValueChange:f,className:`flex h-full flex-col`,children:[(0,$.jsxs)(E5,{className:`h-8 w-full justify-start rounded-none border-b bg-muted/30`,children:[(0,$.jsx)(D5,{value:`message`,className:`h-7 !rounded-sm !border-0 px-3 text-xs !text-muted-foreground hover:!text-foreground data-[state=active]:!bg-primary data-[state=active]:!text-primary-foreground data-[state=active]:font-semibold data-[state=active]:!shadow-none after:!hidden`,children:n(`result.tabs.message`)}),(0,$.jsx)(D5,{value:`info`,className:`h-7 !rounded-sm !border-0 px-3 text-xs !text-muted-foreground hover:!text-foreground data-[state=active]:!bg-primary data-[state=active]:!text-primary-foreground data-[state=active]:font-semibold data-[state=active]:!shadow-none after:!hidden`,children:n(`result.tabs.info`)}),(0,$.jsx)(D5,{value:`history`,className:`h-7 !rounded-sm !border-0 px-3 text-xs !text-muted-foreground hover:!text-foreground data-[state=active]:!bg-primary data-[state=active]:!text-primary-foreground data-[state=active]:font-semibold data-[state=active]:!shadow-none after:!hidden`,children:n(`result.tabs.history`)}),u.map((e,t)=>(0,$.jsxs)(D5,{value:`result-${e.index}`,className:`h-7 gap-1 !rounded-sm !border-0 px-3 text-xs !text-muted-foreground hover:!text-foreground data-[state=active]:!bg-primary data-[state=active]:!text-primary-foreground data-[state=active]:font-semibold data-[state=active]:!shadow-none after:!hidden`,children:[(0,$.jsx)(`span`,{children:l.length===1?n(`result.tabs.result`):n(`result.tabs.resultN`,{n:t+1})}),(0,$.jsx)(`button`,{type:`button`,className:`ml-0.5 rounded p-0.5 opacity-60 hover:bg-muted hover:opacity-100`,onClick:t=>m(t,e.index),children:(0,$.jsx)(b,{className:`size-3`})})]},`result-${e.index}`))]}),(0,$.jsx)(O5,{value:`message`,className:`mt-0 flex-1 overflow-hidden`,children:(0,$.jsx)(AZe,{connectionId:e,tabId:t})}),(0,$.jsx)(O5,{value:`info`,className:`mt-0 flex-1 overflow-hidden`,children:(0,$.jsx)(Q2e,{connectionId:e,tabId:t})}),(0,$.jsx)(O5,{value:`history`,className:`mt-0 flex-1 overflow-hidden`,children:(0,$.jsx)(i4e,{connectionId:e})}),u.map(n=>(0,$.jsx)(O5,{value:`result-${n.index}`,className:`mt-0 flex-1 overflow-hidden`,children:(0,$.jsx)(X2e,{connectionId:e,tabId:t,resultIndex:n.index})},`result-${n.index}`))]})}function s4e({connectionId:e,tabId:t}){let[n,r]=(0,D.useState)(300),[i,a]=(0,D.useState)(!1),o=(0,D.useRef)(null),s=(0,D.useCallback)(e=>{e.preventDefault(),a(!0)},[]);return(0,D.useEffect)(()=>{if(!i)return;let e=e=>{if(!o.current)return;let t=o.current.getBoundingClientRect().bottom-e.clientY;r(Math.min(600,Math.max(100,t)))},t=()=>{a(!1)};return document.addEventListener(`mousemove`,e),document.addEventListener(`mouseup`,t),()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,t)}},[i]),(0,$.jsxs)(`div`,{ref:o,className:`flex h-full flex-col`,style:{userSelect:i?`none`:void 0},children:[(0,$.jsx)(`div`,{className:`min-h-[100px] flex-1`,children:(0,$.jsx)(EZe,{connectionId:e,tabId:t})}),(0,$.jsx)(`div`,{onMouseDown:s,className:`h-1 flex-shrink-0 cursor-row-resize transition-colors ${i?`bg-catppuccin-blue/40`:`bg-catppuccin-surface1 hover:bg-catppuccin-blue/30 active:bg-catppuccin-blue/40`}`}),(0,$.jsx)(`div`,{className:`flex-shrink-0 overflow-hidden`,style:{height:n},children:(0,$.jsx)(o4e,{connectionId:e,tabId:t})})]})}async function c4e(e,t){let n=qt(e),r=mt(e),{introspect:i}=n,a=await i.listTables(r,t),o=a.map(e=>e.name),[s,c,l]=await Promise.all([i.listAllColumns(r,t),i.listAllIndexes(r,t).catch(()=>new Map),i.listForeignKeys(r,t).catch(()=>[])]),u=new Set;for(let e of l)u.add(`${e.table}.${e.column}`);let d=new Set;for(let[e,t]of c)for(let n of t)n.type===`UNIQUE`&&n.columns.length===1&&d.add(`${e}.${n.columns[0]}`);let f=a.map(e=>({name:e.name,kind:`model`,x:0,y:0,comment:e.comment,columns:(s.get(e.name)??[]).map(t=>{let n=`${e.name}.${t.name}`,r=[];return t.key===`PRI`&&r.push(`PK`),u.has(n)&&r.push(`FK`),d.has(n)&&t.key!==`PRI`&&r.push(`UK`),{type:t.type+(t.extra.includes(`auto_increment`)?` AI`:``),name:t.name,badge:r.length>0?r[0]:null,badges:r,comment:t.comment||(t.nullable?`?`:``)}})})),p=new Set(o),m=new Set,h=[];for(let e of l){let{table:t,column:n,refTable:r}=e;if(!t||!r||!p.has(t)||!p.has(r)||t===r)continue;let i=`${t}->${r}:${n}`,a=`${r}->${t}:${n}`;m.has(i)||m.has(a)||(m.add(i),h.push({from:t,to:r,type:`1:N`,label:n}))}return{models:f,relations:h}}var C9=[70,170,180];function w9(e){return 52+e.columns.length*22+4}function T9(e){return e.reduce((e,t)=>e+t,0)+20}var l4e=2.399963229728653,E9=50,u4e=50,D9=56,O9=T9(C9),d4e=120;function f4e(e,t){let n=e.length,r=e.map(e=>({w:O9,h:w9(e)})),i=r.reduce((e,t)=>e+t.h,0)/n,a=Math.max(O9,i)*.32+24,o=e.map((e,t)=>{let n=a*.55*Math.sqrt(t+.5);return{x:Math.cos(t*l4e)*n,y:Math.sin(t*l4e)*n}}),s=a*1.8,c=s/321,l=o.map(()=>({x:0,y:0}));for(let e=0;e<320;e++){for(let e=0;e<n;e++)l[e].x=0,l[e].y=0;for(let e=0;e<n;e++)for(let t=e+1;t<n;t++){let n=o[e].x-o[t].x,r=o[e].y-o[t].y,i=Math.hypot(n,r)||.01,s=.28*a*a/i,c=n/i,u=r/i;l[e].x+=c*s,l[e].y+=u*s,l[t].x-=c*s,l[t].y-=u*s}for(let[e,n]of t){let t=o[e].x-o[n].x,r=o[e].y-o[n].y,i=Math.hypot(t,r)||.01,s=i*i/a,c=t/i,u=r/i;l[e].x-=c*s,l[e].y-=u*s,l[n].x+=c*s,l[n].y+=u*s}for(let e=0;e<n;e++)l[e].x-=o[e].x*.1,l[e].y-=o[e].y*.1;for(let e=0;e<n;e++){let t=Math.hypot(l[e].x,l[e].y)||.01,n=Math.min(t,s);o[e].x+=l[e].x/t*n,o[e].y+=l[e].y/t*n}s=Math.max(s-c,a*.05)}let u=r.map(e=>({hw:e.w/2+D9/2,hh:e.h/2+D9/2}));for(let e=0;e<80;e++){let e=!1;for(let t=0;t<n;t++)for(let r=t+1;r<n;r++){let n=o[r].x-o[t].x,i=o[r].y-o[t].y,a=u[t].hw+u[r].hw-Math.abs(n),s=u[t].hh+u[r].hh-Math.abs(i);if(a>0&&s>0){if(e=!0,a<s){let e=(n<0?-1:1)*a/2;o[t].x-=e,o[r].x+=e}else{let e=(i<0?-1:1)*s/2;o[t].y-=e,o[r].y+=e}}}if(!e)break}let d=1/0,f=1/0;for(let e=0;e<n;e++)d=Math.min(d,o[e].x-r[e].w/2),f=Math.min(f,o[e].y-r[e].h/2);return e.map((e,t)=>({x:o[t].x-r[t].w/2-d,y:o[t].y-r[t].h/2-f}))}function p4e(e){let t=Math.max(1,Math.round(Math.sqrt(e.length))),n=Array(t).fill(0);return e.map(e=>{let r=0;for(let e=1;e<t;e++)n[e]<n[r]&&(r=e);let i={x:r*(O9+D9),y:n[r]};return n[r]+=w9(e)+D9,i})}function k9(e,t,n){let r=[...e,...t];if(r.length===0)return;let i=new Map(r.map((e,t)=>[e.name,t])),a=Array(r.length).fill(0),o=[];n.forEach(e=>{let t=i.get(e.from),n=i.get(e.to);t!==void 0&&n!==void 0&&t!==n&&(o.push([t,n]),a[t]++,a[n]++)});let s=r.filter((e,t)=>a[t]>0),c=r.filter((e,t)=>a[t]===0),l=E9;if(s.length>0){let e=new Map(s.map((e,t)=>[e.name,t])),t=f4e(s,o.map(([t,n])=>[e.get(r[t].name),e.get(r[n].name)]).filter(([e,t])=>e!==void 0&&t!==void 0));s.forEach((e,n)=>{e.x=Math.round(E9+t[n].x),e.y=Math.round(u4e+t[n].y),l=Math.max(l,e.x+O9)})}if(c.length>0){let e=s.length>0?l+d4e:E9,t=p4e(c);c.forEach((n,r)=>{n.x=Math.round(e+t[r].x),n.y=Math.round(u4e+t[r].y)})}}function m4e(e,t){return`${e.targetConnectionId?`${t.connectionName(e.targetConnectionId)} · ${e.targetDatabase}`:e.targetDatabase}.${e.targetTable}`}function h4e(e,t,n,r){let i=new Map(e.map(e=>[e.name,e])),a=new Set(t.map(e=>`${e.from}->${e.to}:${e.label}`)),o=[...e],s=[...t],c=new Map;for(let e of n.filter(e=>e.database===r.database)){let t=i.get(e.table);if(!t)continue;let n=!e.targetConnectionId&&e.targetDatabase===r.database,l;if(n&&i.has(e.targetTable))l=e.targetTable;else{l=m4e(e,r);let n=c.get(l);n||(n={name:l,kind:`model`,external:e.targetConnectionId?r.connectionName(e.targetConnectionId):e.targetDatabase,x:t.x+T9(C9)+120,y:t.y,comment:``,columns:[]},c.set(l,n),o.push(n)),n.columns.some(t=>t.name===e.targetColumn)||n.columns.push({type:``,name:e.targetColumn,badge:`PK`,badges:[`PK`],comment:``})}if(e.table===l)continue;let u=`${e.table}->${l}:${e.column}`;a.has(u)||(a.add(u),s.push({from:e.table,to:l,type:`1:N`,label:e.column,virtual:!0}))}return{models:o,relations:s}}function g4e({zoom:e,database:t,tableCount:n,relationCount:r,fieldCount:i,onZoomIn:a,onZoomOut:o,onResetView:s,onCenter:c,onFitAll:l,onSpreadAll:u,onResetLayout:d,onRefresh:f}){let{t:p}=S();return(0,$.jsxs)(`div`,{className:`relative z-10 flex flex-wrap items-center gap-1.5 border-b px-4 py-1.5`,style:{background:`var(--t-mantle)`,borderColor:`var(--t-surface1)`},children:[t&&(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold`,style:{color:`var(--t-yellow)`},children:[(0,$.jsx)(P8,{className:`size-3.5`}),t]}),(0,$.jsxs)(te,{variant:`outline`,size:`sm`,className:`h-7 gap-1 px-2.5 text-xs`,style:{borderColor:`var(--t-green)`,color:`var(--t-green)`},onClick:f,children:[(0,$.jsx)(V8,{className:`size-3.5`}),p(`erd.toolbar.refresh`)]}),(0,$.jsx)(`div`,{className:`mx-1 h-5 w-px`,style:{background:`var(--t-surface1)`}}),(0,$.jsxs)(te,{variant:`outline`,size:`sm`,className:`h-7 px-2 text-xs`,onClick:a,children:[(0,$.jsx)(BYe,{className:`mr-1 size-3.5`}),` `,p(`erd.toolbar.zoomIn`)]}),(0,$.jsxs)(te,{variant:`outline`,size:`sm`,className:`h-7 px-2 text-xs`,onClick:o,children:[(0,$.jsx)(VYe,{className:`mr-1 size-3.5`}),` `,p(`erd.toolbar.zoomOut`)]}),(0,$.jsxs)(te,{variant:`outline`,size:`sm`,className:`h-7 px-2 text-xs`,onClick:s,children:[(0,$.jsx)(TYe,{className:`mr-1 size-3.5`}),` `,p(`erd.toolbar.resetView`)]}),(0,$.jsxs)(te,{variant:`outline`,size:`sm`,className:`h-7 px-2 text-xs`,onClick:c,children:[(0,$.jsx)(cYe,{className:`mr-1 size-3.5`}),` `,p(`erd.toolbar.center`)]}),(0,$.jsxs)(te,{variant:`outline`,size:`sm`,className:`h-7 px-2 text-xs`,onClick:l,children:[(0,$.jsx)(yYe,{className:`mr-1 size-3.5`}),` `,p(`erd.toolbar.fitAll`)]}),(0,$.jsxs)(`span`,{className:`ml-1 text-xs`,style:{color:`var(--t-overlay0)`},children:[Math.round(e*100),`%`]}),(0,$.jsx)(`div`,{className:`mx-1 h-5 w-px`,style:{background:`var(--t-surface1)`}}),(0,$.jsxs)(te,{variant:`outline`,size:`sm`,className:`h-7 px-2 text-xs`,style:{background:`var(--t-blue)`,color:`var(--t-crust)`,borderColor:`var(--t-blue)`},onClick:u,children:[(0,$.jsx)(_Ye,{className:`mr-1 size-3.5`}),` `,p(`erd.toolbar.spreadAll`)]}),(0,$.jsxs)(te,{variant:`outline`,size:`sm`,className:`h-7 px-2 text-xs`,style:{background:`var(--t-red)`,color:`var(--t-crust)`,borderColor:`var(--t-red)`},onClick:d,children:[(0,$.jsx)(G8,{className:`mr-1 size-3.5`}),` `,p(`erd.toolbar.resetLayout`)]}),(0,$.jsxs)(`div`,{className:`ml-auto flex items-center gap-4 text-[11px]`,style:{color:`var(--t-overlay0)`},children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`span`,{className:`inline-block h-0.5 w-[30px]`,style:{background:`var(--t-red)`}}),`1:1`]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`span`,{className:`inline-block h-0.5 w-[30px]`,style:{background:`var(--t-blue)`}}),p(`erd.toolbar.legendOneToMany`)]}),n>0&&(0,$.jsxs)(`div`,{className:`flex items-center gap-3 text-[11px]`,style:{color:`var(--t-overlay0)`},children:[(0,$.jsxs)(`span`,{children:[p(`erd.toolbar.tables`),` `,(0,$.jsx)(`span`,{className:`font-semibold`,style:{color:`var(--t-foreground)`},children:n})]}),(0,$.jsxs)(`span`,{children:[p(`erd.toolbar.relations`),` `,(0,$.jsx)(`span`,{className:`font-semibold`,style:{color:`var(--t-foreground)`},children:r})]}),(0,$.jsxs)(`span`,{children:[p(`erd.toolbar.columns`),` `,(0,$.jsx)(`span`,{className:`font-semibold`,style:{color:`var(--t-foreground)`},children:i})]})]})]})]})}function _4e({name:e,kind:t,external:n,onDragStart:r}){let{t:i}=S(),a=i(n?`erd.entity.linkBadge`:t===`enum`?`erd.entity.enumBadge`:`erd.entity.modelBadge`),o=n?`var(--t-yellow)`:t===`enum`?`var(--t-peach)`:`var(--t-mauve)`;return(0,$.jsxs)(`div`,{className:`flex items-center justify-between rounded-t-md border-b-2 px-3 py-2 text-[13px] font-bold`,style:{background:`var(--t-surface1)`,borderColor:`var(--t-surface2, var(--t-overlay0))`,color:`var(--t-mauve)`,cursor:`grab`},onMouseDown:r,children:[(0,$.jsx)(`span`,{title:n?i(`erd.entity.externalTitle`,{location:n}):void 0,children:e}),(0,$.jsx)(`span`,{className:`rounded px-1.5 py-px text-[9px] font-semibold`,style:{background:o,color:`var(--t-base)`},children:a})]})}function v4e(e){switch(e){case`PK`:return`var(--t-red)`;case`FK`:return`var(--t-peach)`;case`UK`:return`var(--t-green)`;default:return`var(--t-overlay0)`}}function y4e({entity:e,colWidths:t,onColResizeStart:n}){let{t:r}=S(),i=e.kind===`enum`;return(0,$.jsx)(`div`,{className:`overflow-hidden p-0`,children:(0,$.jsxs)(`table`,{className:`w-full border-collapse text-[11px]`,style:{tableLayout:`fixed`},children:[(0,$.jsxs)(`colgroup`,{children:[(0,$.jsx)(`col`,{style:{width:t[0]+`px`}}),(0,$.jsx)(`col`,{style:{width:t[1]+`px`}}),(0,$.jsx)(`col`,{style:{width:t[2]+`px`}})]}),(0,$.jsx)(`thead`,{children:(0,$.jsx)(`tr`,{children:i?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`th`,{className:`relative px-2.5 py-1 text-left text-[10px] font-semibold uppercase`,style:{background:`var(--t-surface1)`,color:`var(--t-subtext0)`},children:[r(`erd.entity.columns.value`),n&&(0,$.jsx)(`div`,{className:`absolute right-[-3px] top-0 z-10 h-full w-1.5 cursor-col-resize hover:opacity-40`,style:{background:`transparent`},onMouseDown:t=>n(t,e.name,0)})]}),(0,$.jsxs)(`th`,{className:`relative px-2.5 py-1 text-left text-[10px] font-semibold uppercase`,style:{background:`var(--t-surface1)`,color:`var(--t-subtext0)`},children:[r(`erd.entity.columns.comment`),n&&(0,$.jsx)(`div`,{className:`absolute right-[-3px] top-0 z-10 h-full w-1.5 cursor-col-resize hover:opacity-40`,style:{background:`transparent`},onMouseDown:t=>n(t,e.name,1)})]}),(0,$.jsx)(`th`,{className:`px-2.5 py-1 text-left text-[10px] font-semibold uppercase`,style:{background:`var(--t-surface1)`,color:`var(--t-subtext0)`}})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`th`,{className:`relative px-2.5 py-1 text-left text-[10px] font-semibold uppercase`,style:{background:`var(--t-surface1)`,color:`var(--t-subtext0)`},children:[r(`erd.entity.columns.type`),n&&(0,$.jsx)(`div`,{className:`absolute right-[-3px] top-0 z-10 h-full w-1.5 cursor-col-resize hover:opacity-40`,style:{background:`transparent`},onMouseDown:t=>n(t,e.name,0)})]}),(0,$.jsxs)(`th`,{className:`relative px-2.5 py-1 text-left text-[10px] font-semibold uppercase`,style:{background:`var(--t-surface1)`,color:`var(--t-subtext0)`},children:[r(`erd.entity.columns.column`),n&&(0,$.jsx)(`div`,{className:`absolute right-[-3px] top-0 z-10 h-full w-1.5 cursor-col-resize hover:opacity-40`,style:{background:`transparent`},onMouseDown:t=>n(t,e.name,1)})]}),(0,$.jsx)(`th`,{className:`px-2.5 py-1 text-left text-[10px] font-semibold uppercase`,style:{background:`var(--t-surface1)`,color:`var(--t-subtext0)`},children:r(`erd.entity.columns.comment`)})]})})}),(0,$.jsx)(`tbody`,{children:e.columns.map((t,n)=>(0,$.jsx)(`tr`,{style:{borderBottom:n<e.columns.length-1?`1px solid var(--t-surface1)`:`none`},children:i?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`td`,{className:`overflow-hidden text-ellipsis whitespace-nowrap px-2.5 py-[3px]`,style:{color:`var(--t-yellow)`,lineHeight:1.5},children:t.name}),(0,$.jsx)(`td`,{className:`overflow-hidden text-ellipsis whitespace-nowrap px-2.5 py-[3px] text-[10px]`,style:{color:`var(--t-overlay0)`,lineHeight:1.5},colSpan:2,children:t.comment})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`td`,{className:`overflow-hidden text-ellipsis whitespace-nowrap px-2.5 py-[3px]`,style:{color:`var(--t-blue)`,lineHeight:1.5},children:t.type.replace(`?`,``)}),(0,$.jsxs)(`td`,{className:`overflow-hidden text-ellipsis whitespace-nowrap px-2.5 py-[3px]`,style:{color:`var(--t-text)`,lineHeight:1.5},children:[t.name,t.badges.map(e=>(0,$.jsx)(`span`,{className:`ml-1 inline-block rounded px-1 text-[9px] font-semibold`,style:{background:v4e(e),color:`var(--t-base)`},children:e},e)),t.type.endsWith(`?`)&&(0,$.jsx)(`span`,{className:`ml-1 inline-block rounded px-1 text-[9px] font-semibold`,style:{background:`var(--t-overlay0)`,color:`var(--t-subtext0)`},children:`?`})]}),(0,$.jsx)(`td`,{className:`overflow-hidden text-ellipsis whitespace-nowrap px-2.5 py-[3px] text-[10px]`,style:{color:`var(--t-overlay0)`,lineHeight:1.5},children:t.comment})]})},n))})]})})}function b4e({entity:e,colWidths:t,isSelected:n,onMouseDown:r,onColResizeStart:i}){let a=(0,D.useCallback)(t=>{r(t,e.name)},[r,e.name]),o=t.reduce((e,t)=>e+t,0)+20,s=n?`var(--t-yellow)`:e.kind===`enum`?`var(--t-peach)`:`var(--t-overlay0)`;return(0,$.jsxs)(`div`,{className:`absolute select-none rounded-lg`,style:{left:e.x,top:e.y,width:Math.max(o,200),minWidth:200,background:`var(--t-base)`,border:`2px solid ${s}`,boxShadow:n?`0 8px 24px rgba(0,0,0,0.6)`:`0 4px 12px rgba(0,0,0,0.4)`,zIndex:n?1e3:1,transition:`box-shadow 0.15s`},onMouseEnter:t=>{if(!n){let n=t.currentTarget;n.style.borderColor=e.kind===`enum`?`var(--t-yellow)`:`var(--t-blue)`}},onMouseLeave:t=>{if(!n){let n=t.currentTarget;n.style.borderColor=e.kind===`enum`?`var(--t-peach)`:`var(--t-overlay0)`}},children:[(0,$.jsx)(_4e,{name:e.name,kind:e.kind,external:e.external,onDragStart:a}),(0,$.jsx)(y4e,{entity:e,colWidths:t,onColResizeStart:i})]})}function x4e(e,t){return e[t]||[...C9]}function S4e(e,t){let n=T9(x4e(t,e.name)),r=w9(e);return{x:e.x,y:e.y,w:n,h:r,cx:e.x+n/2,cy:e.y+r/2}}function C4e({entities:e,relations:t,entityWidths:n}){let r=(()=>{if(e.length===0)return null;let r=new Map;e.forEach(e=>r.set(e.name,e));let i=1/0,a=1/0,o=-1/0,s=-1/0;e.forEach(e=>{let t=x4e(n,e.name);i=Math.min(i,e.x-200),a=Math.min(a,e.y-200),o=Math.max(o,e.x+T9(t)+200),s=Math.max(s,e.y+w9(e)+200)});let c=o-i,l=s-a,u={};function d(e,t){let n=`${e}_${t}`;return u[n]||(u[n]=0),(u[n]++-1)*16}let f=[];return t.forEach(e=>{let t=r.get(e.from),i=r.get(e.to);if(!t||!i)return;let a=S4e(t,n),o=S4e(i,n),s,c,l,u,p=o.cx-a.cx,m=o.cy-a.cy;if(Math.abs(p)>Math.abs(m)){if(p>0){let t=d(e.from,`right`),n=d(e.to,`left`);s=a.x+a.w+16,c=a.y+40+t,l=o.x-16,u=o.y+40+n}else{let t=d(e.from,`left`),n=d(e.to,`right`);s=a.x-16,c=a.y+40+t,l=o.x+o.w+16,u=o.y+40+n}}else if(m>0){let t=d(e.from,`bottom`),n=d(e.to,`top`);s=a.x+60+t,c=a.y+a.h+16,l=o.x+60+n,u=o.y-16}else{let t=d(e.from,`top`),n=d(e.to,`bottom`);s=a.x+60+t,c=a.y-16,l=o.x+60+n,u=o.y+o.h+16}let h=e.type===`1:1`?`var(--t-red)`:`var(--t-blue)`,g=e.type===`1:1`?`url(#erd-one)`:`url(#erd-crowfoot)`,_=(s+l)/2,v=(c+u)/2,y=Math.abs(p)>Math.abs(m)?`M${s},${c} C${_},${c} ${_},${u} ${l},${u}`:`M${s},${c} C${s},${v} ${l},${v} ${l},${u}`;f.push({d:y,color:h,markerEnd:g,label:`${e.virtual?`⇢ `:``}${e.type} ${e.label}`,midX:_,midY:v,virtual:!!e.virtual})}),{minX:i,minY:a,svgW:c,svgH:l,paths:f}})();if(!r)return null;let{minX:i,minY:a,svgW:o,svgH:s,paths:c}=r;return(0,$.jsxs)(`svg`,{className:`pointer-events-none absolute left-0 top-0`,style:{left:i,top:a},width:o,height:s,viewBox:`${i} ${a} ${o} ${s}`,children:[(0,$.jsxs)(`defs`,{children:[(0,$.jsxs)(`marker`,{id:`erd-crowfoot`,viewBox:`0 0 12 12`,refX:`12`,refY:`6`,markerWidth:`10`,markerHeight:`10`,orient:`auto`,children:[(0,$.jsx)(`line`,{x1:`0`,y1:`0`,x2:`12`,y2:`6`,stroke:`var(--t-blue)`,strokeWidth:`1.5`}),(0,$.jsx)(`line`,{x1:`0`,y1:`12`,x2:`12`,y2:`6`,stroke:`var(--t-blue)`,strokeWidth:`1.5`}),(0,$.jsx)(`line`,{x1:`0`,y1:`6`,x2:`12`,y2:`6`,stroke:`var(--t-blue)`,strokeWidth:`1.5`})]}),(0,$.jsxs)(`marker`,{id:`erd-one`,viewBox:`0 0 12 12`,refX:`12`,refY:`6`,markerWidth:`8`,markerHeight:`8`,orient:`auto`,children:[(0,$.jsx)(`line`,{x1:`8`,y1:`0`,x2:`8`,y2:`12`,stroke:`var(--t-red)`,strokeWidth:`2`}),(0,$.jsx)(`line`,{x1:`12`,y1:`0`,x2:`12`,y2:`12`,stroke:`var(--t-red)`,strokeWidth:`2`})]})]}),c.map((e,t)=>(0,$.jsxs)(`g`,{children:[(0,$.jsx)(`path`,{d:e.d,stroke:e.color,strokeWidth:`1.5`,fill:`none`,markerEnd:e.markerEnd,opacity:`0.7`,strokeDasharray:e.virtual?`6 4`:void 0}),(0,$.jsx)(`text`,{x:e.midX,y:e.midY-6,textAnchor:`middle`,fill:`var(--t-overlay0)`,fontSize:`10`,children:e.label})]},t))]})}function w4e(e){let t=nt.getState(),n=t.selectedNodeId[e],r=t.trees[e];if(!r)return null;let i=null,a=null;function o(e){for(let t of e){let e=t.metadata?.database;e&&a===null&&(t.type===Wt.DATABASE||t.type===Wt.SCHEMA)&&(a=e),t.id===n&&e&&(i=e),t.children.length>0&&o(t.children)}}return o(r),i??a}function T4e({connectionId:e}){let{t}=S(),[n,r]=(0,D.useState)([]),[i,a]=(0,D.useState)([]),[o,s]=(0,D.useState)(1),[c,l]=(0,D.useState)(0),[u,d]=(0,D.useState)(0),[f,p]=(0,D.useState)(null),[m,h]=(0,D.useState)({}),[g,_]=(0,D.useState)(null),[v,y]=(0,D.useState)(!1),[b,x]=(0,D.useState)(null),[,C]=(0,D.useState)(0),w=(0,D.useRef)(null),T=(0,D.useRef)(null),ee=(0,D.useRef)(!1),E=(0,D.useRef)({x:0,y:0}),te=(0,D.useRef)({x:0,y:0}),ne=(0,D.useRef)(1),re=(0,D.useRef)(null),ie=(0,D.useRef)(null),ae=(0,D.useRef)([]),oe=(0,D.useRef)({}),se=(0,D.useRef)(null),ce=(0,D.useRef)(null),le=r5(e=>e.links),ue=(0,D.useCallback)((t,n)=>{let r=(r5.getState().links[e]??[]).filter(e=>e.database===n);return r.length===0?{models:[...t.models],relations:[...t.relations]}:h4e(t.models.map(e=>({...e})),t.relations,r,{connectionId:e,database:n,connectionName:e=>{let t=Ue.getState().activeConnections.find(t=>t.id===e)??Ue.getState().savedConnections.find(t=>t.id===e);return t?t.hostName||t.host||t.file||t.id:e}})},[e]);(0,D.useEffect)(()=>{let e=ce.current,t=se.current;if(!e||!t)return;let n=ue(e,t),i=new Map(ae.current.map(e=>[e.name,{x:e.x,y:e.y}]));for(let e of n.models){let t=i.get(e.name);t&&(e.x=t.x,e.y=t.y)}ae.current=n.models,r(n.models),a(n.relations)},[le]),ae.current=n,oe.current=m,ne.current=o,te.current={x:c,y:u},se.current=g;let de=(0,D.useCallback)(e=>oe.current[e]||[...C9],[]),fe=(0,D.useCallback)(()=>{let e={};ae.current.forEach(t=>{e[t.name]={x:t.x,y:t.y}}),e5.getState().savePositions(se.current,e)},[]),pe=(0,D.useCallback)(()=>{e5.getState().saveColumnWidths(se.current,oe.current)},[]),me=(0,D.useCallback)(e=>{let t=e5.getState().getPositions(se.current);return t?(e.forEach(e=>{t[e.name]&&(e.x=t[e.name].x,e.y=t[e.name].y)}),!0):!1},[]),he=(0,D.useCallback)(()=>e5.getState().getColumnWidths(se.current),[]),ge=(0,D.useCallback)(()=>{let e=ae.current;if(e.length===0)return;let t=w.current;if(!t)return;let n=1/0,r=1/0,i=-1/0,a=-1/0;e.forEach(e=>{let t=de(e.name);n=Math.min(n,e.x),r=Math.min(r,e.y),i=Math.max(i,e.x+T9(t)),a=Math.max(a,e.y+w9(e))});let o=i-n+80,c=a-r+80,u=t.clientWidth,f=t.clientHeight,p=Math.min(u/o,f/c,1),m=(u-o*p)/2-n*p+40,h=(f-c*p)/2-r*p+40;s(p),l(m),d(h)},[de]),_e=(0,D.useCallback)(()=>{let e=ae.current;if(e.length===0)return;let t=w.current;if(!t)return;let n=1/0,r=1/0,i=-1/0,a=-1/0;e.forEach(e=>{let t=de(e.name);n=Math.min(n,e.x),r=Math.min(r,e.y),i=Math.max(i,e.x+T9(t)),a=Math.max(a,e.y+w9(e))});let o=i-n+80,s=a-r+80,c=t.clientWidth,u=t.clientHeight,f=ne.current;l((c-o*f)/2-n*f+40),d((u-s*f)/2-r*f+40)},[de]),ve=(0,D.useCallback)(async n=>{let i=Ue.getState().activeConnections.find(t=>t.id===e)?.serverConnectionId;if(!i){x(t(`erd.viewer.noServerConnection`));return}y(!0),x(null),_(n),se.current=n,e5.getState().setDatabase(e,n);try{let e=await c4e(i,n);ce.current=e;let{models:t,relations:o}=ue(e,n);k9(t,[],o),me(t);let s=he();r([...t]),a(o),h(s),ae.current=t,oe.current=s,setTimeout(()=>ge(),100)}catch(e){x(e instanceof Error?e.message:String(e))}finally{y(!1)}},[e,me,he,ge,t]);(0,D.useEffect)(()=>{let t=e5.getState().database[e]||w4e(e);t&&ve(t)},[e]);let ye=(0,D.useCallback)(()=>{let t=g||w4e(e);t&&ve(t)},[g,e,ve]),be=(0,D.useCallback)((e,t)=>{e.stopPropagation();let n=w.current;if(!n)return;let r=ae.current.find(e=>e.name===t);if(!r)return;let i=n.getBoundingClientRect(),a=(e.clientX-i.left-te.current.x)/ne.current,o=(e.clientY-i.top-te.current.y)/ne.current;re.current={name:t,offsetX:a-r.x,offsetY:o-r.y},p(t)},[]),xe=(0,D.useCallback)((e,t,n)=>{e.stopPropagation(),e.preventDefault();let r=oe.current[t]||[...C9];ie.current={entityName:t,colIndex:n,startX:e.clientX,startWidth:r[n],nextStartWidth:r[n+1]},document.body.style.cursor=`col-resize`},[]),Se=(0,D.useCallback)(e=>{e.target.closest(`[data-entity]`)||e.button===0&&(ee.current=!0,E.current={x:e.clientX-te.current.x,y:e.clientY-te.current.y},p(null))},[]);(0,D.useEffect)(()=>{let e=e=>{if(ie.current){let t=ie.current,n=(e.clientX-t.startX)/ne.current,r=Math.max(30,Math.round(t.startWidth+n)),i=Math.max(30,Math.round(t.nextStartWidth-n));h(e=>{let n=[...e[t.entityName]||[...C9]];return n[t.colIndex]=r,n[t.colIndex+1]=i,{...e,[t.entityName]:n}});return}if(re.current){let t=w.current;if(!t)return;let n=t.getBoundingClientRect(),r=(e.clientX-n.left-te.current.x)/ne.current,i=(e.clientY-n.top-te.current.y)/ne.current,a=Math.round(r-re.current.offsetX),o=Math.round(i-re.current.offsetY),s=ae.current.find(e=>e.name===re.current.name);s&&(s.x=a,s.y=o,C(e=>e+1));return}ee.current&&(l(e.clientX-E.current.x),d(e.clientY-E.current.y))},t=()=>{if(ie.current){document.body.style.cursor=``,pe(),ie.current=null;return}if(re.current){re.current=null,fe();return}ee.current=!1};return window.addEventListener(`mousemove`,e),window.addEventListener(`mouseup`,t),()=>{window.removeEventListener(`mousemove`,e),window.removeEventListener(`mouseup`,t)}},[fe,pe]),(0,D.useEffect)(()=>{let e=w.current;if(!e)return;let t=t=>{t.preventDefault();let n=e.getBoundingClientRect(),r=t.clientX-n.left,i=t.clientY-n.top,a=ne.current,o=t.deltaY>0?.9:1/.9,c=Math.max(.15,Math.min(3,a*o));if(c===a)return;let u=(r-te.current.x)/a,f=(i-te.current.y)/a;l(r-u*c),d(i-f*c),s(c)};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[]);let Ce=(0,D.useCallback)(e=>{let t=w.current;if(!t)return;let n=t.getBoundingClientRect(),r=n.width/2,i=n.height/2,a=ne.current,o=Math.max(.15,Math.min(3,a*e));if(o===a)return;let c=(r-te.current.x)/a,u=(i-te.current.y)/a;l(r-c*o),d(i-u*o),s(o)},[]),we=(0,D.useCallback)(()=>Ce(1.15),[Ce]),Te=(0,D.useCallback)(()=>Ce(1/1.15),[Ce]),Ee=(0,D.useCallback)(()=>{s(1),l(0),d(0)},[]),De=(0,D.useCallback)(()=>{k9(ae.current,[],i),r([...ae.current]),fe(),setTimeout(()=>ge(),50)},[i,fe,ge]),Oe=(0,D.useCallback)(()=>{e5.getState().resetLayout(se.current),k9(ae.current,[],i),r([...ae.current]),h({}),setTimeout(()=>ge(),50)},[i,ge]),ke=n.length>0,Ae=n.reduce((e,t)=>e+t.columns.length,0);return(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsx)(g4e,{zoom:o,database:g,tableCount:n.length,relationCount:i.length,fieldCount:Ae,onZoomIn:we,onZoomOut:Te,onResetView:Ee,onCenter:_e,onFitAll:ge,onSpreadAll:De,onResetLayout:Oe,onRefresh:ye}),(0,$.jsxs)(`div`,{ref:w,className:`relative flex-1 overflow-hidden`,style:{cursor:ee.current?`grabbing`:`grab`,background:`var(--t-background)`},onMouseDown:Se,children:[v&&(0,$.jsx)(`div`,{className:`absolute inset-0 z-20 flex items-center justify-center bg-background/80`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,$.jsx)(R8,{className:`size-5 animate-spin`}),t(`erd.viewer.loading`,{database:g})]})}),b&&!v&&(0,$.jsx)(`div`,{className:`absolute inset-0 z-20 flex items-center justify-center`,children:(0,$.jsxs)(`div`,{className:`text-center text-sm text-destructive`,children:[(0,$.jsx)(`p`,{children:t(`erd.viewer.loadFailed`)}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:b})]})}),!ke&&!v&&!b&&(0,$.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,$.jsxs)(`div`,{className:`text-center text-sm text-muted-foreground`,children:[(0,$.jsx)(`p`,{children:t(`erd.viewer.noDatabase`)}),(0,$.jsx)(`p`,{className:`mt-1 text-xs`,children:t(`erd.viewer.selectDatabaseHint`)})]})}),ke&&(0,$.jsxs)(`div`,{ref:T,className:`absolute left-0 top-0`,style:{transformOrigin:`0 0`,transform:`translate(${c}px, ${u}px) scale(${o})`},children:[(0,$.jsx)(C4e,{entities:n,relations:i,entityWidths:m}),n.map(e=>(0,$.jsx)(b4e,{entity:e,colWidths:m[e.name]||[...C9],isSelected:f===e.name,onMouseDown:be,onColResizeStart:xe},e.name))]})]})]})}function E4e({connectionId:e}){let{t}=S(),n=We(t=>t.tabs[e]??Ge),r=We(t=>t.activeTabId[e]??null),i=e5(t=>t.open[e]??!1),a=We(e=>e.addQueryTab),o=We(e=>e.removeQueryTab),s=We(e=>e.removeQueryTabs),c=We(e=>e.setActiveQueryTab),l=r&&(n.some(e=>e.id===r)||r===`erd`&&i)?r:n.length>0?n[n.length-1].id:i?`erd`:null;(0,D.useEffect)(()=>{l&&l!==r&&c(e,l)},[l,r,e,c]);let u=(0,D.useRef)(null);yZe(u,l);let{loadChildren:d}=Et(),f=n.find(e=>e.id===l),p=f?.sourceTable?{database:f.sourceTable.database,type:`TABLE`,name:f.sourceTable.table}:f?.sourceObject??null,m=p?`${p.database}/${p.type}/${p.name}`:null;(0,D.useEffect)(()=>{p&&jt(e,Ot(e,p.database,p.type,p.name),d)},[e,m]);let h=We(e=>e.reorderQueryTab),g=(0,D.useMemo)(()=>n.map(e=>e.id),[n]),{dragProps:_,dropIndicator:v}=He(g,(0,D.useCallback)((t,n)=>h(e,t,n),[e,h])),y=e5(e=>e.closeERD),x=(0,D.useCallback)(e=>{y(e);let t=We.getState();if(t.activeTabId[e]===`erd`){let n=t.tabs[e]??[];t.setActiveQueryTab(e,n.length>0?n[n.length-1].id:``)}},[y]),C=(0,D.useCallback)(()=>{let r={id:`tab-${Date.now()}`,title:t(`query.tabs.queryTitle`,{n:n.length+1}),query:``,database:``,isExecuting:!1,results:[],error:null,executionTime:null};a(e,r)},[e,n.length,a,t]),w=(0,D.useCallback)((t,n)=>{if(t.stopPropagation(),n===`erd`){x(e);return}o(e,n)},[e,o,x]),T=(0,D.useCallback)((t,r)=>{let a=n.findIndex(e=>e.id===t),o=n.filter((e,n)=>{switch(r){case`all`:return!0;case`others`:return e.id!==t;case`left`:return n<a;case`right`:return n>a}}).map(e=>e.id);o.length>0&&s(e,o),i&&(r===`all`||r===`others`||r===`right`)&&x(e)},[n,i,e,s,x]),ee=(0,D.useCallback)(t=>{c(e,t);let r;r=t===`erd`?e5.getState().database[e]:n.find(e=>e.id===t)?.database,r&&Pt(e,r)},[e,n,c]);return n.length===0&&!i?(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,$.jsxs)(te,{variant:`outline`,onClick:C,children:[(0,$.jsx)(B8,{className:`mr-1 size-4`}),t(`query.tabs.newQuery`)]})}):(0,$.jsxs)(T5,{value:l??void 0,onValueChange:ee,className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex items-center border-b bg-muted/30`,children:[(0,$.jsxs)(`div`,{ref:u,className:`min-w-0 flex-1 overflow-x-auto overflow-y-hidden [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,children:[(0,$.jsxs)(E5,{className:`h-9 w-max rounded-none bg-transparent`,children:[n.map((r,a)=>(0,$.jsxs)(p5,{children:[(0,$.jsx)(m5,{asChild:!0,children:(0,$.jsxs)(D5,{value:r.id,..._(r.id),"data-drop-before":v===r.id||void 0,className:`shrink-0 gap-1 data-[drop-before]:shadow-[inset_2px_0_0_var(--color-primary)] !rounded-none !border-0 !border-b-2 !border-transparent px-3 py-1.5 !text-muted-foreground hover:!text-foreground aria-selected:!bg-primary aria-selected:!text-primary-foreground aria-selected:!border-primary aria-selected:font-semibold aria-selected:!shadow-none after:!hidden`,children:[r.sourceTable&&(0,$.jsx)(AYe,{className:`size-3 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`max-w-[120px] truncate text-xs`,children:r.title}),(n.length>1||i)&&(0,$.jsx)(`button`,{type:`button`,className:`ml-1 rounded p-0.5 opacity-60 hover:bg-muted hover:opacity-100`,onClick:e=>w(e,r.id),children:(0,$.jsx)(b,{className:`size-3`})})]})}),(0,$.jsxs)(h5,{children:[(0,$.jsx)(g5,{onSelect:()=>o(e,r.id),children:t(`query.tabs.close`)}),(0,$.jsx)(g5,{disabled:n.length<=1&&!i,onSelect:()=>T(r.id,`others`),children:t(`query.tabs.closeOthers`)}),(0,$.jsx)(_5,{}),(0,$.jsx)(g5,{disabled:a===0,onSelect:()=>T(r.id,`left`),children:t(`query.tabs.closeLeft`)}),(0,$.jsx)(g5,{disabled:a===n.length-1&&!i,onSelect:()=>T(r.id,`right`),children:t(`query.tabs.closeRight`)}),(0,$.jsx)(_5,{}),(0,$.jsx)(g5,{onSelect:()=>T(r.id,`all`),children:t(`query.tabs.closeAll`)})]})]},r.id)),i&&(0,$.jsxs)(D5,{value:`erd`,className:`shrink-0 gap-1 !rounded-none !border-0 !border-b-2 !border-transparent px-3 py-1.5 !text-muted-foreground hover:!text-foreground aria-selected:!bg-primary aria-selected:!text-primary-foreground aria-selected:!border-primary aria-selected:font-semibold aria-selected:!shadow-none after:!hidden`,children:[(0,$.jsx)(`span`,{className:`text-xs`,children:t(`query.tabs.erdViewer`)}),(0,$.jsx)(`button`,{type:`button`,className:`ml-1 rounded p-0.5 opacity-60 hover:bg-muted hover:opacity-100`,onClick:e=>w(e,`erd`),children:(0,$.jsx)(b,{className:`size-3`})})]})]}),v===`end`&&(0,$.jsx)(`div`,{className:`h-6 w-0.5 shrink-0 bg-primary`})]}),(0,$.jsx)(te,{variant:`ghost`,size:`icon`,className:`mx-1 size-7 shrink-0`,onClick:C,children:(0,$.jsx)(B8,{className:`size-4`})})]}),n.map(t=>(0,$.jsx)(O5,{value:t.id,className:`mt-0 flex-1 overflow-hidden`,forceMount:t.id!==l||void 0,hidden:t.id!==l,children:t.sourceTable?(0,$.jsx)(o4e,{connectionId:e,tabId:t.id}):(0,$.jsx)(s4e,{connectionId:e,tabId:t.id})},t.id)),i&&(0,$.jsx)(O5,{value:`erd`,className:`mt-0 flex-1 overflow-hidden`,forceMount:l!==`erd`||void 0,hidden:l!==`erd`,children:(0,$.jsx)(T4e,{connectionId:e})})]})}function D4e({connectionId:e,fileName:t}){let{t:n}=S(),[r,i]=(0,D.useState)(!1),a=Ue(e=>e.closeConnection);async function o(){i(!0);try{let t=await ht(e,{interactive:!0});if(!t)return;let r=Ue.getState();r.updateServerConnectionId(e,t.connectionId),r.updateProfile(e,{file:t.fileName}),r.setPendingReopen(e,!1),r.setFileDetached(e,t.fileDetached),nt.getState().removeTree(e),c.getState().setFooterMessage(n(`connection.tab.reopened`,{file:t.fileName}))}catch(e){c.getState().setFooterMessage(n(`connection.tab.reopenFailed`,{message:e instanceof Error?e.message:String(e)}))}finally{i(!1)}}return(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 border-b border-catppuccin-yellow/40 bg-catppuccin-yellow/10 px-3 py-1.5 text-xs`,children:[(0,$.jsx)(I8,{className:`size-4 shrink-0 text-catppuccin-yellow`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 break-all`,children:(0,$.jsx)(Fn,{i18nKey:`connection.tab.reopenPrompt`,values:{file:t||n(`connection.tab.theSqliteFile`)},components:{b:(0,$.jsx)(`span`,{className:`font-medium`})}})}),(0,$.jsx)(te,{size:`sm`,className:`h-7 shrink-0 text-xs`,disabled:r,onClick:()=>{o()},children:n(`connection.tab.reopenFile`)}),(0,$.jsx)(te,{size:`sm`,variant:`ghost`,className:`h-7 shrink-0 text-xs`,onClick:()=>a(e),children:n(`connection.tab.closeConnection`)})]})}function O4e({connectionId:e,serverConnectionId:t,fileName:n}){let{t:r}=S(),[i,a]=(0,D.useState)(!1),o=Ue(e=>e.setFileDetached);async function s(){a(!0);try{await at(e,t)?(o(e,!1),c.getState().setFooterMessage(r(`connection.tab.reconnected`,{file:n}))):c.getState().setFooterMessage(r(`connection.tab.accessNotGranted`))}finally{a(!1)}}return(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 border-b border-catppuccin-blue/40 bg-catppuccin-blue/10 px-3 py-1.5 text-xs`,children:[(0,$.jsx)(L8,{className:`size-4 shrink-0 text-catppuccin-blue`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 break-all`,children:(0,$.jsx)(Fn,{i18nKey:`connection.tab.detachedPrompt`,values:{file:n||r(`connection.tab.theSqliteFile`)},components:{b:(0,$.jsx)(`span`,{className:`font-medium`})}})}),(0,$.jsx)(te,{size:`sm`,className:`h-7 shrink-0 text-xs`,disabled:i,onClick:()=>{s()},children:r(`connection.tab.reconnectFile`)}),(0,$.jsx)(te,{size:`sm`,variant:`ghost`,className:`h-7 shrink-0 text-xs`,onClick:()=>o(e,!1),title:r(`connection.tab.detachedHide`),children:(0,$.jsx)(b,{className:`size-3`})})]})}function k4e({connectionId:e,serverConnectionId:t,fileName:n,onDismiss:r}){let{t:i}=S(),[a,o]=(0,D.useState)(!1);async function s(){o(!0);try{let r=await gt(e,t);if(!r)return;Ue.getState().updateServerConnectionId(e,r.connectionId),nt.getState().removeTree(e),c.getState().setFooterMessage(r.appliedFrames>0?i(`connection.tab.walFramesApplied`,{count:r.appliedFrames,file:n}):i(`connection.tab.walNoChanges`))}catch(e){c.getState().setFooterMessage(i(`connection.tab.walLoadFailed`,{message:e instanceof Error?e.message:String(e)}))}finally{o(!1)}}return(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 border-b border-catppuccin-peach/40 bg-catppuccin-peach/10 px-3 py-1.5 text-xs`,children:[(0,$.jsx)(I8,{className:`size-4 shrink-0 text-catppuccin-peach`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 break-all`,children:(0,$.jsx)(Fn,{i18nKey:`connection.tab.walPrompt`,values:{file:n},components:{b:(0,$.jsx)(`span`,{className:`font-medium`}),mono:(0,$.jsx)(`span`,{className:`font-mono`})}})}),(0,$.jsx)(te,{size:`sm`,className:`h-7 shrink-0 text-xs`,disabled:a,onClick:()=>{s()},children:i(`connection.tab.loadWal`)}),(0,$.jsx)(te,{size:`sm`,variant:`outline`,className:`h-7 shrink-0 text-xs`,disabled:a,title:i(`connection.tab.noWalHint`),onClick:()=>{st(t),c.getState().bumpTransportVersion(),r()},children:i(`connection.tab.noWal`)}),(0,$.jsx)(te,{size:`sm`,variant:`ghost`,className:`h-7 w-7 shrink-0 p-0`,"aria-label":i(`connection.tab.dismiss`),title:i(`connection.tab.walHide`),onClick:r,children:(0,$.jsx)(b,{className:`size-3.5`})})]})}function A4e({connectionId:e}){let{t}=S(),n=Ue(t=>t.activeConnections.find(t=>t.id===e)),r=u5(n?.environmentColor),i=Ue(t=>t.pendingReopen[e]??!1),a=Ue(t=>t.fileDetached[e]??!1),o=rt(n?.serverConnectionId),[s,c]=(0,D.useState)(null),l=!i&&o?.wal&&!o.walApplied&&!o.walAcknowledged&&n?.serverConnectionId&&s!==n.serverConnectionId;return(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[i&&(0,$.jsx)(D4e,{connectionId:e,fileName:n?.file??``}),!i&&a&&!n?.sample&&!n?.scratchpad&&n?.serverConnectionId&&(0,$.jsx)(O4e,{connectionId:e,serverConnectionId:n.serverConnectionId,fileName:n?.file??``}),l&&(0,$.jsx)(k4e,{connectionId:e,serverConnectionId:n.serverConnectionId,fileName:n?.file??``,onDismiss:()=>c(n.serverConnectionId)}),r&&(0,$.jsxs)(`div`,{className:`flex h-5 shrink-0 items-center gap-2 px-3 text-[11px] font-semibold uppercase tracking-wider text-white`,style:{background:r},children:[(0,$.jsx)(`span`,{children:n?.hostName||n?.host}),n?.readOnly&&(0,$.jsx)(`span`,{className:`rounded bg-black/25 px-1.5 py-px normal-case tracking-normal`,children:t(`connection.tab.readOnlyBadge`)})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,style:r?{boxShadow:`inset 3px 0 0 ${r}`}:void 0,children:(0,$.jsxs)(zXe,{direction:`horizontal`,defaultSize:200,minSize:150,maxSize:600,storageKey:`sidebar`,children:[(0,$.jsx)(`div`,{className:`h-full border-r border-catppuccin-surface1 bg-catppuccin-mantle overflow-hidden`,children:(0,$.jsx)(_Ze,{connectionId:e})}),(0,$.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,$.jsx)(E4e,{connectionId:e})})]})})]})}var A9=`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>`,j9=`</title><path d="`,M9=`"/></svg>`,j4e={mysql:{title:`MySQL`,slug:`mysql`,get svg(){return A9+`MySQL`+j9+this.path+M9},path:`M16.405 5.501c-.115 0-.193.014-.274.033v.013h.014c.054.104.146.18.214.273.054.107.1.214.154.32l.014-.015c.094-.066.14-.172.14-.333-.04-.047-.046-.094-.08-.14-.04-.067-.126-.1-.18-.153zM5.77 18.695h-.927a50.854 50.854 0 00-.27-4.41h-.008l-1.41 4.41H2.45l-1.4-4.41h-.01a72.892 72.892 0 00-.195 4.41H0c.055-1.966.192-3.81.41-5.53h1.15l1.335 4.064h.008l1.347-4.064h1.095c.242 2.015.384 3.86.428 5.53zm4.017-4.08c-.378 2.045-.876 3.533-1.492 4.46-.482.716-1.01 1.073-1.583 1.073-.153 0-.34-.046-.566-.138v-.494c.11.017.24.026.386.026.268 0 .483-.075.647-.222.197-.18.295-.382.295-.605 0-.155-.077-.47-.23-.944L6.23 14.615h.91l.727 2.36c.164.536.233.91.205 1.123.4-1.064.678-2.227.835-3.483zm12.325 4.08h-2.63v-5.53h.885v4.85h1.745zm-3.32.135l-1.016-.5c.09-.076.177-.158.255-.25.433-.506.648-1.258.648-2.253 0-1.83-.718-2.746-2.155-2.746-.704 0-1.254.232-1.65.697-.43.508-.646 1.256-.646 2.245 0 .972.19 1.686.574 2.14.35.41.877.615 1.583.615.264 0 .506-.033.725-.098l1.325.772.36-.622zM15.5 17.588c-.225-.36-.337-.94-.337-1.736 0-1.393.424-2.09 1.27-2.09.443 0 .77.167.977.5.224.362.336.936.336 1.723 0 1.404-.424 2.108-1.27 2.108-.445 0-.77-.167-.978-.5zm-1.658-.425c0 .47-.172.856-.516 1.156-.344.3-.803.45-1.384.45-.543 0-1.064-.172-1.573-.515l.237-.476c.438.22.833.328 1.19.328.332 0 .593-.073.783-.22a.754.754 0 00.3-.615c0-.33-.23-.61-.648-.845-.388-.213-1.163-.657-1.163-.657-.422-.307-.632-.636-.632-1.177 0-.45.157-.81.47-1.085.315-.278.72-.415 1.22-.415.512 0 .98.136 1.4.41l-.213.476a2.726 2.726 0 00-1.064-.23c-.283 0-.502.068-.654.206a.685.685 0 00-.248.524c0 .328.234.61.666.85.393.215 1.187.67 1.187.67.433.305.648.63.648 1.168zm9.382-5.852c-.535-.014-.95.04-1.297.188-.1.04-.26.04-.274.167.055.053.063.14.11.214.08.134.218.313.346.407.14.11.28.216.427.31.26.16.555.255.81.416.145.094.293.213.44.313.073.05.12.14.214.172v-.02c-.046-.06-.06-.147-.105-.214-.067-.067-.134-.127-.2-.193a3.223 3.223 0 00-.695-.675c-.214-.146-.682-.35-.77-.595l-.013-.014c.146-.013.32-.066.46-.106.227-.06.435-.047.67-.106.106-.027.213-.06.32-.094v-.06c-.12-.12-.21-.283-.334-.395a8.867 8.867 0 00-1.104-.823c-.21-.134-.476-.22-.697-.334-.08-.04-.214-.06-.26-.127-.12-.146-.19-.34-.275-.514a17.69 17.69 0 01-.547-1.163c-.12-.262-.193-.523-.34-.763-.69-1.137-1.437-1.826-2.586-2.5-.247-.14-.543-.2-.856-.274-.167-.008-.334-.02-.5-.027-.11-.047-.216-.174-.31-.235-.38-.24-1.364-.76-1.644-.072-.18.434.267.862.422 1.082.115.153.26.328.34.5.047.116.06.235.107.356.106.294.207.622.347.897.073.14.153.287.247.413.054.073.146.107.167.227-.094.136-.1.334-.154.5-.24.757-.146 1.693.194 2.25.107.166.362.534.703.393.3-.12.234-.5.32-.835.02-.08.007-.133.048-.187v.015c.094.188.188.367.274.555.206.328.566.668.867.895.16.12.287.328.487.402v-.02h-.015c-.043-.058-.1-.086-.154-.133a3.445 3.445 0 01-.35-.4 8.76 8.76 0 01-.747-1.218c-.11-.21-.202-.436-.29-.643-.04-.08-.04-.2-.107-.24-.1.146-.247.273-.32.453-.127.288-.14.642-.188 1.01-.027.007-.014 0-.027.014-.214-.052-.287-.274-.367-.46-.2-.475-.233-1.238-.06-1.785.047-.14.247-.582.167-.716-.042-.127-.174-.2-.247-.303a2.478 2.478 0 01-.24-.427c-.16-.374-.24-.788-.414-1.162-.08-.173-.22-.354-.334-.513-.127-.18-.267-.307-.368-.52-.033-.073-.08-.194-.027-.274.014-.054.042-.075.094-.09.088-.072.335.022.422.062.247.1.455.194.662.334.094.066.195.193.315.226h.14c.214.047.455.014.655.073.355.114.675.28.962.46a5.953 5.953 0 012.085 2.286c.08.154.115.295.188.455.14.33.313.663.455.982.14.315.275.636.476.897.1.14.502.213.682.286.133.06.34.115.46.188.23.14.454.3.67.454.11.076.443.243.463.378z`,source:`https://www.mysql.com/about/legal/logos.html`,hex:`4479A1`,guidelines:`https://www.mysql.com/about/legal/logos.html`},maria:{title:`MariaDB`,slug:`mariadb`,get svg(){return A9+`MariaDB`+j9+this.path+M9},path:`M23.157 4.412c-.676.284-.79.31-1.673.372-.65.045-.757.057-1.212.209-.75.246-1.395.75-2.02 1.59-.296.398-1.249 1.913-1.249 1.988 0 .057-.65.998-.915 1.32-.574.713-1.08 1.079-2.14 1.59-.77.36-1.224.524-4.102 1.477-1.073.353-2.133.738-2.367.864-.852.449-1.515 1.036-2.203 1.938-1.003 1.32-.972 1.313-3.042.947a12.264 12.264 0 00-.675-.063c-.644-.05-1.023.044-1.332.334L0 17.193l.177.088c.094.05.353.234.561.398.215.17.461.347.55.391.088.044.17.088.183.101.012.013-.089.17-.228.353-.435.581-.593.871-.574 1.048.019.164.032.17.43.17.517-.006.826-.056 1.261-.208.65-.233 2.058-.94 2.784-1.4.776-.5 1.717-.998 1.956-1.042.082-.02.354-.07.594-.114.58-.107 1.464-.095 2.587.05.108.013.373.045.6.064.227.025.43.057.454.076.026.012.474.037.998.056.934.026 1.104.007 1.3-.189.126-.133.385-.631.498-.985.209-.643.417-.921.366-.492-.113.966-.322 1.692-.713 2.411-.259.499-.663 1.092-.934 1.395-.322.347-.315.36.088.315.619-.063 1.471-.397 2.096-.82.827-.562 1.647-1.691 2.19-3.03.107-.27.22-.22.183.083-.013.094-.038.315-.057.498l-.031.328.353-.202c.833-.48 1.414-1.262 2.127-2.884.227-.518.877-2.922 1.073-3.976a9.64 9.64 0 01.271-1.042c.127-.429.196-.555.48-.858.183-.19.625-.555.978-.808.72-.505.953-.75 1.187-1.205.208-.417.284-1.13.132-1.357-.132-.202-.284-.196-.763.006Z`,source:`https://mariadb.com/about-us/logos/`,hex:`003545`,guidelines:`https://mariadb.com/about-us/logos/`},postgres:{title:`PostgreSQL`,slug:`postgresql`,get svg(){return A9+`PostgreSQL`+j9+this.path+M9},path:`M23.5594 14.7228a.5269.5269 0 0 0-.0563-.1191c-.139-.2632-.4768-.3418-1.0074-.2321-1.6533.3411-2.2935.1312-2.5256-.0191 1.342-2.0482 2.445-4.522 3.0411-6.8297.2714-1.0507.7982-3.5237.1222-4.7316a1.5641 1.5641 0 0 0-.1509-.235C21.6931.9086 19.8007.0248 17.5099.0005c-1.4947-.0158-2.7705.3461-3.1161.4794a9.449 9.449 0 0 0-.5159-.0816 8.044 8.044 0 0 0-1.3114-.1278c-1.1822-.0184-2.2038.2642-3.0498.8406-.8573-.3211-4.7888-1.645-7.2219.0788C.9359 2.1526.3086 3.8733.4302 6.3043c.0409.818.5069 3.334 1.2423 5.7436.4598 1.5065.9387 2.7019 1.4334 3.582.553.9942 1.1259 1.5933 1.7143 1.7895.4474.1491 1.1327.1441 1.8581-.7279.8012-.9635 1.5903-1.8258 1.9446-2.2069.4351.2355.9064.3625 1.39.3772a.0569.0569 0 0 0 .0004.0041 11.0312 11.0312 0 0 0-.2472.3054c-.3389.4302-.4094.5197-1.5002.7443-.3102.064-1.1344.2339-1.1464.8115-.0025.1224.0329.2309.0919.3268.2269.4231.9216.6097 1.015.6331 1.3345.3335 2.5044.092 3.3714-.6787-.017 2.231.0775 4.4174.3454 5.0874.2212.5529.7618 1.9045 2.4692 1.9043.2505 0 .5263-.0291.8296-.0941 1.7819-.3821 2.5557-1.1696 2.855-2.9059.1503-.8707.4016-2.8753.5388-4.1012.0169-.0703.0357-.1207.057-.1362.0007-.0005.0697-.0471.4272.0307a.3673.3673 0 0 0 .0443.0068l.2539.0223.0149.001c.8468.0384 1.9114-.1426 2.5312-.4308.6438-.2988 1.8057-1.0323 1.5951-1.6698zM2.371 11.8765c-.7435-2.4358-1.1779-4.8851-1.2123-5.5719-.1086-2.1714.4171-3.6829 1.5623-4.4927 1.8367-1.2986 4.8398-.5408 6.108-.13-.0032.0032-.0066.0061-.0098.0094-2.0238 2.044-1.9758 5.536-1.9708 5.7495-.0002.0823.0066.1989.0162.3593.0348.5873.0996 1.6804-.0735 2.9184-.1609 1.1504.1937 2.2764.9728 3.0892.0806.0841.1648.1631.2518.2374-.3468.3714-1.1004 1.1926-1.9025 2.1576-.5677.6825-.9597.5517-1.0886.5087-.3919-.1307-.813-.5871-1.2381-1.3223-.4796-.839-.9635-2.0317-1.4155-3.5126zm6.0072 5.0871c-.1711-.0428-.3271-.1132-.4322-.1772.0889-.0394.2374-.0902.4833-.1409 1.2833-.2641 1.4815-.4506 1.9143-1.0002.0992-.126.2116-.2687.3673-.4426a.3549.3549 0 0 0 .0737-.1298c.1708-.1513.2724-.1099.4369-.0417.156.0646.3078.26.3695.4752.0291.1016.0619.2945-.0452.4444-.9043 1.2658-2.2216 1.2494-3.1676 1.0128zm2.094-3.988-.0525.141c-.133.3566-.2567.6881-.3334 1.003-.6674-.0021-1.3168-.2872-1.8105-.8024-.6279-.6551-.9131-1.5664-.7825-2.5004.1828-1.3079.1153-2.4468.079-3.0586-.005-.0857-.0095-.1607-.0122-.2199.2957-.2621 1.6659-.9962 2.6429-.7724.4459.1022.7176.4057.8305.928.5846 2.7038.0774 3.8307-.3302 4.7363-.084.1866-.1633.3629-.2311.5454zm7.3637 4.5725c-.0169.1768-.0358.376-.0618.5959l-.146.4383a.3547.3547 0 0 0-.0182.1077c-.0059.4747-.054.6489-.115.8693-.0634.2292-.1353.4891-.1794 1.0575-.11 1.4143-.8782 2.2267-2.4172 2.5565-1.5155.3251-1.7843-.4968-2.0212-1.2217a6.5824 6.5824 0 0 0-.0769-.2266c-.2154-.5858-.1911-1.4119-.1574-2.5551.0165-.5612-.0249-1.9013-.3302-2.6462.0044-.2932.0106-.5909.019-.8918a.3529.3529 0 0 0-.0153-.1126 1.4927 1.4927 0 0 0-.0439-.208c-.1226-.4283-.4213-.7866-.7797-.9351-.1424-.059-.4038-.1672-.7178-.0869.067-.276.1831-.5875.309-.9249l.0529-.142c.0595-.16.134-.3257.213-.5012.4265-.9476 1.0106-2.2453.3766-5.1772-.2374-1.0981-1.0304-1.6343-2.2324-1.5098-.7207.0746-1.3799.3654-1.7088.5321a5.6716 5.6716 0 0 0-.1958.1041c.0918-1.1064.4386-3.1741 1.7357-4.4823a4.0306 4.0306 0 0 1 .3033-.276.3532.3532 0 0 0 .1447-.0644c.7524-.5706 1.6945-.8506 2.802-.8325.4091.0067.8017.0339 1.1742.081 1.939.3544 3.2439 1.4468 4.0359 2.3827.8143.9623 1.2552 1.9315 1.4312 2.4543-1.3232-.1346-2.2234.1268-2.6797.779-.9926 1.4189.543 4.1729 1.2811 5.4964.1353.2426.2522.4522.2889.5413.2403.5825.5515.9713.7787 1.2552.0696.087.1372.1714.1885.245-.4008.1155-1.1208.3825-1.0552 1.717-.0123.1563-.0423.4469-.0834.8148-.0461.2077-.0702.4603-.0994.7662zm.8905-1.6211c-.0405-.8316.2691-.9185.5967-1.0105a2.8566 2.8566 0 0 0 .135-.0406 1.202 1.202 0 0 0 .1342.103c.5703.3765 1.5823.4213 3.0068.1344-.2016.1769-.5189.3994-.9533.6011-.4098.1903-1.0957.333-1.7473.3636-.7197.0336-1.0859-.0807-1.1721-.151zm.5695-9.2712c-.0059.3508-.0542.6692-.1054 1.0017-.055.3576-.112.7274-.1264 1.1762-.0142.4368.0404.8909.0932 1.3301.1066.887.216 1.8003-.2075 2.7014a3.5272 3.5272 0 0 1-.1876-.3856c-.0527-.1276-.1669-.3326-.3251-.6162-.6156-1.1041-2.0574-3.6896-1.3193-4.7446.3795-.5427 1.3408-.5661 2.1781-.463zm.2284 7.0137a12.3762 12.3762 0 0 0-.0853-.1074l-.0355-.0444c.7262-1.1995.5842-2.3862.4578-3.4385-.0519-.4318-.1009-.8396-.0885-1.2226.0129-.4061.0666-.7543.1185-1.0911.0639-.415.1288-.8443.1109-1.3505.0134-.0531.0188-.1158.0118-.1902-.0457-.4855-.5999-1.938-1.7294-3.253-.6076-.7073-1.4896-1.4972-2.6889-2.0395.5251-.1066 1.2328-.2035 2.0244-.1859 2.0515.0456 3.6746.8135 4.8242 2.2824a.908.908 0 0 1 .0667.1002c.7231 1.3556-.2762 6.2751-2.9867 10.5405zm-8.8166-6.1162c-.025.1794-.3089.4225-.6211.4225a.5821.5821 0 0 1-.0809-.0056c-.1873-.026-.3765-.144-.5059-.3156-.0458-.0605-.1203-.178-.1055-.2844.0055-.0401.0261-.0985.0925-.1488.1182-.0894.3518-.1226.6096-.0867.3163.0441.6426.1938.6113.4186zm7.9305-.4114c.0111.0792-.049.201-.1531.3102-.0683.0717-.212.1961-.4079.2232a.5456.5456 0 0 1-.075.0052c-.2935 0-.5414-.2344-.5607-.3717-.024-.1765.2641-.3106.5611-.352.297-.0414.6111.0088.6356.1851z`,source:`https://wiki.postgresql.org/wiki/Logo`,hex:`4169E1`,guidelines:`https://www.postgresql.org/about/policies/trademarks/`},sqlite:{title:`SQLite`,slug:`sqlite`,get svg(){return A9+`SQLite`+j9+this.path+M9},path:`M21.678.521c-1.032-.92-2.28-.55-3.513.544a8.71 8.71 0 0 0-.547.535c-2.109 2.237-4.066 6.38-4.674 9.544.237.48.422 1.093.544 1.561a13.044 13.044 0 0 1 .164.703s-.019-.071-.096-.296l-.05-.146a1.689 1.689 0 0 0-.033-.08c-.138-.32-.518-.995-.686-1.289-.143.423-.27.818-.376 1.176.484.884.778 2.4.778 2.4s-.025-.099-.147-.442c-.107-.303-.644-1.244-.772-1.464-.217.804-.304 1.346-.226 1.478.152.256.296.698.422 1.186.286 1.1.485 2.44.485 2.44l.017.224a22.41 22.41 0 0 0 .056 2.748c.095 1.146.273 2.13.5 2.657l.155-.084c-.334-1.038-.47-2.399-.41-3.967.09-2.398.642-5.29 1.661-8.304 1.723-4.55 4.113-8.201 6.3-9.945-1.993 1.8-4.692 7.63-5.5 9.788-.904 2.416-1.545 4.684-1.931 6.857.666-2.037 2.821-2.912 2.821-2.912s1.057-1.304 2.292-3.166c-.74.169-1.955.458-2.362.629-.6.251-.762.337-.762.337s1.945-1.184 3.613-1.72C21.695 7.9 24.195 2.767 21.678.521m-18.573.543A1.842 1.842 0 0 0 1.27 2.9v16.608a1.84 1.84 0 0 0 1.835 1.834h9.418a22.953 22.953 0 0 1-.052-2.707c-.006-.062-.011-.141-.016-.2a27.01 27.01 0 0 0-.473-2.378c-.121-.47-.275-.898-.369-1.057-.116-.197-.098-.31-.097-.432 0-.12.015-.245.037-.386a9.98 9.98 0 0 1 .234-1.045l.217-.028c-.017-.035-.014-.065-.031-.097l-.041-.381a32.8 32.8 0 0 1 .382-1.194l.2-.019c-.008-.016-.01-.038-.018-.053l-.043-.316c.63-3.28 2.587-7.443 4.8-9.791.066-.069.133-.128.198-.194Z`,source:`https://github.com/sqlite/sqlite/blob/43e862723ec680542ca6f608f9963c0993dd7324/art/sqlite370.eps`,hex:`003B57`},mssql:{path:`M12 1.5c-4.97 0-9 1.79-9 4v13c0 2.21 4.03 4 9 4s9-1.79 9-4v-13c0-2.21-4.03-4-9-4zm0 2c3.87 0 7 1.12 7 2s-3.13 2-7 2-7-1.12-7-2 3.13-2 7-2zm0 2.9a2.1 2.1 0 1 1 0 4.2 2.1 2.1 0 0 1 0-4.2zM5 8.55c1.6.9 4.2 1.45 7 1.45s5.4-.55 7-1.45V11c0 .88-3.13 2-7 2s-7-1.12-7-2V8.55zm0 4.9c1.6.9 4.2 1.45 7 1.45s5.4-.55 7-1.45V16c0 .88-3.13 2-7 2s-7-1.12-7-2v-2.55zm0 5c1.6.9 4.2 1.45 7 1.45s5.4-.55 7-1.45`},oracle:{path:`M7.5 5.5h9a6.5 6.5 0 0 1 0 13h-9a6.5 6.5 0 0 1 0-13zm0 2.4a4.1 4.1 0 0 0 0 8.2h9a4.1 4.1 0 0 0 0-8.2h-9z`},neon:{title:`Neon`,slug:`neon`,get svg(){return A9+`Neon`+j9+this.path+M9},path:`M24 0V24l-9.365-8.045V24H0V0ZM2.942 21.087h8.751V9.563l9.365 8.204V2.919L2.942 2.914Z`,source:`https://neon.com/brand`,hex:`34D59A`,guidelines:`https://neon.com/brand`},supabase:{title:`Supabase`,slug:`supabase`,get svg(){return A9+`Supabase`+j9+this.path+M9},path:`M11.9 1.036c-.015-.986-1.26-1.41-1.874-.637L.764 12.05C-.33 13.427.65 15.455 2.409 15.455h9.579l.113 7.51c.014.985 1.259 1.408 1.873.636l9.262-11.653c1.093-1.375.113-3.403-1.645-3.403h-9.642z`,source:`https://github.com/supabase/supabase/blob/4031a7549f5d46da7bc79c01d56be4177dc7c114/packages/common/assets/images/supabase-logo-wordmark--light.svg`,hex:`3FCF8E`},d1:{title:`Cloudflare`,slug:`cloudflare`,get svg(){return A9+`Cloudflare`+j9+this.path+M9},path:`M16.5088 16.8447c.1475-.5068.0908-.9707-.1553-1.3154-.2246-.3164-.6045-.499-1.0615-.5205l-8.6592-.1123a.1559.1559 0 0 1-.1333-.0713c-.0283-.042-.0351-.0986-.021-.1553.0278-.084.1123-.1484.2036-.1562l8.7359-.1123c1.0351-.0489 2.1601-.8868 2.5537-1.9136l.499-1.3013c.0215-.0561.0293-.1128.0147-.168-.5625-2.5463-2.835-4.4453-5.5499-4.4453-2.5039 0-4.6284 1.6177-5.3876 3.8614-.4927-.3658-1.1187-.5625-1.794-.499-1.2026.119-2.1665 1.083-2.2861 2.2856-.0283.31-.0069.6128.0635.894C1.5683 13.171 0 14.7754 0 16.752c0 .1748.0142.3515.0352.5273.0141.083.0844.1475.1689.1475h15.9814c.0909 0 .1758-.0645.2032-.1553l.12-.4268zm2.7568-5.5634c-.0771 0-.1611 0-.2383.0112-.0566 0-.1054.0415-.127.0976l-.3378 1.1744c-.1475.5068-.0918.9707.1543 1.3164.2256.3164.6055.498 1.0625.5195l1.8437.1133c.0557 0 .1055.0263.1329.0703.0283.043.0351.1074.0214.1562-.0283.084-.1132.1485-.204.1553l-1.921.1123c-1.041.0488-2.1582.8867-2.5527 1.914l-.1406.3585c-.0283.0713.0215.1416.0986.1416h6.5977c.0771 0 .1474-.0489.169-.126.1122-.4082.1757-.837.1757-1.2803 0-2.6025-2.125-4.727-4.7344-4.727`,source:`https://www.cloudflare.com/logo/`,hex:`F38020`,guidelines:`https://www.cloudflare.com/trademark/`}};function N9({dbms:e,className:t}){let n=j4e[e];return n?(0,$.jsx)(`svg`,{viewBox:`0 0 24 24`,className:w(`size-4 shrink-0`,t),fill:`currentColor`,"aria-hidden":!0,children:(0,$.jsx)(`path`,{d:n.path})}):(0,$.jsx)(P8,{className:w(`size-4 shrink-0`,t),"aria-hidden":!0})}function M4e(){let{t:e}=S(),{activeConnections:t,activeConnectionId:n,setActiveConnection:r,closeConnection:i}=Ue(),a=(0,D.useRef)(null);yZe(a,n);let o=Ue(e=>e.reorderActiveConnection),s=(0,D.useMemo)(()=>t.map(e=>e.id),[t]),{dragProps:c,dropIndicator:l}=He(s,(0,D.useCallback)((e,t)=>o(e,t),[o]));return t.length===0?(0,$.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground`,children:e(`connection.tab.noConnections`)}):(0,$.jsxs)(T5,{value:n??void 0,onValueChange:r,className:`h-full gap-0`,children:[(0,$.jsx)(E5,{ref:a,variant:`line`,className:`w-full shrink-0 justify-start overflow-x-auto overflow-y-hidden border-b px-2 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,children:t.map(e=>(0,$.jsxs)(D5,{value:e.id,...c(e.id),"data-drop-before":l===e.id||void 0,className:`shrink-0 gap-1 data-[drop-before]:shadow-[inset_2px_0_0_var(--color-primary)] !rounded-none !border-0 !border-b-2 !border-transparent pr-1 !text-muted-foreground hover:!text-foreground data-[state=active]:!bg-primary data-[state=active]:!text-primary-foreground data-[state=active]:!border-primary data-[state=active]:font-semibold data-[state=active]:!shadow-none after:!hidden`,children:[u5(e.environmentColor)&&(0,$.jsx)(`span`,{className:`size-2 shrink-0 rounded-full`,style:{background:u5(e.environmentColor)}}),(0,$.jsx)(N9,{dbms:e.dbms,className:`size-3.5 opacity-80`}),(0,$.jsx)(`span`,{className:`truncate max-w-[140px]`,children:e.hostName||`${e.host}:${e.port}`}),(0,$.jsx)(`button`,{type:`button`,className:`ml-1 rounded-sm p-0.5 opacity-60 hover:opacity-100 hover:bg-muted transition-colors`,onClick:t=>{t.stopPropagation(),i(e.id)},children:(0,$.jsx)(b,{className:`size-3`})})]},e.id))}),t.map(e=>(0,$.jsx)(O5,{value:e.id,className:`mt-0 min-h-0 flex-1`,children:(0,$.jsx)(A4e,{connectionId:e.id})},e.id))]})}var N4e=(0,D.lazy)(()=>oe(()=>import(`./ConnectDialog-Bu2hPwDR.js`).then(e=>({default:e.ConnectDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]))),P4e=(0,D.lazy)(()=>oe(()=>import(`./CreateDatabaseDialog-DxJWfyxB.js`).then(e=>({default:e.CreateDatabaseDialog})),__vite__mapDeps([16,1,2,3,4,5,6,7,15]))),F4e=(0,D.lazy)(()=>oe(()=>import(`./CopyDatabaseDialog-ChOc_aHQ.js`).then(e=>({default:e.CopyDatabaseDialog})),__vite__mapDeps([17,1,2,15,4]))),I4e=(0,D.lazy)(()=>oe(()=>import(`./DownloadToCSVDialog-DOj_AAnH.js`).then(e=>({default:e.DownloadToCSVDialog})),__vite__mapDeps([18,1,2,3,4,5,6,7,8,9,10,11,12,13,19,14,20,21,15,22]))),L4e=(0,D.lazy)(()=>oe(()=>import(`./SchemaToHTMLDialog-BBskyW7d.js`).then(e=>({default:e.SchemaToHTMLDialog})),__vite__mapDeps([23,1,2,3,4,5,6,7,8,9,10,11,12,13,20,14,21,15,22]))),R4e=(0,D.lazy)(()=>oe(()=>import(`./CopyTableDialog-DnuH4LY7.js`).then(e=>({default:e.CopyTableDialog})),__vite__mapDeps([24,1,2,3,4,5,6,7,8,9,12,13,10,11,19,14,20,21,25,26,15]))),z4e=(0,D.lazy)(()=>oe(()=>import(`./LinkColumnDialog-DbBY5TGQ.js`).then(e=>({default:e.LinkColumnDialog})),__vite__mapDeps([27,1,2,3,4,5,6,7,8,9,12,13,10,11,20,14,15]))),B4e=(0,D.lazy)(()=>oe(()=>import(`./DataDiffDialog-Cn-eGt63.js`).then(e=>({default:e.DataDiffDialog})),__vite__mapDeps([28,1,2,3,4,5,6,7,8,9,12,13,10,11,20,14,15]))),V4e=(0,D.lazy)(()=>oe(()=>import(`./SchemaDiffDialog-Bv_hurif.js`).then(e=>({default:e.SchemaDiffDialog})),__vite__mapDeps([29,1,2,3,4,5,6,7,8,9,12,13,10,11,20,14,26,15]))),P9=(0,D.lazy)(()=>oe(()=>import(`./EditSchemaDialog-UhHglHzS.js`).then(e=>({default:e.EditSchemaDialog})),__vite__mapDeps([30,1,2,3,4,5,6,7,8,9,12,13,10,11,20,14,31,15]))),H4e=(0,D.lazy)(()=>oe(()=>import(`./UserManagerDialog-DVESBSWa.js`).then(e=>({default:e.UserManagerDialog})),__vite__mapDeps([32,1,2,8,9,15,4,33]))),U4e=(0,D.lazy)(()=>oe(()=>import(`./UserAddDialog-DeXw9R9S.js`).then(e=>({default:e.UserAddDialog})),__vite__mapDeps([34,1,2,3,4,5,6,7,8,9,15,33]))),W4e=(0,D.lazy)(()=>oe(()=>import(`./ProcessListDialog-C460XY2M.js`).then(e=>({default:e.ProcessListDialog})),__vite__mapDeps([35,1,2,13,8,9,12,10,11,20,14,15,4]))),G4e=(0,D.lazy)(()=>oe(()=>import(`./VariablesDialog-BrHFb0LI.js`).then(e=>({default:e.VariablesDialog})),__vite__mapDeps([36,1,2,13,8,9,12,10,11,20,14,15,4]))),K4e=(0,D.lazy)(()=>oe(()=>import(`./StatusDialog-C46oDW7W.js`).then(e=>({default:e.StatusDialog})),__vite__mapDeps([37,1,2,13,8,9,12,10,11,20,14,15,4]))),q4e=(0,D.lazy)(()=>oe(()=>import(`./FlushDialog-Dddl8R1h.js`).then(e=>({default:e.FlushDialog})),__vite__mapDeps([38,1,2,8,9,12,13,10,11,15,4]))),J4e=(0,D.lazy)(()=>oe(()=>import(`./FindReplaceDialog-DYEerBXx.js`).then(e=>({default:e.FindReplaceDialog})),__vite__mapDeps([39,1,2,7]))),Y4e=(0,D.lazy)(()=>oe(()=>import(`./SafetySettingsDialog-Mny69ZOZ.js`).then(e=>({default:e.SafetySettingsDialog})),__vite__mapDeps([40,1,2,13,3,4,5,6,7,11,9,15]))),X4e=(0,D.lazy)(()=>oe(()=>import(`./LocalHistoryDialog-Nojvlhmz.js`).then(e=>({default:e.LocalHistoryDialog})),__vite__mapDeps([41,1,2,8,9,10,11,15,4]))),Z4e=(0,D.lazy)(()=>oe(()=>import(`./AboutDialog-DNnLylHg.js`).then(e=>({default:e.AboutDialog})),__vite__mapDeps([42,1,2,15,4]))),Q4e=(0,D.lazy)(()=>oe(()=>import(`./TermsDialog-CSYNiNpB.js`).then(e=>({default:e.TermsDialog})),__vite__mapDeps([43,1,2,11,9,15,4]))),$4e=(0,D.lazy)(()=>oe(()=>import(`./RowFormDialog-A8wtwTwI.js`).then(e=>({default:e.RowFormDialog})),__vite__mapDeps([44,1,2,8,9,11,12,13,10,19,14,20,21,31,15,4]))),e3e={connect:N4e,"create-database":P4e,"copy-database":F4e,"export-csv":I4e,"export-html":L4e,"alter-database":P9,"create-table":P9,"alter-table":P9,"duplicate-table-structure":P9,"copy-table":R4e,"schema-diff":V4e,"data-diff":B4e,"link-column":z4e,"user-manager":H4e,"user-add":U4e,"process-list":W4e,variables:G4e,status:K4e,flush:q4e,"find-replace":J4e,"quick-command":(0,D.lazy)(()=>oe(()=>import(`./QuickCommandPalette-Crdl1lBX.js`).then(e=>({default:e.QuickCommandPalette})),__vite__mapDeps([45,1,2,4,11,9,31,8,14,15]))),"safety-settings":Y4e,"local-history":X4e,about:Z4e,terms:Q4e,"row-form":$4e};function t3e(){let e=c(e=>e.activeDialog);if(!e)return null;let t=e3e[e];return t?(0,$.jsx)(D.Suspense,{fallback:null,children:(0,$.jsx)(t,{})}):null}function F9({...e}){return(0,$.jsx)(aWe,{"data-slot":`alert-dialog`,...e})}function n3e({...e}){return(0,$.jsx)(oWe,{"data-slot":`alert-dialog-portal`,...e})}function r3e({className:e,...t}){return(0,$.jsx)(sWe,{"data-slot":`alert-dialog-overlay`,className:w(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function I9({className:e,size:t=`default`,...n}){return(0,$.jsxs)(n3e,{children:[(0,$.jsx)(r3e,{}),(0,$.jsx)(cWe,{"data-slot":`alert-dialog-content`,"data-size":t,className:w(`group/alert-dialog-content fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 data-[size=sm]:max-w-xs data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[size=default]:sm:max-w-lg`,e),...n})]})}function L9({className:e,...t}){return(0,$.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:w(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function R9({className:e,...t}){return(0,$.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:w(`flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function z9({className:e,...t}){return(0,$.jsx)(dWe,{"data-slot":`alert-dialog-title`,className:w(`text-lg font-semibold sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function B9({className:e,...t}){return(0,$.jsx)(fWe,{"data-slot":`alert-dialog-description`,className:w(`text-sm text-muted-foreground`,e),...t})}function V9({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,$.jsx)(te,{variant:t,size:n,asChild:!0,children:(0,$.jsx)(lWe,{"data-slot":`alert-dialog-action`,className:w(e),...r})})}function H9({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,$.jsx)(te,{variant:t,size:n,asChild:!0,children:(0,$.jsx)(uWe,{"data-slot":`alert-dialog-cancel`,className:w(e),...r})})}function U9({className:e,type:t,...n}){return(0,$.jsx)(`input`,{type:t,"data-slot":`input`,className:w(`h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30`,`focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,`aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40`,e),...n})}function i3e({className:e,...t}){return(0,$.jsx)(oKe,{"data-slot":`label`,className:w(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function a3e(){let e=c(e=>e.destructiveConfirm),t=c(e=>e.resolveDestructiveConfirm);return e?(0,$.jsx)(o3e,{request:e.request,resolve:t},e.id):null}function o3e({request:e,resolve:t}){let{t:n}=S(),[r,i]=(0,D.useState)(``),a=!!e.typeToConfirm,o=!a||r===e.typeToConfirm;return(0,$.jsx)(F9,{open:!0,onOpenChange:e=>{e||t(!1)},children:(0,$.jsx)(I9,{className:`max-w-lg overflow-hidden`,children:(0,$.jsxs)(`form`,{className:`contents`,onSubmit:e=>{e.preventDefault(),o&&t(!0)},children:[(0,$.jsxs)(L9,{children:[(0,$.jsxs)(z9,{className:`flex min-w-0 items-center gap-2 break-words`,children:[(0,$.jsx)(MYe,{className:`size-5 shrink-0 text-destructive`}),(0,$.jsx)(`span`,{className:`min-w-0 break-words`,children:e.title})]}),(0,$.jsx)(B9,{className:`min-w-0 break-words [overflow-wrap:anywhere] whitespace-pre-line`,children:e.description??n(`confirm.defaultDescription`)})]}),e.statements&&e.statements.length>0&&(0,$.jsx)(`pre`,{className:`max-h-48 overflow-auto rounded-md border bg-muted p-3 font-mono text-xs whitespace-pre-wrap break-all`,children:e.statements.join(`
|
|
923
|
+
`;a.executeEdits(`history`,[{range:c,text:f,forceMoveMarkers:!0}]),a.focus(),o(t(`result.history.inserted`))},[r,e,_,o,t]),y=(0,D.useMemo)(()=>n.filter(t=>!e||!t.connectionId||t.connectionId===e),[n,e]),x=(0,D.useCallback)(async()=>{if(!await s({title:t(`result.history.clearTitle`),description:t(`result.history.clearDescription`,{count:y.length}),confirmLabel:t(`result.history.clearConfirm`)}))return;let r=n.filter(t=>t.connectionId&&t.connectionId!==e);i();for(let e of[...r].reverse())a(e)},[s,t,y.length,n,e,i,a]),C=(0,D.useMemo)(()=>{let e=d.trim().toLowerCase();return y.filter(t=>!(p===`success`&&!t.success||p===`failed`&&t.success||h&&t.tabId!==r||e&&!t.query.toLowerCase().includes(e)&&!(t.database??``).toLowerCase().includes(e)&&!(t.error??``).toLowerCase().includes(e)))},[y,d,p,h,r]),w=(0,D.useMemo)(()=>n4e(C,t),[C,t]);if(y.length===0)return(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:t(`result.history.empty`)});let T=(e,t)=>(0,$.jsx)(`button`,{type:`button`,className:`rounded px-2 py-0.5 text-xs ${p===e?`bg-primary text-primary-foreground`:`text-muted-foreground hover:text-foreground`}`,onClick:()=>m(e),children:t});return(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center gap-2 border-b bg-muted/30 px-3 py-1.5`,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(U8,{className:`pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground`}),(0,$.jsx)(`input`,{className:`h-7 w-52 rounded border bg-background pl-7 pr-6 text-xs placeholder:text-muted-foreground`,placeholder:t(`result.history.searchPlaceholder`),value:d,onChange:e=>f(e.target.value)}),d&&(0,$.jsx)(`button`,{type:`button`,className:`absolute right-1.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,onClick:()=>f(``),children:(0,$.jsx)(b,{className:`size-3`})})]}),(0,$.jsxs)(`div`,{className:`flex items-center rounded border bg-background p-0.5`,children:[T(`all`,t(`result.history.all`)),T(`success`,t(`result.history.success`)),T(`failed`,t(`result.history.failed`))]}),(0,$.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5 text-xs`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`accent-primary`,checked:h,onChange:e=>g(e.target.checked)}),t(`result.history.thisTab`)]}),(0,$.jsx)(`div`,{className:`flex-1`}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:t(`result.history.count`,{count:C.length})}),(0,$.jsxs)(`button`,{type:`button`,className:`flex h-7 items-center gap-1 rounded border bg-background px-2 text-xs text-muted-foreground hover:text-destructive`,onClick:()=>void x(),children:[(0,$.jsx)(G8,{className:`size-3`}),t(`result.history.clear`)]})]}),(0,$.jsx)(f5,{className:`min-h-0 flex-1`,children:C.length===0?(0,$.jsx)(`div`,{className:`p-6 text-center text-sm text-muted-foreground`,children:t(`result.history.noMatch`)}):w.map(e=>(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`sticky top-0 z-10 border-b bg-background/95 px-3 py-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground backdrop-blur`,children:e.label}),(0,$.jsx)(`div`,{className:`divide-y divide-border/60 text-sm`,children:e.entries.map(e=>{let n=e.kind?.toUpperCase();return(0,$.jsxs)(`div`,{className:`group/row flex items-start gap-2 px-3 py-2 hover:bg-muted/50`,children:[(0,$.jsx)(`div`,{className:`mt-0.5 flex-shrink-0`,children:e.success?(0,$.jsx)(k8,{className:`size-4 text-green-500`}):(0,$.jsx)(A8,{className:`size-4 text-destructive`})}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 cursor-pointer`,onClick:()=>_(e.id,e.query),title:e.query,children:[(0,$.jsx)(`p`,{className:`break-words font-mono text-xs text-foreground`,children:e4e(e.query)}),(0,$.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-[11px] text-muted-foreground`,children:[(0,$.jsx)(`span`,{className:`tabular-nums`,children:$2e(e.timestamp)}),n&&(0,$.jsx)(`span`,{className:`rounded px-1 text-[9px] font-semibold ${r4e[n]??`bg-muted`}`,children:n}),e.database&&(0,$.jsx)(`span`,{className:`font-mono`,children:e.database}),e.rowCount!=null&&(0,$.jsxs)(`span`,{className:`flex items-center gap-0.5`,children:[(0,$.jsx)(H8,{className:`size-3`}),t(`result.history.rows`,{count:e.rowCount})]}),e.affectedRows!=null&&e.affectedRows>0&&(0,$.jsxs)(`span`,{className:`flex items-center gap-0.5`,children:[(0,$.jsx)(z8,{className:`size-3`}),t(`result.history.affected`,{count:e.affectedRows})]}),(0,$.jsxs)(`span`,{className:`flex items-center gap-0.5 tabular-nums`,children:[(0,$.jsx)(j8,{className:`size-3`}),t4e(e.executionTime)]})]}),e.error&&(0,$.jsx)(`p`,{className:`mt-0.5 break-words text-xs text-destructive`,children:e.error})]}),(0,$.jsxs)(`div`,{className:`mt-0.5 flex flex-shrink-0 items-center gap-0.5 opacity-0 group-hover/row:opacity-100`,children:[(0,$.jsx)(`button`,{type:`button`,className:`rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground`,title:t(`result.history.insert`),onClick:()=>v(e.id,e.query),children:(0,$.jsx)(lYe,{className:`size-3.5`})}),(0,$.jsx)(`button`,{type:`button`,className:`rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground`,title:t(`result.history.copy`),onClick:()=>_(e.id,e.query),children:l===e.id?(0,$.jsx)(E8,{className:`size-3.5 text-green-500`}):(0,$.jsx)(N8,{className:`size-3.5`})})]})]},e.id)})})]},e.key))})]})}var a4e=[];function o4e({connectionId:e,tabId:t}){let{t:n}=S(),r=We(t=>t.tabs[e]??Ge).find(e=>e.id===t),i=r?.results??a4e,[a,o]=(0,D.useState)({results:i,closed:new Set,activeTab:null}),s=a.results===i?a:{results:i,closed:new Set,activeTab:null},c=s.closed,l=(0,D.useMemo)(()=>i.map((e,t)=>({result:e,index:t})).filter(e=>e.result.fields.length>0),[i]),u=(0,D.useMemo)(()=>l.filter(e=>!c.has(e.index)),[l,c]),d=s.activeTab??(l.length>0?`result-${l[0].index}`:`message`),f=(0,D.useCallback)(e=>{o(t=>({...t.results===i?t:{results:i,closed:new Set},activeTab:e}))},[i]),p=(0,D.useRef)(!1);(0,D.useEffect)(()=>{if(p.current)return;let n=r?.sourceTable;!n||i.length>0||r?.isExecuting||(p.current=!0,We.getState().setExecuting(e,t,!0),(async()=>{try{let r=await v5(e,{database:n.database,table:n.table,tabId:t,page:0});r.sourceTable=n,We.getState().setResults(e,t,[r])}catch(n){let r=n instanceof Error?n.message:String(n);We.getState().setError(e,t,r)}})())},[r?.sourceTable,r?.isExecuting,i,e,t]);let m=(0,D.useCallback)((e,t)=>{e.stopPropagation(),o(e=>{let n=e.results===i?e:{results:i,closed:new Set,activeTab:null},r=new Set(n.closed);r.add(t);let a=d===`result-${t}`;return{results:i,closed:r,activeTab:a?`message`:n.activeTab}})},[i,d]);return(0,$.jsxs)(T5,{value:d,onValueChange:f,className:`flex h-full flex-col`,children:[(0,$.jsxs)(E5,{className:`h-8 w-full justify-start rounded-none border-b bg-muted/30`,children:[(0,$.jsx)(D5,{value:`message`,className:`h-7 !rounded-sm !border-0 px-3 text-xs !text-muted-foreground hover:!text-foreground data-[state=active]:!bg-primary data-[state=active]:!text-primary-foreground data-[state=active]:font-semibold data-[state=active]:!shadow-none after:!hidden`,children:n(`result.tabs.message`)}),(0,$.jsx)(D5,{value:`info`,className:`h-7 !rounded-sm !border-0 px-3 text-xs !text-muted-foreground hover:!text-foreground data-[state=active]:!bg-primary data-[state=active]:!text-primary-foreground data-[state=active]:font-semibold data-[state=active]:!shadow-none after:!hidden`,children:n(`result.tabs.info`)}),(0,$.jsx)(D5,{value:`history`,className:`h-7 !rounded-sm !border-0 px-3 text-xs !text-muted-foreground hover:!text-foreground data-[state=active]:!bg-primary data-[state=active]:!text-primary-foreground data-[state=active]:font-semibold data-[state=active]:!shadow-none after:!hidden`,children:n(`result.tabs.history`)}),u.map((e,t)=>(0,$.jsxs)(D5,{value:`result-${e.index}`,className:`h-7 gap-1 !rounded-sm !border-0 px-3 text-xs !text-muted-foreground hover:!text-foreground data-[state=active]:!bg-primary data-[state=active]:!text-primary-foreground data-[state=active]:font-semibold data-[state=active]:!shadow-none after:!hidden`,children:[(0,$.jsx)(`span`,{children:l.length===1?n(`result.tabs.result`):n(`result.tabs.resultN`,{n:t+1})}),(0,$.jsx)(`button`,{type:`button`,className:`ml-0.5 rounded p-0.5 opacity-60 hover:bg-muted hover:opacity-100`,onClick:t=>m(t,e.index),children:(0,$.jsx)(b,{className:`size-3`})})]},`result-${e.index}`))]}),(0,$.jsx)(O5,{value:`message`,className:`mt-0 flex-1 overflow-hidden`,children:(0,$.jsx)(AZe,{connectionId:e,tabId:t})}),(0,$.jsx)(O5,{value:`info`,className:`mt-0 flex-1 overflow-hidden`,children:(0,$.jsx)(Q2e,{connectionId:e,tabId:t})}),(0,$.jsx)(O5,{value:`history`,className:`mt-0 flex-1 overflow-hidden`,children:(0,$.jsx)(i4e,{connectionId:e})}),u.map(n=>(0,$.jsx)(O5,{value:`result-${n.index}`,className:`mt-0 flex-1 overflow-hidden`,children:(0,$.jsx)(X2e,{connectionId:e,tabId:t,resultIndex:n.index})},`result-${n.index}`))]})}function s4e({connectionId:e,tabId:t}){let[n,r]=(0,D.useState)(300),[i,a]=(0,D.useState)(!1),o=(0,D.useRef)(null),s=(0,D.useCallback)(e=>{e.preventDefault(),a(!0)},[]);return(0,D.useEffect)(()=>{if(!i)return;let e=e=>{if(!o.current)return;let t=o.current.getBoundingClientRect().bottom-e.clientY;r(Math.min(600,Math.max(100,t)))},t=()=>{a(!1)};return document.addEventListener(`mousemove`,e),document.addEventListener(`mouseup`,t),()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,t)}},[i]),(0,$.jsxs)(`div`,{ref:o,className:`flex h-full flex-col`,style:{userSelect:i?`none`:void 0},children:[(0,$.jsx)(`div`,{className:`min-h-[100px] flex-1`,children:(0,$.jsx)(EZe,{connectionId:e,tabId:t})}),(0,$.jsx)(`div`,{onMouseDown:s,className:`h-1 flex-shrink-0 cursor-row-resize transition-colors ${i?`bg-catppuccin-blue/40`:`bg-catppuccin-surface1 hover:bg-catppuccin-blue/30 active:bg-catppuccin-blue/40`}`}),(0,$.jsx)(`div`,{className:`flex-shrink-0 overflow-hidden`,style:{height:n},children:(0,$.jsx)(o4e,{connectionId:e,tabId:t})})]})}async function c4e(e,t){let n=qt(e),r=mt(e),{introspect:i}=n,a=await i.listTables(r,t),o=a.map(e=>e.name),[s,c,l]=await Promise.all([i.listAllColumns(r,t),i.listAllIndexes(r,t).catch(()=>new Map),i.listForeignKeys(r,t).catch(()=>[])]),u=new Set;for(let e of l)u.add(`${e.table}.${e.column}`);let d=new Set;for(let[e,t]of c)for(let n of t)n.type===`UNIQUE`&&n.columns.length===1&&d.add(`${e}.${n.columns[0]}`);let f=a.map(e=>({name:e.name,kind:`model`,x:0,y:0,comment:e.comment,columns:(s.get(e.name)??[]).map(t=>{let n=`${e.name}.${t.name}`,r=[];return t.key===`PRI`&&r.push(`PK`),u.has(n)&&r.push(`FK`),d.has(n)&&t.key!==`PRI`&&r.push(`UK`),{type:t.type+(t.extra.includes(`auto_increment`)?` AI`:``),name:t.name,badge:r.length>0?r[0]:null,badges:r,comment:t.comment||(t.nullable?`?`:``)}})})),p=new Set(o),m=new Set,h=[];for(let e of l){let{table:t,column:n,refTable:r}=e;if(!t||!r||!p.has(t)||!p.has(r)||t===r)continue;let i=`${t}->${r}:${n}`,a=`${r}->${t}:${n}`;m.has(i)||m.has(a)||(m.add(i),h.push({from:t,to:r,type:`1:N`,label:n}))}return{models:f,relations:h}}var C9=[70,170,180];function w9(e){return 52+e.columns.length*22+4}function T9(e){return e.reduce((e,t)=>e+t,0)+20}var l4e=2.399963229728653,E9=50,u4e=50,D9=56,O9=T9(C9),d4e=120;function f4e(e,t){let n=e.length,r=e.map(e=>({w:O9,h:w9(e)})),i=r.reduce((e,t)=>e+t.h,0)/n,a=Math.max(O9,i)*.32+24,o=e.map((e,t)=>{let n=a*.55*Math.sqrt(t+.5);return{x:Math.cos(t*l4e)*n,y:Math.sin(t*l4e)*n}}),s=a*1.8,c=s/321,l=o.map(()=>({x:0,y:0}));for(let e=0;e<320;e++){for(let e=0;e<n;e++)l[e].x=0,l[e].y=0;for(let e=0;e<n;e++)for(let t=e+1;t<n;t++){let n=o[e].x-o[t].x,r=o[e].y-o[t].y,i=Math.hypot(n,r)||.01,s=.28*a*a/i,c=n/i,u=r/i;l[e].x+=c*s,l[e].y+=u*s,l[t].x-=c*s,l[t].y-=u*s}for(let[e,n]of t){let t=o[e].x-o[n].x,r=o[e].y-o[n].y,i=Math.hypot(t,r)||.01,s=i*i/a,c=t/i,u=r/i;l[e].x-=c*s,l[e].y-=u*s,l[n].x+=c*s,l[n].y+=u*s}for(let e=0;e<n;e++)l[e].x-=o[e].x*.1,l[e].y-=o[e].y*.1;for(let e=0;e<n;e++){let t=Math.hypot(l[e].x,l[e].y)||.01,n=Math.min(t,s);o[e].x+=l[e].x/t*n,o[e].y+=l[e].y/t*n}s=Math.max(s-c,a*.05)}let u=r.map(e=>({hw:e.w/2+D9/2,hh:e.h/2+D9/2}));for(let e=0;e<80;e++){let e=!1;for(let t=0;t<n;t++)for(let r=t+1;r<n;r++){let n=o[r].x-o[t].x,i=o[r].y-o[t].y,a=u[t].hw+u[r].hw-Math.abs(n),s=u[t].hh+u[r].hh-Math.abs(i);if(a>0&&s>0){if(e=!0,a<s){let e=(n<0?-1:1)*a/2;o[t].x-=e,o[r].x+=e}else{let e=(i<0?-1:1)*s/2;o[t].y-=e,o[r].y+=e}}}if(!e)break}let d=1/0,f=1/0;for(let e=0;e<n;e++)d=Math.min(d,o[e].x-r[e].w/2),f=Math.min(f,o[e].y-r[e].h/2);return e.map((e,t)=>({x:o[t].x-r[t].w/2-d,y:o[t].y-r[t].h/2-f}))}function p4e(e){let t=Math.max(1,Math.round(Math.sqrt(e.length))),n=Array(t).fill(0);return e.map(e=>{let r=0;for(let e=1;e<t;e++)n[e]<n[r]&&(r=e);let i={x:r*(O9+D9),y:n[r]};return n[r]+=w9(e)+D9,i})}function k9(e,t,n){let r=[...e,...t];if(r.length===0)return;let i=new Map(r.map((e,t)=>[e.name,t])),a=Array(r.length).fill(0),o=[];n.forEach(e=>{let t=i.get(e.from),n=i.get(e.to);t!==void 0&&n!==void 0&&t!==n&&(o.push([t,n]),a[t]++,a[n]++)});let s=r.filter((e,t)=>a[t]>0),c=r.filter((e,t)=>a[t]===0),l=E9;if(s.length>0){let e=new Map(s.map((e,t)=>[e.name,t])),t=f4e(s,o.map(([t,n])=>[e.get(r[t].name),e.get(r[n].name)]).filter(([e,t])=>e!==void 0&&t!==void 0));s.forEach((e,n)=>{e.x=Math.round(E9+t[n].x),e.y=Math.round(u4e+t[n].y),l=Math.max(l,e.x+O9)})}if(c.length>0){let e=s.length>0?l+d4e:E9,t=p4e(c);c.forEach((n,r)=>{n.x=Math.round(e+t[r].x),n.y=Math.round(u4e+t[r].y)})}}function m4e(e,t){return`${e.targetConnectionId?`${t.connectionName(e.targetConnectionId)} · ${e.targetDatabase}`:e.targetDatabase}.${e.targetTable}`}function h4e(e,t,n,r){let i=new Map(e.map(e=>[e.name,e])),a=new Set(t.map(e=>`${e.from}->${e.to}:${e.label}`)),o=[...e],s=[...t],c=new Map;for(let e of n.filter(e=>e.database===r.database)){let t=i.get(e.table);if(!t)continue;let n=!e.targetConnectionId&&e.targetDatabase===r.database,l;if(n&&i.has(e.targetTable))l=e.targetTable;else{l=m4e(e,r);let n=c.get(l);n||(n={name:l,kind:`model`,external:e.targetConnectionId?r.connectionName(e.targetConnectionId):e.targetDatabase,x:t.x+T9(C9)+120,y:t.y,comment:``,columns:[]},c.set(l,n),o.push(n)),n.columns.some(t=>t.name===e.targetColumn)||n.columns.push({type:``,name:e.targetColumn,badge:`PK`,badges:[`PK`],comment:``})}if(e.table===l)continue;let u=`${e.table}->${l}:${e.column}`;a.has(u)||(a.add(u),s.push({from:e.table,to:l,type:`1:N`,label:e.column,virtual:!0}))}return{models:o,relations:s}}function g4e({zoom:e,database:t,tableCount:n,relationCount:r,fieldCount:i,onZoomIn:a,onZoomOut:o,onResetView:s,onCenter:c,onFitAll:l,onSpreadAll:u,onResetLayout:d,onRefresh:f}){let{t:p}=S();return(0,$.jsxs)(`div`,{className:`relative z-10 flex flex-wrap items-center gap-1.5 border-b px-4 py-1.5`,style:{background:`var(--t-mantle)`,borderColor:`var(--t-surface1)`},children:[t&&(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold`,style:{color:`var(--t-yellow)`},children:[(0,$.jsx)(P8,{className:`size-3.5`}),t]}),(0,$.jsxs)(te,{variant:`outline`,size:`sm`,className:`h-7 gap-1 px-2.5 text-xs`,style:{borderColor:`var(--t-green)`,color:`var(--t-green)`},onClick:f,children:[(0,$.jsx)(V8,{className:`size-3.5`}),p(`erd.toolbar.refresh`)]}),(0,$.jsx)(`div`,{className:`mx-1 h-5 w-px`,style:{background:`var(--t-surface1)`}}),(0,$.jsxs)(te,{variant:`outline`,size:`sm`,className:`h-7 px-2 text-xs`,onClick:a,children:[(0,$.jsx)(BYe,{className:`mr-1 size-3.5`}),` `,p(`erd.toolbar.zoomIn`)]}),(0,$.jsxs)(te,{variant:`outline`,size:`sm`,className:`h-7 px-2 text-xs`,onClick:o,children:[(0,$.jsx)(VYe,{className:`mr-1 size-3.5`}),` `,p(`erd.toolbar.zoomOut`)]}),(0,$.jsxs)(te,{variant:`outline`,size:`sm`,className:`h-7 px-2 text-xs`,onClick:s,children:[(0,$.jsx)(TYe,{className:`mr-1 size-3.5`}),` `,p(`erd.toolbar.resetView`)]}),(0,$.jsxs)(te,{variant:`outline`,size:`sm`,className:`h-7 px-2 text-xs`,onClick:c,children:[(0,$.jsx)(cYe,{className:`mr-1 size-3.5`}),` `,p(`erd.toolbar.center`)]}),(0,$.jsxs)(te,{variant:`outline`,size:`sm`,className:`h-7 px-2 text-xs`,onClick:l,children:[(0,$.jsx)(yYe,{className:`mr-1 size-3.5`}),` `,p(`erd.toolbar.fitAll`)]}),(0,$.jsxs)(`span`,{className:`ml-1 text-xs`,style:{color:`var(--t-overlay0)`},children:[Math.round(e*100),`%`]}),(0,$.jsx)(`div`,{className:`mx-1 h-5 w-px`,style:{background:`var(--t-surface1)`}}),(0,$.jsxs)(te,{variant:`outline`,size:`sm`,className:`h-7 px-2 text-xs`,style:{background:`var(--t-blue)`,color:`var(--t-crust)`,borderColor:`var(--t-blue)`},onClick:u,children:[(0,$.jsx)(_Ye,{className:`mr-1 size-3.5`}),` `,p(`erd.toolbar.spreadAll`)]}),(0,$.jsxs)(te,{variant:`outline`,size:`sm`,className:`h-7 px-2 text-xs`,style:{background:`var(--t-red)`,color:`var(--t-crust)`,borderColor:`var(--t-red)`},onClick:d,children:[(0,$.jsx)(G8,{className:`mr-1 size-3.5`}),` `,p(`erd.toolbar.resetLayout`)]}),(0,$.jsxs)(`div`,{className:`ml-auto flex items-center gap-4 text-[11px]`,style:{color:`var(--t-overlay0)`},children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`span`,{className:`inline-block h-0.5 w-[30px]`,style:{background:`var(--t-red)`}}),`1:1`]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`span`,{className:`inline-block h-0.5 w-[30px]`,style:{background:`var(--t-blue)`}}),p(`erd.toolbar.legendOneToMany`)]}),n>0&&(0,$.jsxs)(`div`,{className:`flex items-center gap-3 text-[11px]`,style:{color:`var(--t-overlay0)`},children:[(0,$.jsxs)(`span`,{children:[p(`erd.toolbar.tables`),` `,(0,$.jsx)(`span`,{className:`font-semibold`,style:{color:`var(--t-foreground)`},children:n})]}),(0,$.jsxs)(`span`,{children:[p(`erd.toolbar.relations`),` `,(0,$.jsx)(`span`,{className:`font-semibold`,style:{color:`var(--t-foreground)`},children:r})]}),(0,$.jsxs)(`span`,{children:[p(`erd.toolbar.columns`),` `,(0,$.jsx)(`span`,{className:`font-semibold`,style:{color:`var(--t-foreground)`},children:i})]})]})]})]})}function _4e({name:e,kind:t,external:n,onDragStart:r}){let{t:i}=S(),a=i(n?`erd.entity.linkBadge`:t===`enum`?`erd.entity.enumBadge`:`erd.entity.modelBadge`),o=n?`var(--t-yellow)`:t===`enum`?`var(--t-peach)`:`var(--t-mauve)`;return(0,$.jsxs)(`div`,{className:`flex items-center justify-between rounded-t-md border-b-2 px-3 py-2 text-[13px] font-bold`,style:{background:`var(--t-surface1)`,borderColor:`var(--t-surface2, var(--t-overlay0))`,color:`var(--t-mauve)`,cursor:`grab`},onMouseDown:r,children:[(0,$.jsx)(`span`,{title:n?i(`erd.entity.externalTitle`,{location:n}):void 0,children:e}),(0,$.jsx)(`span`,{className:`rounded px-1.5 py-px text-[9px] font-semibold`,style:{background:o,color:`var(--t-base)`},children:a})]})}function v4e(e){switch(e){case`PK`:return`var(--t-red)`;case`FK`:return`var(--t-peach)`;case`UK`:return`var(--t-green)`;default:return`var(--t-overlay0)`}}function y4e({entity:e,colWidths:t,onColResizeStart:n}){let{t:r}=S(),i=e.kind===`enum`;return(0,$.jsx)(`div`,{className:`overflow-hidden p-0`,children:(0,$.jsxs)(`table`,{className:`w-full border-collapse text-[11px]`,style:{tableLayout:`fixed`},children:[(0,$.jsxs)(`colgroup`,{children:[(0,$.jsx)(`col`,{style:{width:t[0]+`px`}}),(0,$.jsx)(`col`,{style:{width:t[1]+`px`}}),(0,$.jsx)(`col`,{style:{width:t[2]+`px`}})]}),(0,$.jsx)(`thead`,{children:(0,$.jsx)(`tr`,{children:i?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`th`,{className:`relative px-2.5 py-1 text-left text-[10px] font-semibold uppercase`,style:{background:`var(--t-surface1)`,color:`var(--t-subtext0)`},children:[r(`erd.entity.columns.value`),n&&(0,$.jsx)(`div`,{className:`absolute right-[-3px] top-0 z-10 h-full w-1.5 cursor-col-resize hover:opacity-40`,style:{background:`transparent`},onMouseDown:t=>n(t,e.name,0)})]}),(0,$.jsxs)(`th`,{className:`relative px-2.5 py-1 text-left text-[10px] font-semibold uppercase`,style:{background:`var(--t-surface1)`,color:`var(--t-subtext0)`},children:[r(`erd.entity.columns.comment`),n&&(0,$.jsx)(`div`,{className:`absolute right-[-3px] top-0 z-10 h-full w-1.5 cursor-col-resize hover:opacity-40`,style:{background:`transparent`},onMouseDown:t=>n(t,e.name,1)})]}),(0,$.jsx)(`th`,{className:`px-2.5 py-1 text-left text-[10px] font-semibold uppercase`,style:{background:`var(--t-surface1)`,color:`var(--t-subtext0)`}})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`th`,{className:`relative px-2.5 py-1 text-left text-[10px] font-semibold uppercase`,style:{background:`var(--t-surface1)`,color:`var(--t-subtext0)`},children:[r(`erd.entity.columns.type`),n&&(0,$.jsx)(`div`,{className:`absolute right-[-3px] top-0 z-10 h-full w-1.5 cursor-col-resize hover:opacity-40`,style:{background:`transparent`},onMouseDown:t=>n(t,e.name,0)})]}),(0,$.jsxs)(`th`,{className:`relative px-2.5 py-1 text-left text-[10px] font-semibold uppercase`,style:{background:`var(--t-surface1)`,color:`var(--t-subtext0)`},children:[r(`erd.entity.columns.column`),n&&(0,$.jsx)(`div`,{className:`absolute right-[-3px] top-0 z-10 h-full w-1.5 cursor-col-resize hover:opacity-40`,style:{background:`transparent`},onMouseDown:t=>n(t,e.name,1)})]}),(0,$.jsx)(`th`,{className:`px-2.5 py-1 text-left text-[10px] font-semibold uppercase`,style:{background:`var(--t-surface1)`,color:`var(--t-subtext0)`},children:r(`erd.entity.columns.comment`)})]})})}),(0,$.jsx)(`tbody`,{children:e.columns.map((t,n)=>(0,$.jsx)(`tr`,{style:{borderBottom:n<e.columns.length-1?`1px solid var(--t-surface1)`:`none`},children:i?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`td`,{className:`overflow-hidden text-ellipsis whitespace-nowrap px-2.5 py-[3px]`,style:{color:`var(--t-yellow)`,lineHeight:1.5},children:t.name}),(0,$.jsx)(`td`,{className:`overflow-hidden text-ellipsis whitespace-nowrap px-2.5 py-[3px] text-[10px]`,style:{color:`var(--t-overlay0)`,lineHeight:1.5},colSpan:2,children:t.comment})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`td`,{className:`overflow-hidden text-ellipsis whitespace-nowrap px-2.5 py-[3px]`,style:{color:`var(--t-blue)`,lineHeight:1.5},children:t.type.replace(`?`,``)}),(0,$.jsxs)(`td`,{className:`overflow-hidden text-ellipsis whitespace-nowrap px-2.5 py-[3px]`,style:{color:`var(--t-text)`,lineHeight:1.5},children:[t.name,t.badges.map(e=>(0,$.jsx)(`span`,{className:`ml-1 inline-block rounded px-1 text-[9px] font-semibold`,style:{background:v4e(e),color:`var(--t-base)`},children:e},e)),t.type.endsWith(`?`)&&(0,$.jsx)(`span`,{className:`ml-1 inline-block rounded px-1 text-[9px] font-semibold`,style:{background:`var(--t-overlay0)`,color:`var(--t-subtext0)`},children:`?`})]}),(0,$.jsx)(`td`,{className:`overflow-hidden text-ellipsis whitespace-nowrap px-2.5 py-[3px] text-[10px]`,style:{color:`var(--t-overlay0)`,lineHeight:1.5},children:t.comment})]})},n))})]})})}function b4e({entity:e,colWidths:t,isSelected:n,onMouseDown:r,onColResizeStart:i}){let a=(0,D.useCallback)(t=>{r(t,e.name)},[r,e.name]),o=t.reduce((e,t)=>e+t,0)+20,s=n?`var(--t-yellow)`:e.kind===`enum`?`var(--t-peach)`:`var(--t-overlay0)`;return(0,$.jsxs)(`div`,{className:`absolute select-none rounded-lg`,style:{left:e.x,top:e.y,width:Math.max(o,200),minWidth:200,background:`var(--t-base)`,border:`2px solid ${s}`,boxShadow:n?`0 8px 24px rgba(0,0,0,0.6)`:`0 4px 12px rgba(0,0,0,0.4)`,zIndex:n?1e3:1,transition:`box-shadow 0.15s`},onMouseEnter:t=>{if(!n){let n=t.currentTarget;n.style.borderColor=e.kind===`enum`?`var(--t-yellow)`:`var(--t-blue)`}},onMouseLeave:t=>{if(!n){let n=t.currentTarget;n.style.borderColor=e.kind===`enum`?`var(--t-peach)`:`var(--t-overlay0)`}},children:[(0,$.jsx)(_4e,{name:e.name,kind:e.kind,external:e.external,onDragStart:a}),(0,$.jsx)(y4e,{entity:e,colWidths:t,onColResizeStart:i})]})}function x4e(e,t){return e[t]||[...C9]}function S4e(e,t){let n=T9(x4e(t,e.name)),r=w9(e);return{x:e.x,y:e.y,w:n,h:r,cx:e.x+n/2,cy:e.y+r/2}}function C4e({entities:e,relations:t,entityWidths:n}){let r=(()=>{if(e.length===0)return null;let r=new Map;e.forEach(e=>r.set(e.name,e));let i=1/0,a=1/0,o=-1/0,s=-1/0;e.forEach(e=>{let t=x4e(n,e.name);i=Math.min(i,e.x-200),a=Math.min(a,e.y-200),o=Math.max(o,e.x+T9(t)+200),s=Math.max(s,e.y+w9(e)+200)});let c=o-i,l=s-a,u={};function d(e,t){let n=`${e}_${t}`;return u[n]||(u[n]=0),(u[n]++-1)*16}let f=[];return t.forEach(e=>{let t=r.get(e.from),i=r.get(e.to);if(!t||!i)return;let a=S4e(t,n),o=S4e(i,n),s,c,l,u,p=o.cx-a.cx,m=o.cy-a.cy;if(Math.abs(p)>Math.abs(m)){if(p>0){let t=d(e.from,`right`),n=d(e.to,`left`);s=a.x+a.w+16,c=a.y+40+t,l=o.x-16,u=o.y+40+n}else{let t=d(e.from,`left`),n=d(e.to,`right`);s=a.x-16,c=a.y+40+t,l=o.x+o.w+16,u=o.y+40+n}}else if(m>0){let t=d(e.from,`bottom`),n=d(e.to,`top`);s=a.x+60+t,c=a.y+a.h+16,l=o.x+60+n,u=o.y-16}else{let t=d(e.from,`top`),n=d(e.to,`bottom`);s=a.x+60+t,c=a.y-16,l=o.x+60+n,u=o.y+o.h+16}let h=e.type===`1:1`?`var(--t-red)`:`var(--t-blue)`,g=e.type===`1:1`?`url(#erd-one)`:`url(#erd-crowfoot)`,_=(s+l)/2,v=(c+u)/2,y=Math.abs(p)>Math.abs(m)?`M${s},${c} C${_},${c} ${_},${u} ${l},${u}`:`M${s},${c} C${s},${v} ${l},${v} ${l},${u}`;f.push({d:y,color:h,markerEnd:g,label:`${e.virtual?`⇢ `:``}${e.type} ${e.label}`,midX:_,midY:v,virtual:!!e.virtual})}),{minX:i,minY:a,svgW:c,svgH:l,paths:f}})();if(!r)return null;let{minX:i,minY:a,svgW:o,svgH:s,paths:c}=r;return(0,$.jsxs)(`svg`,{className:`pointer-events-none absolute left-0 top-0`,style:{left:i,top:a},width:o,height:s,viewBox:`${i} ${a} ${o} ${s}`,children:[(0,$.jsxs)(`defs`,{children:[(0,$.jsxs)(`marker`,{id:`erd-crowfoot`,viewBox:`0 0 12 12`,refX:`12`,refY:`6`,markerWidth:`10`,markerHeight:`10`,orient:`auto`,children:[(0,$.jsx)(`line`,{x1:`0`,y1:`0`,x2:`12`,y2:`6`,stroke:`var(--t-blue)`,strokeWidth:`1.5`}),(0,$.jsx)(`line`,{x1:`0`,y1:`12`,x2:`12`,y2:`6`,stroke:`var(--t-blue)`,strokeWidth:`1.5`}),(0,$.jsx)(`line`,{x1:`0`,y1:`6`,x2:`12`,y2:`6`,stroke:`var(--t-blue)`,strokeWidth:`1.5`})]}),(0,$.jsxs)(`marker`,{id:`erd-one`,viewBox:`0 0 12 12`,refX:`12`,refY:`6`,markerWidth:`8`,markerHeight:`8`,orient:`auto`,children:[(0,$.jsx)(`line`,{x1:`8`,y1:`0`,x2:`8`,y2:`12`,stroke:`var(--t-red)`,strokeWidth:`2`}),(0,$.jsx)(`line`,{x1:`12`,y1:`0`,x2:`12`,y2:`12`,stroke:`var(--t-red)`,strokeWidth:`2`})]})]}),c.map((e,t)=>(0,$.jsxs)(`g`,{children:[(0,$.jsx)(`path`,{d:e.d,stroke:e.color,strokeWidth:`1.5`,fill:`none`,markerEnd:e.markerEnd,opacity:`0.7`,strokeDasharray:e.virtual?`6 4`:void 0}),(0,$.jsx)(`text`,{x:e.midX,y:e.midY-6,textAnchor:`middle`,fill:`var(--t-overlay0)`,fontSize:`10`,children:e.label})]},t))]})}function w4e(e){let t=nt.getState(),n=t.selectedNodeId[e],r=t.trees[e];if(!r)return null;let i=null,a=null;function o(e){for(let t of e){let e=t.metadata?.database;e&&a===null&&(t.type===Wt.DATABASE||t.type===Wt.SCHEMA)&&(a=e),t.id===n&&e&&(i=e),t.children.length>0&&o(t.children)}}return o(r),i??a}function T4e({connectionId:e}){let{t}=S(),[n,r]=(0,D.useState)([]),[i,a]=(0,D.useState)([]),[o,s]=(0,D.useState)(1),[c,l]=(0,D.useState)(0),[u,d]=(0,D.useState)(0),[f,p]=(0,D.useState)(null),[m,h]=(0,D.useState)({}),[g,_]=(0,D.useState)(null),[v,y]=(0,D.useState)(!1),[b,x]=(0,D.useState)(null),[,C]=(0,D.useState)(0),w=(0,D.useRef)(null),T=(0,D.useRef)(null),ee=(0,D.useRef)(!1),E=(0,D.useRef)({x:0,y:0}),te=(0,D.useRef)({x:0,y:0}),ne=(0,D.useRef)(1),re=(0,D.useRef)(null),ie=(0,D.useRef)(null),ae=(0,D.useRef)([]),oe=(0,D.useRef)({}),se=(0,D.useRef)(null),ce=(0,D.useRef)(null),le=r5(e=>e.links),ue=(0,D.useCallback)((t,n)=>{let r=(r5.getState().links[e]??[]).filter(e=>e.database===n);return r.length===0?{models:[...t.models],relations:[...t.relations]}:h4e(t.models.map(e=>({...e})),t.relations,r,{connectionId:e,database:n,connectionName:e=>{let t=Ue.getState().activeConnections.find(t=>t.id===e)??Ue.getState().savedConnections.find(t=>t.id===e);return t?t.hostName||t.host||t.file||t.id:e}})},[e]);(0,D.useEffect)(()=>{let e=ce.current,t=se.current;if(!e||!t)return;let n=ue(e,t),i=new Map(ae.current.map(e=>[e.name,{x:e.x,y:e.y}]));for(let e of n.models){let t=i.get(e.name);t&&(e.x=t.x,e.y=t.y)}ae.current=n.models,r(n.models),a(n.relations)},[le]),ae.current=n,oe.current=m,ne.current=o,te.current={x:c,y:u},se.current=g;let de=(0,D.useCallback)(e=>oe.current[e]||[...C9],[]),fe=(0,D.useCallback)(()=>{let e={};ae.current.forEach(t=>{e[t.name]={x:t.x,y:t.y}}),e5.getState().savePositions(se.current,e)},[]),pe=(0,D.useCallback)(()=>{e5.getState().saveColumnWidths(se.current,oe.current)},[]),me=(0,D.useCallback)(e=>{let t=e5.getState().getPositions(se.current);return t?(e.forEach(e=>{t[e.name]&&(e.x=t[e.name].x,e.y=t[e.name].y)}),!0):!1},[]),he=(0,D.useCallback)(()=>e5.getState().getColumnWidths(se.current),[]),ge=(0,D.useCallback)(()=>{let e=ae.current;if(e.length===0)return;let t=w.current;if(!t)return;let n=1/0,r=1/0,i=-1/0,a=-1/0;e.forEach(e=>{let t=de(e.name);n=Math.min(n,e.x),r=Math.min(r,e.y),i=Math.max(i,e.x+T9(t)),a=Math.max(a,e.y+w9(e))});let o=i-n+80,c=a-r+80,u=t.clientWidth,f=t.clientHeight,p=Math.min(u/o,f/c,1),m=(u-o*p)/2-n*p+40,h=(f-c*p)/2-r*p+40;s(p),l(m),d(h)},[de]),_e=(0,D.useCallback)(()=>{let e=ae.current;if(e.length===0)return;let t=w.current;if(!t)return;let n=1/0,r=1/0,i=-1/0,a=-1/0;e.forEach(e=>{let t=de(e.name);n=Math.min(n,e.x),r=Math.min(r,e.y),i=Math.max(i,e.x+T9(t)),a=Math.max(a,e.y+w9(e))});let o=i-n+80,s=a-r+80,c=t.clientWidth,u=t.clientHeight,f=ne.current;l((c-o*f)/2-n*f+40),d((u-s*f)/2-r*f+40)},[de]),ve=(0,D.useCallback)(async n=>{let i=Ue.getState().activeConnections.find(t=>t.id===e)?.serverConnectionId;if(!i){x(t(`erd.viewer.noServerConnection`));return}y(!0),x(null),_(n),se.current=n,e5.getState().setDatabase(e,n);try{let e=await c4e(i,n);ce.current=e;let{models:t,relations:o}=ue(e,n);k9(t,[],o),me(t);let s=he();r([...t]),a(o),h(s),ae.current=t,oe.current=s,setTimeout(()=>ge(),100)}catch(e){x(e instanceof Error?e.message:String(e))}finally{y(!1)}},[e,me,he,ge,t]);(0,D.useEffect)(()=>{let t=e5.getState().database[e]||w4e(e);t&&ve(t)},[e]);let ye=(0,D.useCallback)(()=>{let t=g||w4e(e);t&&ve(t)},[g,e,ve]),be=(0,D.useCallback)((e,t)=>{e.stopPropagation();let n=w.current;if(!n)return;let r=ae.current.find(e=>e.name===t);if(!r)return;let i=n.getBoundingClientRect(),a=(e.clientX-i.left-te.current.x)/ne.current,o=(e.clientY-i.top-te.current.y)/ne.current;re.current={name:t,offsetX:a-r.x,offsetY:o-r.y},p(t)},[]),xe=(0,D.useCallback)((e,t,n)=>{e.stopPropagation(),e.preventDefault();let r=oe.current[t]||[...C9];ie.current={entityName:t,colIndex:n,startX:e.clientX,startWidth:r[n],nextStartWidth:r[n+1]},document.body.style.cursor=`col-resize`},[]),Se=(0,D.useCallback)(e=>{e.target.closest(`[data-entity]`)||e.button===0&&(ee.current=!0,E.current={x:e.clientX-te.current.x,y:e.clientY-te.current.y},p(null))},[]);(0,D.useEffect)(()=>{let e=e=>{if(ie.current){let t=ie.current,n=(e.clientX-t.startX)/ne.current,r=Math.max(30,Math.round(t.startWidth+n)),i=Math.max(30,Math.round(t.nextStartWidth-n));h(e=>{let n=[...e[t.entityName]||[...C9]];return n[t.colIndex]=r,n[t.colIndex+1]=i,{...e,[t.entityName]:n}});return}if(re.current){let t=w.current;if(!t)return;let n=t.getBoundingClientRect(),r=(e.clientX-n.left-te.current.x)/ne.current,i=(e.clientY-n.top-te.current.y)/ne.current,a=Math.round(r-re.current.offsetX),o=Math.round(i-re.current.offsetY),s=ae.current.find(e=>e.name===re.current.name);s&&(s.x=a,s.y=o,C(e=>e+1));return}ee.current&&(l(e.clientX-E.current.x),d(e.clientY-E.current.y))},t=()=>{if(ie.current){document.body.style.cursor=``,pe(),ie.current=null;return}if(re.current){re.current=null,fe();return}ee.current=!1};return window.addEventListener(`mousemove`,e),window.addEventListener(`mouseup`,t),()=>{window.removeEventListener(`mousemove`,e),window.removeEventListener(`mouseup`,t)}},[fe,pe]),(0,D.useEffect)(()=>{let e=w.current;if(!e)return;let t=t=>{t.preventDefault();let n=e.getBoundingClientRect(),r=t.clientX-n.left,i=t.clientY-n.top,a=ne.current,o=t.deltaY>0?.9:1/.9,c=Math.max(.15,Math.min(3,a*o));if(c===a)return;let u=(r-te.current.x)/a,f=(i-te.current.y)/a;l(r-u*c),d(i-f*c),s(c)};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[]);let Ce=(0,D.useCallback)(e=>{let t=w.current;if(!t)return;let n=t.getBoundingClientRect(),r=n.width/2,i=n.height/2,a=ne.current,o=Math.max(.15,Math.min(3,a*e));if(o===a)return;let c=(r-te.current.x)/a,u=(i-te.current.y)/a;l(r-c*o),d(i-u*o),s(o)},[]),we=(0,D.useCallback)(()=>Ce(1.15),[Ce]),Te=(0,D.useCallback)(()=>Ce(1/1.15),[Ce]),Ee=(0,D.useCallback)(()=>{s(1),l(0),d(0)},[]),De=(0,D.useCallback)(()=>{k9(ae.current,[],i),r([...ae.current]),fe(),setTimeout(()=>ge(),50)},[i,fe,ge]),Oe=(0,D.useCallback)(()=>{e5.getState().resetLayout(se.current),k9(ae.current,[],i),r([...ae.current]),h({}),setTimeout(()=>ge(),50)},[i,ge]),ke=n.length>0,Ae=n.reduce((e,t)=>e+t.columns.length,0);return(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsx)(g4e,{zoom:o,database:g,tableCount:n.length,relationCount:i.length,fieldCount:Ae,onZoomIn:we,onZoomOut:Te,onResetView:Ee,onCenter:_e,onFitAll:ge,onSpreadAll:De,onResetLayout:Oe,onRefresh:ye}),(0,$.jsxs)(`div`,{ref:w,className:`relative flex-1 overflow-hidden`,style:{cursor:ee.current?`grabbing`:`grab`,background:`var(--t-background)`},onMouseDown:Se,children:[v&&(0,$.jsx)(`div`,{className:`absolute inset-0 z-20 flex items-center justify-center bg-background/80`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,$.jsx)(R8,{className:`size-5 animate-spin`}),t(`erd.viewer.loading`,{database:g})]})}),b&&!v&&(0,$.jsx)(`div`,{className:`absolute inset-0 z-20 flex items-center justify-center`,children:(0,$.jsxs)(`div`,{className:`text-center text-sm text-destructive`,children:[(0,$.jsx)(`p`,{children:t(`erd.viewer.loadFailed`)}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:b})]})}),!ke&&!v&&!b&&(0,$.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,$.jsxs)(`div`,{className:`text-center text-sm text-muted-foreground`,children:[(0,$.jsx)(`p`,{children:t(`erd.viewer.noDatabase`)}),(0,$.jsx)(`p`,{className:`mt-1 text-xs`,children:t(`erd.viewer.selectDatabaseHint`)})]})}),ke&&(0,$.jsxs)(`div`,{ref:T,className:`absolute left-0 top-0`,style:{transformOrigin:`0 0`,transform:`translate(${c}px, ${u}px) scale(${o})`},children:[(0,$.jsx)(C4e,{entities:n,relations:i,entityWidths:m}),n.map(e=>(0,$.jsx)(b4e,{entity:e,colWidths:m[e.name]||[...C9],isSelected:f===e.name,onMouseDown:be,onColResizeStart:xe},e.name))]})]})]})}function E4e({connectionId:e}){let{t}=S(),n=We(t=>t.tabs[e]??Ge),r=We(t=>t.activeTabId[e]??null),i=e5(t=>t.open[e]??!1),a=We(e=>e.addQueryTab),o=We(e=>e.removeQueryTab),s=We(e=>e.removeQueryTabs),c=We(e=>e.setActiveQueryTab),l=r&&(n.some(e=>e.id===r)||r===`erd`&&i)?r:n.length>0?n[n.length-1].id:i?`erd`:null;(0,D.useEffect)(()=>{l&&l!==r&&c(e,l)},[l,r,e,c]);let u=(0,D.useRef)(null);yZe(u,l);let{loadChildren:d}=Et(),f=n.find(e=>e.id===l),p=f?.sourceTable?{database:f.sourceTable.database,type:`TABLE`,name:f.sourceTable.table}:f?.sourceObject??null,m=p?`${p.database}/${p.type}/${p.name}`:null;(0,D.useEffect)(()=>{p&&jt(e,Ot(e,p.database,p.type,p.name),d)},[e,m]);let h=We(e=>e.reorderQueryTab),g=(0,D.useMemo)(()=>n.map(e=>e.id),[n]),{dragProps:_,dropIndicator:v}=He(g,(0,D.useCallback)((t,n)=>h(e,t,n),[e,h])),y=e5(e=>e.closeERD),x=(0,D.useCallback)(e=>{y(e);let t=We.getState();if(t.activeTabId[e]===`erd`){let n=t.tabs[e]??[];t.setActiveQueryTab(e,n.length>0?n[n.length-1].id:``)}},[y]),C=(0,D.useCallback)(()=>{let r={id:`tab-${Date.now()}`,title:t(`query.tabs.queryTitle`,{n:n.length+1}),query:``,database:``,isExecuting:!1,results:[],error:null,executionTime:null};a(e,r)},[e,n.length,a,t]),w=(0,D.useCallback)((t,n)=>{if(t.stopPropagation(),n===`erd`){x(e);return}o(e,n)},[e,o,x]),T=(0,D.useCallback)((t,r)=>{let a=n.findIndex(e=>e.id===t),o=n.filter((e,n)=>{switch(r){case`all`:return!0;case`others`:return e.id!==t;case`left`:return n<a;case`right`:return n>a}}).map(e=>e.id);o.length>0&&s(e,o),i&&(r===`all`||r===`others`||r===`right`)&&x(e)},[n,i,e,s,x]),ee=(0,D.useCallback)(t=>{c(e,t);let r;r=t===`erd`?e5.getState().database[e]:n.find(e=>e.id===t)?.database,r&&Pt(e,r)},[e,n,c]);return n.length===0&&!i?(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,$.jsxs)(te,{variant:`outline`,onClick:C,children:[(0,$.jsx)(B8,{className:`mr-1 size-4`}),t(`query.tabs.newQuery`)]})}):(0,$.jsxs)(T5,{value:l??void 0,onValueChange:ee,className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex items-center border-b bg-muted/30`,children:[(0,$.jsxs)(`div`,{ref:u,className:`min-w-0 flex-1 overflow-x-auto overflow-y-hidden [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,children:[(0,$.jsxs)(E5,{className:`h-9 w-max rounded-none bg-transparent`,children:[n.map((r,a)=>(0,$.jsxs)(p5,{children:[(0,$.jsx)(m5,{asChild:!0,children:(0,$.jsxs)(D5,{value:r.id,..._(r.id),"data-drop-before":v===r.id||void 0,className:`shrink-0 gap-1 data-[drop-before]:shadow-[inset_2px_0_0_var(--color-primary)] !rounded-none !border-0 !border-b-2 !border-transparent px-3 py-1.5 !text-muted-foreground hover:!text-foreground aria-selected:!bg-primary aria-selected:!text-primary-foreground aria-selected:!border-primary aria-selected:font-semibold aria-selected:!shadow-none after:!hidden`,children:[r.sourceTable&&(0,$.jsx)(AYe,{className:`size-3 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`max-w-[120px] truncate text-xs`,children:r.title}),(n.length>1||i)&&(0,$.jsx)(`button`,{type:`button`,className:`ml-1 rounded p-0.5 opacity-60 hover:bg-muted hover:opacity-100`,onClick:e=>w(e,r.id),children:(0,$.jsx)(b,{className:`size-3`})})]})}),(0,$.jsxs)(h5,{children:[(0,$.jsx)(g5,{onSelect:()=>o(e,r.id),children:t(`query.tabs.close`)}),(0,$.jsx)(g5,{disabled:n.length<=1&&!i,onSelect:()=>T(r.id,`others`),children:t(`query.tabs.closeOthers`)}),(0,$.jsx)(_5,{}),(0,$.jsx)(g5,{disabled:a===0,onSelect:()=>T(r.id,`left`),children:t(`query.tabs.closeLeft`)}),(0,$.jsx)(g5,{disabled:a===n.length-1&&!i,onSelect:()=>T(r.id,`right`),children:t(`query.tabs.closeRight`)}),(0,$.jsx)(_5,{}),(0,$.jsx)(g5,{onSelect:()=>T(r.id,`all`),children:t(`query.tabs.closeAll`)})]})]},r.id)),i&&(0,$.jsxs)(D5,{value:`erd`,className:`shrink-0 gap-1 !rounded-none !border-0 !border-b-2 !border-transparent px-3 py-1.5 !text-muted-foreground hover:!text-foreground aria-selected:!bg-primary aria-selected:!text-primary-foreground aria-selected:!border-primary aria-selected:font-semibold aria-selected:!shadow-none after:!hidden`,children:[(0,$.jsx)(`span`,{className:`text-xs`,children:t(`query.tabs.erdViewer`)}),(0,$.jsx)(`button`,{type:`button`,className:`ml-1 rounded p-0.5 opacity-60 hover:bg-muted hover:opacity-100`,onClick:e=>w(e,`erd`),children:(0,$.jsx)(b,{className:`size-3`})})]})]}),v===`end`&&(0,$.jsx)(`div`,{className:`h-6 w-0.5 shrink-0 bg-primary`})]}),(0,$.jsx)(te,{variant:`ghost`,size:`icon`,className:`mx-1 size-7 shrink-0`,onClick:C,children:(0,$.jsx)(B8,{className:`size-4`})})]}),n.map(t=>(0,$.jsx)(O5,{value:t.id,className:`mt-0 flex-1 overflow-hidden`,forceMount:t.id!==l||void 0,hidden:t.id!==l,children:t.sourceTable?(0,$.jsx)(o4e,{connectionId:e,tabId:t.id}):(0,$.jsx)(s4e,{connectionId:e,tabId:t.id})},t.id)),i&&(0,$.jsx)(O5,{value:`erd`,className:`mt-0 flex-1 overflow-hidden`,forceMount:l!==`erd`||void 0,hidden:l!==`erd`,children:(0,$.jsx)(T4e,{connectionId:e})})]})}function D4e({connectionId:e,fileName:t}){let{t:n}=S(),[r,i]=(0,D.useState)(!1),a=Ue(e=>e.closeConnection);async function o(){i(!0);try{let t=await ht(e,{interactive:!0});if(!t)return;let r=Ue.getState();r.updateServerConnectionId(e,t.connectionId),r.updateProfile(e,{file:t.fileName}),r.setPendingReopen(e,!1),r.setFileDetached(e,t.fileDetached),nt.getState().removeTree(e),c.getState().setFooterMessage(n(`connection.tab.reopened`,{file:t.fileName}))}catch(e){c.getState().setFooterMessage(n(`connection.tab.reopenFailed`,{message:e instanceof Error?e.message:String(e)}))}finally{i(!1)}}return(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 border-b border-catppuccin-yellow/40 bg-catppuccin-yellow/10 px-3 py-1.5 text-xs`,children:[(0,$.jsx)(I8,{className:`size-4 shrink-0 text-catppuccin-yellow`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 break-all`,children:(0,$.jsx)(Fn,{i18nKey:`connection.tab.reopenPrompt`,values:{file:t||n(`connection.tab.theSqliteFile`)},components:{b:(0,$.jsx)(`span`,{className:`font-medium`})}})}),(0,$.jsx)(te,{size:`sm`,className:`h-7 shrink-0 text-xs`,disabled:r,onClick:()=>{o()},children:n(`connection.tab.reopenFile`)}),(0,$.jsx)(te,{size:`sm`,variant:`ghost`,className:`h-7 shrink-0 text-xs`,onClick:()=>a(e),children:n(`connection.tab.closeConnection`)})]})}function O4e({connectionId:e,serverConnectionId:t,fileName:n}){let{t:r}=S(),[i,a]=(0,D.useState)(!1),o=Ue(e=>e.setFileDetached);async function s(){a(!0);try{await at(e,t)?(o(e,!1),c.getState().setFooterMessage(r(`connection.tab.reconnected`,{file:n}))):c.getState().setFooterMessage(r(`connection.tab.accessNotGranted`))}finally{a(!1)}}return(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 border-b border-catppuccin-blue/40 bg-catppuccin-blue/10 px-3 py-1.5 text-xs`,children:[(0,$.jsx)(L8,{className:`size-4 shrink-0 text-catppuccin-blue`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 break-all`,children:(0,$.jsx)(Fn,{i18nKey:`connection.tab.detachedPrompt`,values:{file:n||r(`connection.tab.theSqliteFile`)},components:{b:(0,$.jsx)(`span`,{className:`font-medium`})}})}),(0,$.jsx)(te,{size:`sm`,className:`h-7 shrink-0 text-xs`,disabled:i,onClick:()=>{s()},children:r(`connection.tab.reconnectFile`)}),(0,$.jsx)(te,{size:`sm`,variant:`ghost`,className:`h-7 shrink-0 text-xs`,onClick:()=>o(e,!1),title:r(`connection.tab.detachedHide`),children:(0,$.jsx)(b,{className:`size-3`})})]})}function k4e({connectionId:e,serverConnectionId:t,fileName:n,onDismiss:r}){let{t:i}=S(),[a,o]=(0,D.useState)(!1);async function s(){o(!0);try{let r=await gt(e,t);if(!r)return;Ue.getState().updateServerConnectionId(e,r.connectionId),nt.getState().removeTree(e),c.getState().setFooterMessage(r.appliedFrames>0?i(`connection.tab.walFramesApplied`,{count:r.appliedFrames,file:n}):i(`connection.tab.walNoChanges`))}catch(e){c.getState().setFooterMessage(i(`connection.tab.walLoadFailed`,{message:e instanceof Error?e.message:String(e)}))}finally{o(!1)}}return(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 border-b border-catppuccin-peach/40 bg-catppuccin-peach/10 px-3 py-1.5 text-xs`,children:[(0,$.jsx)(I8,{className:`size-4 shrink-0 text-catppuccin-peach`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 break-all`,children:(0,$.jsx)(Fn,{i18nKey:`connection.tab.walPrompt`,values:{file:n},components:{b:(0,$.jsx)(`span`,{className:`font-medium`}),mono:(0,$.jsx)(`span`,{className:`font-mono`})}})}),(0,$.jsx)(te,{size:`sm`,className:`h-7 shrink-0 text-xs`,disabled:a,onClick:()=>{s()},children:i(`connection.tab.loadWal`)}),(0,$.jsx)(te,{size:`sm`,variant:`outline`,className:`h-7 shrink-0 text-xs`,disabled:a,title:i(`connection.tab.noWalHint`),onClick:()=>{st(t),c.getState().bumpTransportVersion(),r()},children:i(`connection.tab.noWal`)}),(0,$.jsx)(te,{size:`sm`,variant:`ghost`,className:`h-7 w-7 shrink-0 p-0`,"aria-label":i(`connection.tab.dismiss`),title:i(`connection.tab.walHide`),onClick:r,children:(0,$.jsx)(b,{className:`size-3.5`})})]})}function A4e({connectionId:e}){let{t}=S(),n=Ue(t=>t.activeConnections.find(t=>t.id===e)),r=u5(n?.environmentColor),i=Ue(t=>t.pendingReopen[e]??!1),a=Ue(t=>t.fileDetached[e]??!1),o=rt(n?.serverConnectionId),[s,c]=(0,D.useState)(null),l=!i&&o?.wal&&!o.walApplied&&!o.walAcknowledged&&n?.serverConnectionId&&s!==n.serverConnectionId;return(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[i&&(0,$.jsx)(D4e,{connectionId:e,fileName:n?.file??``}),!i&&a&&!n?.sample&&!n?.scratchpad&&n?.serverConnectionId&&(0,$.jsx)(O4e,{connectionId:e,serverConnectionId:n.serverConnectionId,fileName:n?.file??``}),l&&(0,$.jsx)(k4e,{connectionId:e,serverConnectionId:n.serverConnectionId,fileName:n?.file??``,onDismiss:()=>c(n.serverConnectionId)}),r&&(0,$.jsxs)(`div`,{className:`flex h-5 shrink-0 items-center gap-2 px-3 text-[11px] font-semibold uppercase tracking-wider text-white`,style:{background:r},children:[(0,$.jsx)(`span`,{children:n?.hostName||n?.host}),n?.readOnly&&(0,$.jsx)(`span`,{className:`rounded bg-black/25 px-1.5 py-px normal-case tracking-normal`,children:t(`connection.tab.readOnlyBadge`)})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,style:r?{boxShadow:`inset 3px 0 0 ${r}`}:void 0,children:(0,$.jsxs)(zXe,{direction:`horizontal`,defaultSize:200,minSize:150,maxSize:600,storageKey:`sidebar`,children:[(0,$.jsx)(`div`,{className:`h-full border-r border-catppuccin-surface1 bg-catppuccin-mantle overflow-hidden`,children:(0,$.jsx)(_Ze,{connectionId:e})}),(0,$.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,$.jsx)(E4e,{connectionId:e})})]})})]})}var A9=`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>`,j9=`</title><path d="`,M9=`"/></svg>`,j4e={mysql:{title:`MySQL`,slug:`mysql`,get svg(){return A9+`MySQL`+j9+this.path+M9},path:`M16.405 5.501c-.115 0-.193.014-.274.033v.013h.014c.054.104.146.18.214.273.054.107.1.214.154.32l.014-.015c.094-.066.14-.172.14-.333-.04-.047-.046-.094-.08-.14-.04-.067-.126-.1-.18-.153zM5.77 18.695h-.927a50.854 50.854 0 00-.27-4.41h-.008l-1.41 4.41H2.45l-1.4-4.41h-.01a72.892 72.892 0 00-.195 4.41H0c.055-1.966.192-3.81.41-5.53h1.15l1.335 4.064h.008l1.347-4.064h1.095c.242 2.015.384 3.86.428 5.53zm4.017-4.08c-.378 2.045-.876 3.533-1.492 4.46-.482.716-1.01 1.073-1.583 1.073-.153 0-.34-.046-.566-.138v-.494c.11.017.24.026.386.026.268 0 .483-.075.647-.222.197-.18.295-.382.295-.605 0-.155-.077-.47-.23-.944L6.23 14.615h.91l.727 2.36c.164.536.233.91.205 1.123.4-1.064.678-2.227.835-3.483zm12.325 4.08h-2.63v-5.53h.885v4.85h1.745zm-3.32.135l-1.016-.5c.09-.076.177-.158.255-.25.433-.506.648-1.258.648-2.253 0-1.83-.718-2.746-2.155-2.746-.704 0-1.254.232-1.65.697-.43.508-.646 1.256-.646 2.245 0 .972.19 1.686.574 2.14.35.41.877.615 1.583.615.264 0 .506-.033.725-.098l1.325.772.36-.622zM15.5 17.588c-.225-.36-.337-.94-.337-1.736 0-1.393.424-2.09 1.27-2.09.443 0 .77.167.977.5.224.362.336.936.336 1.723 0 1.404-.424 2.108-1.27 2.108-.445 0-.77-.167-.978-.5zm-1.658-.425c0 .47-.172.856-.516 1.156-.344.3-.803.45-1.384.45-.543 0-1.064-.172-1.573-.515l.237-.476c.438.22.833.328 1.19.328.332 0 .593-.073.783-.22a.754.754 0 00.3-.615c0-.33-.23-.61-.648-.845-.388-.213-1.163-.657-1.163-.657-.422-.307-.632-.636-.632-1.177 0-.45.157-.81.47-1.085.315-.278.72-.415 1.22-.415.512 0 .98.136 1.4.41l-.213.476a2.726 2.726 0 00-1.064-.23c-.283 0-.502.068-.654.206a.685.685 0 00-.248.524c0 .328.234.61.666.85.393.215 1.187.67 1.187.67.433.305.648.63.648 1.168zm9.382-5.852c-.535-.014-.95.04-1.297.188-.1.04-.26.04-.274.167.055.053.063.14.11.214.08.134.218.313.346.407.14.11.28.216.427.31.26.16.555.255.81.416.145.094.293.213.44.313.073.05.12.14.214.172v-.02c-.046-.06-.06-.147-.105-.214-.067-.067-.134-.127-.2-.193a3.223 3.223 0 00-.695-.675c-.214-.146-.682-.35-.77-.595l-.013-.014c.146-.013.32-.066.46-.106.227-.06.435-.047.67-.106.106-.027.213-.06.32-.094v-.06c-.12-.12-.21-.283-.334-.395a8.867 8.867 0 00-1.104-.823c-.21-.134-.476-.22-.697-.334-.08-.04-.214-.06-.26-.127-.12-.146-.19-.34-.275-.514a17.69 17.69 0 01-.547-1.163c-.12-.262-.193-.523-.34-.763-.69-1.137-1.437-1.826-2.586-2.5-.247-.14-.543-.2-.856-.274-.167-.008-.334-.02-.5-.027-.11-.047-.216-.174-.31-.235-.38-.24-1.364-.76-1.644-.072-.18.434.267.862.422 1.082.115.153.26.328.34.5.047.116.06.235.107.356.106.294.207.622.347.897.073.14.153.287.247.413.054.073.146.107.167.227-.094.136-.1.334-.154.5-.24.757-.146 1.693.194 2.25.107.166.362.534.703.393.3-.12.234-.5.32-.835.02-.08.007-.133.048-.187v.015c.094.188.188.367.274.555.206.328.566.668.867.895.16.12.287.328.487.402v-.02h-.015c-.043-.058-.1-.086-.154-.133a3.445 3.445 0 01-.35-.4 8.76 8.76 0 01-.747-1.218c-.11-.21-.202-.436-.29-.643-.04-.08-.04-.2-.107-.24-.1.146-.247.273-.32.453-.127.288-.14.642-.188 1.01-.027.007-.014 0-.027.014-.214-.052-.287-.274-.367-.46-.2-.475-.233-1.238-.06-1.785.047-.14.247-.582.167-.716-.042-.127-.174-.2-.247-.303a2.478 2.478 0 01-.24-.427c-.16-.374-.24-.788-.414-1.162-.08-.173-.22-.354-.334-.513-.127-.18-.267-.307-.368-.52-.033-.073-.08-.194-.027-.274.014-.054.042-.075.094-.09.088-.072.335.022.422.062.247.1.455.194.662.334.094.066.195.193.315.226h.14c.214.047.455.014.655.073.355.114.675.28.962.46a5.953 5.953 0 012.085 2.286c.08.154.115.295.188.455.14.33.313.663.455.982.14.315.275.636.476.897.1.14.502.213.682.286.133.06.34.115.46.188.23.14.454.3.67.454.11.076.443.243.463.378z`,source:`https://www.mysql.com/about/legal/logos.html`,hex:`4479A1`,guidelines:`https://www.mysql.com/about/legal/logos.html`},maria:{title:`MariaDB`,slug:`mariadb`,get svg(){return A9+`MariaDB`+j9+this.path+M9},path:`M23.157 4.412c-.676.284-.79.31-1.673.372-.65.045-.757.057-1.212.209-.75.246-1.395.75-2.02 1.59-.296.398-1.249 1.913-1.249 1.988 0 .057-.65.998-.915 1.32-.574.713-1.08 1.079-2.14 1.59-.77.36-1.224.524-4.102 1.477-1.073.353-2.133.738-2.367.864-.852.449-1.515 1.036-2.203 1.938-1.003 1.32-.972 1.313-3.042.947a12.264 12.264 0 00-.675-.063c-.644-.05-1.023.044-1.332.334L0 17.193l.177.088c.094.05.353.234.561.398.215.17.461.347.55.391.088.044.17.088.183.101.012.013-.089.17-.228.353-.435.581-.593.871-.574 1.048.019.164.032.17.43.17.517-.006.826-.056 1.261-.208.65-.233 2.058-.94 2.784-1.4.776-.5 1.717-.998 1.956-1.042.082-.02.354-.07.594-.114.58-.107 1.464-.095 2.587.05.108.013.373.045.6.064.227.025.43.057.454.076.026.012.474.037.998.056.934.026 1.104.007 1.3-.189.126-.133.385-.631.498-.985.209-.643.417-.921.366-.492-.113.966-.322 1.692-.713 2.411-.259.499-.663 1.092-.934 1.395-.322.347-.315.36.088.315.619-.063 1.471-.397 2.096-.82.827-.562 1.647-1.691 2.19-3.03.107-.27.22-.22.183.083-.013.094-.038.315-.057.498l-.031.328.353-.202c.833-.48 1.414-1.262 2.127-2.884.227-.518.877-2.922 1.073-3.976a9.64 9.64 0 01.271-1.042c.127-.429.196-.555.48-.858.183-.19.625-.555.978-.808.72-.505.953-.75 1.187-1.205.208-.417.284-1.13.132-1.357-.132-.202-.284-.196-.763.006Z`,source:`https://mariadb.com/about-us/logos/`,hex:`003545`,guidelines:`https://mariadb.com/about-us/logos/`},postgres:{title:`PostgreSQL`,slug:`postgresql`,get svg(){return A9+`PostgreSQL`+j9+this.path+M9},path:`M23.5594 14.7228a.5269.5269 0 0 0-.0563-.1191c-.139-.2632-.4768-.3418-1.0074-.2321-1.6533.3411-2.2935.1312-2.5256-.0191 1.342-2.0482 2.445-4.522 3.0411-6.8297.2714-1.0507.7982-3.5237.1222-4.7316a1.5641 1.5641 0 0 0-.1509-.235C21.6931.9086 19.8007.0248 17.5099.0005c-1.4947-.0158-2.7705.3461-3.1161.4794a9.449 9.449 0 0 0-.5159-.0816 8.044 8.044 0 0 0-1.3114-.1278c-1.1822-.0184-2.2038.2642-3.0498.8406-.8573-.3211-4.7888-1.645-7.2219.0788C.9359 2.1526.3086 3.8733.4302 6.3043c.0409.818.5069 3.334 1.2423 5.7436.4598 1.5065.9387 2.7019 1.4334 3.582.553.9942 1.1259 1.5933 1.7143 1.7895.4474.1491 1.1327.1441 1.8581-.7279.8012-.9635 1.5903-1.8258 1.9446-2.2069.4351.2355.9064.3625 1.39.3772a.0569.0569 0 0 0 .0004.0041 11.0312 11.0312 0 0 0-.2472.3054c-.3389.4302-.4094.5197-1.5002.7443-.3102.064-1.1344.2339-1.1464.8115-.0025.1224.0329.2309.0919.3268.2269.4231.9216.6097 1.015.6331 1.3345.3335 2.5044.092 3.3714-.6787-.017 2.231.0775 4.4174.3454 5.0874.2212.5529.7618 1.9045 2.4692 1.9043.2505 0 .5263-.0291.8296-.0941 1.7819-.3821 2.5557-1.1696 2.855-2.9059.1503-.8707.4016-2.8753.5388-4.1012.0169-.0703.0357-.1207.057-.1362.0007-.0005.0697-.0471.4272.0307a.3673.3673 0 0 0 .0443.0068l.2539.0223.0149.001c.8468.0384 1.9114-.1426 2.5312-.4308.6438-.2988 1.8057-1.0323 1.5951-1.6698zM2.371 11.8765c-.7435-2.4358-1.1779-4.8851-1.2123-5.5719-.1086-2.1714.4171-3.6829 1.5623-4.4927 1.8367-1.2986 4.8398-.5408 6.108-.13-.0032.0032-.0066.0061-.0098.0094-2.0238 2.044-1.9758 5.536-1.9708 5.7495-.0002.0823.0066.1989.0162.3593.0348.5873.0996 1.6804-.0735 2.9184-.1609 1.1504.1937 2.2764.9728 3.0892.0806.0841.1648.1631.2518.2374-.3468.3714-1.1004 1.1926-1.9025 2.1576-.5677.6825-.9597.5517-1.0886.5087-.3919-.1307-.813-.5871-1.2381-1.3223-.4796-.839-.9635-2.0317-1.4155-3.5126zm6.0072 5.0871c-.1711-.0428-.3271-.1132-.4322-.1772.0889-.0394.2374-.0902.4833-.1409 1.2833-.2641 1.4815-.4506 1.9143-1.0002.0992-.126.2116-.2687.3673-.4426a.3549.3549 0 0 0 .0737-.1298c.1708-.1513.2724-.1099.4369-.0417.156.0646.3078.26.3695.4752.0291.1016.0619.2945-.0452.4444-.9043 1.2658-2.2216 1.2494-3.1676 1.0128zm2.094-3.988-.0525.141c-.133.3566-.2567.6881-.3334 1.003-.6674-.0021-1.3168-.2872-1.8105-.8024-.6279-.6551-.9131-1.5664-.7825-2.5004.1828-1.3079.1153-2.4468.079-3.0586-.005-.0857-.0095-.1607-.0122-.2199.2957-.2621 1.6659-.9962 2.6429-.7724.4459.1022.7176.4057.8305.928.5846 2.7038.0774 3.8307-.3302 4.7363-.084.1866-.1633.3629-.2311.5454zm7.3637 4.5725c-.0169.1768-.0358.376-.0618.5959l-.146.4383a.3547.3547 0 0 0-.0182.1077c-.0059.4747-.054.6489-.115.8693-.0634.2292-.1353.4891-.1794 1.0575-.11 1.4143-.8782 2.2267-2.4172 2.5565-1.5155.3251-1.7843-.4968-2.0212-1.2217a6.5824 6.5824 0 0 0-.0769-.2266c-.2154-.5858-.1911-1.4119-.1574-2.5551.0165-.5612-.0249-1.9013-.3302-2.6462.0044-.2932.0106-.5909.019-.8918a.3529.3529 0 0 0-.0153-.1126 1.4927 1.4927 0 0 0-.0439-.208c-.1226-.4283-.4213-.7866-.7797-.9351-.1424-.059-.4038-.1672-.7178-.0869.067-.276.1831-.5875.309-.9249l.0529-.142c.0595-.16.134-.3257.213-.5012.4265-.9476 1.0106-2.2453.3766-5.1772-.2374-1.0981-1.0304-1.6343-2.2324-1.5098-.7207.0746-1.3799.3654-1.7088.5321a5.6716 5.6716 0 0 0-.1958.1041c.0918-1.1064.4386-3.1741 1.7357-4.4823a4.0306 4.0306 0 0 1 .3033-.276.3532.3532 0 0 0 .1447-.0644c.7524-.5706 1.6945-.8506 2.802-.8325.4091.0067.8017.0339 1.1742.081 1.939.3544 3.2439 1.4468 4.0359 2.3827.8143.9623 1.2552 1.9315 1.4312 2.4543-1.3232-.1346-2.2234.1268-2.6797.779-.9926 1.4189.543 4.1729 1.2811 5.4964.1353.2426.2522.4522.2889.5413.2403.5825.5515.9713.7787 1.2552.0696.087.1372.1714.1885.245-.4008.1155-1.1208.3825-1.0552 1.717-.0123.1563-.0423.4469-.0834.8148-.0461.2077-.0702.4603-.0994.7662zm.8905-1.6211c-.0405-.8316.2691-.9185.5967-1.0105a2.8566 2.8566 0 0 0 .135-.0406 1.202 1.202 0 0 0 .1342.103c.5703.3765 1.5823.4213 3.0068.1344-.2016.1769-.5189.3994-.9533.6011-.4098.1903-1.0957.333-1.7473.3636-.7197.0336-1.0859-.0807-1.1721-.151zm.5695-9.2712c-.0059.3508-.0542.6692-.1054 1.0017-.055.3576-.112.7274-.1264 1.1762-.0142.4368.0404.8909.0932 1.3301.1066.887.216 1.8003-.2075 2.7014a3.5272 3.5272 0 0 1-.1876-.3856c-.0527-.1276-.1669-.3326-.3251-.6162-.6156-1.1041-2.0574-3.6896-1.3193-4.7446.3795-.5427 1.3408-.5661 2.1781-.463zm.2284 7.0137a12.3762 12.3762 0 0 0-.0853-.1074l-.0355-.0444c.7262-1.1995.5842-2.3862.4578-3.4385-.0519-.4318-.1009-.8396-.0885-1.2226.0129-.4061.0666-.7543.1185-1.0911.0639-.415.1288-.8443.1109-1.3505.0134-.0531.0188-.1158.0118-.1902-.0457-.4855-.5999-1.938-1.7294-3.253-.6076-.7073-1.4896-1.4972-2.6889-2.0395.5251-.1066 1.2328-.2035 2.0244-.1859 2.0515.0456 3.6746.8135 4.8242 2.2824a.908.908 0 0 1 .0667.1002c.7231 1.3556-.2762 6.2751-2.9867 10.5405zm-8.8166-6.1162c-.025.1794-.3089.4225-.6211.4225a.5821.5821 0 0 1-.0809-.0056c-.1873-.026-.3765-.144-.5059-.3156-.0458-.0605-.1203-.178-.1055-.2844.0055-.0401.0261-.0985.0925-.1488.1182-.0894.3518-.1226.6096-.0867.3163.0441.6426.1938.6113.4186zm7.9305-.4114c.0111.0792-.049.201-.1531.3102-.0683.0717-.212.1961-.4079.2232a.5456.5456 0 0 1-.075.0052c-.2935 0-.5414-.2344-.5607-.3717-.024-.1765.2641-.3106.5611-.352.297-.0414.6111.0088.6356.1851z`,source:`https://wiki.postgresql.org/wiki/Logo`,hex:`4169E1`,guidelines:`https://www.postgresql.org/about/policies/trademarks/`},sqlite:{title:`SQLite`,slug:`sqlite`,get svg(){return A9+`SQLite`+j9+this.path+M9},path:`M21.678.521c-1.032-.92-2.28-.55-3.513.544a8.71 8.71 0 0 0-.547.535c-2.109 2.237-4.066 6.38-4.674 9.544.237.48.422 1.093.544 1.561a13.044 13.044 0 0 1 .164.703s-.019-.071-.096-.296l-.05-.146a1.689 1.689 0 0 0-.033-.08c-.138-.32-.518-.995-.686-1.289-.143.423-.27.818-.376 1.176.484.884.778 2.4.778 2.4s-.025-.099-.147-.442c-.107-.303-.644-1.244-.772-1.464-.217.804-.304 1.346-.226 1.478.152.256.296.698.422 1.186.286 1.1.485 2.44.485 2.44l.017.224a22.41 22.41 0 0 0 .056 2.748c.095 1.146.273 2.13.5 2.657l.155-.084c-.334-1.038-.47-2.399-.41-3.967.09-2.398.642-5.29 1.661-8.304 1.723-4.55 4.113-8.201 6.3-9.945-1.993 1.8-4.692 7.63-5.5 9.788-.904 2.416-1.545 4.684-1.931 6.857.666-2.037 2.821-2.912 2.821-2.912s1.057-1.304 2.292-3.166c-.74.169-1.955.458-2.362.629-.6.251-.762.337-.762.337s1.945-1.184 3.613-1.72C21.695 7.9 24.195 2.767 21.678.521m-18.573.543A1.842 1.842 0 0 0 1.27 2.9v16.608a1.84 1.84 0 0 0 1.835 1.834h9.418a22.953 22.953 0 0 1-.052-2.707c-.006-.062-.011-.141-.016-.2a27.01 27.01 0 0 0-.473-2.378c-.121-.47-.275-.898-.369-1.057-.116-.197-.098-.31-.097-.432 0-.12.015-.245.037-.386a9.98 9.98 0 0 1 .234-1.045l.217-.028c-.017-.035-.014-.065-.031-.097l-.041-.381a32.8 32.8 0 0 1 .382-1.194l.2-.019c-.008-.016-.01-.038-.018-.053l-.043-.316c.63-3.28 2.587-7.443 4.8-9.791.066-.069.133-.128.198-.194Z`,source:`https://github.com/sqlite/sqlite/blob/43e862723ec680542ca6f608f9963c0993dd7324/art/sqlite370.eps`,hex:`003B57`},mssql:{path:`M12 1.5c-4.97 0-9 1.79-9 4v13c0 2.21 4.03 4 9 4s9-1.79 9-4v-13c0-2.21-4.03-4-9-4zm0 2c3.87 0 7 1.12 7 2s-3.13 2-7 2-7-1.12-7-2 3.13-2 7-2zm0 2.9a2.1 2.1 0 1 1 0 4.2 2.1 2.1 0 0 1 0-4.2zM5 8.55c1.6.9 4.2 1.45 7 1.45s5.4-.55 7-1.45V11c0 .88-3.13 2-7 2s-7-1.12-7-2V8.55zm0 4.9c1.6.9 4.2 1.45 7 1.45s5.4-.55 7-1.45V16c0 .88-3.13 2-7 2s-7-1.12-7-2v-2.55zm0 5c1.6.9 4.2 1.45 7 1.45s5.4-.55 7-1.45`},oracle:{path:`M7.5 5.5h9a6.5 6.5 0 0 1 0 13h-9a6.5 6.5 0 0 1 0-13zm0 2.4a4.1 4.1 0 0 0 0 8.2h9a4.1 4.1 0 0 0 0-8.2h-9z`},neon:{title:`Neon`,slug:`neon`,get svg(){return A9+`Neon`+j9+this.path+M9},path:`M24 0V24l-9.365-8.045V24H0V0ZM2.942 21.087h8.751V9.563l9.365 8.204V2.919L2.942 2.914Z`,source:`https://neon.com/brand`,hex:`34D59A`,guidelines:`https://neon.com/brand`},supabase:{title:`Supabase`,slug:`supabase`,get svg(){return A9+`Supabase`+j9+this.path+M9},path:`M11.9 1.036c-.015-.986-1.26-1.41-1.874-.637L.764 12.05C-.33 13.427.65 15.455 2.409 15.455h9.579l.113 7.51c.014.985 1.259 1.408 1.873.636l9.262-11.653c1.093-1.375.113-3.403-1.645-3.403h-9.642z`,source:`https://github.com/supabase/supabase/blob/4031a7549f5d46da7bc79c01d56be4177dc7c114/packages/common/assets/images/supabase-logo-wordmark--light.svg`,hex:`3FCF8E`},d1:{title:`Cloudflare`,slug:`cloudflare`,get svg(){return A9+`Cloudflare`+j9+this.path+M9},path:`M16.5088 16.8447c.1475-.5068.0908-.9707-.1553-1.3154-.2246-.3164-.6045-.499-1.0615-.5205l-8.6592-.1123a.1559.1559 0 0 1-.1333-.0713c-.0283-.042-.0351-.0986-.021-.1553.0278-.084.1123-.1484.2036-.1562l8.7359-.1123c1.0351-.0489 2.1601-.8868 2.5537-1.9136l.499-1.3013c.0215-.0561.0293-.1128.0147-.168-.5625-2.5463-2.835-4.4453-5.5499-4.4453-2.5039 0-4.6284 1.6177-5.3876 3.8614-.4927-.3658-1.1187-.5625-1.794-.499-1.2026.119-2.1665 1.083-2.2861 2.2856-.0283.31-.0069.6128.0635.894C1.5683 13.171 0 14.7754 0 16.752c0 .1748.0142.3515.0352.5273.0141.083.0844.1475.1689.1475h15.9814c.0909 0 .1758-.0645.2032-.1553l.12-.4268zm2.7568-5.5634c-.0771 0-.1611 0-.2383.0112-.0566 0-.1054.0415-.127.0976l-.3378 1.1744c-.1475.5068-.0918.9707.1543 1.3164.2256.3164.6055.498 1.0625.5195l1.8437.1133c.0557 0 .1055.0263.1329.0703.0283.043.0351.1074.0214.1562-.0283.084-.1132.1485-.204.1553l-1.921.1123c-1.041.0488-2.1582.8867-2.5527 1.914l-.1406.3585c-.0283.0713.0215.1416.0986.1416h6.5977c.0771 0 .1474-.0489.169-.126.1122-.4082.1757-.837.1757-1.2803 0-2.6025-2.125-4.727-4.7344-4.727`,source:`https://www.cloudflare.com/logo/`,hex:`F38020`,guidelines:`https://www.cloudflare.com/trademark/`}};function N9({dbms:e,className:t}){let n=j4e[e];return n?(0,$.jsx)(`svg`,{viewBox:`0 0 24 24`,className:w(`size-4 shrink-0`,t),fill:`currentColor`,"aria-hidden":!0,children:(0,$.jsx)(`path`,{d:n.path})}):(0,$.jsx)(P8,{className:w(`size-4 shrink-0`,t),"aria-hidden":!0})}function M4e(){let{t:e}=S(),{activeConnections:t,activeConnectionId:n,setActiveConnection:r,closeConnection:i}=Ue(),a=(0,D.useRef)(null);yZe(a,n);let o=Ue(e=>e.reorderActiveConnection),s=(0,D.useMemo)(()=>t.map(e=>e.id),[t]),{dragProps:c,dropIndicator:l}=He(s,(0,D.useCallback)((e,t)=>o(e,t),[o]));return t.length===0?(0,$.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground`,children:e(`connection.tab.noConnections`)}):(0,$.jsxs)(T5,{value:n??void 0,onValueChange:r,className:`h-full gap-0`,children:[(0,$.jsx)(E5,{ref:a,variant:`line`,className:`w-full shrink-0 justify-start overflow-x-auto overflow-y-hidden border-b px-2 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,children:t.map(e=>(0,$.jsxs)(D5,{value:e.id,...c(e.id),"data-drop-before":l===e.id||void 0,className:`shrink-0 gap-1 data-[drop-before]:shadow-[inset_2px_0_0_var(--color-primary)] !rounded-none !border-0 !border-b-2 !border-transparent pr-1 !text-muted-foreground hover:!text-foreground data-[state=active]:!bg-primary data-[state=active]:!text-primary-foreground data-[state=active]:!border-primary data-[state=active]:font-semibold data-[state=active]:!shadow-none after:!hidden`,children:[u5(e.environmentColor)&&(0,$.jsx)(`span`,{className:`size-2 shrink-0 rounded-full`,style:{background:u5(e.environmentColor)}}),(0,$.jsx)(N9,{dbms:e.dbms,className:`size-3.5 opacity-80`}),(0,$.jsx)(`span`,{className:`truncate max-w-[140px]`,children:e.hostName||`${e.host}:${e.port}`}),(0,$.jsx)(`button`,{type:`button`,className:`ml-1 rounded-sm p-0.5 opacity-60 hover:opacity-100 hover:bg-muted transition-colors`,onClick:t=>{t.stopPropagation(),i(e.id)},children:(0,$.jsx)(b,{className:`size-3`})})]},e.id))}),t.map(e=>(0,$.jsx)(O5,{value:e.id,className:`mt-0 min-h-0 flex-1`,children:(0,$.jsx)(A4e,{connectionId:e.id})},e.id))]})}var N4e=(0,D.lazy)(()=>oe(()=>import(`./ConnectDialog-BNJnQcBX.js`).then(e=>({default:e.ConnectDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]))),P4e=(0,D.lazy)(()=>oe(()=>import(`./CreateDatabaseDialog-Bzm0FfTH.js`).then(e=>({default:e.CreateDatabaseDialog})),__vite__mapDeps([16,1,2,3,4,5,6,7,15]))),F4e=(0,D.lazy)(()=>oe(()=>import(`./CopyDatabaseDialog-Gsai81KV.js`).then(e=>({default:e.CopyDatabaseDialog})),__vite__mapDeps([17,1,2,15,4]))),I4e=(0,D.lazy)(()=>oe(()=>import(`./DownloadToCSVDialog-Bqw6Rhd1.js`).then(e=>({default:e.DownloadToCSVDialog})),__vite__mapDeps([18,1,2,3,4,5,6,7,8,9,10,11,12,13,19,14,20,21,15,22]))),L4e=(0,D.lazy)(()=>oe(()=>import(`./SchemaToHTMLDialog-BZWaSeWl.js`).then(e=>({default:e.SchemaToHTMLDialog})),__vite__mapDeps([23,1,2,3,4,5,6,7,8,9,10,11,12,13,20,14,21,15,22]))),R4e=(0,D.lazy)(()=>oe(()=>import(`./CopyTableDialog-Bk8AC6tJ.js`).then(e=>({default:e.CopyTableDialog})),__vite__mapDeps([24,1,2,3,4,5,6,7,8,9,12,13,10,11,19,14,20,21,25,26,15]))),z4e=(0,D.lazy)(()=>oe(()=>import(`./LinkColumnDialog-BhyQve5r.js`).then(e=>({default:e.LinkColumnDialog})),__vite__mapDeps([27,1,2,3,4,5,6,7,8,9,12,13,10,11,20,14,15]))),B4e=(0,D.lazy)(()=>oe(()=>import(`./DataDiffDialog-PJeuNu0W.js`).then(e=>({default:e.DataDiffDialog})),__vite__mapDeps([28,1,2,3,4,5,6,7,8,9,12,13,10,11,20,14,15]))),V4e=(0,D.lazy)(()=>oe(()=>import(`./SchemaDiffDialog-CW7Db6W_.js`).then(e=>({default:e.SchemaDiffDialog})),__vite__mapDeps([29,1,2,3,4,5,6,7,8,9,12,13,10,11,20,14,26,15]))),P9=(0,D.lazy)(()=>oe(()=>import(`./EditSchemaDialog-u5dIJ2gT.js`).then(e=>({default:e.EditSchemaDialog})),__vite__mapDeps([30,1,2,3,4,5,6,7,8,9,12,13,10,11,20,14,31,15]))),H4e=(0,D.lazy)(()=>oe(()=>import(`./UserManagerDialog-DD-EVqkB.js`).then(e=>({default:e.UserManagerDialog})),__vite__mapDeps([32,1,2,8,9,15,4,33]))),U4e=(0,D.lazy)(()=>oe(()=>import(`./UserAddDialog-CbHCH74s.js`).then(e=>({default:e.UserAddDialog})),__vite__mapDeps([34,1,2,3,4,5,6,7,8,9,15,33]))),W4e=(0,D.lazy)(()=>oe(()=>import(`./ProcessListDialog-BKF1MRZ-.js`).then(e=>({default:e.ProcessListDialog})),__vite__mapDeps([35,1,2,13,8,9,12,10,11,20,14,15,4]))),G4e=(0,D.lazy)(()=>oe(()=>import(`./VariablesDialog-BG6lVLna.js`).then(e=>({default:e.VariablesDialog})),__vite__mapDeps([36,1,2,13,8,9,12,10,11,20,14,15,4]))),K4e=(0,D.lazy)(()=>oe(()=>import(`./StatusDialog-DYctXfMc.js`).then(e=>({default:e.StatusDialog})),__vite__mapDeps([37,1,2,13,8,9,12,10,11,20,14,15,4]))),q4e=(0,D.lazy)(()=>oe(()=>import(`./FlushDialog-BJ7t14hx.js`).then(e=>({default:e.FlushDialog})),__vite__mapDeps([38,1,2,8,9,12,13,10,11,15,4]))),J4e=(0,D.lazy)(()=>oe(()=>import(`./FindReplaceDialog-BlS9158P.js`).then(e=>({default:e.FindReplaceDialog})),__vite__mapDeps([39,1,2,7]))),Y4e=(0,D.lazy)(()=>oe(()=>import(`./SafetySettingsDialog-BSB29OYt.js`).then(e=>({default:e.SafetySettingsDialog})),__vite__mapDeps([40,1,2,13,3,4,5,6,7,11,9,15]))),X4e=(0,D.lazy)(()=>oe(()=>import(`./LocalHistoryDialog-B0ytB5Y-.js`).then(e=>({default:e.LocalHistoryDialog})),__vite__mapDeps([41,1,2,8,9,10,11,15,4]))),Z4e=(0,D.lazy)(()=>oe(()=>import(`./AboutDialog-CwxQS9-3.js`).then(e=>({default:e.AboutDialog})),__vite__mapDeps([42,1,2,15,4]))),Q4e=(0,D.lazy)(()=>oe(()=>import(`./TermsDialog-Bj_qh6sW.js`).then(e=>({default:e.TermsDialog})),__vite__mapDeps([43,1,2,11,9,15,4]))),$4e=(0,D.lazy)(()=>oe(()=>import(`./RowFormDialog-DpqKxTg4.js`).then(e=>({default:e.RowFormDialog})),__vite__mapDeps([44,1,2,8,9,11,12,13,10,19,14,20,21,31,15,4]))),e3e={connect:N4e,"create-database":P4e,"copy-database":F4e,"export-csv":I4e,"export-html":L4e,"alter-database":P9,"create-table":P9,"alter-table":P9,"duplicate-table-structure":P9,"copy-table":R4e,"schema-diff":V4e,"data-diff":B4e,"link-column":z4e,"user-manager":H4e,"user-add":U4e,"process-list":W4e,variables:G4e,status:K4e,flush:q4e,"find-replace":J4e,"quick-command":(0,D.lazy)(()=>oe(()=>import(`./QuickCommandPalette-DzyPCRTc.js`).then(e=>({default:e.QuickCommandPalette})),__vite__mapDeps([45,1,2,4,11,9,31,8,14,15]))),"safety-settings":Y4e,"local-history":X4e,about:Z4e,terms:Q4e,"row-form":$4e};function t3e(){let e=c(e=>e.activeDialog);if(!e)return null;let t=e3e[e];return t?(0,$.jsx)(D.Suspense,{fallback:null,children:(0,$.jsx)(t,{})}):null}function F9({...e}){return(0,$.jsx)(aWe,{"data-slot":`alert-dialog`,...e})}function n3e({...e}){return(0,$.jsx)(oWe,{"data-slot":`alert-dialog-portal`,...e})}function r3e({className:e,...t}){return(0,$.jsx)(sWe,{"data-slot":`alert-dialog-overlay`,className:w(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function I9({className:e,size:t=`default`,...n}){return(0,$.jsxs)(n3e,{children:[(0,$.jsx)(r3e,{}),(0,$.jsx)(cWe,{"data-slot":`alert-dialog-content`,"data-size":t,className:w(`group/alert-dialog-content fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 data-[size=sm]:max-w-xs data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[size=default]:sm:max-w-lg`,e),...n})]})}function L9({className:e,...t}){return(0,$.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:w(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function R9({className:e,...t}){return(0,$.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:w(`flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function z9({className:e,...t}){return(0,$.jsx)(dWe,{"data-slot":`alert-dialog-title`,className:w(`text-lg font-semibold sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function B9({className:e,...t}){return(0,$.jsx)(fWe,{"data-slot":`alert-dialog-description`,className:w(`text-sm text-muted-foreground`,e),...t})}function V9({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,$.jsx)(te,{variant:t,size:n,asChild:!0,children:(0,$.jsx)(lWe,{"data-slot":`alert-dialog-action`,className:w(e),...r})})}function H9({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,$.jsx)(te,{variant:t,size:n,asChild:!0,children:(0,$.jsx)(uWe,{"data-slot":`alert-dialog-cancel`,className:w(e),...r})})}function U9({className:e,type:t,...n}){return(0,$.jsx)(`input`,{type:t,"data-slot":`input`,className:w(`h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30`,`focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,`aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40`,e),...n})}function i3e({className:e,...t}){return(0,$.jsx)(oKe,{"data-slot":`label`,className:w(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function a3e(){let e=c(e=>e.destructiveConfirm),t=c(e=>e.resolveDestructiveConfirm);return e?(0,$.jsx)(o3e,{request:e.request,resolve:t},e.id):null}function o3e({request:e,resolve:t}){let{t:n}=S(),[r,i]=(0,D.useState)(``),a=!!e.typeToConfirm,o=!a||r===e.typeToConfirm;return(0,$.jsx)(F9,{open:!0,onOpenChange:e=>{e||t(!1)},children:(0,$.jsx)(I9,{className:`max-w-lg overflow-hidden`,children:(0,$.jsxs)(`form`,{className:`contents`,onSubmit:e=>{e.preventDefault(),o&&t(!0)},children:[(0,$.jsxs)(L9,{children:[(0,$.jsxs)(z9,{className:`flex min-w-0 items-center gap-2 break-words`,children:[(0,$.jsx)(MYe,{className:`size-5 shrink-0 text-destructive`}),(0,$.jsx)(`span`,{className:`min-w-0 break-words`,children:e.title})]}),(0,$.jsx)(B9,{className:`min-w-0 break-words [overflow-wrap:anywhere] whitespace-pre-line`,children:e.description??n(`confirm.defaultDescription`)})]}),e.statements&&e.statements.length>0&&(0,$.jsx)(`pre`,{className:`max-h-48 overflow-auto rounded-md border bg-muted p-3 font-mono text-xs whitespace-pre-wrap break-all`,children:e.statements.join(`
|
|
924
924
|
`)}),a&&(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[(0,$.jsx)(i3e,{htmlFor:`destructive-confirm-input`,children:(0,$.jsx)(Fn,{i18nKey:`confirm.typeToConfirm`,components:{name:(0,$.jsx)(`span`,{className:`font-mono font-semibold`,children:e.typeToConfirm})}})}),(0,$.jsx)(U9,{id:`destructive-confirm-input`,autoFocus:!0,autoComplete:`off`,spellCheck:!1,value:r,onChange:e=>i(e.target.value),placeholder:e.typeToConfirm})]}),(0,$.jsxs)(R9,{children:[(0,$.jsx)(H9,{type:`button`,onClick:()=>t(!1),children:n(`confirm.cancel`)}),(0,$.jsx)(V9,{type:`submit`,variant:`destructive`,disabled:!o,onClick:()=>{o&&t(!0)},children:e.confirmLabel??n(`confirm.confirm`)})]})]})})})}var s3e=e=>e==null?`NULL`:typeof e==`object`?m7(e)??String(e):String(e);function c3e(){let e=c(e=>e.dryRun),t=c(e=>e.resolveDryRun);return e?(0,$.jsx)(l3e,{request:e.request,resolve:t},e.id):null}function l3e({request:e,resolve:t}){let{t:n}=S(),{statement:r,previewSql:i,count:a,fields:o,rows:s,truncated:c,error:l}=e,u=r.trim().slice(0,6).toUpperCase()===`DELETE`?`DELETE`:`UPDATE`;return(0,$.jsx)(F9,{open:!0,onOpenChange:e=>{e||t(!1)},children:(0,$.jsxs)(I9,{className:`max-w-3xl overflow-hidden`,children:[(0,$.jsxs)(L9,{children:[(0,$.jsxs)(z9,{className:`flex items-center gap-2`,children:[(0,$.jsx)(F8,{className:`size-5 shrink-0 text-primary`}),l||a===null?n(`dryRun.titleUnknown`,{kind:u}):n(`dryRun.title`,{kind:u,count:a})]}),(0,$.jsx)(B9,{className:`whitespace-pre-line`,children:l?n(`dryRun.previewFailed`,{error:l}):n(`dryRun.description`)})]}),(0,$.jsx)(`pre`,{className:`max-h-24 overflow-auto rounded-md border bg-muted p-2 font-mono text-xs whitespace-pre-wrap break-all`,children:r}),!l&&(0,$.jsx)(`div`,{className:`max-h-72 overflow-auto rounded-md border`,children:s.length===0?(0,$.jsx)(`p`,{className:`p-3 text-xs text-muted-foreground`,children:n(`dryRun.noRows`)}):(0,$.jsxs)(`table`,{className:`w-full text-xs font-mono`,children:[(0,$.jsx)(`thead`,{className:`sticky top-0 bg-muted text-muted-foreground`,children:(0,$.jsx)(`tr`,{children:o.map(e=>(0,$.jsx)(`th`,{className:`px-2 py-1 text-left font-normal whitespace-nowrap`,children:e},e))})}),(0,$.jsx)(`tbody`,{children:s.map((e,t)=>(0,$.jsx)(`tr`,{className:t%2?`bg-muted/40`:``,children:e.map((e,t)=>(0,$.jsx)(`td`,{className:`px-2 py-0.5 whitespace-nowrap max-w-[240px] overflow-hidden text-ellipsis`,children:s3e(e)},t))},t))})]})}),c&&(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`dryRun.truncated`,{shown:s.length,count:a??`?`})}),(0,$.jsxs)(`details`,{className:`text-xs text-muted-foreground`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer`,children:n(`dryRun.previewQuery`)}),(0,$.jsx)(`pre`,{className:`mt-1 max-h-24 overflow-auto rounded-md border bg-muted p-2 font-mono whitespace-pre-wrap break-all`,children:i})]}),(0,$.jsxs)(R9,{children:[(0,$.jsx)(H9,{type:`button`,onClick:()=>t(!1),children:n(`confirm.cancel`)}),(0,$.jsx)(V9,{type:`button`,onClick:()=>t(!0),className:u===`DELETE`?`bg-destructive text-white hover:bg-destructive/90`:``,children:a===null||l?n(`dryRun.runAnyway`):n(`dryRun.run`,{kind:u,count:a})})]})]})})}var u3e={info:(0,$.jsx)(pYe,{className:`size-5 shrink-0 text-muted-foreground`}),success:(0,$.jsx)(k8,{className:`size-5 shrink-0 text-green-500`}),error:(0,$.jsx)(sYe,{className:`size-5 shrink-0 text-destructive`})};function d3e(){let{t:e}=S(),t=c(e=>e.message),n=c(e=>e.resolveMessage);if(!t)return null;let{title:r,description:i,tone:a=`info`}=t.request;return(0,$.jsx)(F9,{open:!0,onOpenChange:e=>{e||n()},children:(0,$.jsxs)(I9,{className:`max-w-md overflow-hidden`,children:[(0,$.jsxs)(L9,{children:[(0,$.jsxs)(z9,{className:`flex min-w-0 items-center gap-2 break-words`,children:[u3e[a],(0,$.jsx)(`span`,{className:`min-w-0 break-words`,children:r})]}),(0,$.jsx)(B9,{className:`min-w-0 break-words [overflow-wrap:anywhere] whitespace-pre-line`,children:i??``})]}),(0,$.jsx)(R9,{children:(0,$.jsx)(V9,{autoFocus:!0,onClick:()=>n(),children:e(`confirm.ok`)})})]})},t.id)}function f3e(){let e=c(e=>e.prompt),t=c(e=>e.resolvePrompt);return e?(0,$.jsx)(p3e,{request:e.request,resolve:t},e.id):null}function p3e({request:e,resolve:t}){let{t:n}=S(),[r,i]=(0,D.useState)(e.defaultValue??``),a=r.trim().length>0;return(0,$.jsx)(F9,{open:!0,onOpenChange:e=>{e||t(null)},children:(0,$.jsx)(I9,{className:`max-w-md overflow-hidden`,children:(0,$.jsxs)(`form`,{className:`contents`,onSubmit:e=>{e.preventDefault(),a&&t(r.trim())},children:[(0,$.jsxs)(L9,{children:[(0,$.jsx)(z9,{className:`min-w-0 break-words`,children:e.title}),(0,$.jsx)(B9,{className:`min-w-0 break-words [overflow-wrap:anywhere] whitespace-pre-line`,children:e.description??``})]}),(0,$.jsx)(U9,{autoFocus:!0,autoComplete:`off`,spellCheck:!1,value:r,placeholder:e.placeholder,onChange:e=>i(e.target.value),onFocus:e=>e.target.select()}),(0,$.jsxs)(R9,{children:[(0,$.jsx)(H9,{type:`button`,onClick:()=>t(null),children:n(`confirm.cancel`)}),(0,$.jsx)(V9,{type:`submit`,disabled:!a,onClick:()=>{a&&t(r.trim())},children:e.confirmLabel??n(`confirm.confirm`)})]})]})})})}function m3e(){let e=t5(e=>e.themeId);(0,D.useEffect)(()=>{let t=iXe(e),n=document.documentElement,r=t.colors;n.style.setProperty(`--t-background`,r.background),n.style.setProperty(`--t-foreground`,r.foreground),n.style.setProperty(`--t-card`,r.card),n.style.setProperty(`--t-card-foreground`,r.cardForeground),n.style.setProperty(`--t-popover`,r.popover),n.style.setProperty(`--t-popover-foreground`,r.popoverForeground),n.style.setProperty(`--t-primary`,r.primary),n.style.setProperty(`--t-primary-foreground`,r.primaryForeground),n.style.setProperty(`--t-secondary`,r.secondary),n.style.setProperty(`--t-secondary-foreground`,r.secondaryForeground),n.style.setProperty(`--t-muted`,r.muted),n.style.setProperty(`--t-muted-foreground`,r.mutedForeground),n.style.setProperty(`--t-accent`,r.accent),n.style.setProperty(`--t-accent-foreground`,r.accentForeground),n.style.setProperty(`--t-destructive`,r.destructive),n.style.setProperty(`--t-destructive-foreground`,r.destructiveForeground),n.style.setProperty(`--t-border`,r.border),n.style.setProperty(`--t-input`,r.input),n.style.setProperty(`--t-ring`,r.ring),n.style.setProperty(`--t-sidebar-background`,r.mantle),n.style.setProperty(`--t-sidebar-foreground`,r.foreground),n.style.setProperty(`--t-sidebar-primary`,r.primary),n.style.setProperty(`--t-sidebar-primary-foreground`,r.primaryForeground),n.style.setProperty(`--t-sidebar-accent`,r.surface0),n.style.setProperty(`--t-sidebar-accent-foreground`,r.foreground),n.style.setProperty(`--t-sidebar-border`,r.surface1),n.style.setProperty(`--t-sidebar-ring`,r.ring),n.style.setProperty(`--t-red`,r.red),n.style.setProperty(`--t-peach`,r.peach),n.style.setProperty(`--t-yellow`,r.yellow),n.style.setProperty(`--t-green`,r.green),n.style.setProperty(`--t-teal`,r.teal),n.style.setProperty(`--t-blue`,r.blue),n.style.setProperty(`--t-lavender`,r.lavender),n.style.setProperty(`--t-mauve`,r.mauve),n.style.setProperty(`--t-sky`,r.sky),n.style.setProperty(`--t-overlay0`,r.overlay0),n.style.setProperty(`--t-overlay1`,r.overlay1),n.style.setProperty(`--t-surface0`,r.surface0),n.style.setProperty(`--t-surface1`,r.surface1),n.style.setProperty(`--t-surface2`,r.surface2),n.style.setProperty(`--t-mantle`,r.mantle),n.style.setProperty(`--t-crust`,r.crust);let i=document.getElementById(`planche-scrollbar-style`)??document.createElement(`style`);i.id=`planche-scrollbar-style`,i.textContent=`
|
|
925
925
|
::-webkit-scrollbar-track { background: ${r.scrollTrack}; }
|
|
926
926
|
::-webkit-scrollbar-thumb { background: ${r.scrollThumb}; border-radius: 4px; }
|