planche 0.7.15 → 0.7.17
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/app/assets/{AboutDialog-DJ1xTjQa.js → AboutDialog-znljyQnx.js} +1 -1
- package/app/assets/ConnectDialog-Bxe0mP_e.js +1 -0
- package/app/assets/{CopyDatabaseDialog-DVaHAD1q.js → CopyDatabaseDialog-N5QtFoaJ.js} +1 -1
- package/app/assets/{CopyTableDialog-BGaxEeFf.js → CopyTableDialog-DU3m9hM4.js} +1 -1
- package/app/assets/{CreateDatabaseDialog-DiwtxqWI.js → CreateDatabaseDialog-CoEVJ90U.js} +1 -1
- package/app/assets/{CreateSchemaDialog-CPhHOdED.js → CreateSchemaDialog-bxvZ9P5c.js} +1 -1
- package/app/assets/{DataDiffDialog-BQzfzN_-.js → DataDiffDialog-nKX0ACC-.js} +1 -1
- package/app/assets/{DownloadToCSVDialog-CMQ_k6oK.js → DownloadToCSVDialog-DdUo0ORh.js} +1 -1
- package/app/assets/{EditSchemaDialog-e9w9yyIn.js → EditSchemaDialog-BaQy8PKH.js} +2 -2
- package/app/assets/{FindReplaceDialog-BbbQS-3c.js → FindReplaceDialog-D5ZYGSHY.js} +1 -1
- package/app/assets/{FlushDialog-D_tK375i.js → FlushDialog-CSS8dkGi.js} +1 -1
- package/app/assets/{LinkColumnDialog-Df-_8K5T.js → LinkColumnDialog-BsalpSZc.js} +1 -1
- package/app/assets/{LocalHistoryDialog-B3Yww-nk.js → LocalHistoryDialog-BMrQIB_G.js} +1 -1
- package/app/assets/{ProcessListDialog-6YJn364S.js → ProcessListDialog-DG4Dx5g0.js} +1 -1
- package/app/assets/QuickCommandPalette-B3pggSef.js +1 -0
- package/app/assets/{RowFormDialog-B5yd3Kv7.js → RowFormDialog-DANBt29z.js} +2 -2
- package/app/assets/{SafetySettingsDialog-ce5eqfIE.js → SafetySettingsDialog-BTw7pePV.js} +1 -1
- package/app/assets/{SchemaDiffDialog-CAU4Tko1.js → SchemaDiffDialog-fdaV0PYL.js} +1 -1
- package/app/assets/{SchemaToHTMLDialog-Bp8NQ4S0.js → SchemaToHTMLDialog-C6G-jwAb.js} +1 -1
- package/app/assets/{StatusDialog-CT8E2pK0.js → StatusDialog-B3olF444.js} +1 -1
- package/app/assets/{UserAddDialog-CyK4YAvW.js → UserAddDialog-BF-VlG8X.js} +1 -1
- package/app/assets/{UserManagerDialog-oRNIMr07.js → UserManagerDialog-B9oy1ki3.js} +1 -1
- package/app/assets/{VariablesDialog-bHfrRqC3.js → VariablesDialog-kv9FBrEY.js} +1 -1
- package/app/assets/database-DGumofGk.js +1 -0
- package/app/assets/{de-sebDJePc.js → de-BCxLqtYG.js} +1 -1
- package/app/assets/{fr-CIPqitfo.js → fr-BFM0dzUF.js} +1 -1
- package/app/assets/{i18n-BBdlx4Gw.js → i18n-Bq2RK9_J.js} +2 -2
- package/app/assets/{ja-Bf1tvh4M.js → ja-ChGb_KdX.js} +1 -1
- package/app/assets/{ko-D8httUGO.js → ko-BDq66jka.js} +1 -1
- package/app/assets/main-CKq8IRiX.css +2 -0
- package/app/assets/{main-BjGObGVl.js → main-D39M4PeA.js} +186 -186
- package/app/assets/pro-usage-CymO6bdA.js +1 -0
- package/app/assets/{query-execution-DqpMGs8z.js → query-execution-K2AH0M79.js} +3 -3
- package/app/assets/{select-BFa0--sE.js → select-DwXB_ZKA.js} +1 -1
- package/app/assets/table-copy-CclNaq6-.js +1 -0
- package/app/assets/{zh-DAWEX6ju.js → zh-C4cAyvNo.js} +1 -1
- package/app/index.html +7 -7
- package/dist/index.js +71 -9
- package/package.json +1 -1
- package/app/assets/ConnectDialog-CsyQZTfv.js +0 -1
- package/app/assets/QuickCommandPalette-Cvvri_sm.js +0 -1
- package/app/assets/database-BUN6Jvbi.js +0 -1
- package/app/assets/main-DaPLBcIe.css +0 -2
- package/app/assets/pro-usage-dBNmC2gt.js +0 -1
- package/app/assets/table-copy-W19HZGKM.js +0 -1
package/dist/index.js
CHANGED
|
@@ -962,6 +962,16 @@ var D1Driver = class {
|
|
|
962
962
|
headers;
|
|
963
963
|
/** Declared column types per table, for result-source resolution. */
|
|
964
964
|
columns = /* @__PURE__ */ new Map();
|
|
965
|
+
/**
|
|
966
|
+
* D1 is a REST call, not a session: there is no cancel to send, so stopping
|
|
967
|
+
* means dropping the request the agent is waiting on. The query may still
|
|
968
|
+
* finish at Cloudflare, which is why this is `abandon` and not `kill`.
|
|
969
|
+
*/
|
|
970
|
+
cancelKind = "abandon";
|
|
971
|
+
inFlight = null;
|
|
972
|
+
async cancel() {
|
|
973
|
+
this.inFlight?.abort();
|
|
974
|
+
}
|
|
965
975
|
constructor(config) {
|
|
966
976
|
this.label = `d1:${config.databaseId}`;
|
|
967
977
|
this.url = `${API}/accounts/${encodeURIComponent(config.accountId)}/d1/database/${encodeURIComponent(config.databaseId)}/raw`;
|
|
@@ -970,8 +980,22 @@ var D1Driver = class {
|
|
|
970
980
|
async raw(sql2) {
|
|
971
981
|
let res;
|
|
972
982
|
try {
|
|
973
|
-
|
|
983
|
+
const controller = new AbortController();
|
|
984
|
+
this.inFlight = controller;
|
|
985
|
+
try {
|
|
986
|
+
res = await fetch(this.url, {
|
|
987
|
+
method: "POST",
|
|
988
|
+
headers: this.headers,
|
|
989
|
+
body: JSON.stringify({ sql: sql2 }),
|
|
990
|
+
signal: AbortSignal.any([controller.signal, AbortSignal.timeout(6e4)])
|
|
991
|
+
});
|
|
992
|
+
} finally {
|
|
993
|
+
if (this.inFlight === controller) this.inFlight = null;
|
|
994
|
+
}
|
|
974
995
|
} catch (err) {
|
|
996
|
+
if (err instanceof Error && err.name === "AbortError") {
|
|
997
|
+
throw new D1Error("Stopped waiting for D1; the query may still finish at Cloudflare.", 400);
|
|
998
|
+
}
|
|
975
999
|
throw new D1Error(`Cannot reach the Cloudflare API: ${err instanceof Error ? err.message : String(err)}`, 400);
|
|
976
1000
|
}
|
|
977
1001
|
let body = null;
|
|
@@ -1196,11 +1220,15 @@ function routeStatement(sql2, known) {
|
|
|
1196
1220
|
}
|
|
1197
1221
|
return { sql: out, target };
|
|
1198
1222
|
}
|
|
1199
|
-
async function fetchJson(url, init, unreachable) {
|
|
1223
|
+
async function fetchJson(url, init, unreachable, abort) {
|
|
1200
1224
|
let res;
|
|
1201
1225
|
try {
|
|
1202
|
-
|
|
1226
|
+
const signal = abort ? AbortSignal.any([abort, AbortSignal.timeout(6e4)]) : AbortSignal.timeout(6e4);
|
|
1227
|
+
res = await fetch(url, { ...init, signal });
|
|
1203
1228
|
} catch (err) {
|
|
1229
|
+
if (err instanceof Error && err.name === "AbortError" && abort?.aborted) {
|
|
1230
|
+
throw new DoError("Stopped waiting for the request; the query may still finish.", 400);
|
|
1231
|
+
}
|
|
1204
1232
|
throw unreachable(err instanceof Error ? err.message : String(err));
|
|
1205
1233
|
}
|
|
1206
1234
|
let body = null;
|
|
@@ -1213,6 +1241,16 @@ async function fetchJson(url, init, unreachable) {
|
|
|
1213
1241
|
var LocalTransport = class {
|
|
1214
1242
|
label;
|
|
1215
1243
|
base;
|
|
1244
|
+
/** The request being waited on, so a stop can drop it. */
|
|
1245
|
+
inFlight = null;
|
|
1246
|
+
abort() {
|
|
1247
|
+
this.inFlight?.abort();
|
|
1248
|
+
}
|
|
1249
|
+
/** Signal for the next request; replaces whatever was tracked before. */
|
|
1250
|
+
track() {
|
|
1251
|
+
this.inFlight = new AbortController();
|
|
1252
|
+
return this.inFlight.signal;
|
|
1253
|
+
}
|
|
1216
1254
|
constructor(devUrl) {
|
|
1217
1255
|
this.label = `do:${devUrl}`;
|
|
1218
1256
|
this.base = `${devUrl.replace(/\/+$/, "")}${LOCAL_EXPLORER}`;
|
|
@@ -1229,7 +1267,8 @@ var LocalTransport = class {
|
|
|
1229
1267
|
(reason) => new DoError(
|
|
1230
1268
|
`Cannot reach a wrangler dev server at ${origin} (${reason}). Run \`wrangler dev\` in your Worker project and try again.`,
|
|
1231
1269
|
400
|
|
1232
|
-
)
|
|
1270
|
+
),
|
|
1271
|
+
this.track()
|
|
1233
1272
|
);
|
|
1234
1273
|
const envelope = parsed && typeof parsed.success === "boolean" && (parsed.result !== void 0 || Array.isArray(parsed.errors)) ? parsed : null;
|
|
1235
1274
|
if (!envelope) {
|
|
@@ -1265,6 +1304,16 @@ var LocalTransport = class {
|
|
|
1265
1304
|
var RemoteTransport = class {
|
|
1266
1305
|
label;
|
|
1267
1306
|
base;
|
|
1307
|
+
/** The request being waited on, so a stop can drop it. */
|
|
1308
|
+
inFlight = null;
|
|
1309
|
+
abort() {
|
|
1310
|
+
this.inFlight?.abort();
|
|
1311
|
+
}
|
|
1312
|
+
/** Signal for the next request; replaces whatever was tracked before. */
|
|
1313
|
+
track() {
|
|
1314
|
+
this.inFlight = new AbortController();
|
|
1315
|
+
return this.inFlight.signal;
|
|
1316
|
+
}
|
|
1268
1317
|
headers;
|
|
1269
1318
|
only;
|
|
1270
1319
|
constructor(config) {
|
|
@@ -1281,7 +1330,8 @@ var RemoteTransport = class {
|
|
|
1281
1330
|
headers: this.headers,
|
|
1282
1331
|
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
1283
1332
|
},
|
|
1284
|
-
(reason) => new DoError(`Cannot reach the Cloudflare API: ${reason}`, 400)
|
|
1333
|
+
(reason) => new DoError(`Cannot reach the Cloudflare API: ${reason}`, 400),
|
|
1334
|
+
this.track()
|
|
1285
1335
|
);
|
|
1286
1336
|
if (res.status === 401 || res.status === 403) {
|
|
1287
1337
|
throw new DoError(
|
|
@@ -1356,6 +1406,14 @@ var DoDriver = class {
|
|
|
1356
1406
|
targets = /* @__PURE__ */ new Map();
|
|
1357
1407
|
/** Declared column types per `database table`, for result-source resolution. */
|
|
1358
1408
|
columns = /* @__PURE__ */ new Map();
|
|
1409
|
+
/**
|
|
1410
|
+
* These are HTTP calls, not sessions: there is nothing to cancel upstream, so
|
|
1411
|
+
* stopping drops the request the agent waits on. `abandon`, not `kill`.
|
|
1412
|
+
*/
|
|
1413
|
+
cancelKind = "abandon";
|
|
1414
|
+
async cancel() {
|
|
1415
|
+
this.transport.abort();
|
|
1416
|
+
}
|
|
1359
1417
|
/**
|
|
1360
1418
|
* Every object of every SQLite-backed namespace, as app-level database
|
|
1361
1419
|
* names. Locally, a `wrangler dev` session registers itself in wrangler's
|
|
@@ -2104,6 +2162,9 @@ function tunneled(driver, tunnel, label) {
|
|
|
2104
2162
|
label,
|
|
2105
2163
|
query: (sql2, database) => driver.query(sql2, database),
|
|
2106
2164
|
setReadOnly: driver.setReadOnly ? () => driver.setReadOnly() : void 0,
|
|
2165
|
+
// Forwarded, or a tunnelled connection would report that its engine cannot
|
|
2166
|
+
// interrupt a statement when it is only this wrapper that cannot.
|
|
2167
|
+
cancel: driver.cancel ? () => driver.cancel() : void 0,
|
|
2107
2168
|
async close() {
|
|
2108
2169
|
try {
|
|
2109
2170
|
await driver.close();
|
|
@@ -2654,9 +2715,9 @@ var ConnectionManager = class {
|
|
|
2654
2715
|
async cancel(connectionId) {
|
|
2655
2716
|
const driver = this.connections.get(connectionId);
|
|
2656
2717
|
if (!driver) throw new Error(`Connection not found: ${connectionId}`);
|
|
2657
|
-
if (!driver.cancel) return false;
|
|
2718
|
+
if (!driver.cancel) return { cancelled: false, abandoned: false };
|
|
2658
2719
|
await driver.cancel();
|
|
2659
|
-
return true;
|
|
2720
|
+
return { cancelled: true, abandoned: driver.cancelKind === "abandon" };
|
|
2660
2721
|
}
|
|
2661
2722
|
/**
|
|
2662
2723
|
* Close and remove a connection.
|
|
@@ -2968,11 +3029,12 @@ function createAgent(options) {
|
|
|
2968
3029
|
fail(res, 400, "connectionId is required");
|
|
2969
3030
|
return;
|
|
2970
3031
|
}
|
|
2971
|
-
const cancelled = await manager.cancel(connectionId);
|
|
3032
|
+
const { cancelled, abandoned } = await manager.cancel(connectionId);
|
|
2972
3033
|
const body = {
|
|
2973
3034
|
success: true,
|
|
2974
3035
|
cancelled,
|
|
2975
|
-
|
|
3036
|
+
abandoned,
|
|
3037
|
+
message: !cancelled ? "This engine cannot interrupt a running statement" : abandoned ? "Stopped waiting for the request; the query may still finish upstream" : "Cancel sent"
|
|
2976
3038
|
};
|
|
2977
3039
|
res.json(body);
|
|
2978
3040
|
} catch (err) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "planche",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.17",
|
|
4
4
|
"description": "Local agent for Planche — lets the browser-based Planche SQL client reach MySQL/MariaDB/PostgreSQL/SQLite/SQL Server/Oracle/Neon/Supabase/Cloudflare D1 databases and local Durable Object storage from your machine.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"homepage": "https://planche.dev",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as e,n as t,t as n,v as r}from"./ui-store-DfspmPOn.js";import{$ as i,C as a,F as o,M as s,N as c,S as l,a as u,b as d,c as f,d as p,i as m,j as h,l as g,n as _,o as v,r as y,s as b,u as x,w as S,x as C,y as w}from"./main-BjGObGVl.js";import{l as T,m as E,t as D}from"./button--s6nUzD8.js";import{a as O,i as k,n as A,r as j,t as M}from"./select-BFa0--sE.js";import{t as N}from"./connection-store-DjSajhjh.js";import{n as ee}from"./query-store-Bz1pmp4E.js";import{A as P,C as te,E as ne,N as F,T as re,c as I,h as ie,j as L,n as ae,r as oe,u as R,x as se}from"./database-BUN6Jvbi.js";import{n as z,t as B}from"./dbms-B9Zk7nEm.js";import{a as ce,i as le,n as ue,o as de,t as fe}from"./dialog-CJoWJzRo.js";var V=r(e(),1),H=new Set([`postgres:`,`postgresql:`]);function U(e){let t=e.trim().replace(/^psql\s+(['"])?/,``).replace(/['"]$/,``);if(!/^postgres(ql)?:\/\//i.test(t))return null;let n;try{n=new URL(t)}catch{return null}if(!H.has(n.protocol.toLowerCase())||!n.hostname)return null;let r=e=>{try{return decodeURIComponent(e)}catch{return e}},i={host:n.hostname};n.port&&(i.port=Number(n.port)),n.username&&(i.user=r(n.username)),n.password&&(i.pass=r(n.password));let a=r(n.pathname.replace(/^\//,``));return a&&(i.database=a),i}var W=T(),G=[`utf8`,`utf8mb4`,`latin1`,`ascii`,`euckr`,`sjis`,`big5`],K={enabled:!1,host:``,port:22,user:``,auth:`key`};function q({label:e,htmlFor:t,children:n}){return(0,W.jsxs)(`div`,{className:`grid grid-cols-[120px_minmax(0,1fr)] items-center gap-2`,children:[(0,W.jsx)(g,{htmlFor:t,children:e}),n]})}function pe({value:e,onChange:t}){let{t:n}=E();function r(n,r){t({...e,[n]:r})}let i=e.dbms===`sqlite`,a=e.transport??`browser`,l=i&&a===`browser`,u=L.has(e.dbms),d=e.dbms===`d1`,f=e.dbms===`do`,m=B.find(t=>t.id===e.dbms)?.capabilities,h=e.ssh??K,[g,_]=(0,V.useState)(``),y=g.trim()===``?`empty`:U(g)?`applied`:`invalid`,S=e.dbms===`supabase`&&e.port===6543;function C(n){_(n);let r=U(n);r&&t({...e,host:r.host??e.host,port:r.port??B.find(t=>t.id===e.dbms)?.defaultPort??e.port,user:r.user??e.user,pass:r.pass??e.pass,database:r.database??e.database})}function w(n){t({...e,ssh:{...h,...n}})}async function T(e){e&&w({privateKey:await e.text(),privateKeyName:e.name})}return(0,W.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,W.jsx)(q,{label:n(`connection.form.hostName`),htmlFor:`conn-hostName`,children:(0,W.jsx)(x,{id:`conn-hostName`,placeholder:n(`connection.form.hostNamePlaceholder`),value:e.hostName,onChange:e=>r(`hostName`,e.target.value)})}),(0,W.jsx)(q,{label:n(`connection.form.dataSource`),children:(0,W.jsxs)(M,{value:e.dbms,onValueChange:n=>{let r=B.find(e=>e.id===n);if(!r)return;let i=r.id,a=L.has(i)||i===`d1`||i===`do`;_(``),t({...e,dbms:i,transactionMode:r.capabilities.transactions?e.transactionMode:`auto`,port:r.defaultPort??e.port,host:a&&e.host===`localhost`?``:!a&&e.host===``?`localhost`:e.host,user:a||u||d||f?b(i):e.user,devUrl:i===`do`?e.devUrl||`http://localhost:8787`:e.devUrl,database:e.database&&!a&&!u&&!d&&!f?e.database:v(i)??e.database})},children:[(0,W.jsx)(k,{id:`conn-dbms`,className:`w-full`,children:(0,W.jsx)(O,{})}),(0,W.jsx)(A,{children:B.map(e=>(0,W.jsx)(j,{value:e.id,children:(0,W.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(p,{dbms:e.id}),e.label]})},e.id))})]})}),u&&(0,W.jsx)(q,{label:n(`connection.form.connectionString`),htmlFor:`conn-uri`,children:(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsx)(x,{id:`conn-uri`,type:`password`,autoComplete:`off`,spellCheck:!1,className:`font-mono text-xs`,placeholder:e.dbms===`neon`?`postgresql://neondb_owner:npg_…@ep-….neon.tech/neondb?sslmode=require`:`postgresql://postgres.[ref]:[password]@aws-0-….pooler.supabase.com:5432/postgres`,value:g,onChange:e=>C(e.target.value)}),(0,W.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed ${y===`invalid`?`text-destructive`:`text-muted-foreground`}`,children:n(y===`invalid`?`connection.form.connectionStringInvalid`:y===`applied`?`connection.form.connectionStringApplied`:e.dbms===`neon`?`connection.form.neonHint`:`connection.form.supabaseHint`)})]})}),i&&(0,W.jsxs)(q,{label:n(`connection.form.openVia`),children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,W.jsxs)(`label`,{className:`flex items-center gap-1.5 text-sm cursor-pointer`,children:[(0,W.jsx)(`input`,{type:`radio`,name:`transport`,value:`browser`,checked:a===`browser`,onChange:()=>r(`transport`,`browser`),className:`accent-primary`}),n(`connection.form.viaBrowser`)]}),(0,W.jsxs)(`label`,{className:`flex items-center gap-1.5 text-sm cursor-pointer`,children:[(0,W.jsx)(`input`,{type:`radio`,name:`transport`,value:`tunnel`,checked:a===`tunnel`,onChange:()=>r(`transport`,`tunnel`),className:`accent-primary`}),n(`connection.form.viaAgent`)]})]}),(0,W.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(a===`browser`?`connection.form.viaBrowserHint`:`connection.form.viaAgentHint`)})]}),l?(0,W.jsx)(q,{label:n(`connection.form.databaseFile`),children:(0,W.jsxs)(`div`,{className:`min-w-0 text-xs text-muted-foreground leading-relaxed`,children:[e.file?(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,W.jsx)(`span`,{className:`min-w-0 break-all text-foreground`,title:e.file,children:e.file}),(0,W.jsx)(D,{type:`button`,variant:`outline`,size:`sm`,className:`h-6 shrink-0 px-2 text-xs`,onClick:()=>{I(e.id),r(`file`,``)},children:n(`connection.form.changeFile`)})]}):(0,W.jsx)(`p`,{children:n(`connection.form.filePickerHint`)}),(0,W.jsx)(`p`,{className:`mt-1`,children:n(`connection.form.fileRememberedHint`)})]})}):null,!l&&(0,W.jsx)(q,{label:n(`connection.form.authToken`),htmlFor:`conn-authToken`,children:(0,W.jsx)(x,{id:`conn-authToken`,type:`password`,placeholder:n(`connection.form.authTokenPlaceholder`),value:e.authToken,onChange:e=>r(`authToken`,e.target.value.trim())})}),l?null:f?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{label:n(`connection.form.doDevUrl`),htmlFor:`conn-do-url`,children:(0,W.jsx)(x,{id:`conn-do-url`,className:`font-mono text-xs`,spellCheck:!1,placeholder:`http://localhost:8787`,value:e.devUrl??``,onChange:e=>r(`devUrl`,e.target.value.trim())})}),(0,W.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.doHint`)}),(0,W.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.doLimitsHint`)})]}):d?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{label:n(`connection.form.d1AccountId`),htmlFor:`conn-d1-account`,children:(0,W.jsx)(x,{id:`conn-d1-account`,className:`font-mono text-xs`,spellCheck:!1,placeholder:`023e105f4ecef8ad9ca31a8372d0c353`,value:e.accountId??``,onChange:e=>r(`accountId`,e.target.value.trim())})}),(0,W.jsx)(q,{label:n(`connection.form.d1DatabaseId`),htmlFor:`conn-d1-database`,children:(0,W.jsx)(x,{id:`conn-d1-database`,className:`font-mono text-xs`,spellCheck:!1,placeholder:`xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`,value:e.databaseId??``,onChange:e=>r(`databaseId`,e.target.value.trim())})}),(0,W.jsx)(q,{label:n(`connection.form.d1ApiToken`),htmlFor:`conn-pass`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,W.jsx)(x,{id:`conn-pass`,type:`password`,value:e.pass,onChange:e=>r(`pass`,e.target.value.trim())}),(0,W.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs whitespace-nowrap cursor-pointer`,title:n(`connection.form.savePasswordHint`),children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:e.savePassword??!0,onChange:e=>r(`savePassword`,e.target.checked)}),n(`connection.form.savePassword`)]})]})}),(0,W.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.d1Hint`)}),(0,W.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.d1LimitsHint`)})]}):i?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{label:n(`connection.form.databaseFile`),htmlFor:`conn-file`,children:(0,W.jsx)(x,{id:`conn-file`,placeholder:n(`connection.form.filePathPlaceholder`),value:e.file??``,onChange:e=>r(`file`,e.target.value)})}),(0,W.jsx)(q,{label:n(`connection.form.createIfMissing`),htmlFor:`conn-create`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`input`,{id:`conn-create`,type:`checkbox`,checked:e.createIfMissing??!1,onChange:e=>r(`createIfMissing`,e.target.checked),className:`size-4 accent-primary cursor-pointer`}),(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`connection.form.createIfMissingHint`)})]})})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{label:n(`connection.form.host`),htmlFor:`conn-host`,children:(0,W.jsx)(x,{id:`conn-host`,placeholder:e.dbms===`neon`?`ep-….aws.neon.tech`:e.dbms===`supabase`?`aws-0-….pooler.supabase.com`:`localhost`,value:e.host,onChange:e=>r(`host`,e.target.value)})}),(0,W.jsx)(q,{label:n(`connection.form.port`),htmlFor:`conn-port`,children:(0,W.jsx)(x,{id:`conn-port`,type:`number`,value:e.port,onChange:t=>r(`port`,Number(t.target.value)||B.find(t=>t.id===e.dbms)?.defaultPort||3306)})}),S&&(0,W.jsx)(`p`,{className:`col-start-2 rounded-md border border-yellow-500/40 bg-yellow-500/10 px-2 py-1.5 text-xs leading-relaxed text-foreground`,children:n(`connection.form.supabasePoolerWarning`)}),(F(e.dbms)||e.dbms===`mssql`||e.dbms===`oracle`)&&(0,W.jsx)(q,{label:e.dbms===`oracle`?n(`connection.form.serviceName`):n(`connection.form.database`),htmlFor:`conn-database`,children:(0,W.jsx)(x,{id:`conn-database`,placeholder:v(e.dbms),value:e.database??``,onChange:e=>r(`database`,e.target.value.trim())})}),(0,W.jsx)(q,{label:n(`connection.form.user`),htmlFor:`conn-user`,children:(0,W.jsx)(x,{id:`conn-user`,placeholder:b(e.dbms),value:e.user,onChange:e=>r(`user`,e.target.value)})}),(0,W.jsx)(q,{label:n(`connection.form.password`),htmlFor:`conn-pass`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,W.jsx)(x,{id:`conn-pass`,type:`password`,value:e.pass,onChange:e=>r(`pass`,e.target.value)}),(0,W.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs whitespace-nowrap cursor-pointer`,title:n(`connection.form.savePasswordHint`),children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:e.savePassword??!0,onChange:e=>r(`savePassword`,e.target.checked)}),n(`connection.form.savePassword`)]})]})}),u&&(0,W.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.managedTlsHint`)}),!u&&e.dbms!==`oracle`&&(0,W.jsx)(q,{label:n(`connection.form.tls`),children:(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,W.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs cursor-pointer`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:e.ssl??!1,onChange:e=>r(`ssl`,e.target.checked),className:`size-4 accent-primary`}),n(`connection.form.tlsEnable`)]}),(0,W.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs cursor-pointer ${e.ssl?``:`opacity-50`}`,title:n(`connection.form.tlsVerifyHint`),children:[(0,W.jsx)(`input`,{type:`checkbox`,disabled:!e.ssl,checked:e.sslVerify??!1,onChange:e=>r(`sslVerify`,e.target.checked),className:`size-4 accent-primary`}),n(`connection.form.tlsVerify`)]})]})}),!u&&(0,W.jsx)(q,{label:n(`connection.form.charset`),children:(0,W.jsxs)(M,{value:e.charset,onValueChange:e=>r(`charset`,e),children:[(0,W.jsx)(k,{className:`w-full`,children:(0,W.jsx)(O,{})}),(0,W.jsx)(A,{children:G.map(e=>(0,W.jsx)(j,{value:e,children:e},e))})]})})]}),!i&&!u&&!d&&!f&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`mt-1 flex items-center border-t pt-3 text-xs font-medium text-muted-foreground`,children:[n(`connection.form.ssh`),(0,W.jsx)(o,{className:`ml-2`})]}),(0,W.jsx)(q,{label:n(`connection.form.sshTunnel`),htmlFor:`conn-ssh`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`input`,{id:`conn-ssh`,type:`checkbox`,checked:h.enabled,onChange:e=>w({enabled:e.target.checked}),className:`size-4 accent-primary cursor-pointer`}),(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`connection.form.sshTunnelHint`)})]})}),h.enabled&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{label:n(`connection.form.sshHost`),htmlFor:`conn-ssh-host`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(x,{id:`conn-ssh-host`,placeholder:n(`connection.form.sshHostPlaceholder`),value:h.host,onChange:e=>w({host:e.target.value.trim()})}),(0,W.jsx)(x,{"aria-label":n(`connection.form.sshPort`),type:`number`,className:`w-24 shrink-0`,value:h.port,onChange:e=>w({port:Number(e.target.value)||22})})]})}),(0,W.jsx)(q,{label:n(`connection.form.sshUser`),htmlFor:`conn-ssh-user`,children:(0,W.jsx)(x,{id:`conn-ssh-user`,placeholder:n(`connection.form.sshUserPlaceholder`),value:h.user,onChange:e=>w({user:e.target.value.trim()})})}),(0,W.jsx)(q,{label:n(`connection.form.sshAuth`),children:(0,W.jsxs)(M,{value:h.auth,onValueChange:e=>w({auth:e}),children:[(0,W.jsx)(k,{className:`w-full`,children:(0,W.jsx)(O,{})}),(0,W.jsxs)(A,{children:[(0,W.jsx)(j,{value:`key`,children:n(`connection.form.sshAuthKey`)}),(0,W.jsx)(j,{value:`password`,children:n(`connection.form.sshAuthPassword`)}),(0,W.jsx)(j,{value:`agent`,children:n(`connection.form.sshAuthAgent`)})]})]})}),h.auth===`password`&&(0,W.jsx)(q,{label:n(`connection.form.sshPassword`),htmlFor:`conn-ssh-pass`,children:(0,W.jsx)(x,{id:`conn-ssh-pass`,type:`password`,value:h.password??``,onChange:e=>w({password:e.target.value})})}),h.auth===`key`&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{label:n(`connection.form.sshKey`),htmlFor:`conn-ssh-key`,children:(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,W.jsx)(`input`,{id:`conn-ssh-key`,type:`file`,className:`hidden`,onChange:e=>{T(e.target.files?.[0]),e.target.value=``}}),(0,W.jsx)(D,{type:`button`,variant:`outline`,size:`sm`,className:`h-7 shrink-0 px-2 text-xs`,onClick:()=>document.getElementById(`conn-ssh-key`)?.click(),children:h.privateKey?n(`connection.form.changeFile`):n(`connection.form.sshKeyPick`)}),(0,W.jsx)(`span`,{className:`min-w-0 truncate text-xs text-muted-foreground`,title:h.privateKeyName,children:h.privateKey?h.privateKeyName||n(`connection.form.sshKeyLoaded`):n(`connection.form.sshKeyHint`)})]})}),(0,W.jsx)(q,{label:n(`connection.form.sshPassphrase`),htmlFor:`conn-ssh-passphrase`,children:(0,W.jsx)(x,{id:`conn-ssh-passphrase`,type:`password`,placeholder:n(`connection.form.sshPassphrasePlaceholder`),value:h.passphrase??``,onChange:e=>w({passphrase:e.target.value})})})]}),h.auth===`agent`&&(0,W.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.sshAuthAgentHint`)}),(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.sshTargetHint`)}),(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.sshSecretsHint`)})]})]}),(0,W.jsx)(q,{label:n(`connection.form.autoConnection`),htmlFor:`conn-auto`,children:(0,W.jsx)(`div`,{className:`flex items-center`,children:(0,W.jsx)(`input`,{id:`conn-auto`,type:`checkbox`,checked:e.autoConnection,onChange:e=>r(`autoConnection`,e.target.checked),className:`size-4 accent-primary cursor-pointer`})})}),(0,W.jsx)(`div`,{className:`mt-1 border-t pt-3 text-xs font-medium text-muted-foreground`,children:n(`connection.form.safety`)}),(0,W.jsx)(q,{label:n(`connection.form.environment`),children:(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[s.map(t=>{let n=(e.environmentColor??`none`)===t.id;return(0,W.jsx)(`button`,{type:`button`,title:c(t.id),"aria-label":c(t.id),"aria-pressed":n,onClick:()=>r(`environmentColor`,t.id),className:`size-6 rounded-full border-2 transition-transform ${n?`scale-110 border-foreground`:`border-transparent hover:scale-105`}`,style:{background:t.id===`none`?`repeating-linear-gradient(45deg, transparent, transparent 3px, var(--muted-foreground) 3px, var(--muted-foreground) 4px)`:t.hex}},t.id)}),(0,W.jsx)(`span`,{className:`ml-1 text-xs text-muted-foreground`,children:n(`connection.form.environmentHint`)})]})}),(0,W.jsx)(q,{label:n(`connection.form.readOnly`),htmlFor:`conn-readonly`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`input`,{id:`conn-readonly`,type:`checkbox`,checked:e.readOnly??!1,onChange:e=>r(`readOnly`,e.target.checked),className:`size-4 accent-primary cursor-pointer`}),(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`connection.form.readOnlyHint`)})]})}),m?.transactions!==!1&&(0,W.jsx)(q,{label:n(`connection.form.transactions`),children:(0,W.jsxs)(M,{value:e.transactionMode??`auto`,onValueChange:e=>r(`transactionMode`,e),children:[(0,W.jsx)(k,{className:`w-full`,children:(0,W.jsx)(O,{})}),(0,W.jsxs)(A,{children:[(0,W.jsx)(j,{value:`auto`,children:n(`connection.form.txAuto`)}),(0,W.jsx)(j,{value:`manual`,children:n(`connection.form.txManual`)})]})]})})]})}function J(){let{t:e}=E(),{activeDialog:r,closeDialog:o,showMessage:s}=t(),[c,g]=(0,V.useState)(!1),{savedConnections:v,addSavedConnection:b,updateSavedConnection:x,deleteSavedConnection:T,openConnection:O}=N(),k=n(`connect`)?.profileId,[A,j]=(0,V.useState)(()=>k??null),[M,F]=(0,V.useState)(()=>{let e=k?v.find(e=>e.id===k):void 0;return e?{...e}:null}),I=r===`connect`,[L,B]=(0,V.useState)(null),[H,U]=(0,V.useState)(null),G=f(e=>e.url),K=f(e=>e.token);(0,V.useEffect)(()=>{if(!I)return;let e=!1;return(async()=>{try{let t=await te();if(e||t.state!==`online`||!t.gateway){e||B(null);return}let n=await re();e||(B({name:n.gateway,profiles:n.profiles}),U(null))}catch(t){e||U(t instanceof Error?t.message:String(t))}})(),()=>{e=!0}},[I,G,K]);function q(n){let r=v.find(e=>e.gatewayProfile===n.name);if(r){Y(r);return}let i=y(n);b(i),Y(i),t.getState().setFooterMessage(e(`connection.dialog.gatewayAdded`,{name:n.name}))}function J(e){e||(o(),j(null),F(null))}function Y(e){j(e.id),F({...e})}function me(e){F(e),x(e.id,e)}function he(){let e=u();b(e),j(e.id),F(e)}function ge(){A&&(T(A),j(null),F(null))}let[_e,X]=(0,V.useState)(!1),ve=ee(e=>e.addQueryTab);function Z(t){let n=N.getState().activeConnections.some(e=>e.id===t.id);if(O(t),n){se.getState().removeTree(t.id),o(),j(null),F(null);return}ve(t.id,{id:`tab-${Date.now()}`,title:e(`connection.dialog.firstQueryTab`),query:``,database:``,isExecuting:!1,results:[],error:null,executionTime:null}),o(),j(null),F(null)}async function ye(n){let r=await ae(n.id,{interactive:!0});if(!r)return;let i={...n,file:r.fileName,serverConnectionId:r.connectionId};x(n.id,{file:r.fileName}),Z(i),N.getState().setFileDetached(n.id,r.fileDetached),r.restoredUnsaved?t.getState().setFooterMessage(e(r.diskChanged?`connection.dialog.restoredUnsavedDiskChanged`:`connection.dialog.restoredUnsaved`,{file:r.fileName})):r.wal&&!r.walApplied?t.getState().setFooterMessage(e(`connection.dialog.walPending`,{file:r.fileName})):r.walApplied&&t.getState().setFooterMessage(e(`connection.dialog.walApplied`,{file:r.fileName}))}async function Q(n,r){try{return await r(n)}catch(i){let a=ne(i);if(!a||!(`ssh`in n)||!n.ssh||!await t.getState().requestDestructiveConfirm({title:e(`connection.dialog.hostKeyTitle`),description:e(`connection.dialog.hostKeyDescription`,a),confirmLabel:e(`connection.dialog.hostKeyAccept`)}))throw i;return r({...n,ssh:{...n.ssh,acceptHostKey:a.fingerprint}})}}async function $(){if(M){X(!0);try{if(R(M)===`browser`){await ye(M);return}let t=await Q(P(M),e=>oe(e,M.authToken||void 0));t.success?Z({...M,serverConnectionId:t.connectionId}):s({tone:`error`,title:e(`connection.dialog.connectFailedTitle`),description:t.message??e(`connection.dialog.unknownError`)})}catch(t){s({tone:`error`,title:e(`connection.dialog.connectFailedTitle`),description:t instanceof Error?t.message:String(t)})}finally{X(!1)}}}async function be(){if(M){if(R(M)===`browser`){s({tone:`info`,title:e(`connection.dialog.testConnection`),description:e(`connection.dialog.browserTestHint`)});return}g(!0);try{let t=await Q(P(M),e=>ie(e,M.authToken||void 0));t.success?s({tone:`success`,title:e(`connection.dialog.testSuccess`),description:e(`connection.dialog.testSuccessDescription`)}):s({tone:`error`,title:e(`connection.dialog.testFailedTitle`),description:t.message??e(`connection.dialog.unknownError`)})}catch(t){s({tone:`error`,title:e(`connection.dialog.testFailedTitle`),description:t instanceof Error?t.message:String(t)})}finally{g(!1)}}}return(0,W.jsx)(fe,{open:I,onOpenChange:J,children:(0,W.jsxs)(ue,{className:`sm:max-w-[1100px] h-[85vh] max-h-[85vh] flex flex-col`,children:[(0,W.jsx)(ce,{children:(0,W.jsx)(de,{children:e(`connection.dialog.title`)})}),(0,W.jsxs)(`p`,{className:`flex items-start gap-2 rounded-md border border-catppuccin-green/40 bg-catppuccin-green/10 px-3 py-2 text-xs leading-relaxed text-foreground`,children:[(0,W.jsx)(i,{className:`mt-0.5 size-4 shrink-0 text-catppuccin-green`,"aria-hidden":!0}),(0,W.jsx)(`span`,{children:e(`connection.dialog.privacy`)})]}),(0,W.jsxs)(`div`,{className:`flex flex-1 gap-4 overflow-hidden min-h-0`,children:[(0,W.jsxs)(`div`,{className:`w-[460px] shrink-0 border rounded-md overflow-hidden flex flex-col`,children:[(L||H)&&(0,W.jsxs)(`div`,{className:`border-b p-2 text-xs space-y-1 max-h-40 overflow-auto`,children:[(0,W.jsxs)(`p`,{className:`font-medium`,children:[e(`connection.dialog.gatewayTitle`),L?` — ${L.name}`:``]}),H&&(0,W.jsx)(`p`,{className:`text-destructive`,children:e(`connection.dialog.gatewayLoadFailed`,{error:H})}),L?.profiles.map(t=>(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,W.jsxs)(`span`,{className:`flex items-center gap-1.5 truncate`,children:[(0,W.jsx)(p,{dbms:_[t.driver],className:`size-3.5`}),(0,W.jsx)(`span`,{className:`truncate`,children:t.name}),(0,W.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,t.readOnly?e(`connection.dialog.gatewayReadOnly`):e(`connection.dialog.gatewayWritable`),`)`]})]}),(0,W.jsx)(D,{size:`sm`,variant:`outline`,className:`h-6 px-2 text-xs`,onClick:()=>q(t),children:e(`connection.dialog.gatewayAdd`)})]},t.name))]}),(0,W.jsx)(h,{className:`h-full`,children:(0,W.jsxs)(w,{className:`table-fixed`,children:[(0,W.jsx)(a,{children:(0,W.jsxs)(S,{children:[(0,W.jsx)(l,{className:`w-[32%]`,children:e(`connection.dialog.colHostName`)}),(0,W.jsx)(l,{className:`w-[40%]`,children:e(`connection.dialog.colTarget`)}),(0,W.jsx)(l,{className:`w-[28%]`,children:e(`connection.dialog.colDbms`)})]})}),(0,W.jsx)(d,{children:v.length===0?(0,W.jsx)(S,{children:(0,W.jsx)(C,{colSpan:3,className:`text-center text-muted-foreground`,children:e(`connection.dialog.noSaved`)})}):v.map(t=>(0,W.jsxs)(S,{"data-state":A===t.id?`selected`:void 0,className:`cursor-pointer`,onClick:()=>Y(t),onDoubleClick:()=>{Y(t),$()},children:[(0,W.jsx)(C,{className:`truncate font-medium`,title:t.hostName,children:t.hostName||e(`connection.dialog.unnamed`)}),(0,W.jsx)(C,{className:`truncate`,title:t.dbms===`sqlite`?t.file:t.dbms===`d1`?t.databaseId:t.dbms===`do`?t.devUrl:`${t.user}@${t.host}:${t.port}`,children:t.dbms===`sqlite`?t.file||(R(t)===`browser`?e(`connection.dialog.pickOnConnect`):e(`connection.dialog.noFile`)):t.dbms===`d1`?t.databaseId||`—`:t.dbms===`do`?t.devUrl||`—`:`${t.user}@${t.host}:${t.port}`}),(0,W.jsx)(C,{className:`truncate`,title:z(t.dbms).label,children:(0,W.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,W.jsx)(p,{dbms:t.dbms,className:`size-3.5`}),(0,W.jsx)(`span`,{className:`truncate`,children:z(t.dbms).label})]})})]},t.id))})]})})]}),(0,W.jsx)(`div`,{className:`flex-1 border rounded-md overflow-auto`,children:M?(0,W.jsxs)(W.Fragment,{children:[R(M)!==`browser`&&(0,W.jsx)(`div`,{className:`p-4 pb-0`,children:(0,W.jsx)(m,{})}),M.gatewayProfile?(0,W.jsxs)(`div`,{className:`p-4 space-y-2 text-sm`,children:[(0,W.jsxs)(`p`,{className:`font-medium flex items-center gap-2`,children:[(0,W.jsx)(p,{dbms:M.dbms,className:`size-4`}),M.hostName]}),(0,W.jsx)(`p`,{className:`text-muted-foreground`,children:e(`connection.dialog.gatewayProfileHint`,{name:M.gatewayProfile})}),(0,W.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[M.readOnly?e(`connection.dialog.gatewayReadOnly`):e(`connection.dialog.gatewayWritable`),M.database?` · ${M.database}`:``]})]}):(0,W.jsx)(pe,{value:M,onChange:me})]}):(0,W.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground text-sm`,children:e(`connection.dialog.selectPrompt`)})})]}),(0,W.jsxs)(le,{className:`sm:justify-between`,children:[(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsx)(D,{variant:`outline`,onClick:he,children:e(`connection.dialog.addNew`)}),(0,W.jsx)(D,{variant:`destructive`,onClick:ge,disabled:!A,children:e(`connection.dialog.delete`)})]}),(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsx)(D,{variant:`outline`,onClick:be,disabled:!M||c,children:e(`connection.dialog.testConnection`)}),(0,W.jsx)(D,{onClick:$,disabled:!M||_e,children:e(`connection.dialog.connect`)}),(0,W.jsx)(D,{variant:`outline`,onClick:()=>J(!1),children:e(`connection.dialog.close`)})]})]})]})})}export{J as ConnectDialog};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,h as t,n,v as r}from"./ui-store-DfspmPOn.js";import{B as i,F as a,G as o,J as s,K as c,L as l,Q as u,U as d,W as f,Y as p,Z as m,at as ee,bt as h,dt as g,et as _,gt as v,it as te,lt as y,nt as b,q as x,rt as S,st as ne,tt as C,ut as w,z as T}from"./main-BjGObGVl.js";import{a as E,f as D,l as O,m as k,o as A,s as j}from"./button--s6nUzD8.js";import{r as M,t as N}from"./i18n-BBdlx4Gw.js";import{_ as P,a as F,o as I,r as re,t as ie}from"./dist-CBYDYlja.js";import{t as L}from"./connection-store-DjSajhjh.js";import{n as ae}from"./query-store-Bz1pmp4E.js";import{n as oe,r as se}from"./settings-store-CSRx4hwh.js";import{r as ce,s as le}from"./query-execution-DqpMGs8z.js";import{t as ue}from"./use-engine-C_C2qpfD.js";import{a as de,n as R,o as z,r as B,t as fe}from"./dialog-CJoWJzRo.js";var pe=E(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),me=E(`copy-plus`,[[`line`,{x1:`15`,x2:`15`,y1:`12`,y2:`18`,key:`1p7wdc`}],[`line`,{x1:`12`,x2:`18`,y1:`15`,y2:`15`,key:`1nscbv`}],[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),he=E(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),ge=E(`database-zap`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 15 21.84`,key:`14ibmq`}],[`path`,{d:`M21 5V8`,key:`1marbg`}],[`path`,{d:`M21 12L18 17H22L19 22`,key:`zafso`}],[`path`,{d:`M3 12A9 3 0 0 0 14.59 14.87`,key:`1y4wr8`}]]),_e=E(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),ve=E(`file-spreadsheet`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]),ye=E(`git-compare`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`path`,{d:`M11 18H8a2 2 0 0 1-2-2V9`,key:`19pyzm`}]]),be=E(`git-compare-arrows`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`M12 18H7a2 2 0 0 1-2-2V9`,key:`16sdep`}],[`path`,{d:`m9 15 3 3-3 3`,key:`1m3kbl`}]]),xe=E(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),Se=E(`languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),Ce=E(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),we=E(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]),Te=E(`replace`,[[`path`,{d:`M14 4a1 1 0 0 1 1-1`,key:`dhj8ez`}],[`path`,{d:`M15 10a1 1 0 0 1-1-1`,key:`1mnyi5`}],[`path`,{d:`M21 4a1 1 0 0 0-1-1`,key:`sfs9ap`}],[`path`,{d:`M21 9a1 1 0 0 1-1 1`,key:`mp6qeo`}],[`path`,{d:`m3 7 3 3 3-3`,key:`x25e72`}],[`path`,{d:`M6 10V5a2 2 0 0 1 2-2h2`,key:`15xut4`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}]]),Ee=E(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),De=E(`scale`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`m19 8 3 8a5 5 0 0 1-6 0zV7`,key:`zcdpyk`}],[`path`,{d:`M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1`,key:`1yorad`}],[`path`,{d:`m5 8 3 8a5 5 0 0 1-6 0zV7`,key:`eua70x`}],[`path`,{d:`M7 21h10`,key:`1b0cd5`}]]),Oe=E(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),ke=E(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),Ae=E(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),je=E(`waypoints`,[[`path`,{d:`m10.586 5.414-5.172 5.172`,key:`4mc350`}],[`path`,{d:`m18.586 13.414-5.172 5.172`,key:`8c96vv`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`circle`,{cx:`12`,cy:`20`,r:`2`,key:`144qzu`}],[`circle`,{cx:`12`,cy:`4`,r:`2`,key:`muu5ef`}],[`circle`,{cx:`20`,cy:`12`,r:`2`,key:`1xzzfp`}],[`circle`,{cx:`4`,cy:`12`,r:`2`,key:`1hvhnz`}]]),Me=E(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),V=r(t(),1),Ne=1,Pe=.9,Fe=.8,Ie=.17,H=.1,U=.999,W=.9999,Le=.99,Re=/[\\\/_+.#"@\[\(\{&]/,ze=/[\\\/_+.#"@\[\(\{&]/g,Be=/[\s-]/,Ve=/[\s-]/g;function He(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?Ne:Le;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=He(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=Ne:Re.test(e.charAt(l-1))?(d*=Fe,p=e.slice(i,l-1).match(ze),p&&i>0&&(d*=U**+p.length)):Be.test(e.charAt(l-1))?(d*=Pe,m=e.slice(i,l-1).match(Ve),m&&i>0&&(d*=U**+m.length)):(d*=Ie,i>0&&(d*=U**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=W)),(d<H&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=He(e,t,n,r,l+1,a+2,o),f*H>d&&(d=f*H)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Ue(e){return e.toLowerCase().replace(Ve,` `)}function We(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,He(e,t,Ue(e),Ue(t),0,0,{})}var G=`[cmdk-group=""]`,Ge=`[cmdk-group-items=""]`,Ke=`[cmdk-group-heading=""]`,qe=`[cmdk-item=""]`,Je=`${qe}:not([aria-disabled="true"])`,Ye=`cmdk-item-select`,K=`data-value`,Xe=(e,t,n)=>We(e,t,n),Ze=V.createContext(void 0),q=()=>V.useContext(Ze),Qe=V.createContext(void 0),$e=()=>V.useContext(Qe),et=V.createContext(void 0),tt=V.forwardRef((e,t)=>{let n=X(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=X(()=>new Set),i=X(()=>new Map),a=X(()=>new Map),o=X(()=>new Set),s=ft(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:ee=!1,vimBindings:h=!0,...g}=e,_=P(),v=P(),te=P(),y=V.useRef(null),b=mt();Y(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,x.emit()}},[u]),Y(()=>{b(6,E)},[]);let x=V.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)T(),C(),b(1,w);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(te);e?e.focus():(i=document.getElementById(_))==null||i.focus()}if(b(7,()=>{n.current.selectedItemId=D()?.id,x.emit()}),r||b(5,E),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}x.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),S=V.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,ne(t,r)),b(2,()=>{C(),x.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),b(3,()=>{T(),C(),n.current.value||w(),x.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=D();b(4,()=>{T(),t?.getAttribute(`id`)===e&&w(),x.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:_,inputId:te,labelId:v,listInnerRef:y}),[]);function ne(e,t){let r=s.current?.filter??Xe;return e?r(e,n.current.search,t):0}function C(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=y.current;O().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(Ge);t?t.appendChild(e.parentElement===t?e:e.closest(`${Ge} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${Ge} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=y.current?.querySelector(`${G}[${K}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function w(){let e=O().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(K);x.setState(`value`,e||void 0)}function T(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=ne(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function E(){var e;let t=D();t&&(t.parentElement?.firstChild===t&&((e=t.closest(G)?.querySelector(Ke))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function D(){return y.current?.querySelector(`${qe}[aria-selected="true"]`)}function O(){return Array.from(y.current?.querySelectorAll(Je)||[])}function k(e){let t=O()[e];t&&x.setState(`value`,t.getAttribute(K))}function A(e){var t;let n=D(),r=O(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&x.setState(`value`,a.getAttribute(K))}function M(e){let t=D()?.closest(G),n;for(;t&&!n;)t=e>0?ut(t,G):dt(t,G),n=t?.querySelector(Je);n?x.setState(`value`,n.getAttribute(K)):A(e)}let N=()=>k(O().length-1),F=e=>{e.preventDefault(),e.metaKey?N():e.altKey?M(1):A(1)},I=e=>{e.preventDefault(),e.metaKey?k(0):e.altKey?M(-1):A(-1)};return V.createElement(j.div,{ref:t,tabIndex:-1,...g,"cmdk-root":``,onKeyDown:e=>{var t;(t=g.onKeyDown)==null||t.call(g,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:h&&e.ctrlKey&&F(e);break;case`ArrowDown`:F(e);break;case`p`:case`k`:h&&e.ctrlKey&&I(e);break;case`ArrowUp`:I(e);break;case`Home`:e.preventDefault(),k(0);break;case`End`:e.preventDefault(),N();break;case`Enter`:{e.preventDefault();let t=D();if(t){let e=new Event(Ye);t.dispatchEvent(e)}}}}},V.createElement(`label`,{"cmdk-label":``,htmlFor:S.inputId,id:S.labelId,style:gt},c),Q(e,e=>V.createElement(Qe.Provider,{value:x},V.createElement(Ze.Provider,{value:S},e))))}),nt=V.forwardRef((e,t)=>{let n=P(),r=V.useRef(null),i=V.useContext(et),a=q(),o=ft(e),s=o.current?.forceMount??i?.forceMount;Y(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=pt(n,r,[e.value,e.children,r],e.keywords),l=$e(),u=Z(e=>e.value&&e.value===c.current),d=Z(e=>s||a.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);V.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(Ye,f),()=>t.removeEventListener(Ye,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:ee,onSelect:h,forceMount:g,keywords:_,...v}=e;return V.createElement(j.div,{ref:D(r,t),...v,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),rt=V.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=P(),s=V.useRef(null),c=V.useRef(null),l=P(),u=q(),d=Z(e=>i||u.filter()===!1?!0:!e.search||e.filtered.groups.has(o));Y(()=>u.group(o),[]),pt(o,s,[e.value,e.heading,c]);let f=V.useMemo(()=>({id:o,forceMount:i}),[i]);return V.createElement(j.div,{ref:D(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:!d||void 0},n&&V.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),Q(e,e=>V.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},V.createElement(et.Provider,{value:f},e))))}),it=V.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=V.useRef(null),a=Z(e=>!e.search);return!n&&!a?null:V.createElement(j.div,{ref:D(i,t),...r,"cmdk-separator":``,role:`separator`})}),at=V.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=$e(),o=Z(e=>e.search),s=Z(e=>e.selectedItemId),c=q();return V.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),V.createElement(j.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),ot=V.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=V.useRef(null),o=V.useRef(null),s=Z(e=>e.selectedItemId),c=q();return V.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),V.createElement(j.div,{ref:D(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},Q(e,e=>V.createElement(`div`,{ref:D(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),st=V.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return V.createElement(ie,{open:n,onOpenChange:r},V.createElement(I,{container:o},V.createElement(F,{"cmdk-overlay":``,className:i}),V.createElement(re,{"aria-label":e.label,"cmdk-dialog":``,className:a},V.createElement(tt,{ref:t,...s}))))}),ct=V.forwardRef((e,t)=>Z(e=>e.filtered.count===0)?V.createElement(j.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),lt=V.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return V.createElement(j.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},Q(e,e=>V.createElement(`div`,{"aria-hidden":!0},e)))}),J=Object.assign(tt,{List:ot,Item:nt,Input:at,Group:rt,Separator:it,Dialog:st,Empty:ct,Loading:lt});function ut(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function dt(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function ft(e){let t=V.useRef(e);return Y(()=>{t.current=e}),t}var Y=typeof window>`u`?V.useEffect:V.useLayoutEffect;function X(e){let t=V.useRef();return t.current===void 0&&(t.current=e()),t}function Z(e){let t=$e(),n=()=>e(t.snapshot());return V.useSyncExternalStore(t.subscribe,n,n)}function pt(e,t,n,r=[]){let i=V.useRef(),a=q();return Y(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(K,s),i.current=s}),i}var mt=()=>{let[e,t]=V.useState(),n=X(()=>new Map);return Y(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function ht(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function Q({asChild:e,children:t},n){return e&&V.isValidElement(t)?V.cloneElement(ht(t),{ref:t.ref},n(t.props.children)):n(t)}var gt={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},$=O();function _t({className:e,...t}){return(0,$.jsx)(J,{"data-slot":`command`,className:A(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...t})}function vt({title:e=`Command Palette`,description:t=`Search for a command to run...`,children:n,className:r,showCloseButton:i=!0,...a}){return(0,$.jsxs)(fe,{...a,children:[(0,$.jsxs)(de,{className:`sr-only`,children:[(0,$.jsx)(z,{children:e}),(0,$.jsx)(B,{children:t})]}),(0,$.jsx)(R,{className:A(`overflow-hidden p-0`,r),showCloseButton:i,children:(0,$.jsx)(_t,{className:`**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5`,children:n})})]})}function yt({className:e,...t}){return(0,$.jsxs)(`div`,{"data-slot":`command-input-wrapper`,className:`flex h-9 items-center gap-2 border-b px-3`,children:[(0,$.jsx)(_,{className:`size-4 shrink-0 opacity-50`}),(0,$.jsx)(J.Input,{"data-slot":`command-input`,className:A(`flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...t})]})}function bt({className:e,...t}){return(0,$.jsx)(J.List,{"data-slot":`command-list`,className:A(`max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto`,e),...t})}function xt({...e}){return(0,$.jsx)(J.Empty,{"data-slot":`command-empty`,className:`py-6 text-center text-sm`,...e})}function St({className:e,...t}){return(0,$.jsx)(J.Group,{"data-slot":`command-group`,className:A(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function Ct({className:e,...t}){return(0,$.jsx)(J.Item,{"data-slot":`command-item`,className:A(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...t})}function wt({className:e,...t}){return(0,$.jsx)(`span`,{"data-slot":`command-shortcut`,className:A(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t})}var Tt={sky:`text-catppuccin-sky`,blue:`text-catppuccin-blue`,green:`text-catppuccin-green`,teal:`text-catppuccin-teal`,mauve:`text-catppuccin-mauve`,lavender:`text-catppuccin-lavender`,peach:`text-catppuccin-peach`,yellow:`text-catppuccin-yellow`,red:`text-catppuccin-red`};function Et({theme:e}){let{background:t,blue:n,mauve:r,green:i}=e.colors;return(0,$.jsx)(`span`,{className:`flex size-5 shrink-0 overflow-hidden rounded-sm border border-catppuccin-surface2`,children:[t,n,r,i].map((e,t)=>(0,$.jsx)(`span`,{className:`flex-1`,style:{backgroundColor:e}},t))})}function Dt(){let{t}=k(),{activeDialog:r,closeDialog:_,openDialog:E}=n(),D=n(e=>e.setWelcomeVisible),O=n(e=>e.setFooterMessage),{executeCurrentQuery:j,executeCurrentStatement:P,executeWholeScript:F,addNewQueryTab:I,disconnectActive:re}=c(),{capabilities:ie}=ue(),de=se(),R=L(e=>e.activeConnections.find(t=>t.id===e.activeConnectionId)),z=L(e=>e.activeConnectionId?e.transactionOpen[e.activeConnectionId]??!1:!1),B=L(e=>e.updateProfile),fe=d(e=>e.themeId),Ne=d(e=>e.setTheme),Pe=oe(e=>e.locale),Fe=oe(e=>e.setLocale),Ie=r===`quick-command`,H=R!==void 0,U=(0,V.useCallback)(e=>{_(),e()},[_]),W=(0,V.useCallback)(e=>O(e instanceof Error?e.message:String(e)),[O]),Le=()=>{let t=L.getState().activeConnectionId;t&&(o.getState().openERD(t),e(`erd_open`),ae.getState().setActiveQueryTab(t,`erd`))},Re=[{heading:t(`palette.groups.connection`),commands:[{id:`connect`,label:t(`palette.commands.connect`),icon:we,tone:`sky`,shortcut:`Alt+N`,keywords:[`connect`,`server`,`profile`,`login`],disabled:!de,action:()=>U(()=>E(`connect`))},{id:`disconnect`,label:t(`palette.commands.disconnect`),icon:s,tone:`red`,keywords:[`disconnect`,`close`],disabled:!H,action:()=>U(()=>{re()})},{id:`read-only`,label:t(`menu.connection.readOnly`),icon:ee,tone:`yellow`,keywords:[`read only`,`safety`,`guard`],disabled:!H,checked:R?.readOnly===!0,action:()=>U(()=>{R&&B(R.id,{readOnly:!R.readOnly})})},{id:`manual-transactions`,capability:`transactions`,label:t(`menu.connection.manualTransactions`),icon:ne,tone:`lavender`,keywords:[`transaction`,`manual`,`autocommit`],disabled:!H,checked:R?.transactionMode===`manual`,action:()=>U(()=>{R&&B(R.id,{transactionMode:R.transactionMode===`manual`?`auto`:`manual`})})},{id:`commit`,capability:`transactions`,label:t(`toolbar.commit`),icon:v,tone:`green`,keywords:[`commit`,`transaction`],disabled:!z||!R,action:()=>U(()=>{R&&ce(R.id).catch(W)})},{id:`rollback`,capability:`transactions`,label:t(`toolbar.rollback`),icon:p,tone:`peach`,keywords:[`rollback`,`transaction`,`undo`],disabled:!z||!R,action:()=>U(()=>{R&&le(R.id).catch(W)})}]},{heading:t(`palette.groups.query`),commands:[{id:`execute`,label:t(`palette.commands.executeQuery`),icon:S,tone:`green`,shortcut:`F9`,keywords:[`run`,`execute`,`sql`],disabled:!H,action:()=>U(()=>{j()})},{id:`execute-statement`,label:t(`menu.query.executeStatementAtCursor`),icon:he,tone:`green`,shortcut:`Ctrl+Enter`,keywords:[`run`,`statement`,`cursor`],disabled:!H,action:()=>U(()=>{P()})},{id:`execute-script`,label:t(`menu.query.executeWholeScript`),icon:Oe,tone:`teal`,shortcut:`Ctrl+Shift+Enter`,keywords:[`run`,`script`,`batch`],disabled:!H,action:()=>U(()=>{F()})},{id:`new-tab`,label:t(`palette.commands.newQueryTab`),icon:b,tone:`blue`,shortcut:`Alt+T`,keywords:[`new`,`tab`,`editor`],disabled:!H,action:()=>U(()=>I())},{id:`find-replace`,label:t(`menu.query.findReplace`),icon:Te,tone:`lavender`,keywords:[`find`,`replace`,`search`],disabled:!H,action:()=>U(()=>E(`find-replace`))},{id:`local-history`,label:t(`menu.query.localHistory`),icon:xe,tone:`mauve`,keywords:[`history`,`snapshot`,`undo`],disabled:!H,action:()=>U(()=>E(`local-history`))}]},{heading:t(`palette.groups.database`),commands:[{id:`create-db`,capability:`multipleDatabases`,label:t(`palette.commands.createDatabase`),icon:w,tone:`blue`,keywords:[`create`,`database`,`schema`],disabled:!H,action:()=>U(()=>E(`create-database`))},{id:`alter-db`,capability:`multipleDatabases`,label:t(`menu.database.alter`),icon:ge,tone:`blue`,keywords:[`alter`,`database`,`charset`],disabled:!H,action:()=>U(()=>E(`alter-database`))},{id:`copy-db`,capability:`multipleDatabases`,label:t(`menu.database.copy`),icon:g,tone:`sky`,keywords:[`copy`,`clone`,`database`],disabled:!H,action:()=>U(()=>E(`copy-database`))},{id:`schema-diff`,label:t(`menu.database.compare`),icon:ye,tone:`mauve`,keywords:[`compare`,`diff`,`schema`,`sync`],pro:!0,disabled:!H,action:()=>U(()=>E(`schema-diff`))},{id:`data-diff`,label:t(`menu.database.compareData`),icon:be,tone:`mauve`,keywords:[`compare`,`diff`,`data`,`rows`],pro:!0,disabled:!H,action:()=>U(()=>E(`data-diff`))}]},{heading:t(`palette.groups.table`),commands:[{id:`create-table`,label:t(`palette.commands.createTable`),icon:u,tone:`green`,keywords:[`create`,`table`],disabled:!H,action:()=>U(()=>E(`create-table`))},{id:`alter-table`,label:t(`palette.commands.alterTable`),icon:Me,tone:`yellow`,keywords:[`alter`,`table`,`column`],disabled:!H,action:()=>U(()=>E(`alter-table`))},{id:`duplicate-table`,label:t(`menu.table.duplicateStructure`),icon:me,tone:`teal`,keywords:[`duplicate`,`structure`,`table`],disabled:!H,action:()=>U(()=>E(`duplicate-table-structure`))}]},{heading:t(`menu.export.title`),commands:[{id:`export-csv`,label:t(`menu.export.csv`),icon:ve,tone:`green`,keywords:[`export`,`csv`,`excel`],disabled:!H,action:()=>U(()=>E(`export-csv`))},{id:`export-html`,label:t(`menu.export.schemaHtml`),icon:_e,tone:`peach`,keywords:[`export`,`html`,`schema`,`documentation`],disabled:!H,action:()=>U(()=>E(`export-html`))}]},{heading:t(`palette.groups.tools`),commands:[{id:`process-list`,capability:`processList`,label:t(`palette.commands.processList`),icon:h,tone:`red`,keywords:[`process`,`kill`,`connections`],disabled:!H,action:()=>U(()=>E(`process-list`))},{id:`variables`,capability:`variables`,label:t(`palette.commands.serverVariables`),icon:ke,tone:`lavender`,keywords:[`variables`,`server`,`settings`],disabled:!H,action:()=>U(()=>E(`variables`))},{id:`status`,capability:`status`,label:t(`palette.commands.serverStatus`),icon:m,tone:`teal`,keywords:[`status`,`server`,`metrics`],disabled:!H,action:()=>U(()=>E(`status`))},{id:`flush`,capability:`flush`,label:t(`palette.commands.flush`),icon:C,tone:`peach`,keywords:[`flush`,`cache`,`reload`],disabled:!H,action:()=>U(()=>E(`flush`))},{id:`user-manager`,capability:`users`,label:t(`palette.commands.userManager`),icon:x,tone:`blue`,keywords:[`users`,`grants`,`privileges`],disabled:!H,action:()=>U(()=>E(`user-manager`))},{id:`scratchpad`,label:t(`menu.tools.scratchpad`),icon:te,tone:`yellow`,keywords:[`scratchpad`,`sqlite`,`local`],pro:!0,action:()=>U(()=>{i().catch(W)})},{id:`federated`,label:t(`menu.tools.federated`),icon:je,tone:`mauve`,keywords:[`federated`,`cross`,`join`,`connections`],pro:!0,action:()=>U(()=>{l().catch(W)})},{id:`erd`,label:t(`menu.tools.viewErd`),icon:Ce,tone:`sky`,keywords:[`erd`,`diagram`,`relations`],disabled:!H,action:()=>U(Le)}]},{heading:t(`menu.settings.theme`),commands:f().map(e=>({id:`theme-${e.id}`,label:e.name,tone:`lavender`,keywords:[`theme`,`color`,`appearance`,`dark`,`light`,e.id],checked:fe===e.id,swatch:e,action:()=>U(()=>Ne(e.id))}))},{heading:t(`menu.settings.language`),commands:[`auto`,...N].map(e=>({id:`locale-${e}`,label:e===`auto`?t(`language.auto`,{name:t(`language.${M()}`)}):t(`language.${e}`),icon:Se,tone:`teal`,keywords:[`language`,`locale`,`i18n`,e],checked:Pe===e,action:()=>U(()=>Fe(e))}))},{heading:t(`menu.settings.title`),commands:[{id:`safety-settings`,label:t(`menu.settings.safety`),icon:Ae,tone:`yellow`,keywords:[`safety`,`settings`,`row limit`,`preferences`],action:()=>U(()=>E(`safety-settings`))}]},{heading:t(`menu.help.title`),commands:[{id:`documentation`,label:t(`menu.help.documentation`),icon:pe,tone:`blue`,keywords:[`docs`,`documentation`,`manual`,`help`],action:()=>U(()=>{window.open(T(),`_blank`,`noopener,noreferrer`)})},{id:`getting-started`,label:t(`menu.help.gettingStarted`),icon:Ee,tone:`green`,keywords:[`welcome`,`onboarding`,`sample`,`getting started`],action:()=>U(()=>D(!0))},{id:`terms`,label:t(`menu.help.terms`),icon:De,tone:`peach`,keywords:[`terms`,`privacy`,`legal`],action:()=>U(()=>E(`terms`))},{id:`about`,label:t(`menu.help.about`),icon:y,tone:`sky`,keywords:[`about`,`version`,`agent`],action:()=>U(()=>E(`about`))}]}];function ze(e){e||_()}let Be=Re.map(e=>({...e,commands:e.commands.filter(e=>!e.capability||ie[e.capability])})).filter(e=>e.commands.length>0);return(0,$.jsxs)(vt,{open:Ie,onOpenChange:ze,title:t(`palette.title`),description:t(`palette.description`),children:[(0,$.jsx)(yt,{placeholder:t(`palette.inputPlaceholder`)}),(0,$.jsxs)(bt,{className:`max-h-[60vh]`,children:[(0,$.jsx)(xt,{children:t(`palette.empty`)}),Be.map(e=>(0,$.jsx)(St,{heading:e.heading,children:e.commands.map(t=>(0,$.jsxs)(Ct,{value:`${e.heading} ${t.label}`,keywords:t.keywords,disabled:t.disabled,onSelect:t.action,children:[t.swatch?(0,$.jsx)(Et,{theme:t.swatch}):t.icon?(0,$.jsx)(t.icon,{className:A(`size-4`,Tt[t.tone])}):null,(0,$.jsx)(`span`,{className:`truncate`,children:t.label}),(0,$.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[t.pro&&(0,$.jsx)(a,{className:`ml-0`}),t.checked&&(0,$.jsx)(v,{className:`size-3.5 text-catppuccin-green`}),t.shortcut&&(0,$.jsx)(wt,{className:`ml-0`,children:t.shortcut})]})]},t.id))},e.heading))]})]})}export{Dt as QuickCommandPalette};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,n as t,r as n}from"./ui-store-DfspmPOn.js";import{a as r,i}from"./i18n-BBdlx4Gw.js";import{i as a,n as o,r as s,t as c}from"./app-storage-C_1RLCyI.js";import{t as l}from"./connection-store-DjSajhjh.js";import{n as u}from"./query-store-Bz1pmp4E.js";import{t as d}from"./hmr-singleton-Bit0Kfog.js";var f=new Set([`neon`,`supabase`]);function p(e){return e===`postgres`||f.has(e)}var ee=`_rowid_`,te=`http://127.0.0.1:8888`,m=d(`tunnelAgent`,()=>({url:null,token:null}));function ne(e){m.url=e.url?.replace(/\/+$/,``)||null,m.token=e.token?.trim()||null}var re=new Set([`127.0.0.1`,`localhost`,`[::1]`,`::1`]);function ie(e){try{let t=new URL(e);return(t.protocol===`http:`||t.protocol===`https:`)&&re.has(t.hostname)}catch{return!1}}function ae(e){try{return typeof window<`u`&&new URL(e).origin===window.location.origin}catch{return!1}}function oe(e){return ie(e)||ae(e)}function se(){return m.url!==null&&m.url!==`/api`&&!oe(m.url)}function h(){return m.url??te}function ce(){let e=h();return e===`/api`?r.t(`services.agent.devProxyUrl`,{url:`http://localhost:8888`}):e}async function le(){let e=ce(),t;try{let e={};m.token&&(e.Authorization=`Bearer ${m.token}`),t=await(await fetch(`${h()}/health`,{cache:`no-store`,headers:e})).json()}catch(t){return{state:`offline`,url:e,message:t instanceof Error?t.message:String(t)}}return t.name!==`planche`||typeof t.version!=`string`||!/^[\w.+-]{1,32}$/.test(t.version)?{state:`offline`,url:e,message:r.t(`services.agent.notPlanche`)}:t.protocolVersion===2?t.authorized===!1||m.token===null&&t.authorized===void 0?{state:`unauthorized`,url:e,version:t.version}:{state:`online`,url:e,version:t.version,activeConnections:t.activeConnections??0,...t.gateway?{gateway:t.gateway}:{}}:{state:`outdated`,url:e,version:t.version,protocolVersion:t.protocolVersion??0,install:t.install===`standalone`?`standalone`:`npx`}}async function ue(){let e=await fetch(`${h()}/profiles`,{cache:`no-store`,headers:y()}),t=await e.json().catch(()=>null);if(!e.ok||!t||t.success!==!0)throw new b(t?.message??r.t(`services.agent.httpError`,{status:e.status,statusText:e.statusText}),e.status);return t}function g(e){let t=e.ssh;if(t?.enabled)return{host:t.host,port:t.port,user:t.user,auth:t.auth,password:t.auth===`password`?t.password??``:void 0,privateKey:t.auth===`key`?t.privateKey:void 0,passphrase:t.auth===`key`&&t.passphrase||void 0}}function _(e){return e.gatewayProfile?{profile:e.gatewayProfile}:e.dbms===`sqlite`?{driver:`sqlite`,file:e.file??``,createIfMissing:e.createIfMissing??!1,readonly:e.readOnly??!1}:e.dbms===`do`?{driver:`do`,devUrl:e.devUrl??``}:e.dbms===`d1`?{driver:`d1`,accountId:e.accountId??``,databaseId:e.databaseId??``,apiToken:e.pass}:e.dbms===`postgres`?{driver:`postgres`,host:e.host,port:e.port,user:e.user,password:e.pass,database:e.database||`postgres`,ssl:e.ssl??!1,sslVerify:e.sslVerify??!1,ssh:g(e)}:f.has(e.dbms)?{driver:`postgres`,host:e.host,port:e.port,user:e.user,password:e.pass,database:e.database||`postgres`,ssl:!0,sslVerify:e.dbms===`neon`}:e.dbms===`mssql`?{driver:`mssql`,host:e.host,port:e.port,user:e.user,password:e.pass,database:e.database||`master`,ssl:e.ssl??!1,sslVerify:e.sslVerify??!1,ssh:g(e)}:e.dbms===`oracle`?{driver:`oracle`,host:e.host,port:e.port,user:e.user,password:e.pass,serviceName:e.database||`FREEPDB1`,ssh:g(e)}:{driver:`mysql`,host:e.host,port:e.port,user:e.user,password:e.pass,charset:e.charset===`utf8`?`utf8mb4`:e.charset,ssl:e.ssl??!1,sslVerify:e.sslVerify??!1,ssh:g(e)}}var v=d(`tunnelAuthTokens`,()=>new Map);function de(e,t){let n=t?.trim();n?v.set(e,n):v.delete(e)}function fe(e){return e?.trim()||m.token||void 0}function y(e){let t={"Content-Type":`application/json`},n=fe(e);return n&&(t.Authorization=`Bearer ${n}`),t}var b=class extends Error{status;body;constructor(e,t,n=null){super(e),this.status=t,this.body=n}};function pe(e){if(!(e instanceof b)||e.status!==409)return null;let t=e.body,n=t?.hostKey;if(t?.code!==`host-key-unknown`||!n)return null;let r=typeof n.host==`string`&&/^[A-Za-z0-9._:[\]-]{1,253}$/.test(n.host)?n.host:null,i=typeof n.type==`string`&&/^[\w.@-]{1,64}$/.test(n.type)?n.type:null,a=typeof n.fingerprint==`string`&&/^SHA256:[A-Za-z0-9+/]{43}$/.test(n.fingerprint)?n.fingerprint:null,o=Number.isInteger(n.port)&&n.port>0&&n.port<65536?n.port:null;return r&&i&&a&&o?{host:r,port:o,type:i,fingerprint:a}:null}async function me(e,t){let n=await fetch(`${e.replace(/\/+$/,``)}/pair`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({code:t})}),i=await n.json().catch(()=>null);if(!n.ok||!i?.success||typeof i.token!=`string`)throw Error(i?.message??r.t(`services.agent.httpError`,{status:n.status,statusText:n.statusText}));return i.token}async function x(e,t,n){let i;try{i=await fetch(`${h()}${e}`,{method:`POST`,headers:y(n),body:JSON.stringify(t)})}catch(e){throw Error(r.t(`services.agent.unreachable`,{url:ce(),message:e instanceof Error?e.message:String(e)}))}let a=null;try{a=await i.json()}catch{a=null}if(!i.ok)throw new b(a?.message??r.t(`services.agent.httpError`,{status:i.status,statusText:i.statusText}),i.status,a);if(!a)throw Error(r.t(`services.agent.emptyResponse`));return a}async function he(e,t){let n=await x(`/connect`,e,t);return n.success&&n.connectionId&&(de(n.connectionId,fe(t)),ve()),n}async function ge(e){try{return(await x(`/cancel`,{connectionId:e},v.get(e))).cancelled}catch{return!1}}async function _e(e,t,n){let r=performance.now(),i=await x(`/query`,{connectionId:e,sql:t,database:n},v.get(e));return i.execTime||=Math.round(performance.now()-r),i}function ve(){if(typeof window>`u`)return;let e=d(`tunnelPageHide`,()=>({done:!1}));e.done||(e.done=!0,window.addEventListener(`pagehide`,()=>{for(let[e,t]of v)fetch(`${h()}/disconnect`,{method:`POST`,headers:y(t),body:JSON.stringify({connectionId:e}),keepalive:!0}).catch(()=>void 0)}))}async function ye(e){try{await x(`/disconnect`,{connectionId:e},v.get(e))}finally{v.delete(e)}}async function be(e,t){return x(`/test-connection`,e,t)}var S=0;function xe(e){S>=3||(async()=>{try{(await fetch(`${h()}/usage`,{method:`POST`,headers:y(),body:JSON.stringify({feature:e})})).ok?S=0:S+=1}catch{S+=1}})()}function C(e,t,n){return e.map(e=>e.id===t?n(e):e.children.length>0?{...e,children:C(e.children,t,n)}:e)}function Se(e,t){for(let n of e){if(n.id===t)return n;let e=Se(n.children,t);if(e)return e}return null}function w(e,t,n){let r=new Set(e??[]);if(n)r.add(t);else for(let e of r)(e===t||e.startsWith(`${t}/`))&&r.delete(e);return[...r]}var Ce=n()(a(e=>({trees:{},selectedNodeId:{},expandedIds:{},setTree:(t,n)=>e(e=>({trees:{...e.trees,[t]:n}})),setChildren:(t,n,r)=>e(e=>{let i=e.trees[t];return i?{expandedIds:{...e.expandedIds,[t]:w(e.expandedIds[t],n,!0)},trees:{...e.trees,[t]:C(i,n,e=>({...e,children:r,isLoading:!1,isExpanded:!0,metadata:{...e.metadata,count:r.length}}))}}:e}),setNodeMetadata:(t,n,r)=>e(e=>{let i=e.trees[t];return i?{trees:{...e.trees,[t]:C(i,n,e=>({...e,metadata:{...e.metadata,...r}}))}}:e}),toggleExpanded:(t,n)=>e(e=>{let r=e.trees[t];if(!r)return e;let i=!Se(r,n)?.isExpanded;return{expandedIds:{...e.expandedIds,[t]:w(e.expandedIds[t],n,i)},trees:{...e.trees,[t]:C(r,n,e=>({...e,isExpanded:i}))}}}),setExpanded:(t,n,r)=>e(e=>{let i=e.trees[t];return i?{expandedIds:{...e.expandedIds,[t]:w(e.expandedIds[t],n,r)},trees:{...e.trees,[t]:C(i,n,e=>({...e,isExpanded:r}))}}:e}),setSelected:(t,n)=>e(e=>({selectedNodeId:{...e.selectedNodeId,[t]:n}})),setLoading:(t,n,r)=>e(e=>{let i=e.trees[t];return i?{trees:{...e.trees,[t]:C(i,n,e=>({...e,isLoading:r}))}}:e}),removeTree:t=>e(e=>{let n={...e.trees},r={...e.selectedNodeId};return delete n[t],delete r[t],{trees:n,selectedNodeId:r}})}),{name:`planche-schema`,storage:c(),partialize:e=>({selectedNodeId:e.selectedNodeId,expandedIds:e.expandedIds})})),T=32,E=24,we=931071618,D=931071619,O=(e,t)=>(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0,Te=(e,t)=>(e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t])>>>0;function k(e,t,n,r,i=0,a=0){let o=r?O:Te;for(let r=t;r<t+n;r+=8)i=i+o(e,r)+a>>>0,a=a+o(e,r+4)+i>>>0;return[i,a]}function Ee(e){if(e.byteLength<T)return null;let t=O(e,0);if(t!==we&&t!==D)return null;let n=t===D,r=O(e,8);if(r<512||r>65536||r&r-1)return null;let i=O(e,16),a=O(e,20),[o,s]=k(e,0,24,n);if(o!==O(e,24)||s!==O(e,28))return null;let c=E+r,l=new Map,u=new Map,d=0,f=0,p=0;for(let t=T;t+c<=e.byteLength&&!(O(e,t+8)!==i||O(e,t+12)!==a||([o,s]=k(e,t,8,n,o,s),[o,s]=k(e,t+E,r,n,o,s),o!==O(e,t+16)||s!==O(e,t+20)));t+=c){let n=O(e,t),r=O(e,t+4);if(n===0)break;if(u.set(n,e.subarray(t+E,t+c)),p++,r>0){for(let[e,t]of u)l.set(e,t);u.clear(),d=r,f+=p,p=0}}return{pageSize:r,dbSizePages:d,pages:l,committedFrames:f}}function A(e,t){let n=Ee(t);if(!n||n.committedFrames===0)return{bytes:e,appliedFrames:0};let{pageSize:r,dbSizePages:i,pages:a}=n,o=Math.max(i*r,e.byteLength-e.byteLength%r),s=new Uint8Array(o);s.set(e.subarray(0,Math.min(e.byteLength,o)));for(let[e,t]of a){let n=(e-1)*r;n+r<=o&&s.set(t,n)}return{bytes:i>0?s.subarray(0,i*r):s,appliedFrames:n.committedFrames}}var De=`planche-file-handles`,j=`handles`;function Oe(){return new Promise((e,t)=>{if(typeof indexedDB>`u`){t(Error(`IndexedDB unavailable`));return}let n=indexedDB.open(De,1);n.onupgradeneeded=()=>n.result.createObjectStore(j),n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error)})}function M(e,t){return Oe().then(n=>new Promise((r,i)=>{let a=t(n.transaction(j,e).objectStore(j));a.onsuccess=()=>r(a.result),a.onerror=()=>i(a.error)}))}var N=e=>`${e}:wal`;async function P(e,t){try{await M(`readwrite`,n=>n.put(t,e))}catch{}}async function F(e){try{return await M(`readonly`,t=>t.get(e))??null}catch{return null}}async function I(e){try{await M(`readwrite`,t=>t.delete(e))}catch{}}async function L(e,t){let n=e,r={mode:`readwrite`};try{if(n.queryPermission&&await n.queryPermission(r)===`granted`)return!0;if(t&&n.requestPermission)return await n.requestPermission(r)===`granted`}catch{}return!1}var R=e=>`dbcache-meta:${e}`,z=e=>`${e}.sqlite3`;async function ke(e){try{let t=await s.getItem(R(e));if(!t)return null;let n=JSON.parse(t),r=await o.get(z(e));return r?{bytes:new Uint8Array(r),meta:n}:null}catch{return null}}async function Ae(e,t,n){try{let r=t.slice().buffer;return await o.set(z(e),r)?(await s.setItem(R(e),JSON.stringify(n)),!0):!1}catch(e){return console.warn(`[db-cache] write failed:`,e),!1}}async function je(e,t){try{let n=await s.getItem(R(e));if(!n)return;await s.setItem(R(e),JSON.stringify({...JSON.parse(n),...t}))}catch{}}async function Me(e){try{await o.remove(z(e)),await s.removeItem(R(e))}catch{}}var Ne=`browser:`;function B(e){return typeof e==`string`&&e.startsWith(`browser:`)}var Pe=750;function Fe(e){let t=W.get(e);t?.profileId&&(t.flushTimer&&clearTimeout(t.flushTimer),t.flushTimer=setTimeout(()=>{t.flushTimer=null,V(e)},Pe))}async function V(e){let t=W.get(e);if(t?.profileId)try{let n=await et(e);await Ae(t.profileId,n,H(t))}catch(e){console.warn(`[browser-sqlite] cache flush failed:`,e)}}function H(e){return{name:e.source.name,lastModified:e.fileMeta.lastModified,size:e.fileMeta.size,dirty:e.dirty,cachedAt:Date.now()}}var Ie=d(`browserSqliteVisibilityListener`,()=>({installed:!1}));typeof document<`u`&&!Ie.installed&&(Ie.installed=!0,document.addEventListener(`visibilitychange`,()=>{if(document.visibilityState===`hidden`)for(let[e,t]of W)t.flushTimer&&(clearTimeout(t.flushTimer),t.flushTimer=null,V(e))}));function U(e){return e.toLowerCase().endsWith(`-wal`)}var W=d(`browserSqliteDatabases`,()=>new Map),Le=d(`browserSqliteModule`,()=>({promise:null}));async function G(){return Le.promise||=i(()=>import(`./dist-Roudme38.js`).then(e=>e.default()),[]),Le.promise}function K(e){let t=W.get(e);if(!t)throw Error(`Browser connection not found: ${e}`);return t}function Re(e){if(!(e.byteLength>=100&&e[0]===83&&e[15]===0)||e[18]!==2&&e[19]!==2)return{bytes:e,wal:!1};let t=new Uint8Array(e);return t[18]=1,t[19]=1,{bytes:t,wal:!0}}var ze=`SQLite format 3\0`;function Be(e){if(e.byteLength===0)return null;if(e.byteLength<100)return r.t(`services.sqliteFile.tooSmall`);if(String.fromCharCode(...e.subarray(0,16))!==ze)return r.t(`services.sqliteFile.notSqlite`);let t=e[16]<<8|e[17],n=t===1?65536:t;return n<512||n&n-1?r.t(`services.sqliteFile.badPageSize`,{size:n}):null}async function Ve(e){let t=Be(e);if(t)throw Error(t);let n=await G(),i=new n.oo1.DB;if(e.byteLength===0)return i;let a=n.wasm.allocFromTypedArray(e),o=n.capi,s=o.SQLITE_DESERIALIZE_FREEONCLOSE??1,c=o.SQLITE_DESERIALIZE_RESIZEABLE??2,l=n.capi.sqlite3_deserialize(i.pointer,`main`,a,e.byteLength,e.byteLength,s|c);i.checkRc(l);try{i.exec(`SELECT count(*) FROM sqlite_master`)}catch(e){throw i.close(),Error(r.t(`services.sqliteFile.unreadable`,{message:e instanceof Error?e.message:String(e)}))}return i}async function He(e){let t=window.showOpenFilePicker;if(t)try{let n=await t({multiple:e.multiple,types:e.sqliteOnly?[{description:r.t(`services.sqliteFile.pickerDescription`),accept:{"application/vnd.sqlite3":[`.sqlite`,`.sqlite3`,`.db`,`.db3`]}}]:void 0,excludeAcceptAllOption:!1});return Promise.all(n.map(async e=>({file:await e.getFile(),handle:e})))}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return[];throw e}return new Promise(t=>{let n=document.createElement(`input`);n.type=`file`,n.multiple=e.multiple,e.sqliteOnly&&(n.accept=`.sqlite,.sqlite3,.db,.db3,application/vnd.sqlite3`),n.onchange=()=>t(Array.from(n.files??[]).map(e=>({file:e}))),n.oncancel=()=>t([]),n.click()})}async function Ue(){let e=await He({multiple:!0,sqliteOnly:!1}),t=e.find(e=>!U(e.file.name));return t?{main:t,wal:e.find(e=>U(e.file.name)&&e.file.name.toLowerCase()===`${t.file.name.toLowerCase()}-wal`)??e.find(e=>U(e.file.name))}:null}async function We(){let[e]=await He({multiple:!1,sqliteOnly:!1});return e??null}async function q(e,t,n={}){let{bytes:r,wal:i}=Re(e),a=await Ve(r),o=`${Ne}${crypto.randomUUID()}`,s={...t,wal:i};return W.set(o,{db:a,source:s,rawBytes:e,profileId:n.profileId,fileMeta:n.fileMeta??{lastModified:0,size:e.byteLength},dirty:n.dirty??!1,flushTimer:null}),{connectionId:o,source:s}}async function J(e,t,n,r={}){let i=e?new Uint8Array(await e.arrayBuffer()):new Uint8Array,a=i,o=!1;n&&(a=A(i,new Uint8Array(await n.file.arrayBuffer())).bytes,o=!0);let s=await q(a,{name:e?.name??`:memory:`,handle:t,walApplied:o,walHandle:n?.handle},{profileId:r.profileId,fileMeta:{lastModified:Math.max(e?.lastModified??0,n?.file.lastModified??0),size:i.byteLength}});return W.get(s.connectionId).rawBytes=i,r.profileId&&V(s.connectionId),s}async function Ge(e,t,n,r){return await q(t,{name:n.name,handle:r,walApplied:!0},{profileId:e,fileMeta:{lastModified:n.lastModified,size:n.size},dirty:n.dirty})}function Ke(e,t){let n=K(e);n.source={...n.source,handle:t}}function qe(e){return W.get(e)?.dirty??!1}async function Je(e,t){let n=K(e),r=A(n.rawBytes,new Uint8Array(await t.file.arrayBuffer())),i=await q(r.bytes,{...n.source,walApplied:!0,walHandle:t.handle},{profileId:n.profileId,fileMeta:n.fileMeta});return W.get(i.connectionId).rawBytes=n.rawBytes,X(e),n.profileId&&V(i.connectionId),{...i,appliedFrames:r.appliedFrames}}function Y(e){return W.get(e)?.source??null}function Ye(e){return e&&e.trim().toLowerCase().replace(/\(.*$/,``).trim()||null}function Xe(e){return e==null?`null`:typeof e==`number`?Number.isInteger(e)?`integer`:`real`:typeof e==`bigint`?`bigint`:e instanceof Uint8Array?`blob`:`text`}function Ze(e){return typeof e==`bigint`?Number(e):e instanceof Uint8Array?{type:`Buffer`,data:Array.from(e)}:e}async function Qe(e,t){let{db:n}=K(e),r=await G(),i=performance.now(),a=K(e),o=Number(r.capi.sqlite3_total_changes(n.pointer)),s=n.prepare(t);try{if(s.columnCount===0){s.step();let c=Number(n.changes()),l=Number(r.capi.sqlite3_last_insert_rowid(n.pointer)),u=/^\s*(BEGIN|COMMIT|END|ROLLBACK|SAVEPOINT|RELEASE)\b/i.test(t);return(c>0||Number(r.capi.sqlite3_total_changes(n.pointer))!==o||!u)&&(a.dirty=!0,Fe(e)),{success:!0,fields:[],records:[],affectedRows:c,insertId:l,isResultQuery:!1,execTime:Math.round(performance.now()-i)}}let c=[];for(;s.step();)c.push(s.get([]).map(Ze));let l=s.getColumnNames(),u=r.capi,d=s.pointer;return{success:!0,fields:l.map((e,t)=>{let n=Ye(u.sqlite3_column_decltype(d,t)),r=u.sqlite3_column_table_name(d,t)??``;return{name:e,orgName:u.sqlite3_column_origin_name(d,t)??e,type:n??Xe($e(c,t)),table:r,orgTable:r,db:u.sqlite3_column_database_name(d,t)??``,maxLength:0}}),records:c,affectedRows:0,insertId:0,isResultQuery:!0,execTime:Math.round(performance.now()-i)}}finally{s.finalize()}}function $e(e,t){for(let n of e){let e=n[t];if(e!=null)return e}return null}async function et(e){let{db:t}=K(e);return(await G()).capi.sqlite3_js_db_export(t.pointer)}function tt(e){let t=W.get(e);if(!t?.source.handle)return null;let{source:n}=t;return n.wal&&!n.walApplied&&!n.walAcknowledged?r.t(`services.sqliteFile.walNotLoaded`):null}function nt(e){let t=K(e);t.source={...t.source,walAcknowledged:!0}}async function rt(e){let{source:t,fileMeta:n}=e;if(!t.handle)return;let i=await t.handle.getFile();if(n.lastModified&&(i.lastModified!==n.lastModified||i.size!==n.size))throw Error(r.t(`services.sqliteFile.changedOnDisk`,{name:t.name}));if(t.walHandle)try{let e=await t.walHandle.getFile();if(e.size>0&&!t.walApplied)throw Error(r.t(`services.sqliteFile.walHasChanges`,{name:t.name}));if(e.size>0&&t.walApplied&&e.lastModified>n.lastModified)throw Error(r.t(`services.sqliteFile.walChangedOnDisk`,{name:t.name}))}catch(e){if(e instanceof Error&&!(e instanceof DOMException))throw e}}async function it(e){let t=K(e),{source:n}=t,i=tt(e);if(i)throw Error(i);n.handle&&await rt(t);let a=await et(e);if(n.handle){if(!await L(n.handle,!0))throw Error(r.t(`services.sqliteFile.writeDenied`,{name:n.name}));let t=await n.handle.createWritable();await t.write(a),await t.close(),n.walHandle&&await(await n.walHandle.createWritable()).close();let i=K(e);i.dirty=!1;try{let e=await n.handle.getFile();i.fileMeta={lastModified:e.lastModified,size:e.size}}catch{i.fileMeta={lastModified:Date.now(),size:a.byteLength}}return i.profileId&&je(i.profileId,{...H(i)}),`in-place`}let o=new Blob([a],{type:`application/vnd.sqlite3`}),s=URL.createObjectURL(o),c=document.createElement(`a`);return c.href=s,c.download=n.name===`:memory:`?`database.sqlite`:n.name,c.click(),URL.revokeObjectURL(s),`download`}function X(e){let t=W.get(e);t&&(t.flushTimer&&clearTimeout(t.flushTimer),t.db.close(),W.delete(e))}function Z(e){return W.get(e)?.profileId}async function at(e){await I(e),await I(N(e)),await Me(e)}async function ot(e,t){let n=await F(e);if(!n)return null;if(!await L(n,t))return`denied`;try{return{handle:n,file:await n.getFile()}}catch(t){if(t instanceof DOMException&&(t.name===`NotFoundError`||t.name===`NotAllowedError`))return await I(e),null;throw t}}async function st(e,t){let n=await F(N(e));if(!(!n||!await L(n,t)))try{return{file:await n.getFile(),handle:n}}catch{await I(N(e));return}}async function ct(e,t){let n={remembered:!0,fromCache:!1,restoredUnsaved:!1,fileDetached:!1,diskChanged:!1},r=await ke(e),i=await ot(e,t.interactive),a=i&&i!==`denied`?i.handle:void 0,o=i&&i!==`denied`?i.file:null;if(r?.meta.dirty){let{connectionId:t,source:i}=await Ge(e,r.bytes,r.meta,a),s=o?o.lastModified!==r.meta.lastModified||o.size!==r.meta.size:!1;return{...n,connectionId:t,fileName:i.name,wal:i.wal,walApplied:i.walApplied,fromCache:!0,restoredUnsaved:!0,fileDetached:!a,diskChanged:s}}if(o&&a){let{connectionId:r,source:i}=await J(o,a,await st(e,t.interactive),{profileId:e});return{...n,connectionId:r,fileName:i.name,wal:i.wal,walApplied:i.walApplied}}if(r){let{connectionId:t,source:i}=await Ge(e,r.bytes,r.meta);return{...n,connectionId:t,fileName:i.name,wal:i.wal,walApplied:i.walApplied,fromCache:!0,fileDetached:!0}}if(!t.interactive)return null;let s=await Ue();if(!s)return null;let{connectionId:c,source:l}=await J(s.main.file,s.main.handle,s.wal,{profileId:e});return s.main.handle?await P(e,s.main.handle):await I(e),s.wal?.handle?await P(N(e),s.wal.handle):await I(N(e)),{...n,connectionId:c,fileName:l.name,wal:l.wal,walApplied:l.walApplied,remembered:!1}}var lt=`SQLite format 3\0`;async function ut(e){if(e.size===0)return!0;if(e.size<100)return!1;let t=new Uint8Array(await e.slice(0,16).arrayBuffer());return String.fromCharCode(...t)===lt}async function dt(e,t){try{let n=await F(e);return n?await n.isSameEntry(t):!1}catch{return!1}}async function ft(n){let i=n.find(e=>!U(e.file.name));if(!i)return;if(!await ut(i.file))throw Error(r.t(`app.dropNotSqlite`,{name:i.file.name}));let a=n.find(e=>U(e.file.name)&&e.file.name.toLowerCase()===`${i.file.name.toLowerCase()}-wal`),o=l.getState(),s;for(let e of o.savedConnections)if(!(e.dbms!==`sqlite`||(e.transport??`browser`)!==`browser`||e.sample||e.file!==i.file.name)&&i.handle&&await dt(e.id,i.handle)){s=e;break}let c=s??{id:crypto.randomUUID(),hostName:i.file.name.replace(/\.(db|sqlite|sqlite3|db3)$/i,``),host:``,user:``,pass:``,charset:`utf8`,port:0,dbms:`sqlite`,transport:`browser`,file:i.file.name,autoConnection:!1,savePassword:!0,authToken:``};e(`sqlite_file_drop`,{reused:!!s,wal:!!a,handle:!!i.handle});let d=o.activeConnections.some(e=>e.id===c.id),f=o.activeConnections.find(e=>e.id===c.id)?.serverConnectionId,{connectionId:p}=await J(i.file,i.handle,a,{profileId:c.id});f&&f!==p&&B(f)&&X(f),i.handle?await P(c.id,i.handle):await I(c.id),a?.handle?await P(N(c.id),a.handle):await I(N(c.id)),s||o.addSavedConnection(c),o.openConnection({...c,serverConnectionId:p}),o.setPendingReopen(c.id,!1),o.setFileDetached(c.id,!1),d?Ce.getState().removeTree(c.id):u.getState().addQueryTab(c.id,{id:`tab-${Date.now()}`,title:r.t(`connection.dialog.firstQueryTab`),query:``,database:``,isExecuting:!1,results:[],error:null,executionTime:null}),t.getState().setWelcomeVisible(!1)}async function pt(e,t){let n=await ot(e,!0);return!n||n===`denied`?!1:(Ke(t,n.handle),!0)}async function mt(e){let t=Z(e),n=Y(e);return n&&!n.handle&&t&&await pt(t,e),it(e)}function ht(e){let t=Y(e);return t?t.name===`:memory:`?r.t(`services.save.inMemory`):typeof window<`u`&&!(`showOpenFilePicker`in window)?r.t(`services.save.noFileSystemAccess`):!t.handle&&!Z(e)?r.t(`services.save.noWritableHandle`):null:r.t(`services.save.notBrowserSqlite`)}async function gt(e,t){let n=await We();if(!n)return null;let r=await Je(t,n);return n.handle&&await P(N(e),n.handle),{connectionId:r.connectionId,appliedFrames:r.appliedFrames}}function _t(e){if(!B(e))return null;let t=Y(e);return t?{wal:t.wal,walApplied:t.walApplied,walAcknowledged:t.walAcknowledged??!1}:null}function vt(e){return e.dbms===`sqlite`&&e.transport===`browser`?`browser`:`tunnel`}async function yt(e,t){return he(e,t)}async function bt(e,t){return be(e,t)}async function xt(e,t,n){let r=e=>({success:!1,fields:[],records:[],affectedRows:0,insertId:0,isResultQuery:!1,execTime:0,message:e instanceof Error?e.message:String(e)});if(B(e))try{return await Qe(e,t)}catch(e){return r(e)}let i=Q.get(e)??e;try{return await _e(i,t,n)}catch(e){if(!(e instanceof b)||e.status!==404)return r(e);let a=await St(i);if(!a)return r(e);try{return await _e(a,t,n)}catch(e){return r(e)}}}var Q=new Map,$=new Map;function St(e){let n=$.get(e);if(n)return n;let i=(async()=>{let n=l.getState(),i=n.activeConnections.find(t=>t.serverConnectionId===e||Q.get(t.serverConnectionId??``)===e);if(!i||vt(i)===`browser`||se())return null;if(i.serverConnectionId&&i.serverConnectionId!==e&&!Q.has(i.serverConnectionId))return Q.set(e,i.serverConnectionId),i.serverConnectionId;let a=n.resolveCredentials(i),o=a.ssh?.enabled&&a.ssh.auth===`password`&&!a.ssh.password;if(!a.pass&&i.pass===``&&i.dbms!==`sqlite`||o)return null;try{let n=await he(_(a),a.authToken||void 0);if(!n.success||!n.connectionId)return null;for(let[t,r]of Q)r===e&&Q.set(t,n.connectionId);return Q.set(e,n.connectionId),l.getState().updateServerConnectionId(i.id,n.connectionId),l.getState().setTransactionOpen(i.id,!1),t.getState().setFooterMessage(r.t(`services.agent.reconnected`,{name:i.hostName||i.host||i.databaseId||i.file||i.id})),n.connectionId}catch{return null}})();return $.set(e,i),i.finally(()=>$.delete(e)),i}async function Ct(e){if(B(e)){let t=Z(e);X(e),t&&await Me(t);return}return ye(e)}async function wt(e){if(B(e))return!1;let t=l.getState().activeConnections.find(t=>t.id===e)?.serverConnectionId;return t?ge(t):!1}function Tt(e){return async(t,n)=>{let i=await xt(e,t,n);if(!i.success)throw Error(i.message??r.t(`services.query.failed`));return i}}export{_ as A,le as C,oe as D,pe as E,ee as M,p as N,me as O,se as S,ue as T,tt as _,ht as a,J as b,at as c,gt as d,ft as f,nt as g,bt as h,Tt as i,f as j,xe as k,_t as l,mt as m,ct as n,Ct as o,pt as p,yt as r,xt as s,wt as t,vt as u,B as v,ne as w,Ce as x,qe as y};
|