@kong-ui-public/entities-plugins 9.199.5 → 9.199.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2421 +0,0 @@
1
- var wt = Object.defineProperty;
2
- var _t = (n, e, t) => e in n ? wt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var k = (n, e, t) => _t(n, typeof e != "symbol" ? e + "" : e, t);
4
- import { get as $t } from "lodash-es";
5
- const ts = {
6
- // Common
7
- field: (n) => `[data-testid="ff-${n}"]`,
8
- label: (n) => `[data-testid="ff-label-${n}"]`,
9
- // EnumField
10
- selectTrigger: (n) => `[data-testid="ff-enum-${n}-items"]`,
11
- multiSelectItem: (n) => `[data-testid="multiselect-item-${n}"]`,
12
- selectItem: (n) => `[data-testid="select-item-${n}"]`,
13
- // ArrayField
14
- array: (n) => `[data-testid="ff-array-${n}"]`,
15
- arrayTabContainer: (n) => `[data-appearance="tabs"][data-testid="ff-array-${n}"]`,
16
- arrayBasicContainer: (n) => `[data-testid="ff-array-${n}"]:not([data-appearance="tabs"])`,
17
- arrayTabs: (n) => `[data-testid="ff-array-tabs-${n}"]`,
18
- arrayItem: (n, e) => `[data-testid="ff-array-item-${n}.${e}"]`,
19
- arrayAddBtn: (n) => `[data-testid="ff-add-item-btn-${n}"]`,
20
- arrayRemoveBtns: (n) => `[data-testid^="ff-array-remove-item-btn-${n}"]`,
21
- arrayRemoveBtn: (n, e) => `[data-testid="ff-array-remove-item-btn-${n}.${e}"]`,
22
- // ObjectField
23
- object: (n) => `[data-testid="ff-object-${n}"]`,
24
- objectToggleBtn: (n) => `[data-testid="ff-object-toggle-btn-${n}"]`,
25
- objectSwitch: (n) => `[data-testid="ff-object-switch-${n}"]`,
26
- objectContent: (n) => `[data-testid="ff-object-content-${n}"]`,
27
- // MapField
28
- map: (n) => `[data-testid="ff-map-${n}"]`,
29
- mapContainer: (n, e) => `[data-testid="ff-map-container-${n}.${e}"]`,
30
- mapKey: (n, e) => `[data-testid="ff-map-key-${n}.${e}"]`,
31
- mapRemoveBtns: (n) => `[data-testid^="ff-map-remove-btn-${n}"]`,
32
- mapRemoveBtn: (n, e) => `[data-testid="ff-map-remove-btn-${n}.${e}"]`,
33
- mapAddBtn: (n) => `[data-testid="ff-map-add-btn-${n}"]`,
34
- // StringArrayField
35
- tag: (n) => `[data-testid="ff-tag-${n}"]`,
36
- tagInput: (n) => `[data-testid="ff-tag-${n}"] input`,
37
- // JsonField
38
- json: (n) => `[data-testid="ff-json-${n}"]`
39
- };
40
- /**
41
- * @vue/shared v3.5.33
42
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
43
- * @license MIT
44
- **/
45
- const me = process.env.NODE_ENV !== "production" ? Object.freeze({}) : {};
46
- process.env.NODE_ENV !== "production" && Object.freeze([]);
47
- const qe = () => {
48
- }, Et = (n) => n.charCodeAt(0) === 111 && n.charCodeAt(1) === 110 && // uppercase letter
49
- (n.charCodeAt(2) > 122 || n.charCodeAt(2) < 97), Rt = (n) => n.startsWith("onUpdate:"), se = Object.assign, E = Array.isArray, N = (n) => typeof n == "function", S = (n) => typeof n == "string", Tt = (n) => typeof n == "symbol", O = (n) => n !== null && typeof n == "object";
50
- let Ve;
51
- const re = () => Ve || (Ve = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : typeof global < "u" ? global : {});
52
- function we(n) {
53
- if (E(n)) {
54
- const e = {};
55
- for (let t = 0; t < n.length; t++) {
56
- const s = n[t], r = S(s) ? Ot(s) : we(s);
57
- if (r)
58
- for (const i in r)
59
- e[i] = r[i];
60
- }
61
- return e;
62
- } else if (S(n) || O(n))
63
- return n;
64
- }
65
- const St = /;(?![^(]*\))/g, zt = /:([^]+)/, Nt = /\/\*[^]*?\*\//g;
66
- function Ot(n) {
67
- const e = {};
68
- return n.replace(Nt, "").split(St).forEach((t) => {
69
- if (t) {
70
- const s = t.split(zt);
71
- s.length > 1 && (e[s[0].trim()] = s[1].trim());
72
- }
73
- }), e;
74
- }
75
- function _e(n) {
76
- let e = "";
77
- if (S(n))
78
- e = n;
79
- else if (E(n))
80
- for (let t = 0; t < n.length; t++) {
81
- const s = _e(n[t]);
82
- s && (e += s + " ");
83
- }
84
- else if (O(n))
85
- for (const t in n)
86
- n[t] && (e += t + " ");
87
- return e.trim();
88
- }
89
- /**
90
- * @vue/reactivity v3.5.33
91
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
92
- * @license MIT
93
- **/
94
- process.env.NODE_ENV;
95
- process.env.NODE_ENV;
96
- process.env.NODE_ENV;
97
- new Set(
98
- /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((n) => n !== "arguments" && n !== "caller").map((n) => Symbol[n]).filter(Tt)
99
- );
100
- // @__NO_SIDE_EFFECTS__
101
- function He(n) {
102
- return /* @__PURE__ */ ke(n) ? /* @__PURE__ */ He(n.__v_raw) : !!(n && n.__v_isReactive);
103
- }
104
- // @__NO_SIDE_EFFECTS__
105
- function ke(n) {
106
- return !!(n && n.__v_isReadonly);
107
- }
108
- // @__NO_SIDE_EFFECTS__
109
- function fe(n) {
110
- return !!(n && n.__v_isShallow);
111
- }
112
- // @__NO_SIDE_EFFECTS__
113
- function be(n) {
114
- return n ? !!n.__v_raw : !1;
115
- }
116
- // @__NO_SIDE_EFFECTS__
117
- function I(n) {
118
- const e = n && n.__v_raw;
119
- return e ? /* @__PURE__ */ I(e) : n;
120
- }
121
- // @__NO_SIDE_EFFECTS__
122
- function ie(n) {
123
- return n ? n.__v_isRef === !0 : !1;
124
- }
125
- function It(n) {
126
- return /* @__PURE__ */ ie(n) ? n.value : n;
127
- }
128
- function At(n) {
129
- return N(n) ? n() : It(n);
130
- }
131
- /**
132
- * @vue/runtime-core v3.5.33
133
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
134
- * @license MIT
135
- **/
136
- const A = [];
137
- function Ct(n) {
138
- A.push(n);
139
- }
140
- function vt() {
141
- A.pop();
142
- }
143
- let he = !1;
144
- function D(n, ...e) {
145
- if (he) return;
146
- he = !0;
147
- const t = A.length ? A[A.length - 1].component : null, s = t && t.appContext.config.warnHandler, r = Mt();
148
- if (s)
149
- $e(
150
- s,
151
- t,
152
- 11,
153
- [
154
- // eslint-disable-next-line no-restricted-syntax
155
- n + e.map((i) => {
156
- var o, l;
157
- return (l = (o = i.toString) == null ? void 0 : o.call(i)) != null ? l : JSON.stringify(i);
158
- }).join(""),
159
- t && t.proxy,
160
- r.map(
161
- ({ vnode: i }) => `at <${it(t, i.type)}>`
162
- ).join(`
163
- `),
164
- r
165
- ]
166
- );
167
- else {
168
- const i = [`[Vue warn]: ${n}`, ...e];
169
- r.length && i.push(`
170
- `, ...Vt(r)), console.warn(...i);
171
- }
172
- he = !1;
173
- }
174
- function Mt() {
175
- let n = A[A.length - 1];
176
- if (!n)
177
- return [];
178
- const e = [];
179
- for (; n; ) {
180
- const t = e[0];
181
- t && t.vnode === n ? t.recurseCount++ : e.push({
182
- vnode: n,
183
- recurseCount: 0
184
- });
185
- const s = n.component && n.component.parent;
186
- n = s && s.vnode;
187
- }
188
- return e;
189
- }
190
- function Vt(n) {
191
- const e = [];
192
- return n.forEach((t, s) => {
193
- e.push(...s === 0 ? [] : [`
194
- `], ...Pt(t));
195
- }), e;
196
- }
197
- function Pt({ vnode: n, recurseCount: e }) {
198
- const t = e > 0 ? `... (${e} recursive calls)` : "", s = n.component ? n.component.parent == null : !1, r = ` at <${it(
199
- n.component,
200
- n.type,
201
- s
202
- )}`, i = ">" + t;
203
- return n.props ? [r, ...Dt(n.props), i] : [r + i];
204
- }
205
- function Dt(n) {
206
- const e = [], t = Object.keys(n);
207
- return t.slice(0, 3).forEach((s) => {
208
- e.push(...Ze(s, n[s]));
209
- }), t.length > 3 && e.push(" ..."), e;
210
- }
211
- function Ze(n, e, t) {
212
- return S(e) ? (e = JSON.stringify(e), t ? e : [`${n}=${e}`]) : typeof e == "number" || typeof e == "boolean" || e == null ? t ? e : [`${n}=${e}`] : /* @__PURE__ */ ie(e) ? (e = Ze(n, /* @__PURE__ */ I(e.value), !0), t ? e : [`${n}=Ref<`, e, ">"]) : N(e) ? [`${n}=fn${e.name ? `<${e.name}>` : ""}`] : (e = /* @__PURE__ */ I(e), t ? e : [`${n}=`, e]);
213
- }
214
- const Ue = {
215
- sp: "serverPrefetch hook",
216
- bc: "beforeCreate hook",
217
- c: "created hook",
218
- bm: "beforeMount hook",
219
- m: "mounted hook",
220
- bu: "beforeUpdate hook",
221
- u: "updated",
222
- bum: "beforeUnmount hook",
223
- um: "unmounted hook",
224
- a: "activated hook",
225
- da: "deactivated hook",
226
- ec: "errorCaptured hook",
227
- rtc: "renderTracked hook",
228
- rtg: "renderTriggered hook",
229
- 0: "setup function",
230
- 1: "render function",
231
- 2: "watcher getter",
232
- 3: "watcher callback",
233
- 4: "watcher cleanup function",
234
- 5: "native event handler",
235
- 6: "component event handler",
236
- 7: "vnode hook",
237
- 8: "directive hook",
238
- 9: "transition hook",
239
- 10: "app errorHandler",
240
- 11: "app warnHandler",
241
- 12: "ref function",
242
- 13: "async component loader",
243
- 14: "scheduler flush",
244
- 15: "component update",
245
- 16: "app unmount cleanup function"
246
- };
247
- function $e(n, e, t, s) {
248
- try {
249
- return s ? n(...s) : n();
250
- } catch (r) {
251
- Qe(r, e, t);
252
- }
253
- }
254
- function Qe(n, e, t, s = !0) {
255
- const r = e ? e.vnode : null, { errorHandler: i, throwUnhandledErrorInProduction: o } = e && e.appContext.config || me;
256
- if (e) {
257
- let l = e.parent;
258
- const a = e.proxy, p = process.env.NODE_ENV !== "production" ? Ue[t] : `https://vuejs.org/error-reference/#runtime-${t}`;
259
- for (; l; ) {
260
- const u = l.ec;
261
- if (u) {
262
- for (let c = 0; c < u.length; c++)
263
- if (u[c](n, a, p) === !1)
264
- return;
265
- }
266
- l = l.parent;
267
- }
268
- if (i) {
269
- $e(i, null, 10, [
270
- n,
271
- a,
272
- p
273
- ]);
274
- return;
275
- }
276
- }
277
- jt(n, t, r, s, o);
278
- }
279
- function jt(n, e, t, s = !0, r = !1) {
280
- if (process.env.NODE_ENV !== "production") {
281
- const i = Ue[e];
282
- if (t && Ct(t), D(`Unhandled error${i ? ` during execution of ${i}` : ""}`), t && vt(), s)
283
- throw n;
284
- console.error(n);
285
- } else {
286
- if (r)
287
- throw n;
288
- console.error(n);
289
- }
290
- }
291
- const x = [];
292
- let R = -1;
293
- const P = [];
294
- let T = null, M = 0;
295
- const Lt = /* @__PURE__ */ Promise.resolve();
296
- let ye = null;
297
- const Ft = 100;
298
- function Bt(n) {
299
- let e = R + 1, t = x.length;
300
- for (; e < t; ) {
301
- const s = e + t >>> 1, r = x[s], i = H(r);
302
- i < n || i === n && r.flags & 2 ? e = s + 1 : t = s;
303
- }
304
- return e;
305
- }
306
- function qt(n) {
307
- if (!(n.flags & 1)) {
308
- const e = H(n), t = x[x.length - 1];
309
- !t || // fast path when the job id is larger than the tail
310
- !(n.flags & 2) && e >= H(t) ? x.push(n) : x.splice(Bt(e), 0, n), n.flags |= 1, Ke();
311
- }
312
- }
313
- function Ke() {
314
- ye || (ye = Lt.then(We));
315
- }
316
- function Ht(n) {
317
- E(n) ? P.push(...n) : T && n.id === -1 ? T.splice(M + 1, 0, n) : n.flags & 1 || (P.push(n), n.flags |= 1), Ke();
318
- }
319
- function Zt(n) {
320
- if (P.length) {
321
- const e = [...new Set(P)].sort(
322
- (t, s) => H(t) - H(s)
323
- );
324
- if (P.length = 0, T) {
325
- T.push(...e);
326
- return;
327
- }
328
- for (T = e, process.env.NODE_ENV !== "production" && (n = n || /* @__PURE__ */ new Map()), M = 0; M < T.length; M++) {
329
- const t = T[M];
330
- process.env.NODE_ENV !== "production" && Je(n, t) || (t.flags & 4 && (t.flags &= -2), t.flags & 8 || t(), t.flags &= -2);
331
- }
332
- T = null, M = 0;
333
- }
334
- }
335
- const H = (n) => n.id == null ? n.flags & 2 ? -1 : 1 / 0 : n.id;
336
- function We(n) {
337
- process.env.NODE_ENV !== "production" && (n = n || /* @__PURE__ */ new Map());
338
- const e = process.env.NODE_ENV !== "production" ? (t) => Je(n, t) : qe;
339
- try {
340
- for (R = 0; R < x.length; R++) {
341
- const t = x[R];
342
- if (t && !(t.flags & 8)) {
343
- if (process.env.NODE_ENV !== "production" && e(t))
344
- continue;
345
- t.flags & 4 && (t.flags &= -2), $e(
346
- t,
347
- t.i,
348
- t.i ? 15 : 14
349
- ), t.flags & 4 || (t.flags &= -2);
350
- }
351
- }
352
- } finally {
353
- for (; R < x.length; R++) {
354
- const t = x[R];
355
- t && (t.flags &= -2);
356
- }
357
- R = -1, x.length = 0, Zt(n), ye = null, (x.length || P.length) && We(n);
358
- }
359
- }
360
- function Je(n, e) {
361
- const t = n.get(e) || 0;
362
- if (t > Ft) {
363
- const s = e.i, r = s && rt(s.type);
364
- return Qe(
365
- `Maximum recursive updates exceeded${r ? ` in component <${r}>` : ""}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,
366
- null,
367
- 10
368
- ), !0;
369
- }
370
- return n.set(e, t + 1), !1;
371
- }
372
- const de = /* @__PURE__ */ new Map();
373
- process.env.NODE_ENV !== "production" && (re().__VUE_HMR_RUNTIME__ = {
374
- createRecord: ge(Ut),
375
- rerender: ge(Qt),
376
- reload: ge(Kt)
377
- });
378
- const J = /* @__PURE__ */ new Map();
379
- function Ut(n, e) {
380
- return J.has(n) ? !1 : (J.set(n, {
381
- initialDef: Y(e),
382
- instances: /* @__PURE__ */ new Set()
383
- }), !0);
384
- }
385
- function Y(n) {
386
- return ot(n) ? n.__vccOpts : n;
387
- }
388
- function Qt(n, e) {
389
- const t = J.get(n);
390
- t && (t.initialDef.render = e, [...t.instances].forEach((s) => {
391
- e && (s.render = e, Y(s.type).render = e), s.renderCache = [], s.job.flags & 8 || s.update();
392
- }));
393
- }
394
- function Kt(n, e) {
395
- const t = J.get(n);
396
- if (!t) return;
397
- e = Y(e), Pe(t.initialDef, e);
398
- const s = [...t.instances];
399
- for (let r = 0; r < s.length; r++) {
400
- const i = s[r], o = Y(i.type);
401
- let l = de.get(o);
402
- l || (o !== t.initialDef && Pe(o, e), de.set(o, l = /* @__PURE__ */ new Set())), l.add(i), i.appContext.propsCache.delete(i.type), i.appContext.emitsCache.delete(i.type), i.appContext.optionsCache.delete(i.type), i.ceReload ? (l.add(i), i.ceReload(e.styles), l.delete(i)) : i.parent ? qt(() => {
403
- i.job.flags & 8 || (i.parent.update(), l.delete(i));
404
- }) : i.appContext.reload ? i.appContext.reload() : typeof window < "u" ? window.location.reload() : console.warn(
405
- "[HMR] Root or manually mounted instance modified. Full reload required."
406
- ), i.root.ce && i !== i.root && i.root.ce._removeChildStyle(o);
407
- }
408
- Ht(() => {
409
- de.clear();
410
- });
411
- }
412
- function Pe(n, e) {
413
- se(n, e);
414
- for (const t in n)
415
- t !== "__file" && !(t in e) && delete n[t];
416
- }
417
- function ge(n) {
418
- return (e, t) => {
419
- try {
420
- return n(e, t);
421
- } catch (s) {
422
- console.error(s), console.warn(
423
- "[HMR] Something went wrong during Vue component hot-reload. Full reload required."
424
- );
425
- }
426
- };
427
- }
428
- let V, Q = [];
429
- function Ye(n, e) {
430
- var t, s;
431
- V = n, V ? (V.enabled = !0, Q.forEach(({ event: r, args: i }) => V.emit(r, ...i)), Q = []) : /* handle late devtools injection - only do this if we are in an actual */ /* browser environment to avoid the timer handle stalling test runner exit */ /* (#4815) */ typeof window < "u" && // some envs mock window but not fully
432
- window.HTMLElement && // also exclude jsdom
433
- // eslint-disable-next-line no-restricted-syntax
434
- !((s = (t = window.navigator) == null ? void 0 : t.userAgent) != null && s.includes("jsdom")) ? ((e.__VUE_DEVTOOLS_HOOK_REPLAY__ = e.__VUE_DEVTOOLS_HOOK_REPLAY__ || []).push((i) => {
435
- Ye(i, e);
436
- }), setTimeout(() => {
437
- V || (e.__VUE_DEVTOOLS_HOOK_REPLAY__ = null, Q = []);
438
- }, 3e3)) : Q = [];
439
- }
440
- let G = null, Wt = null;
441
- const Jt = (n) => n.__isTeleport;
442
- function Ge(n, e) {
443
- n.shapeFlag & 6 && n.component ? (n.transition = e, Ge(n.component.subTree, e)) : n.shapeFlag & 128 ? (n.ssContent.transition = e.clone(n.ssContent), n.ssFallback.transition = e.clone(n.ssFallback)) : n.transition = e;
444
- }
445
- re().requestIdleCallback;
446
- re().cancelIdleCallback;
447
- const Yt = /* @__PURE__ */ Symbol.for("v-ndc"), Gt = {};
448
- process.env.NODE_ENV !== "production" && (Gt.ownKeys = (n) => (D(
449
- "Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead."
450
- ), Reflect.ownKeys(n)));
451
- const Xt = {}, Xe = (n) => Object.getPrototypeOf(n) === Xt, en = (n) => n.__isSuspense, et = /* @__PURE__ */ Symbol.for("v-fgt"), tn = /* @__PURE__ */ Symbol.for("v-txt"), nn = /* @__PURE__ */ Symbol.for("v-cmt");
452
- function sn(n) {
453
- return n ? n.__v_isVNode === !0 : !1;
454
- }
455
- const rn = (...n) => nt(
456
- ...n
457
- ), tt = ({ key: n }) => n ?? null, W = ({
458
- ref: n,
459
- ref_key: e,
460
- ref_for: t
461
- }) => (typeof n == "number" && (n = "" + n), n != null ? S(n) || /* @__PURE__ */ ie(n) || N(n) ? { i: G, r: n, k: e, f: !!t } : n : null);
462
- function on(n, e = null, t = null, s = 0, r = null, i = n === et ? 0 : 1, o = !1, l = !1) {
463
- const a = {
464
- __v_isVNode: !0,
465
- __v_skip: !0,
466
- type: n,
467
- props: e,
468
- key: e && tt(e),
469
- ref: e && W(e),
470
- scopeId: Wt,
471
- slotScopeIds: null,
472
- children: t,
473
- component: null,
474
- suspense: null,
475
- ssContent: null,
476
- ssFallback: null,
477
- dirs: null,
478
- transition: null,
479
- el: null,
480
- anchor: null,
481
- target: null,
482
- targetStart: null,
483
- targetAnchor: null,
484
- staticCount: 0,
485
- shapeFlag: i,
486
- patchFlag: s,
487
- dynamicProps: r,
488
- dynamicChildren: null,
489
- appContext: null,
490
- ctx: G
491
- };
492
- return l ? (Ee(a, t), i & 128 && n.normalize(a)) : t && (a.shapeFlag |= S(t) ? 8 : 16), process.env.NODE_ENV !== "production" && a.key !== a.key && D("VNode created with invalid key (NaN). VNode type:", a.type), a;
493
- }
494
- const ln = process.env.NODE_ENV !== "production" ? rn : nt;
495
- function nt(n, e = null, t = null, s = 0, r = null, i = !1) {
496
- if ((!n || n === Yt) && (process.env.NODE_ENV !== "production" && !n && D(`Invalid vnode type when creating vnode: ${n}.`), n = nn), sn(n)) {
497
- const l = X(
498
- n,
499
- e,
500
- !0
501
- /* mergeRef: true */
502
- );
503
- return t && Ee(l, t), l.patchFlag = -2, l;
504
- }
505
- if (ot(n) && (n = n.__vccOpts), e) {
506
- e = an(e);
507
- let { class: l, style: a } = e;
508
- l && !S(l) && (e.class = _e(l)), O(a) && (/* @__PURE__ */ be(a) && !E(a) && (a = se({}, a)), e.style = we(a));
509
- }
510
- const o = S(n) ? 1 : en(n) ? 128 : Jt(n) ? 64 : O(n) ? 4 : N(n) ? 2 : 0;
511
- return process.env.NODE_ENV !== "production" && o & 4 && /* @__PURE__ */ be(n) && (n = /* @__PURE__ */ I(n), D(
512
- "Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.",
513
- `
514
- Component that was made reactive: `,
515
- n
516
- )), on(
517
- n,
518
- e,
519
- t,
520
- s,
521
- r,
522
- o,
523
- i,
524
- !0
525
- );
526
- }
527
- function an(n) {
528
- return n ? /* @__PURE__ */ be(n) || Xe(n) ? se({}, n) : n : null;
529
- }
530
- function X(n, e, t = !1, s = !1) {
531
- const { props: r, ref: i, patchFlag: o, children: l, transition: a } = n, p = e ? un(r || {}, e) : r, u = {
532
- __v_isVNode: !0,
533
- __v_skip: !0,
534
- type: n.type,
535
- props: p,
536
- key: p && tt(p),
537
- ref: e && e.ref ? (
538
- // #2078 in the case of <component :is="vnode" ref="extra"/>
539
- // if the vnode itself already has a ref, cloneVNode will need to merge
540
- // the refs so the single vnode can be set on multiple refs
541
- t && i ? E(i) ? i.concat(W(e)) : [i, W(e)] : W(e)
542
- ) : i,
543
- scopeId: n.scopeId,
544
- slotScopeIds: n.slotScopeIds,
545
- children: process.env.NODE_ENV !== "production" && o === -1 && E(l) ? l.map(st) : l,
546
- target: n.target,
547
- targetStart: n.targetStart,
548
- targetAnchor: n.targetAnchor,
549
- staticCount: n.staticCount,
550
- shapeFlag: n.shapeFlag,
551
- // if the vnode is cloned with extra props, we can no longer assume its
552
- // existing patch flag to be reliable and need to add the FULL_PROPS flag.
553
- // note: preserve flag for fragments since they use the flag for children
554
- // fast paths only.
555
- patchFlag: e && n.type !== et ? o === -1 ? 16 : o | 16 : o,
556
- dynamicProps: n.dynamicProps,
557
- dynamicChildren: n.dynamicChildren,
558
- appContext: n.appContext,
559
- dirs: n.dirs,
560
- transition: a,
561
- // These should technically only be non-null on mounted VNodes. However,
562
- // they *should* be copied for kept-alive vnodes. So we just always copy
563
- // them since them being non-null during a mount doesn't affect the logic as
564
- // they will simply be overwritten.
565
- component: n.component,
566
- suspense: n.suspense,
567
- ssContent: n.ssContent && X(n.ssContent),
568
- ssFallback: n.ssFallback && X(n.ssFallback),
569
- placeholder: n.placeholder,
570
- el: n.el,
571
- anchor: n.anchor,
572
- ctx: n.ctx,
573
- ce: n.ce
574
- };
575
- return a && s && Ge(
576
- u,
577
- a.clone(u)
578
- ), u;
579
- }
580
- function st(n) {
581
- const e = X(n);
582
- return E(n.children) && (e.children = n.children.map(st)), e;
583
- }
584
- function cn(n = " ", e = 0) {
585
- return ln(tn, null, n, e);
586
- }
587
- function Ee(n, e) {
588
- let t = 0;
589
- const { shapeFlag: s } = n;
590
- if (e == null)
591
- e = null;
592
- else if (E(e))
593
- t = 16;
594
- else if (typeof e == "object")
595
- if (s & 65) {
596
- const r = e.default;
597
- r && (r._c && (r._d = !1), Ee(n, r()), r._c && (r._d = !0));
598
- return;
599
- } else
600
- t = 32, !e._ && !Xe(e) && (e._ctx = G);
601
- else N(e) ? (e = { default: e, _ctx: G }, t = 32) : (e = String(e), s & 64 ? (t = 16, e = [cn(e)]) : t = 8);
602
- n.children = e, n.shapeFlag |= t;
603
- }
604
- function un(...n) {
605
- const e = {};
606
- for (let t = 0; t < n.length; t++) {
607
- const s = n[t];
608
- for (const r in s)
609
- if (r === "class")
610
- e.class !== s.class && (e.class = _e([e.class, s.class]));
611
- else if (r === "style")
612
- e.style = we([e.style, s.style]);
613
- else if (Et(r)) {
614
- const i = e[r], o = s[r];
615
- o && i !== o && !(E(i) && i.includes(o)) ? e[r] = i ? [].concat(i, o) : o : o == null && i == null && // mergeProps({ 'onUpdate:modelValue': undefined }) should not retain
616
- // the model listener.
617
- !Rt(r) && (e[r] = o);
618
- } else r !== "" && (e[r] = s[r]);
619
- }
620
- return e;
621
- }
622
- {
623
- const n = re(), e = (t, s) => {
624
- let r;
625
- return (r = n[t]) || (r = n[t] = []), r.push(s), (i) => {
626
- r.length > 1 ? r.forEach((o) => o(i)) : r[0](i);
627
- };
628
- };
629
- e(
630
- "__VUE_INSTANCE_SETTERS__",
631
- (t) => t
632
- ), e(
633
- "__VUE_SSR_SETTERS__",
634
- (t) => t
635
- );
636
- }
637
- process.env.NODE_ENV;
638
- const pn = /(?:^|[-_])\w/g, fn = (n) => n.replace(pn, (e) => e.toUpperCase()).replace(/[-_]/g, "");
639
- function rt(n, e = !0) {
640
- return N(n) ? n.displayName || n.name : n.name || e && n.__name;
641
- }
642
- function it(n, e, t = !1) {
643
- let s = rt(e);
644
- if (!s && e.__file) {
645
- const r = e.__file.match(/([^/\\]+)\.\w+$/);
646
- r && (s = r[1]);
647
- }
648
- if (!s && n) {
649
- const r = (i) => {
650
- for (const o in i)
651
- if (i[o] === e)
652
- return o;
653
- };
654
- s = r(n.components) || n.parent && r(
655
- n.parent.type.components
656
- ) || r(n.appContext.components);
657
- }
658
- return s ? fn(s) : t ? "App" : "Anonymous";
659
- }
660
- function ot(n) {
661
- return N(n) && "__vccOpts" in n;
662
- }
663
- function hn() {
664
- if (process.env.NODE_ENV === "production" || typeof window > "u")
665
- return;
666
- const n = { style: "color:#3ba776" }, e = { style: "color:#1677ff" }, t = { style: "color:#f5222d" }, s = { style: "color:#eb2f96" }, r = {
667
- __vue_custom_formatter: !0,
668
- header(c) {
669
- if (!O(c))
670
- return null;
671
- if (c.__isVue)
672
- return ["div", n, "VueInstance"];
673
- if (/* @__PURE__ */ ie(c)) {
674
- const f = c.value;
675
- return [
676
- "div",
677
- {},
678
- ["span", n, u(c)],
679
- "<",
680
- l(f),
681
- ">"
682
- ];
683
- } else {
684
- if (/* @__PURE__ */ He(c))
685
- return [
686
- "div",
687
- {},
688
- ["span", n, /* @__PURE__ */ fe(c) ? "ShallowReactive" : "Reactive"],
689
- "<",
690
- l(c),
691
- `>${/* @__PURE__ */ ke(c) ? " (readonly)" : ""}`
692
- ];
693
- if (/* @__PURE__ */ ke(c))
694
- return [
695
- "div",
696
- {},
697
- ["span", n, /* @__PURE__ */ fe(c) ? "ShallowReadonly" : "Readonly"],
698
- "<",
699
- l(c),
700
- ">"
701
- ];
702
- }
703
- return null;
704
- },
705
- hasBody(c) {
706
- return c && c.__isVue;
707
- },
708
- body(c) {
709
- if (c && c.__isVue)
710
- return [
711
- "div",
712
- {},
713
- ...i(c.$)
714
- ];
715
- }
716
- };
717
- function i(c) {
718
- const f = [];
719
- c.type.props && c.props && f.push(o("props", /* @__PURE__ */ I(c.props))), c.setupState !== me && f.push(o("setup", c.setupState)), c.data !== me && f.push(o("data", /* @__PURE__ */ I(c.data)));
720
- const h = a(c, "computed");
721
- h && f.push(o("computed", h));
722
- const d = a(c, "inject");
723
- return d && f.push(o("injected", d)), f.push([
724
- "div",
725
- {},
726
- [
727
- "span",
728
- {
729
- style: s.style + ";opacity:0.66"
730
- },
731
- "$ (internal): "
732
- ],
733
- ["object", { object: c }]
734
- ]), f;
735
- }
736
- function o(c, f) {
737
- return f = se({}, f), Object.keys(f).length ? [
738
- "div",
739
- { style: "line-height:1.25em;margin-bottom:0.6em" },
740
- [
741
- "div",
742
- {
743
- style: "color:#476582"
744
- },
745
- c
746
- ],
747
- [
748
- "div",
749
- {
750
- style: "padding-left:1.25em"
751
- },
752
- ...Object.keys(f).map((h) => [
753
- "div",
754
- {},
755
- ["span", s, h + ": "],
756
- l(f[h], !1)
757
- ])
758
- ]
759
- ] : ["span", {}];
760
- }
761
- function l(c, f = !0) {
762
- return typeof c == "number" ? ["span", e, c] : typeof c == "string" ? ["span", t, JSON.stringify(c)] : typeof c == "boolean" ? ["span", s, c] : O(c) ? ["object", { object: f ? /* @__PURE__ */ I(c) : c }] : ["span", t, String(c)];
763
- }
764
- function a(c, f) {
765
- const h = c.type;
766
- if (N(h))
767
- return;
768
- const d = {};
769
- for (const b in c.ctx)
770
- p(h, b, f) && (d[b] = c.ctx[b]);
771
- return d;
772
- }
773
- function p(c, f, h) {
774
- const d = c[h];
775
- if (E(d) && d.includes(f) || O(d) && f in d || c.extends && p(c.extends, f, h) || c.mixins && c.mixins.some((b) => p(b, f, h)))
776
- return !0;
777
- }
778
- function u(c) {
779
- return /* @__PURE__ */ fe(c) ? "ShallowRef" : c.effect ? "ComputedRef" : "Ref";
780
- }
781
- window.devtoolsFormatters ? window.devtoolsFormatters.push(r) : window.devtoolsFormatters = [r];
782
- }
783
- process.env.NODE_ENV;
784
- process.env.NODE_ENV;
785
- process.env.NODE_ENV;
786
- /**
787
- * vue v3.5.33
788
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
789
- * @license MIT
790
- **/
791
- function dn() {
792
- hn();
793
- }
794
- process.env.NODE_ENV !== "production" && dn();
795
- const lt = "*", at = "#", ct = ".";
796
- function z(...n) {
797
- return n.join(ct);
798
- }
799
- function gn(n) {
800
- return n.split(ct).filter((e) => e !== "");
801
- }
802
- function mn(n) {
803
- const e = At(n);
804
- return e ? e.type === "set" && e.elements.type === "string" && !e.elements.one_of : !1;
805
- }
806
- function kn(n) {
807
- return "one_of" in n && Array.isArray(n.one_of);
808
- }
809
- function ns(n) {
810
- return n.type === "set" && "elements" in n && "one_of" in n.elements;
811
- }
812
- function Re() {
813
- return {
814
- async: !1,
815
- breaks: !1,
816
- extensions: null,
817
- gfm: !0,
818
- hooks: null,
819
- pedantic: !1,
820
- renderer: null,
821
- silent: !1,
822
- tokenizer: null,
823
- walkTokens: null
824
- };
825
- }
826
- let v = Re();
827
- function ut(n) {
828
- v = n;
829
- }
830
- const pt = /[&<>"']/, bn = new RegExp(pt.source, "g"), ft = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, yn = new RegExp(ft.source, "g"), xn = {
831
- "&": "&amp;",
832
- "<": "&lt;",
833
- ">": "&gt;",
834
- '"': "&quot;",
835
- "'": "&#39;"
836
- }, De = (n) => xn[n];
837
- function y(n, e) {
838
- if (e) {
839
- if (pt.test(n))
840
- return n.replace(bn, De);
841
- } else if (ft.test(n))
842
- return n.replace(yn, De);
843
- return n;
844
- }
845
- const wn = /(^|[^\[])\^/g;
846
- function m(n, e) {
847
- let t = typeof n == "string" ? n : n.source;
848
- e = e || "";
849
- const s = {
850
- replace: (r, i) => {
851
- let o = typeof i == "string" ? i : i.source;
852
- return o = o.replace(wn, "$1"), t = t.replace(r, o), s;
853
- },
854
- getRegex: () => new RegExp(t, e)
855
- };
856
- return s;
857
- }
858
- function je(n) {
859
- try {
860
- n = encodeURI(n).replace(/%25/g, "%");
861
- } catch {
862
- return null;
863
- }
864
- return n;
865
- }
866
- const B = { exec: () => null };
867
- function Le(n, e) {
868
- const t = n.replace(/\|/g, (i, o, l) => {
869
- let a = !1, p = o;
870
- for (; --p >= 0 && l[p] === "\\"; )
871
- a = !a;
872
- return a ? "|" : " |";
873
- }), s = t.split(/ \|/);
874
- let r = 0;
875
- if (s[0].trim() || s.shift(), s.length > 0 && !s[s.length - 1].trim() && s.pop(), e)
876
- if (s.length > e)
877
- s.splice(e);
878
- else
879
- for (; s.length < e; )
880
- s.push("");
881
- for (; r < s.length; r++)
882
- s[r] = s[r].trim().replace(/\\\|/g, "|");
883
- return s;
884
- }
885
- function L(n, e, t) {
886
- const s = n.length;
887
- if (s === 0)
888
- return "";
889
- let r = 0;
890
- for (; r < s && n.charAt(s - r - 1) === e; )
891
- r++;
892
- return n.slice(0, s - r);
893
- }
894
- function _n(n, e) {
895
- if (n.indexOf(e[1]) === -1)
896
- return -1;
897
- let t = 0;
898
- for (let s = 0; s < n.length; s++)
899
- if (n[s] === "\\")
900
- s++;
901
- else if (n[s] === e[0])
902
- t++;
903
- else if (n[s] === e[1] && (t--, t < 0))
904
- return s;
905
- return -1;
906
- }
907
- function Fe(n, e, t, s) {
908
- const r = e.href, i = e.title ? y(e.title) : null, o = n[1].replace(/\\([\[\]])/g, "$1");
909
- if (n[0].charAt(0) !== "!") {
910
- s.state.inLink = !0;
911
- const l = {
912
- type: "link",
913
- raw: t,
914
- href: r,
915
- title: i,
916
- text: o,
917
- tokens: s.inlineTokens(o)
918
- };
919
- return s.state.inLink = !1, l;
920
- }
921
- return {
922
- type: "image",
923
- raw: t,
924
- href: r,
925
- title: i,
926
- text: y(o)
927
- };
928
- }
929
- function $n(n, e) {
930
- const t = n.match(/^(\s+)(?:```)/);
931
- if (t === null)
932
- return e;
933
- const s = t[1];
934
- return e.split(`
935
- `).map((r) => {
936
- const i = r.match(/^\s+/);
937
- if (i === null)
938
- return r;
939
- const [o] = i;
940
- return o.length >= s.length ? r.slice(s.length) : r;
941
- }).join(`
942
- `);
943
- }
944
- class ee {
945
- // set by the lexer
946
- constructor(e) {
947
- k(this, "options");
948
- k(this, "rules");
949
- // set by the lexer
950
- k(this, "lexer");
951
- this.options = e || v;
952
- }
953
- space(e) {
954
- const t = this.rules.block.newline.exec(e);
955
- if (t && t[0].length > 0)
956
- return {
957
- type: "space",
958
- raw: t[0]
959
- };
960
- }
961
- code(e) {
962
- const t = this.rules.block.code.exec(e);
963
- if (t) {
964
- const s = t[0].replace(/^(?: {1,4}| {0,3}\t)/gm, "");
965
- return {
966
- type: "code",
967
- raw: t[0],
968
- codeBlockStyle: "indented",
969
- text: this.options.pedantic ? s : L(s, `
970
- `)
971
- };
972
- }
973
- }
974
- fences(e) {
975
- const t = this.rules.block.fences.exec(e);
976
- if (t) {
977
- const s = t[0], r = $n(s, t[3] || "");
978
- return {
979
- type: "code",
980
- raw: s,
981
- lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2],
982
- text: r
983
- };
984
- }
985
- }
986
- heading(e) {
987
- const t = this.rules.block.heading.exec(e);
988
- if (t) {
989
- let s = t[2].trim();
990
- if (/#$/.test(s)) {
991
- const r = L(s, "#");
992
- (this.options.pedantic || !r || / $/.test(r)) && (s = r.trim());
993
- }
994
- return {
995
- type: "heading",
996
- raw: t[0],
997
- depth: t[1].length,
998
- text: s,
999
- tokens: this.lexer.inline(s)
1000
- };
1001
- }
1002
- }
1003
- hr(e) {
1004
- const t = this.rules.block.hr.exec(e);
1005
- if (t)
1006
- return {
1007
- type: "hr",
1008
- raw: L(t[0], `
1009
- `)
1010
- };
1011
- }
1012
- blockquote(e) {
1013
- const t = this.rules.block.blockquote.exec(e);
1014
- if (t) {
1015
- let s = L(t[0], `
1016
- `).split(`
1017
- `), r = "", i = "";
1018
- const o = [];
1019
- for (; s.length > 0; ) {
1020
- let l = !1;
1021
- const a = [];
1022
- let p;
1023
- for (p = 0; p < s.length; p++)
1024
- if (/^ {0,3}>/.test(s[p]))
1025
- a.push(s[p]), l = !0;
1026
- else if (!l)
1027
- a.push(s[p]);
1028
- else
1029
- break;
1030
- s = s.slice(p);
1031
- const u = a.join(`
1032
- `), c = u.replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g, `
1033
- $1`).replace(/^ {0,3}>[ \t]?/gm, "");
1034
- r = r ? `${r}
1035
- ${u}` : u, i = i ? `${i}
1036
- ${c}` : c;
1037
- const f = this.lexer.state.top;
1038
- if (this.lexer.state.top = !0, this.lexer.blockTokens(c, o, !0), this.lexer.state.top = f, s.length === 0)
1039
- break;
1040
- const h = o[o.length - 1];
1041
- if ((h == null ? void 0 : h.type) === "code")
1042
- break;
1043
- if ((h == null ? void 0 : h.type) === "blockquote") {
1044
- const d = h, b = d.raw + `
1045
- ` + s.join(`
1046
- `), $ = this.blockquote(b);
1047
- o[o.length - 1] = $, r = r.substring(0, r.length - d.raw.length) + $.raw, i = i.substring(0, i.length - d.text.length) + $.text;
1048
- break;
1049
- } else if ((h == null ? void 0 : h.type) === "list") {
1050
- const d = h, b = d.raw + `
1051
- ` + s.join(`
1052
- `), $ = this.list(b);
1053
- o[o.length - 1] = $, r = r.substring(0, r.length - h.raw.length) + $.raw, i = i.substring(0, i.length - d.raw.length) + $.raw, s = b.substring(o[o.length - 1].raw.length).split(`
1054
- `);
1055
- continue;
1056
- }
1057
- }
1058
- return {
1059
- type: "blockquote",
1060
- raw: r,
1061
- tokens: o,
1062
- text: i
1063
- };
1064
- }
1065
- }
1066
- list(e) {
1067
- let t = this.rules.block.list.exec(e);
1068
- if (t) {
1069
- let s = t[1].trim();
1070
- const r = s.length > 1, i = {
1071
- type: "list",
1072
- raw: "",
1073
- ordered: r,
1074
- start: r ? +s.slice(0, -1) : "",
1075
- loose: !1,
1076
- items: []
1077
- };
1078
- s = r ? `\\d{1,9}\\${s.slice(-1)}` : `\\${s}`, this.options.pedantic && (s = r ? s : "[*+-]");
1079
- const o = new RegExp(`^( {0,3}${s})((?:[ ][^\\n]*)?(?:\\n|$))`);
1080
- let l = !1;
1081
- for (; e; ) {
1082
- let a = !1, p = "", u = "";
1083
- if (!(t = o.exec(e)) || this.rules.block.hr.test(e))
1084
- break;
1085
- p = t[0], e = e.substring(p.length);
1086
- let c = t[2].split(`
1087
- `, 1)[0].replace(/^\t+/, (ue) => " ".repeat(3 * ue.length)), f = e.split(`
1088
- `, 1)[0], h = !c.trim(), d = 0;
1089
- if (this.options.pedantic ? (d = 2, u = c.trimStart()) : h ? d = t[1].length + 1 : (d = t[2].search(/[^ ]/), d = d > 4 ? 1 : d, u = c.slice(d), d += t[1].length), h && /^[ \t]*$/.test(f) && (p += f + `
1090
- `, e = e.substring(f.length + 1), a = !0), !a) {
1091
- const ue = new RegExp(`^ {0,${Math.min(3, d - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), Ce = new RegExp(`^ {0,${Math.min(3, d - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), ve = new RegExp(`^ {0,${Math.min(3, d - 1)}}(?:\`\`\`|~~~)`), Me = new RegExp(`^ {0,${Math.min(3, d - 1)}}#`), xt = new RegExp(`^ {0,${Math.min(3, d - 1)}}<(?:[a-z].*>|!--)`, "i");
1092
- for (; e; ) {
1093
- const pe = e.split(`
1094
- `, 1)[0];
1095
- let j;
1096
- if (f = pe, this.options.pedantic ? (f = f.replace(/^ {1,4}(?=( {4})*[^ ])/g, " "), j = f) : j = f.replace(/\t/g, " "), ve.test(f) || Me.test(f) || xt.test(f) || ue.test(f) || Ce.test(f))
1097
- break;
1098
- if (j.search(/[^ ]/) >= d || !f.trim())
1099
- u += `
1100
- ` + j.slice(d);
1101
- else {
1102
- if (h || c.replace(/\t/g, " ").search(/[^ ]/) >= 4 || ve.test(c) || Me.test(c) || Ce.test(c))
1103
- break;
1104
- u += `
1105
- ` + f;
1106
- }
1107
- !h && !f.trim() && (h = !0), p += pe + `
1108
- `, e = e.substring(pe.length + 1), c = j.slice(d);
1109
- }
1110
- }
1111
- i.loose || (l ? i.loose = !0 : /\n[ \t]*\n[ \t]*$/.test(p) && (l = !0));
1112
- let b = null, $;
1113
- this.options.gfm && (b = /^\[[ xX]\] /.exec(u), b && ($ = b[0] !== "[ ] ", u = u.replace(/^\[[ xX]\] +/, ""))), i.items.push({
1114
- type: "list_item",
1115
- raw: p,
1116
- task: !!b,
1117
- checked: $,
1118
- loose: !1,
1119
- text: u,
1120
- tokens: []
1121
- }), i.raw += p;
1122
- }
1123
- i.items[i.items.length - 1].raw = i.items[i.items.length - 1].raw.trimEnd(), i.items[i.items.length - 1].text = i.items[i.items.length - 1].text.trimEnd(), i.raw = i.raw.trimEnd();
1124
- for (let a = 0; a < i.items.length; a++)
1125
- if (this.lexer.state.top = !1, i.items[a].tokens = this.lexer.blockTokens(i.items[a].text, []), !i.loose) {
1126
- const p = i.items[a].tokens.filter((c) => c.type === "space"), u = p.length > 0 && p.some((c) => /\n.*\n/.test(c.raw));
1127
- i.loose = u;
1128
- }
1129
- if (i.loose)
1130
- for (let a = 0; a < i.items.length; a++)
1131
- i.items[a].loose = !0;
1132
- return i;
1133
- }
1134
- }
1135
- html(e) {
1136
- const t = this.rules.block.html.exec(e);
1137
- if (t)
1138
- return {
1139
- type: "html",
1140
- block: !0,
1141
- raw: t[0],
1142
- pre: t[1] === "pre" || t[1] === "script" || t[1] === "style",
1143
- text: t[0]
1144
- };
1145
- }
1146
- def(e) {
1147
- const t = this.rules.block.def.exec(e);
1148
- if (t) {
1149
- const s = t[1].toLowerCase().replace(/\s+/g, " "), r = t[2] ? t[2].replace(/^<(.*)>$/, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", i = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
1150
- return {
1151
- type: "def",
1152
- tag: s,
1153
- raw: t[0],
1154
- href: r,
1155
- title: i
1156
- };
1157
- }
1158
- }
1159
- table(e) {
1160
- const t = this.rules.block.table.exec(e);
1161
- if (!t || !/[:|]/.test(t[2]))
1162
- return;
1163
- const s = Le(t[1]), r = t[2].replace(/^\||\| *$/g, "").split("|"), i = t[3] && t[3].trim() ? t[3].replace(/\n[ \t]*$/, "").split(`
1164
- `) : [], o = {
1165
- type: "table",
1166
- raw: t[0],
1167
- header: [],
1168
- align: [],
1169
- rows: []
1170
- };
1171
- if (s.length === r.length) {
1172
- for (const l of r)
1173
- /^ *-+: *$/.test(l) ? o.align.push("right") : /^ *:-+: *$/.test(l) ? o.align.push("center") : /^ *:-+ *$/.test(l) ? o.align.push("left") : o.align.push(null);
1174
- for (let l = 0; l < s.length; l++)
1175
- o.header.push({
1176
- text: s[l],
1177
- tokens: this.lexer.inline(s[l]),
1178
- header: !0,
1179
- align: o.align[l]
1180
- });
1181
- for (const l of i)
1182
- o.rows.push(Le(l, o.header.length).map((a, p) => ({
1183
- text: a,
1184
- tokens: this.lexer.inline(a),
1185
- header: !1,
1186
- align: o.align[p]
1187
- })));
1188
- return o;
1189
- }
1190
- }
1191
- lheading(e) {
1192
- const t = this.rules.block.lheading.exec(e);
1193
- if (t)
1194
- return {
1195
- type: "heading",
1196
- raw: t[0],
1197
- depth: t[2].charAt(0) === "=" ? 1 : 2,
1198
- text: t[1],
1199
- tokens: this.lexer.inline(t[1])
1200
- };
1201
- }
1202
- paragraph(e) {
1203
- const t = this.rules.block.paragraph.exec(e);
1204
- if (t) {
1205
- const s = t[1].charAt(t[1].length - 1) === `
1206
- ` ? t[1].slice(0, -1) : t[1];
1207
- return {
1208
- type: "paragraph",
1209
- raw: t[0],
1210
- text: s,
1211
- tokens: this.lexer.inline(s)
1212
- };
1213
- }
1214
- }
1215
- text(e) {
1216
- const t = this.rules.block.text.exec(e);
1217
- if (t)
1218
- return {
1219
- type: "text",
1220
- raw: t[0],
1221
- text: t[0],
1222
- tokens: this.lexer.inline(t[0])
1223
- };
1224
- }
1225
- escape(e) {
1226
- const t = this.rules.inline.escape.exec(e);
1227
- if (t)
1228
- return {
1229
- type: "escape",
1230
- raw: t[0],
1231
- text: y(t[1])
1232
- };
1233
- }
1234
- tag(e) {
1235
- const t = this.rules.inline.tag.exec(e);
1236
- if (t)
1237
- return !this.lexer.state.inLink && /^<a /i.test(t[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && /^<\/a>/i.test(t[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(t[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0]) && (this.lexer.state.inRawBlock = !1), {
1238
- type: "html",
1239
- raw: t[0],
1240
- inLink: this.lexer.state.inLink,
1241
- inRawBlock: this.lexer.state.inRawBlock,
1242
- block: !1,
1243
- text: t[0]
1244
- };
1245
- }
1246
- link(e) {
1247
- const t = this.rules.inline.link.exec(e);
1248
- if (t) {
1249
- const s = t[2].trim();
1250
- if (!this.options.pedantic && /^</.test(s)) {
1251
- if (!/>$/.test(s))
1252
- return;
1253
- const o = L(s.slice(0, -1), "\\");
1254
- if ((s.length - o.length) % 2 === 0)
1255
- return;
1256
- } else {
1257
- const o = _n(t[2], "()");
1258
- if (o > -1) {
1259
- const a = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + o;
1260
- t[2] = t[2].substring(0, o), t[0] = t[0].substring(0, a).trim(), t[3] = "";
1261
- }
1262
- }
1263
- let r = t[2], i = "";
1264
- if (this.options.pedantic) {
1265
- const o = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(r);
1266
- o && (r = o[1], i = o[3]);
1267
- } else
1268
- i = t[3] ? t[3].slice(1, -1) : "";
1269
- return r = r.trim(), /^</.test(r) && (this.options.pedantic && !/>$/.test(s) ? r = r.slice(1) : r = r.slice(1, -1)), Fe(t, {
1270
- href: r && r.replace(this.rules.inline.anyPunctuation, "$1"),
1271
- title: i && i.replace(this.rules.inline.anyPunctuation, "$1")
1272
- }, t[0], this.lexer);
1273
- }
1274
- }
1275
- reflink(e, t) {
1276
- let s;
1277
- if ((s = this.rules.inline.reflink.exec(e)) || (s = this.rules.inline.nolink.exec(e))) {
1278
- const r = (s[2] || s[1]).replace(/\s+/g, " "), i = t[r.toLowerCase()];
1279
- if (!i) {
1280
- const o = s[0].charAt(0);
1281
- return {
1282
- type: "text",
1283
- raw: o,
1284
- text: o
1285
- };
1286
- }
1287
- return Fe(s, i, s[0], this.lexer);
1288
- }
1289
- }
1290
- emStrong(e, t, s = "") {
1291
- let r = this.rules.inline.emStrongLDelim.exec(e);
1292
- if (!r || r[3] && s.match(/[\p{L}\p{N}]/u))
1293
- return;
1294
- if (!(r[1] || r[2] || "") || !s || this.rules.inline.punctuation.exec(s)) {
1295
- const o = [...r[0]].length - 1;
1296
- let l, a, p = o, u = 0;
1297
- const c = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
1298
- for (c.lastIndex = 0, t = t.slice(-1 * e.length + o); (r = c.exec(t)) != null; ) {
1299
- if (l = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !l)
1300
- continue;
1301
- if (a = [...l].length, r[3] || r[4]) {
1302
- p += a;
1303
- continue;
1304
- } else if ((r[5] || r[6]) && o % 3 && !((o + a) % 3)) {
1305
- u += a;
1306
- continue;
1307
- }
1308
- if (p -= a, p > 0)
1309
- continue;
1310
- a = Math.min(a, a + p + u);
1311
- const f = [...r[0]][0].length, h = e.slice(0, o + r.index + f + a);
1312
- if (Math.min(o, a) % 2) {
1313
- const b = h.slice(1, -1);
1314
- return {
1315
- type: "em",
1316
- raw: h,
1317
- text: b,
1318
- tokens: this.lexer.inlineTokens(b)
1319
- };
1320
- }
1321
- const d = h.slice(2, -2);
1322
- return {
1323
- type: "strong",
1324
- raw: h,
1325
- text: d,
1326
- tokens: this.lexer.inlineTokens(d)
1327
- };
1328
- }
1329
- }
1330
- }
1331
- codespan(e) {
1332
- const t = this.rules.inline.code.exec(e);
1333
- if (t) {
1334
- let s = t[2].replace(/\n/g, " ");
1335
- const r = /[^ ]/.test(s), i = /^ /.test(s) && / $/.test(s);
1336
- return r && i && (s = s.substring(1, s.length - 1)), s = y(s, !0), {
1337
- type: "codespan",
1338
- raw: t[0],
1339
- text: s
1340
- };
1341
- }
1342
- }
1343
- br(e) {
1344
- const t = this.rules.inline.br.exec(e);
1345
- if (t)
1346
- return {
1347
- type: "br",
1348
- raw: t[0]
1349
- };
1350
- }
1351
- del(e) {
1352
- const t = this.rules.inline.del.exec(e);
1353
- if (t)
1354
- return {
1355
- type: "del",
1356
- raw: t[0],
1357
- text: t[2],
1358
- tokens: this.lexer.inlineTokens(t[2])
1359
- };
1360
- }
1361
- autolink(e) {
1362
- const t = this.rules.inline.autolink.exec(e);
1363
- if (t) {
1364
- let s, r;
1365
- return t[2] === "@" ? (s = y(t[1]), r = "mailto:" + s) : (s = y(t[1]), r = s), {
1366
- type: "link",
1367
- raw: t[0],
1368
- text: s,
1369
- href: r,
1370
- tokens: [
1371
- {
1372
- type: "text",
1373
- raw: s,
1374
- text: s
1375
- }
1376
- ]
1377
- };
1378
- }
1379
- }
1380
- url(e) {
1381
- var s;
1382
- let t;
1383
- if (t = this.rules.inline.url.exec(e)) {
1384
- let r, i;
1385
- if (t[2] === "@")
1386
- r = y(t[0]), i = "mailto:" + r;
1387
- else {
1388
- let o;
1389
- do
1390
- o = t[0], t[0] = ((s = this.rules.inline._backpedal.exec(t[0])) == null ? void 0 : s[0]) ?? "";
1391
- while (o !== t[0]);
1392
- r = y(t[0]), t[1] === "www." ? i = "http://" + t[0] : i = t[0];
1393
- }
1394
- return {
1395
- type: "link",
1396
- raw: t[0],
1397
- text: r,
1398
- href: i,
1399
- tokens: [
1400
- {
1401
- type: "text",
1402
- raw: r,
1403
- text: r
1404
- }
1405
- ]
1406
- };
1407
- }
1408
- }
1409
- inlineText(e) {
1410
- const t = this.rules.inline.text.exec(e);
1411
- if (t) {
1412
- let s;
1413
- return this.lexer.state.inRawBlock ? s = t[0] : s = y(t[0]), {
1414
- type: "text",
1415
- raw: t[0],
1416
- text: s
1417
- };
1418
- }
1419
- }
1420
- }
1421
- const En = /^(?:[ \t]*(?:\n|$))+/, Rn = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Tn = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, Z = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Sn = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, ht = /(?:[*+-]|\d{1,9}[.)])/, dt = m(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g, ht).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).getRegex(), Te = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, zn = /^[^\n]+/, Se = /(?!\s*\])(?:\\.|[^\[\]\\])+/, Nn = m(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", Se).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), On = m(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, ht).getRegex(), oe = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", ze = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, In = m("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", ze).replace("tag", oe).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), gt = m(Te).replace("hr", Z).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", oe).getRegex(), An = m(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", gt).getRegex(), Ne = {
1422
- blockquote: An,
1423
- code: Rn,
1424
- def: Nn,
1425
- fences: Tn,
1426
- heading: Sn,
1427
- hr: Z,
1428
- html: In,
1429
- lheading: dt,
1430
- list: On,
1431
- newline: En,
1432
- paragraph: gt,
1433
- table: B,
1434
- text: zn
1435
- }, Be = m("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", Z).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", oe).getRegex(), Cn = {
1436
- ...Ne,
1437
- table: Be,
1438
- paragraph: m(Te).replace("hr", Z).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", Be).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", oe).getRegex()
1439
- }, vn = {
1440
- ...Ne,
1441
- html: m(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", ze).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
1442
- def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
1443
- heading: /^(#{1,6})(.*)(?:\n+|$)/,
1444
- fences: B,
1445
- // fences not supported
1446
- lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
1447
- paragraph: m(Te).replace("hr", Z).replace("heading", ` *#{1,6} *[^
1448
- ]`).replace("lheading", dt).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
1449
- }, mt = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Mn = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, kt = /^( {2,}|\\)\n(?!\s*$)/, Vn = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, U = "\\p{P}\\p{S}", Pn = m(/^((?![*_])[\spunctuation])/, "u").replace(/punctuation/g, U).getRegex(), Dn = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g, jn = m(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/, "u").replace(/punct/g, U).getRegex(), Ln = m("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])", "gu").replace(/punct/g, U).getRegex(), Fn = m("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])", "gu").replace(/punct/g, U).getRegex(), Bn = m(/\\([punct])/, "gu").replace(/punct/g, U).getRegex(), qn = m(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), Hn = m(ze).replace("(?:-->|$)", "-->").getRegex(), Zn = m("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Hn).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), te = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, Un = m(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label", te).replace("href", /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), bt = m(/^!?\[(label)\]\[(ref)\]/).replace("label", te).replace("ref", Se).getRegex(), yt = m(/^!?\[(ref)\](?:\[\])?/).replace("ref", Se).getRegex(), Qn = m("reflink|nolink(?!\\()", "g").replace("reflink", bt).replace("nolink", yt).getRegex(), Oe = {
1450
- _backpedal: B,
1451
- // only used for GFM url
1452
- anyPunctuation: Bn,
1453
- autolink: qn,
1454
- blockSkip: Dn,
1455
- br: kt,
1456
- code: Mn,
1457
- del: B,
1458
- emStrongLDelim: jn,
1459
- emStrongRDelimAst: Ln,
1460
- emStrongRDelimUnd: Fn,
1461
- escape: mt,
1462
- link: Un,
1463
- nolink: yt,
1464
- punctuation: Pn,
1465
- reflink: bt,
1466
- reflinkSearch: Qn,
1467
- tag: Zn,
1468
- text: Vn,
1469
- url: B
1470
- }, Kn = {
1471
- ...Oe,
1472
- link: m(/^!?\[(label)\]\((.*?)\)/).replace("label", te).getRegex(),
1473
- reflink: m(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", te).getRegex()
1474
- }, xe = {
1475
- ...Oe,
1476
- escape: m(mt).replace("])", "~|])").getRegex(),
1477
- url: m(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
1478
- _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
1479
- del: /^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,
1480
- text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
1481
- }, Wn = {
1482
- ...xe,
1483
- br: m(kt).replace("{2,}", "*").getRegex(),
1484
- text: m(xe.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
1485
- }, K = {
1486
- normal: Ne,
1487
- gfm: Cn,
1488
- pedantic: vn
1489
- }, F = {
1490
- normal: Oe,
1491
- gfm: xe,
1492
- breaks: Wn,
1493
- pedantic: Kn
1494
- };
1495
- class w {
1496
- constructor(e) {
1497
- k(this, "tokens");
1498
- k(this, "options");
1499
- k(this, "state");
1500
- k(this, "tokenizer");
1501
- k(this, "inlineQueue");
1502
- this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || v, this.options.tokenizer = this.options.tokenizer || new ee(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
1503
- inLink: !1,
1504
- inRawBlock: !1,
1505
- top: !0
1506
- };
1507
- const t = {
1508
- block: K.normal,
1509
- inline: F.normal
1510
- };
1511
- this.options.pedantic ? (t.block = K.pedantic, t.inline = F.pedantic) : this.options.gfm && (t.block = K.gfm, this.options.breaks ? t.inline = F.breaks : t.inline = F.gfm), this.tokenizer.rules = t;
1512
- }
1513
- /**
1514
- * Expose Rules
1515
- */
1516
- static get rules() {
1517
- return {
1518
- block: K,
1519
- inline: F
1520
- };
1521
- }
1522
- /**
1523
- * Static Lex Method
1524
- */
1525
- static lex(e, t) {
1526
- return new w(t).lex(e);
1527
- }
1528
- /**
1529
- * Static Lex Inline Method
1530
- */
1531
- static lexInline(e, t) {
1532
- return new w(t).inlineTokens(e);
1533
- }
1534
- /**
1535
- * Preprocessing
1536
- */
1537
- lex(e) {
1538
- e = e.replace(/\r\n|\r/g, `
1539
- `), this.blockTokens(e, this.tokens);
1540
- for (let t = 0; t < this.inlineQueue.length; t++) {
1541
- const s = this.inlineQueue[t];
1542
- this.inlineTokens(s.src, s.tokens);
1543
- }
1544
- return this.inlineQueue = [], this.tokens;
1545
- }
1546
- blockTokens(e, t = [], s = !1) {
1547
- this.options.pedantic && (e = e.replace(/\t/g, " ").replace(/^ +$/gm, ""));
1548
- let r, i, o;
1549
- for (; e; )
1550
- if (!(this.options.extensions && this.options.extensions.block && this.options.extensions.block.some((l) => (r = l.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), !0) : !1))) {
1551
- if (r = this.tokenizer.space(e)) {
1552
- e = e.substring(r.raw.length), r.raw.length === 1 && t.length > 0 ? t[t.length - 1].raw += `
1553
- ` : t.push(r);
1554
- continue;
1555
- }
1556
- if (r = this.tokenizer.code(e)) {
1557
- e = e.substring(r.raw.length), i = t[t.length - 1], i && (i.type === "paragraph" || i.type === "text") ? (i.raw += `
1558
- ` + r.raw, i.text += `
1559
- ` + r.text, this.inlineQueue[this.inlineQueue.length - 1].src = i.text) : t.push(r);
1560
- continue;
1561
- }
1562
- if (r = this.tokenizer.fences(e)) {
1563
- e = e.substring(r.raw.length), t.push(r);
1564
- continue;
1565
- }
1566
- if (r = this.tokenizer.heading(e)) {
1567
- e = e.substring(r.raw.length), t.push(r);
1568
- continue;
1569
- }
1570
- if (r = this.tokenizer.hr(e)) {
1571
- e = e.substring(r.raw.length), t.push(r);
1572
- continue;
1573
- }
1574
- if (r = this.tokenizer.blockquote(e)) {
1575
- e = e.substring(r.raw.length), t.push(r);
1576
- continue;
1577
- }
1578
- if (r = this.tokenizer.list(e)) {
1579
- e = e.substring(r.raw.length), t.push(r);
1580
- continue;
1581
- }
1582
- if (r = this.tokenizer.html(e)) {
1583
- e = e.substring(r.raw.length), t.push(r);
1584
- continue;
1585
- }
1586
- if (r = this.tokenizer.def(e)) {
1587
- e = e.substring(r.raw.length), i = t[t.length - 1], i && (i.type === "paragraph" || i.type === "text") ? (i.raw += `
1588
- ` + r.raw, i.text += `
1589
- ` + r.raw, this.inlineQueue[this.inlineQueue.length - 1].src = i.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = {
1590
- href: r.href,
1591
- title: r.title
1592
- });
1593
- continue;
1594
- }
1595
- if (r = this.tokenizer.table(e)) {
1596
- e = e.substring(r.raw.length), t.push(r);
1597
- continue;
1598
- }
1599
- if (r = this.tokenizer.lheading(e)) {
1600
- e = e.substring(r.raw.length), t.push(r);
1601
- continue;
1602
- }
1603
- if (o = e, this.options.extensions && this.options.extensions.startBlock) {
1604
- let l = 1 / 0;
1605
- const a = e.slice(1);
1606
- let p;
1607
- this.options.extensions.startBlock.forEach((u) => {
1608
- p = u.call({ lexer: this }, a), typeof p == "number" && p >= 0 && (l = Math.min(l, p));
1609
- }), l < 1 / 0 && l >= 0 && (o = e.substring(0, l + 1));
1610
- }
1611
- if (this.state.top && (r = this.tokenizer.paragraph(o))) {
1612
- i = t[t.length - 1], s && (i == null ? void 0 : i.type) === "paragraph" ? (i.raw += `
1613
- ` + r.raw, i.text += `
1614
- ` + r.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src = i.text) : t.push(r), s = o.length !== e.length, e = e.substring(r.raw.length);
1615
- continue;
1616
- }
1617
- if (r = this.tokenizer.text(e)) {
1618
- e = e.substring(r.raw.length), i = t[t.length - 1], i && i.type === "text" ? (i.raw += `
1619
- ` + r.raw, i.text += `
1620
- ` + r.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src = i.text) : t.push(r);
1621
- continue;
1622
- }
1623
- if (e) {
1624
- const l = "Infinite loop on byte: " + e.charCodeAt(0);
1625
- if (this.options.silent) {
1626
- console.error(l);
1627
- break;
1628
- } else
1629
- throw new Error(l);
1630
- }
1631
- }
1632
- return this.state.top = !0, t;
1633
- }
1634
- inline(e, t = []) {
1635
- return this.inlineQueue.push({ src: e, tokens: t }), t;
1636
- }
1637
- /**
1638
- * Lexing/Compiling
1639
- */
1640
- inlineTokens(e, t = []) {
1641
- let s, r, i, o = e, l, a, p;
1642
- if (this.tokens.links) {
1643
- const u = Object.keys(this.tokens.links);
1644
- if (u.length > 0)
1645
- for (; (l = this.tokenizer.rules.inline.reflinkSearch.exec(o)) != null; )
1646
- u.includes(l[0].slice(l[0].lastIndexOf("[") + 1, -1)) && (o = o.slice(0, l.index) + "[" + "a".repeat(l[0].length - 2) + "]" + o.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
1647
- }
1648
- for (; (l = this.tokenizer.rules.inline.blockSkip.exec(o)) != null; )
1649
- o = o.slice(0, l.index) + "[" + "a".repeat(l[0].length - 2) + "]" + o.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
1650
- for (; (l = this.tokenizer.rules.inline.anyPunctuation.exec(o)) != null; )
1651
- o = o.slice(0, l.index) + "++" + o.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
1652
- for (; e; )
1653
- if (a || (p = ""), a = !1, !(this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((u) => (s = u.call({ lexer: this }, e, t)) ? (e = e.substring(s.raw.length), t.push(s), !0) : !1))) {
1654
- if (s = this.tokenizer.escape(e)) {
1655
- e = e.substring(s.raw.length), t.push(s);
1656
- continue;
1657
- }
1658
- if (s = this.tokenizer.tag(e)) {
1659
- e = e.substring(s.raw.length), r = t[t.length - 1], r && s.type === "text" && r.type === "text" ? (r.raw += s.raw, r.text += s.text) : t.push(s);
1660
- continue;
1661
- }
1662
- if (s = this.tokenizer.link(e)) {
1663
- e = e.substring(s.raw.length), t.push(s);
1664
- continue;
1665
- }
1666
- if (s = this.tokenizer.reflink(e, this.tokens.links)) {
1667
- e = e.substring(s.raw.length), r = t[t.length - 1], r && s.type === "text" && r.type === "text" ? (r.raw += s.raw, r.text += s.text) : t.push(s);
1668
- continue;
1669
- }
1670
- if (s = this.tokenizer.emStrong(e, o, p)) {
1671
- e = e.substring(s.raw.length), t.push(s);
1672
- continue;
1673
- }
1674
- if (s = this.tokenizer.codespan(e)) {
1675
- e = e.substring(s.raw.length), t.push(s);
1676
- continue;
1677
- }
1678
- if (s = this.tokenizer.br(e)) {
1679
- e = e.substring(s.raw.length), t.push(s);
1680
- continue;
1681
- }
1682
- if (s = this.tokenizer.del(e)) {
1683
- e = e.substring(s.raw.length), t.push(s);
1684
- continue;
1685
- }
1686
- if (s = this.tokenizer.autolink(e)) {
1687
- e = e.substring(s.raw.length), t.push(s);
1688
- continue;
1689
- }
1690
- if (!this.state.inLink && (s = this.tokenizer.url(e))) {
1691
- e = e.substring(s.raw.length), t.push(s);
1692
- continue;
1693
- }
1694
- if (i = e, this.options.extensions && this.options.extensions.startInline) {
1695
- let u = 1 / 0;
1696
- const c = e.slice(1);
1697
- let f;
1698
- this.options.extensions.startInline.forEach((h) => {
1699
- f = h.call({ lexer: this }, c), typeof f == "number" && f >= 0 && (u = Math.min(u, f));
1700
- }), u < 1 / 0 && u >= 0 && (i = e.substring(0, u + 1));
1701
- }
1702
- if (s = this.tokenizer.inlineText(i)) {
1703
- e = e.substring(s.raw.length), s.raw.slice(-1) !== "_" && (p = s.raw.slice(-1)), a = !0, r = t[t.length - 1], r && r.type === "text" ? (r.raw += s.raw, r.text += s.text) : t.push(s);
1704
- continue;
1705
- }
1706
- if (e) {
1707
- const u = "Infinite loop on byte: " + e.charCodeAt(0);
1708
- if (this.options.silent) {
1709
- console.error(u);
1710
- break;
1711
- } else
1712
- throw new Error(u);
1713
- }
1714
- }
1715
- return t;
1716
- }
1717
- }
1718
- class ne {
1719
- // set by the parser
1720
- constructor(e) {
1721
- k(this, "options");
1722
- k(this, "parser");
1723
- this.options = e || v;
1724
- }
1725
- space(e) {
1726
- return "";
1727
- }
1728
- code({ text: e, lang: t, escaped: s }) {
1729
- var o;
1730
- const r = (o = (t || "").match(/^\S*/)) == null ? void 0 : o[0], i = e.replace(/\n$/, "") + `
1731
- `;
1732
- return r ? '<pre><code class="language-' + y(r) + '">' + (s ? i : y(i, !0)) + `</code></pre>
1733
- ` : "<pre><code>" + (s ? i : y(i, !0)) + `</code></pre>
1734
- `;
1735
- }
1736
- blockquote({ tokens: e }) {
1737
- return `<blockquote>
1738
- ${this.parser.parse(e)}</blockquote>
1739
- `;
1740
- }
1741
- html({ text: e }) {
1742
- return e;
1743
- }
1744
- heading({ tokens: e, depth: t }) {
1745
- return `<h${t}>${this.parser.parseInline(e)}</h${t}>
1746
- `;
1747
- }
1748
- hr(e) {
1749
- return `<hr>
1750
- `;
1751
- }
1752
- list(e) {
1753
- const t = e.ordered, s = e.start;
1754
- let r = "";
1755
- for (let l = 0; l < e.items.length; l++) {
1756
- const a = e.items[l];
1757
- r += this.listitem(a);
1758
- }
1759
- const i = t ? "ol" : "ul", o = t && s !== 1 ? ' start="' + s + '"' : "";
1760
- return "<" + i + o + `>
1761
- ` + r + "</" + i + `>
1762
- `;
1763
- }
1764
- listitem(e) {
1765
- let t = "";
1766
- if (e.task) {
1767
- const s = this.checkbox({ checked: !!e.checked });
1768
- e.loose ? e.tokens.length > 0 && e.tokens[0].type === "paragraph" ? (e.tokens[0].text = s + " " + e.tokens[0].text, e.tokens[0].tokens && e.tokens[0].tokens.length > 0 && e.tokens[0].tokens[0].type === "text" && (e.tokens[0].tokens[0].text = s + " " + e.tokens[0].tokens[0].text)) : e.tokens.unshift({
1769
- type: "text",
1770
- raw: s + " ",
1771
- text: s + " "
1772
- }) : t += s + " ";
1773
- }
1774
- return t += this.parser.parse(e.tokens, !!e.loose), `<li>${t}</li>
1775
- `;
1776
- }
1777
- checkbox({ checked: e }) {
1778
- return "<input " + (e ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
1779
- }
1780
- paragraph({ tokens: e }) {
1781
- return `<p>${this.parser.parseInline(e)}</p>
1782
- `;
1783
- }
1784
- table(e) {
1785
- let t = "", s = "";
1786
- for (let i = 0; i < e.header.length; i++)
1787
- s += this.tablecell(e.header[i]);
1788
- t += this.tablerow({ text: s });
1789
- let r = "";
1790
- for (let i = 0; i < e.rows.length; i++) {
1791
- const o = e.rows[i];
1792
- s = "";
1793
- for (let l = 0; l < o.length; l++)
1794
- s += this.tablecell(o[l]);
1795
- r += this.tablerow({ text: s });
1796
- }
1797
- return r && (r = `<tbody>${r}</tbody>`), `<table>
1798
- <thead>
1799
- ` + t + `</thead>
1800
- ` + r + `</table>
1801
- `;
1802
- }
1803
- tablerow({ text: e }) {
1804
- return `<tr>
1805
- ${e}</tr>
1806
- `;
1807
- }
1808
- tablecell(e) {
1809
- const t = this.parser.parseInline(e.tokens), s = e.header ? "th" : "td";
1810
- return (e.align ? `<${s} align="${e.align}">` : `<${s}>`) + t + `</${s}>
1811
- `;
1812
- }
1813
- /**
1814
- * span level renderer
1815
- */
1816
- strong({ tokens: e }) {
1817
- return `<strong>${this.parser.parseInline(e)}</strong>`;
1818
- }
1819
- em({ tokens: e }) {
1820
- return `<em>${this.parser.parseInline(e)}</em>`;
1821
- }
1822
- codespan({ text: e }) {
1823
- return `<code>${e}</code>`;
1824
- }
1825
- br(e) {
1826
- return "<br>";
1827
- }
1828
- del({ tokens: e }) {
1829
- return `<del>${this.parser.parseInline(e)}</del>`;
1830
- }
1831
- link({ href: e, title: t, tokens: s }) {
1832
- const r = this.parser.parseInline(s), i = je(e);
1833
- if (i === null)
1834
- return r;
1835
- e = i;
1836
- let o = '<a href="' + e + '"';
1837
- return t && (o += ' title="' + t + '"'), o += ">" + r + "</a>", o;
1838
- }
1839
- image({ href: e, title: t, text: s }) {
1840
- const r = je(e);
1841
- if (r === null)
1842
- return s;
1843
- e = r;
1844
- let i = `<img src="${e}" alt="${s}"`;
1845
- return t && (i += ` title="${t}"`), i += ">", i;
1846
- }
1847
- text(e) {
1848
- return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : e.text;
1849
- }
1850
- }
1851
- class Ie {
1852
- // no need for block level renderers
1853
- strong({ text: e }) {
1854
- return e;
1855
- }
1856
- em({ text: e }) {
1857
- return e;
1858
- }
1859
- codespan({ text: e }) {
1860
- return e;
1861
- }
1862
- del({ text: e }) {
1863
- return e;
1864
- }
1865
- html({ text: e }) {
1866
- return e;
1867
- }
1868
- text({ text: e }) {
1869
- return e;
1870
- }
1871
- link({ text: e }) {
1872
- return "" + e;
1873
- }
1874
- image({ text: e }) {
1875
- return "" + e;
1876
- }
1877
- br() {
1878
- return "";
1879
- }
1880
- }
1881
- class _ {
1882
- constructor(e) {
1883
- k(this, "options");
1884
- k(this, "renderer");
1885
- k(this, "textRenderer");
1886
- this.options = e || v, this.options.renderer = this.options.renderer || new ne(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new Ie();
1887
- }
1888
- /**
1889
- * Static Parse Method
1890
- */
1891
- static parse(e, t) {
1892
- return new _(t).parse(e);
1893
- }
1894
- /**
1895
- * Static Parse Inline Method
1896
- */
1897
- static parseInline(e, t) {
1898
- return new _(t).parseInline(e);
1899
- }
1900
- /**
1901
- * Parse Loop
1902
- */
1903
- parse(e, t = !0) {
1904
- let s = "";
1905
- for (let r = 0; r < e.length; r++) {
1906
- const i = e[r];
1907
- if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[i.type]) {
1908
- const l = i, a = this.options.extensions.renderers[l.type].call({ parser: this }, l);
1909
- if (a !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(l.type)) {
1910
- s += a || "";
1911
- continue;
1912
- }
1913
- }
1914
- const o = i;
1915
- switch (o.type) {
1916
- case "space": {
1917
- s += this.renderer.space(o);
1918
- continue;
1919
- }
1920
- case "hr": {
1921
- s += this.renderer.hr(o);
1922
- continue;
1923
- }
1924
- case "heading": {
1925
- s += this.renderer.heading(o);
1926
- continue;
1927
- }
1928
- case "code": {
1929
- s += this.renderer.code(o);
1930
- continue;
1931
- }
1932
- case "table": {
1933
- s += this.renderer.table(o);
1934
- continue;
1935
- }
1936
- case "blockquote": {
1937
- s += this.renderer.blockquote(o);
1938
- continue;
1939
- }
1940
- case "list": {
1941
- s += this.renderer.list(o);
1942
- continue;
1943
- }
1944
- case "html": {
1945
- s += this.renderer.html(o);
1946
- continue;
1947
- }
1948
- case "paragraph": {
1949
- s += this.renderer.paragraph(o);
1950
- continue;
1951
- }
1952
- case "text": {
1953
- let l = o, a = this.renderer.text(l);
1954
- for (; r + 1 < e.length && e[r + 1].type === "text"; )
1955
- l = e[++r], a += `
1956
- ` + this.renderer.text(l);
1957
- t ? s += this.renderer.paragraph({
1958
- type: "paragraph",
1959
- raw: a,
1960
- text: a,
1961
- tokens: [{ type: "text", raw: a, text: a }]
1962
- }) : s += a;
1963
- continue;
1964
- }
1965
- default: {
1966
- const l = 'Token with "' + o.type + '" type was not found.';
1967
- if (this.options.silent)
1968
- return console.error(l), "";
1969
- throw new Error(l);
1970
- }
1971
- }
1972
- }
1973
- return s;
1974
- }
1975
- /**
1976
- * Parse Inline Tokens
1977
- */
1978
- parseInline(e, t) {
1979
- t = t || this.renderer;
1980
- let s = "";
1981
- for (let r = 0; r < e.length; r++) {
1982
- const i = e[r];
1983
- if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[i.type]) {
1984
- const l = this.options.extensions.renderers[i.type].call({ parser: this }, i);
1985
- if (l !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(i.type)) {
1986
- s += l || "";
1987
- continue;
1988
- }
1989
- }
1990
- const o = i;
1991
- switch (o.type) {
1992
- case "escape": {
1993
- s += t.text(o);
1994
- break;
1995
- }
1996
- case "html": {
1997
- s += t.html(o);
1998
- break;
1999
- }
2000
- case "link": {
2001
- s += t.link(o);
2002
- break;
2003
- }
2004
- case "image": {
2005
- s += t.image(o);
2006
- break;
2007
- }
2008
- case "strong": {
2009
- s += t.strong(o);
2010
- break;
2011
- }
2012
- case "em": {
2013
- s += t.em(o);
2014
- break;
2015
- }
2016
- case "codespan": {
2017
- s += t.codespan(o);
2018
- break;
2019
- }
2020
- case "br": {
2021
- s += t.br(o);
2022
- break;
2023
- }
2024
- case "del": {
2025
- s += t.del(o);
2026
- break;
2027
- }
2028
- case "text": {
2029
- s += t.text(o);
2030
- break;
2031
- }
2032
- default: {
2033
- const l = 'Token with "' + o.type + '" type was not found.';
2034
- if (this.options.silent)
2035
- return console.error(l), "";
2036
- throw new Error(l);
2037
- }
2038
- }
2039
- }
2040
- return s;
2041
- }
2042
- }
2043
- class q {
2044
- constructor(e) {
2045
- k(this, "options");
2046
- k(this, "block");
2047
- this.options = e || v;
2048
- }
2049
- /**
2050
- * Process markdown before marked
2051
- */
2052
- preprocess(e) {
2053
- return e;
2054
- }
2055
- /**
2056
- * Process HTML after marked is finished
2057
- */
2058
- postprocess(e) {
2059
- return e;
2060
- }
2061
- /**
2062
- * Process all tokens before walk tokens
2063
- */
2064
- processAllTokens(e) {
2065
- return e;
2066
- }
2067
- /**
2068
- * Provide function to tokenize markdown
2069
- */
2070
- provideLexer() {
2071
- return this.block ? w.lex : w.lexInline;
2072
- }
2073
- /**
2074
- * Provide function to parse tokens
2075
- */
2076
- provideParser() {
2077
- return this.block ? _.parse : _.parseInline;
2078
- }
2079
- }
2080
- k(q, "passThroughHooks", /* @__PURE__ */ new Set([
2081
- "preprocess",
2082
- "postprocess",
2083
- "processAllTokens"
2084
- ]));
2085
- class Jn {
2086
- constructor(...e) {
2087
- k(this, "defaults", Re());
2088
- k(this, "options", this.setOptions);
2089
- k(this, "parse", this.parseMarkdown(!0));
2090
- k(this, "parseInline", this.parseMarkdown(!1));
2091
- k(this, "Parser", _);
2092
- k(this, "Renderer", ne);
2093
- k(this, "TextRenderer", Ie);
2094
- k(this, "Lexer", w);
2095
- k(this, "Tokenizer", ee);
2096
- k(this, "Hooks", q);
2097
- this.use(...e);
2098
- }
2099
- /**
2100
- * Run callback for every token
2101
- */
2102
- walkTokens(e, t) {
2103
- var r, i;
2104
- let s = [];
2105
- for (const o of e)
2106
- switch (s = s.concat(t.call(this, o)), o.type) {
2107
- case "table": {
2108
- const l = o;
2109
- for (const a of l.header)
2110
- s = s.concat(this.walkTokens(a.tokens, t));
2111
- for (const a of l.rows)
2112
- for (const p of a)
2113
- s = s.concat(this.walkTokens(p.tokens, t));
2114
- break;
2115
- }
2116
- case "list": {
2117
- const l = o;
2118
- s = s.concat(this.walkTokens(l.items, t));
2119
- break;
2120
- }
2121
- default: {
2122
- const l = o;
2123
- (i = (r = this.defaults.extensions) == null ? void 0 : r.childTokens) != null && i[l.type] ? this.defaults.extensions.childTokens[l.type].forEach((a) => {
2124
- const p = l[a].flat(1 / 0);
2125
- s = s.concat(this.walkTokens(p, t));
2126
- }) : l.tokens && (s = s.concat(this.walkTokens(l.tokens, t)));
2127
- }
2128
- }
2129
- return s;
2130
- }
2131
- use(...e) {
2132
- const t = this.defaults.extensions || { renderers: {}, childTokens: {} };
2133
- return e.forEach((s) => {
2134
- const r = { ...s };
2135
- if (r.async = this.defaults.async || r.async || !1, s.extensions && (s.extensions.forEach((i) => {
2136
- if (!i.name)
2137
- throw new Error("extension name required");
2138
- if ("renderer" in i) {
2139
- const o = t.renderers[i.name];
2140
- o ? t.renderers[i.name] = function(...l) {
2141
- let a = i.renderer.apply(this, l);
2142
- return a === !1 && (a = o.apply(this, l)), a;
2143
- } : t.renderers[i.name] = i.renderer;
2144
- }
2145
- if ("tokenizer" in i) {
2146
- if (!i.level || i.level !== "block" && i.level !== "inline")
2147
- throw new Error("extension level must be 'block' or 'inline'");
2148
- const o = t[i.level];
2149
- o ? o.unshift(i.tokenizer) : t[i.level] = [i.tokenizer], i.start && (i.level === "block" ? t.startBlock ? t.startBlock.push(i.start) : t.startBlock = [i.start] : i.level === "inline" && (t.startInline ? t.startInline.push(i.start) : t.startInline = [i.start]));
2150
- }
2151
- "childTokens" in i && i.childTokens && (t.childTokens[i.name] = i.childTokens);
2152
- }), r.extensions = t), s.renderer) {
2153
- const i = this.defaults.renderer || new ne(this.defaults);
2154
- for (const o in s.renderer) {
2155
- if (!(o in i))
2156
- throw new Error(`renderer '${o}' does not exist`);
2157
- if (["options", "parser"].includes(o))
2158
- continue;
2159
- const l = o, a = s.renderer[l], p = i[l];
2160
- i[l] = (...u) => {
2161
- let c = a.apply(i, u);
2162
- return c === !1 && (c = p.apply(i, u)), c || "";
2163
- };
2164
- }
2165
- r.renderer = i;
2166
- }
2167
- if (s.tokenizer) {
2168
- const i = this.defaults.tokenizer || new ee(this.defaults);
2169
- for (const o in s.tokenizer) {
2170
- if (!(o in i))
2171
- throw new Error(`tokenizer '${o}' does not exist`);
2172
- if (["options", "rules", "lexer"].includes(o))
2173
- continue;
2174
- const l = o, a = s.tokenizer[l], p = i[l];
2175
- i[l] = (...u) => {
2176
- let c = a.apply(i, u);
2177
- return c === !1 && (c = p.apply(i, u)), c;
2178
- };
2179
- }
2180
- r.tokenizer = i;
2181
- }
2182
- if (s.hooks) {
2183
- const i = this.defaults.hooks || new q();
2184
- for (const o in s.hooks) {
2185
- if (!(o in i))
2186
- throw new Error(`hook '${o}' does not exist`);
2187
- if (["options", "block"].includes(o))
2188
- continue;
2189
- const l = o, a = s.hooks[l], p = i[l];
2190
- q.passThroughHooks.has(o) ? i[l] = (u) => {
2191
- if (this.defaults.async)
2192
- return Promise.resolve(a.call(i, u)).then((f) => p.call(i, f));
2193
- const c = a.call(i, u);
2194
- return p.call(i, c);
2195
- } : i[l] = (...u) => {
2196
- let c = a.apply(i, u);
2197
- return c === !1 && (c = p.apply(i, u)), c;
2198
- };
2199
- }
2200
- r.hooks = i;
2201
- }
2202
- if (s.walkTokens) {
2203
- const i = this.defaults.walkTokens, o = s.walkTokens;
2204
- r.walkTokens = function(l) {
2205
- let a = [];
2206
- return a.push(o.call(this, l)), i && (a = a.concat(i.call(this, l))), a;
2207
- };
2208
- }
2209
- this.defaults = { ...this.defaults, ...r };
2210
- }), this;
2211
- }
2212
- setOptions(e) {
2213
- return this.defaults = { ...this.defaults, ...e }, this;
2214
- }
2215
- lexer(e, t) {
2216
- return w.lex(e, t ?? this.defaults);
2217
- }
2218
- parser(e, t) {
2219
- return _.parse(e, t ?? this.defaults);
2220
- }
2221
- parseMarkdown(e) {
2222
- return (s, r) => {
2223
- const i = { ...r }, o = { ...this.defaults, ...i }, l = this.onError(!!o.silent, !!o.async);
2224
- if (this.defaults.async === !0 && i.async === !1)
2225
- return l(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
2226
- if (typeof s > "u" || s === null)
2227
- return l(new Error("marked(): input parameter is undefined or null"));
2228
- if (typeof s != "string")
2229
- return l(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(s) + ", string expected"));
2230
- o.hooks && (o.hooks.options = o, o.hooks.block = e);
2231
- const a = o.hooks ? o.hooks.provideLexer() : e ? w.lex : w.lexInline, p = o.hooks ? o.hooks.provideParser() : e ? _.parse : _.parseInline;
2232
- if (o.async)
2233
- return Promise.resolve(o.hooks ? o.hooks.preprocess(s) : s).then((u) => a(u, o)).then((u) => o.hooks ? o.hooks.processAllTokens(u) : u).then((u) => o.walkTokens ? Promise.all(this.walkTokens(u, o.walkTokens)).then(() => u) : u).then((u) => p(u, o)).then((u) => o.hooks ? o.hooks.postprocess(u) : u).catch(l);
2234
- try {
2235
- o.hooks && (s = o.hooks.preprocess(s));
2236
- let u = a(s, o);
2237
- o.hooks && (u = o.hooks.processAllTokens(u)), o.walkTokens && this.walkTokens(u, o.walkTokens);
2238
- let c = p(u, o);
2239
- return o.hooks && (c = o.hooks.postprocess(c)), c;
2240
- } catch (u) {
2241
- return l(u);
2242
- }
2243
- };
2244
- }
2245
- onError(e, t) {
2246
- return (s) => {
2247
- if (s.message += `
2248
- Please report this to https://github.com/markedjs/marked.`, e) {
2249
- const r = "<p>An error occurred:</p><pre>" + y(s.message + "", !0) + "</pre>";
2250
- return t ? Promise.resolve(r) : r;
2251
- }
2252
- if (t)
2253
- return Promise.reject(s);
2254
- throw s;
2255
- };
2256
- }
2257
- }
2258
- const C = new Jn();
2259
- function g(n, e) {
2260
- return C.parse(n, e);
2261
- }
2262
- g.options = g.setOptions = function(n) {
2263
- return C.setOptions(n), g.defaults = C.defaults, ut(g.defaults), g;
2264
- };
2265
- g.getDefaults = Re;
2266
- g.defaults = v;
2267
- g.use = function(...n) {
2268
- return C.use(...n), g.defaults = C.defaults, ut(g.defaults), g;
2269
- };
2270
- g.walkTokens = function(n, e) {
2271
- return C.walkTokens(n, e);
2272
- };
2273
- g.parseInline = C.parseInline;
2274
- g.Parser = _;
2275
- g.parser = _.parse;
2276
- g.Renderer = ne;
2277
- g.TextRenderer = Ie;
2278
- g.Lexer = w;
2279
- g.lexer = w.lex;
2280
- g.Tokenizer = ee;
2281
- g.Hooks = q;
2282
- g.parse = g;
2283
- g.options;
2284
- g.setOptions;
2285
- g.use;
2286
- g.walkTokens;
2287
- g.parseInline;
2288
- _.parse;
2289
- w.lex;
2290
- function Yn(n, e = "") {
2291
- const t = {}, s = n;
2292
- return Array.isArray(s.fields) ? Object.assign(t, le(s, e)) : n.type === "array" && n.elements ? Object.assign(t, ae(n, e)) : n.type === "map" && n.values && Object.assign(t, ce(n, e)), t;
2293
- }
2294
- function le(n, e = "") {
2295
- const t = {};
2296
- if (Array.isArray(n.fields))
2297
- for (const s of n.fields) {
2298
- const r = Object.keys(s)[0], i = s[r], o = e ? z(e, r) : r;
2299
- if (t[o] = i, i.type === "record" && Array.isArray(i.fields)) {
2300
- const l = le(i, o);
2301
- Object.assign(t, l);
2302
- } else if (i.type === "array" && i.elements) {
2303
- const l = ae(i, o);
2304
- Object.assign(t, l);
2305
- } else if (i.type === "map" && i.values) {
2306
- const l = ce(i, o);
2307
- Object.assign(t, l);
2308
- }
2309
- }
2310
- return t;
2311
- }
2312
- function ae(n, e = "") {
2313
- const t = {};
2314
- if (n.elements) {
2315
- const s = n.elements, r = z(e, lt);
2316
- if (t[r] = s, s.type === "record" && Array.isArray(s.fields)) {
2317
- const i = le(s, r);
2318
- Object.assign(t, i);
2319
- } else if (s.type === "array" && s.elements) {
2320
- const i = ae(s, r);
2321
- Object.assign(t, i);
2322
- } else if (s.type === "map" && s.values) {
2323
- const i = ce(s, r);
2324
- Object.assign(t, i);
2325
- }
2326
- }
2327
- return t;
2328
- }
2329
- function ce(n, e = "") {
2330
- const t = {}, s = z(e, at);
2331
- if (t[s] = n.values, n.values.type === "record" && Array.isArray(n.values.fields)) {
2332
- const r = le(n.values, s);
2333
- Object.assign(t, r);
2334
- } else if ((n.values.type === "array" || n.values.type === "set") && n.values.elements) {
2335
- const r = ae(n.values, s);
2336
- Object.assign(t, r);
2337
- } else if (n.values.type === "map" && n.values.values) {
2338
- const r = ce(n.values, s);
2339
- Object.assign(t, r);
2340
- }
2341
- return t;
2342
- }
2343
- function Ae(n, e) {
2344
- const t = gn(n), s = [];
2345
- for (let r = 0; r < t.length; r++) {
2346
- const i = t[r], o = s.length > 0 ? z(...s) : "", l = o ? e[o] : void 0;
2347
- (l == null ? void 0 : l.type) === "map" ? s.push(at) : (l == null ? void 0 : l.type) === "array" ? s.push(lt) : s.push(i);
2348
- }
2349
- return z(...s);
2350
- }
2351
- function Gn(n) {
2352
- if (kn(n)) return "enum";
2353
- switch (n.type) {
2354
- case "string":
2355
- return "string";
2356
- case "number":
2357
- case "integer":
2358
- return "number";
2359
- case "boolean":
2360
- return "boolean";
2361
- case "set":
2362
- return mn(n) ? "tag" : "enum";
2363
- case "array":
2364
- return "array";
2365
- case "record":
2366
- return "record";
2367
- case "map":
2368
- return "map";
2369
- case "json":
2370
- return "json";
2371
- case "foreign":
2372
- return "foreign";
2373
- default:
2374
- throw new Error(`Unknown field type: ${n.type}`);
2375
- }
2376
- }
2377
- function* ss(n, e, t, s = "") {
2378
- for (const r of n) {
2379
- const i = Object.keys(r)[0], o = s ? z(s, i) : i, l = $t(e, i);
2380
- if (l === void 0) continue;
2381
- const a = Ae(o, t.schemaMap), p = t.schemaMap[a];
2382
- if (!p)
2383
- throw new Error(`Field schema for "${o}" not found in schema map`);
2384
- yield {
2385
- handlerType: Gn(p),
2386
- fieldKey: o,
2387
- fieldSchema: p,
2388
- value: l
2389
- };
2390
- }
2391
- }
2392
- function rs(n, e, t) {
2393
- const s = z(n, String(e)), r = Ae(s, t.schemaMap), i = t.schemaMap[r];
2394
- if (!i)
2395
- throw new Error(`Item schema for "${s}" not found in schema map`);
2396
- return { itemKey: s, itemSchema: i };
2397
- }
2398
- function is(n, e, t) {
2399
- const s = z(n, e), r = Ae(s, t.schemaMap), i = t.schemaMap[r];
2400
- if (!i)
2401
- throw new Error(`Map entry schema for "${s}" not found in schema map`);
2402
- return { entryKey: s, entrySchema: i };
2403
- }
2404
- function os(n) {
2405
- return n.type === "record" && Array.isArray(n.fields);
2406
- }
2407
- function ls(n) {
2408
- return {
2409
- schemaMap: Yn(n)
2410
- };
2411
- }
2412
- export {
2413
- rs as a,
2414
- os as b,
2415
- ls as c,
2416
- is as d,
2417
- Gn as g,
2418
- ns as i,
2419
- ts as s,
2420
- ss as w
2421
- };