@onerjs/code-input 0.1.1 → 0.1.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.
@@ -1,5 +1,5 @@
1
- import { defineComponent as bt, ref as C, computed as V, watch as Me, nextTick as j, onMounted as gt, onBeforeUnmount as vt, openBlock as T, createElementBlock as S, normalizeStyle as oe, normalizeClass as ie, createElementVNode as M, Fragment as He, renderList as Ae, toDisplayString as K, createCommentVNode as D, withModifiers as yt, createTextVNode as kt } from "vue";
2
- const wt = [
1
+ import { defineComponent as wt, ref as C, computed as V, watch as Be, nextTick as j, onMounted as $t, onBeforeUnmount as Ct, openBlock as S, createElementBlock as E, normalizeStyle as ae, normalizeClass as te, createElementVNode as R, withModifiers as Le, Fragment as Oe, renderList as Ne, toDisplayString as K, createCommentVNode as D, createTextVNode as Tt } from "vue";
2
+ const St = [
3
3
  {
4
4
  label: "Math",
5
5
  kind: "class",
@@ -134,7 +134,7 @@ const wt = [
134
134
  kind: "function",
135
135
  detail: "(id: number) => void"
136
136
  }
137
- ], Be = [
137
+ ], ze = [
138
138
  "break",
139
139
  "case",
140
140
  "catch",
@@ -179,7 +179,7 @@ const wt = [
179
179
  "undefined",
180
180
  "NaN",
181
181
  "Infinity"
182
- ], xt = [
182
+ ], Et = [
183
183
  "abstract",
184
184
  "any",
185
185
  "as",
@@ -209,26 +209,26 @@ const wt = [
209
209
  "type",
210
210
  "unknown"
211
211
  ];
212
- function Ke(l) {
213
- return l === "typescript" ? [...Be, ...xt] : Be;
212
+ function Ye(l) {
213
+ return l === "typescript" ? [...ze, ...Et] : ze;
214
214
  }
215
- function Le(l) {
216
- return new Set(Ke(l));
215
+ function je(l) {
216
+ return new Set(Ye(l));
217
217
  }
218
- const $t = /((?:[A-Za-z_$][\w$]*\??\.)*)([A-Za-z_$][\w$]*)?$/, Oe = /\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g, Ct = /^[A-Za-z_$]/;
219
- function Tt(l, r) {
220
- const a = l.slice(0, r), n = $t.exec(a);
221
- if (!n) return { prefix: "", chain: [] };
222
- const o = n[1] ?? "", c = n[2] ?? "", u = o.split(".").filter(Boolean).map((d) => d.replace(/\?$/, ""));
218
+ const It = /((?:[A-Za-z_$][\w$]*\??\.)*)([A-Za-z_$][\w$]*)?$/, De = /\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g, Rt = /^[A-Za-z_$]/;
219
+ function Je(l, s) {
220
+ const a = l.slice(0, s), t = It.exec(a);
221
+ if (!t) return { prefix: "", chain: [] };
222
+ const o = t[1] ?? "", c = t[2] ?? "", u = o.split(".").filter(Boolean).map((d) => d.replace(/\?$/, ""));
223
223
  return { prefix: c, chain: u };
224
224
  }
225
- function Ne(l, r) {
226
- const a = [], n = /* @__PURE__ */ new Set();
225
+ function We(l, s) {
226
+ const a = [], t = /* @__PURE__ */ new Set();
227
227
  let o;
228
- for (Oe.lastIndex = 0; (o = Oe.exec(l)) && !(o.index >= r); ) {
228
+ for (De.lastIndex = 0; (o = De.exec(l)) && !(o.index >= s); ) {
229
229
  const c = o[1];
230
- if (n.has(c)) continue;
231
- n.add(c);
230
+ if (t.has(c)) continue;
231
+ t.add(c);
232
232
  const u = o[0].slice(0, o[0].indexOf(c)).trim();
233
233
  a.push({
234
234
  label: c,
@@ -238,112 +238,125 @@ function Ne(l, r) {
238
238
  }
239
239
  return a;
240
240
  }
241
- function Ze(l, r) {
242
- let a = r;
243
- for (const n of l) {
241
+ function Ge(l, s) {
242
+ let a = s;
243
+ for (const t of l) {
244
244
  if (!a) return null;
245
- const o = a.find((c) => c.label === n);
245
+ const o = a.find((c) => c.label === t);
246
246
  if (!o) return null;
247
247
  a = o.members ?? [];
248
248
  }
249
249
  return a;
250
250
  }
251
- function St(l, r) {
252
- const a = l.toLowerCase(), n = r.toLowerCase(), o = a.indexOf(n);
251
+ function Mt(l, s) {
252
+ const a = l.toLowerCase(), t = s.toLowerCase(), o = a.indexOf(t);
253
253
  if (o === 0) return 1e3 - a.length;
254
254
  if (o > 0) return 800 - o;
255
255
  let c = 0, u = 0, d = -1;
256
- for (let i = 0; i < a.length && c < n.length; i++)
257
- a[i] === n[c] && (d >= 0 && (u += i - d - 1), d = i, c++);
258
- return c !== n.length ? null : 400 - u - a.length;
256
+ for (let i = 0; i < a.length && c < t.length; i++)
257
+ a[i] === t[c] && (d >= 0 && (u += i - d - 1), d = i, c++);
258
+ return c !== t.length ? null : 400 - u - a.length;
259
259
  }
260
- function Et(l, r) {
261
- if (!r) return l;
260
+ function _t(l, s) {
261
+ if (!s) return l;
262
262
  const a = [];
263
- for (const n of l) {
264
- const o = St(n.label, r);
265
- o !== null && a.push({ item: n, score: o });
263
+ for (const t of l) {
264
+ const o = Mt(t.label, s);
265
+ o !== null && a.push({ item: t, score: o });
266
266
  }
267
- return a.sort((n, o) => o.score - n.score || n.item.label.localeCompare(o.item.label)), a.map((n) => n.item);
267
+ return a.sort((t, o) => o.score - t.score || t.item.label.localeCompare(o.item.label)), a.map((t) => t.item);
268
268
  }
269
- function _t(l) {
270
- const r = /* @__PURE__ */ new Set(), a = [];
271
- for (const n of l)
272
- r.has(n.label) || (r.add(n.label), a.push(n));
269
+ function Ht(l) {
270
+ const s = /* @__PURE__ */ new Set(), a = [];
271
+ for (const t of l)
272
+ s.has(t.label) || (s.add(t.label), a.push(t));
273
273
  return a;
274
274
  }
275
- function Rt(l, r, a) {
276
- const { prefix: n, chain: o } = Tt(l, r);
277
- if (a.auto && (!n && o.length === 0 || n && !Ct.test(n)))
275
+ function At(l, s, a) {
276
+ const { prefix: t, chain: o } = Je(l, s);
277
+ if (a.auto && (!t && o.length === 0 || t && !Rt.test(t)))
278
278
  return null;
279
279
  const c = a.declared ?? [], u = [...c, ...a.completions];
280
280
  let d;
281
281
  if (o.length > 0) {
282
- const f = Ze(o, u);
283
- if (!f || f.length === 0) return null;
284
- d = f;
282
+ const p = Ge(o, u);
283
+ if (!p || p.length === 0) return null;
284
+ d = p;
285
285
  } else
286
286
  d = [
287
287
  ...a.completions,
288
288
  ...c,
289
- ...Ke(a.language).map((f) => ({
290
- label: f,
289
+ ...Ye(a.language).map((p) => ({
290
+ label: p,
291
291
  kind: "keyword"
292
292
  }))
293
293
  ];
294
- const i = Et(_t(d), n);
294
+ const i = _t(Ht(d), t);
295
295
  return i.length === 0 ? null : {
296
296
  items: i,
297
- start: r - n.length,
298
- end: r
297
+ start: s - t.length,
298
+ end: s
299
299
  };
300
300
  }
301
- const It = /([A-Za-z_$][\w$]*(?:\??\.[A-Za-z_$][\w$]*)*)\??\.\s*$/;
302
- function Mt(l, r, a, n) {
303
- const o = l.slice(r, a);
301
+ const Bt = /([A-Za-z_$][\w$]*(?:\??\.[A-Za-z_$][\w$]*)*)\??\.\s*$/;
302
+ function Lt(l, s, a, t) {
303
+ const o = l.slice(s, a);
304
304
  if (!o) return null;
305
- const c = [...n.declared ?? [], ...n.completions], u = It.exec(l.slice(0, r));
305
+ const c = [...t.declared ?? [], ...t.completions], u = Bt.exec(l.slice(0, s));
306
306
  if (u) {
307
- const d = u[1].split(".").filter(Boolean).map((_) => _.replace(/\?$/, "")), i = Ze(d, c), f = i == null ? void 0 : i.find((_) => _.label === o);
308
- if (f) return f;
307
+ const d = u[1].split(".").filter(Boolean).map((M) => M.replace(/\?$/, "")), i = Ge(d, c), p = i == null ? void 0 : i.find((M) => M.label === o);
308
+ if (p) return p;
309
309
  }
310
310
  return c.find((d) => d.label === o) ?? null;
311
311
  }
312
- const Z = "[A-Za-z_$][\\w$]*", je = "(?:readonly\\s+|public\\s+|private\\s+|protected\\s+|static\\s+|abstract\\s+)*";
313
- function ze(l, r) {
314
- let a = 0, n = !1, o = r;
315
- for (let c = r; c < l.length; c++) {
312
+ const Z = "[A-Za-z_$][\\w$]*", Fe = "(?:readonly\\s+|public\\s+|private\\s+|protected\\s+|static\\s+|abstract\\s+)*";
313
+ function Pe(l, s) {
314
+ let a = 0, t = !1, o = s;
315
+ for (let c = s; c < l.length; c++) {
316
316
  const u = l[c];
317
317
  for (let d = 0; d < u.length; d++) {
318
318
  const i = u[d];
319
- i === "{" ? (a++, n = !0) : i === "}" && a--;
319
+ i === "{" ? (a++, t = !0) : i === "}" && a--;
320
320
  }
321
- if (n && a <= 0) {
321
+ if (t && a <= 0) {
322
322
  o = c;
323
323
  break;
324
324
  }
325
325
  }
326
- return { end: o, body: l.slice(r + 1, o) };
326
+ return { end: o, body: l.slice(s + 1, o) };
327
327
  }
328
- function De(l) {
328
+ function Ve(l) {
329
329
  return l.trim().replace(/[,;]$/, "").trim();
330
330
  }
331
+ function Ot(l) {
332
+ return /^(?:export\s+)?(?:declare\s+)?(?:abstract\s+)?(?:interface|class|type|function|const|let|var|namespace|enum)\b/.test(
333
+ l
334
+ );
335
+ }
336
+ function ne(l, s) {
337
+ const a = l[s];
338
+ let t = a.lastIndexOf("}");
339
+ const o = a.lastIndexOf(";");
340
+ if (o > t && (t = o), t === -1) return;
341
+ const c = a.slice(t + 1).replace(/^[\s;]+/, "").trim();
342
+ !c || !Ot(c) || (l[s] = a.slice(0, t + 1), l.splice(s + 1, 0, c));
343
+ }
331
344
  function U(l) {
332
345
  return l.length ? l.join(`
333
346
  `).replace(/^\s*\/\*\*?/, "").replace(/\*\/\s*$/, "").split(`
334
- `).map((r) => r.replace(/^\s*\*+\s?/, "").replace(/^\s*\/\/\s?/, "")).join(`
347
+ `).map((s) => s.replace(/^\s*\*+\s?/, "").replace(/^\s*\/\/\s?/, "")).join(`
335
348
  `).replace(/\n{3,}/g, `
336
349
 
337
350
  `).trim() : "";
338
351
  }
339
- function We(l) {
352
+ function Ke(l) {
340
353
  return l.split(`
341
- `).filter((r) => !/^\s*(\/\/|\/\*|\*)/.test(r)).join(`
354
+ `).filter((s) => !/^\s*(\/\/|\/\*|\*)/.test(s)).join(`
342
355
  `).replace(/\n{2,}/g, `
343
356
  `).trim();
344
357
  }
345
- function Pe(l) {
346
- const r = [], a = /* @__PURE__ */ new Set(), n = new RegExp(`^${je}(${Z})(\\?)?\\s*\\((.*)\\)\\s*:\\s*(.+?);?$`), o = new RegExp(`^${je}(${Z})(\\?)?\\s*:\\s*(.+?);?$`);
358
+ function Ze(l) {
359
+ const s = [], a = /* @__PURE__ */ new Set(), t = new RegExp(`^${Fe}(${Z})(\\?)?\\s*\\((.*)\\)\\s*:\\s*(.+?);?$`), o = new RegExp(`^${Fe}(${Z})(\\?)?\\s*:\\s*(.+?);?$`);
347
360
  let c = [], u = !1;
348
361
  for (const d of l) {
349
362
  const i = d.trim();
@@ -363,29 +376,29 @@ function Pe(l) {
363
376
  c = [];
364
377
  continue;
365
378
  }
366
- const f = n.exec(i);
367
- if (f) {
379
+ const p = t.exec(i);
380
+ if (p) {
368
381
  const W = U(c);
369
382
  c = [];
370
- const g = f[1];
383
+ const g = p[1];
371
384
  if (a.has(g)) continue;
372
- a.add(g), r.push({
385
+ a.add(g), s.push({
373
386
  label: g,
374
387
  kind: "function",
375
- detail: `(${f[3].trim()}) => ${De(f[4])}`,
388
+ detail: `(${p[3].trim()}) => ${Ve(p[4])}`,
376
389
  documentation: W || void 0
377
390
  });
378
391
  continue;
379
392
  }
380
- const _ = o.exec(i);
381
- if (_) {
393
+ const M = o.exec(i);
394
+ if (M) {
382
395
  const W = U(c);
383
396
  c = [];
384
- const g = _[1];
397
+ const g = M[1];
385
398
  if (a.has(g)) continue;
386
399
  a.add(g);
387
- const b = De(_[3]), H = /^\(|=>/.test(b) ? "function" : "property";
388
- r.push({
400
+ const b = Ve(M[3]), H = /^\(|=>/.test(b) ? "function" : "property";
401
+ s.push({
389
402
  label: g,
390
403
  kind: H,
391
404
  detail: b,
@@ -393,38 +406,49 @@ function Pe(l) {
393
406
  });
394
407
  }
395
408
  }
396
- return r;
409
+ return s;
397
410
  }
398
- function qe(l) {
399
- const r = l.replace(/\[\]/g, "").replace(/<[^>]*>/g, "").replace(/\s*\|\s*null\s*/g, "").trim(), a = new RegExp(`^(${Z})$`).exec(r);
411
+ function Xe(l) {
412
+ const s = l.replace(/\[\]/g, "").replace(/<[^>]*>/g, "").replace(/\s*\|\s*null\s*/g, "").trim(), a = new RegExp(`^(${Z})$`).exec(s);
400
413
  return a ? a[1] : null;
401
414
  }
402
- function Ht(l) {
403
- const r = l.trim();
404
- if (!r || r.endsWith(";")) return !1;
405
- const a = (r.match(/[(<[{]/g) ?? []).length, n = (r.match(/[)>\]}]/g) ?? []).length;
406
- return /[|&,(<]\s*$/.test(r) || a > n;
415
+ function Nt(l) {
416
+ const s = l.trim();
417
+ if (!s || s.endsWith(";")) return !1;
418
+ const a = (s.match(/[(<[{]/g) ?? []).length, t = (s.match(/[)>\]}]/g) ?? []).length;
419
+ return /[|&,(<]\s*$/.test(s) || a > t;
407
420
  }
408
- function Ue(l, r, a, n = 0) {
409
- return n > 6 ? l : l.map((o) => {
421
+ function Qe(l, s, a, t = 0) {
422
+ return t > 6 ? l : l.map((o) => {
410
423
  if (o.kind !== "property" || !o.detail) return o;
411
- const c = qe(o.detail), u = c ? r.get(c) : void 0;
424
+ const c = Xe(o.detail), u = c ? s.get(c) : void 0;
412
425
  if (!u || a.has(u.label)) return o;
413
426
  const d = new Set(a);
414
427
  return d.add(u.label), {
415
428
  ...o,
416
429
  type: u.type,
417
- members: Ue(u.members, r, d, n + 1)
430
+ members: Qe(u.members, s, d, t + 1)
418
431
  };
419
432
  });
420
433
  }
421
- function At(l) {
434
+ const zt = 50, le = /* @__PURE__ */ new Map();
435
+ function jt(l) {
422
436
  if (!l || !l.trim()) return [];
423
- const r = l.split(`
424
- `), a = /* @__PURE__ */ new Map(), n = new RegExp(`^(?:export\\s+)?(?:declare\\s+)?interface\\s+(${Z})`), o = new RegExp(`^(?:export\\s+)?(?:declare\\s+)?(?:abstract\\s+)?class\\s+(${Z})`), c = new RegExp(`^(?:export\\s+)?(?:declare\\s+)?type\\s+(${Z})\\s*=`);
437
+ const s = le.get(l);
438
+ if (s) return s;
439
+ const a = Dt(l);
440
+ if (le.size >= zt) {
441
+ const t = le.keys().next().value;
442
+ t !== void 0 && le.delete(t);
443
+ }
444
+ return le.set(l, a), a;
445
+ }
446
+ function Dt(l) {
447
+ const s = l.split(`
448
+ `), a = /* @__PURE__ */ new Map(), t = new RegExp(`^(?:export\\s+)?(?:declare\\s+)?interface\\s+(${Z})`), o = new RegExp(`^(?:export\\s+)?(?:declare\\s+)?(?:abstract\\s+)?class\\s+(${Z})`), c = new RegExp(`^(?:export\\s+)?(?:declare\\s+)?type\\s+(${Z})\\s*=`);
425
449
  let u = [], d = !1;
426
- for (let g = 0; g < r.length; g++) {
427
- const b = r[g].trim();
450
+ for (let g = 0; g < s.length; g++) {
451
+ const b = s[g].trim();
428
452
  if (d) {
429
453
  u.push(b), b.includes("*/") && (d = !1);
430
454
  continue;
@@ -441,70 +465,70 @@ function At(l) {
441
465
  u = [];
442
466
  continue;
443
467
  }
444
- const H = n.exec(b);
468
+ const H = t.exec(b);
445
469
  if (H && b.includes("{")) {
446
- const k = U(u);
470
+ const w = U(u);
447
471
  u = [];
448
- const { end: w, body: E } = ze(r, g), v = H[1];
449
- a.set(v, {
450
- label: v,
451
- type: We(
452
- r.slice(g, w + 1).join(`
472
+ const { end: y, body: T } = Pe(s, g), k = H[1];
473
+ a.set(k, {
474
+ label: k,
475
+ type: Ke(
476
+ s.slice(g, y + 1).join(`
453
477
  `).replace(/^\s*export\s+/, "")
454
478
  ),
455
- members: Pe(E),
479
+ members: Ze(T),
456
480
  kind: "interface",
457
- documentation: k || void 0
458
- }), g = w;
481
+ documentation: w || void 0
482
+ }), ne(s, y), g = y;
459
483
  continue;
460
484
  }
461
485
  const O = o.exec(b);
462
486
  if (O && b.includes("{")) {
463
- const k = U(u);
487
+ const w = U(u);
464
488
  u = [];
465
- const { end: w, body: E } = ze(r, g), v = O[1];
466
- a.set(v, {
467
- label: v,
468
- type: We(
469
- r.slice(g, w + 1).join(`
489
+ const { end: y, body: T } = Pe(s, g), k = O[1];
490
+ a.set(k, {
491
+ label: k,
492
+ type: Ke(
493
+ s.slice(g, y + 1).join(`
470
494
  `).replace(/^\s*export\s+/, "")
471
495
  ),
472
- members: Pe(E),
496
+ members: Ze(T),
473
497
  kind: "class",
474
- documentation: k || void 0
475
- }), g = w;
498
+ documentation: w || void 0
499
+ }), ne(s, y), g = y;
476
500
  continue;
477
501
  }
478
502
  const A = c.exec(b);
479
503
  if (A) {
480
- const k = U(u);
504
+ const w = U(u);
481
505
  u = [];
482
- const w = [r[g]];
483
- let E = g;
484
- for (; Ht(w.join(`
485
- `)) && E + 1 < r.length; )
486
- E++, w.push(r[E]);
487
- const v = w.join(`
506
+ const y = [s[g]];
507
+ let T = g;
508
+ for (; Nt(y.join(`
509
+ `)) && T + 1 < s.length; )
510
+ T++, y.push(s[T]);
511
+ const k = y.join(`
488
512
  `).replace(/^\s*export\s+/, "").replace(/;\s*$/, "").trim();
489
513
  a.set(A[1], {
490
514
  label: A[1],
491
- type: v,
515
+ type: k,
492
516
  members: [],
493
517
  kind: "type",
494
- documentation: k || void 0
495
- }), g = E;
518
+ documentation: w || void 0
519
+ }), ne(s, T), g = T;
496
520
  continue;
497
521
  }
498
522
  u = [];
499
523
  }
500
- const i = [], f = /* @__PURE__ */ new Set(), _ = new RegExp(
524
+ const i = [], p = /* @__PURE__ */ new Set(), M = new RegExp(
501
525
  `^(?:export\\s+)?(?:declare\\s+)?function\\s+(${Z})\\s*\\(([^)]*)\\)\\s*:\\s*([^;{]+)`
502
526
  ), W = new RegExp(
503
527
  `^(?:export\\s+)?(?:declare\\s+)?(?:const|let|var)\\s+(${Z})\\s*:\\s*([^=;]+)`
504
528
  );
505
529
  u = [], d = !1;
506
- for (const g of r) {
507
- const b = g.trim();
530
+ for (let g = 0; g < s.length; g++) {
531
+ const b = s[g].trim();
508
532
  if (d) {
509
533
  u.push(b), b.includes("*/") && (d = !1);
510
534
  continue;
@@ -521,13 +545,14 @@ function At(l) {
521
545
  u = [];
522
546
  continue;
523
547
  }
524
- const H = _.exec(b);
548
+ const H = M.exec(b);
525
549
  if (H) {
550
+ ne(s, g);
526
551
  const A = U(u);
527
552
  u = [];
528
- const k = H[1];
529
- f.has(k) || (f.add(k), i.push({
530
- label: k,
553
+ const w = H[1];
554
+ p.has(w) || (p.add(w), i.push({
555
+ label: w,
531
556
  kind: "function",
532
557
  detail: `(${H[2].trim()}) => ${H[3].trim()}`,
533
558
  documentation: A || void 0
@@ -536,19 +561,20 @@ function At(l) {
536
561
  }
537
562
  const O = W.exec(b);
538
563
  if (O) {
564
+ ne(s, g);
539
565
  const A = U(u);
540
566
  u = [];
541
- const k = O[1];
542
- if (f.has(k)) continue;
543
- f.add(k);
544
- const w = O[2].trim(), E = qe(w), v = E ? a.get(E) : void 0, $ = (v == null ? void 0 : v.kind) === "class" ? "class" : /^\(|=>/.test(w) ? "function" : "variable";
567
+ const w = O[1];
568
+ if (p.has(w)) continue;
569
+ p.add(w);
570
+ const y = O[2].trim(), T = Xe(y), k = T ? a.get(T) : void 0, $ = (k == null ? void 0 : k.kind) === "class" ? "class" : /^\(|=>/.test(y) ? "function" : "variable";
545
571
  i.push({
546
- label: k,
572
+ label: w,
547
573
  kind: $,
548
- detail: w,
549
- type: v == null ? void 0 : v.type,
550
- documentation: A || (v == null ? void 0 : v.documentation) || void 0,
551
- members: v ? Ue(v.members, a, /* @__PURE__ */ new Set([v.label])) : void 0
574
+ detail: y,
575
+ type: k == null ? void 0 : k.type,
576
+ documentation: A || (k == null ? void 0 : k.documentation) || void 0,
577
+ members: k ? Qe(k.members, a, /* @__PURE__ */ new Set([k.label])) : void 0
552
578
  });
553
579
  continue;
554
580
  }
@@ -556,43 +582,43 @@ function At(l) {
556
582
  }
557
583
  return i;
558
584
  }
559
- function he(l, r, a, n) {
560
- if (!a || !n) return null;
561
- const o = Math.max(0, r - 1), c = l.lastIndexOf(a, o);
562
- if (c === -1 || l.lastIndexOf(n, o) > c) return null;
563
- const d = l.indexOf(n, c + a.length);
585
+ function ve(l, s, a, t) {
586
+ if (!a || !t) return null;
587
+ const o = Math.max(0, s - 1), c = l.lastIndexOf(a, o);
588
+ if (c === -1 || l.lastIndexOf(t, o) > c) return null;
589
+ const d = l.indexOf(t, c + a.length);
564
590
  return {
565
591
  start: c + a.length,
566
592
  end: d === -1 ? l.length : d
567
593
  };
568
594
  }
569
- function ln(l, r, a, n) {
570
- return he(l, r, a, n) !== null;
595
+ function dn(l, s, a, t) {
596
+ return ve(l, s, a, t) !== null;
571
597
  }
572
- const Fe = /[A-Za-z_$]/, Bt = /[\w$]/, Ve = /\s/;
573
- function ae(l, r) {
574
- const a = [], n = l.length;
598
+ const qe = /[A-Za-z_$]/, Wt = /[\w$]/, Ue = /\s/;
599
+ function se(l, s) {
600
+ const a = [], t = l.length;
575
601
  let o = 0;
576
- for (; o < n; ) {
602
+ for (; o < t; ) {
577
603
  const c = l[o], u = l[o + 1];
578
- if (Ve.test(c)) {
604
+ if (Ue.test(c)) {
579
605
  o++;
580
606
  continue;
581
607
  }
582
608
  if (c === "/" && u === "/") {
583
609
  let i = l.indexOf(`
584
610
  `, o);
585
- i === -1 && (i = n), a.push({ start: o, end: i, type: "comment" }), o = i;
611
+ i === -1 && (i = t), a.push({ start: o, end: i, type: "comment" }), o = i;
586
612
  continue;
587
613
  }
588
614
  if (c === "/" && u === "*") {
589
- const i = l.indexOf("*/", o + 2), f = i === -1 ? n : i + 2;
590
- a.push({ start: o, end: f, type: "comment" }), o = f;
615
+ const i = l.indexOf("*/", o + 2), p = i === -1 ? t : i + 2;
616
+ a.push({ start: o, end: p, type: "comment" }), o = p;
591
617
  continue;
592
618
  }
593
619
  if (c === '"' || c === "'") {
594
620
  let i = o + 1;
595
- for (; i < n; ) {
621
+ for (; i < t; ) {
596
622
  if (l[i] === "\\") {
597
623
  i += 2;
598
624
  continue;
@@ -610,7 +636,7 @@ function ae(l, r) {
610
636
  }
611
637
  if (c === "`") {
612
638
  let i = o + 1;
613
- for (; i < n; ) {
639
+ for (; i < t; ) {
614
640
  if (l[i] === "\\") {
615
641
  i += 2;
616
642
  continue;
@@ -626,46 +652,46 @@ function ae(l, r) {
626
652
  }
627
653
  if (/[0-9]/.test(c) || c === "." && /[0-9]/.test(u ?? "")) {
628
654
  let i = o + 1;
629
- for (; i < n && /[\w.]/.test(l[i]); ) i++;
655
+ for (; i < t && /[\w.]/.test(l[i]); ) i++;
630
656
  a.push({ start: o, end: i, type: "number" }), o = i;
631
657
  continue;
632
658
  }
633
- if (Fe.test(c)) {
659
+ if (qe.test(c)) {
634
660
  let i = o + 1;
635
- for (; i < n && Bt.test(l[i]); ) i++;
636
- const f = l.slice(o, i), _ = r.keywords.has(f) ? "keyword" : r.builtins.has(f) ? "builtin" : "identifier";
637
- a.push({ start: o, end: i, type: _ }), o = i;
661
+ for (; i < t && Wt.test(l[i]); ) i++;
662
+ const p = l.slice(o, i), M = s.keywords.has(p) ? "keyword" : s.builtins.has(p) ? "builtin" : "identifier";
663
+ a.push({ start: o, end: i, type: M }), o = i;
638
664
  continue;
639
665
  }
640
666
  let d = o + 1;
641
- for (; d < n; ) {
667
+ for (; d < t; ) {
642
668
  const i = l[d];
643
- if (Ve.test(i) || Fe.test(i) || /[0-9]/.test(i) || i === '"' || i === "'" || i === "`" || i === "/") break;
669
+ if (Ue.test(i) || qe.test(i) || /[0-9]/.test(i) || i === '"' || i === "'" || i === "`" || i === "/") break;
644
670
  d++;
645
671
  }
646
672
  a.push({ start: o, end: d, type: "punctuation" }), o = d;
647
673
  }
648
674
  return a;
649
675
  }
650
- const Lt = {
676
+ const Ft = {
651
677
  "&": "&amp;",
652
678
  "<": "&lt;",
653
679
  ">": "&gt;"
654
680
  };
655
681
  function Y(l) {
656
- return l.replace(/[&<>]/g, (r) => Lt[r] ?? r);
682
+ return l.replace(/[&<>]/g, (s) => Ft[s] ?? s);
657
683
  }
658
- function se(l, r, a = 0) {
659
- let n = "", o = 0;
660
- for (const c of r) {
661
- c.start > o && (n += Y(l.slice(o, c.start)));
684
+ function re(l, s, a = 0) {
685
+ let t = "", o = 0;
686
+ for (const c of s) {
687
+ c.start > o && (t += Y(l.slice(o, c.start)));
662
688
  const u = Y(l.slice(c.start, c.end));
663
- n += `<span class="tok-${c.type}" data-start="${c.start + a}" data-end="${c.end + a}">${u}</span>`, o = c.end;
689
+ t += `<span class="tok-${c.type}" data-start="${c.start + a}" data-end="${c.end + a}">${u}</span>`, o = c.end;
664
690
  }
665
- return o < l.length && (n += Y(l.slice(o))), n;
691
+ return o < l.length && (t += Y(l.slice(o))), t;
666
692
  }
667
- function Ot(l, r, a, n) {
668
- if (!a || !n) return se(l, ae(l, r));
693
+ function Pt(l, s, a, t) {
694
+ if (!a || !t) return re(l, se(l, s));
669
695
  let o = "", c = 0;
670
696
  for (; c < l.length; ) {
671
697
  const u = l.indexOf(a, c);
@@ -674,43 +700,43 @@ function Ot(l, r, a, n) {
674
700
  break;
675
701
  }
676
702
  o += Y(l.slice(c, u));
677
- const d = l.indexOf(n, u + a.length), i = d === -1 ? l.length : d, f = l.slice(u + a.length, i);
678
- o += `<span class="tok-brace">${Y(a)}</span>`, o += se(f, ae(f, r), u + a.length), d === -1 ? c = i : (o += `<span class="tok-brace">${Y(n)}</span>`, c = d + n.length);
703
+ const d = l.indexOf(t, u + a.length), i = d === -1 ? l.length : d, p = l.slice(u + a.length, i);
704
+ o += `<span class="tok-brace">${Y(a)}</span>`, o += re(p, se(p, s), u + a.length), d === -1 ? c = i : (o += `<span class="tok-brace">${Y(t)}</span>`, c = d + t.length);
679
705
  }
680
706
  return o;
681
707
  }
682
- const Nt = {
708
+ const Vt = {
683
709
  key: 0,
684
710
  class: "gutter",
685
711
  "aria-hidden": "true"
686
- }, jt = ["innerHTML"], zt = ["value", "readonly", "placeholder"], Dt = ["onMouseenter", "onClick"], Wt = { class: "popup-label" }, Pt = {
712
+ }, Kt = ["innerHTML"], Zt = ["value", "readonly", "placeholder"], qt = ["onMouseenter", "onClick"], Ut = { class: "popup-label" }, Yt = {
687
713
  key: 0,
688
714
  class: "popup-detail"
689
- }, Ft = { class: "hover-head" }, Vt = { class: "hover-name" }, Kt = {
715
+ }, Jt = { class: "hover-head" }, Gt = { class: "hover-name" }, Xt = {
690
716
  key: 0,
691
717
  class: "hover-colon"
692
- }, Zt = {
718
+ }, Qt = {
693
719
  key: 0,
694
720
  class: "hover-type"
695
- }, qt = {
721
+ }, en = {
696
722
  key: 0,
697
723
  class: "hover-doc"
698
- }, Ut = {
724
+ }, tn = {
699
725
  key: 1,
700
726
  class: "hover-def"
701
- }, Yt = ["innerHTML"], Jt = ["title", "aria-label"], Gt = {
727
+ }, nn = ["innerHTML"], ln = ["title", "aria-label"], on = {
702
728
  key: 0,
703
729
  viewBox: "0 0 16 16",
704
730
  width: "14",
705
731
  height: "14",
706
732
  "aria-hidden": "true"
707
- }, Xt = {
733
+ }, an = {
708
734
  key: 1,
709
735
  viewBox: "0 0 16 16",
710
736
  width: "14",
711
737
  height: "14",
712
738
  "aria-hidden": "true"
713
- }, Qt = /* @__PURE__ */ bt({
739
+ }, sn = /* @__PURE__ */ wt({
714
740
  __name: "CodeEditor",
715
741
  props: {
716
742
  modelValue: {},
@@ -718,6 +744,7 @@ const Nt = {
718
744
  language: { default: "javascript" },
719
745
  completions: { default: () => [] },
720
746
  tsTypes: { default: "" },
747
+ completionFilter: {},
721
748
  templateCompletions: { default: () => [] },
722
749
  templateOpen: { default: "{{" },
723
750
  templateClose: { default: "}}" },
@@ -730,11 +757,12 @@ const Nt = {
730
757
  defaultExpanded: { type: Boolean, default: !1 },
731
758
  collapsedHeight: { default: "34px" },
732
759
  collapseOnBlur: { type: Boolean, default: !1 },
760
+ borderRadius: { default: "4px" },
733
761
  minHeight: { default: "260px" }
734
762
  },
735
763
  emits: ["update:modelValue", "change", "expand", "collapse"],
736
- setup(l, { expose: r, emit: a }) {
737
- const n = l, o = a, c = {
764
+ setup(l, { expose: s, emit: a }) {
765
+ const t = l, o = a, c = {
738
766
  variable: "变量",
739
767
  function: "函数",
740
768
  property: "属性",
@@ -755,166 +783,176 @@ const Nt = {
755
783
  "End",
756
784
  "PageUp",
757
785
  "PageDown"
758
- ]), i = C(n.modelValue), f = C(), _ = C(), W = C(), g = C(), b = C(), H = C(), O = C(), A = C([]), k = C(0), w = C(!1), E = C({ start: 0, end: 0 }), v = C({}), $ = C(null), be = C({}), Ye = V(
759
- () => n.tsTypes ? At(n.tsTypes) : []
760
- ), ge = V(() => [
761
- ...wt,
762
- ...Ye.value,
763
- ...n.completions
764
- ]), re = V(
765
- () => n.mode === "template" ? [...n.templateCompletions, ...ge.value] : ge.value
766
- ), Je = V(() => {
786
+ ]), i = C(t.modelValue), p = C(), M = C(), W = C(), g = C(), b = C(), H = C(), O = C(), A = C([]), w = C(0), y = C(!1), T = C({ start: 0, end: 0 }), k = C({}), $ = C(null), ye = C({}), et = V(
787
+ () => t.tsTypes ? jt(t.tsTypes) : []
788
+ ), ke = V(() => [
789
+ ...St,
790
+ ...et.value,
791
+ ...t.completions
792
+ ]), ce = V(
793
+ () => t.mode === "template" ? [...t.templateCompletions, ...ke.value] : ke.value
794
+ ), tt = V(() => {
767
795
  const e = {
768
- keywords: Le(n.language),
769
- builtins: new Set(re.value.map((t) => t.label))
796
+ keywords: je(t.language),
797
+ builtins: new Set(ce.value.map((n) => n.label))
770
798
  };
771
- return n.mode === "template" ? `${Ot(i.value, e, n.templateOpen, n.templateClose)}
772
- ` : `${se(i.value, ae(i.value, e))}
799
+ return t.mode === "template" ? `${Pt(i.value, e, t.templateOpen, t.templateClose)}
800
+ ` : `${re(i.value, se(i.value, e))}
773
801
  `;
774
- }), Ge = V(() => i.value.split(`
775
- `).length), z = C(n.defaultExpanded), J = V(() => n.collapsible && !z.value), Xe = V(() => J.value ? { "--ce-collapsed-height": n.collapsedHeight } : { height: n.minHeight }), Qe = V(
776
- () => J.value ? { height: n.collapsedHeight } : {}
777
- );
778
- let ve = 0;
779
- function ye(e) {
780
- if (z.value === e) return;
781
- const t = f.value;
782
- e && t && (ve = t.scrollTop), z.value = e, o(e ? "expand" : "collapse"), R(), L(), j(() => {
783
- if (ce(), !z.value && t) {
784
- const s = Math.max(0, t.scrollHeight - t.clientHeight);
785
- t.scrollTop = Math.max(0, Math.min(ve, s)), N(!0), document.activeElement === t && X();
802
+ }), nt = V(() => i.value.split(`
803
+ `).length), N = C(t.defaultExpanded), ue = C(!1), de = V(() => t.collapsible && !N.value), lt = V(() => {
804
+ const e = {};
805
+ return t.collapsible && (e.height = t.collapsedHeight), e;
806
+ }), ot = V(() => {
807
+ const e = {
808
+ "--ce-radius": t.borderRadius,
809
+ "--ce-collapsed-height": t.collapsedHeight
810
+ };
811
+ return t.collapsible ? { ...e, height: N.value ? t.minHeight : t.collapsedHeight } : { ...e, height: t.minHeight };
812
+ });
813
+ let xe = 0;
814
+ function we(e) {
815
+ if (N.value === e) return;
816
+ const n = p.value;
817
+ e && n && (xe = n.scrollTop), N.value = e, t.collapsible && (ue.value = !0), o(e ? "expand" : "collapse"), I(), L(), j(() => {
818
+ if (fe(), !N.value && n) {
819
+ const r = Math.max(0, n.scrollHeight - n.clientHeight);
820
+ n.scrollTop = Math.max(0, Math.min(xe, r)), z(!0), document.activeElement === n && G();
786
821
  return;
787
822
  }
788
- N(!0), e && n.collapseOnBlur && t && document.activeElement !== t && t.focus();
823
+ z(!0), e && t.collapseOnBlur && n && document.activeElement !== n && n.focus();
789
824
  });
790
825
  }
791
- function et() {
792
- ye(!z.value);
826
+ function it() {
827
+ ue.value = !1;
828
+ }
829
+ function at() {
830
+ we(!N.value);
793
831
  }
794
- Me(
795
- () => n.modelValue,
832
+ Be(
833
+ () => t.modelValue,
796
834
  (e) => {
797
- e !== i.value && (i.value = e, R());
835
+ e !== i.value && (i.value = e, I());
798
836
  }
799
- ), Me(i, () => {
800
- j(() => N(!0));
837
+ ), Be(i, () => {
838
+ j(() => z(!0));
801
839
  });
802
- function ke(e) {
840
+ function $e(e) {
803
841
  return c[e];
804
842
  }
805
- function tt(e) {
806
- return e ? se(
843
+ function st(e) {
844
+ return e ? re(
807
845
  e,
808
- ae(e, { keywords: Le("typescript"), builtins: /* @__PURE__ */ new Set() })
846
+ se(e, { keywords: je("typescript"), builtins: /* @__PURE__ */ new Set() })
809
847
  ) : "";
810
848
  }
811
- let G = { top: 14, bottom: 14, lineHeight: 22 };
812
- function ce() {
813
- const e = f.value;
849
+ let J = { top: 14, bottom: 14, lineHeight: 22 };
850
+ function fe() {
851
+ const e = p.value;
814
852
  if (!e) return;
815
- const t = window.getComputedStyle(e);
816
- G = {
817
- top: parseFloat(t.paddingTop) || 0,
818
- bottom: parseFloat(t.paddingBottom) || 0,
819
- lineHeight: parseFloat(t.lineHeight) || 22
853
+ const n = window.getComputedStyle(e);
854
+ J = {
855
+ top: parseFloat(n.paddingTop) || 0,
856
+ bottom: parseFloat(n.paddingBottom) || 0,
857
+ lineHeight: parseFloat(n.lineHeight) || 22
820
858
  };
821
859
  }
822
- function N(e = !1) {
823
- const t = f.value;
824
- if (!t) return;
825
- const s = g.value;
826
- if (s && (s.style.transform = `translate(${-t.scrollLeft}px, ${-t.scrollTop}px)`), b.value && (b.value.style.transform = `translateY(${-t.scrollTop}px)`), e) {
827
- const m = `${i.value}|${n.mode}|${t.clientWidth}|${t.clientHeight}`;
828
- m !== xe && (xe = m, nt());
860
+ function z(e = !1) {
861
+ const n = p.value;
862
+ if (!n) return;
863
+ const r = g.value;
864
+ if (r && (r.style.transform = `translate(${-n.scrollLeft}px, ${-n.scrollTop}px)`), b.value && (b.value.style.transform = `translateY(${-n.scrollTop}px)`), e) {
865
+ const m = `${i.value}|${t.mode}|${n.clientWidth}|${n.clientHeight}`;
866
+ m !== Te && (Te = m, rt());
829
867
  }
830
868
  }
831
- function X() {
832
- const e = f.value;
833
- if (!e || !J.value) return;
834
- const t = $e();
835
- if (!t) return;
836
- const s = e.clientHeight - G.top - G.bottom, h = t.top + e.scrollTop - G.top - Math.max(0, (s - t.lineHeight) / 2), p = Math.max(0, e.scrollHeight - e.clientHeight), x = Math.max(0, Math.min(h, p));
837
- Math.abs(x - e.scrollTop) > 0.5 && (e.scrollTop = x, N());
869
+ function G() {
870
+ const e = p.value;
871
+ if (!e || !de.value) return;
872
+ const n = Se();
873
+ if (!n) return;
874
+ const r = e.clientHeight - J.top - J.bottom, h = n.top + e.scrollTop - J.top - Math.max(0, (r - n.lineHeight) / 2), f = Math.max(0, e.scrollHeight - e.clientHeight), v = Math.max(0, Math.min(h, f));
875
+ Math.abs(v - e.scrollTop) > 0.5 && (e.scrollTop = v, z());
838
876
  }
839
- let we = [], xe = "", ne = 0, ue = -1, de = -1, fe = { x: 0, y: 0 };
840
- function nt() {
841
- const e = f.value, t = W.value;
842
- if (!e || !t) return;
843
- const s = e.getBoundingClientRect(), m = [];
844
- t.querySelectorAll("[data-start]").forEach((h) => {
845
- const p = h.getBoundingClientRect();
877
+ let Ce = [], Te = "", oe = 0, pe = -1, me = -1, he = { x: 0, y: 0 };
878
+ function rt() {
879
+ const e = p.value, n = W.value;
880
+ if (!e || !n) return;
881
+ const r = e.getBoundingClientRect(), m = [];
882
+ n.querySelectorAll("[data-start]").forEach((h) => {
883
+ const f = h.getBoundingClientRect();
846
884
  m.push({
847
885
  start: Number(h.dataset.start),
848
886
  end: Number(h.dataset.end),
849
- left: p.left - s.left + e.scrollLeft,
850
- right: p.right - s.left + e.scrollLeft,
851
- top: p.top - s.top + e.scrollTop,
852
- bottom: p.bottom - s.top + e.scrollTop
887
+ left: f.left - r.left + e.scrollLeft,
888
+ right: f.right - r.left + e.scrollLeft,
889
+ top: f.top - r.top + e.scrollTop,
890
+ bottom: f.bottom - r.top + e.scrollTop
853
891
  });
854
- }), we = m;
892
+ }), Ce = m;
855
893
  }
856
- function lt(e, t) {
857
- for (const s of we)
858
- if (e >= s.left - 1 && e <= s.right + 1 && t >= s.top && t <= s.bottom)
859
- return s;
894
+ function ct(e, n) {
895
+ for (const r of Ce)
896
+ if (e >= r.left - 1 && e <= r.right + 1 && n >= r.top && n <= r.bottom)
897
+ return r;
860
898
  return null;
861
899
  }
862
900
  function L() {
863
- $.value = null, ne = 0, ue = -1, de = -1;
901
+ $.value = null, oe = 0, pe = -1, me = -1;
864
902
  }
865
- function ot(e) {
866
- const t = O.value, s = f.value;
867
- if (!t || !s) return;
868
- const m = s.getBoundingClientRect(), h = m.left + e.left - s.scrollLeft, p = m.left + e.right - s.scrollLeft, x = m.top + e.top - s.scrollTop, y = m.top + e.bottom - s.scrollTop, I = 12, B = 8, P = t.offsetWidth, ee = t.offsetHeight;
869
- let F = h, q = y + B;
870
- F + P > window.innerWidth - I && (F = p - P), q + ee > window.innerHeight - I && (q = x - ee - B), F = Math.max(I, Math.min(F, window.innerWidth - I - P)), q = Math.max(I, q), be.value = { left: `${F}px`, top: `${q}px` };
903
+ function ut(e) {
904
+ const n = O.value, r = p.value;
905
+ if (!n || !r) return;
906
+ const m = r.getBoundingClientRect(), h = m.left + e.left - r.scrollLeft, f = m.left + e.right - r.scrollLeft, v = m.top + e.top - r.scrollTop, x = m.top + e.bottom - r.scrollTop, _ = 12, B = 8, F = n.offsetWidth, Q = n.offsetHeight;
907
+ let P = h, q = x + B;
908
+ P + F > window.innerWidth - _ && (P = f - F), q + Q > window.innerHeight - _ && (q = v - Q - B), P = Math.max(_, Math.min(P, window.innerWidth - _ - F)), q = Math.max(_, q), ye.value = { left: `${P}px`, top: `${q}px` };
871
909
  }
872
- function it(e, t) {
873
- const s = f.value;
874
- if (!s || n.readonly || !n.hover || w.value) {
910
+ function dt(e, n) {
911
+ const r = p.value;
912
+ if (!r || t.readonly || !t.hover || y.value) {
875
913
  L();
876
914
  return;
877
915
  }
878
- if (s.selectionStart !== s.selectionEnd) {
916
+ if (r.selectionStart !== r.selectionEnd) {
879
917
  L();
880
918
  return;
881
919
  }
882
920
  const m = O.value;
883
921
  if ($.value && m) {
884
- const y = m.getBoundingClientRect();
885
- if (e >= y.left && e <= y.right && t >= y.top && t <= y.bottom)
922
+ const x = m.getBoundingClientRect();
923
+ if (e >= x.left && e <= x.right && n >= x.top && n <= x.bottom)
886
924
  return;
887
925
  }
888
- const h = s.getBoundingClientRect(), p = lt(e - h.left + s.scrollLeft, t - h.top + s.scrollTop);
889
- if (!p) {
926
+ const h = r.getBoundingClientRect(), f = ct(e - h.left + r.scrollLeft, n - h.top + r.scrollTop);
927
+ if (!f) {
890
928
  L();
891
929
  return;
892
930
  }
893
- if ($.value && ue === p.start && de === p.end)
931
+ if ($.value && pe === f.start && me === f.end)
894
932
  return;
895
- const x = Mt(s.value, p.start, p.end, {
896
- completions: re.value,
897
- declared: Ne(s.value, p.start)
933
+ const v = Lt(r.value, f.start, f.end, {
934
+ completions: ce.value,
935
+ declared: We(r.value, f.start)
898
936
  });
899
- if (!x) {
937
+ if (!v) {
900
938
  L();
901
939
  return;
902
940
  }
903
- $.value = x, ue = p.start, de = p.end, j(() => ot(p));
941
+ $.value = v, pe = f.start, me = f.end, j(() => ut(f));
904
942
  }
905
- function at(e) {
906
- fe = { x: e.clientX, y: e.clientY }, !ne && (ne = requestAnimationFrame(() => {
907
- ne = 0, it(fe.x, fe.y);
943
+ function ft(e) {
944
+ he = { x: e.clientX, y: e.clientY }, !oe && (oe = requestAnimationFrame(() => {
945
+ oe = 0, dt(he.x, he.y);
908
946
  }));
909
947
  }
910
- function $e() {
911
- const e = f.value;
948
+ function Se() {
949
+ const e = p.value;
912
950
  if (!e) return null;
913
- const t = window.getComputedStyle(e), s = document.createElement("div"), m = parseFloat(t.paddingLeft) || 0, h = parseFloat(t.paddingRight) || 0, p = e.getBoundingClientRect();
914
- Object.assign(s.style, {
951
+ const n = window.getComputedStyle(e), r = document.createElement("div"), m = parseFloat(n.paddingLeft) || 0, h = parseFloat(n.paddingRight) || 0, f = e.getBoundingClientRect();
952
+ Object.assign(r.style, {
915
953
  position: "fixed",
916
- left: `${p.left}px`,
917
- top: `${p.top}px`,
954
+ left: `${f.left}px`,
955
+ top: `${f.top}px`,
918
956
  visibility: "hidden",
919
957
  pointerEvents: "none",
920
958
  zIndex: "-1",
@@ -923,394 +961,415 @@ const Nt = {
923
961
  wordBreak: "normal",
924
962
  boxSizing: "content-box",
925
963
  width: `${e.clientWidth - m - h}px`,
926
- paddingTop: t.paddingTop,
927
- paddingRight: t.paddingRight,
928
- paddingBottom: t.paddingBottom,
929
- paddingLeft: t.paddingLeft,
964
+ paddingTop: n.paddingTop,
965
+ paddingRight: n.paddingRight,
966
+ paddingBottom: n.paddingBottom,
967
+ paddingLeft: n.paddingLeft,
930
968
  border: "0",
931
- fontFamily: t.fontFamily,
932
- fontSize: t.fontSize,
933
- fontWeight: t.fontWeight,
934
- fontStyle: t.fontStyle,
935
- fontVariant: t.fontVariant,
936
- letterSpacing: t.letterSpacing,
937
- lineHeight: t.lineHeight,
938
- textTransform: t.textTransform,
939
- tabSize: t.tabSize
940
- }), s.textContent = e.value.slice(0, e.selectionStart);
941
- const x = document.createElement("span");
942
- x.textContent = "​", s.appendChild(x), document.body.appendChild(s);
943
- const y = x.getBoundingClientRect();
944
- document.body.removeChild(s);
945
- const I = parseFloat(t.lineHeight) || 22, B = y.height, P = B > 0 && B < I ? (I - B) / 2 : 0;
969
+ fontFamily: n.fontFamily,
970
+ fontSize: n.fontSize,
971
+ fontWeight: n.fontWeight,
972
+ fontStyle: n.fontStyle,
973
+ fontVariant: n.fontVariant,
974
+ letterSpacing: n.letterSpacing,
975
+ lineHeight: n.lineHeight,
976
+ textTransform: n.textTransform,
977
+ tabSize: n.tabSize
978
+ }), r.textContent = e.value.slice(0, e.selectionStart);
979
+ const v = document.createElement("span");
980
+ v.textContent = "​", r.appendChild(v), document.body.appendChild(r);
981
+ const x = v.getBoundingClientRect();
982
+ document.body.removeChild(r);
983
+ const _ = parseFloat(n.lineHeight) || 22, B = x.height, F = B > 0 && B < _ ? (_ - B) / 2 : 0;
946
984
  return {
947
- left: y.left - p.left - e.scrollLeft,
948
- top: y.top - p.top - e.scrollTop - P,
949
- lineHeight: I
985
+ left: x.left - f.left - e.scrollLeft,
986
+ top: x.top - f.top - e.scrollTop - F,
987
+ lineHeight: _
950
988
  };
951
989
  }
952
- async function st() {
990
+ async function pt() {
953
991
  await j();
954
- const e = _.value, t = H.value, s = $e();
955
- if (!e || !t || !s) return;
956
- const m = 4, h = 8, p = window.innerWidth, x = window.innerHeight, y = e.getBoundingClientRect(), I = t.scrollHeight, B = x - (y.top + s.top + s.lineHeight) - m - h, P = y.top + s.top - m - h, ee = B >= Math.min(I, 180) || B >= P, F = Math.min(248, Math.max(ee ? B : P, 96)), q = Math.min(I, F), Ie = t.offsetWidth || 280;
957
- let te = s.left;
958
- y.left + te + Ie > p - h && (te = p - h - Ie - y.left), te = Math.max(te, h - y.left), v.value = {
959
- left: `${te}px`,
960
- top: `${ee ? s.top + s.lineHeight + m : s.top - m - q}px`,
961
- maxHeight: `${F}px`
992
+ const e = M.value, n = H.value, r = Se();
993
+ if (!e || !n || !r) return;
994
+ const m = 4, h = 8, f = window.innerWidth, v = window.innerHeight, x = e.getBoundingClientRect(), _ = n.scrollHeight, B = v - (x.top + r.top + r.lineHeight) - m - h, F = x.top + r.top - m - h, Q = B >= Math.min(_, 180) || B >= F, P = Math.min(248, Math.max(Q ? B : F, 96)), q = Math.min(_, P), Ae = n.offsetWidth || 280;
995
+ let ee = r.left;
996
+ x.left + ee + Ae > f - h && (ee = f - h - Ae - x.left), ee = Math.max(ee, h - x.left), k.value = {
997
+ left: `${ee}px`,
998
+ top: `${Q ? r.top + r.lineHeight + m : r.top - m - q}px`,
999
+ maxHeight: `${P}px`
962
1000
  };
963
1001
  }
964
- function R() {
965
- w.value = !1, A.value = [], k.value = 0, L();
1002
+ function I() {
1003
+ y.value = !1, A.value = [], w.value = 0, L();
966
1004
  }
967
- function Q(e = !1) {
968
- const t = f.value;
969
- if (!t || n.readonly) return;
970
- if (t.selectionStart !== t.selectionEnd) {
971
- R();
1005
+ function X(e = !1) {
1006
+ const n = p.value;
1007
+ if (!n || t.readonly) return;
1008
+ if (n.selectionStart !== n.selectionEnd) {
1009
+ I();
972
1010
  return;
973
1011
  }
974
- const s = t.selectionStart;
1012
+ const r = n.selectionStart;
975
1013
  let m = !e;
976
- if (n.mode === "template") {
977
- const p = he(
978
- t.value,
979
- s,
980
- n.templateOpen,
981
- n.templateClose
1014
+ if (t.mode === "template") {
1015
+ const v = ve(
1016
+ n.value,
1017
+ r,
1018
+ t.templateOpen,
1019
+ t.templateClose
982
1020
  );
983
- if (!p) {
984
- R();
1021
+ if (!v) {
1022
+ I();
985
1023
  return;
986
1024
  }
987
- e && t.value.slice(p.start, s).trim() === "" && (m = !0);
1025
+ e && n.value.slice(v.start, r).trim() === "" && (m = !0);
988
1026
  }
989
- const h = Rt(t.value, s, {
990
- language: n.language,
991
- completions: re.value,
992
- declared: Ne(t.value, s),
1027
+ const h = At(n.value, r, {
1028
+ language: t.language,
1029
+ completions: ce.value,
1030
+ declared: We(n.value, r),
993
1031
  auto: !m
994
1032
  });
995
1033
  if (!h) {
996
- R();
1034
+ I();
997
1035
  return;
998
1036
  }
999
- A.value = h.items, E.value = { start: h.start, end: h.end }, k.value = 0, w.value = !0, st();
1037
+ let f = h.items;
1038
+ if (t.completionFilter) {
1039
+ const v = Je(n.value, r);
1040
+ if (f = t.completionFilter(f, {
1041
+ prefix: v.prefix,
1042
+ chain: v.chain,
1043
+ text: n.value,
1044
+ position: r,
1045
+ mode: t.mode,
1046
+ language: t.language
1047
+ }), f.length === 0) {
1048
+ I();
1049
+ return;
1050
+ }
1051
+ }
1052
+ A.value = f, T.value = { start: h.start, end: h.end }, w.value = 0, y.value = !0, pt();
1000
1053
  }
1001
- function rt(e) {
1054
+ function mt(e) {
1002
1055
  i.value = e, o("update:modelValue", e), o("change", e);
1003
1056
  }
1004
- function le(e, t, s, m = e + s.length) {
1005
- const h = f.value;
1057
+ function ie(e, n, r, m = e + r.length) {
1058
+ const h = p.value;
1006
1059
  if (!h) return;
1007
- const p = h.value.slice(0, e) + s + h.value.slice(t);
1008
- rt(p), R(), j(() => {
1009
- h.value = p, h.setSelectionRange(m, m), h.focus(), N(!0), X();
1060
+ const f = h.value.slice(0, e) + r + h.value.slice(n);
1061
+ mt(f), I(), j(() => {
1062
+ h.value = f, h.setSelectionRange(m, m), h.focus(), z(!0), G();
1010
1063
  });
1011
1064
  }
1012
- function Ce(e = A.value[k.value]) {
1065
+ function Ee(e = A.value[w.value]) {
1013
1066
  if (!e) return;
1014
- const t = e.insertText ?? e.label;
1015
- le(E.value.start, E.value.end, t), R();
1067
+ const n = e.insertText ?? e.label;
1068
+ ie(T.value.start, T.value.end, n), I();
1016
1069
  }
1017
- function Te(e) {
1018
- const t = A.value.length;
1019
- t && (k.value = (k.value + e + t) % t, j(() => {
1020
- var s, m;
1021
- (m = (s = H.value) == null ? void 0 : s.querySelector(".is-active")) == null || m.scrollIntoView({ block: "nearest" });
1070
+ function Ie(e) {
1071
+ const n = A.value.length;
1072
+ n && (w.value = (w.value + e + n) % n, j(() => {
1073
+ var r, m;
1074
+ (m = (r = H.value) == null ? void 0 : r.querySelector(".is-active")) == null || m.scrollIntoView({ block: "nearest" });
1022
1075
  }));
1023
1076
  }
1024
- function ct(e) {
1025
- const t = e.target;
1026
- i.value = t.value, o("update:modelValue", t.value), o("change", t.value), L(), N(), j(X), Q(!0);
1077
+ function ht(e) {
1078
+ const n = e.target;
1079
+ i.value = n.value, o("update:modelValue", n.value), o("change", n.value), L(), z(), j(G), X(!0);
1027
1080
  }
1028
- function ut(e) {
1029
- if (R(), L(), !n.collapsible || !n.collapseOnBlur || !z.value) return;
1030
- const t = e.relatedTarget;
1031
- t && t.closest(".expand-toggle") || ye(!1);
1081
+ function bt(e) {
1082
+ if (I(), L(), !t.collapsible || !t.collapseOnBlur || !N.value) return;
1083
+ const n = e.relatedTarget;
1084
+ n && n.closest(".expand-toggle") || we(!1);
1032
1085
  }
1033
- function dt() {
1034
- Se(), X();
1086
+ function gt() {
1087
+ Re(), G();
1035
1088
  }
1036
- function Se() {
1037
- const e = f.value;
1038
- if (!e || n.readonly) return;
1089
+ function Re() {
1090
+ const e = p.value;
1091
+ if (!e || t.readonly) return;
1039
1092
  if (e.selectionStart !== e.selectionEnd) {
1040
- R();
1093
+ I();
1041
1094
  return;
1042
1095
  }
1043
- const t = e.selectionStart;
1044
- if (t > 0 && e.value[t - 1] === ".") {
1045
- Q(!0);
1096
+ const n = e.selectionStart;
1097
+ if (n > 0 && e.value[n - 1] === ".") {
1098
+ X(!0);
1046
1099
  return;
1047
1100
  }
1048
- if (n.mode === "template") {
1049
- const s = he(
1101
+ if (t.mode === "template") {
1102
+ const r = ve(
1050
1103
  e.value,
1051
- t,
1052
- n.templateOpen,
1053
- n.templateClose
1104
+ n,
1105
+ t.templateOpen,
1106
+ t.templateClose
1054
1107
  );
1055
- if (s && e.value.slice(s.start, t).trim() === "") {
1056
- Q(!0);
1108
+ if (r && e.value.slice(r.start, n).trim() === "") {
1109
+ X(!0);
1057
1110
  return;
1058
1111
  }
1059
1112
  }
1060
- R();
1113
+ I();
1061
1114
  }
1062
- let pe = 0;
1063
- function Ee() {
1064
- window.clearTimeout(pe), pe = window.setTimeout(() => {
1065
- pe = 0, Se(), X();
1115
+ let be = 0;
1116
+ function Me() {
1117
+ window.clearTimeout(be), be = window.setTimeout(() => {
1118
+ be = 0, Re(), G();
1066
1119
  }, 0);
1067
1120
  }
1068
1121
  function _e(e) {
1069
- e.target !== f.value && w.value && R();
1122
+ e.target !== p.value && y.value && I();
1070
1123
  }
1071
- function ft() {
1072
- L(), N(), J.value && pt();
1124
+ function vt() {
1125
+ L(), z(), de.value && yt();
1073
1126
  }
1074
- let me = 0;
1075
- function pt() {
1076
- window.clearTimeout(me), me = window.setTimeout(() => {
1077
- me = 0, mt();
1127
+ let ge = 0;
1128
+ function yt() {
1129
+ window.clearTimeout(ge), ge = window.setTimeout(() => {
1130
+ ge = 0, kt();
1078
1131
  }, 120);
1079
1132
  }
1080
- function mt() {
1081
- const e = f.value;
1133
+ function kt() {
1134
+ const e = p.value;
1082
1135
  if (!e) return;
1083
- const t = G.lineHeight, s = e.scrollTop, m = Math.round(s / t) * t;
1084
- Math.abs(m - s) < 0.5 || (e.scrollTop = m, N());
1136
+ const n = J.lineHeight, r = e.scrollTop, m = Math.round(r / n) * n;
1137
+ Math.abs(m - r) < 0.5 || (e.scrollTop = m, z());
1085
1138
  }
1086
- function ht(e) {
1139
+ function xt(e) {
1087
1140
  var h;
1088
- const t = f.value;
1089
- if (!t) return;
1090
- const s = e.metaKey || e.ctrlKey, m = d.has(e.key);
1091
- if (e.key === " " && s) {
1092
- e.preventDefault(), Q(!1);
1141
+ const n = p.value;
1142
+ if (!n) return;
1143
+ const r = e.metaKey || e.ctrlKey, m = d.has(e.key);
1144
+ if (e.key === " " && r) {
1145
+ e.preventDefault(), X(!1);
1093
1146
  return;
1094
1147
  }
1095
- if (w.value) {
1148
+ if (y.value) {
1096
1149
  if (e.key === "ArrowDown") {
1097
- e.preventDefault(), Te(1);
1150
+ e.preventDefault(), Ie(1);
1098
1151
  return;
1099
1152
  }
1100
1153
  if (e.key === "ArrowUp") {
1101
- e.preventDefault(), Te(-1);
1154
+ e.preventDefault(), Ie(-1);
1102
1155
  return;
1103
1156
  }
1104
1157
  if (e.key === "Enter" || e.key === "Tab") {
1105
- e.preventDefault(), Ce();
1158
+ e.preventDefault(), Ee();
1106
1159
  return;
1107
1160
  }
1108
1161
  if (e.key === "Escape") {
1109
- e.preventDefault(), R();
1162
+ e.preventDefault(), I();
1110
1163
  return;
1111
1164
  }
1112
- if (m || s) {
1113
- R(), m && !s && Ee();
1165
+ if (m || r) {
1166
+ I(), m && !r && Me();
1114
1167
  return;
1115
1168
  }
1116
1169
  }
1117
- if (m && !s) {
1118
- Ee();
1170
+ if (m && !r) {
1171
+ Me();
1119
1172
  return;
1120
1173
  }
1121
- if (e.key === "Enter" && !s && !e.shiftKey) {
1122
- const p = t.selectionStart;
1123
- if (p !== t.selectionEnd) return;
1124
- const x = t.value.lastIndexOf(`
1125
- `, p - 1) + 1, y = t.value.slice(x, p), I = ((h = y.match(/^[ \t]*/)) == null ? void 0 : h[0]) ?? "", B = /[{[(]$/.test(y.trimEnd()) ? " " : "";
1126
- e.preventDefault(), le(p, p, `
1127
- ${I}${B}`);
1174
+ if (e.key === "Enter" && !r && !e.shiftKey) {
1175
+ const f = n.selectionStart;
1176
+ if (f !== n.selectionEnd) return;
1177
+ const v = n.value.lastIndexOf(`
1178
+ `, f - 1) + 1, x = n.value.slice(v, f), _ = ((h = x.match(/^[ \t]*/)) == null ? void 0 : h[0]) ?? "", B = /[{[(]$/.test(x.trimEnd()) ? " " : "";
1179
+ e.preventDefault(), ie(f, f, `
1180
+ ${_}${B}`);
1128
1181
  return;
1129
1182
  }
1130
1183
  if (e.key === "Tab") {
1131
- e.preventDefault(), le(t.selectionStart, t.selectionEnd, " ");
1184
+ e.preventDefault(), ie(n.selectionStart, n.selectionEnd, " ");
1132
1185
  return;
1133
1186
  }
1134
- if (e.key.length === 1 && !s && !e.altKey && u[e.key]) {
1135
- if (t.selectionStart !== t.selectionEnd) return;
1136
- const p = t.selectionStart, x = t.value[p - 1], y = t.value[p];
1137
- if ((e.key === '"' || e.key === "'") && x && /[\w$]/.test(x) || y !== void 0 && !/[\s)\]},;:]/.test(y)) return;
1138
- e.preventDefault(), le(p, p, e.key + u[e.key], p + 1), n.mode === "template" && j(() => Q(!0));
1187
+ if (e.key.length === 1 && !r && !e.altKey && u[e.key]) {
1188
+ if (n.selectionStart !== n.selectionEnd) return;
1189
+ const f = n.selectionStart, v = n.value[f - 1], x = n.value[f];
1190
+ if ((e.key === '"' || e.key === "'") && v && /[\w$]/.test(v) || x !== void 0 && !/[\s)\]},;:]/.test(x)) return;
1191
+ e.preventDefault(), ie(f, f, e.key + u[e.key], f + 1), t.mode === "template" && j(() => X(!0));
1139
1192
  }
1140
1193
  }
1141
- function Re() {
1142
- w.value && R(), L(), j(() => {
1143
- ce(), N(!0);
1194
+ function He() {
1195
+ y.value && I(), L(), j(() => {
1196
+ fe(), z(!0);
1144
1197
  });
1145
1198
  }
1146
- return gt(() => {
1147
- window.addEventListener("resize", Re), window.addEventListener("scroll", _e, !0), j(() => {
1148
- ce(), N(!0);
1199
+ return $t(() => {
1200
+ window.addEventListener("resize", He), window.addEventListener("scroll", _e, !0), j(() => {
1201
+ fe(), z(!0);
1149
1202
  });
1150
- }), vt(() => {
1151
- window.removeEventListener("resize", Re), window.removeEventListener("scroll", _e, !0);
1152
- }), r({ focus: () => {
1203
+ }), Ct(() => {
1204
+ window.removeEventListener("resize", He), window.removeEventListener("scroll", _e, !0);
1205
+ }), s({ focus: () => {
1153
1206
  var e;
1154
- return (e = f.value) == null ? void 0 : e.focus();
1155
- } }), (e, t) => (T(), S("div", {
1156
- class: ie(["code-editor", {
1157
- "is-readonly": l.readonly,
1158
- "is-dark": l.theme === "dark",
1159
- "is-collapsed": J.value
1160
- }]),
1161
- style: oe(Xe.value)
1207
+ return (e = p.value) == null ? void 0 : e.focus();
1208
+ } }), (e, n) => (S(), E("div", {
1209
+ class: te(["code-input", { "is-collapsible": l.collapsible }]),
1210
+ style: ae(lt.value)
1162
1211
  }, [
1163
- l.lineNumbers && !J.value ? (T(), S("div", Nt, [
1164
- M("div", {
1165
- ref_key: "gutterInner",
1166
- ref: b,
1167
- class: "gutter-inner code-font"
1168
- }, [
1169
- (T(!0), S(He, null, Ae(Ge.value, (s) => (T(), S("div", {
1170
- key: s,
1171
- class: "gutter-line"
1172
- }, K(s), 1))), 128))
1173
- ], 512)
1174
- ])) : D("", !0),
1175
- M("div", {
1176
- ref_key: "stage",
1177
- ref: _,
1178
- class: "stage",
1179
- style: oe(Qe.value)
1212
+ R("div", {
1213
+ class: te(["code-editor", {
1214
+ "is-readonly": l.readonly,
1215
+ "is-dark": l.theme === "dark",
1216
+ "is-collapsed": de.value,
1217
+ "is-expanding": ue.value
1218
+ }]),
1219
+ style: ae(ot.value),
1220
+ onAnimationend: Le(it, ["self"])
1180
1221
  }, [
1181
- M("div", {
1182
- ref_key: "highlightLayer",
1183
- ref: W,
1184
- class: "highlight code-font"
1185
- }, [
1186
- M("pre", {
1187
- ref_key: "highlightInner",
1188
- ref: g,
1189
- class: "code-font"
1222
+ l.lineNumbers ? (S(), E("div", Vt, [
1223
+ R("div", {
1224
+ ref_key: "gutterInner",
1225
+ ref: b,
1226
+ class: "gutter-inner code-font"
1190
1227
  }, [
1191
- M("code", { innerHTML: Je.value }, null, 8, jt)
1228
+ (S(!0), E(Oe, null, Ne(nt.value, (r) => (S(), E("div", {
1229
+ key: r,
1230
+ class: "gutter-line"
1231
+ }, K(r), 1))), 128))
1192
1232
  ], 512)
1193
- ], 512),
1194
- M("textarea", {
1195
- ref_key: "textarea",
1196
- ref: f,
1197
- class: "code-font input",
1198
- value: i.value,
1199
- readonly: l.readonly,
1200
- placeholder: l.placeholder,
1201
- spellcheck: "false",
1202
- autocomplete: "off",
1203
- autocapitalize: "off",
1204
- autocorrect: "off",
1205
- wrap: "soft",
1206
- onInput: ct,
1207
- onKeydown: ht,
1208
- onScroll: ft,
1209
- onClick: dt,
1210
- onMousemove: at,
1211
- onMouseleave: L,
1212
- onBlur: ut
1213
- }, null, 40, zt),
1214
- w.value ? (T(), S("ul", {
1215
- key: 0,
1216
- ref_key: "popup",
1217
- ref: H,
1218
- class: "popup",
1219
- style: oe(v.value),
1220
- onMousedown: t[0] || (t[0] = yt(() => {
1221
- }, ["prevent"]))
1233
+ ])) : D("", !0),
1234
+ R("div", {
1235
+ ref_key: "stage",
1236
+ ref: M,
1237
+ class: "stage"
1222
1238
  }, [
1223
- (T(!0), S(He, null, Ae(A.value, (s, m) => (T(), S("li", {
1224
- key: `${s.label}-${m}`,
1225
- class: ie(["popup-item", { "is-active": m === k.value }]),
1226
- onMouseenter: (h) => k.value = m,
1227
- onClick: (h) => Ce(s)
1239
+ R("div", {
1240
+ ref_key: "highlightLayer",
1241
+ ref: W,
1242
+ class: "highlight code-font"
1243
+ }, [
1244
+ R("pre", {
1245
+ ref_key: "highlightInner",
1246
+ ref: g,
1247
+ class: "code-font"
1248
+ }, [
1249
+ R("code", { innerHTML: tt.value }, null, 8, Kt)
1250
+ ], 512)
1251
+ ], 512),
1252
+ R("textarea", {
1253
+ ref_key: "textarea",
1254
+ ref: p,
1255
+ class: "code-font input",
1256
+ value: i.value,
1257
+ readonly: l.readonly,
1258
+ placeholder: l.placeholder,
1259
+ spellcheck: "false",
1260
+ autocomplete: "off",
1261
+ autocapitalize: "off",
1262
+ autocorrect: "off",
1263
+ wrap: "soft",
1264
+ onInput: ht,
1265
+ onKeydown: xt,
1266
+ onScroll: vt,
1267
+ onClick: gt,
1268
+ onMousemove: ft,
1269
+ onMouseleave: L,
1270
+ onBlur: bt
1271
+ }, null, 40, Zt),
1272
+ y.value ? (S(), E("ul", {
1273
+ key: 0,
1274
+ ref_key: "popup",
1275
+ ref: H,
1276
+ class: "popup",
1277
+ style: ae(k.value),
1278
+ onMousedown: n[0] || (n[0] = Le(() => {
1279
+ }, ["prevent"]))
1280
+ }, [
1281
+ (S(!0), E(Oe, null, Ne(A.value, (r, m) => (S(), E("li", {
1282
+ key: `${r.label}-${m}`,
1283
+ class: te(["popup-item", { "is-active": m === w.value }]),
1284
+ onMouseenter: (h) => w.value = m,
1285
+ onClick: (h) => Ee(r)
1286
+ }, [
1287
+ R("span", {
1288
+ class: te(["badge", `badge-${r.kind}`])
1289
+ }, K($e(r.kind)), 3),
1290
+ R("span", Ut, K(r.label), 1),
1291
+ r.detail ? (S(), E("span", Yt, K(r.detail), 1)) : D("", !0)
1292
+ ], 42, qt))), 128))
1293
+ ], 36)) : D("", !0),
1294
+ $.value ? (S(), E("div", {
1295
+ key: 1,
1296
+ ref_key: "hoverCard",
1297
+ ref: O,
1298
+ class: "hover-card",
1299
+ style: ae(ye.value)
1228
1300
  }, [
1229
- M("span", {
1230
- class: ie(["badge", `badge-${s.kind}`])
1231
- }, K(ke(s.kind)), 3),
1232
- M("span", Wt, K(s.label), 1),
1233
- s.detail ? (T(), S("span", Pt, K(s.detail), 1)) : D("", !0)
1234
- ], 42, Dt))), 128))
1235
- ], 36)) : D("", !0),
1236
- $.value ? (T(), S("div", {
1301
+ R("div", Jt, [
1302
+ R("span", {
1303
+ class: te(["badge", `badge-${$.value.kind}`])
1304
+ }, K($e($.value.kind)), 3),
1305
+ R("span", Gt, [
1306
+ Tt(K($.value.label), 1),
1307
+ $.value.detail ? (S(), E("span", Xt, ":")) : D("", !0)
1308
+ ]),
1309
+ $.value.detail ? (S(), E("span", Qt, K($.value.detail), 1)) : D("", !0)
1310
+ ]),
1311
+ $.value.documentation ? (S(), E("p", en, K($.value.documentation), 1)) : D("", !0),
1312
+ $.value.type ? (S(), E("pre", tn, [
1313
+ R("code", {
1314
+ innerHTML: st($.value.type)
1315
+ }, null, 8, nn)
1316
+ ])) : D("", !0)
1317
+ ], 4)) : D("", !0)
1318
+ ], 512),
1319
+ l.collapsible ? (S(), E("button", {
1237
1320
  key: 1,
1238
- ref_key: "hoverCard",
1239
- ref: O,
1240
- class: "hover-card",
1241
- style: oe(be.value)
1321
+ type: "button",
1322
+ class: "expand-toggle",
1323
+ title: N.value ? "收起" : "展开",
1324
+ "aria-label": N.value ? "收起编辑器" : "展开编辑器",
1325
+ onClick: at
1242
1326
  }, [
1243
- M("div", Ft, [
1244
- M("span", {
1245
- class: ie(["badge", `badge-${$.value.kind}`])
1246
- }, K(ke($.value.kind)), 3),
1247
- M("span", Vt, [
1248
- kt(K($.value.label), 1),
1249
- $.value.detail ? (T(), S("span", Kt, ":")) : D("", !0)
1250
- ]),
1251
- $.value.detail ? (T(), S("span", Zt, K($.value.detail), 1)) : D("", !0)
1252
- ]),
1253
- $.value.documentation ? (T(), S("p", qt, K($.value.documentation), 1)) : D("", !0),
1254
- $.value.type ? (T(), S("pre", Ut, [
1255
- M("code", {
1256
- innerHTML: tt($.value.type)
1257
- }, null, 8, Yt)
1258
- ])) : D("", !0)
1259
- ], 4)) : D("", !0)
1260
- ], 4),
1261
- l.collapsible ? (T(), S("button", {
1262
- key: 1,
1263
- type: "button",
1264
- class: "expand-toggle",
1265
- title: z.value ? "收起" : "展开",
1266
- "aria-label": z.value ? "收起编辑器" : "展开编辑器",
1267
- onClick: et
1268
- }, [
1269
- z.value ? (T(), S("svg", Xt, [...t[2] || (t[2] = [
1270
- M("path", {
1271
- d: "M11 2 5 8 11 14",
1272
- fill: "none",
1273
- stroke: "currentColor",
1274
- "stroke-width": "1.6",
1275
- "stroke-linecap": "round",
1276
- "stroke-linejoin": "round"
1277
- }, null, -1)
1278
- ])])) : (T(), S("svg", Gt, [...t[1] || (t[1] = [
1279
- M("path", {
1280
- d: "M6 2 12 8 6 14",
1281
- fill: "none",
1282
- stroke: "currentColor",
1283
- "stroke-width": "1.6",
1284
- "stroke-linecap": "round",
1285
- "stroke-linejoin": "round"
1286
- }, null, -1)
1287
- ])]))
1288
- ], 8, Jt)) : D("", !0)
1327
+ N.value ? (S(), E("svg", an, [...n[2] || (n[2] = [
1328
+ R("path", {
1329
+ d: "M11 2 5 8 11 14",
1330
+ fill: "none",
1331
+ stroke: "currentColor",
1332
+ "stroke-width": "1.6",
1333
+ "stroke-linecap": "round",
1334
+ "stroke-linejoin": "round"
1335
+ }, null, -1)
1336
+ ])])) : (S(), E("svg", on, [...n[1] || (n[1] = [
1337
+ R("path", {
1338
+ d: "M6 2 12 8 6 14",
1339
+ fill: "none",
1340
+ stroke: "currentColor",
1341
+ "stroke-width": "1.6",
1342
+ "stroke-linecap": "round",
1343
+ "stroke-linejoin": "round"
1344
+ }, null, -1)
1345
+ ])]))
1346
+ ], 8, ln)) : D("", !0)
1347
+ ], 38)
1289
1348
  ], 6));
1290
1349
  }
1291
- }), en = (l, r) => {
1350
+ }), rn = (l, s) => {
1292
1351
  const a = l.__vccOpts || l;
1293
- for (const [n, o] of r)
1294
- a[n] = o;
1352
+ for (const [t, o] of s)
1353
+ a[t] = o;
1295
1354
  return a;
1296
- }, tn = /* @__PURE__ */ en(Qt, [["__scopeId", "data-v-dc3651c9"]]), on = {
1355
+ }, cn = /* @__PURE__ */ rn(sn, [["__scopeId", "data-v-fcbf39fe"]]), fn = {
1297
1356
  install(l) {
1298
- l.component("CodeInput", tn);
1357
+ l.component("CodeInput", cn);
1299
1358
  }
1300
1359
  };
1301
1360
  export {
1302
- tn as CodeEditor,
1303
- Rt as collectCompletions,
1304
- on as default,
1305
- wt as defaultCompletions,
1306
- he as findTemplateRange,
1307
- Le as getKeywordSet,
1308
- Ke as getKeywords,
1309
- se as highlight,
1310
- Ot as highlightTemplate,
1311
- ln as isInsideTemplate,
1312
- At as parseTsCompletions,
1313
- Mt as resolveHoverItem,
1314
- Ne as scanDeclarations,
1315
- ae as tokenize
1361
+ cn as CodeEditor,
1362
+ At as collectCompletions,
1363
+ fn as default,
1364
+ St as defaultCompletions,
1365
+ ve as findTemplateRange,
1366
+ je as getKeywordSet,
1367
+ Ye as getKeywords,
1368
+ re as highlight,
1369
+ Pt as highlightTemplate,
1370
+ dn as isInsideTemplate,
1371
+ jt as parseTsCompletions,
1372
+ Lt as resolveHoverItem,
1373
+ We as scanDeclarations,
1374
+ se as tokenize
1316
1375
  };