@hep-code-runner/vue3 2.0.0 → 2.1.0
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/README.md +34 -17
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -6
- package/dist/index.mjs +633 -602
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
var
|
|
3
|
-
let
|
|
4
|
-
class
|
|
5
|
-
constructor(
|
|
6
|
-
|
|
1
|
+
import { defineComponent as le, useCssVars as be, ref as L, computed as B, onMounted as ge, watch as ue, onUnmounted as ve, openBlock as x, createElementBlock as I, normalizeClass as z, createElementVNode as y, normalizeStyle as J, withDirectives as Ee, createCommentVNode as U, Fragment as ye, renderList as Ae, toDisplayString as H, vModelSelect as ke, createTextVNode as Se, createStaticVNode as we, createVNode as ie, createBlock as Te, Teleport as xe, Transition as _e, withCtx as Ie, normalizeProps as Fe, guardReactiveProps as Re, renderSlot as Ne } from "vue";
|
|
2
|
+
var Le = Object.defineProperty, Oe = (i, g, n) => g in i ? Le(i, g, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[g] = n, de = (i, g, n) => Oe(i, typeof g != "symbol" ? g + "" : g, n);
|
|
3
|
+
let re = null;
|
|
4
|
+
class Ce {
|
|
5
|
+
constructor(g = {}) {
|
|
6
|
+
de(this, "baseUrl"), de(this, "timeout"), this.baseUrl = g.pistonUrl || "/api/piston", this.timeout = g.timeout || 3e3;
|
|
7
7
|
}
|
|
8
|
-
async getRuntimes(
|
|
9
|
-
if (
|
|
10
|
-
return
|
|
8
|
+
async getRuntimes(g = !1) {
|
|
9
|
+
if (re && !g)
|
|
10
|
+
return re;
|
|
11
11
|
try {
|
|
12
12
|
const n = await fetch(`${this.baseUrl}/runtimes`, {
|
|
13
13
|
method: "GET",
|
|
@@ -18,26 +18,26 @@ class Le {
|
|
|
18
18
|
if (!n.ok)
|
|
19
19
|
throw new Error(`Failed to fetch runtimes: ${n.statusText}`);
|
|
20
20
|
const l = await n.json();
|
|
21
|
-
return
|
|
21
|
+
return re = l, l;
|
|
22
22
|
} catch (n) {
|
|
23
23
|
throw console.error("Failed to fetch runtimes:", n), n;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
async execute(
|
|
27
|
-
const
|
|
28
|
-
(
|
|
29
|
-
var
|
|
30
|
-
return
|
|
26
|
+
async execute(g, n, l = {}) {
|
|
27
|
+
const f = (await this.getRuntimes()).find(
|
|
28
|
+
(m) => {
|
|
29
|
+
var b;
|
|
30
|
+
return m.language.toLowerCase() === g.toLowerCase() || ((b = m.aliases) == null ? void 0 : b.some((_) => _.toLowerCase() === g.toLowerCase()));
|
|
31
31
|
}
|
|
32
32
|
);
|
|
33
|
-
if (!
|
|
34
|
-
throw new Error(`Language '${
|
|
35
|
-
const
|
|
36
|
-
language:
|
|
37
|
-
version: l.version ||
|
|
33
|
+
if (!f)
|
|
34
|
+
throw new Error(`Language '${g}' is not supported`);
|
|
35
|
+
const T = this.getFileName(g), k = {
|
|
36
|
+
language: f.language,
|
|
37
|
+
version: l.version || f.version,
|
|
38
38
|
files: [
|
|
39
39
|
{
|
|
40
|
-
name:
|
|
40
|
+
name: T,
|
|
41
41
|
content: n
|
|
42
42
|
}
|
|
43
43
|
],
|
|
@@ -45,41 +45,41 @@ class Le {
|
|
|
45
45
|
args: l.args || [],
|
|
46
46
|
run_timeout: l.runTimeout || this.timeout,
|
|
47
47
|
compile_timeout: this.timeout
|
|
48
|
-
},
|
|
48
|
+
}, s = Date.now();
|
|
49
49
|
try {
|
|
50
|
-
const
|
|
50
|
+
const m = await fetch(`${this.baseUrl}/execute`, {
|
|
51
51
|
method: "POST",
|
|
52
52
|
headers: {
|
|
53
53
|
"Content-Type": "application/json"
|
|
54
54
|
},
|
|
55
55
|
body: JSON.stringify(k)
|
|
56
56
|
});
|
|
57
|
-
if (!
|
|
58
|
-
throw new Error(`Execute failed: ${
|
|
59
|
-
const
|
|
57
|
+
if (!m.ok)
|
|
58
|
+
throw new Error(`Execute failed: ${m.statusText}`);
|
|
59
|
+
const b = await m.json(), _ = Date.now() - s, D = b.run.stdout || "", O = b.run.stderr || "";
|
|
60
60
|
return {
|
|
61
|
-
success:
|
|
62
|
-
output:
|
|
63
|
-
stderr:
|
|
64
|
-
code:
|
|
65
|
-
executionTime:
|
|
66
|
-
compile:
|
|
67
|
-
stdout:
|
|
68
|
-
stderr:
|
|
69
|
-
code:
|
|
61
|
+
success: b.run.code === 0,
|
|
62
|
+
output: D,
|
|
63
|
+
stderr: O,
|
|
64
|
+
code: b.run.code,
|
|
65
|
+
executionTime: _,
|
|
66
|
+
compile: b.compile ? {
|
|
67
|
+
stdout: b.compile.stdout || "",
|
|
68
|
+
stderr: b.compile.stderr || "",
|
|
69
|
+
code: b.compile.code
|
|
70
70
|
} : void 0
|
|
71
71
|
};
|
|
72
|
-
} catch (
|
|
72
|
+
} catch (m) {
|
|
73
73
|
return {
|
|
74
74
|
success: !1,
|
|
75
75
|
output: "",
|
|
76
|
-
stderr:
|
|
76
|
+
stderr: m instanceof Error ? m.message : "Unknown error",
|
|
77
77
|
code: -1,
|
|
78
|
-
executionTime: Date.now() -
|
|
78
|
+
executionTime: Date.now() - s
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
getFileName(
|
|
82
|
+
getFileName(g) {
|
|
83
83
|
return {
|
|
84
84
|
javascript: "main.js",
|
|
85
85
|
typescript: "main.ts",
|
|
@@ -106,10 +106,10 @@ class Le {
|
|
|
106
106
|
css: "style.css",
|
|
107
107
|
sql: "query.sql",
|
|
108
108
|
markdown: "readme.md"
|
|
109
|
-
}[
|
|
109
|
+
}[g.toLowerCase()] || `main.${g}`;
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
const
|
|
112
|
+
const De = {
|
|
113
113
|
javascript: 'console.log("Hello, World!");',
|
|
114
114
|
typescript: 'console.log("Hello, World!");',
|
|
115
115
|
python: 'print("Hello, World!")',
|
|
@@ -207,18 +207,18 @@ h1 {
|
|
|
207
207
|
|
|
208
208
|
This is a sample markdown document.`
|
|
209
209
|
};
|
|
210
|
-
function
|
|
211
|
-
const
|
|
212
|
-
return
|
|
210
|
+
function oe(i) {
|
|
211
|
+
const g = i.toLowerCase();
|
|
212
|
+
return De[g] || `// ${i}
|
|
213
213
|
// Write your code here`;
|
|
214
214
|
}
|
|
215
|
-
var
|
|
216
|
-
function
|
|
215
|
+
var pe = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
216
|
+
function Pe(i) {
|
|
217
217
|
return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
|
|
218
218
|
}
|
|
219
|
-
var
|
|
219
|
+
var he = { exports: {} };
|
|
220
220
|
(function(i) {
|
|
221
|
-
var
|
|
221
|
+
var g = typeof window < "u" ? window : typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope ? self : {};
|
|
222
222
|
/**
|
|
223
223
|
* Prism: Lightweight, robust, elegant syntax highlighting
|
|
224
224
|
*
|
|
@@ -228,7 +228,7 @@ var ge = { exports: {} };
|
|
|
228
228
|
* @public
|
|
229
229
|
*/
|
|
230
230
|
var n = function(l) {
|
|
231
|
-
var
|
|
231
|
+
var f = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i, T = 0, k = {}, s = {
|
|
232
232
|
/**
|
|
233
233
|
* By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
|
|
234
234
|
* current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
|
|
@@ -283,8 +283,8 @@ var ge = { exports: {} };
|
|
|
283
283
|
* @memberof Prism
|
|
284
284
|
*/
|
|
285
285
|
util: {
|
|
286
|
-
encode: function t
|
|
287
|
-
return
|
|
286
|
+
encode: function e(t) {
|
|
287
|
+
return t instanceof m ? new m(t.type, e(t.content), t.alias) : Array.isArray(t) ? t.map(e) : t.replace(/&/g, "&").replace(/</g, "<").replace(/\u00a0/g, " ");
|
|
288
288
|
},
|
|
289
289
|
/**
|
|
290
290
|
* Returns the name of the type of the given value.
|
|
@@ -302,8 +302,8 @@ var ge = { exports: {} };
|
|
|
302
302
|
* type(String) === 'Function'
|
|
303
303
|
* type(/abc+/) === 'RegExp'
|
|
304
304
|
*/
|
|
305
|
-
type: function(
|
|
306
|
-
return Object.prototype.toString.call(
|
|
305
|
+
type: function(e) {
|
|
306
|
+
return Object.prototype.toString.call(e).slice(8, -1);
|
|
307
307
|
},
|
|
308
308
|
/**
|
|
309
309
|
* Returns a unique number for the given object. Later calls will still return the same number.
|
|
@@ -311,8 +311,8 @@ var ge = { exports: {} };
|
|
|
311
311
|
* @param {Object} obj
|
|
312
312
|
* @returns {number}
|
|
313
313
|
*/
|
|
314
|
-
objId: function(
|
|
315
|
-
return
|
|
314
|
+
objId: function(e) {
|
|
315
|
+
return e.__id || Object.defineProperty(e, "__id", { value: ++T }), e.__id;
|
|
316
316
|
},
|
|
317
317
|
/**
|
|
318
318
|
* Creates a deep clone of the given object.
|
|
@@ -324,30 +324,30 @@ var ge = { exports: {} };
|
|
|
324
324
|
* @returns {T}
|
|
325
325
|
* @template T
|
|
326
326
|
*/
|
|
327
|
-
clone: function t
|
|
328
|
-
|
|
329
|
-
var
|
|
330
|
-
switch (
|
|
327
|
+
clone: function e(t, a) {
|
|
328
|
+
a = a || {};
|
|
329
|
+
var r, o;
|
|
330
|
+
switch (s.util.type(t)) {
|
|
331
331
|
case "Object":
|
|
332
|
-
if (
|
|
333
|
-
return
|
|
334
|
-
|
|
335
|
-
{},
|
|
336
|
-
for (var
|
|
337
|
-
|
|
332
|
+
if (o = s.util.objId(t), a[o])
|
|
333
|
+
return a[o];
|
|
334
|
+
r = /** @type {Record<string, any>} */
|
|
335
|
+
{}, a[o] = r;
|
|
336
|
+
for (var c in t)
|
|
337
|
+
t.hasOwnProperty(c) && (r[c] = e(t[c], a));
|
|
338
338
|
return (
|
|
339
339
|
/** @type {any} */
|
|
340
|
-
|
|
340
|
+
r
|
|
341
341
|
);
|
|
342
342
|
case "Array":
|
|
343
|
-
return
|
|
343
|
+
return o = s.util.objId(t), a[o] ? a[o] : (r = [], a[o] = r, /** @type {Array} */
|
|
344
344
|
/** @type {any} */
|
|
345
|
-
|
|
346
|
-
|
|
345
|
+
t.forEach(function(E, u) {
|
|
346
|
+
r[u] = e(E, a);
|
|
347
347
|
}), /** @type {any} */
|
|
348
|
-
|
|
348
|
+
r);
|
|
349
349
|
default:
|
|
350
|
-
return
|
|
350
|
+
return t;
|
|
351
351
|
}
|
|
352
352
|
},
|
|
353
353
|
/**
|
|
@@ -358,12 +358,12 @@ var ge = { exports: {} };
|
|
|
358
358
|
* @param {Element} element
|
|
359
359
|
* @returns {string}
|
|
360
360
|
*/
|
|
361
|
-
getLanguage: function(
|
|
362
|
-
for (;
|
|
363
|
-
var
|
|
364
|
-
if (
|
|
365
|
-
return
|
|
366
|
-
|
|
361
|
+
getLanguage: function(e) {
|
|
362
|
+
for (; e; ) {
|
|
363
|
+
var t = f.exec(e.className);
|
|
364
|
+
if (t)
|
|
365
|
+
return t[1].toLowerCase();
|
|
366
|
+
e = e.parentElement;
|
|
367
367
|
}
|
|
368
368
|
return "none";
|
|
369
369
|
},
|
|
@@ -374,8 +374,8 @@ var ge = { exports: {} };
|
|
|
374
374
|
* @param {string} language
|
|
375
375
|
* @returns {void}
|
|
376
376
|
*/
|
|
377
|
-
setLanguage: function(
|
|
378
|
-
|
|
377
|
+
setLanguage: function(e, t) {
|
|
378
|
+
e.className = e.className.replace(RegExp(f, "gi"), ""), e.classList.add("language-" + t);
|
|
379
379
|
},
|
|
380
380
|
/**
|
|
381
381
|
* Returns the script element that is currently executing.
|
|
@@ -394,13 +394,13 @@ var ge = { exports: {} };
|
|
|
394
394
|
);
|
|
395
395
|
try {
|
|
396
396
|
throw new Error();
|
|
397
|
-
} catch (
|
|
398
|
-
var
|
|
399
|
-
if (
|
|
400
|
-
var
|
|
401
|
-
for (var
|
|
402
|
-
if (
|
|
403
|
-
return
|
|
397
|
+
} catch (r) {
|
|
398
|
+
var e = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(r.stack) || [])[1];
|
|
399
|
+
if (e) {
|
|
400
|
+
var t = document.getElementsByTagName("script");
|
|
401
|
+
for (var a in t)
|
|
402
|
+
if (t[a].src == e)
|
|
403
|
+
return t[a];
|
|
404
404
|
}
|
|
405
405
|
return null;
|
|
406
406
|
}
|
|
@@ -424,16 +424,16 @@ var ge = { exports: {} };
|
|
|
424
424
|
* @param {boolean} [defaultActivation=false]
|
|
425
425
|
* @returns {boolean}
|
|
426
426
|
*/
|
|
427
|
-
isActive: function(
|
|
428
|
-
for (var
|
|
429
|
-
var
|
|
430
|
-
if (
|
|
427
|
+
isActive: function(e, t, a) {
|
|
428
|
+
for (var r = "no-" + t; e; ) {
|
|
429
|
+
var o = e.classList;
|
|
430
|
+
if (o.contains(t))
|
|
431
431
|
return !0;
|
|
432
|
-
if (
|
|
432
|
+
if (o.contains(r))
|
|
433
433
|
return !1;
|
|
434
|
-
|
|
434
|
+
e = e.parentElement;
|
|
435
435
|
}
|
|
436
|
-
return !!
|
|
436
|
+
return !!a;
|
|
437
437
|
}
|
|
438
438
|
},
|
|
439
439
|
/**
|
|
@@ -479,11 +479,11 @@ var ge = { exports: {} };
|
|
|
479
479
|
* 'color': /\b(?:red|green|blue)\b/
|
|
480
480
|
* });
|
|
481
481
|
*/
|
|
482
|
-
extend: function(
|
|
483
|
-
var
|
|
484
|
-
for (var
|
|
485
|
-
r
|
|
486
|
-
return
|
|
482
|
+
extend: function(e, t) {
|
|
483
|
+
var a = s.util.clone(s.languages[e]);
|
|
484
|
+
for (var r in t)
|
|
485
|
+
a[r] = t[r];
|
|
486
|
+
return a;
|
|
487
487
|
},
|
|
488
488
|
/**
|
|
489
489
|
* Inserts tokens _before_ another token in a language definition or any other grammar.
|
|
@@ -560,31 +560,31 @@ var ge = { exports: {} };
|
|
|
560
560
|
* @returns {Grammar} The new grammar object.
|
|
561
561
|
* @public
|
|
562
562
|
*/
|
|
563
|
-
insertBefore: function(t,
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
var
|
|
567
|
-
for (var
|
|
568
|
-
if (
|
|
569
|
-
if (
|
|
570
|
-
for (var
|
|
571
|
-
|
|
572
|
-
|
|
563
|
+
insertBefore: function(e, t, a, r) {
|
|
564
|
+
r = r || /** @type {any} */
|
|
565
|
+
s.languages;
|
|
566
|
+
var o = r[e], c = {};
|
|
567
|
+
for (var E in o)
|
|
568
|
+
if (o.hasOwnProperty(E)) {
|
|
569
|
+
if (E == t)
|
|
570
|
+
for (var u in a)
|
|
571
|
+
a.hasOwnProperty(u) && (c[u] = a[u]);
|
|
572
|
+
a.hasOwnProperty(E) || (c[E] = o[E]);
|
|
573
573
|
}
|
|
574
|
-
var
|
|
575
|
-
return
|
|
576
|
-
|
|
577
|
-
}),
|
|
574
|
+
var w = r[e];
|
|
575
|
+
return r[e] = c, s.languages.DFS(s.languages, function(R, M) {
|
|
576
|
+
M === w && R != e && (this[R] = c);
|
|
577
|
+
}), c;
|
|
578
578
|
},
|
|
579
579
|
// Traverse a language definition with Depth First Search
|
|
580
|
-
DFS: function t
|
|
581
|
-
|
|
582
|
-
var
|
|
583
|
-
for (var
|
|
584
|
-
if (
|
|
585
|
-
|
|
586
|
-
var
|
|
587
|
-
|
|
580
|
+
DFS: function e(t, a, r, o) {
|
|
581
|
+
o = o || {};
|
|
582
|
+
var c = s.util.objId;
|
|
583
|
+
for (var E in t)
|
|
584
|
+
if (t.hasOwnProperty(E)) {
|
|
585
|
+
a.call(t, E, t[E], r || E);
|
|
586
|
+
var u = t[E], w = s.util.type(u);
|
|
587
|
+
w === "Object" && !o[c(u)] ? (o[c(u)] = !0, e(u, a, null, o)) : w === "Array" && !o[c(u)] && (o[c(u)] = !0, e(u, a, E, o));
|
|
588
588
|
}
|
|
589
589
|
}
|
|
590
590
|
},
|
|
@@ -601,8 +601,8 @@ var ge = { exports: {} };
|
|
|
601
601
|
* @memberof Prism
|
|
602
602
|
* @public
|
|
603
603
|
*/
|
|
604
|
-
highlightAll: function(
|
|
605
|
-
|
|
604
|
+
highlightAll: function(e, t) {
|
|
605
|
+
s.highlightAllUnder(document, e, t);
|
|
606
606
|
},
|
|
607
607
|
/**
|
|
608
608
|
* Fetches all the descendants of `container` that have a `.language-xxxx` class and then calls
|
|
@@ -619,15 +619,15 @@ var ge = { exports: {} };
|
|
|
619
619
|
* @memberof Prism
|
|
620
620
|
* @public
|
|
621
621
|
*/
|
|
622
|
-
highlightAllUnder: function(
|
|
623
|
-
var
|
|
624
|
-
callback:
|
|
625
|
-
container:
|
|
622
|
+
highlightAllUnder: function(e, t, a) {
|
|
623
|
+
var r = {
|
|
624
|
+
callback: a,
|
|
625
|
+
container: e,
|
|
626
626
|
selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
|
|
627
627
|
};
|
|
628
|
-
|
|
629
|
-
for (var
|
|
630
|
-
|
|
628
|
+
s.hooks.run("before-highlightall", r), r.elements = Array.prototype.slice.apply(r.container.querySelectorAll(r.selector)), s.hooks.run("before-all-elements-highlight", r);
|
|
629
|
+
for (var o = 0, c; c = r.elements[o++]; )
|
|
630
|
+
s.highlightElement(c, t === !0, r.callback);
|
|
631
631
|
},
|
|
632
632
|
/**
|
|
633
633
|
* Highlights the code inside a single element.
|
|
@@ -657,39 +657,39 @@ var ge = { exports: {} };
|
|
|
657
657
|
* @memberof Prism
|
|
658
658
|
* @public
|
|
659
659
|
*/
|
|
660
|
-
highlightElement: function(
|
|
661
|
-
var
|
|
662
|
-
|
|
663
|
-
var
|
|
664
|
-
|
|
665
|
-
var
|
|
666
|
-
element:
|
|
667
|
-
language:
|
|
668
|
-
grammar:
|
|
669
|
-
code:
|
|
660
|
+
highlightElement: function(e, t, a) {
|
|
661
|
+
var r = s.util.getLanguage(e), o = s.languages[r];
|
|
662
|
+
s.util.setLanguage(e, r);
|
|
663
|
+
var c = e.parentElement;
|
|
664
|
+
c && c.nodeName.toLowerCase() === "pre" && s.util.setLanguage(c, r);
|
|
665
|
+
var E = e.textContent, u = {
|
|
666
|
+
element: e,
|
|
667
|
+
language: r,
|
|
668
|
+
grammar: o,
|
|
669
|
+
code: E
|
|
670
670
|
};
|
|
671
|
-
function
|
|
672
|
-
|
|
671
|
+
function w(M) {
|
|
672
|
+
u.highlightedCode = M, s.hooks.run("before-insert", u), u.element.innerHTML = u.highlightedCode, s.hooks.run("after-highlight", u), s.hooks.run("complete", u), a && a.call(u.element);
|
|
673
673
|
}
|
|
674
|
-
if (
|
|
675
|
-
|
|
674
|
+
if (s.hooks.run("before-sanity-check", u), c = u.element.parentElement, c && c.nodeName.toLowerCase() === "pre" && !c.hasAttribute("tabindex") && c.setAttribute("tabindex", "0"), !u.code) {
|
|
675
|
+
s.hooks.run("complete", u), a && a.call(u.element);
|
|
676
676
|
return;
|
|
677
677
|
}
|
|
678
|
-
if (
|
|
679
|
-
|
|
678
|
+
if (s.hooks.run("before-highlight", u), !u.grammar) {
|
|
679
|
+
w(s.util.encode(u.code));
|
|
680
680
|
return;
|
|
681
681
|
}
|
|
682
|
-
if (
|
|
683
|
-
var
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
},
|
|
687
|
-
language:
|
|
688
|
-
code:
|
|
682
|
+
if (t && l.Worker) {
|
|
683
|
+
var R = new Worker(s.filename);
|
|
684
|
+
R.onmessage = function(M) {
|
|
685
|
+
w(M.data);
|
|
686
|
+
}, R.postMessage(JSON.stringify({
|
|
687
|
+
language: u.language,
|
|
688
|
+
code: u.code,
|
|
689
689
|
immediateClose: !0
|
|
690
690
|
}));
|
|
691
691
|
} else
|
|
692
|
-
|
|
692
|
+
w(s.highlight(u.code, u.grammar, u.language));
|
|
693
693
|
},
|
|
694
694
|
/**
|
|
695
695
|
* Low-level function, only use if you know what you’re doing. It accepts a string of text as input
|
|
@@ -711,15 +711,15 @@ var ge = { exports: {} };
|
|
|
711
711
|
* @example
|
|
712
712
|
* Prism.highlight('var foo = true;', Prism.languages.javascript, 'javascript');
|
|
713
713
|
*/
|
|
714
|
-
highlight: function(
|
|
715
|
-
var
|
|
716
|
-
code:
|
|
717
|
-
grammar:
|
|
718
|
-
language:
|
|
714
|
+
highlight: function(e, t, a) {
|
|
715
|
+
var r = {
|
|
716
|
+
code: e,
|
|
717
|
+
grammar: t,
|
|
718
|
+
language: a
|
|
719
719
|
};
|
|
720
|
-
if (
|
|
721
|
-
throw new Error('The language "' +
|
|
722
|
-
return
|
|
720
|
+
if (s.hooks.run("before-tokenize", r), !r.grammar)
|
|
721
|
+
throw new Error('The language "' + r.language + '" has no grammar.');
|
|
722
|
+
return r.tokens = s.tokenize(r.code, r.grammar), s.hooks.run("after-tokenize", r), m.stringify(s.util.encode(r.tokens), r.language);
|
|
723
723
|
},
|
|
724
724
|
/**
|
|
725
725
|
* This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
|
|
@@ -745,15 +745,15 @@ var ge = { exports: {} };
|
|
|
745
745
|
* }
|
|
746
746
|
* });
|
|
747
747
|
*/
|
|
748
|
-
tokenize: function(
|
|
749
|
-
var
|
|
750
|
-
if (
|
|
751
|
-
for (var
|
|
752
|
-
|
|
753
|
-
delete
|
|
748
|
+
tokenize: function(e, t) {
|
|
749
|
+
var a = t.rest;
|
|
750
|
+
if (a) {
|
|
751
|
+
for (var r in a)
|
|
752
|
+
t[r] = a[r];
|
|
753
|
+
delete t.rest;
|
|
754
754
|
}
|
|
755
|
-
var
|
|
756
|
-
return
|
|
755
|
+
var o = new D();
|
|
756
|
+
return O(o, o.head, e), _(e, o, t, o.head, 0), P(o);
|
|
757
757
|
},
|
|
758
758
|
/**
|
|
759
759
|
* @namespace
|
|
@@ -774,9 +774,9 @@ var ge = { exports: {} };
|
|
|
774
774
|
* @param {HookCallback} callback The callback function which is given environment variables.
|
|
775
775
|
* @public
|
|
776
776
|
*/
|
|
777
|
-
add: function(
|
|
778
|
-
var
|
|
779
|
-
|
|
777
|
+
add: function(e, t) {
|
|
778
|
+
var a = s.hooks.all;
|
|
779
|
+
a[e] = a[e] || [], a[e].push(t);
|
|
780
780
|
},
|
|
781
781
|
/**
|
|
782
782
|
* Runs a hook invoking all registered callbacks with the given environment variables.
|
|
@@ -787,135 +787,135 @@ var ge = { exports: {} };
|
|
|
787
787
|
* @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.
|
|
788
788
|
* @public
|
|
789
789
|
*/
|
|
790
|
-
run: function(
|
|
791
|
-
var
|
|
792
|
-
if (!(!
|
|
793
|
-
for (var
|
|
794
|
-
|
|
790
|
+
run: function(e, t) {
|
|
791
|
+
var a = s.hooks.all[e];
|
|
792
|
+
if (!(!a || !a.length))
|
|
793
|
+
for (var r = 0, o; o = a[r++]; )
|
|
794
|
+
o(t);
|
|
795
795
|
}
|
|
796
796
|
},
|
|
797
|
-
Token:
|
|
797
|
+
Token: m
|
|
798
798
|
};
|
|
799
|
-
l.Prism =
|
|
800
|
-
function
|
|
801
|
-
this.type =
|
|
799
|
+
l.Prism = s;
|
|
800
|
+
function m(e, t, a, r) {
|
|
801
|
+
this.type = e, this.content = t, this.alias = a, this.length = (r || "").length | 0;
|
|
802
802
|
}
|
|
803
|
-
|
|
804
|
-
if (typeof
|
|
805
|
-
return
|
|
806
|
-
if (Array.isArray(
|
|
807
|
-
var
|
|
808
|
-
return
|
|
809
|
-
|
|
810
|
-
}),
|
|
803
|
+
m.stringify = function e(t, a) {
|
|
804
|
+
if (typeof t == "string")
|
|
805
|
+
return t;
|
|
806
|
+
if (Array.isArray(t)) {
|
|
807
|
+
var r = "";
|
|
808
|
+
return t.forEach(function(w) {
|
|
809
|
+
r += e(w, a);
|
|
810
|
+
}), r;
|
|
811
811
|
}
|
|
812
|
-
var
|
|
813
|
-
type:
|
|
814
|
-
content: t
|
|
812
|
+
var o = {
|
|
813
|
+
type: t.type,
|
|
814
|
+
content: e(t.content, a),
|
|
815
815
|
tag: "span",
|
|
816
|
-
classes: ["token",
|
|
816
|
+
classes: ["token", t.type],
|
|
817
817
|
attributes: {},
|
|
818
|
-
language:
|
|
819
|
-
},
|
|
820
|
-
|
|
821
|
-
var
|
|
822
|
-
for (var
|
|
823
|
-
|
|
824
|
-
return "<" +
|
|
818
|
+
language: a
|
|
819
|
+
}, c = t.alias;
|
|
820
|
+
c && (Array.isArray(c) ? Array.prototype.push.apply(o.classes, c) : o.classes.push(c)), s.hooks.run("wrap", o);
|
|
821
|
+
var E = "";
|
|
822
|
+
for (var u in o.attributes)
|
|
823
|
+
E += " " + u + '="' + (o.attributes[u] || "").replace(/"/g, """) + '"';
|
|
824
|
+
return "<" + o.tag + ' class="' + o.classes.join(" ") + '"' + E + ">" + o.content + "</" + o.tag + ">";
|
|
825
825
|
};
|
|
826
|
-
function
|
|
827
|
-
|
|
828
|
-
var
|
|
829
|
-
if (
|
|
830
|
-
var
|
|
831
|
-
|
|
826
|
+
function b(e, t, a, r) {
|
|
827
|
+
e.lastIndex = t;
|
|
828
|
+
var o = e.exec(a);
|
|
829
|
+
if (o && r && o[1]) {
|
|
830
|
+
var c = o[1].length;
|
|
831
|
+
o.index += c, o[0] = o[0].slice(c);
|
|
832
832
|
}
|
|
833
|
-
return
|
|
833
|
+
return o;
|
|
834
834
|
}
|
|
835
|
-
function
|
|
836
|
-
for (var
|
|
837
|
-
if (!(!
|
|
838
|
-
var
|
|
839
|
-
|
|
840
|
-
for (var
|
|
841
|
-
if (
|
|
835
|
+
function _(e, t, a, r, o, c) {
|
|
836
|
+
for (var E in a)
|
|
837
|
+
if (!(!a.hasOwnProperty(E) || !a[E])) {
|
|
838
|
+
var u = a[E];
|
|
839
|
+
u = Array.isArray(u) ? u : [u];
|
|
840
|
+
for (var w = 0; w < u.length; ++w) {
|
|
841
|
+
if (c && c.cause == E + "," + w)
|
|
842
842
|
return;
|
|
843
|
-
var
|
|
844
|
-
if (
|
|
845
|
-
var
|
|
846
|
-
|
|
843
|
+
var R = u[w], M = R.inside, Y = !!R.lookbehind, j = !!R.greedy, ee = R.alias;
|
|
844
|
+
if (j && !R.pattern.global) {
|
|
845
|
+
var X = R.pattern.toString().match(/[imsuy]*$/)[0];
|
|
846
|
+
R.pattern = RegExp(R.pattern.source, X + "g");
|
|
847
847
|
}
|
|
848
|
-
for (var
|
|
849
|
-
var
|
|
850
|
-
if (
|
|
848
|
+
for (var W = R.pattern || R, N = r.next, d = o; N !== t.tail && !(c && d >= c.reach); d += N.value.length, N = N.next) {
|
|
849
|
+
var p = N.value;
|
|
850
|
+
if (t.length > e.length)
|
|
851
851
|
return;
|
|
852
|
-
if (!(
|
|
853
|
-
var
|
|
854
|
-
if (
|
|
855
|
-
if (
|
|
852
|
+
if (!(p instanceof m)) {
|
|
853
|
+
var A = 1, F;
|
|
854
|
+
if (j) {
|
|
855
|
+
if (F = b(W, d, e, Y), !F || F.index >= e.length)
|
|
856
856
|
break;
|
|
857
|
-
var
|
|
858
|
-
for (
|
|
859
|
-
|
|
860
|
-
if (
|
|
857
|
+
var Z = F.index, V = F.index + F[0].length, $ = d;
|
|
858
|
+
for ($ += N.value.length; Z >= $; )
|
|
859
|
+
N = N.next, $ += N.value.length;
|
|
860
|
+
if ($ -= N.value.length, d = $, N.value instanceof m)
|
|
861
861
|
continue;
|
|
862
|
-
for (var
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
} else if (
|
|
862
|
+
for (var G = N; G !== t.tail && ($ < V || typeof G.value == "string"); G = G.next)
|
|
863
|
+
A++, $ += G.value.length;
|
|
864
|
+
A--, p = e.slice(d, $), F.index -= d;
|
|
865
|
+
} else if (F = b(W, 0, p, Y), !F)
|
|
866
866
|
continue;
|
|
867
|
-
var
|
|
868
|
-
|
|
869
|
-
var
|
|
870
|
-
|
|
871
|
-
var
|
|
872
|
-
if (
|
|
873
|
-
var
|
|
874
|
-
cause:
|
|
875
|
-
reach:
|
|
867
|
+
var Z = F.index, K = F[0], te = p.slice(0, Z), ce = p.slice(Z + K.length), ne = d + p.length;
|
|
868
|
+
c && ne > c.reach && (c.reach = ne);
|
|
869
|
+
var q = N.prev;
|
|
870
|
+
te && (q = O(t, q, te), d += te.length), C(t, q, A);
|
|
871
|
+
var fe = new m(E, M ? s.tokenize(K, M) : K, ee, K);
|
|
872
|
+
if (N = O(t, q, fe), ce && O(t, N, ce), A > 1) {
|
|
873
|
+
var ae = {
|
|
874
|
+
cause: E + "," + w,
|
|
875
|
+
reach: ne
|
|
876
876
|
};
|
|
877
|
-
|
|
877
|
+
_(e, t, a, N.prev, d, ae), c && ae.reach > c.reach && (c.reach = ae.reach);
|
|
878
878
|
}
|
|
879
879
|
}
|
|
880
880
|
}
|
|
881
881
|
}
|
|
882
882
|
}
|
|
883
883
|
}
|
|
884
|
-
function
|
|
885
|
-
var
|
|
886
|
-
|
|
884
|
+
function D() {
|
|
885
|
+
var e = { value: null, prev: null, next: null }, t = { value: null, prev: e, next: null };
|
|
886
|
+
e.next = t, this.head = e, this.tail = t, this.length = 0;
|
|
887
887
|
}
|
|
888
|
-
function
|
|
889
|
-
var
|
|
890
|
-
return
|
|
888
|
+
function O(e, t, a) {
|
|
889
|
+
var r = t.next, o = { value: a, prev: t, next: r };
|
|
890
|
+
return t.next = o, r.prev = o, e.length++, o;
|
|
891
891
|
}
|
|
892
|
-
function
|
|
893
|
-
for (var
|
|
894
|
-
|
|
895
|
-
|
|
892
|
+
function C(e, t, a) {
|
|
893
|
+
for (var r = t.next, o = 0; o < a && r !== e.tail; o++)
|
|
894
|
+
r = r.next;
|
|
895
|
+
t.next = r, r.prev = t, e.length -= o;
|
|
896
896
|
}
|
|
897
|
-
function
|
|
898
|
-
for (var
|
|
899
|
-
|
|
900
|
-
return
|
|
897
|
+
function P(e) {
|
|
898
|
+
for (var t = [], a = e.head.next; a !== e.tail; )
|
|
899
|
+
t.push(a.value), a = a.next;
|
|
900
|
+
return t;
|
|
901
901
|
}
|
|
902
902
|
if (!l.document)
|
|
903
|
-
return l.addEventListener && (
|
|
904
|
-
var
|
|
905
|
-
l.postMessage(
|
|
906
|
-
}, !1)),
|
|
907
|
-
var
|
|
908
|
-
|
|
909
|
-
function
|
|
910
|
-
|
|
903
|
+
return l.addEventListener && (s.disableWorkerMessageHandler || l.addEventListener("message", function(e) {
|
|
904
|
+
var t = JSON.parse(e.data), a = t.language, r = t.code, o = t.immediateClose;
|
|
905
|
+
l.postMessage(s.highlight(r, s.languages[a], a)), o && l.close();
|
|
906
|
+
}, !1)), s;
|
|
907
|
+
var S = s.util.currentScript();
|
|
908
|
+
S && (s.filename = S.src, S.hasAttribute("data-manual") && (s.manual = !0));
|
|
909
|
+
function v() {
|
|
910
|
+
s.manual || s.highlightAll();
|
|
911
911
|
}
|
|
912
|
-
if (!
|
|
913
|
-
var
|
|
914
|
-
|
|
912
|
+
if (!s.manual) {
|
|
913
|
+
var h = document.readyState;
|
|
914
|
+
h === "loading" || h === "interactive" && S && S.defer ? document.addEventListener("DOMContentLoaded", v) : window.requestAnimationFrame ? window.requestAnimationFrame(v) : window.setTimeout(v, 16);
|
|
915
915
|
}
|
|
916
|
-
return
|
|
917
|
-
}(
|
|
918
|
-
i.exports && (i.exports = n), typeof
|
|
916
|
+
return s;
|
|
917
|
+
}(g);
|
|
918
|
+
i.exports && (i.exports = n), typeof pe < "u" && (pe.Prism = n), n.languages.markup = {
|
|
919
919
|
comment: {
|
|
920
920
|
pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
|
|
921
921
|
greedy: !0
|
|
@@ -1006,32 +1006,32 @@ var ge = { exports: {} };
|
|
|
1006
1006
|
* @example
|
|
1007
1007
|
* addInlined('style', 'css');
|
|
1008
1008
|
*/
|
|
1009
|
-
value: function(
|
|
1009
|
+
value: function(f, T) {
|
|
1010
1010
|
var k = {};
|
|
1011
|
-
k["language-" +
|
|
1011
|
+
k["language-" + T] = {
|
|
1012
1012
|
pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
|
|
1013
1013
|
lookbehind: !0,
|
|
1014
|
-
inside: n.languages[
|
|
1014
|
+
inside: n.languages[T]
|
|
1015
1015
|
}, k.cdata = /^<!\[CDATA\[|\]\]>$/i;
|
|
1016
|
-
var
|
|
1016
|
+
var s = {
|
|
1017
1017
|
"included-cdata": {
|
|
1018
1018
|
pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
|
|
1019
1019
|
inside: k
|
|
1020
1020
|
}
|
|
1021
1021
|
};
|
|
1022
|
-
|
|
1022
|
+
s["language-" + T] = {
|
|
1023
1023
|
pattern: /[\s\S]+/,
|
|
1024
|
-
inside: n.languages[
|
|
1024
|
+
inside: n.languages[T]
|
|
1025
1025
|
};
|
|
1026
|
-
var
|
|
1027
|
-
f
|
|
1026
|
+
var m = {};
|
|
1027
|
+
m[f] = {
|
|
1028
1028
|
pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function() {
|
|
1029
|
-
return
|
|
1029
|
+
return f;
|
|
1030
1030
|
}), "i"),
|
|
1031
1031
|
lookbehind: !0,
|
|
1032
1032
|
greedy: !0,
|
|
1033
|
-
inside:
|
|
1034
|
-
}, n.languages.insertBefore("markup", "cdata",
|
|
1033
|
+
inside: s
|
|
1034
|
+
}, n.languages.insertBefore("markup", "cdata", m);
|
|
1035
1035
|
}
|
|
1036
1036
|
}), Object.defineProperty(n.languages.markup.tag, "addAttribute", {
|
|
1037
1037
|
/**
|
|
@@ -1045,7 +1045,7 @@ var ge = { exports: {} };
|
|
|
1045
1045
|
* @example
|
|
1046
1046
|
* addAttribute('style', 'css');
|
|
1047
1047
|
*/
|
|
1048
|
-
value: function(l,
|
|
1048
|
+
value: function(l, f) {
|
|
1049
1049
|
n.languages.markup.tag.inside["special-attr"].push({
|
|
1050
1050
|
pattern: RegExp(
|
|
1051
1051
|
/(^|["'\s])/.source + "(?:" + l + ")" + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
|
|
@@ -1060,8 +1060,8 @@ var ge = { exports: {} };
|
|
|
1060
1060
|
value: {
|
|
1061
1061
|
pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
|
|
1062
1062
|
lookbehind: !0,
|
|
1063
|
-
alias: [
|
|
1064
|
-
inside: n.languages[
|
|
1063
|
+
alias: [f, "language-" + f],
|
|
1064
|
+
inside: n.languages[f]
|
|
1065
1065
|
},
|
|
1066
1066
|
punctuation: [
|
|
1067
1067
|
{
|
|
@@ -1076,11 +1076,11 @@ var ge = { exports: {} };
|
|
|
1076
1076
|
});
|
|
1077
1077
|
}
|
|
1078
1078
|
}), n.languages.html = n.languages.markup, n.languages.mathml = n.languages.markup, n.languages.svg = n.languages.markup, n.languages.xml = n.languages.extend("markup", {}), n.languages.ssml = n.languages.xml, n.languages.atom = n.languages.xml, n.languages.rss = n.languages.xml, function(l) {
|
|
1079
|
-
var
|
|
1079
|
+
var f = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
|
|
1080
1080
|
l.languages.css = {
|
|
1081
1081
|
comment: /\/\*[\s\S]*?\*\//,
|
|
1082
1082
|
atrule: {
|
|
1083
|
-
pattern: RegExp("@[\\w-](?:" + /[^;{\s"']|\s+(?!\s)/.source + "|" +
|
|
1083
|
+
pattern: RegExp("@[\\w-](?:" + /[^;{\s"']|\s+(?!\s)/.source + "|" + f.source + ")*?" + /(?:;|(?=\s*\{))/.source),
|
|
1084
1084
|
inside: {
|
|
1085
1085
|
rule: /^@[\w-]+/,
|
|
1086
1086
|
"selector-function-argument": {
|
|
@@ -1097,23 +1097,23 @@ var ge = { exports: {} };
|
|
|
1097
1097
|
},
|
|
1098
1098
|
url: {
|
|
1099
1099
|
// https://drafts.csswg.org/css-values-3/#urls
|
|
1100
|
-
pattern: RegExp("\\burl\\((?:" +
|
|
1100
|
+
pattern: RegExp("\\burl\\((?:" + f.source + "|" + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ")\\)", "i"),
|
|
1101
1101
|
greedy: !0,
|
|
1102
1102
|
inside: {
|
|
1103
1103
|
function: /^url/i,
|
|
1104
1104
|
punctuation: /^\(|\)$/,
|
|
1105
1105
|
string: {
|
|
1106
|
-
pattern: RegExp("^" +
|
|
1106
|
+
pattern: RegExp("^" + f.source + "$"),
|
|
1107
1107
|
alias: "url"
|
|
1108
1108
|
}
|
|
1109
1109
|
}
|
|
1110
1110
|
},
|
|
1111
1111
|
selector: {
|
|
1112
|
-
pattern: RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|` +
|
|
1112
|
+
pattern: RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|` + f.source + ")*(?=\\s*\\{)"),
|
|
1113
1113
|
lookbehind: !0
|
|
1114
1114
|
},
|
|
1115
1115
|
string: {
|
|
1116
|
-
pattern:
|
|
1116
|
+
pattern: f,
|
|
1117
1117
|
greedy: !0
|
|
1118
1118
|
},
|
|
1119
1119
|
property: {
|
|
@@ -1127,8 +1127,8 @@ var ge = { exports: {} };
|
|
|
1127
1127
|
},
|
|
1128
1128
|
punctuation: /[(){};:,]/
|
|
1129
1129
|
}, l.languages.css.atrule.inside.rest = l.languages.css;
|
|
1130
|
-
var
|
|
1131
|
-
|
|
1130
|
+
var T = l.languages.markup;
|
|
1131
|
+
T && (T.tag.addInlined("style", "css"), T.tag.addAttribute("style", "css"));
|
|
1132
1132
|
}(n), n.languages.clike = {
|
|
1133
1133
|
comment: [
|
|
1134
1134
|
{
|
|
@@ -1293,9 +1293,9 @@ var ge = { exports: {} };
|
|
|
1293
1293
|
if (typeof n > "u" || typeof document > "u")
|
|
1294
1294
|
return;
|
|
1295
1295
|
Element.prototype.matches || (Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector);
|
|
1296
|
-
var l = "Loading…",
|
|
1297
|
-
return "✖ Error " +
|
|
1298
|
-
},
|
|
1296
|
+
var l = "Loading…", f = function(S, v) {
|
|
1297
|
+
return "✖ Error " + S + " while fetching file: " + v;
|
|
1298
|
+
}, T = "✖ Error: File does not exist or is empty", k = {
|
|
1299
1299
|
js: "javascript",
|
|
1300
1300
|
py: "python",
|
|
1301
1301
|
rb: "ruby",
|
|
@@ -1305,52 +1305,52 @@ var ge = { exports: {} };
|
|
|
1305
1305
|
bat: "batch",
|
|
1306
1306
|
h: "c",
|
|
1307
1307
|
tex: "latex"
|
|
1308
|
-
},
|
|
1309
|
-
function
|
|
1310
|
-
var
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
},
|
|
1308
|
+
}, s = "data-src-status", m = "loading", b = "loaded", _ = "failed", D = "pre[data-src]:not([" + s + '="' + b + '"]):not([' + s + '="' + m + '"])';
|
|
1309
|
+
function O(S, v, h) {
|
|
1310
|
+
var e = new XMLHttpRequest();
|
|
1311
|
+
e.open("GET", S, !0), e.onreadystatechange = function() {
|
|
1312
|
+
e.readyState == 4 && (e.status < 400 && e.responseText ? v(e.responseText) : e.status >= 400 ? h(f(e.status, e.statusText)) : h(T));
|
|
1313
|
+
}, e.send(null);
|
|
1314
1314
|
}
|
|
1315
|
-
function
|
|
1316
|
-
var
|
|
1317
|
-
if (
|
|
1318
|
-
var
|
|
1319
|
-
return
|
|
1315
|
+
function C(S) {
|
|
1316
|
+
var v = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(S || "");
|
|
1317
|
+
if (v) {
|
|
1318
|
+
var h = Number(v[1]), e = v[2], t = v[3];
|
|
1319
|
+
return e ? t ? [h, Number(t)] : [h, void 0] : [h, h];
|
|
1320
1320
|
}
|
|
1321
1321
|
}
|
|
1322
|
-
n.hooks.add("before-highlightall", function(
|
|
1323
|
-
|
|
1324
|
-
}), n.hooks.add("before-sanity-check", function(
|
|
1325
|
-
var
|
|
1322
|
+
n.hooks.add("before-highlightall", function(S) {
|
|
1323
|
+
S.selector += ", " + D;
|
|
1324
|
+
}), n.hooks.add("before-sanity-check", function(S) {
|
|
1325
|
+
var v = (
|
|
1326
1326
|
/** @type {HTMLPreElement} */
|
|
1327
|
-
|
|
1327
|
+
S.element
|
|
1328
1328
|
);
|
|
1329
|
-
if (
|
|
1330
|
-
|
|
1331
|
-
var
|
|
1332
|
-
|
|
1333
|
-
var
|
|
1334
|
-
if (
|
|
1335
|
-
var
|
|
1336
|
-
|
|
1329
|
+
if (v.matches(D)) {
|
|
1330
|
+
S.code = "", v.setAttribute(s, m);
|
|
1331
|
+
var h = v.appendChild(document.createElement("CODE"));
|
|
1332
|
+
h.textContent = l;
|
|
1333
|
+
var e = v.getAttribute("data-src"), t = S.language;
|
|
1334
|
+
if (t === "none") {
|
|
1335
|
+
var a = (/\.(\w+)$/.exec(e) || [, "none"])[1];
|
|
1336
|
+
t = k[a] || a;
|
|
1337
1337
|
}
|
|
1338
|
-
n.util.setLanguage(
|
|
1339
|
-
var
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
function(
|
|
1343
|
-
|
|
1344
|
-
var
|
|
1345
|
-
if (
|
|
1346
|
-
var
|
|
1347
|
-
|
|
1348
|
-
`),
|
|
1338
|
+
n.util.setLanguage(h, t), n.util.setLanguage(v, t);
|
|
1339
|
+
var r = n.plugins.autoloader;
|
|
1340
|
+
r && r.loadLanguages(t), O(
|
|
1341
|
+
e,
|
|
1342
|
+
function(o) {
|
|
1343
|
+
v.setAttribute(s, b);
|
|
1344
|
+
var c = C(v.getAttribute("data-range"));
|
|
1345
|
+
if (c) {
|
|
1346
|
+
var E = o.split(/\r\n?|\n/g), u = c[0], w = c[1] == null ? E.length : c[1];
|
|
1347
|
+
u < 0 && (u += E.length), u = Math.max(0, Math.min(u - 1, E.length)), w < 0 && (w += E.length), w = Math.max(0, Math.min(w, E.length)), o = E.slice(u, w).join(`
|
|
1348
|
+
`), v.hasAttribute("data-start") || v.setAttribute("data-start", String(u + 1));
|
|
1349
1349
|
}
|
|
1350
|
-
|
|
1350
|
+
h.textContent = o, n.highlightElement(h);
|
|
1351
1351
|
},
|
|
1352
|
-
function(
|
|
1353
|
-
|
|
1352
|
+
function(o) {
|
|
1353
|
+
v.setAttribute(s, _), h.textContent = o;
|
|
1354
1354
|
}
|
|
1355
1355
|
);
|
|
1356
1356
|
}
|
|
@@ -1362,19 +1362,19 @@ var ge = { exports: {} };
|
|
|
1362
1362
|
*
|
|
1363
1363
|
* @param {ParentNode} [container=document]
|
|
1364
1364
|
*/
|
|
1365
|
-
highlight: function(
|
|
1366
|
-
for (var
|
|
1367
|
-
n.highlightElement(
|
|
1365
|
+
highlight: function(v) {
|
|
1366
|
+
for (var h = (v || document).querySelectorAll(D), e = 0, t; t = h[e++]; )
|
|
1367
|
+
n.highlightElement(t);
|
|
1368
1368
|
}
|
|
1369
1369
|
};
|
|
1370
|
-
var
|
|
1370
|
+
var P = !1;
|
|
1371
1371
|
n.fileHighlight = function() {
|
|
1372
|
-
|
|
1372
|
+
P || (console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."), P = !0), n.plugins.fileHighlight.highlight.apply(this, arguments);
|
|
1373
1373
|
};
|
|
1374
1374
|
}();
|
|
1375
|
-
})(
|
|
1376
|
-
var
|
|
1377
|
-
const
|
|
1375
|
+
})(he);
|
|
1376
|
+
var $e = he.exports;
|
|
1377
|
+
const se = /* @__PURE__ */ Pe($e);
|
|
1378
1378
|
Prism.languages.clike = {
|
|
1379
1379
|
comment: [
|
|
1380
1380
|
{
|
|
@@ -1633,7 +1633,7 @@ Prism.languages.insertBefore("go", "string", {
|
|
|
1633
1633
|
});
|
|
1634
1634
|
delete Prism.languages.go["class-name"];
|
|
1635
1635
|
(function(i) {
|
|
1636
|
-
var
|
|
1636
|
+
var g = /\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/, n = /(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source, l = {
|
|
1637
1637
|
pattern: RegExp(/(^|[^\w.])/.source + n + /[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),
|
|
1638
1638
|
lookbehind: !0,
|
|
1639
1639
|
inside: {
|
|
@@ -1669,7 +1669,7 @@ delete Prism.languages.go["class-name"];
|
|
|
1669
1669
|
inside: l.inside
|
|
1670
1670
|
}
|
|
1671
1671
|
],
|
|
1672
|
-
keyword:
|
|
1672
|
+
keyword: g,
|
|
1673
1673
|
function: [
|
|
1674
1674
|
i.languages.clike.function,
|
|
1675
1675
|
{
|
|
@@ -1704,7 +1704,7 @@ delete Prism.languages.go["class-name"];
|
|
|
1704
1704
|
pattern: /<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,
|
|
1705
1705
|
inside: {
|
|
1706
1706
|
"class-name": l,
|
|
1707
|
-
keyword:
|
|
1707
|
+
keyword: g,
|
|
1708
1708
|
punctuation: /[<>(),.:]/,
|
|
1709
1709
|
operator: /[?&|]/
|
|
1710
1710
|
}
|
|
@@ -1736,7 +1736,7 @@ delete Prism.languages.go["class-name"];
|
|
|
1736
1736
|
namespace: {
|
|
1737
1737
|
pattern: RegExp(
|
|
1738
1738
|
/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g, function() {
|
|
1739
|
-
return
|
|
1739
|
+
return g.source;
|
|
1740
1740
|
})
|
|
1741
1741
|
),
|
|
1742
1742
|
lookbehind: !0,
|
|
@@ -1823,16 +1823,16 @@ Prism.languages.insertBefore("c", "function", {
|
|
|
1823
1823
|
});
|
|
1824
1824
|
delete Prism.languages.c.boolean;
|
|
1825
1825
|
(function(i) {
|
|
1826
|
-
for (var
|
|
1827
|
-
|
|
1828
|
-
return
|
|
1826
|
+
for (var g = /\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source, n = 0; n < 2; n++)
|
|
1827
|
+
g = g.replace(/<self>/g, function() {
|
|
1828
|
+
return g;
|
|
1829
1829
|
});
|
|
1830
|
-
|
|
1830
|
+
g = g.replace(/<self>/g, function() {
|
|
1831
1831
|
return /[^\s\S]/.source;
|
|
1832
1832
|
}), i.languages.rust = {
|
|
1833
1833
|
comment: [
|
|
1834
1834
|
{
|
|
1835
|
-
pattern: RegExp(/(^|[^\\])/.source +
|
|
1835
|
+
pattern: RegExp(/(^|[^\\])/.source + g),
|
|
1836
1836
|
lookbehind: !0,
|
|
1837
1837
|
greedy: !0
|
|
1838
1838
|
},
|
|
@@ -1972,7 +1972,7 @@ Prism.languages.sql = {
|
|
|
1972
1972
|
punctuation: /[;[\]()`,.]/
|
|
1973
1973
|
};
|
|
1974
1974
|
(function(i) {
|
|
1975
|
-
var
|
|
1975
|
+
var g = "\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b", n = {
|
|
1976
1976
|
pattern: /(^(["']?)\w+\2)[ \t]+\S.*/,
|
|
1977
1977
|
lookbehind: !0,
|
|
1978
1978
|
alias: "punctuation",
|
|
@@ -1982,7 +1982,7 @@ Prism.languages.sql = {
|
|
|
1982
1982
|
}, l = {
|
|
1983
1983
|
bash: n,
|
|
1984
1984
|
environment: {
|
|
1985
|
-
pattern: RegExp("\\$" +
|
|
1985
|
+
pattern: RegExp("\\$" + g),
|
|
1986
1986
|
alias: "constant"
|
|
1987
1987
|
},
|
|
1988
1988
|
variable: [
|
|
@@ -2022,7 +2022,7 @@ Prism.languages.sql = {
|
|
|
2022
2022
|
operator: /:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,
|
|
2023
2023
|
punctuation: /[\[\]]/,
|
|
2024
2024
|
environment: {
|
|
2025
|
-
pattern: RegExp("(\\{)" +
|
|
2025
|
+
pattern: RegExp("(\\{)" + g),
|
|
2026
2026
|
lookbehind: !0,
|
|
2027
2027
|
alias: "constant"
|
|
2028
2028
|
}
|
|
@@ -2071,7 +2071,7 @@ Prism.languages.sql = {
|
|
|
2071
2071
|
pattern: /(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,
|
|
2072
2072
|
inside: {
|
|
2073
2073
|
environment: {
|
|
2074
|
-
pattern: RegExp("(^|[\\s;|&]|[<>]\\()" +
|
|
2074
|
+
pattern: RegExp("(^|[\\s;|&]|[<>]\\()" + g),
|
|
2075
2075
|
lookbehind: !0,
|
|
2076
2076
|
alias: "constant"
|
|
2077
2077
|
}
|
|
@@ -2127,7 +2127,7 @@ Prism.languages.sql = {
|
|
|
2127
2127
|
}
|
|
2128
2128
|
],
|
|
2129
2129
|
environment: {
|
|
2130
|
-
pattern: RegExp("\\$?" +
|
|
2130
|
+
pattern: RegExp("\\$?" + g),
|
|
2131
2131
|
alias: "constant"
|
|
2132
2132
|
},
|
|
2133
2133
|
variable: l.variable,
|
|
@@ -2170,7 +2170,7 @@ Prism.languages.sql = {
|
|
|
2170
2170
|
lookbehind: !0
|
|
2171
2171
|
}
|
|
2172
2172
|
}, n.inside = i.languages.bash;
|
|
2173
|
-
for (var
|
|
2173
|
+
for (var f = [
|
|
2174
2174
|
"comment",
|
|
2175
2175
|
"function-name",
|
|
2176
2176
|
"for-or-select",
|
|
@@ -2186,8 +2186,8 @@ Prism.languages.sql = {
|
|
|
2186
2186
|
"operator",
|
|
2187
2187
|
"punctuation",
|
|
2188
2188
|
"number"
|
|
2189
|
-
],
|
|
2190
|
-
|
|
2189
|
+
], T = l.variable[1].inside, k = 0; k < f.length; k++)
|
|
2190
|
+
T[f[k]] = i.languages.bash[f[k]];
|
|
2191
2191
|
i.languages.sh = i.languages.bash, i.languages.shell = i.languages.bash;
|
|
2192
2192
|
})(Prism);
|
|
2193
2193
|
Prism.languages.json = {
|
|
@@ -2215,7 +2215,7 @@ Prism.languages.json = {
|
|
|
2215
2215
|
}
|
|
2216
2216
|
};
|
|
2217
2217
|
Prism.languages.webmanifest = Prism.languages.json;
|
|
2218
|
-
const
|
|
2218
|
+
const Me = `
|
|
2219
2219
|
/* 默认代码颜色 */
|
|
2220
2220
|
.hep-cr-editor .hep-cr-highlight code,
|
|
2221
2221
|
.hep-cr-editor .hep-cr-highlight pre {
|
|
@@ -2301,7 +2301,7 @@ const $e = `
|
|
|
2301
2301
|
.hep-cr-editor .token.console {
|
|
2302
2302
|
color: #f8f8f2 !important;
|
|
2303
2303
|
}
|
|
2304
|
-
`,
|
|
2304
|
+
`, Ue = `
|
|
2305
2305
|
/* 默认代码颜色 */
|
|
2306
2306
|
.hep-cr-editor .hep-cr-highlight code,
|
|
2307
2307
|
.hep-cr-editor .hep-cr-highlight pre {
|
|
@@ -2378,7 +2378,7 @@ const $e = `
|
|
|
2378
2378
|
.hep-cr-editor .token.console {
|
|
2379
2379
|
color: #333 !important;
|
|
2380
2380
|
}
|
|
2381
|
-
`,
|
|
2381
|
+
`, Be = ["innerHTML"], He = ["value", "disabled"], Ge = 500, ze = /* @__PURE__ */ le({
|
|
2382
2382
|
__name: "CodeEditor",
|
|
2383
2383
|
props: {
|
|
2384
2384
|
modelValue: {},
|
|
@@ -2386,19 +2386,26 @@ const $e = `
|
|
|
2386
2386
|
theme: { default: "dark" },
|
|
2387
2387
|
disabled: { type: Boolean, default: !1 }
|
|
2388
2388
|
},
|
|
2389
|
-
emits: ["update:modelValue"],
|
|
2390
|
-
setup(i, { emit:
|
|
2391
|
-
be((
|
|
2392
|
-
|
|
2393
|
-
})), typeof window < "u" && (window.Prism =
|
|
2394
|
-
function n(
|
|
2389
|
+
emits: ["update:modelValue", "change"],
|
|
2390
|
+
setup(i, { emit: g }) {
|
|
2391
|
+
be((h) => ({
|
|
2392
|
+
v2b19bab6: D.value
|
|
2393
|
+
})), typeof window < "u" && (window.Prism = se);
|
|
2394
|
+
function n(h) {
|
|
2395
2395
|
if (typeof document > "u") return;
|
|
2396
|
-
const
|
|
2397
|
-
|
|
2398
|
-
const
|
|
2399
|
-
|
|
2396
|
+
const e = "hep-cr-prism-styles", t = document.getElementById(e), a = h === "dark" ? Me : Ue;
|
|
2397
|
+
t && t.remove();
|
|
2398
|
+
const r = document.createElement("style");
|
|
2399
|
+
r.id = e, r.textContent = a, document.head.appendChild(r);
|
|
2400
|
+
}
|
|
2401
|
+
const l = i, f = g, T = L(null), k = L(null);
|
|
2402
|
+
let s = null;
|
|
2403
|
+
function m(h) {
|
|
2404
|
+
s && clearTimeout(s), s = setTimeout(() => {
|
|
2405
|
+
f("change", h);
|
|
2406
|
+
}, Ge);
|
|
2400
2407
|
}
|
|
2401
|
-
const
|
|
2408
|
+
const b = {
|
|
2402
2409
|
javascript: "javascript",
|
|
2403
2410
|
js: "javascript",
|
|
2404
2411
|
typescript: "typescript",
|
|
@@ -2429,77 +2436,79 @@ const $e = `
|
|
|
2429
2436
|
yml: "yaml",
|
|
2430
2437
|
markdown: "markdown",
|
|
2431
2438
|
md: "markdown"
|
|
2432
|
-
},
|
|
2439
|
+
}, _ = B(() => b[l.language.toLowerCase()] || "javascript"), D = B(() => l.theme === "dark" ? "#1e1e1e" : "#fafafa"), O = B(() => {
|
|
2433
2440
|
try {
|
|
2434
|
-
const
|
|
2435
|
-
if (
|
|
2436
|
-
return
|
|
2441
|
+
const h = se.languages[_.value];
|
|
2442
|
+
if (h)
|
|
2443
|
+
return se.highlight(l.modelValue || "", h, _.value);
|
|
2437
2444
|
} catch {
|
|
2438
2445
|
}
|
|
2439
|
-
return
|
|
2446
|
+
return C(l.modelValue || "");
|
|
2440
2447
|
});
|
|
2441
|
-
function
|
|
2442
|
-
const
|
|
2443
|
-
return
|
|
2448
|
+
function C(h) {
|
|
2449
|
+
const e = document.createElement("div");
|
|
2450
|
+
return e.textContent = h, e.innerHTML;
|
|
2444
2451
|
}
|
|
2445
|
-
function
|
|
2446
|
-
const
|
|
2447
|
-
|
|
2452
|
+
function P(h) {
|
|
2453
|
+
const e = h.target;
|
|
2454
|
+
f("update:modelValue", e.value), m(e.value);
|
|
2448
2455
|
}
|
|
2449
|
-
function
|
|
2450
|
-
|
|
2456
|
+
function S() {
|
|
2457
|
+
T.value && k.value && (k.value.scrollTop = T.value.scrollTop, k.value.scrollLeft = T.value.scrollLeft);
|
|
2451
2458
|
}
|
|
2452
|
-
function
|
|
2453
|
-
if (
|
|
2454
|
-
|
|
2455
|
-
const
|
|
2456
|
-
|
|
2459
|
+
function v(h) {
|
|
2460
|
+
if (h.key === "Tab") {
|
|
2461
|
+
h.preventDefault();
|
|
2462
|
+
const e = h.target, t = e.selectionStart, a = e.selectionEnd, r = e.value;
|
|
2463
|
+
e.value = r.substring(0, t) + " " + r.substring(a), e.selectionStart = e.selectionEnd = t + 2, f("update:modelValue", e.value), m(e.value);
|
|
2457
2464
|
}
|
|
2458
2465
|
}
|
|
2459
|
-
return
|
|
2466
|
+
return ge(() => {
|
|
2460
2467
|
n(l.theme);
|
|
2461
|
-
}),
|
|
2462
|
-
n(
|
|
2463
|
-
}), (
|
|
2464
|
-
|
|
2468
|
+
}), ue(() => l.theme, (h) => {
|
|
2469
|
+
n(h);
|
|
2470
|
+
}), ve(() => {
|
|
2471
|
+
s && clearTimeout(s);
|
|
2472
|
+
}), (h, e) => (x(), I("div", {
|
|
2473
|
+
class: z(["hep-cr-editor", `hep-cr-theme-${i.theme}`])
|
|
2465
2474
|
}, [
|
|
2466
|
-
|
|
2475
|
+
y("pre", {
|
|
2467
2476
|
ref_key: "highlightRef",
|
|
2468
2477
|
ref: k,
|
|
2469
|
-
class:
|
|
2478
|
+
class: z(["hep-cr-highlight", [`language-${_.value}`, `hep-cr-prism-${i.theme}`]]),
|
|
2470
2479
|
"aria-hidden": "true"
|
|
2471
2480
|
}, [
|
|
2472
|
-
|
|
2481
|
+
y("code", { innerHTML: O.value }, null, 8, Be)
|
|
2473
2482
|
], 2),
|
|
2474
|
-
|
|
2483
|
+
y("textarea", {
|
|
2475
2484
|
ref_key: "codeRef",
|
|
2476
|
-
ref:
|
|
2485
|
+
ref: T,
|
|
2477
2486
|
class: "hep-cr-input",
|
|
2478
2487
|
value: i.modelValue,
|
|
2479
2488
|
disabled: i.disabled,
|
|
2480
|
-
onInput:
|
|
2481
|
-
onScroll:
|
|
2482
|
-
onKeydown:
|
|
2489
|
+
onInput: P,
|
|
2490
|
+
onScroll: S,
|
|
2491
|
+
onKeydown: v,
|
|
2483
2492
|
spellcheck: "false",
|
|
2484
2493
|
placeholder: "Write your code here..."
|
|
2485
2494
|
}, null, 40, He)
|
|
2486
2495
|
], 2));
|
|
2487
2496
|
}
|
|
2488
|
-
}),
|
|
2497
|
+
}), me = (i, g) => {
|
|
2489
2498
|
const n = i.__vccOpts || i;
|
|
2490
|
-
for (const [l,
|
|
2491
|
-
n[l] =
|
|
2499
|
+
for (const [l, f] of g)
|
|
2500
|
+
n[l] = f;
|
|
2492
2501
|
return n;
|
|
2493
|
-
},
|
|
2502
|
+
}, je = /* @__PURE__ */ me(ze, [["__scopeId", "data-v-a988ca2a"]]), We = { class: "hep-cr-header" }, Ve = { class: "hep-cr-controls" }, Ye = ["disabled"], Xe = {
|
|
2494
2503
|
key: 0,
|
|
2495
2504
|
value: ""
|
|
2496
|
-
},
|
|
2505
|
+
}, Ze = ["value"], Ke = { class: "hep-cr-actions" }, qe = ["disabled"], Je = {
|
|
2497
2506
|
key: 0,
|
|
2498
2507
|
class: "hep-cr-spinner"
|
|
2499
|
-
},
|
|
2508
|
+
}, Qe = {
|
|
2500
2509
|
key: 1,
|
|
2501
2510
|
class: "hep-cr-run-icon"
|
|
2502
|
-
},
|
|
2511
|
+
}, et = ["title"], tt = {
|
|
2503
2512
|
key: 0,
|
|
2504
2513
|
width: "16",
|
|
2505
2514
|
height: "16",
|
|
@@ -2507,7 +2516,7 @@ const $e = `
|
|
|
2507
2516
|
fill: "none",
|
|
2508
2517
|
stroke: "currentColor",
|
|
2509
2518
|
"stroke-width": "2"
|
|
2510
|
-
},
|
|
2519
|
+
}, nt = {
|
|
2511
2520
|
key: 1,
|
|
2512
2521
|
width: "16",
|
|
2513
2522
|
height: "16",
|
|
@@ -2515,10 +2524,10 @@ const $e = `
|
|
|
2515
2524
|
fill: "none",
|
|
2516
2525
|
stroke: "currentColor",
|
|
2517
2526
|
"stroke-width": "2"
|
|
2518
|
-
},
|
|
2527
|
+
}, at = {
|
|
2519
2528
|
key: 0,
|
|
2520
2529
|
class: "hep-cr-error"
|
|
2521
|
-
},
|
|
2530
|
+
}, rt = { class: "hep-cr-main" }, ot = { class: "hep-cr-panel-header" }, st = { class: "hep-cr-output-actions" }, it = { class: "hep-cr-language-badge" }, lt = ["disabled", "title"], ut = {
|
|
2522
2531
|
key: 0,
|
|
2523
2532
|
width: "14",
|
|
2524
2533
|
height: "14",
|
|
@@ -2526,13 +2535,13 @@ const $e = `
|
|
|
2526
2535
|
fill: "none",
|
|
2527
2536
|
stroke: "currentColor",
|
|
2528
2537
|
"stroke-width": "2"
|
|
2529
|
-
},
|
|
2538
|
+
}, ct = {
|
|
2530
2539
|
key: 1,
|
|
2531
2540
|
class: "hep-cr-copied-text"
|
|
2532
|
-
},
|
|
2541
|
+
}, dt = { class: "hep-cr-panel-header" }, pt = { class: "hep-cr-output-tabs" }, gt = { class: "hep-cr-output-actions" }, ht = {
|
|
2533
2542
|
key: 0,
|
|
2534
2543
|
class: "hep-cr-execution-time"
|
|
2535
|
-
},
|
|
2544
|
+
}, mt = ["disabled", "title"], ft = {
|
|
2536
2545
|
key: 0,
|
|
2537
2546
|
width: "14",
|
|
2538
2547
|
height: "14",
|
|
@@ -2540,172 +2549,193 @@ const $e = `
|
|
|
2540
2549
|
fill: "none",
|
|
2541
2550
|
stroke: "currentColor",
|
|
2542
2551
|
"stroke-width": "2"
|
|
2543
|
-
},
|
|
2552
|
+
}, bt = {
|
|
2544
2553
|
key: 1,
|
|
2545
2554
|
class: "hep-cr-copied-text"
|
|
2546
|
-
},
|
|
2555
|
+
}, vt = { class: "hep-cr-output-content" }, Et = { key: 0 }, yt = {
|
|
2547
2556
|
key: 1,
|
|
2548
2557
|
class: "hep-cr-stderr"
|
|
2549
|
-
},
|
|
2558
|
+
}, At = /* @__PURE__ */ le({
|
|
2550
2559
|
__name: "CodeRunner",
|
|
2551
2560
|
props: {
|
|
2552
2561
|
pistonUrl: { default: "/api/piston" },
|
|
2553
2562
|
language: { default: "javascript" },
|
|
2554
2563
|
theme: { default: "light" },
|
|
2564
|
+
themeColor: { default: "" },
|
|
2555
2565
|
showLanguageSelector: { type: Boolean, default: !0 },
|
|
2556
2566
|
showEditor: { type: Boolean, default: !0 },
|
|
2557
2567
|
editable: { type: Boolean, default: !0 },
|
|
2558
2568
|
defaultCode: {},
|
|
2559
2569
|
executorLabel: { default: "运行" }
|
|
2560
2570
|
},
|
|
2561
|
-
emits: ["execute-start", "execute-end", "language-change"],
|
|
2562
|
-
setup(i, { emit:
|
|
2563
|
-
const n = i, l =
|
|
2564
|
-
|
|
2565
|
-
|
|
2571
|
+
emits: ["execute-start", "execute-end", "language-change", "change"],
|
|
2572
|
+
setup(i, { emit: g }) {
|
|
2573
|
+
const n = i, l = B(() => {
|
|
2574
|
+
if (!n.themeColor) return {};
|
|
2575
|
+
const d = n.theme === "dark", p = n.themeColor, F = f(p) ? "#000" : "#fff";
|
|
2576
|
+
return {
|
|
2577
|
+
"--hep-cr-theme-color": p,
|
|
2578
|
+
"--hep-cr-theme-color-hover": d ? T(p, 20) : T(p, -20),
|
|
2579
|
+
"--hep-cr-tab-active-color": F
|
|
2580
|
+
};
|
|
2581
|
+
});
|
|
2582
|
+
function f(d) {
|
|
2583
|
+
const p = parseInt(d.replace("#", ""), 16), A = p >> 16 & 255, F = p >> 8 & 255, V = p & 255;
|
|
2584
|
+
return (0.299 * A + 0.587 * F + 0.114 * V) / 255 > 0.5;
|
|
2585
|
+
}
|
|
2586
|
+
function T(d, p) {
|
|
2587
|
+
const A = parseInt(d.replace("#", ""), 16), F = Math.round(2.55 * p), V = Math.min(255, Math.max(0, (A >> 16) + F)), $ = Math.min(255, Math.max(0, (A >> 8 & 255) + F)), G = Math.min(255, Math.max(0, (A & 255) + F));
|
|
2588
|
+
return "#" + (16777216 + V * 65536 + $ * 256 + G).toString(16).slice(1);
|
|
2589
|
+
}
|
|
2590
|
+
const k = g, s = L([]), m = L(n.language), b = L(n.theme), _ = L(""), D = L(""), O = L(""), C = L(!1), P = L(null), S = L("stdout"), v = L(null), h = L(!1), e = L(60);
|
|
2591
|
+
function t() {
|
|
2592
|
+
b.value = b.value === "light" ? "dark" : "light";
|
|
2566
2593
|
}
|
|
2567
|
-
const
|
|
2568
|
-
() => new
|
|
2569
|
-
),
|
|
2570
|
-
value: `${
|
|
2571
|
-
label: `${
|
|
2572
|
-
}))),
|
|
2573
|
-
const
|
|
2574
|
-
return
|
|
2594
|
+
const a = B(
|
|
2595
|
+
() => new Ce({ pistonUrl: n.pistonUrl })
|
|
2596
|
+
), r = B(() => s.value.map((d) => ({
|
|
2597
|
+
value: `${d.language}:${d.version}`,
|
|
2598
|
+
label: `${d.language.charAt(0).toUpperCase() + d.language.slice(1)} ${d.version}`
|
|
2599
|
+
}))), o = B(() => {
|
|
2600
|
+
const d = m.value;
|
|
2601
|
+
return d.includes(":") ? d.split(":")[0] : d;
|
|
2575
2602
|
});
|
|
2576
|
-
async function
|
|
2577
|
-
|
|
2603
|
+
async function c() {
|
|
2604
|
+
h.value = !0, v.value = null;
|
|
2578
2605
|
try {
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2606
|
+
s.value = await a.value.getRuntimes();
|
|
2607
|
+
const d = m.value.split(":")[0], p = s.value.find((A) => A.language === d);
|
|
2608
|
+
p && !m.value.includes(":") && (m.value = `${d}:${p.version}`);
|
|
2609
|
+
} catch (d) {
|
|
2610
|
+
v.value = d instanceof Error ? d.message : "Failed to load runtimes";
|
|
2582
2611
|
} finally {
|
|
2583
|
-
|
|
2612
|
+
h.value = !1;
|
|
2584
2613
|
}
|
|
2585
2614
|
}
|
|
2586
|
-
|
|
2587
|
-
const
|
|
2588
|
-
|
|
2615
|
+
ue(m, (d) => {
|
|
2616
|
+
const p = d.includes(":") ? d.split(":")[0] : d, A = oe(p);
|
|
2617
|
+
_.value = A, k("language-change", p, A);
|
|
2589
2618
|
});
|
|
2590
|
-
async function
|
|
2591
|
-
if (!
|
|
2592
|
-
|
|
2619
|
+
async function E() {
|
|
2620
|
+
if (!C.value) {
|
|
2621
|
+
C.value = !0, D.value = "", O.value = "", P.value = null, v.value = null, S.value = "stdout", k("execute-start");
|
|
2593
2622
|
try {
|
|
2594
|
-
const
|
|
2595
|
-
|
|
2596
|
-
} catch (
|
|
2597
|
-
|
|
2623
|
+
const d = await a.value.execute(o.value, _.value);
|
|
2624
|
+
D.value = d.output, O.value = d.stderr, P.value = d.executionTime || null, S.value = d.stderr ? "stderr" : "stdout", k("execute-end", d);
|
|
2625
|
+
} catch (d) {
|
|
2626
|
+
v.value = d instanceof Error ? d.message : "Execution failed", k("execute-end", {
|
|
2598
2627
|
success: !1,
|
|
2599
2628
|
output: "",
|
|
2600
|
-
stderr:
|
|
2629
|
+
stderr: v.value,
|
|
2601
2630
|
code: -1
|
|
2602
2631
|
});
|
|
2603
2632
|
} finally {
|
|
2604
|
-
|
|
2633
|
+
C.value = !1;
|
|
2605
2634
|
}
|
|
2606
2635
|
}
|
|
2607
2636
|
}
|
|
2608
|
-
const
|
|
2609
|
-
async function
|
|
2610
|
-
await navigator.clipboard.writeText(
|
|
2611
|
-
|
|
2637
|
+
const u = L(!1), w = L(!1);
|
|
2638
|
+
async function R() {
|
|
2639
|
+
await navigator.clipboard.writeText(_.value), u.value = !0, setTimeout(() => {
|
|
2640
|
+
u.value = !1;
|
|
2612
2641
|
}, 2e3);
|
|
2613
2642
|
}
|
|
2614
|
-
async function
|
|
2615
|
-
const
|
|
2616
|
-
await navigator.clipboard.writeText(
|
|
2617
|
-
|
|
2643
|
+
async function M() {
|
|
2644
|
+
const d = S.value === "stdout" ? D.value : O.value;
|
|
2645
|
+
await navigator.clipboard.writeText(d), w.value = !0, setTimeout(() => {
|
|
2646
|
+
w.value = !1;
|
|
2618
2647
|
}, 2e3);
|
|
2619
2648
|
}
|
|
2620
|
-
function
|
|
2621
|
-
|
|
2649
|
+
function Y() {
|
|
2650
|
+
_.value = oe(o.value);
|
|
2622
2651
|
}
|
|
2623
|
-
let
|
|
2624
|
-
function
|
|
2625
|
-
|
|
2652
|
+
let j = !1;
|
|
2653
|
+
function ee(d) {
|
|
2654
|
+
j = !0, document.addEventListener("mousemove", X), document.addEventListener("mouseup", W), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
|
|
2626
2655
|
}
|
|
2627
|
-
function
|
|
2628
|
-
if (!
|
|
2629
|
-
const
|
|
2656
|
+
function X(d) {
|
|
2657
|
+
if (!j) return;
|
|
2658
|
+
const p = document.querySelector(
|
|
2630
2659
|
".hep-cr-main"
|
|
2631
2660
|
);
|
|
2632
|
-
if (!
|
|
2633
|
-
const
|
|
2634
|
-
|
|
2661
|
+
if (!p) return;
|
|
2662
|
+
const A = p.getBoundingClientRect(), F = (d.clientX - A.left) / A.width * 100;
|
|
2663
|
+
e.value = Math.max(20, Math.min(80, F));
|
|
2635
2664
|
}
|
|
2636
2665
|
function W() {
|
|
2637
|
-
|
|
2666
|
+
j = !1, document.removeEventListener("mousemove", X), document.removeEventListener("mouseup", W), document.body.style.cursor = "", document.body.style.userSelect = "";
|
|
2638
2667
|
}
|
|
2639
|
-
|
|
2640
|
-
await
|
|
2668
|
+
ge(async () => {
|
|
2669
|
+
await c(), _.value || (_.value = n.defaultCode || oe(m.value));
|
|
2641
2670
|
});
|
|
2642
|
-
const
|
|
2643
|
-
return (
|
|
2644
|
-
class:
|
|
2671
|
+
const N = B(() => `hep-cr-runner-${b.value}`);
|
|
2672
|
+
return (d, p) => (x(), I("div", {
|
|
2673
|
+
class: z(["hep-cr-runner", N.value]),
|
|
2674
|
+
style: J(l.value)
|
|
2645
2675
|
}, [
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
i.showLanguageSelector ? Ee((
|
|
2676
|
+
y("div", We, [
|
|
2677
|
+
y("div", Ve, [
|
|
2678
|
+
i.showLanguageSelector ? Ee((x(), I("select", {
|
|
2649
2679
|
key: 0,
|
|
2650
|
-
"onUpdate:modelValue":
|
|
2680
|
+
"onUpdate:modelValue": p[0] || (p[0] = (A) => m.value = A),
|
|
2651
2681
|
class: "hep-cr-language-select",
|
|
2652
|
-
disabled:
|
|
2682
|
+
disabled: C.value
|
|
2653
2683
|
}, [
|
|
2654
|
-
|
|
2655
|
-
(
|
|
2656
|
-
key:
|
|
2657
|
-
value:
|
|
2658
|
-
}, H(
|
|
2659
|
-
], 8,
|
|
2660
|
-
[
|
|
2661
|
-
]) :
|
|
2684
|
+
h.value ? (x(), I("option", Xe, "加载中...")) : U("", !0),
|
|
2685
|
+
(x(!0), I(ye, null, Ae(r.value, (A) => (x(), I("option", {
|
|
2686
|
+
key: A.value,
|
|
2687
|
+
value: A.value
|
|
2688
|
+
}, H(A.label), 9, Ze))), 128))
|
|
2689
|
+
], 8, Ye)), [
|
|
2690
|
+
[ke, m.value]
|
|
2691
|
+
]) : U("", !0)
|
|
2662
2692
|
]),
|
|
2663
|
-
|
|
2664
|
-
|
|
2693
|
+
y("div", Ke, [
|
|
2694
|
+
y("button", {
|
|
2665
2695
|
class: "hep-cr-btn hep-cr-btn-run",
|
|
2666
|
-
disabled:
|
|
2667
|
-
onClick:
|
|
2696
|
+
disabled: C.value || h.value,
|
|
2697
|
+
onClick: E
|
|
2668
2698
|
}, [
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
], 8,
|
|
2672
|
-
i.showEditor && i.editable ? (
|
|
2699
|
+
C.value ? (x(), I("span", Je)) : (x(), I("span", Qe, "▶")),
|
|
2700
|
+
Se(" " + H(C.value ? "运行中..." : i.executorLabel), 1)
|
|
2701
|
+
], 8, qe),
|
|
2702
|
+
i.showEditor && i.editable ? (x(), I("button", {
|
|
2673
2703
|
key: 0,
|
|
2674
2704
|
class: "hep-cr-btn hep-cr-btn-reset",
|
|
2675
|
-
onClick:
|
|
2676
|
-
}, " 重置 ")) :
|
|
2677
|
-
|
|
2705
|
+
onClick: Y
|
|
2706
|
+
}, " 重置 ")) : U("", !0),
|
|
2707
|
+
y("button", {
|
|
2678
2708
|
class: "hep-cr-btn hep-cr-btn-theme",
|
|
2679
|
-
onClick:
|
|
2680
|
-
title:
|
|
2709
|
+
onClick: t,
|
|
2710
|
+
title: b.value === "light" ? "Switch to dark mode" : "Switch to light mode"
|
|
2681
2711
|
}, [
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
])])) : (
|
|
2685
|
-
|
|
2712
|
+
b.value === "light" ? (x(), I("svg", tt, [...p[5] || (p[5] = [
|
|
2713
|
+
y("path", { d: "M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" }, null, -1)
|
|
2714
|
+
])])) : (x(), I("svg", nt, [...p[6] || (p[6] = [
|
|
2715
|
+
we('<circle cx="12" cy="12" r="5" data-v-37101672></circle><line x1="12" y1="1" x2="12" y2="3" data-v-37101672></line><line x1="12" y1="21" x2="12" y2="23" data-v-37101672></line><line x1="4.22" y1="4.22" x2="5.64" y2="5.64" data-v-37101672></line><line x1="18.36" y1="18.36" x2="19.78" y2="19.78" data-v-37101672></line><line x1="1" y1="12" x2="3" y2="12" data-v-37101672></line><line x1="21" y1="12" x2="23" y2="12" data-v-37101672></line><line x1="4.22" y1="19.78" x2="5.64" y2="18.36" data-v-37101672></line><line x1="18.36" y1="5.64" x2="19.78" y2="4.22" data-v-37101672></line>', 9)
|
|
2686
2716
|
])]))
|
|
2687
|
-
], 8,
|
|
2717
|
+
], 8, et)
|
|
2688
2718
|
])
|
|
2689
2719
|
]),
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
i.showEditor ? (
|
|
2720
|
+
v.value ? (x(), I("div", at, H(v.value), 1)) : U("", !0),
|
|
2721
|
+
y("div", rt, [
|
|
2722
|
+
i.showEditor ? (x(), I("div", {
|
|
2693
2723
|
key: 0,
|
|
2694
2724
|
class: "hep-cr-editor-panel",
|
|
2695
|
-
style:
|
|
2725
|
+
style: J({ width: e.value + "%" })
|
|
2696
2726
|
}, [
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
class:
|
|
2703
|
-
disabled:
|
|
2704
|
-
onClick:
|
|
2705
|
-
title:
|
|
2727
|
+
y("div", ot, [
|
|
2728
|
+
p[8] || (p[8] = y("span", { class: "hep-cr-panel-title" }, "编辑器", -1)),
|
|
2729
|
+
y("div", st, [
|
|
2730
|
+
y("span", it, H(o.value), 1),
|
|
2731
|
+
y("button", {
|
|
2732
|
+
class: z(["hep-cr-btn-icon", { "hep-cr-btn-copied": u.value }]),
|
|
2733
|
+
disabled: u.value,
|
|
2734
|
+
onClick: R,
|
|
2735
|
+
title: u.value ? "已复制" : "复制"
|
|
2706
2736
|
}, [
|
|
2707
|
-
|
|
2708
|
-
|
|
2737
|
+
u.value ? (x(), I("span", ct, "已复制")) : (x(), I("svg", ut, [...p[7] || (p[7] = [
|
|
2738
|
+
y("rect", {
|
|
2709
2739
|
x: "9",
|
|
2710
2740
|
y: "9",
|
|
2711
2741
|
width: "13",
|
|
@@ -2713,52 +2743,53 @@ const $e = `
|
|
|
2713
2743
|
rx: "2",
|
|
2714
2744
|
ry: "2"
|
|
2715
2745
|
}, null, -1),
|
|
2716
|
-
|
|
2746
|
+
y("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" }, null, -1)
|
|
2717
2747
|
])]))
|
|
2718
|
-
], 10,
|
|
2748
|
+
], 10, lt)
|
|
2719
2749
|
])
|
|
2720
2750
|
]),
|
|
2721
|
-
|
|
2722
|
-
modelValue:
|
|
2723
|
-
"onUpdate:modelValue":
|
|
2724
|
-
language:
|
|
2725
|
-
theme:
|
|
2726
|
-
disabled: !i.editable ||
|
|
2751
|
+
ie(je, {
|
|
2752
|
+
modelValue: _.value,
|
|
2753
|
+
"onUpdate:modelValue": p[1] || (p[1] = (A) => _.value = A),
|
|
2754
|
+
language: o.value,
|
|
2755
|
+
theme: b.value,
|
|
2756
|
+
disabled: !i.editable || C.value,
|
|
2757
|
+
onChange: p[2] || (p[2] = (A) => k("change", A))
|
|
2727
2758
|
}, null, 8, ["modelValue", "language", "theme", "disabled"])
|
|
2728
|
-
], 4)) :
|
|
2729
|
-
i.showEditor ? (
|
|
2759
|
+
], 4)) : U("", !0),
|
|
2760
|
+
i.showEditor ? (x(), I("div", {
|
|
2730
2761
|
key: 1,
|
|
2731
2762
|
class: "hep-cr-resize-handle",
|
|
2732
|
-
onMousedown:
|
|
2733
|
-
}, [...
|
|
2734
|
-
|
|
2735
|
-
])], 32)) :
|
|
2736
|
-
|
|
2763
|
+
onMousedown: ee
|
|
2764
|
+
}, [...p[9] || (p[9] = [
|
|
2765
|
+
y("div", { class: "hep-cr-resize-line" }, null, -1)
|
|
2766
|
+
])], 32)) : U("", !0),
|
|
2767
|
+
y("div", {
|
|
2737
2768
|
class: "hep-cr-output-panel",
|
|
2738
|
-
style:
|
|
2769
|
+
style: J({ width: i.showEditor ? 100 - e.value + "%" : "100%" })
|
|
2739
2770
|
}, [
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
class:
|
|
2744
|
-
onClick:
|
|
2771
|
+
y("div", dt, [
|
|
2772
|
+
y("div", pt, [
|
|
2773
|
+
y("button", {
|
|
2774
|
+
class: z(["hep-cr-tab", { active: S.value === "stdout" }]),
|
|
2775
|
+
onClick: p[3] || (p[3] = (A) => S.value = "stdout")
|
|
2745
2776
|
}, " 输出 ", 2),
|
|
2746
|
-
|
|
2777
|
+
O.value ? (x(), I("button", {
|
|
2747
2778
|
key: 0,
|
|
2748
|
-
class:
|
|
2749
|
-
onClick:
|
|
2750
|
-
}, " 错误 ", 2)) :
|
|
2779
|
+
class: z(["hep-cr-tab", "hep-cr-tab-error", { active: S.value === "stderr" }]),
|
|
2780
|
+
onClick: p[4] || (p[4] = (A) => S.value = "stderr")
|
|
2781
|
+
}, " 错误 ", 2)) : U("", !0)
|
|
2751
2782
|
]),
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
class:
|
|
2756
|
-
disabled:
|
|
2757
|
-
onClick:
|
|
2758
|
-
title:
|
|
2783
|
+
y("div", gt, [
|
|
2784
|
+
P.value !== null ? (x(), I("span", ht, H(P.value) + "ms ", 1)) : U("", !0),
|
|
2785
|
+
y("button", {
|
|
2786
|
+
class: z(["hep-cr-btn-icon", { "hep-cr-btn-copied": w.value }]),
|
|
2787
|
+
disabled: w.value,
|
|
2788
|
+
onClick: M,
|
|
2789
|
+
title: w.value ? "已复制" : "复制"
|
|
2759
2790
|
}, [
|
|
2760
|
-
|
|
2761
|
-
|
|
2791
|
+
w.value ? (x(), I("span", bt, "已复制")) : (x(), I("svg", ft, [...p[10] || (p[10] = [
|
|
2792
|
+
y("rect", {
|
|
2762
2793
|
x: "9",
|
|
2763
2794
|
y: "9",
|
|
2764
2795
|
width: "13",
|
|
@@ -2766,22 +2797,22 @@ const $e = `
|
|
|
2766
2797
|
rx: "2",
|
|
2767
2798
|
ry: "2"
|
|
2768
2799
|
}, null, -1),
|
|
2769
|
-
|
|
2800
|
+
y("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" }, null, -1)
|
|
2770
2801
|
])]))
|
|
2771
|
-
], 10,
|
|
2802
|
+
], 10, mt)
|
|
2772
2803
|
])
|
|
2773
2804
|
]),
|
|
2774
|
-
|
|
2775
|
-
|
|
2805
|
+
y("div", vt, [
|
|
2806
|
+
S.value === "stdout" ? (x(), I("pre", Et, H(C.value ? "代码执行中..." : D.value || '点击"运行"执行代码'), 1)) : (x(), I("pre", yt, H(O.value), 1))
|
|
2776
2807
|
])
|
|
2777
2808
|
], 4)
|
|
2778
2809
|
])
|
|
2779
|
-
],
|
|
2810
|
+
], 6));
|
|
2780
2811
|
}
|
|
2781
|
-
}),
|
|
2812
|
+
}), Q = /* @__PURE__ */ me(At, [["__scopeId", "data-v-37101672"]]), kt = { class: "hep-cr-dialog-header" }, St = { class: "hep-cr-dialog-title" }, wt = { class: "hep-cr-dialog-body" }, Tt = {
|
|
2782
2813
|
key: 0,
|
|
2783
2814
|
class: "hep-cr-dialog-footer"
|
|
2784
|
-
},
|
|
2815
|
+
}, _t = /* @__PURE__ */ le({
|
|
2785
2816
|
__name: "CodeRunnerDialog",
|
|
2786
2817
|
props: {
|
|
2787
2818
|
modelValue: { type: Boolean, default: !1 },
|
|
@@ -2797,41 +2828,41 @@ const $e = `
|
|
|
2797
2828
|
executorLabel: { default: "运行" }
|
|
2798
2829
|
},
|
|
2799
2830
|
emits: ["update:modelValue", "close"],
|
|
2800
|
-
setup(i, { expose:
|
|
2801
|
-
const l = i,
|
|
2802
|
-
|
|
2831
|
+
setup(i, { expose: g, emit: n }) {
|
|
2832
|
+
const l = i, f = n, T = L(l.modelValue), k = B(() => l.modelValue !== void 0 ? l.modelValue : T.value);
|
|
2833
|
+
ue(
|
|
2803
2834
|
() => l.modelValue,
|
|
2804
|
-
(
|
|
2805
|
-
|
|
2835
|
+
(b) => {
|
|
2836
|
+
b !== void 0 && (T.value = b);
|
|
2806
2837
|
}
|
|
2807
2838
|
);
|
|
2808
|
-
function
|
|
2809
|
-
|
|
2839
|
+
function s() {
|
|
2840
|
+
T.value = !1, f("update:modelValue", !1), f("close");
|
|
2810
2841
|
}
|
|
2811
|
-
function
|
|
2812
|
-
|
|
2842
|
+
function m(b) {
|
|
2843
|
+
b.target === b.currentTarget && s();
|
|
2813
2844
|
}
|
|
2814
|
-
return
|
|
2815
|
-
close:
|
|
2816
|
-
}), (
|
|
2817
|
-
|
|
2818
|
-
default:
|
|
2819
|
-
k.value ? (
|
|
2845
|
+
return g({
|
|
2846
|
+
close: s
|
|
2847
|
+
}), (b, _) => (x(), Te(xe, { to: "body" }, [
|
|
2848
|
+
ie(_e, { name: "hep-cr-dialog-fade" }, {
|
|
2849
|
+
default: Ie(() => [
|
|
2850
|
+
k.value ? (x(), I("div", {
|
|
2820
2851
|
key: 0,
|
|
2821
2852
|
class: "hep-cr-dialog-overlay",
|
|
2822
|
-
onClick:
|
|
2853
|
+
onClick: m
|
|
2823
2854
|
}, [
|
|
2824
|
-
|
|
2855
|
+
y("div", {
|
|
2825
2856
|
class: "hep-cr-dialog-container",
|
|
2826
|
-
style:
|
|
2857
|
+
style: J({ width: typeof i.width == "number" ? i.width + "px" : i.width })
|
|
2827
2858
|
}, [
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2859
|
+
y("div", kt, [
|
|
2860
|
+
y("h3", St, H(i.title), 1),
|
|
2861
|
+
y("button", {
|
|
2831
2862
|
class: "hep-cr-dialog-close",
|
|
2832
|
-
onClick:
|
|
2833
|
-
}, [...
|
|
2834
|
-
|
|
2863
|
+
onClick: s
|
|
2864
|
+
}, [..._[0] || (_[0] = [
|
|
2865
|
+
y("svg", {
|
|
2835
2866
|
width: "16",
|
|
2836
2867
|
height: "16",
|
|
2837
2868
|
viewBox: "0 0 24 24",
|
|
@@ -2839,13 +2870,13 @@ const $e = `
|
|
|
2839
2870
|
stroke: "currentColor",
|
|
2840
2871
|
"stroke-width": "2"
|
|
2841
2872
|
}, [
|
|
2842
|
-
|
|
2873
|
+
y("line", {
|
|
2843
2874
|
x1: "18",
|
|
2844
2875
|
y1: "6",
|
|
2845
2876
|
x2: "6",
|
|
2846
2877
|
y2: "18"
|
|
2847
2878
|
}),
|
|
2848
|
-
|
|
2879
|
+
y("line", {
|
|
2849
2880
|
x1: "6",
|
|
2850
2881
|
y1: "6",
|
|
2851
2882
|
x2: "18",
|
|
@@ -2854,30 +2885,30 @@ const $e = `
|
|
|
2854
2885
|
], -1)
|
|
2855
2886
|
])])
|
|
2856
2887
|
]),
|
|
2857
|
-
|
|
2858
|
-
|
|
2888
|
+
y("div", wt, [
|
|
2889
|
+
ie(Q, Fe(Re(b.$attrs)), null, 16)
|
|
2859
2890
|
]),
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
])) :
|
|
2891
|
+
b.$slots.footer ? (x(), I("div", Tt, [
|
|
2892
|
+
Ne(b.$slots, "footer", { close: s })
|
|
2893
|
+
])) : U("", !0)
|
|
2863
2894
|
], 4)
|
|
2864
|
-
])) :
|
|
2895
|
+
])) : U("", !0)
|
|
2865
2896
|
]),
|
|
2866
2897
|
_: 3
|
|
2867
2898
|
})
|
|
2868
2899
|
]));
|
|
2869
2900
|
}
|
|
2870
2901
|
});
|
|
2871
|
-
|
|
2872
|
-
i.component("CodeRunner",
|
|
2902
|
+
Q.install = (i) => {
|
|
2903
|
+
i.component("CodeRunner", Q);
|
|
2873
2904
|
};
|
|
2874
|
-
const
|
|
2905
|
+
const It = {
|
|
2875
2906
|
install(i) {
|
|
2876
|
-
i.component("CodeRunner",
|
|
2907
|
+
i.component("CodeRunner", Q);
|
|
2877
2908
|
}
|
|
2878
2909
|
};
|
|
2879
2910
|
export {
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2911
|
+
Q as CodeRunner,
|
|
2912
|
+
_t as CodeRunnerDialog,
|
|
2913
|
+
It as default
|
|
2883
2914
|
};
|