princess-python-editor 0.3.0 → 0.3.2

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/dist/index.es.js CHANGED
@@ -1,24 +1,24 @@
1
- var Na = Object.defineProperty;
2
- var La = (s, n, a) => n in s ? Na(s, n, { enumerable: !0, configurable: !0, writable: !0, value: a }) : s[n] = a;
1
+ var Fa = Object.defineProperty;
2
+ var La = (s, n, a) => n in s ? Fa(s, n, { enumerable: !0, configurable: !0, writable: !0, value: a }) : s[n] = a;
3
3
  var ie = (s, n, a) => La(s, typeof n != "symbol" ? n + "" : n, a);
4
- import { h as Kn, defineComponent as $a, ref as C, reactive as Jn, computed as U, onMounted as Fa, onBeforeUnmount as _a, watch as ee, nextTick as Zn, openBlock as m, createElementBlock as g, normalizeStyle as Gn, normalizeClass as le, createElementVNode as l, createVNode as V, unref as B, createCommentVNode as T, createBlock as Wn, withDirectives as J, vModelText as he, Fragment as A, renderList as te, toDisplayString as R, vModelSelect as Et, withModifiers as Yn, withKeys as Ra, createTextVNode as Wt, onScopeDispose as Ia } from "vue";
5
- import { EditorState as nn, StateEffect as Ha, StateField as Ba, Compartment as qt } from "@codemirror/state";
6
- import { EditorView as $e, keymap as Xn, lineNumbers as Ua, highlightActiveLineGutter as Aa, highlightActiveLine as Da, drawSelection as za, placeholder as ja, Decoration as rn } from "@codemirror/view";
7
- import { linter as Va, forceLinting as Qa } from "@codemirror/lint";
8
- import { autocompletion as Ka, closeBrackets as Ja, closeBracketsKeymap as Za } from "@codemirror/autocomplete";
9
- import { history as Ga, defaultKeymap as Wa, historyKeymap as Ya, indentWithTab as Xa } from "@codemirror/commands";
10
- import { syntaxHighlighting as es, HighlightStyle as ts, indentUnit as ns, bracketMatching as rs } from "@codemirror/language";
11
- import { python as mr } from "@codemirror/lang-python";
12
- import { javascript as as } from "@codemirror/lang-javascript";
13
- import { json as ss } from "@codemirror/lang-json";
14
- import { sql as os } from "@codemirror/lang-sql";
15
- let is = 0;
4
+ import { h as Jn, defineComponent as $a, ref as C, reactive as Zn, computed as U, onMounted as Ra, onBeforeUnmount as _a, watch as ee, nextTick as Gn, openBlock as p, createElementBlock as m, normalizeStyle as Wn, normalizeClass as le, createElementVNode as l, createVNode as z, unref as H, createCommentVNode as O, createBlock as Yn, withDirectives as Z, vModelText as ge, Fragment as A, renderList as te, toDisplayString as _, vModelSelect as Et, withModifiers as Xn, withKeys as Ia, createTextVNode as Wt, onScopeDispose as Ha } from "vue";
5
+ import { EditorState as nn, StateEffect as Ba, StateField as Ua, Compartment as qt } from "@codemirror/state";
6
+ import { EditorView as Le, keymap as er, lineNumbers as Aa, highlightActiveLineGutter as Da, highlightActiveLine as za, drawSelection as ja, placeholder as Va, Decoration as rn } from "@codemirror/view";
7
+ import { linter as Qa, forceLinting as Ka } from "@codemirror/lint";
8
+ import { autocompletion as Ja, closeBrackets as Za, closeBracketsKeymap as Ga } from "@codemirror/autocomplete";
9
+ import { history as Wa, defaultKeymap as Ya, historyKeymap as Xa, indentWithTab as es } from "@codemirror/commands";
10
+ import { syntaxHighlighting as ts, HighlightStyle as ns, indentUnit as rs, bracketMatching as as } from "@codemirror/language";
11
+ import { python as yr } from "@codemirror/lang-python";
12
+ import { javascript as ss } from "@codemirror/lang-javascript";
13
+ import { json as os } from "@codemirror/lang-json";
14
+ import { sql as is } from "@codemirror/lang-sql";
15
+ let ls = 0;
16
16
  class K {
17
17
  /**
18
18
  Create a new node prop type.
19
19
  */
20
20
  constructor(n = {}) {
21
- this.id = is++, this.perNode = !!n.perNode, this.deserialize = n.deserialize || (() => {
21
+ this.id = ls++, this.perNode = !!n.perNode, this.deserialize = n.deserialize || (() => {
22
22
  throw new Error("This node type doesn't define a deserialize function");
23
23
  }), this.combine = n.combine || null;
24
24
  }
@@ -51,7 +51,7 @@ K.isolate = new K({ deserialize: (s) => {
51
51
  K.contextHash = new K({ perNode: !0 });
52
52
  K.lookAhead = new K({ perNode: !0 });
53
53
  K.mounted = new K({ perNode: !0 });
54
- const ls = /* @__PURE__ */ Object.create(null);
54
+ const us = /* @__PURE__ */ Object.create(null);
55
55
  class pt {
56
56
  /**
57
57
  @internal
@@ -63,13 +63,13 @@ class pt {
63
63
  Define a node type.
64
64
  */
65
65
  static define(n) {
66
- let a = n.props && n.props.length ? /* @__PURE__ */ Object.create(null) : ls, o = (n.top ? 1 : 0) | (n.skipped ? 2 : 0) | (n.error ? 4 : 0) | (n.name == null ? 8 : 0), i = new pt(n.name || "", a, n.id, o);
66
+ let a = n.props && n.props.length ? /* @__PURE__ */ Object.create(null) : us, o = (n.top ? 1 : 0) | (n.skipped ? 2 : 0) | (n.error ? 4 : 0) | (n.name == null ? 8 : 0), i = new pt(n.name || "", a, n.id, o);
67
67
  if (n.props) {
68
- for (let p of n.props)
69
- if (Array.isArray(p) || (p = p(i)), p) {
70
- if (p[0].perNode)
68
+ for (let f of n.props)
69
+ if (Array.isArray(f) || (f = f(i)), f) {
70
+ if (f[0].perNode)
71
71
  throw new RangeError("Can't store a per-node prop on a node type");
72
- a[p[0].id] = p[1];
72
+ a[f[0].id] = f[1];
73
73
  }
74
74
  }
75
75
  return i;
@@ -133,8 +133,8 @@ class pt {
133
133
  for (let i of o.split(" "))
134
134
  a[i] = n[o];
135
135
  return (o) => {
136
- for (let i = o.prop(K.group), p = -1; p < (i ? i.length : 0); p++) {
137
- let b = a[p < 0 ? o.name : i[p]];
136
+ for (let i = o.prop(K.group), f = -1; f < (i ? i.length : 0); f++) {
137
+ let b = a[f < 0 ? o.name : i[f]];
138
138
  if (b)
139
139
  return b;
140
140
  }
@@ -148,18 +148,18 @@ pt.none = new pt(
148
148
  8
149
149
  /* NodeFlag.Anonymous */
150
150
  );
151
- var er;
151
+ var tr;
152
152
  (function(s) {
153
153
  s[s.ExcludeBuffers = 1] = "ExcludeBuffers", s[s.IncludeAnonymous = 2] = "IncludeAnonymous", s[s.IgnoreMounts = 4] = "IgnoreMounts", s[s.IgnoreOverlays = 8] = "IgnoreOverlays", s[s.EnterBracketed = 16] = "EnterBracketed";
154
- })(er || (er = {}));
154
+ })(tr || (tr = {}));
155
155
  new K({ perNode: !0 });
156
- let us = 0;
156
+ let cs = 0;
157
157
  class ue {
158
158
  /**
159
159
  @internal
160
160
  */
161
161
  constructor(n, a, o, i) {
162
- this.name = n, this.set = a, this.base = o, this.modified = i, this.id = us++;
162
+ this.name = n, this.set = a, this.base = o, this.modified = i, this.id = cs++;
163
163
  }
164
164
  toString() {
165
165
  let { name: n } = this;
@@ -173,8 +173,8 @@ class ue {
173
173
  throw new Error("Can not derive from a modified tag");
174
174
  let i = new ue(o, [], null, []);
175
175
  if (i.set.push(i), a)
176
- for (let p of a.set)
177
- i.set.push(p);
176
+ for (let f of a.set)
177
+ i.set.push(f);
178
178
  return i;
179
179
  }
180
180
  /**
@@ -190,36 +190,36 @@ class ue {
190
190
  `m1(m3(t1)`, and so on.
191
191
  */
192
192
  static defineModifier(n) {
193
- let a = new Nt(n);
194
- return (o) => o.modified.indexOf(a) > -1 ? o : Nt.get(o.base || o, o.modified.concat(a).sort((i, p) => i.id - p.id));
193
+ let a = new Tt(n);
194
+ return (o) => o.modified.indexOf(a) > -1 ? o : Tt.get(o.base || o, o.modified.concat(a).sort((i, f) => i.id - f.id));
195
195
  }
196
196
  }
197
- let cs = 0;
198
- class Nt {
197
+ let ds = 0;
198
+ class Tt {
199
199
  constructor(n) {
200
- this.name = n, this.instances = [], this.id = cs++;
200
+ this.name = n, this.instances = [], this.id = ds++;
201
201
  }
202
202
  static get(n, a) {
203
203
  if (!a.length)
204
204
  return n;
205
- let o = a[0].instances.find((E) => E.base == n && ds(a, E.modified));
205
+ let o = a[0].instances.find((E) => E.base == n && ps(a, E.modified));
206
206
  if (o)
207
207
  return o;
208
- let i = [], p = new ue(n.name, i, n, a);
208
+ let i = [], f = new ue(n.name, i, n, a);
209
209
  for (let E of a)
210
- E.instances.push(p);
211
- let b = ps(a);
210
+ E.instances.push(f);
211
+ let b = fs(a);
212
212
  for (let E of n.set)
213
213
  if (!E.modified.length)
214
- for (let _ of b)
215
- i.push(Nt.get(E, _));
216
- return p;
214
+ for (let R of b)
215
+ i.push(Tt.get(E, R));
216
+ return f;
217
217
  }
218
218
  }
219
- function ds(s, n) {
219
+ function ps(s, n) {
220
220
  return s.length == n.length && s.every((a, o) => a == n[o]);
221
221
  }
222
- function ps(s) {
222
+ function fs(s) {
223
223
  let n = [[]];
224
224
  for (let a = 0; a < s.length; a++)
225
225
  for (let o = 0, i = n.length; o < i; o++)
@@ -232,8 +232,8 @@ new K({
232
232
  for (; s || n; ) {
233
233
  if (!s || n && s.depth <= n.depth ? (i = n, n = n.next) : (i = s, s = s.next), a && a.mode == i.mode && !i.context && !a.context)
234
234
  continue;
235
- let p = new an(i.tags, i.mode, i.context);
236
- a ? a.next = p : o = p, a = p;
235
+ let f = new an(i.tags, i.mode, i.context);
236
+ a ? a.next = f : o = f, a = f;
237
237
  }
238
238
  return o;
239
239
  }
@@ -256,23 +256,23 @@ class an {
256
256
  }
257
257
  }
258
258
  an.empty = new an([], 2, null);
259
- function fs(s, n) {
259
+ function vs(s, n) {
260
260
  let a = /* @__PURE__ */ Object.create(null);
261
- for (let p of s)
262
- if (!Array.isArray(p.tag))
263
- a[p.tag.id] = p.class;
261
+ for (let f of s)
262
+ if (!Array.isArray(f.tag))
263
+ a[f.tag.id] = f.class;
264
264
  else
265
- for (let b of p.tag)
266
- a[b.id] = p.class;
265
+ for (let b of f.tag)
266
+ a[b.id] = f.class;
267
267
  let { scope: o, all: i = null } = {};
268
268
  return {
269
- style: (p) => {
269
+ style: (f) => {
270
270
  let b = i;
271
- for (let E of p)
272
- for (let _ of E.set) {
273
- let O = a[_.id];
274
- if (O) {
275
- b = b ? b + " " + O : O;
271
+ for (let E of f)
272
+ for (let R of E.set) {
273
+ let M = a[R.id];
274
+ if (M) {
275
+ b = b ? b + " " + M : M;
276
276
  break;
277
277
  }
278
278
  }
@@ -281,7 +281,7 @@ function fs(s, n) {
281
281
  scope: o
282
282
  };
283
283
  }
284
- const v = ue.define, Ct = v(), Ne = v(), tr = v(Ne), nr = v(Ne), Le = v(), Pt = v(Le), Yt = v(Le), we = v(), Be = v(we), be = v(), ke = v(), sn = v(), lt = v(sn), Ot = v(), d = {
284
+ const y = ue.define, Ct = y(), Te = y(), nr = y(Te), rr = y(Te), Fe = y(), Pt = y(Fe), Yt = y(Fe), we = y(), Ue = y(we), be = y(), ke = y(), sn = y(), lt = y(sn), Ot = y(), d = {
285
285
  /**
286
286
  A comment.
287
287
  */
@@ -289,59 +289,59 @@ const v = ue.define, Ct = v(), Ne = v(), tr = v(Ne), nr = v(Ne), Le = v(), Pt =
289
289
  /**
290
290
  A line [comment](#highlight.tags.comment).
291
291
  */
292
- lineComment: v(Ct),
292
+ lineComment: y(Ct),
293
293
  /**
294
294
  A block [comment](#highlight.tags.comment).
295
295
  */
296
- blockComment: v(Ct),
296
+ blockComment: y(Ct),
297
297
  /**
298
298
  A documentation [comment](#highlight.tags.comment).
299
299
  */
300
- docComment: v(Ct),
300
+ docComment: y(Ct),
301
301
  /**
302
302
  Any kind of identifier.
303
303
  */
304
- name: Ne,
304
+ name: Te,
305
305
  /**
306
306
  The [name](#highlight.tags.name) of a variable.
307
307
  */
308
- variableName: v(Ne),
308
+ variableName: y(Te),
309
309
  /**
310
310
  A type [name](#highlight.tags.name).
311
311
  */
312
- typeName: tr,
312
+ typeName: nr,
313
313
  /**
314
314
  A tag name (subtag of [`typeName`](#highlight.tags.typeName)).
315
315
  */
316
- tagName: v(tr),
316
+ tagName: y(nr),
317
317
  /**
318
318
  A property or field [name](#highlight.tags.name).
319
319
  */
320
- propertyName: nr,
320
+ propertyName: rr,
321
321
  /**
322
322
  An attribute name (subtag of [`propertyName`](#highlight.tags.propertyName)).
323
323
  */
324
- attributeName: v(nr),
324
+ attributeName: y(rr),
325
325
  /**
326
326
  The [name](#highlight.tags.name) of a class.
327
327
  */
328
- className: v(Ne),
328
+ className: y(Te),
329
329
  /**
330
330
  A label [name](#highlight.tags.name).
331
331
  */
332
- labelName: v(Ne),
332
+ labelName: y(Te),
333
333
  /**
334
334
  A namespace [name](#highlight.tags.name).
335
335
  */
336
- namespace: v(Ne),
336
+ namespace: y(Te),
337
337
  /**
338
338
  The [name](#highlight.tags.name) of a macro.
339
339
  */
340
- macroName: v(Ne),
340
+ macroName: y(Te),
341
341
  /**
342
342
  A literal value.
343
343
  */
344
- literal: Le,
344
+ literal: Fe,
345
345
  /**
346
346
  A string [literal](#highlight.tags.literal).
347
347
  */
@@ -349,15 +349,15 @@ const v = ue.define, Ct = v(), Ne = v(), tr = v(Ne), nr = v(Ne), Le = v(), Pt =
349
349
  /**
350
350
  A documentation [string](#highlight.tags.string).
351
351
  */
352
- docString: v(Pt),
352
+ docString: y(Pt),
353
353
  /**
354
354
  A character literal (subtag of [string](#highlight.tags.string)).
355
355
  */
356
- character: v(Pt),
356
+ character: y(Pt),
357
357
  /**
358
358
  An attribute value (subtag of [string](#highlight.tags.string)).
359
359
  */
360
- attributeValue: v(Pt),
360
+ attributeValue: y(Pt),
361
361
  /**
362
362
  A number [literal](#highlight.tags.literal).
363
363
  */
@@ -365,32 +365,32 @@ const v = ue.define, Ct = v(), Ne = v(), tr = v(Ne), nr = v(Ne), Le = v(), Pt =
365
365
  /**
366
366
  An integer [number](#highlight.tags.number) literal.
367
367
  */
368
- integer: v(Yt),
368
+ integer: y(Yt),
369
369
  /**
370
370
  A floating-point [number](#highlight.tags.number) literal.
371
371
  */
372
- float: v(Yt),
372
+ float: y(Yt),
373
373
  /**
374
374
  A boolean [literal](#highlight.tags.literal).
375
375
  */
376
- bool: v(Le),
376
+ bool: y(Fe),
377
377
  /**
378
378
  Regular expression [literal](#highlight.tags.literal).
379
379
  */
380
- regexp: v(Le),
380
+ regexp: y(Fe),
381
381
  /**
382
382
  An escape [literal](#highlight.tags.literal), for example a
383
383
  backslash escape in a string.
384
384
  */
385
- escape: v(Le),
385
+ escape: y(Fe),
386
386
  /**
387
387
  A color [literal](#highlight.tags.literal).
388
388
  */
389
- color: v(Le),
389
+ color: y(Fe),
390
390
  /**
391
391
  A URL [literal](#highlight.tags.literal).
392
392
  */
393
- url: v(Le),
393
+ url: y(Fe),
394
394
  /**
395
395
  A language keyword.
396
396
  */
@@ -399,40 +399,40 @@ const v = ue.define, Ct = v(), Ne = v(), tr = v(Ne), nr = v(Ne), Le = v(), Pt =
399
399
  The [keyword](#highlight.tags.keyword) for the self or this
400
400
  object.
401
401
  */
402
- self: v(be),
402
+ self: y(be),
403
403
  /**
404
404
  The [keyword](#highlight.tags.keyword) for null.
405
405
  */
406
- null: v(be),
406
+ null: y(be),
407
407
  /**
408
408
  A [keyword](#highlight.tags.keyword) denoting some atomic value.
409
409
  */
410
- atom: v(be),
410
+ atom: y(be),
411
411
  /**
412
412
  A [keyword](#highlight.tags.keyword) that represents a unit.
413
413
  */
414
- unit: v(be),
414
+ unit: y(be),
415
415
  /**
416
416
  A modifier [keyword](#highlight.tags.keyword).
417
417
  */
418
- modifier: v(be),
418
+ modifier: y(be),
419
419
  /**
420
420
  A [keyword](#highlight.tags.keyword) that acts as an operator.
421
421
  */
422
- operatorKeyword: v(be),
422
+ operatorKeyword: y(be),
423
423
  /**
424
424
  A control-flow related [keyword](#highlight.tags.keyword).
425
425
  */
426
- controlKeyword: v(be),
426
+ controlKeyword: y(be),
427
427
  /**
428
428
  A [keyword](#highlight.tags.keyword) that defines something.
429
429
  */
430
- definitionKeyword: v(be),
430
+ definitionKeyword: y(be),
431
431
  /**
432
432
  A [keyword](#highlight.tags.keyword) related to defining or
433
433
  interfacing with modules.
434
434
  */
435
- moduleKeyword: v(be),
435
+ moduleKeyword: y(be),
436
436
  /**
437
437
  An operator.
438
438
  */
@@ -440,39 +440,39 @@ const v = ue.define, Ct = v(), Ne = v(), tr = v(Ne), nr = v(Ne), Le = v(), Pt =
440
440
  /**
441
441
  An [operator](#highlight.tags.operator) that dereferences something.
442
442
  */
443
- derefOperator: v(ke),
443
+ derefOperator: y(ke),
444
444
  /**
445
445
  Arithmetic-related [operator](#highlight.tags.operator).
446
446
  */
447
- arithmeticOperator: v(ke),
447
+ arithmeticOperator: y(ke),
448
448
  /**
449
449
  Logical [operator](#highlight.tags.operator).
450
450
  */
451
- logicOperator: v(ke),
451
+ logicOperator: y(ke),
452
452
  /**
453
453
  Bit [operator](#highlight.tags.operator).
454
454
  */
455
- bitwiseOperator: v(ke),
455
+ bitwiseOperator: y(ke),
456
456
  /**
457
457
  Comparison [operator](#highlight.tags.operator).
458
458
  */
459
- compareOperator: v(ke),
459
+ compareOperator: y(ke),
460
460
  /**
461
461
  [Operator](#highlight.tags.operator) that updates its operand.
462
462
  */
463
- updateOperator: v(ke),
463
+ updateOperator: y(ke),
464
464
  /**
465
465
  [Operator](#highlight.tags.operator) that defines something.
466
466
  */
467
- definitionOperator: v(ke),
467
+ definitionOperator: y(ke),
468
468
  /**
469
469
  Type-related [operator](#highlight.tags.operator).
470
470
  */
471
- typeOperator: v(ke),
471
+ typeOperator: y(ke),
472
472
  /**
473
473
  Control-flow [operator](#highlight.tags.operator).
474
474
  */
475
- controlOperator: v(ke),
475
+ controlOperator: y(ke),
476
476
  /**
477
477
  Program or markup punctuation.
478
478
  */
@@ -481,7 +481,7 @@ const v = ue.define, Ct = v(), Ne = v(), tr = v(Ne), nr = v(Ne), Le = v(), Pt =
481
481
  [Punctuation](#highlight.tags.punctuation) that separates
482
482
  things.
483
483
  */
484
- separator: v(sn),
484
+ separator: y(sn),
485
485
  /**
486
486
  Bracket-style [punctuation](#highlight.tags.punctuation).
487
487
  */
@@ -490,22 +490,22 @@ const v = ue.define, Ct = v(), Ne = v(), tr = v(Ne), nr = v(Ne), Le = v(), Pt =
490
490
  Angle [brackets](#highlight.tags.bracket) (usually `<` and `>`
491
491
  tokens).
492
492
  */
493
- angleBracket: v(lt),
493
+ angleBracket: y(lt),
494
494
  /**
495
495
  Square [brackets](#highlight.tags.bracket) (usually `[` and `]`
496
496
  tokens).
497
497
  */
498
- squareBracket: v(lt),
498
+ squareBracket: y(lt),
499
499
  /**
500
500
  Parentheses (usually `(` and `)` tokens). Subtag of
501
501
  [bracket](#highlight.tags.bracket).
502
502
  */
503
- paren: v(lt),
503
+ paren: y(lt),
504
504
  /**
505
505
  Braces (usually `{` and `}` tokens). Subtag of
506
506
  [bracket](#highlight.tags.bracket).
507
507
  */
508
- brace: v(lt),
508
+ brace: y(lt),
509
509
  /**
510
510
  Content, for example plain text in XML or markup documents.
511
511
  */
@@ -513,81 +513,81 @@ const v = ue.define, Ct = v(), Ne = v(), tr = v(Ne), nr = v(Ne), Le = v(), Pt =
513
513
  /**
514
514
  [Content](#highlight.tags.content) that represents a heading.
515
515
  */
516
- heading: Be,
516
+ heading: Ue,
517
517
  /**
518
518
  A level 1 [heading](#highlight.tags.heading).
519
519
  */
520
- heading1: v(Be),
520
+ heading1: y(Ue),
521
521
  /**
522
522
  A level 2 [heading](#highlight.tags.heading).
523
523
  */
524
- heading2: v(Be),
524
+ heading2: y(Ue),
525
525
  /**
526
526
  A level 3 [heading](#highlight.tags.heading).
527
527
  */
528
- heading3: v(Be),
528
+ heading3: y(Ue),
529
529
  /**
530
530
  A level 4 [heading](#highlight.tags.heading).
531
531
  */
532
- heading4: v(Be),
532
+ heading4: y(Ue),
533
533
  /**
534
534
  A level 5 [heading](#highlight.tags.heading).
535
535
  */
536
- heading5: v(Be),
536
+ heading5: y(Ue),
537
537
  /**
538
538
  A level 6 [heading](#highlight.tags.heading).
539
539
  */
540
- heading6: v(Be),
540
+ heading6: y(Ue),
541
541
  /**
542
542
  A prose [content](#highlight.tags.content) separator (such as a horizontal rule).
543
543
  */
544
- contentSeparator: v(we),
544
+ contentSeparator: y(we),
545
545
  /**
546
546
  [Content](#highlight.tags.content) that represents a list.
547
547
  */
548
- list: v(we),
548
+ list: y(we),
549
549
  /**
550
550
  [Content](#highlight.tags.content) that represents a quote.
551
551
  */
552
- quote: v(we),
552
+ quote: y(we),
553
553
  /**
554
554
  [Content](#highlight.tags.content) that is emphasized.
555
555
  */
556
- emphasis: v(we),
556
+ emphasis: y(we),
557
557
  /**
558
558
  [Content](#highlight.tags.content) that is styled strong.
559
559
  */
560
- strong: v(we),
560
+ strong: y(we),
561
561
  /**
562
562
  [Content](#highlight.tags.content) that is part of a link.
563
563
  */
564
- link: v(we),
564
+ link: y(we),
565
565
  /**
566
566
  [Content](#highlight.tags.content) that is styled as code or
567
567
  monospace.
568
568
  */
569
- monospace: v(we),
569
+ monospace: y(we),
570
570
  /**
571
571
  [Content](#highlight.tags.content) that has a strike-through
572
572
  style.
573
573
  */
574
- strikethrough: v(we),
574
+ strikethrough: y(we),
575
575
  /**
576
576
  Inserted text in a change-tracking format.
577
577
  */
578
- inserted: v(),
578
+ inserted: y(),
579
579
  /**
580
580
  Deleted text.
581
581
  */
582
- deleted: v(),
582
+ deleted: y(),
583
583
  /**
584
584
  Changed text.
585
585
  */
586
- changed: v(),
586
+ changed: y(),
587
587
  /**
588
588
  An invalid or unsyntactic element.
589
589
  */
590
- invalid: v(),
590
+ invalid: y(),
591
591
  /**
592
592
  Metadata or meta-instruction.
593
593
  */
@@ -596,17 +596,17 @@ const v = ue.define, Ct = v(), Ne = v(), tr = v(Ne), nr = v(Ne), Le = v(), Pt =
596
596
  [Metadata](#highlight.tags.meta) that applies to the entire
597
597
  document.
598
598
  */
599
- documentMeta: v(Ot),
599
+ documentMeta: y(Ot),
600
600
  /**
601
601
  [Metadata](#highlight.tags.meta) that annotates or adds
602
602
  attributes to a given syntactic element.
603
603
  */
604
- annotation: v(Ot),
604
+ annotation: y(Ot),
605
605
  /**
606
606
  Processing instruction or preprocessor directive. Subtag of
607
607
  [meta](#highlight.tags.meta).
608
608
  */
609
- processingInstruction: v(Ot),
609
+ processingInstruction: y(Ot),
610
610
  /**
611
611
  [Modifier](#highlight.Tag^defineModifier) that indicates that a
612
612
  given element is being defined. Expected to be used with the
@@ -651,7 +651,7 @@ for (let s in d) {
651
651
  let n = d[s];
652
652
  n instanceof ue && (n.name = s);
653
653
  }
654
- fs([
654
+ vs([
655
655
  { tag: d.link, class: "tok-link" },
656
656
  { tag: d.heading, class: "tok-heading" },
657
657
  { tag: d.emphasis, class: "tok-emphasis" },
@@ -683,7 +683,7 @@ fs([
683
683
  { tag: d.invalid, class: "tok-invalid" },
684
684
  { tag: d.punctuation, class: "tok-punctuation" }
685
685
  ]);
686
- const vs = {
686
+ const ms = {
687
687
  "&": {
688
688
  backgroundColor: "var(--vpe-editor-bg)",
689
689
  color: "var(--vpe-text)"
@@ -738,7 +738,7 @@ const vs = {
738
738
  ".cm-panels.cm-panels-bottom": {
739
739
  borderTop: "1px solid var(--vpe-border)"
740
740
  }
741
- }, ms = ts.define([
741
+ }, ys = ns.define([
742
742
  { tag: d.comment, color: "var(--vpe-syn-comment)", fontStyle: "italic" },
743
743
  {
744
744
  tag: [
@@ -783,28 +783,28 @@ const vs = {
783
783
  { tag: d.strikethrough, textDecoration: "line-through" },
784
784
  { tag: d.invalid, color: "var(--vpe-syn-invalid)" }
785
785
  ]);
786
- function Tt(s) {
787
- return [$e.theme(vs, { dark: s }), es(ms)];
786
+ function Nt(s) {
787
+ return [Le.theme(ms, { dark: s }), ts(ys)];
788
788
  }
789
- const gs = "'JetBrains Mono', 'Fira Code', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace", gr = Ha.define();
790
- function ys(s, n) {
789
+ const hs = "'JetBrains Mono', 'Fira Code', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace", hr = Ba.define();
790
+ function gs(s, n) {
791
791
  const a = s.filter((o) => Number.isFinite(o) && o >= 1 && o <= n.lines).sort((o, i) => o - i);
792
792
  return rn.set(
793
793
  a.map((o) => rn.line({ class: "vpe-error-line" }).range(n.line(o).from))
794
794
  );
795
795
  }
796
- const hs = Ba.define({
796
+ const bs = Ua.define({
797
797
  create: () => rn.none,
798
798
  update: (s, n) => {
799
799
  let a = s;
800
800
  for (const o of n.effects)
801
- o.is(gr) && (a = ys(o.value, n.state.doc));
801
+ o.is(hr) && (a = gs(o.value, n.state.doc));
802
802
  return n.docChanged && (a = a.map(n.changes)), a;
803
803
  },
804
- provide: (s) => $e.decorations.from(s)
805
- }), bs = $e.theme({
804
+ provide: (s) => Le.decorations.from(s)
805
+ }), ks = Le.theme({
806
806
  "&": { height: "100%", fontSize: "13px" },
807
- ".cm-scroller": { fontFamily: gs, lineHeight: "1.65" },
807
+ ".cm-scroller": { fontFamily: hs, lineHeight: "1.65" },
808
808
  ".cm-content": { padding: "10px 0 14px" },
809
809
  ".cm-gutters": {
810
810
  borderRight: "none",
@@ -814,10 +814,10 @@ const hs = Ba.define({
814
814
  },
815
815
  "&.cm-focused": { outline: "none" }
816
816
  });
817
- function ks(s, n) {
818
- const a = $e.updateListener.of((p) => {
819
- p.docChanged && n.onDocChange(p.state.doc.toString());
820
- }), o = Xn.of([
817
+ function ws(s, n) {
818
+ const a = Le.updateListener.of((f) => {
819
+ f.docChanged && n.onDocChange(f.state.doc.toString());
820
+ }), o = er.of([
821
821
  {
822
822
  key: "Mod-Enter",
823
823
  preventDefault: !0,
@@ -826,31 +826,31 @@ function ks(s, n) {
826
826
  ]), i = nn.create({
827
827
  doc: n.value,
828
828
  extensions: [
829
- bs,
830
- Ua(),
829
+ ks,
831
830
  Aa(),
832
831
  Da(),
833
832
  za(),
834
- Ga(),
835
- ns.of(" "),
836
- n.language ?? mr(),
837
- Tt(n.dark),
838
- Ka(),
833
+ ja(),
834
+ Wa(),
835
+ rs.of(" "),
836
+ n.language ?? yr(),
837
+ Nt(n.dark),
839
838
  Ja(),
840
- rs(),
841
- $e.lineWrapping,
842
- ja(n.placeholderText),
843
- hs,
839
+ Za(),
840
+ as(),
841
+ Le.lineWrapping,
842
+ Va(n.placeholderText),
843
+ bs,
844
844
  o,
845
- Xn.of([...Za, ...Wa, ...Ya, Xa]),
845
+ er.of([...Ga, ...Ya, ...Xa, es]),
846
846
  ...n.extensions,
847
847
  a
848
848
  ]
849
849
  });
850
- return new $e({ state: i, parent: s });
850
+ return new Le({ state: i, parent: s });
851
851
  }
852
- function ws(s, n = 600) {
853
- return Va(
852
+ function Ss(s, n = 600) {
853
+ return Qa(
854
854
  async (a) => {
855
855
  const o = a.state.doc.toString();
856
856
  if (!o.trim()) return [];
@@ -861,11 +861,11 @@ function ws(s, n = 600) {
861
861
  return [];
862
862
  }
863
863
  if (!i) return [];
864
- const p = Math.min(Math.max(Math.round(i.line) || 1, 1), a.state.doc.lines), b = a.state.doc.line(p), E = Math.min(Math.max(Math.round(i.column) || 1, 1), b.length + 1), _ = b.from + E - 1, O = Math.min(_ + 1, b.to);
864
+ const f = Math.min(Math.max(Math.round(i.line) || 1, 1), a.state.doc.lines), b = a.state.doc.line(f), E = Math.min(Math.max(Math.round(i.column) || 1, 1), b.length + 1), R = b.from + E - 1, M = Math.min(R + 1, b.to);
865
865
  return [
866
866
  {
867
- from: _,
868
- to: O,
867
+ from: R,
868
+ to: M,
869
869
  severity: "error",
870
870
  message: i.message,
871
871
  source: "python-syntax"
@@ -875,7 +875,7 @@ function ws(s, n = 600) {
875
875
  { delay: n }
876
876
  );
877
877
  }
878
- const Ss = [
878
+ const xs = [
879
879
  "import ast, json",
880
880
  "def _pye_check(src):",
881
881
  " try:",
@@ -883,7 +883,7 @@ const Ss = [
883
883
  " return json.dumps({'ok': True})",
884
884
  " except SyntaxError as e:",
885
885
  " return json.dumps({'ok': False, 'line': int(e.lineno or 1), 'column': int(e.offset or 1), 'message': str(e.msg or 'invalid syntax')})"
886
- ], xs = [
886
+ ], Es = [
887
887
  "import json",
888
888
  "import sqlite3",
889
889
  "",
@@ -960,13 +960,13 @@ const Ss = [
960
960
  ' return json.dumps({"ok": False, "results": results, "error": error})',
961
961
  ' return json.dumps({"ok": True, "results": results})'
962
962
  ];
963
- function Es(s) {
963
+ function qs(s) {
964
964
  const n = s.endsWith("/") ? s : s + "/";
965
965
  return `
966
966
  var INDEX_URL = ${JSON.stringify(n)};
967
- var CHECK_SOURCE = ${JSON.stringify(Ss.join(`
967
+ var CHECK_SOURCE = ${JSON.stringify(xs.join(`
968
968
  `))};
969
- var SQL_SOURCE = ${JSON.stringify(xs.join(`
969
+ var SQL_SOURCE = ${JSON.stringify(Es.join(`
970
970
  `))};
971
971
  var pyodide = null;
972
972
  var checkFn = null;
@@ -1224,8 +1224,8 @@ self.onmessage = async function (ev) {
1224
1224
  };
1225
1225
  `;
1226
1226
  }
1227
- const yr = "https://cdn.jsdelivr.net/pyodide/v0.27.2/full/";
1228
- class qs {
1227
+ const gr = "https://cdn.jsdelivr.net/pyodide/v0.27.2/full/";
1228
+ class Cs {
1229
1229
  constructor(n = {}) {
1230
1230
  ie(this, "status", "idle");
1231
1231
  ie(this, "version", "");
@@ -1239,7 +1239,7 @@ class qs {
1239
1239
  ie(this, "statusHandlers", /* @__PURE__ */ new Set());
1240
1240
  ie(this, "outputHandlers", /* @__PURE__ */ new Set());
1241
1241
  ie(this, "initErrorHandlers", /* @__PURE__ */ new Set());
1242
- this.pyodideUrl = n.pyodideUrl || yr;
1242
+ this.pyodideUrl = n.pyodideUrl || gr;
1243
1243
  }
1244
1244
  on(n, a) {
1245
1245
  if (n === "status") {
@@ -1257,22 +1257,22 @@ class qs {
1257
1257
  waitReady(n = 18e4) {
1258
1258
  const a = this.generation;
1259
1259
  return this.ensureWorker(), this.status === "ready" || this.status === "running" ? Promise.resolve() : new Promise((o, i) => {
1260
- let p = () => {
1260
+ let f = () => {
1261
1261
  }, b = () => {
1262
1262
  };
1263
1263
  const E = () => {
1264
- clearTimeout(_), p(), b();
1265
- }, _ = setTimeout(() => {
1264
+ clearTimeout(R), f(), b();
1265
+ }, R = setTimeout(() => {
1266
1266
  E(), i(new Error("Pyodide 加载超时"));
1267
1267
  }, n);
1268
- p = this.on("status", (O) => {
1268
+ f = this.on("status", (M) => {
1269
1269
  if (this.generation !== a) {
1270
1270
  E(), i(new Error("执行已被中断"));
1271
1271
  return;
1272
1272
  }
1273
- O === "ready" && (E(), o());
1274
- }), b = this.on("initError", (O) => {
1275
- E(), i(new Error(O));
1273
+ M === "ready" && (E(), o());
1274
+ }), b = this.on("initError", (M) => {
1275
+ E(), i(new Error(M));
1276
1276
  });
1277
1277
  });
1278
1278
  }
@@ -1376,7 +1376,7 @@ class qs {
1376
1376
  }
1377
1377
  ensureWorker() {
1378
1378
  if (this.worker) return this.worker;
1379
- const n = new Blob([Es(this.pyodideUrl)], { type: "text/javascript" }), a = new Worker(URL.createObjectURL(n));
1379
+ const n = new Blob([qs(this.pyodideUrl)], { type: "text/javascript" }), a = new Worker(URL.createObjectURL(n));
1380
1380
  return a.onmessage = (o) => this.handleMessage(o.data), this.worker = a, this.setStatus("loading"), a;
1381
1381
  }
1382
1382
  handleMessage(n) {
@@ -1446,8 +1446,8 @@ class qs {
1446
1446
  }
1447
1447
  send(n, a) {
1448
1448
  const o = this.ensureWorker(), i = this.chain.then(
1449
- () => new Promise((p) => {
1450
- this.pending.set(n.id, { resolve: p, onOutput: a }), o.postMessage(n);
1449
+ () => new Promise((f) => {
1450
+ this.pending.set(n.id, { resolve: f, onOutput: a }), o.postMessage(n);
1451
1451
  })
1452
1452
  );
1453
1453
  return this.chain = i.then(
@@ -1463,50 +1463,50 @@ class qs {
1463
1463
  }
1464
1464
  let Xt = null;
1465
1465
  function un(s) {
1466
- return Xt ? s != null && s.pyodideUrl && s.pyodideUrl !== yr && console.warn(
1466
+ return Xt ? s != null && s.pyodideUrl && s.pyodideUrl !== gr && console.warn(
1467
1467
  "[princess-python-editor] Pyodide 运行器已初始化,后续传入的 pyodideUrl 将被忽略。"
1468
- ) : Xt = new qs(s), Xt;
1468
+ ) : Xt = new Cs(s), Xt;
1469
1469
  }
1470
- const Cs = 3e4;
1471
- function Ps(s) {
1470
+ const Ps = 3e4;
1471
+ function Os(s) {
1472
1472
  const n = (s ?? "").trim().replace(/\/+$/, "");
1473
1473
  if (!n)
1474
1474
  throw new Error("未配置文件服务端点(filesEndpoint)");
1475
1475
  return n;
1476
1476
  }
1477
- async function Ft(s, n, a, o = {}) {
1478
- var _, O;
1479
- const i = Ps(s), p = new AbortController(), b = setTimeout(() => p.abort(), o.timeoutMs ?? Cs), E = () => p.abort();
1480
- o.signal && (o.signal.aborted ? p.abort() : o.signal.addEventListener("abort", E));
1477
+ async function $t(s, n, a, o = {}) {
1478
+ var R, M;
1479
+ const i = Os(s), f = new AbortController(), b = setTimeout(() => f.abort(), o.timeoutMs ?? Ps), E = () => f.abort();
1480
+ o.signal && (o.signal.aborted ? f.abort() : o.signal.addEventListener("abort", E));
1481
1481
  try {
1482
- const N = await fetch(i + n, {
1482
+ const T = await fetch(i + n, {
1483
1483
  ...a,
1484
1484
  headers: {
1485
1485
  "Content-Type": "application/json",
1486
1486
  ...o.headers ?? {},
1487
1487
  ...a.headers ?? {}
1488
1488
  },
1489
- signal: p.signal
1490
- }), x = await N.text();
1491
- let F = null;
1489
+ signal: f.signal
1490
+ }), x = await T.text();
1491
+ let $ = null;
1492
1492
  if (x)
1493
1493
  try {
1494
- F = JSON.parse(x);
1494
+ $ = JSON.parse(x);
1495
1495
  } catch {
1496
- throw new Error(`文件服务返回的不是合法 JSON(HTTP ${N.status})`);
1496
+ throw new Error(`文件服务返回的不是合法 JSON(HTTP ${T.status})`);
1497
1497
  }
1498
- if (!N.ok || !F || F.ok === !1)
1499
- throw new Error(((_ = F == null ? void 0 : F.error) == null ? void 0 : _.message) ?? `文件服务返回 HTTP ${N.status}`);
1500
- return F.data;
1498
+ if (!T.ok || !$ || $.ok === !1)
1499
+ throw new Error(((R = $ == null ? void 0 : $.error) == null ? void 0 : R.message) ?? `文件服务返回 HTTP ${T.status}`);
1500
+ return $.data;
1501
1501
  } finally {
1502
- clearTimeout(b), (O = o.signal) == null || O.removeEventListener("abort", E);
1502
+ clearTimeout(b), (M = o.signal) == null || M.removeEventListener("abort", E);
1503
1503
  }
1504
1504
  }
1505
- function Os(s, n = {}) {
1506
- return Ft(s, "", { method: "GET" }, n);
1505
+ function Ms(s, n = {}) {
1506
+ return $t(s, "", { method: "GET" }, n);
1507
1507
  }
1508
- function Ms(s, n, a = {}) {
1509
- return Ft(
1508
+ function Ns(s, n, a = {}) {
1509
+ return $t(
1510
1510
  s,
1511
1511
  "",
1512
1512
  { method: "POST", body: JSON.stringify(n) },
@@ -1514,15 +1514,15 @@ function Ms(s, n, a = {}) {
1514
1514
  );
1515
1515
  }
1516
1516
  function Ts(s, n, a = {}) {
1517
- return Ft(
1517
+ return $t(
1518
1518
  s,
1519
1519
  `/${encodeURIComponent(n)}`,
1520
1520
  { method: "GET" },
1521
1521
  a
1522
1522
  );
1523
1523
  }
1524
- async function Ns(s, n, a = {}) {
1525
- await Ft(s, `/${encodeURIComponent(n)}`, { method: "DELETE" }, a);
1524
+ async function Fs(s, n, a = {}) {
1525
+ await $t(s, `/${encodeURIComponent(n)}`, { method: "DELETE" }, a);
1526
1526
  }
1527
1527
  const Ls = 6e4;
1528
1528
  function cn(s) {
@@ -1531,7 +1531,7 @@ function cn(s) {
1531
1531
  throw new Error("未配置 Python 服务端点(pythonEndpoint)");
1532
1532
  return n;
1533
1533
  }
1534
- function hr(s, n) {
1534
+ function br(s, n) {
1535
1535
  if (s && typeof s == "object") {
1536
1536
  const a = s, o = Number(a.line);
1537
1537
  return {
@@ -1543,37 +1543,37 @@ function hr(s, n) {
1543
1543
  }
1544
1544
  return { type: "PythonError", message: n };
1545
1545
  }
1546
- async function el(s, n, a = {}) {
1547
- var _;
1548
- const o = cn(s), i = performance.now(), p = new AbortController(), b = setTimeout(() => p.abort(), a.timeoutMs ?? Ls), E = () => p.abort();
1549
- a.signal && (a.signal.aborted ? p.abort() : a.signal.addEventListener("abort", E));
1546
+ async function al(s, n, a = {}) {
1547
+ var R;
1548
+ const o = cn(s), i = performance.now(), f = new AbortController(), b = setTimeout(() => f.abort(), a.timeoutMs ?? Ls), E = () => f.abort();
1549
+ a.signal && (a.signal.aborted ? f.abort() : a.signal.addEventListener("abort", E));
1550
1550
  try {
1551
- const O = await fetch(`${o}/run`, {
1551
+ const M = await fetch(`${o}/run`, {
1552
1552
  method: "POST",
1553
1553
  headers: {
1554
1554
  "Content-Type": "application/json",
1555
1555
  ...a.headers ?? {}
1556
1556
  },
1557
1557
  body: JSON.stringify({ code: n, stdin: a.stdin ?? "" }),
1558
- signal: p.signal
1559
- }), N = await O.text();
1558
+ signal: f.signal
1559
+ }), T = await M.text();
1560
1560
  let x = null;
1561
- if (N)
1561
+ if (T)
1562
1562
  try {
1563
- x = JSON.parse(N);
1563
+ x = JSON.parse(T);
1564
1564
  } catch {
1565
- throw new Error(`Python 服务返回的不是合法 JSON(HTTP ${O.status})`);
1565
+ throw new Error(`Python 服务返回的不是合法 JSON(HTTP ${M.status})`);
1566
1566
  }
1567
- const F = performance.now() - i;
1568
- if (!O.ok) {
1569
- const M = x == null ? void 0 : x.error, Q = typeof (M == null ? void 0 : M.message) == "string" && M.message ? M.message : `Python 服务返回 HTTP ${O.status}`;
1567
+ const $ = performance.now() - i;
1568
+ if (!M.ok) {
1569
+ const N = x == null ? void 0 : x.error, Q = typeof (N == null ? void 0 : N.message) == "string" && N.message ? N.message : `Python 服务返回 HTTP ${M.status}`;
1570
1570
  return {
1571
1571
  ok: !1,
1572
1572
  stdout: "",
1573
1573
  stderr: "",
1574
- durationMs: F,
1574
+ durationMs: $,
1575
1575
  error: {
1576
- type: typeof (M == null ? void 0 : M.type) == "string" && M.type ? M.type : `Http${O.status}`,
1576
+ type: typeof (N == null ? void 0 : N.type) == "string" && N.type ? N.type : `Http${M.status}`,
1577
1577
  message: Q
1578
1578
  }
1579
1579
  };
@@ -1583,7 +1583,7 @@ async function el(s, n, a = {}) {
1583
1583
  ok: !1,
1584
1584
  stdout: "",
1585
1585
  stderr: "",
1586
- durationMs: F,
1586
+ durationMs: $,
1587
1587
  error: { type: "BadResponse", message: "Python 服务返回内容为空" }
1588
1588
  };
1589
1589
  const q = x.ok === !0, G = Number(x.durationMs), me = Number(x.exitCode);
@@ -1592,39 +1592,39 @@ async function el(s, n, a = {}) {
1592
1592
  stdout: typeof x.stdout == "string" ? x.stdout : "",
1593
1593
  stderr: typeof x.stderr == "string" ? x.stderr : "",
1594
1594
  exitCode: Number.isFinite(me) ? Math.trunc(me) : void 0,
1595
- durationMs: Number.isFinite(G) && G >= 0 ? G : F,
1596
- error: q ? void 0 : hr(x.error, "服务端 Python 执行失败")
1595
+ durationMs: Number.isFinite(G) && G >= 0 ? G : $,
1596
+ error: q ? void 0 : br(x.error, "服务端 Python 执行失败")
1597
1597
  };
1598
1598
  } finally {
1599
- clearTimeout(b), (_ = a.signal) == null || _.removeEventListener("abort", E);
1599
+ clearTimeout(b), (R = a.signal) == null || R.removeEventListener("abort", E);
1600
1600
  }
1601
1601
  }
1602
1602
  function $s(s) {
1603
1603
  return s === "waiting" || s === "running" || s === "exited" ? s : "exited";
1604
1604
  }
1605
1605
  async function dn(s, n, a, o, i) {
1606
- var N;
1607
- const p = cn(s), b = performance.now(), E = new AbortController(), _ = setTimeout(() => E.abort(), o.timeoutMs ?? i), O = () => E.abort();
1608
- o.signal && (o.signal.aborted ? E.abort() : o.signal.addEventListener("abort", O));
1606
+ var T;
1607
+ const f = cn(s), b = performance.now(), E = new AbortController(), R = setTimeout(() => E.abort(), o.timeoutMs ?? i), M = () => E.abort();
1608
+ o.signal && (o.signal.aborted ? E.abort() : o.signal.addEventListener("abort", M));
1609
1609
  try {
1610
- const x = await fetch(p + n, {
1610
+ const x = await fetch(f + n, {
1611
1611
  ...a,
1612
1612
  headers: {
1613
1613
  "Content-Type": "application/json",
1614
1614
  ...o.headers ?? {}
1615
1615
  },
1616
1616
  signal: E.signal
1617
- }), F = await x.text();
1617
+ }), $ = await x.text();
1618
1618
  let q = null;
1619
- if (F)
1619
+ if ($)
1620
1620
  try {
1621
- q = JSON.parse(F);
1621
+ q = JSON.parse($);
1622
1622
  } catch {
1623
1623
  throw new Error(`Python 服务返回的不是合法 JSON(HTTP ${x.status})`);
1624
1624
  }
1625
1625
  const G = performance.now() - b;
1626
1626
  if (!x.ok || !q) {
1627
- const Q = q == null ? void 0 : q.error, Ue = typeof (Q == null ? void 0 : Q.message) == "string" && Q.message ? Q.message : `Python 服务返回 HTTP ${x.status}`;
1627
+ const Q = q == null ? void 0 : q.error, Ae = typeof (Q == null ? void 0 : Q.message) == "string" && Q.message ? Q.message : `Python 服务返回 HTTP ${x.status}`;
1628
1628
  return {
1629
1629
  sessionId: typeof (q == null ? void 0 : q.sessionId) == "string" ? q.sessionId : "",
1630
1630
  state: "exited",
@@ -1633,25 +1633,25 @@ async function dn(s, n, a, o, i) {
1633
1633
  durationMs: G,
1634
1634
  error: {
1635
1635
  type: typeof (Q == null ? void 0 : Q.type) == "string" && Q.type ? Q.type : `Http${x.status}`,
1636
- message: Ue
1636
+ message: Ae
1637
1637
  }
1638
1638
  };
1639
1639
  }
1640
- const me = Number(q.exitCode), M = Number(q.durationMs);
1640
+ const me = Number(q.exitCode), N = Number(q.durationMs);
1641
1641
  return {
1642
1642
  sessionId: typeof q.sessionId == "string" ? q.sessionId : "",
1643
1643
  state: $s(q.state),
1644
1644
  stdout: typeof q.stdout == "string" ? q.stdout : "",
1645
1645
  stderr: typeof q.stderr == "string" ? q.stderr : "",
1646
1646
  exitCode: Number.isFinite(me) ? Math.trunc(me) : void 0,
1647
- durationMs: Number.isFinite(M) ? M : G,
1648
- error: q.error ? hr(q.error, "服务端 Python 执行失败") : void 0
1647
+ durationMs: Number.isFinite(N) ? N : G,
1648
+ error: q.error ? br(q.error, "服务端 Python 执行失败") : void 0
1649
1649
  };
1650
1650
  } finally {
1651
- clearTimeout(_), (N = o.signal) == null || N.removeEventListener("abort", O);
1651
+ clearTimeout(R), (T = o.signal) == null || T.removeEventListener("abort", M);
1652
1652
  }
1653
1653
  }
1654
- function Fs(s, n, a = {}) {
1654
+ function Rs(s, n, a = {}) {
1655
1655
  return dn(
1656
1656
  s,
1657
1657
  "/sessions",
@@ -1676,7 +1676,7 @@ function _s(s, n, a = {}) {
1676
1676
  5e3
1677
1677
  );
1678
1678
  }
1679
- function Rs(s, n, a, o = {}) {
1679
+ function Is(s, n, a, o = {}) {
1680
1680
  return dn(
1681
1681
  s,
1682
1682
  `/sessions/${encodeURIComponent(n)}/input`,
@@ -1685,7 +1685,7 @@ function Rs(s, n, a, o = {}) {
1685
1685
  2e4
1686
1686
  );
1687
1687
  }
1688
- async function rr(s, n, a = {}) {
1688
+ async function ar(s, n, a = {}) {
1689
1689
  const o = cn(s);
1690
1690
  try {
1691
1691
  await fetch(`${o}/sessions/${encodeURIComponent(n)}/interrupt`, {
@@ -1704,47 +1704,47 @@ const dt = [
1704
1704
  { value: "oracle", label: "Oracle", defaultPort: 1521 },
1705
1705
  { value: "clickhouse", label: "ClickHouse", defaultPort: 8123 },
1706
1706
  { value: "other", label: "其他" }
1707
- ], tl = {
1707
+ ], sl = {
1708
1708
  mode: "sqlite",
1709
1709
  connection: { dialect: "sqlite", database: ":memory:" },
1710
1710
  maxRows: 200,
1711
1711
  timeoutMs: 3e4
1712
- }, br = 200, Lt = 3e4;
1713
- function Is(s) {
1712
+ }, kr = 200, Ft = 3e4;
1713
+ function Hs(s) {
1714
1714
  return dt.some((n) => n.value === s);
1715
1715
  }
1716
- function ar(s, n, a, o) {
1716
+ function sr(s, n, a, o) {
1717
1717
  const i = typeof s == "number" ? s : Number(s);
1718
1718
  return Number.isFinite(i) ? Math.min(Math.max(Math.trunc(i), a), o) : n;
1719
1719
  }
1720
- function Hs(s) {
1720
+ function Bs(s) {
1721
1721
  if (s == null || s === "") return;
1722
1722
  const n = Number(s);
1723
1723
  if (!(!Number.isFinite(n) || n <= 0))
1724
1724
  return Math.min(Math.trunc(n), 65535);
1725
1725
  }
1726
1726
  function D(s = {}) {
1727
- var p, b, E, _, O, N, x;
1728
- const n = s.mode === "http" ? "http" : "sqlite", a = (p = s.connection) == null ? void 0 : p.dialect, o = Is(a) ? a : n === "http" ? "mysql" : "sqlite", i = (b = s.connection) == null ? void 0 : b.database;
1727
+ var f, b, E, R, M, T, x;
1728
+ const n = s.mode === "http" ? "http" : "sqlite", a = (f = s.connection) == null ? void 0 : f.dialect, o = Hs(a) ? a : n === "http" ? "mysql" : "sqlite", i = (b = s.connection) == null ? void 0 : b.database;
1729
1729
  return {
1730
1730
  mode: n,
1731
1731
  connectionId: s.connectionId === void 0 || s.connectionId === null ? void 0 : s.connectionId.trim() || void 0,
1732
1732
  connection: {
1733
1733
  dialect: o,
1734
1734
  host: ((E = s.connection) == null ? void 0 : E.host) ?? "",
1735
- port: Hs((_ = s.connection) == null ? void 0 : _.port),
1736
- user: ((O = s.connection) == null ? void 0 : O.user) ?? "",
1737
- password: ((N = s.connection) == null ? void 0 : N.password) ?? "",
1735
+ port: Bs((R = s.connection) == null ? void 0 : R.port),
1736
+ user: ((M = s.connection) == null ? void 0 : M.user) ?? "",
1737
+ password: ((T = s.connection) == null ? void 0 : T.password) ?? "",
1738
1738
  database: i ?? (n === "sqlite" ? ":memory:" : ""),
1739
1739
  options: (x = s.connection) != null && x.options ? { ...s.connection.options } : void 0
1740
1740
  },
1741
1741
  endpoint: s.endpoint ?? "",
1742
1742
  headers: s.headers ? { ...s.headers } : void 0,
1743
- maxRows: ar(s.maxRows, br, 1, 1e5),
1744
- timeoutMs: ar(s.timeoutMs, Lt, 1e3, 6e5)
1743
+ maxRows: sr(s.maxRows, kr, 1, 1e5),
1744
+ timeoutMs: sr(s.timeoutMs, Ft, 1e3, 6e5)
1745
1745
  };
1746
1746
  }
1747
- function sr(s) {
1747
+ function or(s) {
1748
1748
  if (s == null) return null;
1749
1749
  const n = typeof s;
1750
1750
  if (n === "string" || n === "number" || n === "boolean")
@@ -1756,7 +1756,7 @@ function sr(s) {
1756
1756
  }
1757
1757
  }
1758
1758
  function on(s) {
1759
- const n = s ?? {}, a = Array.isArray(n.columns) ? n.columns.map((i) => String(i)) : [], o = Array.isArray(n.rows) ? n.rows.map((i) => Array.isArray(i) ? i.map(sr) : [sr(i)]) : [];
1759
+ const n = s ?? {}, a = Array.isArray(n.columns) ? n.columns.map((i) => String(i)) : [], o = Array.isArray(n.rows) ? n.rows.map((i) => Array.isArray(i) ? i.map(or) : [or(i)]) : [];
1760
1760
  return {
1761
1761
  columns: a,
1762
1762
  rows: o,
@@ -1775,10 +1775,10 @@ function pn(s, n) {
1775
1775
  }
1776
1776
  return { type: "SqlError", message: typeof s == "string" && s ? s : n };
1777
1777
  }
1778
- function Bs(s) {
1778
+ function Us(s) {
1779
1779
  return s instanceof DOMException && s.name === "AbortError" || s instanceof Error && s.name === "AbortError";
1780
1780
  }
1781
- function or(s, n) {
1781
+ function ir(s, n) {
1782
1782
  if (!s || typeof s != "object")
1783
1783
  return {
1784
1784
  ok: !1,
@@ -1786,22 +1786,22 @@ function or(s, n) {
1786
1786
  error: { type: "BadResponse", message: "SQL 服务返回内容为空或格式不正确" },
1787
1787
  durationMs: n
1788
1788
  };
1789
- const a = s, o = a.ok !== !1, i = Number(a.durationMs), p = Number.isFinite(i) && i >= 0 ? i : n;
1789
+ const a = s, o = a.ok !== !1, i = Number(a.durationMs), f = Number.isFinite(i) && i >= 0 ? i : n;
1790
1790
  if (!o)
1791
1791
  return {
1792
1792
  ok: !1,
1793
1793
  results: [],
1794
1794
  error: pn(a.error, "SQL 服务返回执行失败"),
1795
- durationMs: p
1795
+ durationMs: f
1796
1796
  };
1797
1797
  let b = [];
1798
1798
  return Array.isArray(a.results) ? b = a.results : (Array.isArray(a.columns) || Array.isArray(a.rows)) && (b = [a]), {
1799
1799
  ok: !0,
1800
1800
  results: b.map(on),
1801
- durationMs: p
1801
+ durationMs: f
1802
1802
  };
1803
1803
  }
1804
- async function Us(s, n, a, o) {
1804
+ async function As(s, n, a, o) {
1805
1805
  const i = (s.endpoint ?? "").trim();
1806
1806
  if (!i)
1807
1807
  return {
@@ -1813,14 +1813,14 @@ async function Us(s, n, a, o) {
1813
1813
  },
1814
1814
  durationMs: 0
1815
1815
  };
1816
- const p = performance.now(), b = new AbortController();
1816
+ const f = performance.now(), b = new AbortController();
1817
1817
  let E = !1;
1818
- const _ = setTimeout(() => {
1818
+ const R = setTimeout(() => {
1819
1819
  E = !0, b.abort();
1820
- }, s.timeoutMs ?? Lt), O = () => b.abort();
1821
- o && (o.aborted ? b.abort() : o.addEventListener("abort", O));
1820
+ }, s.timeoutMs ?? Ft), M = () => b.abort();
1821
+ o && (o.aborted ? b.abort() : o.addEventListener("abort", M));
1822
1822
  try {
1823
- const N = await fetch(i, {
1823
+ const T = await fetch(i, {
1824
1824
  method: "POST",
1825
1825
  headers: { "Content-Type": "application/json", ...s.headers ?? {} },
1826
1826
  body: JSON.stringify({
@@ -1830,52 +1830,52 @@ async function Us(s, n, a, o) {
1830
1830
  maxRows: a
1831
1831
  }),
1832
1832
  signal: b.signal
1833
- }), x = await N.text();
1834
- let F = null;
1833
+ }), x = await T.text();
1834
+ let $ = null;
1835
1835
  if (x)
1836
1836
  try {
1837
- F = JSON.parse(x);
1837
+ $ = JSON.parse(x);
1838
1838
  } catch {
1839
1839
  return {
1840
1840
  ok: !1,
1841
1841
  results: [],
1842
1842
  error: {
1843
1843
  type: "BadResponse",
1844
- message: `SQL 服务返回的不是合法 JSON(HTTP ${N.status})`
1844
+ message: `SQL 服务返回的不是合法 JSON(HTTP ${T.status})`
1845
1845
  },
1846
- durationMs: performance.now() - p
1846
+ durationMs: performance.now() - f
1847
1847
  };
1848
1848
  }
1849
- if (!N.ok) {
1850
- const q = F ? or(F, performance.now() - p) : null;
1849
+ if (!T.ok) {
1850
+ const q = $ ? ir($, performance.now() - f) : null;
1851
1851
  return {
1852
1852
  ok: !1,
1853
1853
  results: [],
1854
1854
  error: (q == null ? void 0 : q.error) ?? {
1855
- type: `Http${N.status}`,
1856
- message: `SQL 服务返回 HTTP ${N.status}${N.statusText ? ` ${N.statusText}` : ""}`
1855
+ type: `Http${T.status}`,
1856
+ message: `SQL 服务返回 HTTP ${T.status}${T.statusText ? ` ${T.statusText}` : ""}`
1857
1857
  },
1858
- durationMs: performance.now() - p
1858
+ durationMs: performance.now() - f
1859
1859
  };
1860
1860
  }
1861
- return or(F, performance.now() - p);
1862
- } catch (N) {
1861
+ return ir($, performance.now() - f);
1862
+ } catch (T) {
1863
1863
  if (E)
1864
1864
  return {
1865
1865
  ok: !1,
1866
1866
  results: [],
1867
1867
  error: {
1868
1868
  type: "Timeout",
1869
- message: `SQL 请求超时(${s.timeoutMs ?? Lt}ms)`
1869
+ message: `SQL 请求超时(${s.timeoutMs ?? Ft}ms)`
1870
1870
  },
1871
- durationMs: performance.now() - p
1871
+ durationMs: performance.now() - f
1872
1872
  };
1873
- throw N;
1873
+ throw T;
1874
1874
  } finally {
1875
- clearTimeout(_), o == null || o.removeEventListener("abort", O);
1875
+ clearTimeout(R), o == null || o.removeEventListener("abort", M);
1876
1876
  }
1877
1877
  }
1878
- function ir(s, n) {
1878
+ function lr(s, n) {
1879
1879
  if (!s || typeof s != "object")
1880
1880
  return {
1881
1881
  ok: !1,
@@ -1895,8 +1895,8 @@ function ir(s, n) {
1895
1895
  durationMs: a
1896
1896
  };
1897
1897
  }
1898
- async function kr(s, n, a = {}) {
1899
- const o = D(s), i = o.maxRows ?? br, p = performance.now();
1898
+ async function wr(s, n, a = {}) {
1899
+ const o = D(s), i = o.maxRows ?? kr, f = performance.now();
1900
1900
  if (!n.trim())
1901
1901
  return {
1902
1902
  ok: !1,
@@ -1910,37 +1910,37 @@ async function kr(s, n, a = {}) {
1910
1910
  { sql: n, connection: o.connection, maxRows: i },
1911
1911
  { signal: a.signal }
1912
1912
  );
1913
- return ir(E, performance.now() - p);
1913
+ return lr(E, performance.now() - f);
1914
1914
  }
1915
1915
  if (o.mode === "http")
1916
- return await Us(o, n, i, a.signal);
1916
+ return await As(o, n, i, a.signal);
1917
1917
  const b = await un().executeSql({
1918
1918
  sql: n,
1919
1919
  database: o.connection.database || ":memory:",
1920
1920
  maxRows: i
1921
1921
  });
1922
- return ir(b, performance.now() - p);
1922
+ return lr(b, performance.now() - f);
1923
1923
  } catch (b) {
1924
- return Bs(b) ? {
1924
+ return Us(b) ? {
1925
1925
  ok: !1,
1926
1926
  results: [],
1927
1927
  error: { type: "AbortError", message: "SQL 执行已中断" },
1928
- durationMs: performance.now() - p
1928
+ durationMs: performance.now() - f
1929
1929
  } : {
1930
1930
  ok: !1,
1931
1931
  results: [],
1932
1932
  error: pn(b, "SQL 执行失败"),
1933
- durationMs: performance.now() - p
1933
+ durationMs: performance.now() - f
1934
1934
  };
1935
1935
  }
1936
1936
  }
1937
- function lr(s) {
1937
+ function ur(s) {
1938
1938
  var n;
1939
1939
  return (n = dt.find((a) => a.value === s)) == null ? void 0 : n.defaultPort;
1940
1940
  }
1941
- async function As(s, n = {}) {
1941
+ async function Ds(s, n = {}) {
1942
1942
  var o;
1943
- const a = await kr(s, "SELECT 1", n);
1943
+ const a = await wr(s, "SELECT 1", n);
1944
1944
  return a.ok ? {
1945
1945
  ok: !0,
1946
1946
  message: `连接成功(${Math.max(1, Math.round(a.durationMs))}ms)`,
@@ -1952,14 +1952,14 @@ async function As(s, n = {}) {
1952
1952
  };
1953
1953
  }
1954
1954
  async function fn(s, n, a, o = {}) {
1955
- var O, N;
1956
- const i = D(s), p = (i.endpoint ?? "").trim().replace(/\/+$/, "");
1957
- if (!p)
1955
+ var M, T;
1956
+ const i = D(s), f = (i.endpoint ?? "").trim().replace(/\/+$/, "");
1957
+ if (!f)
1958
1958
  throw new Error("未配置 SQL 服务端点");
1959
- const b = new AbortController(), E = setTimeout(() => b.abort(), i.timeoutMs ?? Lt), _ = () => b.abort();
1960
- o.signal && (o.signal.aborted ? b.abort() : o.signal.addEventListener("abort", _));
1959
+ const b = new AbortController(), E = setTimeout(() => b.abort(), i.timeoutMs ?? Ft), R = () => b.abort();
1960
+ o.signal && (o.signal.aborted ? b.abort() : o.signal.addEventListener("abort", R));
1961
1961
  try {
1962
- const x = await fetch(p + n, {
1962
+ const x = await fetch(f + n, {
1963
1963
  ...a,
1964
1964
  headers: {
1965
1965
  "Content-Type": "application/json",
@@ -1967,25 +1967,25 @@ async function fn(s, n, a, o = {}) {
1967
1967
  ...a.headers ?? {}
1968
1968
  },
1969
1969
  signal: b.signal
1970
- }), F = await x.text();
1970
+ }), $ = await x.text();
1971
1971
  let q = null;
1972
- if (F)
1972
+ if ($)
1973
1973
  try {
1974
- q = JSON.parse(F);
1974
+ q = JSON.parse($);
1975
1975
  } catch {
1976
1976
  throw new Error(`SQL 服务返回的不是合法 JSON(HTTP ${x.status})`);
1977
1977
  }
1978
1978
  if (!x.ok || !q || q.ok === !1)
1979
- throw new Error(((O = q == null ? void 0 : q.error) == null ? void 0 : O.message) ?? `SQL 服务返回 HTTP ${x.status}`);
1979
+ throw new Error(((M = q == null ? void 0 : q.error) == null ? void 0 : M.message) ?? `SQL 服务返回 HTTP ${x.status}`);
1980
1980
  return q.data;
1981
1981
  } finally {
1982
- clearTimeout(E), (N = o.signal) == null || N.removeEventListener("abort", _);
1982
+ clearTimeout(E), (T = o.signal) == null || T.removeEventListener("abort", R);
1983
1983
  }
1984
1984
  }
1985
- function Ds(s, n = {}) {
1985
+ function zs(s, n = {}) {
1986
1986
  return fn(s, "/connections", { method: "GET" }, n);
1987
1987
  }
1988
- function zs(s, n, a, o = {}) {
1988
+ function js(s, n, a, o = {}) {
1989
1989
  return fn(
1990
1990
  s,
1991
1991
  a ? `/connections/${encodeURIComponent(a)}` : "/connections",
@@ -1993,7 +1993,7 @@ function zs(s, n, a, o = {}) {
1993
1993
  o
1994
1994
  );
1995
1995
  }
1996
- async function ur(s, n, a = {}) {
1996
+ async function cr(s, n, a = {}) {
1997
1997
  await fn(
1998
1998
  s,
1999
1999
  `/connections/${encodeURIComponent(n)}`,
@@ -2001,29 +2001,29 @@ async function ur(s, n, a = {}) {
2001
2001
  a
2002
2002
  );
2003
2003
  }
2004
- const $t = [
2004
+ const Lt = [
2005
2005
  { value: "python", label: "Python", extension: "py" },
2006
2006
  { value: "sql", label: "SQL", extension: "sql" },
2007
2007
  { value: "javascript", label: "JavaScript", extension: "js" },
2008
2008
  { value: "json", label: "JSON", extension: "json" }
2009
2009
  ];
2010
2010
  function Mt(s) {
2011
- return $t.find((n) => n.value === s) ?? $t[0];
2011
+ return Lt.find((n) => n.value === s) ?? Lt[0];
2012
2012
  }
2013
2013
  function en(s) {
2014
2014
  switch (s) {
2015
2015
  case "sql":
2016
- return os();
2016
+ return is();
2017
2017
  case "javascript":
2018
- return as();
2019
- case "json":
2020
2018
  return ss();
2019
+ case "json":
2020
+ return os();
2021
2021
  case "python":
2022
2022
  default:
2023
- return mr();
2023
+ return yr();
2024
2024
  }
2025
2025
  }
2026
- function cr(s) {
2026
+ function dr(s) {
2027
2027
  const n = s.lastIndexOf(".");
2028
2028
  if (n < 0) return "python";
2029
2029
  switch (s.slice(n + 1).toLowerCase()) {
@@ -2051,15 +2051,15 @@ const ln = [
2051
2051
  { value: "solarized-light", label: "Solarized 浅色", dark: !1 },
2052
2052
  { value: "monokai", label: "Monokai", dark: !0 }
2053
2053
  ];
2054
- function js(s) {
2054
+ function Vs(s) {
2055
2055
  return ln.find((n) => n.value === s) ?? ln[0];
2056
2056
  }
2057
2057
  function ut(s) {
2058
- return js(s).dark;
2058
+ return Vs(s).dark;
2059
2059
  }
2060
- function Z(s) {
2060
+ function J(s) {
2061
2061
  const n = Array.isArray(s) ? s : [s];
2062
- return () => Kn(
2062
+ return () => Jn(
2063
2063
  "svg",
2064
2064
  {
2065
2065
  viewBox: "0 0 24 24",
@@ -2068,111 +2068,119 @@ function Z(s) {
2068
2068
  fill: "currentColor",
2069
2069
  "aria-hidden": "true"
2070
2070
  },
2071
- n.map((a) => Kn("path", { d: a }))
2071
+ n.map((a) => Jn("path", { d: a }))
2072
2072
  );
2073
2073
  }
2074
- const Vs = Z(
2074
+ const Qs = J(
2075
2075
  "M8 5.14v13.72a1 1 0 0 0 1.54.84l10.3-6.86a1 1 0 0 0 0-1.68L9.54 4.3A1 1 0 0 0 8 5.14Z"
2076
- ), Qs = Z("M6 6h12v12H6Z"), dr = Z(
2076
+ ), Ks = J("M6 6h12v12H6Z"), pr = J(
2077
2077
  "M9 3h6a1 1 0 0 1 1 1v1h4a1 1 0 1 1 0 2h-1.06l-.87 12.13A2 2 0 0 1 16.08 21H7.92a2 2 0 0 1-1.99-1.87L5.06 7H4a1 1 0 0 1 0-2h4V4a1 1 0 0 1 1-1Zm1 2h4V5h-4v0Zm-2.92 2h9.84l-.85 12.07a.5.5 0 0 1-.5.43H7.93a.5.5 0 0 1-.5-.43Z"
2078
- ), Ks = Z(
2078
+ ), Js = J(
2079
2079
  "M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 14h-3v3h-2v-3H8v-2h3v-3h2v3h3v2zm-3-7V3.5L18.5 9H13z"
2080
- ), Js = Z(
2080
+ ), Zs = J(
2081
2081
  "M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"
2082
- ), pr = Z(
2082
+ ), fr = J(
2083
2083
  "M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z"
2084
- ), fr = Z("M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"), Zs = Z(
2084
+ ), vr = J("M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"), Gs = J(
2085
2085
  "M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"
2086
- ), Gs = Z("M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"), ct = Z(
2086
+ ), Ws = J("M2 3v7l15 2-15 2v7l20-9L2 3z"), Ys = J("M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"), ct = J(
2087
2087
  "M18.3 5.71a1 1 0 0 0-1.41 0L12 10.59 7.11 5.7A1 1 0 0 0 5.7 7.11L10.59 12 5.7 16.89a1 1 0 1 0 1.41 1.41L12 13.41l4.89 4.89a1 1 0 0 0 1.41-1.41L13.41 12l4.89-4.89a1 1 0 0 0 0-1.4Z"
2088
- ), Ws = Z("M11 5h2v6h6v2h-6v6h-2v-6H5v-2h6V5z"), Ys = Z([
2088
+ ), Xs = J("M11 5h2v6h6v2h-6v6h-2v-6H5v-2h6V5z"), eo = J([
2089
2089
  "M12 2C7.58 2 4 3.34 4 5v14c0 1.66 3.58 3 8 3s8-1.34 8-3V5c0-1.66-3.58-3-8-3Zm6 17c0 .35-2.03 1.4-6 1.4S6 19.35 6 19v-2.68c1.45.74 3.6 1.18 6 1.18s4.55-.44 6-1.18V19Zm0-5c0 .35-2.03 1.4-6 1.4S6 14.35 6 14v-2.68c1.45.74 3.6 1.18 6 1.18s4.55-.44 6-1.18V14Zm-6-3.6c-3.87 0-6-1.02-6-1.4V6.32C7.45 7.06 9.6 7.5 12 7.5s4.55-.44 6-1.18V9c0 .38-2.13 1.4-6 1.4Z"
2090
- ]), Xs = Z(
2090
+ ]), to = J(
2091
2091
  "M17 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V7l-4-4zm-5 16a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm3-10H5V5h10v4z"
2092
- ), eo = Z([
2092
+ ), no = J([
2093
2093
  "M4 4h16a1 1 0 0 1 1 1v5H3V5a1 1 0 0 1 1-1Zm-1 8h18v5H3v-5Z",
2094
2094
  "M18 15.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"
2095
- ]), to = {
2095
+ ]), ro = {
2096
2096
  key: 0,
2097
2097
  class: "vpe-toolbar"
2098
- }, no = { class: "vpe-toolbar-main" }, ro = ["title", "disabled"], ao = ["disabled"], so = ["disabled"], oo = ["title", "disabled"], io = ["title", "aria-label"], lo = { key: 2 }, uo = { key: 3 }, co = ["disabled"], po = {
2098
+ }, ao = { class: "vpe-toolbar-main" }, so = ["title", "disabled"], oo = ["disabled"], io = ["disabled"], lo = ["title", "disabled"], uo = ["title", "aria-label"], co = { key: 2 }, po = { key: 3 }, fo = ["disabled"], vo = {
2099
2099
  class: "vpe-file",
2100
2100
  title: "当前文件名(下载时使用)"
2101
- }, fo = ["value"], vo = ["value"], mo = { class: "vpe-toolbar-end" }, go = ["disabled"], yo = {
2101
+ }, mo = ["value"], yo = ["value"], ho = { class: "vpe-toolbar-end" }, go = {
2102
+ key: 0,
2103
+ class: "vpe-sql-connection-group",
2104
+ role: "group",
2105
+ "aria-label": "SQL 连接"
2106
+ }, bo = ["disabled"], ko = {
2102
2107
  value: "",
2103
2108
  disabled: ""
2104
- }, ho = ["value"], bo = { class: "vpe-toolbar-chips" }, ko = ["title"], wo = { class: "vpe-status-text" }, So = ["value", "disabled"], xo = ["value"], Eo = ["aria-selected", "data-file-id", "title", "onClick", "onKeydown"], qo = { class: "vpe-tab-name" }, Co = ["title", "aria-label", "disabled", "onClick"], Po = ["disabled"], Oo = { class: "vpe-output-head" }, Mo = { class: "vpe-output-main" }, To = {
2109
+ }, wo = ["value"], So = { class: "vpe-toolbar-chips" }, xo = ["title"], Eo = { class: "vpe-status-text" }, qo = ["value", "disabled"], Co = ["value"], Po = ["aria-selected", "data-file-id", "title", "onClick", "onKeydown"], Oo = { class: "vpe-tab-name" }, Mo = ["title", "aria-label", "disabled", "onClick"], No = ["disabled"], To = { class: "vpe-output-head" }, Fo = { class: "vpe-output-main" }, Lo = {
2105
2110
  key: 0,
2106
2111
  class: "vpe-sql-results"
2107
- }, No = { class: "vpe-sql-result-head" }, Lo = {
2112
+ }, $o = { class: "vpe-sql-result-head" }, Ro = {
2108
2113
  key: 0,
2109
2114
  class: "vpe-sql-table-wrap"
2110
- }, $o = { class: "vpe-sql-table" }, Fo = {
2115
+ }, _o = { class: "vpe-sql-table" }, Io = {
2111
2116
  key: 0,
2112
2117
  class: "vpe-sql-empty"
2113
- }, _o = {
2118
+ }, Ho = {
2114
2119
  key: 1,
2115
2120
  class: "vpe-sql-affected"
2116
- }, Ro = {
2121
+ }, Bo = {
2117
2122
  key: 1,
2118
2123
  class: "vpe-empty"
2119
- }, Io = {
2124
+ }, Uo = {
2120
2125
  key: 0,
2121
2126
  class: "vpe-terminal-input"
2122
- }, Ho = ["onKeydown"], Bo = {
2127
+ }, Ao = ["onKeydown"], Do = {
2123
2128
  key: 4,
2129
+ class: "vpe-footer"
2130
+ }, zo = {
2131
+ key: 5,
2124
2132
  class: "vpe-fs-panel",
2125
2133
  role: "dialog",
2126
2134
  "aria-label": "虚拟文件"
2127
- }, Uo = { class: "vpe-fs-head" }, Ao = ["disabled"], Do = { class: "vpe-fs-body" }, zo = {
2135
+ }, jo = { class: "vpe-fs-head" }, Vo = ["disabled"], Qo = { class: "vpe-fs-body" }, Ko = {
2128
2136
  key: 0,
2129
2137
  class: "vpe-fs-empty"
2130
- }, jo = {
2138
+ }, Jo = {
2131
2139
  key: 0,
2132
2140
  class: "vpe-fs-empty"
2133
- }, Vo = ["title"], Qo = { class: "vpe-fs-size" }, Ko = ["title", "aria-label", "onClick"], Jo = {
2134
- key: 5,
2141
+ }, Zo = ["title"], Go = { class: "vpe-fs-size" }, Wo = ["title", "aria-label", "onClick"], Yo = {
2142
+ key: 6,
2135
2143
  class: "vpe-fs-panel",
2136
2144
  role: "dialog",
2137
2145
  "aria-label": "服务端文件"
2138
- }, Zo = { class: "vpe-fs-head" }, Go = ["disabled"], Wo = { class: "vpe-fs-body" }, Yo = {
2146
+ }, Xo = { class: "vpe-fs-head" }, ei = ["disabled"], ti = { class: "vpe-fs-body" }, ni = {
2139
2147
  key: 0,
2140
2148
  class: "vpe-fs-empty"
2141
- }, Xo = {
2149
+ }, ri = {
2142
2150
  key: 0,
2143
2151
  class: "vpe-fs-empty"
2144
- }, ei = ["title"], ti = ["title"], ni = ["title", "disabled", "onClick"], ri = ["title", "disabled", "onClick"], ai = {
2152
+ }, ai = ["title"], si = ["title"], oi = ["title", "disabled", "onClick"], ii = ["title", "disabled", "onClick"], li = {
2145
2153
  key: 1,
2146
2154
  class: "vpe-sql-hint vpe-sql-hint--error"
2147
- }, si = {
2148
- key: 6,
2155
+ }, ui = {
2156
+ key: 7,
2149
2157
  class: "vpe-sql-panel",
2150
2158
  role: "dialog",
2151
2159
  "aria-label": "SQL 连接配置"
2152
- }, oi = { class: "vpe-fs-head" }, ii = { class: "vpe-fs-title" }, li = { class: "vpe-sql-body" }, ui = { class: "vpe-sql-field" }, ci = { class: "vpe-sql-field" }, di = { class: "vpe-sql-field" }, pi = { class: "vpe-sql-field" }, fi = ["value"], vi = { class: "vpe-sql-row" }, mi = { class: "vpe-sql-field vpe-sql-field--grow" }, gi = { class: "vpe-sql-field vpe-sql-field--grow" }, yi = { class: "vpe-sql-row" }, hi = { class: "vpe-sql-field vpe-sql-field--grow" }, bi = { class: "vpe-sql-field vpe-sql-field--grow" }, ki = ["placeholder"], wi = { class: "vpe-sql-field" }, Si = {
2160
+ }, ci = { class: "vpe-fs-head" }, di = { class: "vpe-fs-title" }, pi = { class: "vpe-sql-body" }, fi = { class: "vpe-sql-field" }, vi = { class: "vpe-sql-field" }, mi = { class: "vpe-sql-field" }, yi = { class: "vpe-sql-field" }, hi = ["value"], gi = { class: "vpe-sql-row" }, bi = { class: "vpe-sql-field vpe-sql-field--grow" }, ki = { class: "vpe-sql-field vpe-sql-field--grow" }, wi = { class: "vpe-sql-row" }, Si = { class: "vpe-sql-field vpe-sql-field--grow" }, xi = { class: "vpe-sql-field vpe-sql-field--grow" }, Ei = ["placeholder"], qi = { class: "vpe-sql-field" }, Ci = {
2153
2161
  key: 0,
2154
2162
  class: "vpe-sql-field"
2155
- }, xi = {
2163
+ }, Pi = {
2156
2164
  key: 1,
2157
2165
  class: "vpe-sql-hint"
2158
- }, Ei = { class: "vpe-sql-actions" }, qi = ["disabled"], Ci = ["disabled"], Pi = ["disabled"], Oi = {
2166
+ }, Oi = { class: "vpe-sql-actions" }, Mi = ["disabled"], Ni = ["disabled"], Ti = ["disabled"], Fi = {
2159
2167
  key: 3,
2160
2168
  class: "vpe-sql-test vpe-sql-test--err"
2161
- }, Mi = {
2162
- key: 7,
2169
+ }, Li = {
2170
+ key: 8,
2163
2171
  class: "vpe-sql-manager-panel",
2164
2172
  role: "dialog",
2165
2173
  "aria-label": "连接管理"
2166
- }, Ti = { class: "vpe-fs-head" }, Ni = ["disabled"], Li = { class: "vpe-sql-manager-body" }, $i = {
2174
+ }, $i = { class: "vpe-fs-head" }, Ri = ["disabled"], _i = { class: "vpe-sql-manager-body" }, Ii = {
2167
2175
  key: 0,
2168
2176
  class: "vpe-fs-empty"
2169
- }, Fi = {
2177
+ }, Hi = {
2170
2178
  key: 0,
2171
2179
  class: "vpe-fs-empty"
2172
- }, _i = { class: "vpe-sql-manager-main" }, Ri = ["title"], Ii = { class: "vpe-sql-manager-meta" }, Hi = ["onClick"], Bi = ["disabled", "onClick"], Ui = {
2180
+ }, Bi = { class: "vpe-sql-manager-main" }, Ui = ["title"], Ai = { class: "vpe-sql-manager-meta" }, Di = ["onClick"], zi = ["disabled", "onClick"], ji = {
2173
2181
  key: 1,
2174
2182
  class: "vpe-sql-hint vpe-sql-hint--error"
2175
- }, tn = 1, vr = 80, Ai = /* @__PURE__ */ $a({
2183
+ }, tn = 1, mr = 80, Vi = /* @__PURE__ */ $a({
2176
2184
  __name: "PythonEditor",
2177
2185
  props: {
2178
2186
  modelValue: { default: "" },
@@ -2183,6 +2191,11 @@ const Vs = Z(
2183
2191
  readOnly: { type: Boolean, default: !1 },
2184
2192
  autofocus: { type: Boolean, default: !1 },
2185
2193
  showToolbar: { type: Boolean, default: !0 },
2194
+ showSubmit: { type: Boolean, default: !1 },
2195
+ showNewFile: { type: Boolean, default: !0 },
2196
+ showOpenFile: { type: Boolean, default: !0 },
2197
+ showDownload: { type: Boolean, default: !0 },
2198
+ showVirtualFiles: { type: Boolean, default: !0 },
2186
2199
  showTabs: { type: Boolean, default: !0 },
2187
2200
  showOutput: { type: Boolean, default: !0 },
2188
2201
  clearOutputOnRun: { type: Boolean, default: !0 },
@@ -2206,15 +2219,15 @@ const Vs = Z(
2206
2219
  pythonHeaders: { default: void 0 },
2207
2220
  runtime: { default: "browser" }
2208
2221
  },
2209
- emits: ["update:modelValue", "ready", "statusChange", "runStart", "runOutput", "runError", "runFinish", "loadError", "update:fileName", "update:language", "update:theme", "newFile", "fileClose", "fileSwitch", "copy", "download", "fileOpen", "fsDownload", "update:sqlConfig", "update:runtime", "sqlResult", "sqlError"],
2222
+ emits: ["update:modelValue", "ready", "statusChange", "runStart", "runOutput", "runError", "runFinish", "loadError", "update:fileName", "update:language", "update:theme", "newFile", "fileClose", "fileSwitch", "copy", "submit", "download", "fileOpen", "fsDownload", "update:sqlConfig", "update:runtime", "sqlResult", "sqlError"],
2210
2223
  setup(s, { expose: n, emit: a }) {
2211
- const o = s, i = a, p = C(), b = C(), E = C(), _ = C(), O = C(), N = C(), x = C(null), F = C(!1), q = Jn(/* @__PURE__ */ new Map()), G = U(() => fe().lines), me = U(() => fe().sqlResults), M = Jn(/* @__PURE__ */ new Map()), Q = U(() => M.get(w.value.id) ?? null), Ue = U(() => {
2224
+ const o = s, i = a, f = C(), b = C(), E = C(), R = C(), M = C(), T = C(), x = C(null), $ = C(!1), q = Zn(/* @__PURE__ */ new Map()), G = U(() => fe().lines), me = U(() => fe().sqlResults), N = Zn(/* @__PURE__ */ new Map()), Q = U(() => N.get(w.value.id) ?? null), Ae = U(() => {
2212
2225
  var e;
2213
2226
  return !!((e = Q.value) != null && e.busy);
2214
- }), Ae = U(() => {
2227
+ }), De = U(() => {
2215
2228
  var e;
2216
2229
  return !!((e = Q.value) != null && e.waiting);
2217
- }), H = U({
2230
+ }), B = U({
2218
2231
  get: () => {
2219
2232
  var e;
2220
2233
  return ((e = Q.value) == null ? void 0 : e.input) ?? "";
@@ -2223,51 +2236,51 @@ const Vs = Z(
2223
2236
  const t = Q.value;
2224
2237
  t && (t.input = e);
2225
2238
  }
2226
- }), k = C(null), I = C("idle"), z = C(o.theme), ce = C(o.runtime), Se = C(!1), De = C(!1), Xe = C(!1), et = C([]), xe = C(!1), ft = C(!1), tt = C([]), ze = C(""), W = C(!1), Fe = C(!1), Ee = C(!1), _e = C(!1), nt = C(""), vt = C(!1), f = C(D(o.sqlConfig)), Ce = C([]), je = C(!1), Pe = C(""), ne = C(""), re = C(!1), ae = C(""), Ve = C(!1), Re = C(!1), Qe = C(""), mt = C(!1);
2227
- let _t = !1, gt, vn = !1, Rt = !1, mn = !1, P = null, wr = 0, Sr = 0, yt = null, ht = null, It, de = null, Y = null, se = null, oe = null, xr = 0, rt = 0;
2228
- function Ke(e, t, r) {
2229
- return { id: ++Sr, name: e, language: t, code: r };
2239
+ }), k = C(null), I = C("idle"), j = C(o.theme), ce = C(o.runtime), Se = C(!1), ze = C(!1), Xe = C(!1), et = C([]), xe = C(!1), ft = C(!1), tt = C([]), je = C(""), W = C(!1), $e = C(!1), Ee = C(!1), Re = C(!1), nt = C(""), vt = C(!1), v = C(D(o.sqlConfig)), Pe = C([]), Ve = C(!1), Oe = C(""), ne = C(""), re = C(!1), ae = C(""), Qe = C(!1), _e = C(!1), Ke = C(""), mt = C(!1);
2240
+ let Rt = !1, yt, vn = !1, _t = !1, mn = !1, P = null, Sr = 0, xr = 0, ht = null, gt = null, It, de = null, Y = null, se = null, oe = null, Er = 0, rt = 0;
2241
+ function Je(e, t, r) {
2242
+ return { id: ++xr, name: e, language: t, code: r };
2230
2243
  }
2231
- const L = C([Ke(o.fileName, o.language, o.modelValue)]), qe = C(L.value[0].id), w = U(
2232
- () => L.value.find((e) => e.id === qe.value) ?? L.value[0]
2244
+ const F = C([Je(o.fileName, o.language, o.modelValue)]), qe = C(F.value[0].id), w = U(
2245
+ () => F.value.find((e) => e.id === qe.value) ?? F.value[0]
2233
2246
  ), Ie = U({
2234
2247
  get: () => w.value.name,
2235
2248
  set: (e) => {
2236
2249
  const t = w.value;
2237
2250
  t.name !== e && (t.name = e, i("update:fileName", e));
2238
2251
  }
2239
- }), gn = new qt(), Ht = new qt(), Bt = new qt(), Ut = new qt(), j = un(o.pyodideUrl ? { pyodideUrl: o.pyodideUrl } : void 0), Er = U(() => ({
2252
+ }), yn = new qt(), Ht = new qt(), Bt = new qt(), Ut = new qt(), V = un(o.pyodideUrl ? { pyodideUrl: o.pyodideUrl } : void 0), qr = U(() => ({
2240
2253
  height: typeof o.height == "number" ? `${o.height}px` : o.height
2241
- })), qr = U(() => [
2242
- `vpe-theme-${z.value}`,
2243
- ut(z.value) ? "vpe-dark" : ""
2254
+ })), Cr = U(() => [
2255
+ `vpe-theme-${j.value}`,
2256
+ ut(j.value) ? "vpe-dark" : ""
2244
2257
  ]);
2245
- let yn = 0, At = 0, Je = null;
2246
- const Cr = U(
2258
+ let hn = 0, At = 0, Ze = null;
2259
+ const Pr = U(
2247
2260
  () => x.value !== null ? `${x.value}px` : typeof o.outputHeight == "number" ? `${o.outputHeight}px` : o.outputHeight
2248
- ), pe = U(() => w.value.language === "sql"), hn = U(() => w.value.language === "python"), bt = U(() => !!(o.pythonEndpoint ?? "").trim()), Ze = U(
2249
- () => hn.value && bt.value && ce.value === "server"
2250
- ), Oe = U(() => !!(o.filesEndpoint ?? "").trim()), Dt = U(() => Ue.value || Ee.value && k.value === w.value.id ? !0 : I.value === "running" && k.value === w.value.id), bn = U(() => pe.value && f.value.mode === "http" ? Ee.value && k.value === w.value.id ? "查询中" : "外部服务" : Ze.value ? Ue.value ? Ae.value ? "等待输入" : "执行中" : "服务端" : I.value === "running" && k.value !== w.value.id ? "就绪" : {
2261
+ ), pe = U(() => w.value.language === "sql"), gn = U(() => w.value.language === "python"), bt = U(() => !!(o.pythonEndpoint ?? "").trim()), Ge = U(
2262
+ () => gn.value && bt.value && ce.value === "server"
2263
+ ), Me = U(() => !!(o.filesEndpoint ?? "").trim()), Dt = U(() => Ae.value || Ee.value && k.value === w.value.id ? !0 : I.value === "running" && k.value === w.value.id), bn = U(() => pe.value && v.value.mode === "http" ? Ee.value && k.value === w.value.id ? "查询中" : "外部服务" : Ge.value ? Ae.value ? De.value ? "等待输入" : "执行中" : "服务端" : I.value === "running" && k.value !== w.value.id ? "就绪" : {
2251
2264
  idle: "未加载",
2252
2265
  loading: "正在加载 Pyodide…",
2253
2266
  ready: "就绪",
2254
2267
  running: "运行中"
2255
- }[I.value]), Pr = U(() => pe.value && f.value.mode === "http" ? Ee.value && k.value === w.value.id ? "running" : "ready" : Ze.value ? Ue.value ? Ae.value ? "loading" : "running" : "ready" : I.value === "running" && k.value !== w.value.id ? "ready" : I.value), Or = U(() => pe.value ? "执行 SQL (Ctrl+Enter)" : Ze.value ? "运行(服务端 Python,Ctrl+Enter)" : w.value.language === "python" ? "运行 (Ctrl+Enter)" : "仅支持执行 Python / SQL 文件"), Mr = U(() => Dt.value ? !0 : Ze.value || pe.value ? !1 : I.value === "loading" || w.value.language !== "python"), Tr = U(() => f.value.mode === "http" ? f.value.connectionId ? "SQL 连接配置" : "新建 SQL 连接" : "SQL 连接");
2256
- function Ge(e) {
2268
+ }[I.value]), Or = U(() => pe.value && v.value.mode === "http" ? Ee.value && k.value === w.value.id ? "running" : "ready" : Ge.value ? Ae.value ? De.value ? "loading" : "running" : "ready" : I.value === "running" && k.value !== w.value.id ? "ready" : I.value), Mr = U(() => pe.value ? "执行 SQL (Ctrl+Enter)" : Ge.value ? "运行(服务端 Python,Ctrl+Enter)" : w.value.language === "python" ? "运行 (Ctrl+Enter)" : "仅支持执行 Python / SQL 文件"), Nr = U(() => Dt.value ? !0 : Ge.value || pe.value ? !1 : I.value === "loading" || w.value.language !== "python"), Tr = U(() => v.value.mode === "http" ? v.value.connectionId ? "SQL 连接配置" : "新建 SQL 连接" : "SQL 连接");
2269
+ function He(e) {
2257
2270
  return { ...e };
2258
2271
  }
2259
2272
  function fe(e = w.value.id) {
2260
2273
  let t = q.get(e);
2261
2274
  return t || (t = { lines: [], sqlResults: [] }, q.set(e, t)), t;
2262
2275
  }
2263
- function ge(e, t, r) {
2264
- fe(r).lines.push({ id: ++wr, stream: e, text: t });
2276
+ function ye(e, t, r) {
2277
+ fe(r).lines.push({ id: ++Sr, stream: e, text: t });
2265
2278
  }
2266
- function h(e, t) {
2267
- ge("system", e, t);
2279
+ function g(e, t) {
2280
+ ye("system", e, t);
2268
2281
  }
2269
- function Nr(e) {
2270
- return $t.some((t) => t.value === e);
2282
+ function Fr(e) {
2283
+ return Lt.some((t) => t.value === e);
2271
2284
  }
2272
2285
  function Lr() {
2273
2286
  if (!o.storageKey || typeof window > "u") return null;
@@ -2277,10 +2290,10 @@ const Vs = Z(
2277
2290
  const t = JSON.parse(e);
2278
2291
  if (t.version !== tn || !Array.isArray(t.files)) return null;
2279
2292
  const r = [];
2280
- for (const y of t.files) {
2281
- if (!y || typeof y.name != "string" || typeof y.code != "string" || !y.name.trim()) continue;
2282
- const S = Nr(y.language) ? y.language : "python";
2283
- r.push({ name: y.name, language: S, code: y.code });
2293
+ for (const h of t.files) {
2294
+ if (!h || typeof h.name != "string" || typeof h.code != "string" || !h.name.trim()) continue;
2295
+ const S = Fr(h.language) ? h.language : "python";
2296
+ r.push({ name: h.name, language: S, code: h.code });
2284
2297
  }
2285
2298
  if (!r.length) return null;
2286
2299
  const u = typeof t.activeIndex == "number" ? t.activeIndex : 0, c = Math.min(Math.max(Math.trunc(u) || 0, 0), r.length - 1);
@@ -2292,49 +2305,49 @@ const Vs = Z(
2292
2305
  function $r() {
2293
2306
  const e = Lr();
2294
2307
  if (!e) return;
2295
- L.value = e.files.map((r) => Ke(r.name, r.language, r.code));
2296
- const t = L.value[e.activeIndex] ?? L.value[0];
2297
- qe.value = t.id, h(`已恢复上次编辑内容(${L.value.length} 个文件)`), i("update:modelValue", t.code), i("update:fileName", t.name), i("update:language", t.language);
2308
+ F.value = e.files.map((r) => Je(r.name, r.language, r.code));
2309
+ const t = F.value[e.activeIndex] ?? F.value[0];
2310
+ qe.value = t.id, g(`已恢复上次编辑内容(${F.value.length} 个文件)`), i("update:modelValue", t.code), i("update:fileName", t.name), i("update:language", t.language);
2298
2311
  }
2299
2312
  function kn() {
2300
- if (!(!_t || Rt || !o.storageKey || typeof window > "u"))
2313
+ if (!(!Rt || _t || !o.storageKey || typeof window > "u"))
2301
2314
  try {
2302
2315
  const e = {
2303
2316
  version: tn,
2304
- files: L.value.map((t) => ({
2317
+ files: F.value.map((t) => ({
2305
2318
  name: t.name,
2306
2319
  language: t.language,
2307
2320
  code: t.code
2308
2321
  })),
2309
2322
  activeIndex: Math.max(
2310
- L.value.findIndex((t) => t.id === qe.value),
2323
+ F.value.findIndex((t) => t.id === qe.value),
2311
2324
  0
2312
2325
  )
2313
2326
  };
2314
2327
  window.localStorage.setItem(o.storageKey, JSON.stringify(e));
2315
2328
  } catch (e) {
2316
- vn || (vn = !0, h(`本地草稿保存失败:${e instanceof Error ? e.message : String(e)}`));
2329
+ vn || (vn = !0, g(`本地草稿保存失败:${e instanceof Error ? e.message : String(e)}`));
2317
2330
  }
2318
2331
  }
2319
- function Fr() {
2320
- !_t || !o.storageKey || typeof window > "u" || (Rt = !1, window.clearTimeout(gt), gt = window.setTimeout(kn, 400));
2332
+ function Rr() {
2333
+ !Rt || !o.storageKey || typeof window > "u" || (_t = !1, window.clearTimeout(yt), yt = window.setTimeout(kn, 400));
2321
2334
  }
2322
2335
  function _r() {
2323
2336
  if (!(!o.storageKey || typeof window > "u")) {
2324
- window.clearTimeout(gt);
2337
+ window.clearTimeout(yt);
2325
2338
  try {
2326
- window.localStorage.removeItem(o.storageKey), Rt = !0, h("已清除本地草稿");
2339
+ window.localStorage.removeItem(o.storageKey), _t = !0, g("已清除本地草稿");
2327
2340
  } catch (e) {
2328
- h(`清除本地草稿失败:${e instanceof Error ? e.message : String(e)}`);
2341
+ g(`清除本地草稿失败:${e instanceof Error ? e.message : String(e)}`);
2329
2342
  }
2330
2343
  }
2331
2344
  }
2332
- function Me(e) {
2345
+ function Ne(e) {
2333
2346
  if (!P) return;
2334
2347
  const t = e ? [e] : [];
2335
- P.dispatch({ effects: gr.of(t) });
2348
+ P.dispatch({ effects: hr.of(t) });
2336
2349
  }
2337
- function Rr() {
2350
+ function Ir() {
2338
2351
  const e = o.modelValue;
2339
2352
  if (P) {
2340
2353
  e !== P.state.doc.toString() && P.dispatch({ changes: { from: 0, to: P.state.doc.length, insert: e } });
@@ -2343,7 +2356,7 @@ const Vs = Z(
2343
2356
  const t = w.value;
2344
2357
  t.code !== e && (t.code = e);
2345
2358
  }
2346
- function Te() {
2359
+ function Ce() {
2347
2360
  return P ? P.state.doc.toString() : w.value.code;
2348
2361
  }
2349
2362
  function kt(e) {
@@ -2355,19 +2368,19 @@ const Vs = Z(
2355
2368
  t.code = e, e !== o.modelValue && i("update:modelValue", e);
2356
2369
  }
2357
2370
  function zt(e) {
2358
- return o.disableLint || e !== "python" ? [] : ws(j, o.lintDelay);
2371
+ return o.disableLint || e !== "python" ? [] : Ss(V, o.lintDelay);
2359
2372
  }
2360
2373
  function jt(e) {
2361
2374
  const t = w.value;
2362
2375
  if (t.language !== e) {
2363
- if (t.language = e, fe(t.id).sqlResults = [], Me(void 0), P == null || P.dispatch({
2376
+ if (t.language = e, fe(t.id).sqlResults = [], Ne(void 0), P == null || P.dispatch({
2364
2377
  effects: [
2365
2378
  Bt.reconfigure(en(e)),
2366
2379
  Ut.reconfigure(zt(e))
2367
2380
  ]
2368
2381
  }), /^untitled(-\d+)?\.[^.]+$/.test(t.name)) {
2369
2382
  const u = `${t.name.slice(0, t.name.lastIndexOf("."))}.${Mt(e).extension}`;
2370
- L.value.some((c) => c.id !== t.id && c.name === u) || (t.name = u, i("update:fileName", u));
2383
+ F.value.some((c) => c.id !== t.id && c.name === u) || (t.name = u, i("update:fileName", u));
2371
2384
  }
2372
2385
  i("update:language", e);
2373
2386
  }
@@ -2377,102 +2390,102 @@ const Vs = Z(
2377
2390
  return /\.[^.\\/]+$/.test(u) ? u : `${u}.${Mt(t).extension}`;
2378
2391
  }
2379
2392
  function wn(e) {
2380
- const t = Mt(e).extension, r = new Set(L.value.map((y) => y.name));
2393
+ const t = Mt(e).extension, r = new Set(F.value.map((h) => h.name));
2381
2394
  let u = `untitled.${t}`, c = 2;
2382
2395
  for (; r.has(u); )
2383
2396
  u = `untitled-${c}.${t}`, c += 1;
2384
2397
  return u;
2385
2398
  }
2386
2399
  function Sn(e) {
2387
- if (!L.value.some((S) => S.name === e)) return e;
2400
+ if (!F.value.some((S) => S.name === e)) return e;
2388
2401
  const t = e.lastIndexOf("."), r = t > 0 ? e.slice(0, t) : e, u = t > 0 ? e.slice(t) : "";
2389
- let c = 2, y = `${r}-${c}${u}`;
2390
- for (; L.value.some((S) => S.name === y); )
2391
- c += 1, y = `${r}-${c}${u}`;
2392
- return y;
2402
+ let c = 2, h = `${r}-${c}${u}`;
2403
+ for (; F.value.some((S) => S.name === h); )
2404
+ c += 1, h = `${r}-${c}${u}`;
2405
+ return h;
2393
2406
  }
2394
2407
  let We = 0;
2395
- function Ir(e) {
2408
+ function Hr(e) {
2396
2409
  return !!e && e !== "." && e !== ".." && !e.includes("/") && !e.includes("\\");
2397
2410
  }
2398
- async function Hr() {
2411
+ async function Br() {
2399
2412
  var t;
2400
2413
  if (!o.syncFilesOnRun) return;
2401
- const e = L.value.filter((r) => r.language === "python");
2414
+ const e = F.value.filter((r) => r.language === "python");
2402
2415
  for (const r of e) {
2403
- if (!Ir(r.name)) {
2404
- h(`跳过同步文件:${r.name}(文件名不能包含路径分隔符)`);
2416
+ if (!Hr(r.name)) {
2417
+ g(`跳过同步文件:${r.name}(文件名不能包含路径分隔符)`);
2405
2418
  continue;
2406
2419
  }
2407
- const u = await j.writeFile(r.name, r.code);
2408
- u.ok || h(`同步文件失败:${r.name}(${((t = u.error) == null ? void 0 : t.message) ?? "未知错误"})`);
2420
+ const u = await V.writeFile(r.name, r.code);
2421
+ u.ok || g(`同步文件失败:${r.name}(${((t = u.error) == null ? void 0 : t.message) ?? "未知错误"})`);
2409
2422
  }
2410
2423
  }
2411
2424
  function at() {
2412
- Y == null || Y.abort(), Y = null, _e.value = !1, nt.value = "", vt.value = !1;
2425
+ Y == null || Y.abort(), Y = null, Re.value = !1, nt.value = "", vt.value = !1;
2413
2426
  }
2414
- function ye() {
2427
+ function he() {
2415
2428
  at(), ae.value = "";
2416
- const e = D(f.value);
2417
- f.value = e, i("update:sqlConfig", D(e));
2418
- }
2419
- function Br() {
2420
- Re.value = !1, Fe.value = !0, ve();
2429
+ const e = D(v.value);
2430
+ v.value = e, i("update:sqlConfig", D(e));
2421
2431
  }
2422
2432
  function Ur() {
2423
- f.value.mode !== "http" && (f.value = D({ ...f.value, mode: "http" }), i("update:sqlConfig", D(f.value))), Fe.value = !1, Re.value = !0, Qe.value = "", mt.value = !1, ve();
2433
+ _e.value = !1, $e.value = !0, ve();
2424
2434
  }
2425
2435
  function Ar() {
2426
- const e = f.value.connection.dialect, t = e === "sqlite" ? "mysql" : e;
2427
- f.value = D({
2436
+ v.value.mode !== "http" && (v.value = D({ ...v.value, mode: "http" }), i("update:sqlConfig", D(v.value))), $e.value = !1, _e.value = !0, Ke.value = "", mt.value = !1, ve();
2437
+ }
2438
+ function Dr() {
2439
+ const e = v.value.connection.dialect, t = e === "sqlite" ? "mysql" : e;
2440
+ v.value = D({
2428
2441
  mode: "http",
2429
- endpoint: f.value.endpoint,
2430
- headers: f.value.headers,
2431
- maxRows: f.value.maxRows,
2432
- timeoutMs: f.value.timeoutMs,
2433
- connection: { dialect: t, port: lr(t) }
2434
- }), ne.value = "", ae.value = "", Pe.value = "", at(), i("update:sqlConfig", D(f.value)), Re.value = !1, Fe.value = !0, ve();
2442
+ endpoint: v.value.endpoint,
2443
+ headers: v.value.headers,
2444
+ maxRows: v.value.maxRows,
2445
+ timeoutMs: v.value.timeoutMs,
2446
+ connection: { dialect: t, port: ur(t) }
2447
+ }), ne.value = "", ae.value = "", Oe.value = "", at(), i("update:sqlConfig", D(v.value)), _e.value = !1, $e.value = !0, ve();
2435
2448
  }
2436
2449
  function xn() {
2437
- Fe.value = !1;
2438
- }
2439
- function Dr() {
2440
- const e = f.value;
2441
- e.mode === "sqlite" ? (e.connectionId = void 0, e.connection.dialect = "sqlite", e.connection.database || (e.connection.database = ":memory:"), ne.value = "") : (e.connection.dialect === "sqlite" && (e.connection.dialect = "mysql", e.connection.port = lr("mysql")), e.connection.database === ":memory:" && (e.connection.database = "")), ye(), e.mode === "http" && ve();
2450
+ $e.value = !1;
2442
2451
  }
2443
2452
  function zr() {
2444
- const e = f.value.connection, t = dt.find((u) => u.value === e.dialect), r = dt.map((u) => u.defaultPort);
2445
- t != null && t.defaultPort && (!e.port || r.includes(e.port)) && (e.port = t.defaultPort), ye();
2453
+ const e = v.value;
2454
+ e.mode === "sqlite" ? (e.connectionId = void 0, e.connection.dialect = "sqlite", e.connection.database || (e.connection.database = ":memory:"), ne.value = "") : (e.connection.dialect === "sqlite" && (e.connection.dialect = "mysql", e.connection.port = ur("mysql")), e.connection.database === ":memory:" && (e.connection.database = "")), he(), e.mode === "http" && ve();
2455
+ }
2456
+ function jr() {
2457
+ const e = v.value.connection, t = dt.find((u) => u.value === e.dialect), r = dt.map((u) => u.defaultPort);
2458
+ t != null && t.defaultPort && (!e.port || r.includes(e.port)) && (e.port = t.defaultPort), he();
2446
2459
  }
2447
2460
  async function ve() {
2448
- const e = D(f.value);
2461
+ const e = D(v.value);
2449
2462
  if (!e.endpoint) {
2450
- Ce.value = [], Pe.value = "";
2463
+ Pe.value = [], Oe.value = "";
2451
2464
  return;
2452
2465
  }
2453
2466
  se == null || se.abort();
2454
2467
  const t = new AbortController();
2455
- se = t, je.value = !0, Pe.value = "";
2468
+ se = t, Ve.value = !0, Oe.value = "";
2456
2469
  try {
2457
- const r = await Ds(e, { signal: t.signal });
2470
+ const r = await zs(e, { signal: t.signal });
2458
2471
  if (se !== t) return;
2459
- Ce.value = r;
2460
- const u = r.find((c) => c.id === f.value.connectionId);
2461
- u ? ne.value = u.name : f.value.connectionId && (f.value.connectionId = void 0, ne.value = "");
2472
+ Pe.value = r;
2473
+ const u = r.find((c) => c.id === v.value.connectionId);
2474
+ u ? ne.value = u.name : v.value.connectionId && (v.value.connectionId = void 0, ne.value = "");
2462
2475
  } catch (r) {
2463
2476
  if (se !== t) return;
2464
- Ce.value = [], Pe.value = r instanceof Error ? r.message : String(r);
2477
+ Pe.value = [], Oe.value = r instanceof Error ? r.message : String(r);
2465
2478
  } finally {
2466
- se === t && (se = null, je.value = !1);
2479
+ se === t && (se = null, Ve.value = !1);
2467
2480
  }
2468
2481
  }
2469
2482
  function En(e) {
2470
- f.value = D({
2483
+ v.value = D({
2471
2484
  mode: "http",
2472
- endpoint: f.value.endpoint,
2473
- headers: f.value.headers,
2474
- maxRows: f.value.maxRows,
2475
- timeoutMs: f.value.timeoutMs,
2485
+ endpoint: v.value.endpoint,
2486
+ headers: v.value.headers,
2487
+ maxRows: v.value.maxRows,
2488
+ timeoutMs: v.value.timeoutMs,
2476
2489
  connectionId: e.id,
2477
2490
  connection: {
2478
2491
  dialect: e.dialect,
@@ -2483,28 +2496,28 @@ const Vs = Z(
2483
2496
  database: e.database ?? "",
2484
2497
  options: e.options
2485
2498
  }
2486
- }), ne.value = e.name, ae.value = "", at(), i("update:sqlConfig", D(f.value));
2499
+ }), ne.value = e.name, ae.value = "", at(), i("update:sqlConfig", D(v.value));
2487
2500
  }
2488
- function jr() {
2489
- Fe.value = !1, Re.value = !1;
2490
- const e = Ce.value.find((t) => t.id === f.value.connectionId);
2501
+ function Vr() {
2502
+ $e.value = !1, _e.value = !1;
2503
+ const e = Pe.value.find((t) => t.id === v.value.connectionId);
2491
2504
  if (!e) {
2492
- f.value.connectionId = void 0, f.value.connection.password = "", ne.value = "", ye();
2505
+ v.value.connectionId = void 0, v.value.connection.password = "", ne.value = "", he();
2493
2506
  return;
2494
2507
  }
2495
2508
  En(e);
2496
2509
  }
2497
- function Vr(e) {
2498
- En(e), Re.value = !1, Fe.value = !0;
2510
+ function Qr(e) {
2511
+ En(e), _e.value = !1, $e.value = !0;
2499
2512
  }
2500
- async function Qr() {
2513
+ async function Kr() {
2501
2514
  if (re.value) return;
2502
2515
  const e = ne.value.trim();
2503
2516
  if (!e) {
2504
- Ve.value = !1, ae.value = "请先填写连接名称";
2517
+ Qe.value = !1, ae.value = "请先填写连接名称";
2505
2518
  return;
2506
2519
  }
2507
- const t = D(f.value), r = {
2520
+ const t = D(v.value), r = {
2508
2521
  name: e,
2509
2522
  dialect: t.connection.dialect,
2510
2523
  host: t.connection.host,
@@ -2516,50 +2529,50 @@ const Vs = Z(
2516
2529
  };
2517
2530
  re.value = !0, ae.value = "";
2518
2531
  try {
2519
- const u = await zs(t, r, t.connectionId);
2520
- f.value = D({
2532
+ const u = await js(t, r, t.connectionId);
2533
+ v.value = D({
2521
2534
  ...t,
2522
2535
  connectionId: u.id,
2523
2536
  connection: { ...t.connection, password: "" }
2524
- }), ne.value = u.name, Ve.value = !0, ae.value = "连接已保存", i("update:sqlConfig", D(f.value)), await ve();
2537
+ }), ne.value = u.name, Qe.value = !0, ae.value = "连接已保存", i("update:sqlConfig", D(v.value)), await ve();
2525
2538
  } catch (u) {
2526
- Ve.value = !1, ae.value = u instanceof Error ? u.message : String(u);
2539
+ Qe.value = !1, ae.value = u instanceof Error ? u.message : String(u);
2527
2540
  } finally {
2528
2541
  re.value = !1;
2529
2542
  }
2530
2543
  }
2531
- async function Kr() {
2532
- const e = f.value.connectionId;
2544
+ async function Jr() {
2545
+ const e = v.value.connectionId;
2533
2546
  if (!(!e || re.value) && !(typeof window < "u" && !window.confirm("确定删除该连接配置?"))) {
2534
2547
  re.value = !0, ae.value = "";
2535
2548
  try {
2536
- await ur(f.value, e), f.value.connectionId = void 0, ne.value = "", Ve.value = !0, ae.value = "连接已删除", i("update:sqlConfig", D(f.value)), await ve();
2549
+ await cr(v.value, e), v.value.connectionId = void 0, ne.value = "", Qe.value = !0, ae.value = "连接已删除", i("update:sqlConfig", D(v.value)), await ve();
2537
2550
  } catch (t) {
2538
- Ve.value = !1, ae.value = t instanceof Error ? t.message : String(t);
2551
+ Qe.value = !1, ae.value = t instanceof Error ? t.message : String(t);
2539
2552
  } finally {
2540
2553
  re.value = !1;
2541
2554
  }
2542
2555
  }
2543
2556
  }
2544
- async function Jr(e) {
2557
+ async function Zr(e) {
2545
2558
  if (!re.value && !(typeof window < "u" && !window.confirm(`确定删除连接“${e.name}”?`))) {
2546
- re.value = !0, Qe.value = "";
2559
+ re.value = !0, Ke.value = "";
2547
2560
  try {
2548
- await ur(f.value, e.id), f.value.connectionId === e.id && (f.value.connectionId = void 0, f.value.connection.password = "", ne.value = "", i("update:sqlConfig", D(f.value))), mt.value = !0, Qe.value = `已删除连接“${e.name}”`, await ve();
2561
+ await cr(v.value, e.id), v.value.connectionId === e.id && (v.value.connectionId = void 0, v.value.connection.password = "", ne.value = "", i("update:sqlConfig", D(v.value))), mt.value = !0, Ke.value = `已删除连接“${e.name}”`, await ve();
2549
2562
  } catch (t) {
2550
- mt.value = !1, Qe.value = t instanceof Error ? t.message : String(t);
2563
+ mt.value = !1, Ke.value = t instanceof Error ? t.message : String(t);
2551
2564
  } finally {
2552
2565
  re.value = !1;
2553
2566
  }
2554
2567
  }
2555
2568
  }
2556
- async function Zr() {
2557
- if (_e.value) return;
2558
- at(), _e.value = !0;
2569
+ async function Gr() {
2570
+ if (Re.value) return;
2571
+ at(), Re.value = !0;
2559
2572
  const e = new AbortController();
2560
2573
  Y = e;
2561
2574
  try {
2562
- const t = await As(D(f.value), {
2575
+ const t = await Ds(D(v.value), {
2563
2576
  executor: o.sqlExecutor,
2564
2577
  signal: e.signal
2565
2578
  });
@@ -2569,13 +2582,13 @@ const Vs = Z(
2569
2582
  if (Y !== e) return;
2570
2583
  vt.value = !1, nt.value = t instanceof Error ? t.message : String(t);
2571
2584
  } finally {
2572
- Y === e && (Y = null, _e.value = !1);
2585
+ Y === e && (Y = null, Re.value = !1);
2573
2586
  }
2574
2587
  }
2575
- function Gr(e) {
2588
+ function Wr(e) {
2576
2589
  return e === null ? "NULL" : String(e);
2577
2590
  }
2578
- function Wr(e) {
2591
+ function Yr(e) {
2579
2592
  return e.columns.length ? `${e.rows.length} 行${e.truncated ? "(已截断)" : ""}` : `影响 ${e.affectedRows ?? 0} 行`;
2580
2593
  }
2581
2594
  function qn(e) {
@@ -2584,30 +2597,30 @@ const Vs = Z(
2584
2597
  }
2585
2598
  async function Cn() {
2586
2599
  if (Ee.value)
2587
- return k.value !== w.value.id && h("另一个 SQL 正在执行,请等待或停止后再试"), null;
2588
- const e = Te();
2600
+ return k.value !== w.value.id && g("另一个 SQL 正在执行,请等待或停止后再试"), null;
2601
+ const e = Ce();
2589
2602
  if (!e.trim())
2590
- return h("SQL 内容为空,请输入要执行的语句"), null;
2591
- const t = D(f.value), r = ++rt, u = w.value.id;
2592
- Ee.value = !0, k.value = u, de = new AbortController(), Me(void 0), o.clearOutputOnRun && (fe(u).lines = [], fe(u).sqlResults = []), h(
2603
+ return g("SQL 内容为空,请输入要执行的语句"), null;
2604
+ const t = D(v.value), r = ++rt, u = w.value.id;
2605
+ Ee.value = !0, k.value = u, de = new AbortController(), Ne(void 0), o.clearOutputOnRun && (fe(u).lines = [], fe(u).sqlResults = []), g(
2593
2606
  `开始执行 SQL(${t.mode === "sqlite" ? "浏览器内 SQLite" : "HTTP 服务"})`,
2594
2607
  u
2595
2608
  ), i("runStart");
2596
2609
  try {
2597
- const c = await kr(t, e, {
2610
+ const c = await wr(t, e, {
2598
2611
  executor: o.sqlExecutor,
2599
2612
  signal: de.signal
2600
2613
  });
2601
2614
  if (r !== rt) return null;
2602
2615
  if (fe(u).sqlResults = c.results ?? [], c.ok) {
2603
- const y = c.results ?? [], S = y.reduce(($, X) => $ + X.rows.length, 0);
2604
- h(
2605
- `SQL 执行完成:${y.length} 个结果集,共 ${S} 行,耗时 ${(c.durationMs / 1e3).toFixed(2)}s`,
2616
+ const h = c.results ?? [], S = h.reduce((L, X) => L + X.rows.length, 0);
2617
+ g(
2618
+ `SQL 执行完成:${h.length} 个结果集,共 ${S} 行,耗时 ${(c.durationMs / 1e3).toFixed(2)}s`,
2606
2619
  u
2607
2620
  );
2608
2621
  } else {
2609
- const y = c.error ?? { type: "SqlError", message: "SQL 执行失败" };
2610
- h(`SQL 执行出错:${y.type}`, u), ge("stderr", y.message, u), i("runOutput", { stream: "stderr", text: y.message }), i("sqlError", y);
2622
+ const h = c.error ?? { type: "SqlError", message: "SQL 执行失败" };
2623
+ g(`SQL 执行出错:${h.type}`, u), ye("stderr", h.message, u), i("runOutput", { stream: "stderr", text: h.message }), i("sqlError", h);
2611
2624
  }
2612
2625
  return i("sqlResult", c), i("runFinish", {
2613
2626
  ok: c.ok,
@@ -2616,58 +2629,58 @@ const Vs = Z(
2616
2629
  }), c;
2617
2630
  } catch (c) {
2618
2631
  if (r !== rt) return null;
2619
- const y = c instanceof Error ? c.message : String(c);
2620
- h(`SQL 执行失败:${y}`, u);
2621
- const S = { type: "SqlError", message: y };
2632
+ const h = c instanceof Error ? c.message : String(c);
2633
+ g(`SQL 执行失败:${h}`, u);
2634
+ const S = { type: "SqlError", message: h };
2622
2635
  return i("sqlError", S), i("runFinish", { ok: !1, durationMs: 0, error: qn(S) }), null;
2623
2636
  } finally {
2624
2637
  r === rt && (Ee.value = !1, de = null, k.value === u && (k.value = null));
2625
2638
  }
2626
2639
  }
2627
- async function Yr(e) {
2628
- return e !== void 0 && (kt(e), w.value.language !== "sql" && jt("sql")), w.value.language !== "sql" ? (h("当前文件不是 SQL,无法执行"), null) : Cn();
2640
+ async function Xr(e) {
2641
+ return e !== void 0 && (kt(e), w.value.language !== "sql" && jt("sql")), w.value.language !== "sql" ? (g("当前文件不是 SQL,无法执行"), null) : Cn();
2629
2642
  }
2630
- function Xr(e) {
2643
+ function ea(e) {
2631
2644
  const t = e.target.value === "server" ? "server" : "browser";
2632
2645
  if (t === "browser")
2633
- for (const r of [...M.keys()])
2646
+ for (const r of [...N.keys()])
2634
2647
  st(r, !1);
2635
- ce.value = t, i("update:runtime", t), h(t === "server" ? "已切换到服务端 Python 环境" : "已切换到浏览器 Python 环境");
2648
+ ce.value = t, i("update:runtime", t), g(t === "server" ? "已切换到服务端 Python 环境" : "已切换到浏览器 Python 环境");
2636
2649
  }
2637
2650
  function Pn(e, t, r, u) {
2638
2651
  if (!u) return;
2639
2652
  const c = u.replace(/\r\n/g, `
2640
2653
  `);
2641
- let y = r === "stdout" ? t.stdoutBuffer : t.stderrBuffer;
2642
- y += c;
2643
- const S = y.split(`
2644
- `), $ = S.pop() ?? "";
2645
- r === "stdout" ? t.stdoutBuffer = $ : t.stderrBuffer = $;
2654
+ let h = r === "stdout" ? t.stdoutBuffer : t.stderrBuffer;
2655
+ h += c;
2656
+ const S = h.split(`
2657
+ `), L = S.pop() ?? "";
2658
+ r === "stdout" ? t.stdoutBuffer = L : t.stderrBuffer = L;
2646
2659
  for (const X of S)
2647
- ge(r, X, e), i("runOutput", { stream: r, text: X });
2660
+ ye(r, X, e), i("runOutput", { stream: r, text: X });
2648
2661
  }
2649
2662
  function On(e, t) {
2650
- t.stdoutBuffer && (ge("stdout", t.stdoutBuffer, e), i("runOutput", { stream: "stdout", text: t.stdoutBuffer }), t.stdoutBuffer = ""), t.stderrBuffer && (ge("stderr", t.stderrBuffer, e), i("runOutput", { stream: "stderr", text: t.stderrBuffer }), t.stderrBuffer = "");
2663
+ t.stdoutBuffer && (ye("stdout", t.stdoutBuffer, e), i("runOutput", { stream: "stdout", text: t.stdoutBuffer }), t.stdoutBuffer = ""), t.stderrBuffer && (ye("stderr", t.stderrBuffer, e), i("runOutput", { stream: "stderr", text: t.stderrBuffer }), t.stderrBuffer = "");
2651
2664
  }
2652
2665
  function wt(e, t, r) {
2653
2666
  window.clearTimeout(t.pollTimer), On(e, t);
2654
- const u = M.get(e);
2655
- if (u && u.token === t.token && M.delete(e), r.error) {
2656
- h(`执行出错:${r.error.type}`, e), e === w.value.id && Me(r.error.line);
2657
- const y = {
2667
+ const u = N.get(e);
2668
+ if (u && u.token === t.token && N.delete(e), r.error) {
2669
+ g(`执行出错:${r.error.type}`, e), e === w.value.id && Ne(r.error.line);
2670
+ const h = {
2658
2671
  type: r.error.type,
2659
2672
  message: r.error.message,
2660
2673
  line: r.error.line,
2661
2674
  traceback: r.error.traceback ?? ""
2662
2675
  };
2663
- i("runError", y), i("runFinish", { ok: !1, durationMs: r.durationMs ?? 0, error: y });
2676
+ i("runError", h), i("runFinish", { ok: !1, durationMs: r.durationMs ?? 0, error: h });
2664
2677
  return;
2665
2678
  }
2666
2679
  const c = r.durationMs ?? 0;
2667
- h(`执行完成,会话时长 ${(c / 1e3).toFixed(2)}s`, e), i("runFinish", { ok: !0, durationMs: c });
2680
+ g(`执行完成,会话时长 ${(c / 1e3).toFixed(2)}s`, e), i("runFinish", { ok: !0, durationMs: c });
2668
2681
  }
2669
2682
  function Qt(e, t, r, u) {
2670
- const c = M.get(e);
2683
+ const c = N.get(e);
2671
2684
  if (!(!c || c.token !== u)) {
2672
2685
  if (Pn(e, t, "stdout", r.stdout), Pn(e, t, "stderr", r.stderr), r.state === "exited") {
2673
2686
  wt(e, t, r);
@@ -2677,48 +2690,48 @@ const Vs = Z(
2677
2690
  t.waiting = !0;
2678
2691
  return;
2679
2692
  }
2680
- t.waiting = !1, ea(e, t, u);
2693
+ t.waiting = !1, ta(e, t, u);
2681
2694
  }
2682
2695
  }
2683
- function ea(e, t, r) {
2696
+ function ta(e, t, r) {
2684
2697
  window.clearTimeout(t.pollTimer), t.pollTimer = window.setTimeout(() => {
2685
- ta(e, r);
2698
+ na(e, r);
2686
2699
  }, 250);
2687
2700
  }
2688
- async function ta(e, t) {
2701
+ async function na(e, t) {
2689
2702
  var u, c;
2690
- const r = M.get(e);
2703
+ const r = N.get(e);
2691
2704
  if (!(!r || r.token !== t || !r.sessionId))
2692
2705
  try {
2693
- const y = await _s(o.pythonEndpoint, r.sessionId, {
2706
+ const h = await _s(o.pythonEndpoint, r.sessionId, {
2694
2707
  headers: o.pythonHeaders,
2695
2708
  signal: (u = r.abort) == null ? void 0 : u.signal
2696
2709
  });
2697
- Qt(e, r, y, t);
2698
- } catch (y) {
2699
- if (((c = M.get(e)) == null ? void 0 : c.token) !== t) return;
2700
- const S = y instanceof Error ? y.message : String(y);
2701
- h(`执行失败:${S}`, e), wt(e, r, {
2710
+ Qt(e, r, h, t);
2711
+ } catch (h) {
2712
+ if (((c = N.get(e)) == null ? void 0 : c.token) !== t) return;
2713
+ const S = h instanceof Error ? h.message : String(h);
2714
+ g(`执行失败:${S}`, e), wt(e, r, {
2702
2715
  sessionId: r.sessionId,
2703
2716
  durationMs: 0,
2704
2717
  error: { type: "RuntimeError", message: S }
2705
2718
  });
2706
2719
  }
2707
2720
  }
2708
- async function na() {
2709
- var y;
2721
+ async function ra() {
2722
+ var h;
2710
2723
  const e = w.value.id;
2711
- if ((y = M.get(e)) != null && y.busy) return;
2724
+ if ((h = N.get(e)) != null && h.busy) return;
2712
2725
  if (!bt.value) {
2713
- h("未配置 Python 服务端点(pythonEndpoint)");
2726
+ g("未配置 Python 服务端点(pythonEndpoint)");
2714
2727
  return;
2715
2728
  }
2716
- const t = Te();
2729
+ const t = Ce();
2717
2730
  if (!t.trim()) {
2718
- h("代码为空,请输入要执行的 Python 代码");
2731
+ g("代码为空,请输入要执行的 Python 代码");
2719
2732
  return;
2720
2733
  }
2721
- const r = ++xr, u = {
2734
+ const r = ++Er, u = {
2722
2735
  sessionId: "",
2723
2736
  busy: !0,
2724
2737
  waiting: !1,
@@ -2729,27 +2742,27 @@ const Vs = Z(
2729
2742
  stdoutBuffer: "",
2730
2743
  stderrBuffer: ""
2731
2744
  };
2732
- M.set(e, u);
2733
- const c = M.get(e);
2734
- Me(void 0), o.clearOutputOnRun && (fe(e).lines = []), h("开始执行(服务端 Python)", e), i("runStart");
2745
+ N.set(e, u);
2746
+ const c = N.get(e);
2747
+ Ne(void 0), o.clearOutputOnRun && (fe(e).lines = []), g("开始执行(服务端 Python)", e), i("runStart");
2735
2748
  try {
2736
- const S = await Fs(o.pythonEndpoint, t, {
2749
+ const S = await Rs(o.pythonEndpoint, t, {
2737
2750
  stdin: o.stdin,
2738
2751
  headers: o.pythonHeaders,
2739
2752
  signal: c.abort.signal
2740
- }), $ = M.get(e);
2741
- if (!$ || $.token !== r) {
2742
- S.sessionId && rr(o.pythonEndpoint, S.sessionId, {
2753
+ }), L = N.get(e);
2754
+ if (!L || L.token !== r) {
2755
+ S.sessionId && ar(o.pythonEndpoint, S.sessionId, {
2743
2756
  headers: o.pythonHeaders
2744
2757
  });
2745
2758
  return;
2746
2759
  }
2747
- $.sessionId = S.sessionId, Qt(e, $, S, r);
2760
+ L.sessionId = S.sessionId, Qt(e, L, S, r);
2748
2761
  } catch (S) {
2749
- const $ = M.get(e);
2750
- if (!$ || $.token !== r) return;
2762
+ const L = N.get(e);
2763
+ if (!L || L.token !== r) return;
2751
2764
  const X = S instanceof Error ? S.message : String(S);
2752
- h(`执行失败:${X}`, e), wt(e, $, {
2765
+ g(`执行失败:${X}`, e), wt(e, L, {
2753
2766
  durationMs: 0,
2754
2767
  error: { type: "RuntimeError", message: X }
2755
2768
  });
@@ -2757,20 +2770,20 @@ const Vs = Z(
2757
2770
  }
2758
2771
  async function Mn() {
2759
2772
  var u, c;
2760
- const e = w.value.id, t = M.get(e);
2773
+ const e = w.value.id, t = N.get(e);
2761
2774
  if (!t || !t.waiting || !t.sessionId) return;
2762
2775
  const r = t.input;
2763
- t.input = "", t.waiting = !1, ge("stdout", r, e), i("runOutput", { stream: "stdout", text: r });
2776
+ t.input = "", t.waiting = !1, ye("stdout", r, e), i("runOutput", { stream: "stdout", text: r });
2764
2777
  try {
2765
- const y = await Rs(o.pythonEndpoint, t.sessionId, r, {
2778
+ const h = await Is(o.pythonEndpoint, t.sessionId, r, {
2766
2779
  headers: o.pythonHeaders,
2767
2780
  signal: (u = t.abort) == null ? void 0 : u.signal
2768
2781
  });
2769
- Qt(e, t, y, t.token);
2770
- } catch (y) {
2771
- if (((c = M.get(e)) == null ? void 0 : c.token) !== t.token) return;
2772
- const S = y instanceof Error ? y.message : String(y);
2773
- h(`执行失败:${S}`, e), wt(e, t, {
2782
+ Qt(e, t, h, t.token);
2783
+ } catch (h) {
2784
+ if (((c = N.get(e)) == null ? void 0 : c.token) !== t.token) return;
2785
+ const S = h instanceof Error ? h.message : String(h);
2786
+ g(`执行失败:${S}`, e), wt(e, t, {
2774
2787
  sessionId: t.sessionId,
2775
2788
  durationMs: 0,
2776
2789
  error: { type: "RuntimeError", message: S }
@@ -2779,23 +2792,23 @@ const Vs = Z(
2779
2792
  }
2780
2793
  function st(e, t = !0) {
2781
2794
  var u;
2782
- const r = M.get(e);
2783
- r && (window.clearTimeout(r.pollTimer), M.delete(e), (u = r.abort) == null || u.abort(), r.sessionId && rr(o.pythonEndpoint, r.sessionId, {
2795
+ const r = N.get(e);
2796
+ r && (window.clearTimeout(r.pollTimer), N.delete(e), (u = r.abort) == null || u.abort(), r.sessionId && ar(o.pythonEndpoint, r.sessionId, {
2784
2797
  headers: o.pythonHeaders
2785
- }), t && h("执行已中断", e));
2798
+ }), t && g("执行已中断", e));
2786
2799
  }
2787
- async function Tn() {
2788
- var c, y, S;
2800
+ async function Nn() {
2801
+ var c, h, S;
2789
2802
  if (w.value.language === "sql") {
2790
2803
  await Cn();
2791
2804
  return;
2792
2805
  }
2793
- if (Ze.value) {
2794
- await na();
2806
+ if (Ge.value) {
2807
+ await ra();
2795
2808
  return;
2796
2809
  }
2797
2810
  if (I.value === "running") {
2798
- k.value !== w.value.id && h(
2811
+ k.value !== w.value.id && g(
2799
2812
  "浏览器环境共享同一个 Pyodide 实例,暂不支持同时运行多个文件;可切换到服务端环境后并行执行"
2800
2813
  );
2801
2814
  return;
@@ -2803,97 +2816,97 @@ const Vs = Z(
2803
2816
  if (I.value === "loading") return;
2804
2817
  const e = w.value.language;
2805
2818
  if (e !== "python") {
2806
- h(`当前文件为 ${Mt(e).label},仅支持执行 Python / SQL 代码`);
2819
+ g(`当前文件为 ${Mt(e).label},仅支持执行 Python / SQL 代码`);
2807
2820
  return;
2808
2821
  }
2809
2822
  We += 1;
2810
2823
  const t = We, r = w.value.id;
2811
- k.value = r, Me(void 0), o.clearOutputOnRun && (fe(r).lines = []), h("开始执行", r), i("runStart");
2812
- const u = Te();
2824
+ k.value = r, Ne(void 0), o.clearOutputOnRun && (fe(r).lines = []), g("开始执行", r), i("runStart");
2825
+ const u = Ce();
2813
2826
  try {
2814
- await Hr();
2815
- const $ = await j.run(u, {
2827
+ await Br();
2828
+ const L = await V.run(u, {
2816
2829
  stdin: o.stdin,
2817
2830
  onOutput: (X, it) => {
2818
- ge(X, it, r), i("runOutput", { stream: X, text: it });
2831
+ ye(X, it, r), i("runOutput", { stream: X, text: it });
2819
2832
  }
2820
2833
  });
2821
2834
  if (t !== We) return;
2822
- $.interrupted ? h("执行已中断", r) : $.ok ? h(`执行完成,耗时 ${($.durationMs / 1e3).toFixed(2)}s`, r) : (h(`执行出错:${((c = $.error) == null ? void 0 : c.type) ?? "未知错误"}`, r), (y = $.error) != null && y.traceback && (ge("stderr", $.error.traceback, r), i("runOutput", { stream: "stderr", text: $.error.traceback })), w.value.id === r && Me((S = $.error) == null ? void 0 : S.line), $.error && i("runError", $.error)), i("runFinish", $);
2823
- } catch ($) {
2835
+ L.interrupted ? g("执行已中断", r) : L.ok ? g(`执行完成,耗时 ${(L.durationMs / 1e3).toFixed(2)}s`, r) : (g(`执行出错:${((c = L.error) == null ? void 0 : c.type) ?? "未知错误"}`, r), (h = L.error) != null && h.traceback && (ye("stderr", L.error.traceback, r), i("runOutput", { stream: "stderr", text: L.error.traceback })), w.value.id === r && Ne((S = L.error) == null ? void 0 : S.line), L.error && i("runError", L.error)), i("runFinish", L);
2836
+ } catch (L) {
2824
2837
  if (t !== We) return;
2825
- const X = $ instanceof Error ? $.message : String($);
2826
- h(`执行失败:${X}`, r);
2838
+ const X = L instanceof Error ? L.message : String(L);
2839
+ g(`执行失败:${X}`, r);
2827
2840
  const it = { type: "RuntimeError", message: X, traceback: "" };
2828
2841
  i("runError", it), i("runFinish", { ok: !1, durationMs: 0, error: it });
2829
2842
  } finally {
2830
2843
  t === We && k.value === r && (k.value = null);
2831
2844
  }
2832
2845
  }
2833
- async function ra() {
2846
+ async function aa() {
2834
2847
  var t;
2835
2848
  if (mn) return;
2836
2849
  const e = o.preloadPackages;
2837
2850
  if (e.length) {
2838
- mn = !0, h(`正在安装预置包:${e.join(", ")}`);
2851
+ mn = !0, g(`正在安装预置包:${e.join(", ")}`);
2839
2852
  try {
2840
- const r = await j.loadPackages(e, {
2841
- onOutput: (u, c) => ge(u, c)
2853
+ const r = await V.loadPackages(e, {
2854
+ onOutput: (u, c) => ye(u, c)
2842
2855
  });
2843
- h(
2856
+ g(
2844
2857
  r.ok ? `预置包安装完成(${(r.durationMs / 1e3).toFixed(1)}s)` : `预置包安装失败:${((t = r.error) == null ? void 0 : t.message) ?? "未知错误"}`
2845
2858
  );
2846
2859
  } catch (r) {
2847
- h(`预置包安装失败:${r instanceof Error ? r.message : String(r)}`);
2860
+ g(`预置包安装失败:${r instanceof Error ? r.message : String(r)}`);
2848
2861
  }
2849
2862
  }
2850
2863
  }
2851
- Fa(() => {
2864
+ Ra(() => {
2852
2865
  const e = b.value;
2853
2866
  if (!e) return;
2854
- $r(), _t = !0;
2867
+ $r(), Rt = !0;
2855
2868
  const t = [
2856
- gn.of([
2869
+ yn.of([
2857
2870
  nn.readOnly.of(o.readOnly),
2858
- $e.editable.of(!o.readOnly)
2871
+ Le.editable.of(!o.readOnly)
2859
2872
  ]),
2860
2873
  Ut.of(zt(w.value.language)),
2861
- Ht.of(Tt(ut(z.value)))
2874
+ Ht.of(Nt(ut(j.value)))
2862
2875
  ];
2863
2876
  try {
2864
- P = ks(e, {
2877
+ P = ws(e, {
2865
2878
  value: w.value.code,
2866
- dark: ut(z.value),
2879
+ dark: ut(j.value),
2867
2880
  placeholderText: o.placeholder,
2868
2881
  language: Bt.of(en(w.value.language)),
2869
2882
  extensions: t,
2870
2883
  onDocChange: (r) => {
2871
2884
  w.value.code = r, r !== o.modelValue && i("update:modelValue", r);
2872
2885
  },
2873
- onRunShortcut: Tn
2886
+ onRunShortcut: Nn
2874
2887
  });
2875
2888
  } catch (r) {
2876
2889
  const u = r instanceof Error ? r.message : String(r);
2877
- console.error("[princess-python-editor] 编辑器初始化失败", r), h(`编辑器初始化失败:${u}`), e.innerHTML = "";
2890
+ console.error("[princess-python-editor] 编辑器初始化失败", r), g(`编辑器初始化失败:${u}`), e.innerHTML = "";
2878
2891
  const c = document.createElement("div");
2879
2892
  c.className = "vpe-init-error", c.textContent = `编辑器初始化失败:${u}`, e.appendChild(c);
2880
2893
  return;
2881
2894
  }
2882
- o.autofocus && P.focus(), yt = j.on("status", (r, u) => {
2883
- I.value = r, r === "ready" && (u && h(`Pyodide ${u} 就绪`), i("ready"), P && !o.disableLint && w.value.language === "python" && Qa(P)), i("statusChange", r);
2884
- }), ht = j.on("initError", (r) => {
2885
- h(`Pyodide 加载失败:${r}`), i("loadError", r);
2886
- }), I.value = j.status, pe.value && ve(), typeof ResizeObserver < "u" && p.value && (Je = new ResizeObserver(() => {
2895
+ o.autofocus && P.focus(), ht = V.on("status", (r, u) => {
2896
+ I.value = r, r === "ready" && (u && g(`Pyodide ${u} 就绪`), i("ready"), P && !o.disableLint && w.value.language === "python" && Ka(P)), i("statusChange", r);
2897
+ }), gt = V.on("initError", (r) => {
2898
+ g(`Pyodide 加载失败:${r}`), i("loadError", r);
2899
+ }), I.value = V.status, pe.value && ve(), typeof ResizeObserver < "u" && f.value && (Ze = new ResizeObserver(() => {
2887
2900
  x.value !== null && Kt(x.value);
2888
- }), Je.observe(p.value)), o.preloadPackages.length ? j.waitReady().then(() => ra()).catch((r) => h(r.message)) : o.preload && j.waitReady().catch((r) => h(r.message));
2901
+ }), Ze.observe(f.value)), o.preloadPackages.length ? V.waitReady().then(() => aa()).catch((r) => g(r.message)) : o.preload && V.waitReady().catch((r) => g(r.message));
2889
2902
  }), _a(() => {
2890
- yt == null || yt(), ht == null || ht(), ot(), Je == null || Je.disconnect(), Je = null, de == null || de.abort(), de = null, Y == null || Y.abort(), Y = null, se == null || se.abort(), se = null, oe == null || oe.abort(), oe = null;
2891
- for (const e of [...M.keys()])
2903
+ ht == null || ht(), gt == null || gt(), ot(), Ze == null || Ze.disconnect(), Ze = null, de == null || de.abort(), de = null, Y == null || Y.abort(), Y = null, se == null || se.abort(), se = null, oe == null || oe.abort(), oe = null;
2904
+ for (const e of [...N.keys()])
2892
2905
  st(e, !1);
2893
- window.clearTimeout(It), window.clearTimeout(gt), kn(), P == null || P.destroy(), P = null;
2906
+ window.clearTimeout(It), window.clearTimeout(yt), kn(), P == null || P.destroy(), P = null;
2894
2907
  }), ee(
2895
2908
  () => o.modelValue,
2896
- () => Rr()
2909
+ () => Ir()
2897
2910
  ), ee(
2898
2911
  () => o.outputHeight,
2899
2912
  () => {
@@ -2912,8 +2925,8 @@ const Vs = Z(
2912
2925
  ), ee(
2913
2926
  () => o.theme,
2914
2927
  (e) => {
2915
- e !== z.value && (z.value = e, P == null || P.dispatch({
2916
- effects: Ht.reconfigure(Tt(ut(e)))
2928
+ e !== j.value && (j.value = e, P == null || P.dispatch({
2929
+ effects: Ht.reconfigure(Nt(ut(e)))
2917
2930
  }));
2918
2931
  }
2919
2932
  ), ee(
@@ -2925,7 +2938,7 @@ const Vs = Z(
2925
2938
  () => o.pythonEndpoint,
2926
2939
  () => {
2927
2940
  if (!bt.value) {
2928
- for (const e of [...M.keys()])
2941
+ for (const e of [...N.keys()])
2929
2942
  st(e, !1);
2930
2943
  ce.value !== "browser" && (ce.value = "browser", i("update:runtime", "browser"));
2931
2944
  }
@@ -2933,8 +2946,8 @@ const Vs = Z(
2933
2946
  ), ee(
2934
2947
  () => o.filesEndpoint,
2935
2948
  () => {
2936
- if (!Oe.value) {
2937
- xe.value = !1, tt.value = [], ze.value = "";
2949
+ if (!Me.value) {
2950
+ xe.value = !1, tt.value = [], je.value = "";
2938
2951
  return;
2939
2952
  }
2940
2953
  xe.value && Ye();
@@ -2943,7 +2956,7 @@ const Vs = Z(
2943
2956
  () => o.readOnly,
2944
2957
  (e) => {
2945
2958
  P == null || P.dispatch({
2946
- effects: gn.reconfigure([nn.readOnly.of(e), $e.editable.of(!e)])
2959
+ effects: yn.reconfigure([nn.readOnly.of(e), Le.editable.of(!e)])
2947
2960
  });
2948
2961
  }
2949
2962
  ), ee(
@@ -2951,7 +2964,7 @@ const Vs = Z(
2951
2964
  (e) => {
2952
2965
  if (!e) return;
2953
2966
  const t = D(e);
2954
- JSON.stringify(t) !== JSON.stringify(f.value) && (f.value = t), pe.value && ve();
2967
+ JSON.stringify(t) !== JSON.stringify(v.value) && (v.value = t), pe.value && ve();
2955
2968
  },
2956
2969
  { deep: !0 }
2957
2970
  ), ee(pe, (e) => {
@@ -2959,22 +2972,26 @@ const Vs = Z(
2959
2972
  }), ee(
2960
2973
  () => G.value.length,
2961
2974
  async () => {
2962
- await Zn();
2963
- const e = _.value;
2975
+ await Gn();
2976
+ const e = R.value;
2964
2977
  e && (e.scrollTop = e.scrollHeight);
2965
2978
  }
2966
- ), ee([L, qe], () => Fr(), { deep: !0 });
2967
- function Nn() {
2968
- Tn();
2979
+ ), ee([F, qe], () => Rr(), { deep: !0 });
2980
+ function Tn() {
2981
+ const e = Ce();
2982
+ i("submit", e, { ...He(w.value), code: e });
2983
+ }
2984
+ function Fn() {
2985
+ Nn();
2969
2986
  }
2970
2987
  function Ln() {
2971
2988
  var t;
2972
2989
  const e = w.value.id;
2973
- if (_e.value) {
2974
- at(), !o.sqlExecutor && f.value.mode === "sqlite" && j.interrupt(), h("已取消连接测试");
2990
+ if (Re.value) {
2991
+ at(), !o.sqlExecutor && v.value.mode === "sqlite" && V.interrupt(), g("已取消连接测试");
2975
2992
  return;
2976
2993
  }
2977
- if ((t = M.get(e)) != null && t.busy) {
2994
+ if ((t = N.get(e)) != null && t.busy) {
2978
2995
  st(e);
2979
2996
  return;
2980
2997
  }
@@ -2982,106 +2999,106 @@ const Vs = Z(
2982
2999
  $n();
2983
3000
  return;
2984
3001
  }
2985
- I.value === "running" && k.value === e && Fn();
3002
+ I.value === "running" && k.value === e && Rn();
2986
3003
  }
2987
3004
  function $n(e = !0) {
2988
3005
  const t = k.value;
2989
- rt += 1, Ee.value = !1, k.value = null, de == null || de.abort(), de = null, !o.sqlExecutor && f.value.mode === "sqlite" && j.interrupt(), e && h("执行已中断", t ?? void 0);
3006
+ rt += 1, Ee.value = !1, k.value = null, de == null || de.abort(), de = null, !o.sqlExecutor && v.value.mode === "sqlite" && V.interrupt(), e && g("执行已中断", t ?? void 0);
2990
3007
  }
2991
- function Fn(e = !0) {
3008
+ function Rn(e = !0) {
2992
3009
  const t = k.value;
2993
- We += 1, k.value = null, j.interrupt(), e && h("执行已中断", t ?? void 0);
3010
+ We += 1, k.value = null, V.interrupt(), e && g("执行已中断", t ?? void 0);
2994
3011
  }
2995
3012
  function _n() {
2996
3013
  fe().lines = [], fe().sqlResults = [];
2997
3014
  }
2998
- function Rn() {
3015
+ function In() {
2999
3016
  var e;
3000
3017
  return ((e = E.value) == null ? void 0 : e.getBoundingClientRect().height) ?? 180;
3001
3018
  }
3002
- function aa() {
3019
+ function sa() {
3003
3020
  var t;
3004
- const e = ((t = p.value) == null ? void 0 : t.clientHeight) ?? 0;
3005
- return Math.max(vr, e ? e - 180 : 600);
3021
+ const e = ((t = f.value) == null ? void 0 : t.clientHeight) ?? 0;
3022
+ return Math.max(mr, e ? e - 180 : 600);
3006
3023
  }
3007
3024
  function Kt(e) {
3008
- x.value = Math.round(Math.max(vr, Math.min(e, aa())));
3025
+ x.value = Math.round(Math.max(mr, Math.min(e, sa())));
3009
3026
  }
3010
- function sa(e) {
3011
- e.button === 0 && (e.preventDefault(), F.value = !0, yn = e.clientY, At = Rn(), x.value = Math.round(At), document.body.style.cursor = "ns-resize", document.body.style.userSelect = "none", window.addEventListener("pointermove", In), window.addEventListener("pointerup", ot), window.addEventListener("pointercancel", ot));
3027
+ function oa(e) {
3028
+ e.button === 0 && (e.preventDefault(), $.value = !0, hn = e.clientY, At = In(), x.value = Math.round(At), document.body.style.cursor = "ns-resize", document.body.style.userSelect = "none", window.addEventListener("pointermove", Hn), window.addEventListener("pointerup", ot), window.addEventListener("pointercancel", ot));
3012
3029
  }
3013
- function In(e) {
3014
- F.value && Kt(At + (yn - e.clientY));
3030
+ function Hn(e) {
3031
+ $.value && Kt(At + (hn - e.clientY));
3015
3032
  }
3016
3033
  function ot() {
3017
- F.value && (F.value = !1, document.body.style.cursor = "", document.body.style.userSelect = "", window.removeEventListener("pointermove", In), window.removeEventListener("pointerup", ot), window.removeEventListener("pointercancel", ot));
3034
+ $.value && ($.value = !1, document.body.style.cursor = "", document.body.style.userSelect = "", window.removeEventListener("pointermove", Hn), window.removeEventListener("pointerup", ot), window.removeEventListener("pointercancel", ot));
3018
3035
  }
3019
- function oa() {
3036
+ function ia() {
3020
3037
  x.value = null;
3021
3038
  }
3022
- function ia(e) {
3039
+ function la(e) {
3023
3040
  if (e.key !== "ArrowUp" && e.key !== "ArrowDown") return;
3024
3041
  e.preventDefault();
3025
- const t = x.value ?? Rn();
3042
+ const t = x.value ?? In();
3026
3043
  Kt(t + (e.key === "ArrowUp" ? 16 : -16));
3027
3044
  }
3028
3045
  function Jt() {
3029
3046
  if (o.readOnly) return;
3030
- const e = w.value.language, t = Ke(wn(e), e, "");
3031
- L.value.push(t), He(t.id), i("newFile", Ge(t));
3047
+ const e = w.value.language, t = Je(wn(e), e, "");
3048
+ F.value.push(t), Be(t.id), i("newFile", He(t));
3032
3049
  }
3033
- function He(e) {
3050
+ function Be(e) {
3034
3051
  if (e === qe.value) {
3035
3052
  xt();
3036
3053
  return;
3037
3054
  }
3038
- const t = L.value.find((r) => r.id === e);
3055
+ const t = F.value.find((r) => r.id === e);
3039
3056
  t && (qe.value = e, Zt(t));
3040
3057
  }
3041
- function la(e) {
3042
- st(e, !1), Ee.value && k.value === e && $n(!1), I.value === "running" && k.value === e && Fn(!1);
3058
+ function ua(e) {
3059
+ st(e, !1), Ee.value && k.value === e && $n(!1), I.value === "running" && k.value === e && Rn(!1);
3043
3060
  }
3044
- function Hn(e) {
3061
+ function Bn(e) {
3045
3062
  if (o.readOnly) return;
3046
- const t = L.value.findIndex((c) => c.id === e);
3063
+ const t = F.value.findIndex((c) => c.id === e);
3047
3064
  if (t === -1) return;
3048
- la(e);
3049
- const r = L.value.splice(t, 1)[0];
3065
+ ua(e);
3066
+ const r = F.value.splice(t, 1)[0];
3050
3067
  if (!r) return;
3051
- if (q.delete(e), i("fileClose", Ge(r)), !L.value.length) {
3052
- const c = Ke(wn(r.language), r.language, "");
3053
- L.value.push(c), qe.value = c.id, Zt(c), i("newFile", Ge(c));
3068
+ if (q.delete(e), i("fileClose", He(r)), !F.value.length) {
3069
+ const c = Je(wn(r.language), r.language, "");
3070
+ F.value.push(c), qe.value = c.id, Zt(c), i("newFile", He(c));
3054
3071
  return;
3055
3072
  }
3056
3073
  if (e !== qe.value) return;
3057
- const u = L.value[Math.min(t, L.value.length - 1)];
3074
+ const u = F.value[Math.min(t, F.value.length - 1)];
3058
3075
  u && (qe.value = u.id, Zt(u));
3059
3076
  }
3060
3077
  function Zt(e) {
3061
- Me(void 0), kt(e.code), P == null || P.dispatch({
3078
+ Ne(void 0), kt(e.code), P == null || P.dispatch({
3062
3079
  effects: [
3063
3080
  Bt.reconfigure(en(e.language)),
3064
3081
  Ut.reconfigure(zt(e.language))
3065
3082
  ]
3066
- }), i("update:fileName", e.name), i("update:language", e.language), i("fileSwitch", Ge(e)), xt();
3083
+ }), i("update:fileName", e.name), i("update:language", e.language), i("fileSwitch", He(e)), xt();
3067
3084
  }
3068
- function Bn() {
3069
- o.readOnly || (Me(void 0), kt(""), xt());
3085
+ function Un() {
3086
+ o.readOnly || (Ne(void 0), kt(""), xt());
3070
3087
  }
3071
- async function Un() {
3088
+ async function An() {
3072
3089
  var r;
3073
- const e = Te();
3090
+ const e = Ce();
3074
3091
  let t = !1;
3075
3092
  try {
3076
3093
  (r = navigator.clipboard) != null && r.writeText && (await navigator.clipboard.writeText(e), t = !0);
3077
3094
  } catch {
3078
3095
  t = !1;
3079
3096
  }
3080
- return t || (t = ua(e)), t ? (Se.value = !0, window.clearTimeout(It), It = window.setTimeout(() => {
3097
+ return t || (t = ca(e)), t ? (Se.value = !0, window.clearTimeout(It), It = window.setTimeout(() => {
3081
3098
  Se.value = !1;
3082
- }, 1600), i("copy", e), !0) : (h("复制失败,请手动选择代码复制"), !1);
3099
+ }, 1600), i("copy", e), !0) : (g("复制失败,请手动选择代码复制"), !1);
3083
3100
  }
3084
- function ua(e) {
3101
+ function ca(e) {
3085
3102
  const t = document.createElement("textarea");
3086
3103
  t.value = e, t.setAttribute("readonly", ""), t.style.position = "fixed", t.style.top = "0", t.style.left = "-9999px", t.style.opacity = "0", document.body.appendChild(t), t.select(), t.setSelectionRange(0, t.value.length);
3087
3104
  let r = !1;
@@ -3092,36 +3109,36 @@ const Vs = Z(
3092
3109
  }
3093
3110
  return t.remove(), r;
3094
3111
  }
3095
- function An() {
3112
+ function Dn() {
3096
3113
  const e = w.value, t = Vt(e.name, e.language);
3097
3114
  Ie.value = t;
3098
- const r = new Blob([Te()], {
3115
+ const r = new Blob([Ce()], {
3099
3116
  type: e.language === "python" ? "text/x-python;charset=utf-8" : "text/plain;charset=utf-8"
3100
3117
  }), u = URL.createObjectURL(r), c = document.createElement("a");
3101
3118
  return c.href = u, c.download = t, c.style.display = "none", document.body.appendChild(c), c.click(), c.remove(), window.setTimeout(() => URL.revokeObjectURL(u), 1e3), i("download", t), t;
3102
3119
  }
3103
- function ca() {
3104
- De.value = !De.value, De.value && (xe.value = !1, Dn());
3120
+ function da() {
3121
+ ze.value = !ze.value, ze.value && (xe.value = !1, zn());
3105
3122
  }
3106
- async function Dn() {
3123
+ async function zn() {
3107
3124
  var e;
3108
3125
  if (!Xe.value) {
3109
3126
  Xe.value = !0;
3110
3127
  try {
3111
- const t = await j.listFiles(".");
3128
+ const t = await V.listFiles(".");
3112
3129
  if (!t.ok) {
3113
- et.value = [], h(`读取虚拟文件失败:${((e = t.error) == null ? void 0 : e.message) ?? "未知错误"}`);
3130
+ et.value = [], g(`读取虚拟文件失败:${((e = t.error) == null ? void 0 : e.message) ?? "未知错误"}`);
3114
3131
  return;
3115
3132
  }
3116
3133
  et.value = t.entries ?? [];
3117
3134
  } catch (t) {
3118
- et.value = [], h(`读取虚拟文件失败:${t instanceof Error ? t.message : String(t)}`);
3135
+ et.value = [], g(`读取虚拟文件失败:${t instanceof Error ? t.message : String(t)}`);
3119
3136
  } finally {
3120
3137
  Xe.value = !1;
3121
3138
  }
3122
3139
  }
3123
3140
  }
3124
- function da(e) {
3141
+ function pa(e) {
3125
3142
  switch (e.slice(e.lastIndexOf(".") + 1).toLowerCase()) {
3126
3143
  case "csv":
3127
3144
  return "text/csv";
@@ -3141,47 +3158,47 @@ const Vs = Z(
3141
3158
  function Gt(e) {
3142
3159
  return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / 1024 / 1024).toFixed(1)} MB`;
3143
3160
  }
3144
- async function zn(e) {
3161
+ async function jn(e) {
3145
3162
  var t;
3146
3163
  try {
3147
- const r = await j.readFile(e);
3164
+ const r = await V.readFile(e);
3148
3165
  if (!r.ok || r.content === void 0)
3149
- return h(`下载失败:${e}(${((t = r.error) == null ? void 0 : t.message) ?? "未知错误"})`), null;
3166
+ return g(`下载失败:${e}(${((t = r.error) == null ? void 0 : t.message) ?? "未知错误"})`), null;
3150
3167
  const u = e.slice(e.lastIndexOf("/") + 1) || "download.txt", c = new Blob([r.content], {
3151
- type: `${da(u)};charset=utf-8`
3152
- }), y = URL.createObjectURL(c), S = document.createElement("a");
3153
- return S.href = y, S.download = u, S.style.display = "none", document.body.appendChild(S), S.click(), S.remove(), window.setTimeout(() => URL.revokeObjectURL(y), 1e3), i("fsDownload", { path: r.path ?? e, name: u }), h(`已下载虚拟文件:${u}`), u;
3168
+ type: `${pa(u)};charset=utf-8`
3169
+ }), h = URL.createObjectURL(c), S = document.createElement("a");
3170
+ return S.href = h, S.download = u, S.style.display = "none", document.body.appendChild(S), S.click(), S.remove(), window.setTimeout(() => URL.revokeObjectURL(h), 1e3), i("fsDownload", { path: r.path ?? e, name: u }), g(`已下载虚拟文件:${u}`), u;
3154
3171
  } catch (r) {
3155
- return h(`下载失败:${r instanceof Error ? r.message : String(r)}`), null;
3172
+ return g(`下载失败:${r instanceof Error ? r.message : String(r)}`), null;
3156
3173
  }
3157
3174
  }
3158
- function pa(e, t) {
3159
- return j.writeFile(e, t);
3175
+ function fa(e, t) {
3176
+ return V.writeFile(e, t);
3160
3177
  }
3161
- function fa(e) {
3162
- return j.readFile(e);
3178
+ function va(e) {
3179
+ return V.readFile(e);
3163
3180
  }
3164
- function va(e = ".") {
3165
- return j.listFiles(e);
3181
+ function ma(e = ".") {
3182
+ return V.listFiles(e);
3166
3183
  }
3167
3184
  function St(e) {
3168
3185
  return e instanceof Error ? e.message : String(e);
3169
3186
  }
3170
- function ma(e) {
3187
+ function ya(e) {
3171
3188
  if (!e) return "";
3172
3189
  const t = new Date(e);
3173
3190
  return Number.isNaN(t.getTime()) ? e : `更新时间:${t.toLocaleString()}`;
3174
3191
  }
3175
- function ga() {
3176
- xe.value = !xe.value, xe.value && (De.value = !1, Ye());
3192
+ function ha() {
3193
+ xe.value = !xe.value, xe.value && (ze.value = !1, Ye());
3177
3194
  }
3178
3195
  async function Ye() {
3179
- if (!Oe.value) return;
3196
+ if (!Me.value) return;
3180
3197
  oe == null || oe.abort();
3181
3198
  const e = new AbortController();
3182
- oe = e, ft.value = !0, ze.value = "";
3199
+ oe = e, ft.value = !0, je.value = "";
3183
3200
  try {
3184
- const t = await Os(o.filesEndpoint, {
3201
+ const t = await Ms(o.filesEndpoint, {
3185
3202
  headers: o.filesHeaders,
3186
3203
  signal: e.signal
3187
3204
  });
@@ -3189,204 +3206,206 @@ const Vs = Z(
3189
3206
  tt.value = t;
3190
3207
  } catch (t) {
3191
3208
  if (oe !== e) return;
3192
- tt.value = [], ze.value = St(t);
3209
+ tt.value = [], je.value = St(t);
3193
3210
  } finally {
3194
3211
  oe === e && (oe = null, ft.value = !1);
3195
3212
  }
3196
3213
  }
3197
- async function jn() {
3198
- if (!Oe.value)
3199
- return h("未配置文件服务端点(filesEndpoint)"), null;
3214
+ async function Vn() {
3215
+ if (!Me.value)
3216
+ return g("未配置文件服务端点(filesEndpoint)"), null;
3200
3217
  if (W.value) return null;
3201
3218
  const e = w.value, t = Vt(e.name, e.language);
3202
3219
  t !== e.name && (Ie.value = t), W.value = !0;
3203
3220
  try {
3204
- const r = await Ms(
3221
+ const r = await Ns(
3205
3222
  o.filesEndpoint,
3206
- { name: t, content: Te() },
3223
+ { name: t, content: Ce() },
3207
3224
  { headers: o.filesHeaders }
3208
3225
  );
3209
- return h(`已保存到服务端:${r.name}(${Gt(r.size)})`), xe.value && await Ye(), r;
3226
+ return g(`已保存到服务端:${r.name}(${Gt(r.size)})`), xe.value && await Ye(), r;
3210
3227
  } catch (r) {
3211
- return h(`保存到服务端失败:${St(r)}`), null;
3228
+ return g(`保存到服务端失败:${St(r)}`), null;
3212
3229
  } finally {
3213
3230
  W.value = !1;
3214
3231
  }
3215
3232
  }
3216
- async function ya(e) {
3217
- if (!Oe.value || W.value) return !1;
3233
+ async function ga(e) {
3234
+ if (!Me.value || W.value) return !1;
3218
3235
  W.value = !0;
3219
3236
  try {
3220
3237
  const t = await Ts(o.filesEndpoint, e.id, {
3221
3238
  headers: o.filesHeaders
3222
- }), r = cr(t.name), u = Ke(Sn(t.name), r, t.content);
3223
- return L.value.push(u), He(u.id), h(`已从服务端打开文件:${t.name}`), i("fileOpen", { name: u.name, code: t.content, language: r }), !0;
3239
+ }), r = dr(t.name), u = Je(Sn(t.name), r, t.content);
3240
+ return F.value.push(u), Be(u.id), g(`已从服务端打开文件:${t.name}`), i("fileOpen", { name: u.name, code: t.content, language: r }), !0;
3224
3241
  } catch (t) {
3225
- return h(`打开服务端文件失败:${St(t)}`), !1;
3242
+ return g(`打开服务端文件失败:${St(t)}`), !1;
3226
3243
  } finally {
3227
3244
  W.value = !1;
3228
3245
  }
3229
3246
  }
3230
- async function ha(e) {
3231
- if (!(!Oe.value || W.value) && !(typeof window < "u" && !window.confirm(`确定删除服务端文件“${e.name}”?`))) {
3247
+ async function ba(e) {
3248
+ if (!(!Me.value || W.value) && !(typeof window < "u" && !window.confirm(`确定删除服务端文件“${e.name}”?`))) {
3232
3249
  W.value = !0;
3233
3250
  try {
3234
- await Ns(o.filesEndpoint, e.id, { headers: o.filesHeaders }), h(`已删除服务端文件:${e.name}`), await Ye();
3251
+ await Fs(o.filesEndpoint, e.id, { headers: o.filesHeaders }), g(`已删除服务端文件:${e.name}`), await Ye();
3235
3252
  } catch (t) {
3236
- h(`删除服务端文件失败:${St(t)}`);
3253
+ g(`删除服务端文件失败:${St(t)}`);
3237
3254
  } finally {
3238
3255
  W.value = !1;
3239
3256
  }
3240
3257
  }
3241
3258
  }
3242
- function Vn() {
3259
+ function Qn() {
3243
3260
  var e;
3244
- (e = N.value) == null || e.click();
3261
+ (e = T.value) == null || e.click();
3245
3262
  }
3246
- async function ba(e) {
3263
+ async function ka(e) {
3247
3264
  var u;
3248
3265
  const t = e.target, r = (u = t.files) == null ? void 0 : u[0];
3249
3266
  if (t.value = "", !!r) {
3250
3267
  if (r.size > 2 * 1024 * 1024) {
3251
- h(`文件过大:${(r.size / 1024 / 1024).toFixed(1)} MB(最多 2 MB)`);
3268
+ g(`文件过大:${(r.size / 1024 / 1024).toFixed(1)} MB(最多 2 MB)`);
3252
3269
  return;
3253
3270
  }
3254
3271
  try {
3255
- const c = await r.text(), y = cr(r.name), S = Ke(Sn(r.name), y, c);
3256
- L.value.push(S), He(S.id), h(`已打开文件:${S.name}`), i("fileOpen", { name: S.name, code: c, language: y });
3272
+ const c = await r.text(), h = dr(r.name), S = Je(Sn(r.name), h, c);
3273
+ F.value.push(S), Be(S.id), g(`已打开文件:${S.name}`), i("fileOpen", { name: S.name, code: c, language: h });
3257
3274
  } catch (c) {
3258
- const y = c instanceof Error ? c.message : String(c);
3259
- h(`读取文件失败:${y}`);
3275
+ const h = c instanceof Error ? c.message : String(c);
3276
+ g(`读取文件失败:${h}`);
3260
3277
  }
3261
3278
  }
3262
3279
  }
3263
- function ka() {
3280
+ function wa() {
3264
3281
  Ie.value = Vt(Ie.value, w.value.language);
3265
3282
  }
3266
- function wa(e) {
3283
+ function Sa(e) {
3267
3284
  e.key === "Enter" && (e.preventDefault(), e.target.blur());
3268
3285
  }
3269
- function Sa(e) {
3286
+ function xa(e) {
3270
3287
  jt(e.target.value);
3271
3288
  }
3272
- function xa(e) {
3289
+ function Ea(e) {
3273
3290
  const t = e.target.value;
3274
- t !== z.value && (z.value = t, P == null || P.dispatch({
3275
- effects: Ht.reconfigure(Tt(ut(t)))
3291
+ t !== j.value && (j.value = t, P == null || P.dispatch({
3292
+ effects: Ht.reconfigure(Nt(ut(t)))
3276
3293
  }), i("update:theme", t));
3277
3294
  }
3278
- async function Qn(e) {
3295
+ async function Kn(e) {
3279
3296
  var t, r;
3280
- await Zn(), (r = (t = O.value) == null ? void 0 : t.querySelector(`[data-file-id="${e}"]`)) == null || r.focus();
3297
+ await Gn(), (r = (t = M.value) == null ? void 0 : t.querySelector(`[data-file-id="${e}"]`)) == null || r.focus();
3281
3298
  }
3282
- function Ea(e, t) {
3299
+ function qa(e, t) {
3283
3300
  if (e.target !== e.currentTarget) return;
3284
3301
  if (e.key === "Enter" || e.key === " ") {
3285
- e.preventDefault(), He(t.id), Qn(t.id);
3302
+ e.preventDefault(), Be(t.id), Kn(t.id);
3286
3303
  return;
3287
3304
  }
3288
3305
  if (e.key !== "ArrowLeft" && e.key !== "ArrowRight") return;
3289
3306
  e.preventDefault();
3290
- const r = L.value.findIndex((y) => y.id === t.id);
3307
+ const r = F.value.findIndex((h) => h.id === t.id);
3291
3308
  if (r < 0) return;
3292
- const u = e.key === "ArrowLeft" ? -1 : 1, c = L.value[(r + u + L.value.length) % L.value.length];
3293
- c && (He(c.id), Qn(c.id));
3309
+ const u = e.key === "ArrowLeft" ? -1 : 1, c = F.value[(r + u + F.value.length) % F.value.length];
3310
+ c && (Be(c.id), Kn(c.id));
3294
3311
  }
3295
3312
  function xt() {
3296
3313
  P == null || P.focus();
3297
3314
  }
3298
- async function qa(e) {
3315
+ async function Ca(e) {
3299
3316
  var r;
3300
- h(`正在安装:${e.join(", ")}`);
3317
+ g(`正在安装:${e.join(", ")}`);
3301
3318
  let t;
3302
3319
  try {
3303
- t = await j.loadPackages(e, {
3304
- onOutput: (u, c) => ge(u, c)
3320
+ t = await V.loadPackages(e, {
3321
+ onOutput: (u, c) => ye(u, c)
3305
3322
  });
3306
3323
  } catch (u) {
3307
3324
  const c = u instanceof Error ? u.message : String(u);
3308
- return h(`安装失败:${c}`), { ok: !1, durationMs: 0, error: { type: "RuntimeError", message: c } };
3325
+ return g(`安装失败:${c}`), { ok: !1, durationMs: 0, error: { type: "RuntimeError", message: c } };
3309
3326
  }
3310
- return h(t.ok ? "安装完成" : `安装失败:${((r = t.error) == null ? void 0 : r.message) ?? "未知错误"}`), t;
3311
- }
3312
- function Ca() {
3313
- return j.checkSyntax(Te());
3327
+ return g(t.ok ? "安装完成" : `安装失败:${((r = t.error) == null ? void 0 : r.message) ?? "未知错误"}`), t;
3314
3328
  }
3315
3329
  function Pa() {
3316
- return D(f.value);
3330
+ return V.checkSyntax(Ce());
3317
3331
  }
3318
3332
  function Oa() {
3319
- return P;
3333
+ return D(v.value);
3320
3334
  }
3321
3335
  function Ma() {
3322
- return L.value.map(Ge);
3336
+ return P;
3337
+ }
3338
+ function Na() {
3339
+ return F.value.map(He);
3323
3340
  }
3324
3341
  function Ta() {
3325
- return Ge(w.value);
3342
+ return He(w.value);
3326
3343
  }
3327
3344
  return n({
3328
- run: Nn,
3345
+ submit: Tn,
3346
+ run: Fn,
3329
3347
  stop: Ln,
3330
3348
  clearOutput: _n,
3331
- clearCode: Bn,
3349
+ clearCode: Un,
3332
3350
  newFile: Jt,
3333
- switchFile: He,
3334
- closeFile: Hn,
3335
- copyCode: Un,
3336
- download: An,
3337
- openFile: Vn,
3351
+ switchFile: Be,
3352
+ closeFile: Bn,
3353
+ copyCode: An,
3354
+ download: Dn,
3355
+ openFile: Qn,
3338
3356
  focus: xt,
3339
- install: qa,
3340
- checkSyntax: Ca,
3341
- executeSql: Yr,
3342
- getSqlConfig: Pa,
3343
- openSqlConfig: Br,
3357
+ install: Ca,
3358
+ checkSyntax: Pa,
3359
+ executeSql: Xr,
3360
+ getSqlConfig: Oa,
3361
+ openSqlConfig: Ur,
3344
3362
  closeSqlConfig: xn,
3345
- getEditorView: Oa,
3346
- getCode: Te,
3363
+ getEditorView: Ma,
3364
+ getCode: Ce,
3347
3365
  setCode: kt,
3348
- getFiles: Ma,
3366
+ getFiles: Na,
3349
3367
  getActiveFile: Ta,
3350
- writeFile: pa,
3351
- readFile: fa,
3352
- listFiles: va,
3353
- downloadFile: zn,
3354
- saveToServer: jn,
3368
+ writeFile: fa,
3369
+ readFile: va,
3370
+ listFiles: ma,
3371
+ downloadFile: jn,
3372
+ saveToServer: Vn,
3355
3373
  refreshServerFiles: Ye,
3356
3374
  clearPersistedState: _r
3357
- }), (e, t) => (m(), g("div", {
3375
+ }), (e, t) => (p(), m("div", {
3358
3376
  ref_key: "rootEl",
3359
- ref: p,
3360
- class: le(["vpe-root", qr.value]),
3361
- style: Gn(Er.value)
3377
+ ref: f,
3378
+ class: le(["vpe-root", Cr.value]),
3379
+ style: Wn(qr.value)
3362
3380
  }, [
3363
- s.showToolbar ? (m(), g("div", to, [
3364
- l("div", no, [
3365
- Dt.value ? (m(), g("button", {
3381
+ s.showToolbar ? (p(), m("div", ro, [
3382
+ l("div", ao, [
3383
+ Dt.value ? (p(), m("button", {
3366
3384
  key: 1,
3367
3385
  class: "vpe-btn vpe-btn--stop",
3368
3386
  type: "button",
3369
3387
  title: "中断执行",
3370
3388
  onClick: Ln
3371
3389
  }, [
3372
- V(B(Qs)),
3390
+ z(H(Ks)),
3373
3391
  t[19] || (t[19] = l("span", null, "停止", -1))
3374
- ])) : (m(), g("button", {
3392
+ ])) : (p(), m("button", {
3375
3393
  key: 0,
3376
3394
  class: "vpe-btn vpe-btn--primary",
3377
3395
  type: "button",
3378
- title: Or.value,
3379
- disabled: Mr.value,
3380
- onClick: Nn
3396
+ title: Mr.value,
3397
+ disabled: Nr.value,
3398
+ onClick: Fn
3381
3399
  }, [
3382
- V(B(Vs)),
3400
+ z(H(Qs)),
3383
3401
  t[18] || (t[18] = l("span", null, "运行", -1))
3384
- ], 8, ro)),
3402
+ ], 8, so)),
3385
3403
  t[28] || (t[28] = l("span", {
3386
3404
  class: "vpe-divider",
3387
3405
  "aria-hidden": "true"
3388
3406
  }, null, -1)),
3389
- l("button", {
3407
+ s.showNewFile ? (p(), m("button", {
3408
+ key: 2,
3390
3409
  class: "vpe-btn",
3391
3410
  type: "button",
3392
3411
  title: "新建文件",
@@ -3394,181 +3413,184 @@ const Vs = Z(
3394
3413
  disabled: s.readOnly,
3395
3414
  onClick: Jt
3396
3415
  }, [
3397
- V(B(Ks)),
3416
+ z(H(Js)),
3398
3417
  t[20] || (t[20] = l("span", null, "新建", -1))
3399
- ], 8, ao),
3400
- l("button", {
3418
+ ], 8, oo)) : O("", !0),
3419
+ s.showOpenFile ? (p(), m("button", {
3420
+ key: 3,
3401
3421
  class: "vpe-btn",
3402
3422
  type: "button",
3403
3423
  title: "打开本地文件",
3404
3424
  "aria-label": "打开本地文件",
3405
3425
  disabled: s.readOnly,
3406
- onClick: Vn
3426
+ onClick: Qn
3407
3427
  }, [
3408
- V(B(Js)),
3428
+ z(H(Zs)),
3409
3429
  t[21] || (t[21] = l("span", null, "本地文件", -1))
3410
- ], 8, so),
3411
- l("button", {
3430
+ ], 8, io)) : O("", !0),
3431
+ s.showDownload ? (p(), m("button", {
3432
+ key: 4,
3412
3433
  class: "vpe-btn",
3413
3434
  type: "button",
3414
3435
  title: "下载当前文件",
3415
3436
  "aria-label": "下载当前文件",
3416
- onClick: An
3437
+ onClick: Dn
3417
3438
  }, [
3418
- V(B(fr)),
3439
+ z(H(vr)),
3419
3440
  t[22] || (t[22] = l("span", null, "下载", -1))
3420
- ]),
3421
- l("button", {
3441
+ ])) : O("", !0),
3442
+ s.showVirtualFiles ? (p(), m("button", {
3443
+ key: 5,
3422
3444
  class: "vpe-btn vpe-toolbar-secondary",
3423
3445
  type: "button",
3424
3446
  title: "虚拟文件(下载 Python 生成的文件)",
3425
3447
  "aria-label": "虚拟文件",
3426
- onClick: ca
3448
+ onClick: da
3427
3449
  }, [
3428
- V(B(pr)),
3450
+ z(H(fr)),
3429
3451
  t[23] || (t[23] = l("span", null, "虚拟文件", -1))
3430
- ]),
3431
- Oe.value ? (m(), g("button", {
3432
- key: 2,
3452
+ ])) : O("", !0),
3453
+ Me.value ? (p(), m("button", {
3454
+ key: 6,
3433
3455
  class: "vpe-btn",
3434
3456
  type: "button",
3435
3457
  title: W.value ? "正在处理服务端文件…" : "保存当前文件到服务端",
3436
3458
  "aria-label": "保存到服务端",
3437
3459
  disabled: W.value,
3438
- onClick: jn
3460
+ onClick: Vn
3439
3461
  }, [
3440
- V(B(Xs)),
3462
+ z(H(to)),
3441
3463
  t[24] || (t[24] = l("span", null, "保存", -1))
3442
- ], 8, oo)) : T("", !0),
3443
- Oe.value ? (m(), g("button", {
3444
- key: 3,
3464
+ ], 8, lo)) : O("", !0),
3465
+ Me.value ? (p(), m("button", {
3466
+ key: 7,
3445
3467
  class: "vpe-btn vpe-toolbar-secondary",
3446
3468
  type: "button",
3447
3469
  title: "查询服务端已保存文件",
3448
3470
  "aria-label": "已保存文件",
3449
- onClick: ga
3471
+ onClick: ha
3450
3472
  }, [
3451
- V(B(eo)),
3473
+ z(H(no)),
3452
3474
  t[25] || (t[25] = l("span", null, "已保存文件", -1))
3453
- ])) : T("", !0),
3454
- s.showSqlConfig && pe.value ? (m(), g("button", {
3455
- key: 4,
3475
+ ])) : O("", !0),
3476
+ s.showSqlConfig && pe.value ? (p(), m("button", {
3477
+ key: 8,
3456
3478
  class: "vpe-btn",
3457
3479
  type: "button",
3458
3480
  title: "新建连接",
3459
3481
  "aria-label": "新建连接",
3460
- onClick: Ar
3482
+ onClick: Dr
3461
3483
  }, [
3462
- V(B(Ys)),
3484
+ z(H(eo)),
3463
3485
  t[26] || (t[26] = l("span", null, "新建连接", -1))
3464
- ])) : T("", !0),
3486
+ ])) : O("", !0),
3465
3487
  l("button", {
3466
3488
  class: le(["vpe-btn", { "vpe-btn--copied": Se.value }]),
3467
3489
  type: "button",
3468
3490
  title: Se.value ? "已复制" : "复制代码",
3469
3491
  "aria-label": Se.value ? "已复制" : "复制代码",
3470
- onClick: Un
3492
+ onClick: An
3471
3493
  }, [
3472
- Se.value ? (m(), Wn(B(Gs), { key: 0 })) : (m(), Wn(B(Zs), { key: 1 })),
3473
- Se.value ? (m(), g("span", lo, "已复制")) : (m(), g("span", uo, "复制"))
3474
- ], 10, io),
3494
+ Se.value ? (p(), Yn(H(Ys), { key: 0 })) : (p(), Yn(H(Gs), { key: 1 })),
3495
+ Se.value ? (p(), m("span", co, "已复制")) : (p(), m("span", po, "复制"))
3496
+ ], 10, uo),
3475
3497
  l("button", {
3476
3498
  class: "vpe-btn",
3477
3499
  type: "button",
3478
3500
  title: "清空当前文件",
3479
3501
  "aria-label": "清空当前文件",
3480
3502
  disabled: s.readOnly,
3481
- onClick: Bn
3503
+ onClick: Un
3482
3504
  }, [
3483
- V(B(dr)),
3505
+ z(H(pr)),
3484
3506
  t[27] || (t[27] = l("span", null, "清空", -1))
3485
- ], 8, co),
3507
+ ], 8, fo),
3486
3508
  t[29] || (t[29] = l("span", {
3487
3509
  class: "vpe-divider",
3488
3510
  "aria-hidden": "true"
3489
3511
  }, null, -1)),
3490
- l("label", po, [
3491
- V(B(pr)),
3492
- J(l("input", {
3512
+ l("label", vo, [
3513
+ z(H(fr)),
3514
+ Z(l("input", {
3493
3515
  "onUpdate:modelValue": t[0] || (t[0] = (r) => Ie.value = r),
3494
3516
  class: "vpe-file-input",
3495
3517
  type: "text",
3496
3518
  spellcheck: "false",
3497
3519
  "aria-label": "文件名",
3498
- onBlur: ka,
3499
- onKeydown: wa
3520
+ onBlur: wa,
3521
+ onKeydown: Sa
3500
3522
  }, null, 544), [
3501
- [he, Ie.value]
3523
+ [ge, Ie.value]
3502
3524
  ])
3503
3525
  ]),
3504
3526
  l("select", {
3505
3527
  class: "vpe-toolbar-select",
3506
- value: z.value,
3528
+ value: j.value,
3507
3529
  title: "编辑器主题",
3508
3530
  "aria-label": "编辑器主题",
3509
- onChange: xa
3531
+ onChange: Ea
3510
3532
  }, [
3511
- (m(!0), g(A, null, te(B(ln), (r) => (m(), g("option", {
3533
+ (p(!0), m(A, null, te(H(ln), (r) => (p(), m("option", {
3512
3534
  key: r.value,
3513
3535
  value: r.value
3514
- }, R(r.label), 9, vo))), 128))
3515
- ], 40, fo)
3536
+ }, _(r.label), 9, yo))), 128))
3537
+ ], 40, mo)
3516
3538
  ]),
3517
- l("div", mo, [
3518
- s.showSqlConfig && pe.value && (f.value.mode === "http" || f.value.endpoint) ? (m(), g(A, { key: 0 }, [
3519
- J(l("select", {
3520
- "onUpdate:modelValue": t[1] || (t[1] = (r) => f.value.connectionId = r),
3539
+ l("div", ho, [
3540
+ s.showSqlConfig && pe.value && (v.value.mode === "http" || v.value.endpoint) ? (p(), m("div", go, [
3541
+ Z(l("select", {
3542
+ "onUpdate:modelValue": t[1] || (t[1] = (r) => v.value.connectionId = r),
3521
3543
  class: "vpe-select vpe-sql-connection",
3522
3544
  title: "切换已保存连接",
3523
3545
  "aria-label": "切换已保存连接",
3524
- disabled: je.value,
3525
- onChange: jr
3546
+ disabled: Ve.value,
3547
+ onChange: Vr
3526
3548
  }, [
3527
- l("option", yo, R(je.value ? "加载中…" : Ce.value.length ? "选择连接" : "暂无已保存连接"), 1),
3528
- (m(!0), g(A, null, te(Ce.value, (r) => (m(), g("option", {
3549
+ l("option", ko, _(Ve.value ? "加载中…" : Pe.value.length ? "选择连接" : "暂无已保存连接"), 1),
3550
+ (p(!0), m(A, null, te(Pe.value, (r) => (p(), m("option", {
3529
3551
  key: r.id,
3530
3552
  value: r.id
3531
- }, R(r.name), 9, ho))), 128))
3532
- ], 40, go), [
3533
- [Et, f.value.connectionId]
3553
+ }, _(r.name), 9, wo))), 128))
3554
+ ], 40, bo), [
3555
+ [Et, v.value.connectionId]
3534
3556
  ]),
3535
3557
  l("button", {
3536
3558
  class: "vpe-btn vpe-btn--sm vpe-sql-manage",
3537
3559
  type: "button",
3538
3560
  title: "管理连接配置",
3539
3561
  "aria-label": "管理连接配置",
3540
- onClick: Ur
3562
+ onClick: Ar
3541
3563
  }, " 管理 ")
3542
- ], 64)) : T("", !0),
3543
- l("div", bo, [
3564
+ ])) : O("", !0),
3565
+ l("div", So, [
3544
3566
  l("span", {
3545
- class: le(["vpe-status", `vpe-status--${Pr.value}`]),
3567
+ class: le(["vpe-status", `vpe-status--${Or.value}`]),
3546
3568
  title: bn.value
3547
3569
  }, [
3548
3570
  t[30] || (t[30] = l("span", {
3549
3571
  class: "vpe-status-dot",
3550
3572
  "aria-hidden": "true"
3551
3573
  }, null, -1)),
3552
- l("span", wo, R(bn.value), 1)
3553
- ], 10, ko),
3554
- bt.value && hn.value ? (m(), g(A, { key: 0 }, [
3574
+ l("span", Eo, _(bn.value), 1)
3575
+ ], 10, xo),
3576
+ bt.value && gn.value ? (p(), m(A, { key: 0 }, [
3555
3577
  t[32] || (t[32] = l("span", {
3556
3578
  class: "vpe-chips-divider",
3557
3579
  "aria-hidden": "true"
3558
3580
  }, null, -1)),
3559
- J(l("select", {
3581
+ Z(l("select", {
3560
3582
  "onUpdate:modelValue": t[2] || (t[2] = (r) => ce.value = r),
3561
3583
  class: "vpe-toolbar-select",
3562
3584
  title: "Python 运行环境",
3563
3585
  "aria-label": "Python 运行环境",
3564
- onChange: Xr
3586
+ onChange: ea
3565
3587
  }, [...t[31] || (t[31] = [
3566
3588
  l("option", { value: "browser" }, "浏览器", -1),
3567
3589
  l("option", { value: "server" }, "服务端", -1)
3568
3590
  ])], 544), [
3569
3591
  [Et, ce.value]
3570
3592
  ])
3571
- ], 64)) : T("", !0),
3593
+ ], 64)) : O("", !0),
3572
3594
  t[33] || (t[33] = l("span", {
3573
3595
  class: "vpe-chips-divider",
3574
3596
  "aria-hidden": "true"
@@ -3579,25 +3601,25 @@ const Vs = Z(
3579
3601
  title: "编辑器语言",
3580
3602
  "aria-label": "编辑器语言",
3581
3603
  disabled: s.readOnly,
3582
- onChange: Sa
3604
+ onChange: xa
3583
3605
  }, [
3584
- (m(!0), g(A, null, te(B($t), (r) => (m(), g("option", {
3606
+ (p(!0), m(A, null, te(H(Lt), (r) => (p(), m("option", {
3585
3607
  key: r.value,
3586
3608
  value: r.value
3587
- }, R(r.label), 9, xo))), 128))
3588
- ], 40, So)
3609
+ }, _(r.label), 9, Co))), 128))
3610
+ ], 40, qo)
3589
3611
  ])
3590
3612
  ])
3591
- ])) : T("", !0),
3592
- s.showTabs ? (m(), g("div", {
3613
+ ])) : O("", !0),
3614
+ s.showTabs ? (p(), m("div", {
3593
3615
  key: 1,
3594
3616
  ref_key: "tabsEl",
3595
- ref: O,
3617
+ ref: M,
3596
3618
  class: "vpe-tabs",
3597
3619
  role: "tablist",
3598
3620
  "aria-label": "文件"
3599
3621
  }, [
3600
- (m(!0), g(A, null, te(L.value, (r) => (m(), g("div", {
3622
+ (p(!0), m(A, null, te(F.value, (r) => (p(), m("div", {
3601
3623
  key: r.id,
3602
3624
  class: le(["vpe-tab", { "vpe-tab--active": r.id === w.value.id }]),
3603
3625
  role: "tab",
@@ -3605,26 +3627,27 @@ const Vs = Z(
3605
3627
  "aria-selected": r.id === w.value.id,
3606
3628
  "data-file-id": r.id,
3607
3629
  title: r.name,
3608
- onClick: (u) => He(r.id),
3609
- onKeydown: (u) => Ea(u, r)
3630
+ onClick: (u) => Be(r.id),
3631
+ onKeydown: (u) => qa(u, r)
3610
3632
  }, [
3611
3633
  l("span", {
3612
3634
  class: le(["vpe-tab-dot", `vpe-tab-dot--${r.language}`]),
3613
3635
  "aria-hidden": "true"
3614
3636
  }, null, 2),
3615
- l("span", qo, R(r.name), 1),
3637
+ l("span", Oo, _(r.name), 1),
3616
3638
  l("button", {
3617
3639
  class: "vpe-tab-close",
3618
3640
  type: "button",
3619
3641
  title: `关闭 ${r.name}`,
3620
3642
  "aria-label": `关闭 ${r.name}`,
3621
3643
  disabled: s.readOnly,
3622
- onClick: Yn((u) => Hn(r.id), ["stop"])
3644
+ onClick: Xn((u) => Bn(r.id), ["stop"])
3623
3645
  }, [
3624
- V(B(ct))
3625
- ], 8, Co)
3626
- ], 42, Eo))), 128)),
3627
- l("button", {
3646
+ z(H(ct))
3647
+ ], 8, Mo)
3648
+ ], 42, Po))), 128)),
3649
+ s.showNewFile ? (p(), m("button", {
3650
+ key: 0,
3628
3651
  class: "vpe-tabs-add",
3629
3652
  type: "button",
3630
3653
  title: "新建文件",
@@ -3632,42 +3655,42 @@ const Vs = Z(
3632
3655
  disabled: s.readOnly,
3633
3656
  onClick: Jt
3634
3657
  }, [
3635
- V(B(Ws))
3636
- ], 8, Po)
3637
- ], 512)) : T("", !0),
3658
+ z(H(Xs))
3659
+ ], 8, No)) : O("", !0)
3660
+ ], 512)) : O("", !0),
3638
3661
  l("input", {
3639
3662
  ref_key: "fileInputEl",
3640
- ref: N,
3663
+ ref: T,
3641
3664
  class: "vpe-file-hidden",
3642
3665
  type: "file",
3643
3666
  accept: ".py,.pyw,.sql,.js,.mjs,.cjs,.jsx,.ts,.json,.txt,text/x-python,text/plain,application/json",
3644
- onChange: ba
3667
+ onChange: ka
3645
3668
  }, null, 544),
3646
3669
  l("div", {
3647
3670
  ref_key: "editorEl",
3648
3671
  ref: b,
3649
3672
  class: "vpe-editor"
3650
3673
  }, null, 512),
3651
- s.showOutput ? (m(), g("div", {
3674
+ s.showOutput ? (p(), m("div", {
3652
3675
  key: 2,
3653
- class: le(["vpe-output-resizer", { "vpe-output-resizer--active": F.value }]),
3676
+ class: le(["vpe-output-resizer", { "vpe-output-resizer--active": $.value }]),
3654
3677
  role: "separator",
3655
3678
  "aria-orientation": "horizontal",
3656
3679
  "aria-label": "调整输出面板高度",
3657
3680
  title: "拖动调整输出高度,双击复位",
3658
3681
  tabindex: "0",
3659
- onPointerdown: sa,
3660
- onDblclick: oa,
3661
- onKeydown: ia
3662
- }, null, 34)) : T("", !0),
3663
- s.showOutput ? (m(), g("div", {
3682
+ onPointerdown: oa,
3683
+ onDblclick: ia,
3684
+ onKeydown: la
3685
+ }, null, 34)) : O("", !0),
3686
+ s.showOutput ? (p(), m("div", {
3664
3687
  key: 3,
3665
3688
  ref_key: "outputPanelEl",
3666
3689
  ref: E,
3667
3690
  class: "vpe-output",
3668
- style: Gn({ height: Cr.value })
3691
+ style: Wn({ height: Pr.value })
3669
3692
  }, [
3670
- l("div", Oo, [
3693
+ l("div", To, [
3671
3694
  t[34] || (t[34] = l("span", null, "输出", -1)),
3672
3695
  l("button", {
3673
3696
  class: "vpe-btn vpe-btn--sm",
@@ -3675,78 +3698,90 @@ const Vs = Z(
3675
3698
  title: "清空输出",
3676
3699
  onClick: _n
3677
3700
  }, [
3678
- V(B(dr))
3701
+ z(H(pr))
3679
3702
  ])
3680
3703
  ]),
3681
- l("div", Mo, [
3682
- me.value.length ? (m(), g("div", To, [
3683
- (m(!0), g(A, null, te(me.value, (r, u) => (m(), g("section", {
3704
+ l("div", Fo, [
3705
+ me.value.length ? (p(), m("div", Lo, [
3706
+ (p(!0), m(A, null, te(me.value, (r, u) => (p(), m("section", {
3684
3707
  key: u,
3685
3708
  class: "vpe-sql-result"
3686
3709
  }, [
3687
- l("div", No, [
3688
- l("span", null, "结果 " + R(u + 1), 1),
3689
- l("span", null, R(Wr(r)), 1)
3710
+ l("div", $o, [
3711
+ l("span", null, "结果 " + _(u + 1), 1),
3712
+ l("span", null, _(Yr(r)), 1)
3690
3713
  ]),
3691
- r.columns.length ? (m(), g("div", Lo, [
3692
- l("table", $o, [
3714
+ r.columns.length ? (p(), m("div", Ro, [
3715
+ l("table", _o, [
3693
3716
  l("thead", null, [
3694
3717
  l("tr", null, [
3695
- (m(!0), g(A, null, te(r.columns, (c, y) => (m(), g("th", { key: y }, R(c), 1))), 128))
3718
+ (p(!0), m(A, null, te(r.columns, (c, h) => (p(), m("th", { key: h }, _(c), 1))), 128))
3696
3719
  ])
3697
3720
  ]),
3698
3721
  l("tbody", null, [
3699
- (m(!0), g(A, null, te(r.rows, (c, y) => (m(), g("tr", { key: y }, [
3700
- (m(!0), g(A, null, te(c, (S, $) => (m(), g("td", {
3701
- key: $,
3722
+ (p(!0), m(A, null, te(r.rows, (c, h) => (p(), m("tr", { key: h }, [
3723
+ (p(!0), m(A, null, te(c, (S, L) => (p(), m("td", {
3724
+ key: L,
3702
3725
  class: le({ "vpe-sql-null": S === null })
3703
- }, R(Gr(S)), 3))), 128))
3726
+ }, _(Wr(S)), 3))), 128))
3704
3727
  ]))), 128))
3705
3728
  ])
3706
3729
  ]),
3707
- r.rows.length ? T("", !0) : (m(), g("div", Fo, "查询无数据"))
3708
- ])) : (m(), g("div", _o, "影响 " + R(r.affectedRows ?? 0) + " 行", 1))
3730
+ r.rows.length ? O("", !0) : (p(), m("div", Io, "查询无数据"))
3731
+ ])) : (p(), m("div", Ho, "影响 " + _(r.affectedRows ?? 0) + " 行", 1))
3709
3732
  ]))), 128))
3710
- ])) : T("", !0),
3733
+ ])) : O("", !0),
3711
3734
  l("pre", {
3712
3735
  ref_key: "outputEl",
3713
- ref: _,
3736
+ ref: R,
3714
3737
  class: "vpe-output-body"
3715
3738
  }, [
3716
- G.value.length ? (m(!0), g(A, { key: 0 }, te(G.value, (r) => (m(), g("span", {
3739
+ G.value.length ? (p(!0), m(A, { key: 0 }, te(G.value, (r) => (p(), m("span", {
3717
3740
  key: r.id,
3718
3741
  class: le(["vpe-line", `vpe-line--${r.stream}`])
3719
- }, R(r.text) + `
3720
- `, 3))), 128)) : (m(), g("span", Ro, "暂无输出,点击“运行”或按 Ctrl+Enter 执行代码"))
3742
+ }, _(r.text) + `
3743
+ `, 3))), 128)) : (p(), m("span", Bo, "暂无输出,点击“运行”或按 Ctrl+Enter 执行代码"))
3721
3744
  ], 512)
3722
3745
  ]),
3723
- Ze.value && Ae.value && Dt.value ? (m(), g("div", Io, [
3746
+ Ge.value && De.value && Dt.value ? (p(), m("div", Uo, [
3724
3747
  t[35] || (t[35] = l("span", {
3725
3748
  class: "vpe-terminal-prompt",
3726
3749
  "aria-hidden": "true"
3727
3750
  }, "›", -1)),
3728
- J(l("input", {
3729
- "onUpdate:modelValue": t[3] || (t[3] = (r) => H.value = r),
3751
+ Z(l("input", {
3752
+ "onUpdate:modelValue": t[3] || (t[3] = (r) => B.value = r),
3730
3753
  class: "vpe-terminal-field",
3731
3754
  type: "text",
3732
3755
  spellcheck: "false",
3733
3756
  placeholder: "输入后按 Enter 发送给 input()",
3734
3757
  "aria-label": "标准输入",
3735
- onKeydown: Ra(Yn(Mn, ["prevent"]), ["enter"])
3736
- }, null, 40, Ho), [
3737
- [he, H.value]
3758
+ onKeydown: Ia(Xn(Mn, ["prevent"]), ["enter"])
3759
+ }, null, 40, Ao), [
3760
+ [ge, B.value]
3738
3761
  ]),
3739
3762
  l("button", {
3740
3763
  class: "vpe-btn vpe-btn--sm",
3741
3764
  type: "button",
3742
3765
  onClick: Mn
3743
3766
  }, " 发送 ")
3744
- ])) : T("", !0)
3745
- ], 4)) : T("", !0),
3746
- De.value ? (m(), g("div", Bo, [
3747
- l("div", Uo, [
3748
- t[36] || (t[36] = l("span", { class: "vpe-fs-title" }, "虚拟文件", -1)),
3749
- t[37] || (t[37] = l("span", {
3767
+ ])) : O("", !0)
3768
+ ], 4)) : O("", !0),
3769
+ s.showSubmit ? (p(), m("div", Do, [
3770
+ l("button", {
3771
+ class: "vpe-btn vpe-btn--primary",
3772
+ type: "button",
3773
+ title: "提交当前代码",
3774
+ "aria-label": "提交当前代码",
3775
+ onClick: Tn
3776
+ }, [
3777
+ z(H(Ws)),
3778
+ t[36] || (t[36] = l("span", null, "提交", -1))
3779
+ ])
3780
+ ])) : O("", !0),
3781
+ ze.value ? (p(), m("div", zo, [
3782
+ l("div", jo, [
3783
+ t[37] || (t[37] = l("span", { class: "vpe-fs-title" }, "虚拟文件", -1)),
3784
+ t[38] || (t[38] = l("span", {
3750
3785
  class: "vpe-spacer",
3751
3786
  "aria-hidden": "true"
3752
3787
  }, null, -1)),
@@ -3755,48 +3790,48 @@ const Vs = Z(
3755
3790
  type: "button",
3756
3791
  title: "刷新文件列表",
3757
3792
  disabled: Xe.value,
3758
- onClick: Dn
3759
- }, " 刷新 ", 8, Ao),
3793
+ onClick: zn
3794
+ }, " 刷新 ", 8, Vo),
3760
3795
  l("button", {
3761
3796
  class: "vpe-btn vpe-btn--sm",
3762
3797
  type: "button",
3763
3798
  title: "关闭虚拟文件面板",
3764
3799
  "aria-label": "关闭虚拟文件面板",
3765
- onClick: t[4] || (t[4] = (r) => De.value = !1)
3800
+ onClick: t[4] || (t[4] = (r) => ze.value = !1)
3766
3801
  }, [
3767
- V(B(ct))
3802
+ z(H(ct))
3768
3803
  ])
3769
3804
  ]),
3770
- l("div", Do, [
3771
- Xe.value ? (m(), g("div", zo, "正在读取虚拟文件…")) : (m(), g(A, { key: 1 }, [
3772
- et.value.length ? T("", !0) : (m(), g("div", jo, " 暂无文件。运行 Python 代码创建文件后再刷新。 ")),
3773
- (m(!0), g(A, null, te(et.value, (r) => (m(), g("div", {
3805
+ l("div", Qo, [
3806
+ Xe.value ? (p(), m("div", Ko, "正在读取虚拟文件…")) : (p(), m(A, { key: 1 }, [
3807
+ et.value.length ? O("", !0) : (p(), m("div", Jo, " 暂无文件。运行 Python 代码创建文件后再刷新。 ")),
3808
+ (p(!0), m(A, null, te(et.value, (r) => (p(), m("div", {
3774
3809
  key: r.path,
3775
3810
  class: le(["vpe-fs-item", { "vpe-fs-item--dir": r.isDirectory }])
3776
3811
  }, [
3777
3812
  l("span", {
3778
3813
  class: "vpe-fs-name",
3779
3814
  title: r.path
3780
- }, R(r.path), 9, Vo),
3781
- l("span", Qo, R(r.isDirectory ? "目录" : Gt(r.size)), 1),
3782
- r.isDirectory ? T("", !0) : (m(), g("button", {
3815
+ }, _(r.path), 9, Zo),
3816
+ l("span", Go, _(r.isDirectory ? "目录" : Gt(r.size)), 1),
3817
+ r.isDirectory ? O("", !0) : (p(), m("button", {
3783
3818
  key: 0,
3784
3819
  class: "vpe-btn vpe-btn--sm",
3785
3820
  type: "button",
3786
3821
  title: `下载 ${r.name}`,
3787
3822
  "aria-label": `下载 ${r.name}`,
3788
- onClick: (u) => zn(r.path)
3823
+ onClick: (u) => jn(r.path)
3789
3824
  }, [
3790
- V(B(fr))
3791
- ], 8, Ko))
3825
+ z(H(vr))
3826
+ ], 8, Wo))
3792
3827
  ], 2))), 128))
3793
3828
  ], 64))
3794
3829
  ])
3795
- ])) : T("", !0),
3796
- xe.value && Oe.value ? (m(), g("div", Jo, [
3797
- l("div", Zo, [
3798
- t[38] || (t[38] = l("span", { class: "vpe-fs-title" }, "服务端文件", -1)),
3799
- t[39] || (t[39] = l("span", {
3830
+ ])) : O("", !0),
3831
+ xe.value && Me.value ? (p(), m("div", Yo, [
3832
+ l("div", Xo, [
3833
+ t[39] || (t[39] = l("span", { class: "vpe-fs-title" }, "服务端文件", -1)),
3834
+ t[40] || (t[40] = l("span", {
3800
3835
  class: "vpe-spacer",
3801
3836
  "aria-hidden": "true"
3802
3837
  }, null, -1)),
@@ -3806,7 +3841,7 @@ const Vs = Z(
3806
3841
  title: "刷新文件列表",
3807
3842
  disabled: ft.value,
3808
3843
  onClick: t[5] || (t[5] = (r) => Ye())
3809
- }, " 刷新 ", 8, Go),
3844
+ }, " 刷新 ", 8, ei),
3810
3845
  l("button", {
3811
3846
  class: "vpe-btn vpe-btn--sm",
3812
3847
  type: "button",
@@ -3814,47 +3849,47 @@ const Vs = Z(
3814
3849
  "aria-label": "关闭服务端文件面板",
3815
3850
  onClick: t[6] || (t[6] = (r) => xe.value = !1)
3816
3851
  }, [
3817
- V(B(ct))
3852
+ z(H(ct))
3818
3853
  ])
3819
3854
  ]),
3820
- l("div", Wo, [
3821
- ft.value ? (m(), g("div", Yo, "正在读取服务端文件…")) : (m(), g(A, { key: 1 }, [
3822
- !tt.value.length && !ze.value ? (m(), g("div", Xo, " 暂无已保存文件。点击工具栏“保存”按钮把当前文件保存到服务端。 ")) : T("", !0),
3823
- (m(!0), g(A, null, te(tt.value, (r) => (m(), g("div", {
3855
+ l("div", ti, [
3856
+ ft.value ? (p(), m("div", ni, "正在读取服务端文件…")) : (p(), m(A, { key: 1 }, [
3857
+ !tt.value.length && !je.value ? (p(), m("div", ri, " 暂无已保存文件。点击工具栏“保存”按钮把当前文件保存到服务端。 ")) : O("", !0),
3858
+ (p(!0), m(A, null, te(tt.value, (r) => (p(), m("div", {
3824
3859
  key: r.id,
3825
3860
  class: "vpe-fs-item"
3826
3861
  }, [
3827
3862
  l("span", {
3828
3863
  class: "vpe-fs-name",
3829
3864
  title: r.name
3830
- }, R(r.name), 9, ei),
3865
+ }, _(r.name), 9, ai),
3831
3866
  l("span", {
3832
3867
  class: "vpe-fs-size",
3833
- title: ma(r.updatedAt)
3834
- }, R(Gt(r.size)), 9, ti),
3868
+ title: ya(r.updatedAt)
3869
+ }, _(Gt(r.size)), 9, si),
3835
3870
  l("button", {
3836
3871
  class: "vpe-btn vpe-btn--sm",
3837
3872
  type: "button",
3838
3873
  title: `打开 ${r.name}`,
3839
3874
  disabled: W.value,
3840
- onClick: (u) => ya(r)
3841
- }, " 打开 ", 8, ni),
3875
+ onClick: (u) => ga(r)
3876
+ }, " 打开 ", 8, oi),
3842
3877
  l("button", {
3843
3878
  class: "vpe-btn vpe-btn--sm",
3844
3879
  type: "button",
3845
3880
  title: `删除 ${r.name}`,
3846
3881
  disabled: W.value,
3847
- onClick: (u) => ha(r)
3848
- }, " 删除 ", 8, ri)
3882
+ onClick: (u) => ba(r)
3883
+ }, " 删除 ", 8, ii)
3849
3884
  ]))), 128)),
3850
- ze.value ? (m(), g("p", ai, R(ze.value), 1)) : T("", !0)
3885
+ je.value ? (p(), m("p", li, _(je.value), 1)) : O("", !0)
3851
3886
  ], 64))
3852
3887
  ])
3853
- ])) : T("", !0),
3854
- Fe.value && pe.value ? (m(), g("div", si, [
3855
- l("div", oi, [
3856
- l("span", ii, R(Tr.value), 1),
3857
- t[40] || (t[40] = l("span", {
3888
+ ])) : O("", !0),
3889
+ $e.value && pe.value ? (p(), m("div", ui, [
3890
+ l("div", ci, [
3891
+ l("span", di, _(Tr.value), 1),
3892
+ t[41] || (t[41] = l("span", {
3858
3893
  class: "vpe-spacer",
3859
3894
  "aria-hidden": "true"
3860
3895
  }, null, -1)),
@@ -3865,194 +3900,194 @@ const Vs = Z(
3865
3900
  "aria-label": "关闭 SQL 连接配置",
3866
3901
  onClick: xn
3867
3902
  }, [
3868
- V(B(ct))
3903
+ z(H(ct))
3869
3904
  ])
3870
3905
  ]),
3871
- l("div", li, [
3872
- l("label", ui, [
3873
- t[42] || (t[42] = l("span", { class: "vpe-sql-label" }, "执行方式", -1)),
3874
- J(l("select", {
3875
- "onUpdate:modelValue": t[7] || (t[7] = (r) => f.value.mode = r),
3906
+ l("div", pi, [
3907
+ l("label", fi, [
3908
+ t[43] || (t[43] = l("span", { class: "vpe-sql-label" }, "执行方式", -1)),
3909
+ Z(l("select", {
3910
+ "onUpdate:modelValue": t[7] || (t[7] = (r) => v.value.mode = r),
3876
3911
  class: "vpe-sql-input",
3877
- onChange: Dr
3878
- }, [...t[41] || (t[41] = [
3912
+ onChange: zr
3913
+ }, [...t[42] || (t[42] = [
3879
3914
  l("option", { value: "sqlite" }, "浏览器内 SQLite(无需服务端)", -1),
3880
3915
  l("option", { value: "http" }, "HTTP 服务(后端网关)", -1)
3881
3916
  ])], 544), [
3882
- [Et, f.value.mode]
3917
+ [Et, v.value.mode]
3883
3918
  ])
3884
3919
  ]),
3885
- f.value.mode === "sqlite" ? (m(), g(A, { key: 0 }, [
3886
- l("label", ci, [
3887
- t[43] || (t[43] = l("span", { class: "vpe-sql-label" }, "数据库文件", -1)),
3888
- J(l("input", {
3889
- "onUpdate:modelValue": t[8] || (t[8] = (r) => f.value.connection.database = r),
3920
+ v.value.mode === "sqlite" ? (p(), m(A, { key: 0 }, [
3921
+ l("label", vi, [
3922
+ t[44] || (t[44] = l("span", { class: "vpe-sql-label" }, "数据库文件", -1)),
3923
+ Z(l("input", {
3924
+ "onUpdate:modelValue": t[8] || (t[8] = (r) => v.value.connection.database = r),
3890
3925
  class: "vpe-sql-input",
3891
3926
  type: "text",
3892
3927
  spellcheck: "false",
3893
3928
  placeholder: ":memory:",
3894
- onChange: ye
3929
+ onChange: he
3895
3930
  }, null, 544), [
3896
- [he, f.value.connection.database]
3931
+ [ge, v.value.connection.database]
3897
3932
  ])
3898
3933
  ]),
3899
- t[44] || (t[44] = l("p", { class: "vpe-sql-hint" }, " SQLite 在浏览器内运行,数据仅保存在当前页面内存;“停止”或刷新后会丢失。 ", -1))
3900
- ], 64)) : (m(), g(A, { key: 1 }, [
3901
- l("label", di, [
3902
- t[45] || (t[45] = l("span", { class: "vpe-sql-label" }, "连接名称", -1)),
3903
- J(l("input", {
3934
+ t[45] || (t[45] = l("p", { class: "vpe-sql-hint" }, " SQLite 在浏览器内运行,数据仅保存在当前页面内存;“停止”或刷新后会丢失。 ", -1))
3935
+ ], 64)) : (p(), m(A, { key: 1 }, [
3936
+ l("label", mi, [
3937
+ t[46] || (t[46] = l("span", { class: "vpe-sql-label" }, "连接名称", -1)),
3938
+ Z(l("input", {
3904
3939
  "onUpdate:modelValue": t[9] || (t[9] = (r) => ne.value = r),
3905
3940
  class: "vpe-sql-input",
3906
3941
  type: "text",
3907
3942
  spellcheck: "false",
3908
3943
  placeholder: "用于保存和切换连接"
3909
3944
  }, null, 512), [
3910
- [he, ne.value]
3945
+ [ge, ne.value]
3911
3946
  ])
3912
3947
  ]),
3913
- l("label", pi, [
3914
- t[46] || (t[46] = l("span", { class: "vpe-sql-label" }, "数据库类型", -1)),
3915
- J(l("select", {
3916
- "onUpdate:modelValue": t[10] || (t[10] = (r) => f.value.connection.dialect = r),
3948
+ l("label", yi, [
3949
+ t[47] || (t[47] = l("span", { class: "vpe-sql-label" }, "数据库类型", -1)),
3950
+ Z(l("select", {
3951
+ "onUpdate:modelValue": t[10] || (t[10] = (r) => v.value.connection.dialect = r),
3917
3952
  class: "vpe-sql-input",
3918
- onChange: zr
3953
+ onChange: jr
3919
3954
  }, [
3920
- (m(!0), g(A, null, te(B(dt), (r) => (m(), g("option", {
3955
+ (p(!0), m(A, null, te(H(dt), (r) => (p(), m("option", {
3921
3956
  key: r.value,
3922
3957
  value: r.value
3923
- }, R(r.label), 9, fi))), 128))
3958
+ }, _(r.label), 9, hi))), 128))
3924
3959
  ], 544), [
3925
- [Et, f.value.connection.dialect]
3960
+ [Et, v.value.connection.dialect]
3926
3961
  ])
3927
3962
  ]),
3928
- l("div", vi, [
3929
- l("label", mi, [
3930
- t[47] || (t[47] = l("span", { class: "vpe-sql-label" }, "主机", -1)),
3931
- J(l("input", {
3932
- "onUpdate:modelValue": t[11] || (t[11] = (r) => f.value.connection.host = r),
3963
+ l("div", gi, [
3964
+ l("label", bi, [
3965
+ t[48] || (t[48] = l("span", { class: "vpe-sql-label" }, "主机", -1)),
3966
+ Z(l("input", {
3967
+ "onUpdate:modelValue": t[11] || (t[11] = (r) => v.value.connection.host = r),
3933
3968
  class: "vpe-sql-input",
3934
3969
  type: "text",
3935
3970
  spellcheck: "false",
3936
3971
  placeholder: "127.0.0.1",
3937
- onChange: ye
3972
+ onChange: he
3938
3973
  }, null, 544), [
3939
- [he, f.value.connection.host]
3974
+ [ge, v.value.connection.host]
3940
3975
  ])
3941
3976
  ]),
3942
- l("label", gi, [
3943
- t[48] || (t[48] = l("span", { class: "vpe-sql-label" }, "端口", -1)),
3944
- J(l("input", {
3945
- "onUpdate:modelValue": t[12] || (t[12] = (r) => f.value.connection.port = r),
3977
+ l("label", ki, [
3978
+ t[49] || (t[49] = l("span", { class: "vpe-sql-label" }, "端口", -1)),
3979
+ Z(l("input", {
3980
+ "onUpdate:modelValue": t[12] || (t[12] = (r) => v.value.connection.port = r),
3946
3981
  class: "vpe-sql-input",
3947
3982
  type: "number",
3948
3983
  min: "1",
3949
3984
  max: "65535",
3950
3985
  placeholder: "3306",
3951
- onChange: ye
3986
+ onChange: he
3952
3987
  }, null, 544), [
3953
3988
  [
3954
- he,
3955
- f.value.connection.port,
3989
+ ge,
3990
+ v.value.connection.port,
3956
3991
  void 0,
3957
3992
  { number: !0 }
3958
3993
  ]
3959
3994
  ])
3960
3995
  ])
3961
3996
  ]),
3962
- l("div", yi, [
3963
- l("label", hi, [
3964
- t[49] || (t[49] = l("span", { class: "vpe-sql-label" }, "用户名", -1)),
3965
- J(l("input", {
3966
- "onUpdate:modelValue": t[13] || (t[13] = (r) => f.value.connection.user = r),
3997
+ l("div", wi, [
3998
+ l("label", Si, [
3999
+ t[50] || (t[50] = l("span", { class: "vpe-sql-label" }, "用户名", -1)),
4000
+ Z(l("input", {
4001
+ "onUpdate:modelValue": t[13] || (t[13] = (r) => v.value.connection.user = r),
3967
4002
  class: "vpe-sql-input",
3968
4003
  type: "text",
3969
4004
  autocomplete: "off",
3970
4005
  spellcheck: "false",
3971
- onChange: ye
4006
+ onChange: he
3972
4007
  }, null, 544), [
3973
- [he, f.value.connection.user]
4008
+ [ge, v.value.connection.user]
3974
4009
  ])
3975
4010
  ]),
3976
- l("label", bi, [
3977
- t[50] || (t[50] = l("span", { class: "vpe-sql-label" }, "密码", -1)),
3978
- J(l("input", {
3979
- "onUpdate:modelValue": t[14] || (t[14] = (r) => f.value.connection.password = r),
4011
+ l("label", xi, [
4012
+ t[51] || (t[51] = l("span", { class: "vpe-sql-label" }, "密码", -1)),
4013
+ Z(l("input", {
4014
+ "onUpdate:modelValue": t[14] || (t[14] = (r) => v.value.connection.password = r),
3980
4015
  class: "vpe-sql-input",
3981
4016
  type: "password",
3982
4017
  autocomplete: "new-password",
3983
- placeholder: f.value.connectionId ? "已保存(留空不修改)" : "",
3984
- onChange: ye
3985
- }, null, 40, ki), [
3986
- [he, f.value.connection.password]
4018
+ placeholder: v.value.connectionId ? "已保存(留空不修改)" : "",
4019
+ onChange: he
4020
+ }, null, 40, Ei), [
4021
+ [ge, v.value.connection.password]
3987
4022
  ])
3988
4023
  ])
3989
4024
  ]),
3990
- l("label", wi, [
3991
- t[51] || (t[51] = l("span", { class: "vpe-sql-label" }, "数据库名", -1)),
3992
- J(l("input", {
3993
- "onUpdate:modelValue": t[15] || (t[15] = (r) => f.value.connection.database = r),
4025
+ l("label", qi, [
4026
+ t[52] || (t[52] = l("span", { class: "vpe-sql-label" }, "数据库名", -1)),
4027
+ Z(l("input", {
4028
+ "onUpdate:modelValue": t[15] || (t[15] = (r) => v.value.connection.database = r),
3994
4029
  class: "vpe-sql-input",
3995
4030
  type: "text",
3996
4031
  spellcheck: "false",
3997
4032
  placeholder: "database",
3998
- onChange: ye
4033
+ onChange: he
3999
4034
  }, null, 544), [
4000
- [he, f.value.connection.database]
4035
+ [ge, v.value.connection.database]
4001
4036
  ])
4002
4037
  ]),
4003
- s.sqlEndpointLocked ? T("", !0) : (m(), g("label", Si, [
4004
- t[52] || (t[52] = l("span", { class: "vpe-sql-label" }, "服务端点", -1)),
4005
- J(l("input", {
4006
- "onUpdate:modelValue": t[16] || (t[16] = (r) => f.value.endpoint = r),
4038
+ s.sqlEndpointLocked ? O("", !0) : (p(), m("label", Ci, [
4039
+ t[53] || (t[53] = l("span", { class: "vpe-sql-label" }, "服务端点", -1)),
4040
+ Z(l("input", {
4041
+ "onUpdate:modelValue": t[16] || (t[16] = (r) => v.value.endpoint = r),
4007
4042
  class: "vpe-sql-input",
4008
4043
  type: "url",
4009
4044
  spellcheck: "false",
4010
4045
  placeholder: "https://example.com/api/sql",
4011
- onChange: ye
4046
+ onChange: he
4012
4047
  }, null, 544), [
4013
- [he, f.value.endpoint]
4048
+ [ge, v.value.endpoint]
4014
4049
  ])
4015
4050
  ])),
4016
- s.sqlEndpointLocked ? (m(), g("p", xi, "服务端点由系统预置,无需填写。")) : T("", !0),
4017
- t[53] || (t[53] = l("p", { class: "vpe-sql-hint" }, " 执行时会把连接信息与 SQL POST 到该端点,由后端网关连接真实数据库。建议使用 HTTPS,并避免在前端配置高权限账号。 ", -1))
4051
+ s.sqlEndpointLocked ? (p(), m("p", Pi, "服务端点由系统预置,无需填写。")) : O("", !0),
4052
+ t[54] || (t[54] = l("p", { class: "vpe-sql-hint" }, " 执行时会把连接信息与 SQL POST 到该端点,由后端网关连接真实数据库。建议使用 HTTPS,并避免在前端配置高权限账号。 ", -1))
4018
4053
  ], 64)),
4019
- l("div", Ei, [
4054
+ l("div", Oi, [
4020
4055
  l("button", {
4021
4056
  class: "vpe-btn vpe-btn--primary",
4022
4057
  type: "button",
4023
- disabled: _e.value,
4024
- onClick: Zr
4025
- }, R(_e.value ? "测试中…" : "测试连接"), 9, qi),
4026
- f.value.mode === "http" ? (m(), g("button", {
4058
+ disabled: Re.value,
4059
+ onClick: Gr
4060
+ }, _(Re.value ? "测试中…" : "测试连接"), 9, Mi),
4061
+ v.value.mode === "http" ? (p(), m("button", {
4027
4062
  key: 0,
4028
4063
  class: "vpe-btn",
4029
4064
  type: "button",
4030
4065
  disabled: re.value,
4031
- onClick: Qr
4032
- }, " 保存 ", 8, Ci)) : T("", !0),
4033
- f.value.mode === "http" && f.value.connectionId ? (m(), g("button", {
4066
+ onClick: Kr
4067
+ }, " 保存 ", 8, Ni)) : O("", !0),
4068
+ v.value.mode === "http" && v.value.connectionId ? (p(), m("button", {
4034
4069
  key: 1,
4035
4070
  class: "vpe-btn",
4036
4071
  type: "button",
4037
4072
  disabled: re.value,
4038
- onClick: Kr
4039
- }, " 删除 ", 8, Pi)) : T("", !0),
4040
- nt.value ? (m(), g("span", {
4073
+ onClick: Jr
4074
+ }, " 删除 ", 8, Ti)) : O("", !0),
4075
+ nt.value ? (p(), m("span", {
4041
4076
  key: 2,
4042
4077
  class: le(["vpe-sql-test", vt.value ? "vpe-sql-test--ok" : "vpe-sql-test--err"])
4043
- }, R(nt.value), 3)) : T("", !0),
4044
- f.value.mode === "http" && Pe.value ? (m(), g("span", Oi, R(Pe.value), 1)) : T("", !0),
4045
- f.value.mode === "http" && ae.value ? (m(), g("span", {
4078
+ }, _(nt.value), 3)) : O("", !0),
4079
+ v.value.mode === "http" && Oe.value ? (p(), m("span", Fi, _(Oe.value), 1)) : O("", !0),
4080
+ v.value.mode === "http" && ae.value ? (p(), m("span", {
4046
4081
  key: 4,
4047
- class: le(["vpe-sql-test", Ve.value ? "vpe-sql-test--ok" : "vpe-sql-test--err"])
4048
- }, R(ae.value), 3)) : T("", !0)
4082
+ class: le(["vpe-sql-test", Qe.value ? "vpe-sql-test--ok" : "vpe-sql-test--err"])
4083
+ }, _(ae.value), 3)) : O("", !0)
4049
4084
  ])
4050
4085
  ])
4051
- ])) : T("", !0),
4052
- Re.value && pe.value ? (m(), g("div", Mi, [
4053
- l("div", Ti, [
4054
- t[54] || (t[54] = l("span", { class: "vpe-fs-title" }, "连接管理", -1)),
4055
- t[55] || (t[55] = l("span", {
4086
+ ])) : O("", !0),
4087
+ _e.value && pe.value ? (p(), m("div", Li, [
4088
+ l("div", $i, [
4089
+ t[55] || (t[55] = l("span", { class: "vpe-fs-title" }, "连接管理", -1)),
4090
+ t[56] || (t[56] = l("span", {
4056
4091
  class: "vpe-spacer",
4057
4092
  "aria-hidden": "true"
4058
4093
  }, null, -1)),
@@ -4060,116 +4095,116 @@ const Vs = Z(
4060
4095
  class: "vpe-btn vpe-btn--sm",
4061
4096
  type: "button",
4062
4097
  title: "刷新连接列表",
4063
- disabled: je.value,
4098
+ disabled: Ve.value,
4064
4099
  onClick: ve
4065
- }, " 刷新 ", 8, Ni),
4100
+ }, " 刷新 ", 8, Ri),
4066
4101
  l("button", {
4067
4102
  class: "vpe-btn vpe-btn--sm",
4068
4103
  type: "button",
4069
4104
  title: "关闭连接管理",
4070
4105
  "aria-label": "关闭连接管理",
4071
- onClick: t[17] || (t[17] = (r) => Re.value = !1)
4106
+ onClick: t[17] || (t[17] = (r) => _e.value = !1)
4072
4107
  }, [
4073
- V(B(ct))
4108
+ z(H(ct))
4074
4109
  ])
4075
4110
  ]),
4076
- l("div", Li, [
4077
- je.value ? (m(), g("div", $i, "正在读取连接…")) : (m(), g(A, { key: 1 }, [
4078
- Ce.value.length ? T("", !0) : (m(), g("div", Fi, " 暂无已保存连接,点击工具栏“新建连接”创建。 ")),
4079
- (m(!0), g(A, null, te(Ce.value, (r) => (m(), g("div", {
4111
+ l("div", _i, [
4112
+ Ve.value ? (p(), m("div", Ii, "正在读取连接…")) : (p(), m(A, { key: 1 }, [
4113
+ Pe.value.length ? O("", !0) : (p(), m("div", Hi, " 暂无已保存连接,点击工具栏“新建连接”创建。 ")),
4114
+ (p(!0), m(A, null, te(Pe.value, (r) => (p(), m("div", {
4080
4115
  key: r.id,
4081
4116
  class: "vpe-sql-manager-item"
4082
4117
  }, [
4083
- l("div", _i, [
4118
+ l("div", Bi, [
4084
4119
  l("span", {
4085
4120
  class: "vpe-sql-manager-name",
4086
4121
  title: r.name
4087
- }, R(r.name), 9, Ri),
4088
- l("span", Ii, [
4089
- Wt(R(r.dialect), 1),
4090
- r.database ? (m(), g(A, { key: 0 }, [
4091
- Wt(" · " + R(r.database), 1)
4092
- ], 64)) : T("", !0),
4093
- r.host ? (m(), g(A, { key: 1 }, [
4094
- Wt(" · " + R(r.host), 1)
4095
- ], 64)) : T("", !0)
4122
+ }, _(r.name), 9, Ui),
4123
+ l("span", Ai, [
4124
+ Wt(_(r.dialect), 1),
4125
+ r.database ? (p(), m(A, { key: 0 }, [
4126
+ Wt(" · " + _(r.database), 1)
4127
+ ], 64)) : O("", !0),
4128
+ r.host ? (p(), m(A, { key: 1 }, [
4129
+ Wt(" · " + _(r.host), 1)
4130
+ ], 64)) : O("", !0)
4096
4131
  ])
4097
4132
  ]),
4098
4133
  l("button", {
4099
4134
  class: "vpe-btn vpe-btn--sm",
4100
4135
  type: "button",
4101
4136
  title: "编辑连接",
4102
- onClick: (u) => Vr(r)
4103
- }, " 编辑 ", 8, Hi),
4137
+ onClick: (u) => Qr(r)
4138
+ }, " 编辑 ", 8, Di),
4104
4139
  l("button", {
4105
4140
  class: "vpe-btn vpe-btn--sm",
4106
4141
  type: "button",
4107
4142
  title: "删除连接",
4108
4143
  disabled: re.value,
4109
- onClick: (u) => Jr(r)
4110
- }, " 删除 ", 8, Bi)
4144
+ onClick: (u) => Zr(r)
4145
+ }, " 删除 ", 8, zi)
4111
4146
  ]))), 128)),
4112
- Pe.value ? (m(), g("p", Ui, R(Pe.value), 1)) : T("", !0),
4113
- Qe.value ? (m(), g("p", {
4147
+ Oe.value ? (p(), m("p", ji, _(Oe.value), 1)) : O("", !0),
4148
+ Ke.value ? (p(), m("p", {
4114
4149
  key: 2,
4115
4150
  class: le(["vpe-sql-hint", mt.value ? "vpe-sql-hint--ok" : "vpe-sql-hint--error"])
4116
- }, R(Qe.value), 3)) : T("", !0)
4151
+ }, _(Ke.value), 3)) : O("", !0)
4117
4152
  ], 64))
4118
4153
  ])
4119
- ])) : T("", !0)
4154
+ ])) : O("", !0)
4120
4155
  ], 6));
4121
4156
  }
4122
4157
  });
4123
- function nl(s = {}) {
4124
- var Ae;
4158
+ function ol(s = {}) {
4159
+ var De;
4125
4160
  const n = un(s.pyodideUrl ? { pyodideUrl: s.pyodideUrl } : void 0), a = C(n.status), o = C(""), i = C([]);
4126
- let p = 0;
4127
- const b = (H, k) => {
4128
- i.value.push({ id: ++p, stream: H, text: k });
4129
- }, E = n.on("status", (H, k) => {
4130
- a.value = H, k && (o.value = k);
4131
- }), _ = n.on("initError", (H) => {
4132
- b("system", `[pyodide] 加载失败:${H}`);
4161
+ let f = 0;
4162
+ const b = (B, k) => {
4163
+ i.value.push({ id: ++f, stream: B, text: k });
4164
+ }, E = n.on("status", (B, k) => {
4165
+ a.value = B, k && (o.value = k);
4166
+ }), R = n.on("initError", (B) => {
4167
+ b("system", `[pyodide] 加载失败:${B}`);
4133
4168
  });
4134
- Ia(() => {
4135
- E(), _();
4169
+ Ha(() => {
4170
+ E(), R();
4136
4171
  });
4137
- const O = async (H, k = {}) => {
4172
+ const M = async (B, k = {}) => {
4138
4173
  var I;
4139
4174
  try {
4140
- const z = await n.run(H, {
4175
+ const j = await n.run(B, {
4141
4176
  stdin: k.stdin,
4142
4177
  onOutput: (ce, Se) => b(ce, Se)
4143
4178
  });
4144
- return !z.ok && ((I = z.error) != null && I.traceback) && b("stderr", z.error.traceback), z;
4145
- } catch (z) {
4179
+ return !j.ok && ((I = j.error) != null && I.traceback) && b("stderr", j.error.traceback), j;
4180
+ } catch (j) {
4146
4181
  return {
4147
4182
  ok: !1,
4148
4183
  durationMs: 0,
4149
- error: { type: "RuntimeError", message: z instanceof Error ? z.message : String(z), traceback: "" }
4184
+ error: { type: "RuntimeError", message: j instanceof Error ? j.message : String(j), traceback: "" }
4150
4185
  };
4151
4186
  }
4152
- }, N = async (H, k) => {
4187
+ }, T = async (B, k) => {
4153
4188
  try {
4154
- return await n.writeFile(H, k);
4189
+ return await n.writeFile(B, k);
4155
4190
  } catch (I) {
4156
4191
  return { ok: !1, error: { type: "RuntimeError", message: I instanceof Error ? I.message : String(I), traceback: "" } };
4157
4192
  }
4158
- }, x = async (H) => {
4193
+ }, x = async (B) => {
4159
4194
  try {
4160
- return await n.readFile(H);
4195
+ return await n.readFile(B);
4161
4196
  } catch (k) {
4162
4197
  return { ok: !1, error: { type: "RuntimeError", message: k instanceof Error ? k.message : String(k), traceback: "" } };
4163
4198
  }
4164
- }, F = async (H = ".") => {
4199
+ }, $ = async (B = ".") => {
4165
4200
  try {
4166
- return await n.listFiles(H);
4201
+ return await n.listFiles(B);
4167
4202
  } catch (k) {
4168
4203
  return { ok: !1, error: { type: "RuntimeError", message: k instanceof Error ? k.message : String(k), traceback: "" } };
4169
4204
  }
4170
- }, q = async (H) => {
4205
+ }, q = async (B) => {
4171
4206
  try {
4172
- return await n.loadPackages(H, { onOutput: (k, I) => b(k, I) });
4207
+ return await n.loadPackages(B, { onOutput: (k, I) => b(k, I) });
4173
4208
  } catch (k) {
4174
4209
  return {
4175
4210
  ok: !1,
@@ -4182,65 +4217,65 @@ function nl(s = {}) {
4182
4217
  const me = async () => {
4183
4218
  var I;
4184
4219
  if (G) return;
4185
- const H = s.preloadPackages ?? [];
4186
- if (!H.length) return;
4187
- G = !0, b("system", `[pyodide] 正在安装预置包:${H.join(", ")}`);
4188
- const k = await q(H);
4220
+ const B = s.preloadPackages ?? [];
4221
+ if (!B.length) return;
4222
+ G = !0, b("system", `[pyodide] 正在安装预置包:${B.join(", ")}`);
4223
+ const k = await q(B);
4189
4224
  b(
4190
4225
  "system",
4191
4226
  k.ok ? `[pyodide] 预置包安装完成(${(k.durationMs / 1e3).toFixed(1)}s)` : `[pyodide] 预置包安装失败:${((I = k.error) == null ? void 0 : I.message) ?? "未知错误"}`
4192
4227
  );
4193
4228
  };
4194
- return (s.preload || (((Ae = s.preloadPackages) == null ? void 0 : Ae.length) ?? 0) > 0) && n.waitReady().then(() => me()).catch(() => {
4229
+ return (s.preload || (((De = s.preloadPackages) == null ? void 0 : De.length) ?? 0) > 0) && n.waitReady().then(() => me()).catch(() => {
4195
4230
  }), {
4196
4231
  status: a,
4197
4232
  version: o,
4198
4233
  outputs: i,
4199
- runPython: O,
4234
+ runPython: M,
4200
4235
  install: q,
4201
- checkSyntax: (H) => n.checkSyntax(H),
4236
+ checkSyntax: (B) => n.checkSyntax(B),
4202
4237
  interrupt: () => n.interrupt(),
4203
4238
  clearOutputs: () => {
4204
4239
  i.value = [];
4205
4240
  },
4206
- writeFile: N,
4241
+ writeFile: T,
4207
4242
  readFile: x,
4208
- listFiles: F,
4243
+ listFiles: $,
4209
4244
  /** 预加载并在就绪后 resolve */
4210
4245
  ready: () => n.waitReady()
4211
4246
  };
4212
4247
  }
4213
- const rl = Ai;
4248
+ const il = Vi;
4214
4249
  export {
4215
- yr as DEFAULT_PYODIDE_URL,
4216
- tl as DEFAULT_SQL_CONFIG,
4250
+ gr as DEFAULT_PYODIDE_URL,
4251
+ sl as DEFAULT_SQL_CONFIG,
4217
4252
  ln as EDITOR_THEMES,
4218
- gs as MONO_FONT_STACK,
4219
- qs as PyodideRunner,
4220
- rl as PythonEditor,
4253
+ hs as MONO_FONT_STACK,
4254
+ Cs as PyodideRunner,
4255
+ il as PythonEditor,
4221
4256
  dt as SQL_DIALECT_OPTIONS,
4222
- ks as createEditor,
4223
- Fs as createPythonSession,
4224
- Ai as default,
4225
- Ns as deleteServerFile,
4226
- ur as deleteSqlConnection,
4227
- lr as getDefaultSqlPort,
4257
+ ws as createEditor,
4258
+ Rs as createPythonSession,
4259
+ Vi as default,
4260
+ Fs as deleteServerFile,
4261
+ cr as deleteSqlConnection,
4262
+ ur as getDefaultSqlPort,
4228
4263
  un as getRunner,
4229
- js as getThemeOption,
4230
- rr as interruptPythonSession,
4264
+ Vs as getThemeOption,
4265
+ ar as interruptPythonSession,
4231
4266
  ut as isDarkTheme,
4232
- Os as listServerFiles,
4233
- Ds as listSqlConnections,
4234
- ws as makePythonLinter,
4267
+ Ms as listServerFiles,
4268
+ zs as listSqlConnections,
4269
+ Ss as makePythonLinter,
4235
4270
  D as normalizeSqlConfig,
4236
4271
  _s as pollPythonSession,
4237
4272
  Ts as readServerFile,
4238
- el as runPythonOnServer,
4239
- kr as runSql,
4240
- Ms as saveServerFile,
4241
- zs as saveSqlConnection,
4242
- Rs as sendPythonSessionInput,
4243
- gr as setErrorLines,
4244
- As as testSqlConnection,
4245
- nl as usePyodide
4273
+ al as runPythonOnServer,
4274
+ wr as runSql,
4275
+ Ns as saveServerFile,
4276
+ js as saveSqlConnection,
4277
+ Is as sendPythonSessionInput,
4278
+ hr as setErrorLines,
4279
+ Ds as testSqlConnection,
4280
+ ol as usePyodide
4246
4281
  };