@oneflowui/ui 0.5.0 → 0.5.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.
Files changed (41) hide show
  1. package/dist/components/Dashboard/charts/BarChart.vue.js +2 -2
  2. package/dist/components/Dashboard/charts/BarChart.vue2.js +11 -8
  3. package/dist/components/Dashboard/charts/PieChart.vue.js +2 -2
  4. package/dist/components/Dashboard/charts/PieChart.vue2.js +8 -5
  5. package/dist/components/Dashboard/index.vue.js +1 -1
  6. package/dist/components/Dashboard/index.vue2.js +20 -25
  7. package/dist/components/editor/RichTextEditor.vue2.js +1 -1
  8. package/dist/components/table/DataTable.vue.js +1 -1
  9. package/dist/components/table/DataTable.vue2.js +134 -135
  10. package/dist/components/table/FieldCell.vue.js +2 -2
  11. package/dist/components/table/FieldCell.vue2.js +16 -15
  12. package/dist/composables/useMarkdown.js +23 -23
  13. package/dist/composables/useWorkerSort.js +30 -29
  14. package/dist/index.d.ts +1 -5
  15. package/dist/index.js +250 -350
  16. package/dist/plugin.d.ts +5 -0
  17. package/dist/plugin.js +197 -0
  18. package/dist/style.css +1 -1
  19. package/dist/utils/echarts.d.ts +2 -0
  20. package/dist/utils/icon.d.ts +0 -5
  21. package/dist/utils/icon.js +72 -11
  22. package/dist/workers/tableWorkerSource.js +79 -0
  23. package/package.json +2 -3
  24. package/dist/_virtual/_commonjsHelpers.js +0 -6
  25. package/dist/assets/tableWorker-CTsbCPPP.js +0 -1
  26. package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/core.js +0 -5
  27. package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/bash.js +0 -377
  28. package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/css.js +0 -923
  29. package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/go.js +0 -151
  30. package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/java.js +0 -240
  31. package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/javascript.js +0 -658
  32. package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/json.js +0 -38
  33. package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/markdown.js +0 -216
  34. package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/plaintext.js +0 -13
  35. package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/python.js +0 -399
  36. package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/rust.js +0 -305
  37. package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/sql.js +0 -615
  38. package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/typescript.js +0 -753
  39. package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/xml.js +0 -219
  40. package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/yaml.js +0 -183
  41. package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/core.js +0 -1063
@@ -1,1063 +0,0 @@
1
- import { getDefaultExportFromCjs as Ve } from "../../../../../../_virtual/_commonjsHelpers.js";
2
- function xe(e) {
3
- return e instanceof Map ? e.clear = e.delete = e.set = function() {
4
- throw new Error("map is read-only");
5
- } : e instanceof Set && (e.add = e.clear = e.delete = function() {
6
- throw new Error("set is read-only");
7
- }), Object.freeze(e), Object.getOwnPropertyNames(e).forEach((t) => {
8
- const i = e[t], u = typeof i;
9
- (u === "object" || u === "function") && !Object.isFrozen(i) && xe(i);
10
- }), e;
11
- }
12
- class he {
13
- /**
14
- * @param {CompiledMode} mode
15
- */
16
- constructor(t) {
17
- t.data === void 0 && (t.data = {}), this.data = t.data, this.isMatchIgnored = !1;
18
- }
19
- ignoreMatch() {
20
- this.isMatchIgnored = !0;
21
- }
22
- }
23
- function we(e) {
24
- return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#x27;");
25
- }
26
- function B(e, ...t) {
27
- const i = /* @__PURE__ */ Object.create(null);
28
- for (const u in e)
29
- i[u] = e[u];
30
- return t.forEach(function(u) {
31
- for (const b in u)
32
- i[b] = u[b];
33
- }), /** @type {T} */
34
- i;
35
- }
36
- const qe = "</span>", pe = (e) => !!e.scope, Qe = (e, { prefix: t }) => {
37
- if (e.startsWith("language:"))
38
- return e.replace("language:", "language-");
39
- if (e.includes(".")) {
40
- const i = e.split(".");
41
- return [
42
- `${t}${i.shift()}`,
43
- ...i.map((u, b) => `${u}${"_".repeat(b + 1)}`)
44
- ].join(" ");
45
- }
46
- return `${t}${e}`;
47
- };
48
- class me {
49
- /**
50
- * Creates a new HTMLRenderer
51
- *
52
- * @param {Tree} parseTree - the parse tree (must support `walk` API)
53
- * @param {{classPrefix: string}} options
54
- */
55
- constructor(t, i) {
56
- this.buffer = "", this.classPrefix = i.classPrefix, t.walk(this);
57
- }
58
- /**
59
- * Adds texts to the output stream
60
- *
61
- * @param {string} text */
62
- addText(t) {
63
- this.buffer += we(t);
64
- }
65
- /**
66
- * Adds a node open to the output stream (if needed)
67
- *
68
- * @param {Node} node */
69
- openNode(t) {
70
- if (!pe(t)) return;
71
- const i = Qe(
72
- t.scope,
73
- { prefix: this.classPrefix }
74
- );
75
- this.span(i);
76
- }
77
- /**
78
- * Adds a node close to the output stream (if needed)
79
- *
80
- * @param {Node} node */
81
- closeNode(t) {
82
- pe(t) && (this.buffer += qe);
83
- }
84
- /**
85
- * returns the accumulated buffer
86
- */
87
- value() {
88
- return this.buffer;
89
- }
90
- // helpers
91
- /**
92
- * Builds a span element
93
- *
94
- * @param {string} className */
95
- span(t) {
96
- this.buffer += `<span class="${t}">`;
97
- }
98
- }
99
- const de = (e = {}) => {
100
- const t = { children: [] };
101
- return Object.assign(t, e), t;
102
- };
103
- class te {
104
- constructor() {
105
- this.rootNode = de(), this.stack = [this.rootNode];
106
- }
107
- get top() {
108
- return this.stack[this.stack.length - 1];
109
- }
110
- get root() {
111
- return this.rootNode;
112
- }
113
- /** @param {Node} node */
114
- add(t) {
115
- this.top.children.push(t);
116
- }
117
- /** @param {string} scope */
118
- openNode(t) {
119
- const i = de({ scope: t });
120
- this.add(i), this.stack.push(i);
121
- }
122
- closeNode() {
123
- if (this.stack.length > 1)
124
- return this.stack.pop();
125
- }
126
- closeAllNodes() {
127
- for (; this.closeNode(); ) ;
128
- }
129
- toJSON() {
130
- return JSON.stringify(this.rootNode, null, 4);
131
- }
132
- /**
133
- * @typedef { import("./html_renderer").Renderer } Renderer
134
- * @param {Renderer} builder
135
- */
136
- walk(t) {
137
- return this.constructor._walk(t, this.rootNode);
138
- }
139
- /**
140
- * @param {Renderer} builder
141
- * @param {Node} node
142
- */
143
- static _walk(t, i) {
144
- return typeof i == "string" ? t.addText(i) : i.children && (t.openNode(i), i.children.forEach((u) => this._walk(t, u)), t.closeNode(i)), t;
145
- }
146
- /**
147
- * @param {Node} node
148
- */
149
- static _collapse(t) {
150
- typeof t != "string" && t.children && (t.children.every((i) => typeof i == "string") ? t.children = [t.children.join("")] : t.children.forEach((i) => {
151
- te._collapse(i);
152
- }));
153
- }
154
- }
155
- class et extends te {
156
- /**
157
- * @param {*} options
158
- */
159
- constructor(t) {
160
- super(), this.options = t;
161
- }
162
- /**
163
- * @param {string} text
164
- */
165
- addText(t) {
166
- t !== "" && this.add(t);
167
- }
168
- /** @param {string} scope */
169
- startScope(t) {
170
- this.openNode(t);
171
- }
172
- endScope() {
173
- this.closeNode();
174
- }
175
- /**
176
- * @param {Emitter & {root: DataNode}} emitter
177
- * @param {string} name
178
- */
179
- __addSublanguage(t, i) {
180
- const u = t.root;
181
- i && (u.scope = `language:${i}`), this.add(u);
182
- }
183
- toHTML() {
184
- return new me(this, this.options).value();
185
- }
186
- finalize() {
187
- return this.closeAllNodes(), !0;
188
- }
189
- }
190
- function P(e) {
191
- return e ? typeof e == "string" ? e : e.source : null;
192
- }
193
- function Oe(e) {
194
- return C("(?=", e, ")");
195
- }
196
- function tt(e) {
197
- return C("(?:", e, ")*");
198
- }
199
- function nt(e) {
200
- return C("(?:", e, ")?");
201
- }
202
- function C(...e) {
203
- return e.map((i) => P(i)).join("");
204
- }
205
- function it(e) {
206
- const t = e[e.length - 1];
207
- return typeof t == "object" && t.constructor === Object ? (e.splice(e.length - 1, 1), t) : {};
208
- }
209
- function ne(...e) {
210
- return "(" + (it(e).capture ? "" : "?:") + e.map((u) => P(u)).join("|") + ")";
211
- }
212
- function Re(e) {
213
- return new RegExp(e.toString() + "|").exec("").length - 1;
214
- }
215
- function st(e, t) {
216
- const i = e && e.exec(t);
217
- return i && i.index === 0;
218
- }
219
- const rt = /\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;
220
- function ie(e, { joinWith: t }) {
221
- let i = 0;
222
- return e.map((u) => {
223
- i += 1;
224
- const b = i;
225
- let _ = P(u), c = "";
226
- for (; _.length > 0; ) {
227
- const r = rt.exec(_);
228
- if (!r) {
229
- c += _;
230
- break;
231
- }
232
- c += _.substring(0, r.index), _ = _.substring(r.index + r[0].length), r[0][0] === "\\" && r[1] ? c += "\\" + String(Number(r[1]) + b) : (c += r[0], r[0] === "(" && i++);
233
- }
234
- return c;
235
- }).map((u) => `(${u})`).join(t);
236
- }
237
- const ct = /\b\B/, ye = "[a-zA-Z]\\w*", se = "[a-zA-Z_]\\w*", Se = "\\b\\d+(\\.\\d+)?", Ne = "(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)", Ae = "\\b(0b[01]+)", ot = "!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~", at = (e = {}) => {
238
- const t = /^#![ ]*\//;
239
- return e.binary && (e.begin = C(
240
- t,
241
- /.*\b/,
242
- e.binary,
243
- /\b.*/
244
- )), B({
245
- scope: "meta",
246
- begin: t,
247
- end: /$/,
248
- relevance: 0,
249
- /** @type {ModeCallback} */
250
- "on:begin": (i, u) => {
251
- i.index !== 0 && u.ignoreMatch();
252
- }
253
- }, e);
254
- }, U = {
255
- begin: "\\\\[\\s\\S]",
256
- relevance: 0
257
- }, lt = {
258
- scope: "string",
259
- begin: "'",
260
- end: "'",
261
- illegal: "\\n",
262
- contains: [U]
263
- }, ut = {
264
- scope: "string",
265
- begin: '"',
266
- end: '"',
267
- illegal: "\\n",
268
- contains: [U]
269
- }, ft = {
270
- begin: /\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/
271
- }, Y = function(e, t, i = {}) {
272
- const u = B(
273
- {
274
- scope: "comment",
275
- begin: e,
276
- end: t,
277
- contains: []
278
- },
279
- i
280
- );
281
- u.contains.push({
282
- scope: "doctag",
283
- // hack to avoid the space from being included. the space is necessary to
284
- // match here to prevent the plain text rule below from gobbling up doctags
285
- begin: "[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",
286
- end: /(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,
287
- excludeBegin: !0,
288
- relevance: 0
289
- });
290
- const b = ne(
291
- // list of common 1 and 2 letter words in English
292
- "I",
293
- "a",
294
- "is",
295
- "so",
296
- "us",
297
- "to",
298
- "at",
299
- "if",
300
- "in",
301
- "it",
302
- "on",
303
- // note: this is not an exhaustive list of contractions, just popular ones
304
- /[A-Za-z]+['](d|ve|re|ll|t|s|n)/,
305
- // contractions - can't we'd they're let's, etc
306
- /[A-Za-z]+[-][a-z]+/,
307
- // `no-way`, etc.
308
- /[A-Za-z][a-z]{2,}/
309
- // allow capitalized words at beginning of sentences
310
- );
311
- return u.contains.push(
312
- {
313
- // TODO: how to include ", (, ) without breaking grammars that use these for
314
- // comment delimiters?
315
- // begin: /[ ]+([()"]?([A-Za-z'-]{3,}|is|a|I|so|us|[tT][oO]|at|if|in|it|on)[.]?[()":]?([.][ ]|[ ]|\))){3}/
316
- // ---
317
- // this tries to find sequences of 3 english words in a row (without any
318
- // "programming" type syntax) this gives us a strong signal that we've
319
- // TRULY found a comment - vs perhaps scanning with the wrong language.
320
- // It's possible to find something that LOOKS like the start of the
321
- // comment - but then if there is no readable text - good chance it is a
322
- // false match and not a comment.
323
- //
324
- // for a visual example please see:
325
- // https://github.com/highlightjs/highlight.js/issues/2827
326
- begin: C(
327
- /[ ]+/,
328
- // necessary to prevent us gobbling up doctags like /* @author Bob Mcgill */
329
- "(",
330
- b,
331
- /[.]?[:]?([.][ ]|[ ])/,
332
- "){3}"
333
- )
334
- // look for 3 words in a row
335
- }
336
- ), u;
337
- }, gt = Y("//", "$"), ht = Y("/\\*", "\\*/"), pt = Y("#", "$"), dt = {
338
- scope: "number",
339
- begin: Se,
340
- relevance: 0
341
- }, Et = {
342
- scope: "number",
343
- begin: Ne,
344
- relevance: 0
345
- }, bt = {
346
- scope: "number",
347
- begin: Ae,
348
- relevance: 0
349
- }, _t = {
350
- scope: "regexp",
351
- begin: /\/(?=[^/\n]*\/)/,
352
- end: /\/[gimuy]*/,
353
- contains: [
354
- U,
355
- {
356
- begin: /\[/,
357
- end: /\]/,
358
- relevance: 0,
359
- contains: [U]
360
- }
361
- ]
362
- }, Mt = {
363
- scope: "title",
364
- begin: ye,
365
- relevance: 0
366
- }, xt = {
367
- scope: "title",
368
- begin: se,
369
- relevance: 0
370
- }, wt = {
371
- // excludes method names from keyword processing
372
- begin: "\\.\\s*" + se,
373
- relevance: 0
374
- }, Ot = function(e) {
375
- return Object.assign(
376
- e,
377
- {
378
- /** @type {ModeCallback} */
379
- "on:begin": (t, i) => {
380
- i.data._beginMatch = t[1];
381
- },
382
- /** @type {ModeCallback} */
383
- "on:end": (t, i) => {
384
- i.data._beginMatch !== t[1] && i.ignoreMatch();
385
- }
386
- }
387
- );
388
- };
389
- var z = /* @__PURE__ */ Object.freeze({
390
- __proto__: null,
391
- APOS_STRING_MODE: lt,
392
- BACKSLASH_ESCAPE: U,
393
- BINARY_NUMBER_MODE: bt,
394
- BINARY_NUMBER_RE: Ae,
395
- COMMENT: Y,
396
- C_BLOCK_COMMENT_MODE: ht,
397
- C_LINE_COMMENT_MODE: gt,
398
- C_NUMBER_MODE: Et,
399
- C_NUMBER_RE: Ne,
400
- END_SAME_AS_BEGIN: Ot,
401
- HASH_COMMENT_MODE: pt,
402
- IDENT_RE: ye,
403
- MATCH_NOTHING_RE: ct,
404
- METHOD_GUARD: wt,
405
- NUMBER_MODE: dt,
406
- NUMBER_RE: Se,
407
- PHRASAL_WORDS_MODE: ft,
408
- QUOTE_STRING_MODE: ut,
409
- REGEXP_MODE: _t,
410
- RE_STARTERS_RE: ot,
411
- SHEBANG: at,
412
- TITLE_MODE: Mt,
413
- UNDERSCORE_IDENT_RE: se,
414
- UNDERSCORE_TITLE_MODE: xt
415
- });
416
- function Rt(e, t) {
417
- e.input[e.index - 1] === "." && t.ignoreMatch();
418
- }
419
- function yt(e, t) {
420
- e.className !== void 0 && (e.scope = e.className, delete e.className);
421
- }
422
- function St(e, t) {
423
- t && e.beginKeywords && (e.begin = "\\b(" + e.beginKeywords.split(" ").join("|") + ")(?!\\.)(?=\\b|\\s)", e.__beforeBegin = Rt, e.keywords = e.keywords || e.beginKeywords, delete e.beginKeywords, e.relevance === void 0 && (e.relevance = 0));
424
- }
425
- function Nt(e, t) {
426
- Array.isArray(e.illegal) && (e.illegal = ne(...e.illegal));
427
- }
428
- function At(e, t) {
429
- if (e.match) {
430
- if (e.begin || e.end) throw new Error("begin & end are not supported with match");
431
- e.begin = e.match, delete e.match;
432
- }
433
- }
434
- function kt(e, t) {
435
- e.relevance === void 0 && (e.relevance = 1);
436
- }
437
- const Tt = (e, t) => {
438
- if (!e.beforeMatch) return;
439
- if (e.starts) throw new Error("beforeMatch cannot be used with starts");
440
- const i = Object.assign({}, e);
441
- Object.keys(e).forEach((u) => {
442
- delete e[u];
443
- }), e.keywords = i.keywords, e.begin = C(i.beforeMatch, Oe(i.begin)), e.starts = {
444
- relevance: 0,
445
- contains: [
446
- Object.assign(i, { endsParent: !0 })
447
- ]
448
- }, e.relevance = 0, delete i.beforeMatch;
449
- }, It = [
450
- "of",
451
- "and",
452
- "for",
453
- "in",
454
- "not",
455
- "or",
456
- "if",
457
- "then",
458
- "parent",
459
- // common variable name
460
- "list",
461
- // common variable name
462
- "value"
463
- // common variable name
464
- ], Bt = "keyword";
465
- function ke(e, t, i = Bt) {
466
- const u = /* @__PURE__ */ Object.create(null);
467
- return typeof e == "string" ? b(i, e.split(" ")) : Array.isArray(e) ? b(i, e) : Object.keys(e).forEach(function(_) {
468
- Object.assign(
469
- u,
470
- ke(e[_], t, _)
471
- );
472
- }), u;
473
- function b(_, c) {
474
- t && (c = c.map((r) => r.toLowerCase())), c.forEach(function(r) {
475
- const l = r.split("|");
476
- u[l[0]] = [_, Dt(l[0], l[1])];
477
- });
478
- }
479
- }
480
- function Dt(e, t) {
481
- return t ? Number(t) : vt(e) ? 0 : 1;
482
- }
483
- function vt(e) {
484
- return It.includes(e.toLowerCase());
485
- }
486
- const Ee = {}, v = (e) => {
487
- console.error(e);
488
- }, be = (e, ...t) => {
489
- console.log(`WARN: ${e}`, ...t);
490
- }, L = (e, t) => {
491
- Ee[`${e}/${t}`] || (console.log(`Deprecated as of ${e}. ${t}`), Ee[`${e}/${t}`] = !0);
492
- }, X = new Error();
493
- function Te(e, t, { key: i }) {
494
- let u = 0;
495
- const b = e[i], _ = {}, c = {};
496
- for (let r = 1; r <= t.length; r++)
497
- c[r + u] = b[r], _[r + u] = !0, u += Re(t[r - 1]);
498
- e[i] = c, e[i]._emit = _, e[i]._multi = !0;
499
- }
500
- function Ct(e) {
501
- if (Array.isArray(e.begin)) {
502
- if (e.skip || e.excludeBegin || e.returnBegin)
503
- throw v("skip, excludeBegin, returnBegin not compatible with beginScope: {}"), X;
504
- if (typeof e.beginScope != "object" || e.beginScope === null)
505
- throw v("beginScope must be object"), X;
506
- Te(e, e.begin, { key: "beginScope" }), e.begin = ie(e.begin, { joinWith: "" });
507
- }
508
- }
509
- function Lt(e) {
510
- if (Array.isArray(e.end)) {
511
- if (e.skip || e.excludeEnd || e.returnEnd)
512
- throw v("skip, excludeEnd, returnEnd not compatible with endScope: {}"), X;
513
- if (typeof e.endScope != "object" || e.endScope === null)
514
- throw v("endScope must be object"), X;
515
- Te(e, e.end, { key: "endScope" }), e.end = ie(e.end, { joinWith: "" });
516
- }
517
- }
518
- function Ht(e) {
519
- e.scope && typeof e.scope == "object" && e.scope !== null && (e.beginScope = e.scope, delete e.scope);
520
- }
521
- function jt(e) {
522
- Ht(e), typeof e.beginScope == "string" && (e.beginScope = { _wrap: e.beginScope }), typeof e.endScope == "string" && (e.endScope = { _wrap: e.endScope }), Ct(e), Lt(e);
523
- }
524
- function Pt(e) {
525
- function t(c, r) {
526
- return new RegExp(
527
- P(c),
528
- "m" + (e.case_insensitive ? "i" : "") + (e.unicodeRegex ? "u" : "") + (r ? "g" : "")
529
- );
530
- }
531
- class i {
532
- constructor() {
533
- this.matchIndexes = {}, this.regexes = [], this.matchAt = 1, this.position = 0;
534
- }
535
- // @ts-ignore
536
- addRule(r, l) {
537
- l.position = this.position++, this.matchIndexes[this.matchAt] = l, this.regexes.push([l, r]), this.matchAt += Re(r) + 1;
538
- }
539
- compile() {
540
- this.regexes.length === 0 && (this.exec = () => null);
541
- const r = this.regexes.map((l) => l[1]);
542
- this.matcherRe = t(ie(r, { joinWith: "|" }), !0), this.lastIndex = 0;
543
- }
544
- /** @param {string} s */
545
- exec(r) {
546
- this.matcherRe.lastIndex = this.lastIndex;
547
- const l = this.matcherRe.exec(r);
548
- if (!l)
549
- return null;
550
- const w = l.findIndex((j, Z) => Z > 0 && j !== void 0), M = this.matchIndexes[w];
551
- return l.splice(0, w), Object.assign(l, M);
552
- }
553
- }
554
- class u {
555
- constructor() {
556
- this.rules = [], this.multiRegexes = [], this.count = 0, this.lastIndex = 0, this.regexIndex = 0;
557
- }
558
- // @ts-ignore
559
- getMatcher(r) {
560
- if (this.multiRegexes[r]) return this.multiRegexes[r];
561
- const l = new i();
562
- return this.rules.slice(r).forEach(([w, M]) => l.addRule(w, M)), l.compile(), this.multiRegexes[r] = l, l;
563
- }
564
- resumingScanAtSamePosition() {
565
- return this.regexIndex !== 0;
566
- }
567
- considerAll() {
568
- this.regexIndex = 0;
569
- }
570
- // @ts-ignore
571
- addRule(r, l) {
572
- this.rules.push([r, l]), l.type === "begin" && this.count++;
573
- }
574
- /** @param {string} s */
575
- exec(r) {
576
- const l = this.getMatcher(this.regexIndex);
577
- l.lastIndex = this.lastIndex;
578
- let w = l.exec(r);
579
- if (this.resumingScanAtSamePosition() && !(w && w.index === this.lastIndex)) {
580
- const M = this.getMatcher(0);
581
- M.lastIndex = this.lastIndex + 1, w = M.exec(r);
582
- }
583
- return w && (this.regexIndex += w.position + 1, this.regexIndex === this.count && this.considerAll()), w;
584
- }
585
- }
586
- function b(c) {
587
- const r = new u();
588
- return c.contains.forEach((l) => r.addRule(l.begin, { rule: l, type: "begin" })), c.terminatorEnd && r.addRule(c.terminatorEnd, { type: "end" }), c.illegal && r.addRule(c.illegal, { type: "illegal" }), r;
589
- }
590
- function _(c, r) {
591
- const l = (
592
- /** @type CompiledMode */
593
- c
594
- );
595
- if (c.isCompiled) return l;
596
- [
597
- yt,
598
- // do this early so compiler extensions generally don't have to worry about
599
- // the distinction between match/begin
600
- At,
601
- jt,
602
- Tt
603
- ].forEach((M) => M(c, r)), e.compilerExtensions.forEach((M) => M(c, r)), c.__beforeBegin = null, [
604
- St,
605
- // do this later so compiler extensions that come earlier have access to the
606
- // raw array if they wanted to perhaps manipulate it, etc.
607
- Nt,
608
- // default to 1 relevance if not specified
609
- kt
610
- ].forEach((M) => M(c, r)), c.isCompiled = !0;
611
- let w = null;
612
- return typeof c.keywords == "object" && c.keywords.$pattern && (c.keywords = Object.assign({}, c.keywords), w = c.keywords.$pattern, delete c.keywords.$pattern), w = w || /\w+/, c.keywords && (c.keywords = ke(c.keywords, e.case_insensitive)), l.keywordPatternRe = t(w, !0), r && (c.begin || (c.begin = /\B|\b/), l.beginRe = t(l.begin), !c.end && !c.endsWithParent && (c.end = /\B|\b/), c.end && (l.endRe = t(l.end)), l.terminatorEnd = P(l.end) || "", c.endsWithParent && r.terminatorEnd && (l.terminatorEnd += (c.end ? "|" : "") + r.terminatorEnd)), c.illegal && (l.illegalRe = t(
613
- /** @type {RegExp | string} */
614
- c.illegal
615
- )), c.contains || (c.contains = []), c.contains = [].concat(...c.contains.map(function(M) {
616
- return Ut(M === "self" ? c : M);
617
- })), c.contains.forEach(function(M) {
618
- _(
619
- /** @type Mode */
620
- M,
621
- l
622
- );
623
- }), c.starts && _(c.starts, r), l.matcher = b(l), l;
624
- }
625
- if (e.compilerExtensions || (e.compilerExtensions = []), e.contains && e.contains.includes("self"))
626
- throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");
627
- return e.classNameAliases = B(e.classNameAliases || {}), _(
628
- /** @type Mode */
629
- e
630
- );
631
- }
632
- function Ie(e) {
633
- return e ? e.endsWithParent || Ie(e.starts) : !1;
634
- }
635
- function Ut(e) {
636
- return e.variants && !e.cachedVariants && (e.cachedVariants = e.variants.map(function(t) {
637
- return B(e, { variants: null }, t);
638
- })), e.cachedVariants ? e.cachedVariants : Ie(e) ? B(e, { starts: e.starts ? B(e.starts) : null }) : Object.isFrozen(e) ? B(e) : e;
639
- }
640
- var $t = "11.11.1";
641
- class Gt extends Error {
642
- constructor(t, i) {
643
- super(t), this.name = "HTMLInjectionError", this.html = i;
644
- }
645
- }
646
- const ee = we, _e = B, Me = Symbol("nomatch"), Wt = 7, Be = function(e) {
647
- const t = /* @__PURE__ */ Object.create(null), i = /* @__PURE__ */ Object.create(null), u = [];
648
- let b = !0;
649
- const _ = "Could not find the language '{}', did you forget to load/include a language module?", c = { disableAutodetect: !0, name: "Plain text", contains: [] };
650
- let r = {
651
- ignoreUnescapedHTML: !1,
652
- throwUnescapedHTML: !1,
653
- noHighlightRe: /^(no-?highlight)$/i,
654
- languageDetectRe: /\blang(?:uage)?-([\w-]+)\b/i,
655
- classPrefix: "hljs-",
656
- cssSelector: "pre code",
657
- languages: null,
658
- // beta configuration options, subject to change, welcome to discuss
659
- // https://github.com/highlightjs/highlight.js/issues/1086
660
- __emitter: et
661
- };
662
- function l(n) {
663
- return r.noHighlightRe.test(n);
664
- }
665
- function w(n) {
666
- let a = n.className + " ";
667
- a += n.parentNode ? n.parentNode.className : "";
668
- const h = r.languageDetectRe.exec(a);
669
- if (h) {
670
- const d = T(h[1]);
671
- return d || (be(_.replace("{}", h[1])), be("Falling back to no-highlight mode for this block.", n)), d ? h[1] : "no-highlight";
672
- }
673
- return a.split(/\s+/).find((d) => l(d) || T(d));
674
- }
675
- function M(n, a, h) {
676
- let d = "", x = "";
677
- typeof a == "object" ? (d = n, h = a.ignoreIllegals, x = a.language) : (L("10.7.0", "highlight(lang, code, ...args) has been deprecated."), L("10.7.0", `Please use highlight(code, options) instead.
678
- https://github.com/highlightjs/highlight.js/issues/2277`), x = n, d = a), h === void 0 && (h = !0);
679
- const S = {
680
- code: d,
681
- language: x
682
- };
683
- G("before:highlight", S);
684
- const I = S.result ? S.result : j(S.language, S.code, h);
685
- return I.code = S.code, G("after:highlight", I), I;
686
- }
687
- function j(n, a, h, d) {
688
- const x = /* @__PURE__ */ Object.create(null);
689
- function S(s, o) {
690
- return s.keywords[o];
691
- }
692
- function I() {
693
- if (!f.keywords) {
694
- O.addText(E);
695
- return;
696
- }
697
- let s = 0;
698
- f.keywordPatternRe.lastIndex = 0;
699
- let o = f.keywordPatternRe.exec(E), g = "";
700
- for (; o; ) {
701
- g += E.substring(s, o.index);
702
- const p = A.case_insensitive ? o[0].toLowerCase() : o[0], R = S(f, p);
703
- if (R) {
704
- const [k, Ze] = R;
705
- if (O.addText(g), g = "", x[p] = (x[p] || 0) + 1, x[p] <= Wt && (F += Ze), k.startsWith("_"))
706
- g += o[0];
707
- else {
708
- const Je = A.classNameAliases[k] || k;
709
- N(o[0], Je);
710
- }
711
- } else
712
- g += o[0];
713
- s = f.keywordPatternRe.lastIndex, o = f.keywordPatternRe.exec(E);
714
- }
715
- g += E.substring(s), O.addText(g);
716
- }
717
- function W() {
718
- if (E === "") return;
719
- let s = null;
720
- if (typeof f.subLanguage == "string") {
721
- if (!t[f.subLanguage]) {
722
- O.addText(E);
723
- return;
724
- }
725
- s = j(f.subLanguage, E, !0, ge[f.subLanguage]), ge[f.subLanguage] = /** @type {CompiledMode} */
726
- s._top;
727
- } else
728
- s = J(E, f.subLanguage.length ? f.subLanguage : null);
729
- f.relevance > 0 && (F += s.relevance), O.__addSublanguage(s._emitter, s.language);
730
- }
731
- function y() {
732
- f.subLanguage != null ? W() : I(), E = "";
733
- }
734
- function N(s, o) {
735
- s !== "" && (O.startScope(o), O.addText(s), O.endScope());
736
- }
737
- function ae(s, o) {
738
- let g = 1;
739
- const p = o.length - 1;
740
- for (; g <= p; ) {
741
- if (!s._emit[g]) {
742
- g++;
743
- continue;
744
- }
745
- const R = A.classNameAliases[s[g]] || s[g], k = o[g];
746
- R ? N(k, R) : (E = k, I(), E = ""), g++;
747
- }
748
- }
749
- function le(s, o) {
750
- return s.scope && typeof s.scope == "string" && O.openNode(A.classNameAliases[s.scope] || s.scope), s.beginScope && (s.beginScope._wrap ? (N(E, A.classNameAliases[s.beginScope._wrap] || s.beginScope._wrap), E = "") : s.beginScope._multi && (ae(s.beginScope, o), E = "")), f = Object.create(s, { parent: { value: f } }), f;
751
- }
752
- function ue(s, o, g) {
753
- let p = st(s.endRe, g);
754
- if (p) {
755
- if (s["on:end"]) {
756
- const R = new he(s);
757
- s["on:end"](o, R), R.isMatchIgnored && (p = !1);
758
- }
759
- if (p) {
760
- for (; s.endsParent && s.parent; )
761
- s = s.parent;
762
- return s;
763
- }
764
- }
765
- if (s.endsWithParent)
766
- return ue(s.parent, o, g);
767
- }
768
- function Ke(s) {
769
- return f.matcher.regexIndex === 0 ? (E += s[0], 1) : (m = !0, 0);
770
- }
771
- function Fe(s) {
772
- const o = s[0], g = s.rule, p = new he(g), R = [g.__beforeBegin, g["on:begin"]];
773
- for (const k of R)
774
- if (k && (k(s, p), p.isMatchIgnored))
775
- return Ke(o);
776
- return g.skip ? E += o : (g.excludeBegin && (E += o), y(), !g.returnBegin && !g.excludeBegin && (E = o)), le(g, s), g.returnBegin ? 0 : o.length;
777
- }
778
- function ze(s) {
779
- const o = s[0], g = a.substring(s.index), p = ue(f, s, g);
780
- if (!p)
781
- return Me;
782
- const R = f;
783
- f.endScope && f.endScope._wrap ? (y(), N(o, f.endScope._wrap)) : f.endScope && f.endScope._multi ? (y(), ae(f.endScope, s)) : R.skip ? E += o : (R.returnEnd || R.excludeEnd || (E += o), y(), R.excludeEnd && (E = o));
784
- do
785
- f.scope && O.closeNode(), !f.skip && !f.subLanguage && (F += f.relevance), f = f.parent;
786
- while (f !== p.parent);
787
- return p.starts && le(p.starts, s), R.returnEnd ? 0 : o.length;
788
- }
789
- function Xe() {
790
- const s = [];
791
- for (let o = f; o !== A; o = o.parent)
792
- o.scope && s.unshift(o.scope);
793
- s.forEach((o) => O.openNode(o));
794
- }
795
- let K = {};
796
- function fe(s, o) {
797
- const g = o && o[0];
798
- if (E += s, g == null)
799
- return y(), 0;
800
- if (K.type === "begin" && o.type === "end" && K.index === o.index && g === "") {
801
- if (E += a.slice(o.index, o.index + 1), !b) {
802
- const p = new Error(`0 width match regex (${n})`);
803
- throw p.languageName = n, p.badRule = K.rule, p;
804
- }
805
- return 1;
806
- }
807
- if (K = o, o.type === "begin")
808
- return Fe(o);
809
- if (o.type === "illegal" && !h) {
810
- const p = new Error('Illegal lexeme "' + g + '" for mode "' + (f.scope || "<unnamed>") + '"');
811
- throw p.mode = f, p;
812
- } else if (o.type === "end") {
813
- const p = ze(o);
814
- if (p !== Me)
815
- return p;
816
- }
817
- if (o.type === "illegal" && g === "")
818
- return E += `
819
- `, 1;
820
- if (Q > 1e5 && Q > o.index * 3)
821
- throw new Error("potential infinite loop, way more iterations than matches");
822
- return E += g, g.length;
823
- }
824
- const A = T(n);
825
- if (!A)
826
- throw v(_.replace("{}", n)), new Error('Unknown language: "' + n + '"');
827
- const Ye = Pt(A);
828
- let q = "", f = d || Ye;
829
- const ge = {}, O = new r.__emitter(r);
830
- Xe();
831
- let E = "", F = 0, D = 0, Q = 0, m = !1;
832
- try {
833
- if (A.__emitTokens)
834
- A.__emitTokens(a, O);
835
- else {
836
- for (f.matcher.considerAll(); ; ) {
837
- Q++, m ? m = !1 : f.matcher.considerAll(), f.matcher.lastIndex = D;
838
- const s = f.matcher.exec(a);
839
- if (!s) break;
840
- const o = a.substring(D, s.index), g = fe(o, s);
841
- D = s.index + g;
842
- }
843
- fe(a.substring(D));
844
- }
845
- return O.finalize(), q = O.toHTML(), {
846
- language: n,
847
- value: q,
848
- relevance: F,
849
- illegal: !1,
850
- _emitter: O,
851
- _top: f
852
- };
853
- } catch (s) {
854
- if (s.message && s.message.includes("Illegal"))
855
- return {
856
- language: n,
857
- value: ee(a),
858
- illegal: !0,
859
- relevance: 0,
860
- _illegalBy: {
861
- message: s.message,
862
- index: D,
863
- context: a.slice(D - 100, D + 100),
864
- mode: s.mode,
865
- resultSoFar: q
866
- },
867
- _emitter: O
868
- };
869
- if (b)
870
- return {
871
- language: n,
872
- value: ee(a),
873
- illegal: !1,
874
- relevance: 0,
875
- errorRaised: s,
876
- _emitter: O,
877
- _top: f
878
- };
879
- throw s;
880
- }
881
- }
882
- function Z(n) {
883
- const a = {
884
- value: ee(n),
885
- illegal: !1,
886
- relevance: 0,
887
- _top: c,
888
- _emitter: new r.__emitter(r)
889
- };
890
- return a._emitter.addText(n), a;
891
- }
892
- function J(n, a) {
893
- a = a || r.languages || Object.keys(t);
894
- const h = Z(n), d = a.filter(T).filter(oe).map(
895
- (y) => j(y, n, !1)
896
- );
897
- d.unshift(h);
898
- const x = d.sort((y, N) => {
899
- if (y.relevance !== N.relevance) return N.relevance - y.relevance;
900
- if (y.language && N.language) {
901
- if (T(y.language).supersetOf === N.language)
902
- return 1;
903
- if (T(N.language).supersetOf === y.language)
904
- return -1;
905
- }
906
- return 0;
907
- }), [S, I] = x, W = S;
908
- return W.secondBest = I, W;
909
- }
910
- function De(n, a, h) {
911
- const d = a && i[a] || h;
912
- n.classList.add("hljs"), n.classList.add(`language-${d}`);
913
- }
914
- function V(n) {
915
- let a = null;
916
- const h = w(n);
917
- if (l(h)) return;
918
- if (G(
919
- "before:highlightElement",
920
- { el: n, language: h }
921
- ), n.dataset.highlighted) {
922
- console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.", n);
923
- return;
924
- }
925
- if (n.children.length > 0 && (r.ignoreUnescapedHTML || (console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."), console.warn("https://github.com/highlightjs/highlight.js/wiki/security"), console.warn("The element with unescaped HTML:"), console.warn(n)), r.throwUnescapedHTML))
926
- throw new Gt(
927
- "One of your code blocks includes unescaped HTML.",
928
- n.innerHTML
929
- );
930
- a = n;
931
- const d = a.textContent, x = h ? M(d, { language: h, ignoreIllegals: !0 }) : J(d);
932
- n.innerHTML = x.value, n.dataset.highlighted = "yes", De(n, h, x.language), n.result = {
933
- language: x.language,
934
- // TODO: remove with version 11.0
935
- re: x.relevance,
936
- relevance: x.relevance
937
- }, x.secondBest && (n.secondBest = {
938
- language: x.secondBest.language,
939
- relevance: x.secondBest.relevance
940
- }), G("after:highlightElement", { el: n, result: x, text: d });
941
- }
942
- function ve(n) {
943
- r = _e(r, n);
944
- }
945
- const Ce = () => {
946
- $(), L("10.6.0", "initHighlighting() deprecated. Use highlightAll() now.");
947
- };
948
- function Le() {
949
- $(), L("10.6.0", "initHighlightingOnLoad() deprecated. Use highlightAll() now.");
950
- }
951
- let re = !1;
952
- function $() {
953
- function n() {
954
- $();
955
- }
956
- if (document.readyState === "loading") {
957
- re || window.addEventListener("DOMContentLoaded", n, !1), re = !0;
958
- return;
959
- }
960
- document.querySelectorAll(r.cssSelector).forEach(V);
961
- }
962
- function He(n, a) {
963
- let h = null;
964
- try {
965
- h = a(e);
966
- } catch (d) {
967
- if (v("Language definition for '{}' could not be registered.".replace("{}", n)), b)
968
- v(d);
969
- else
970
- throw d;
971
- h = c;
972
- }
973
- h.name || (h.name = n), t[n] = h, h.rawDefinition = a.bind(null, e), h.aliases && ce(h.aliases, { languageName: n });
974
- }
975
- function je(n) {
976
- delete t[n];
977
- for (const a of Object.keys(i))
978
- i[a] === n && delete i[a];
979
- }
980
- function Pe() {
981
- return Object.keys(t);
982
- }
983
- function T(n) {
984
- return n = (n || "").toLowerCase(), t[n] || t[i[n]];
985
- }
986
- function ce(n, { languageName: a }) {
987
- typeof n == "string" && (n = [n]), n.forEach((h) => {
988
- i[h.toLowerCase()] = a;
989
- });
990
- }
991
- function oe(n) {
992
- const a = T(n);
993
- return a && !a.disableAutodetect;
994
- }
995
- function Ue(n) {
996
- n["before:highlightBlock"] && !n["before:highlightElement"] && (n["before:highlightElement"] = (a) => {
997
- n["before:highlightBlock"](
998
- Object.assign({ block: a.el }, a)
999
- );
1000
- }), n["after:highlightBlock"] && !n["after:highlightElement"] && (n["after:highlightElement"] = (a) => {
1001
- n["after:highlightBlock"](
1002
- Object.assign({ block: a.el }, a)
1003
- );
1004
- });
1005
- }
1006
- function $e(n) {
1007
- Ue(n), u.push(n);
1008
- }
1009
- function Ge(n) {
1010
- const a = u.indexOf(n);
1011
- a !== -1 && u.splice(a, 1);
1012
- }
1013
- function G(n, a) {
1014
- const h = n;
1015
- u.forEach(function(d) {
1016
- d[h] && d[h](a);
1017
- });
1018
- }
1019
- function We(n) {
1020
- return L("10.7.0", "highlightBlock will be removed entirely in v12.0"), L("10.7.0", "Please use highlightElement now."), V(n);
1021
- }
1022
- Object.assign(e, {
1023
- highlight: M,
1024
- highlightAuto: J,
1025
- highlightAll: $,
1026
- highlightElement: V,
1027
- // TODO: Remove with v12 API
1028
- highlightBlock: We,
1029
- configure: ve,
1030
- initHighlighting: Ce,
1031
- initHighlightingOnLoad: Le,
1032
- registerLanguage: He,
1033
- unregisterLanguage: je,
1034
- listLanguages: Pe,
1035
- getLanguage: T,
1036
- registerAliases: ce,
1037
- autoDetection: oe,
1038
- inherit: _e,
1039
- addPlugin: $e,
1040
- removePlugin: Ge
1041
- }), e.debugMode = function() {
1042
- b = !1;
1043
- }, e.safeMode = function() {
1044
- b = !0;
1045
- }, e.versionString = $t, e.regex = {
1046
- concat: C,
1047
- lookahead: Oe,
1048
- either: ne,
1049
- optional: nt,
1050
- anyNumberOfTimes: tt
1051
- };
1052
- for (const n in z)
1053
- typeof z[n] == "object" && xe(z[n]);
1054
- return Object.assign(e, z), e;
1055
- }, H = Be({});
1056
- H.newInstance = () => Be({});
1057
- var Kt = H;
1058
- H.HighlightJS = H;
1059
- H.default = H;
1060
- const zt = /* @__PURE__ */ Ve(Kt);
1061
- export {
1062
- zt as default
1063
- };