@jojovms/scripto 0.0.5 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/scripto.js DELETED
@@ -1,2973 +0,0 @@
1
- var Jn = Object.defineProperty;
2
- var bn = (l) => {
3
- throw TypeError(l);
4
- };
5
- var er = (l, e, t) => e in l ? Jn(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t;
6
- var N = (l, e, t) => er(l, typeof e != "symbol" ? e + "" : e, t), tr = (l, e, t) => e.has(l) || bn("Cannot " + t);
7
- var xn = (l, e, t) => e.has(l) ? bn("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(l) : e.set(l, t);
8
- var Dt = (l, e, t) => (tr(l, e, "access private method"), t);
9
- import me, { useRef as nr, useState as ye, useEffect as Ye } from "react";
10
- var nn = { exports: {} }, lt = {};
11
- /**
12
- * @license React
13
- * react-jsx-runtime.production.min.js
14
- *
15
- * Copyright (c) Facebook, Inc. and its affiliates.
16
- *
17
- * This source code is licensed under the MIT license found in the
18
- * LICENSE file in the root directory of this source tree.
19
- */
20
- var Tn;
21
- function rr() {
22
- if (Tn) return lt;
23
- Tn = 1;
24
- var l = me, e = Symbol.for("react.element"), t = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, o = l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, a = { key: !0, ref: !0, __self: !0, __source: !0 };
25
- function r(u, c, x) {
26
- var h, g = {}, m = null, y = null;
27
- x !== void 0 && (m = "" + x), c.key !== void 0 && (m = "" + c.key), c.ref !== void 0 && (y = c.ref);
28
- for (h in c) n.call(c, h) && !a.hasOwnProperty(h) && (g[h] = c[h]);
29
- if (u && u.defaultProps) for (h in c = u.defaultProps, c) g[h] === void 0 && (g[h] = c[h]);
30
- return { $$typeof: e, type: u, key: m, ref: y, props: g, _owner: o.current };
31
- }
32
- return lt.Fragment = t, lt.jsx = r, lt.jsxs = r, lt;
33
- }
34
- var ct = {};
35
- /**
36
- * @license React
37
- * react-jsx-runtime.development.js
38
- *
39
- * Copyright (c) Facebook, Inc. and its affiliates.
40
- *
41
- * This source code is licensed under the MIT license found in the
42
- * LICENSE file in the root directory of this source tree.
43
- */
44
- var wn;
45
- function ir() {
46
- return wn || (wn = 1, process.env.NODE_ENV !== "production" && function() {
47
- var l = me, e = Symbol.for("react.element"), t = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), o = Symbol.for("react.strict_mode"), a = Symbol.for("react.profiler"), r = Symbol.for("react.provider"), u = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), x = Symbol.for("react.suspense"), h = Symbol.for("react.suspense_list"), g = Symbol.for("react.memo"), m = Symbol.for("react.lazy"), y = Symbol.for("react.offscreen"), A = Symbol.iterator, T = "@@iterator";
48
- function D(s) {
49
- if (s === null || typeof s != "object")
50
- return null;
51
- var p = A && s[A] || s[T];
52
- return typeof p == "function" ? p : null;
53
- }
54
- var j = l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
55
- function $(s) {
56
- {
57
- for (var p = arguments.length, k = new Array(p > 1 ? p - 1 : 0), w = 1; w < p; w++)
58
- k[w - 1] = arguments[w];
59
- K("error", s, k);
60
- }
61
- }
62
- function K(s, p, k) {
63
- {
64
- var w = j.ReactDebugCurrentFrame, S = w.getStackAddendum();
65
- S !== "" && (p += "%s", k = k.concat([S]));
66
- var L = k.map(function(R) {
67
- return String(R);
68
- });
69
- L.unshift("Warning: " + p), Function.prototype.apply.call(console[s], console, L);
70
- }
71
- }
72
- var B = !1, ie = !1, qe = !1, Wt = !1, Ht = !1, Tt;
73
- Tt = Symbol.for("react.module.reference");
74
- function Gt(s) {
75
- return !!(typeof s == "string" || typeof s == "function" || s === n || s === a || Ht || s === o || s === x || s === h || Wt || s === y || B || ie || qe || typeof s == "object" && s !== null && (s.$$typeof === m || s.$$typeof === g || s.$$typeof === r || s.$$typeof === u || s.$$typeof === c || // This needs to include all possible module reference object
76
- // types supported by any Flight configuration anywhere since
77
- // we don't know which Flight build this will end up being used
78
- // with.
79
- s.$$typeof === Tt || s.getModuleId !== void 0));
80
- }
81
- function H(s, p, k) {
82
- var w = s.displayName;
83
- if (w)
84
- return w;
85
- var S = p.displayName || p.name || "";
86
- return S !== "" ? k + "(" + S + ")" : k;
87
- }
88
- function je(s) {
89
- return s.displayName || "Context";
90
- }
91
- function ee(s) {
92
- if (s == null)
93
- return null;
94
- if (typeof s.tag == "number" && $("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof s == "function")
95
- return s.displayName || s.name || null;
96
- if (typeof s == "string")
97
- return s;
98
- switch (s) {
99
- case n:
100
- return "Fragment";
101
- case t:
102
- return "Portal";
103
- case a:
104
- return "Profiler";
105
- case o:
106
- return "StrictMode";
107
- case x:
108
- return "Suspense";
109
- case h:
110
- return "SuspenseList";
111
- }
112
- if (typeof s == "object")
113
- switch (s.$$typeof) {
114
- case u:
115
- var p = s;
116
- return je(p) + ".Consumer";
117
- case r:
118
- var k = s;
119
- return je(k._context) + ".Provider";
120
- case c:
121
- return H(s, s.render, "ForwardRef");
122
- case g:
123
- var w = s.displayName || null;
124
- return w !== null ? w : ee(s.type) || "Memo";
125
- case m: {
126
- var S = s, L = S._payload, R = S._init;
127
- try {
128
- return ee(R(L));
129
- } catch {
130
- return null;
131
- }
132
- }
133
- }
134
- return null;
135
- }
136
- var oe = Object.assign, Le = 0, wt, _t, Ve, yt, Ze, F, Xe;
137
- function W() {
138
- }
139
- W.__reactDisabledLog = !0;
140
- function Et() {
141
- {
142
- if (Le === 0) {
143
- wt = console.log, _t = console.info, Ve = console.warn, yt = console.error, Ze = console.group, F = console.groupCollapsed, Xe = console.groupEnd;
144
- var s = {
145
- configurable: !0,
146
- enumerable: !0,
147
- value: W,
148
- writable: !0
149
- };
150
- Object.defineProperties(console, {
151
- info: s,
152
- log: s,
153
- warn: s,
154
- error: s,
155
- group: s,
156
- groupCollapsed: s,
157
- groupEnd: s
158
- });
159
- }
160
- Le++;
161
- }
162
- }
163
- function z() {
164
- {
165
- if (Le--, Le === 0) {
166
- var s = {
167
- configurable: !0,
168
- enumerable: !0,
169
- writable: !0
170
- };
171
- Object.defineProperties(console, {
172
- log: oe({}, s, {
173
- value: wt
174
- }),
175
- info: oe({}, s, {
176
- value: _t
177
- }),
178
- warn: oe({}, s, {
179
- value: Ve
180
- }),
181
- error: oe({}, s, {
182
- value: yt
183
- }),
184
- group: oe({}, s, {
185
- value: Ze
186
- }),
187
- groupCollapsed: oe({}, s, {
188
- value: F
189
- }),
190
- groupEnd: oe({}, s, {
191
- value: Xe
192
- })
193
- });
194
- }
195
- Le < 0 && $("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
196
- }
197
- }
198
- var ge = j.ReactCurrentDispatcher, Ie;
199
- function se(s, p, k) {
200
- {
201
- if (Ie === void 0)
202
- try {
203
- throw Error();
204
- } catch (S) {
205
- var w = S.stack.trim().match(/\n( *(at )?)/);
206
- Ie = w && w[1] || "";
207
- }
208
- return `
209
- ` + Ie + s;
210
- }
211
- }
212
- var ze = !1, Ee;
213
- {
214
- var vt = typeof WeakMap == "function" ? WeakMap : Map;
215
- Ee = new vt();
216
- }
217
- function Ke(s, p) {
218
- if (!s || ze)
219
- return "";
220
- {
221
- var k = Ee.get(s);
222
- if (k !== void 0)
223
- return k;
224
- }
225
- var w;
226
- ze = !0;
227
- var S = Error.prepareStackTrace;
228
- Error.prepareStackTrace = void 0;
229
- var L;
230
- L = ge.current, ge.current = null, Et();
231
- try {
232
- if (p) {
233
- var R = function() {
234
- throw Error();
235
- };
236
- if (Object.defineProperty(R.prototype, "props", {
237
- set: function() {
238
- throw Error();
239
- }
240
- }), typeof Reflect == "object" && Reflect.construct) {
241
- try {
242
- Reflect.construct(R, []);
243
- } catch (C) {
244
- w = C;
245
- }
246
- Reflect.construct(s, [], R);
247
- } else {
248
- try {
249
- R.call();
250
- } catch (C) {
251
- w = C;
252
- }
253
- s.call(R.prototype);
254
- }
255
- } else {
256
- try {
257
- throw Error();
258
- } catch (C) {
259
- w = C;
260
- }
261
- s();
262
- }
263
- } catch (C) {
264
- if (C && w && typeof C.stack == "string") {
265
- for (var E = C.stack.split(`
266
- `), G = w.stack.split(`
267
- `), d = E.length - 1, i = G.length - 1; d >= 1 && i >= 0 && E[d] !== G[i]; )
268
- i--;
269
- for (; d >= 1 && i >= 0; d--, i--)
270
- if (E[d] !== G[i]) {
271
- if (d !== 1 || i !== 1)
272
- do
273
- if (d--, i--, i < 0 || E[d] !== G[i]) {
274
- var f = `
275
- ` + E[d].replace(" at new ", " at ");
276
- return s.displayName && f.includes("<anonymous>") && (f = f.replace("<anonymous>", s.displayName)), typeof s == "function" && Ee.set(s, f), f;
277
- }
278
- while (d >= 1 && i >= 0);
279
- break;
280
- }
281
- }
282
- } finally {
283
- ze = !1, ge.current = L, z(), Error.prepareStackTrace = S;
284
- }
285
- var b = s ? s.displayName || s.name : "", O = b ? se(b) : "";
286
- return typeof s == "function" && Ee.set(s, O), O;
287
- }
288
- function ve(s, p, k) {
289
- return Ke(s, !1);
290
- }
291
- function $e(s) {
292
- var p = s.prototype;
293
- return !!(p && p.isReactComponent);
294
- }
295
- function te(s, p, k) {
296
- if (s == null)
297
- return "";
298
- if (typeof s == "function")
299
- return Ke(s, $e(s));
300
- if (typeof s == "string")
301
- return se(s);
302
- switch (s) {
303
- case x:
304
- return se("Suspense");
305
- case h:
306
- return se("SuspenseList");
307
- }
308
- if (typeof s == "object")
309
- switch (s.$$typeof) {
310
- case c:
311
- return ve(s.render);
312
- case g:
313
- return te(s.type, p, k);
314
- case m: {
315
- var w = s, S = w._payload, L = w._init;
316
- try {
317
- return te(L(S), p, k);
318
- } catch {
319
- }
320
- }
321
- }
322
- return "";
323
- }
324
- var ke = Object.prototype.hasOwnProperty, Fe = {}, be = j.ReactDebugCurrentFrame;
325
- function xe(s) {
326
- if (s) {
327
- var p = s._owner, k = te(s.type, s._source, p ? p.type : null);
328
- be.setExtraStackFrame(k);
329
- } else
330
- be.setExtraStackFrame(null);
331
- }
332
- function Ue(s, p, k, w, S) {
333
- {
334
- var L = Function.call.bind(ke);
335
- for (var R in s)
336
- if (L(s, R)) {
337
- var E = void 0;
338
- try {
339
- if (typeof s[R] != "function") {
340
- var G = Error((w || "React class") + ": " + k + " type `" + R + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof s[R] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
341
- throw G.name = "Invariant Violation", G;
342
- }
343
- E = s[R](p, R, w, k, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
344
- } catch (d) {
345
- E = d;
346
- }
347
- E && !(E instanceof Error) && (xe(S), $("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", w || "React class", k, R, typeof E), xe(null)), E instanceof Error && !(E.message in Fe) && (Fe[E.message] = !0, xe(S), $("Failed %s type: %s", k, E.message), xe(null));
348
- }
349
- }
350
- }
351
- var Rt = Array.isArray;
352
- function Be(s) {
353
- return Rt(s);
354
- }
355
- function Yt(s) {
356
- {
357
- var p = typeof Symbol == "function" && Symbol.toStringTag, k = p && s[Symbol.toStringTag] || s.constructor.name || "Object";
358
- return k;
359
- }
360
- }
361
- function Qe(s) {
362
- try {
363
- return Re(s), !1;
364
- } catch {
365
- return !0;
366
- }
367
- }
368
- function Re(s) {
369
- return "" + s;
370
- }
371
- function Te(s) {
372
- if (Qe(s))
373
- return $("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Yt(s)), Re(s);
374
- }
375
- var Q = j.ReactCurrentOwner, Je = {
376
- key: !0,
377
- ref: !0,
378
- __self: !0,
379
- __source: !0
380
- }, et, tt;
381
- function nt(s) {
382
- if (ke.call(s, "ref")) {
383
- var p = Object.getOwnPropertyDescriptor(s, "ref").get;
384
- if (p && p.isReactWarning)
385
- return !1;
386
- }
387
- return s.ref !== void 0;
388
- }
389
- function At(s) {
390
- if (ke.call(s, "key")) {
391
- var p = Object.getOwnPropertyDescriptor(s, "key").get;
392
- if (p && p.isReactWarning)
393
- return !1;
394
- }
395
- return s.key !== void 0;
396
- }
397
- function We(s, p) {
398
- typeof s.ref == "string" && Q.current;
399
- }
400
- function He(s, p) {
401
- {
402
- var k = function() {
403
- et || (et = !0, $("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", p));
404
- };
405
- k.isReactWarning = !0, Object.defineProperty(s, "key", {
406
- get: k,
407
- configurable: !0
408
- });
409
- }
410
- }
411
- function ae(s, p) {
412
- {
413
- var k = function() {
414
- tt || (tt = !0, $("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", p));
415
- };
416
- k.isReactWarning = !0, Object.defineProperty(s, "ref", {
417
- get: k,
418
- configurable: !0
419
- });
420
- }
421
- }
422
- var Ae = function(s, p, k, w, S, L, R) {
423
- var E = {
424
- // This tag allows us to uniquely identify this as a React Element
425
- $$typeof: e,
426
- // Built-in properties that belong on the element
427
- type: s,
428
- key: p,
429
- ref: k,
430
- props: R,
431
- // Record the component responsible for creating this element.
432
- _owner: L
433
- };
434
- return E._store = {}, Object.defineProperty(E._store, "validated", {
435
- configurable: !1,
436
- enumerable: !1,
437
- writable: !0,
438
- value: !1
439
- }), Object.defineProperty(E, "_self", {
440
- configurable: !1,
441
- enumerable: !1,
442
- writable: !1,
443
- value: w
444
- }), Object.defineProperty(E, "_source", {
445
- configurable: !1,
446
- enumerable: !1,
447
- writable: !1,
448
- value: S
449
- }), Object.freeze && (Object.freeze(E.props), Object.freeze(E)), E;
450
- };
451
- function rt(s, p, k, w, S) {
452
- {
453
- var L, R = {}, E = null, G = null;
454
- k !== void 0 && (Te(k), E = "" + k), At(p) && (Te(p.key), E = "" + p.key), nt(p) && (G = p.ref, We(p, S));
455
- for (L in p)
456
- ke.call(p, L) && !Je.hasOwnProperty(L) && (R[L] = p[L]);
457
- if (s && s.defaultProps) {
458
- var d = s.defaultProps;
459
- for (L in d)
460
- R[L] === void 0 && (R[L] = d[L]);
461
- }
462
- if (E || G) {
463
- var i = typeof s == "function" ? s.displayName || s.name || "Unknown" : s;
464
- E && He(R, i), G && ae(R, i);
465
- }
466
- return Ae(s, E, G, S, w, Q.current, R);
467
- }
468
- }
469
- var De = j.ReactCurrentOwner, St = j.ReactDebugCurrentFrame;
470
- function le(s) {
471
- if (s) {
472
- var p = s._owner, k = te(s.type, s._source, p ? p.type : null);
473
- St.setExtraStackFrame(k);
474
- } else
475
- St.setExtraStackFrame(null);
476
- }
477
- var Se;
478
- Se = !1;
479
- function it(s) {
480
- return typeof s == "object" && s !== null && s.$$typeof === e;
481
- }
482
- function Oe() {
483
- {
484
- if (De.current) {
485
- var s = ee(De.current.type);
486
- if (s)
487
- return `
488
-
489
- Check the render method of \`` + s + "`.";
490
- }
491
- return "";
492
- }
493
- }
494
- function qt(s) {
495
- return "";
496
- }
497
- var Ot = {};
498
- function U(s) {
499
- {
500
- var p = Oe();
501
- if (!p) {
502
- var k = typeof s == "string" ? s : s.displayName || s.name;
503
- k && (p = `
504
-
505
- Check the top-level render call using <` + k + ">.");
506
- }
507
- return p;
508
- }
509
- }
510
- function we(s, p) {
511
- {
512
- if (!s._store || s._store.validated || s.key != null)
513
- return;
514
- s._store.validated = !0;
515
- var k = U(p);
516
- if (Ot[k])
517
- return;
518
- Ot[k] = !0;
519
- var w = "";
520
- s && s._owner && s._owner !== De.current && (w = " It was passed a child from " + ee(s._owner.type) + "."), le(s), $('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', k, w), le(null);
521
- }
522
- }
523
- function Ct(s, p) {
524
- {
525
- if (typeof s != "object")
526
- return;
527
- if (Be(s))
528
- for (var k = 0; k < s.length; k++) {
529
- var w = s[k];
530
- it(w) && we(w, p);
531
- }
532
- else if (it(s))
533
- s._store && (s._store.validated = !0);
534
- else if (s) {
535
- var S = D(s);
536
- if (typeof S == "function" && S !== s.entries)
537
- for (var L = S.call(s), R; !(R = L.next()).done; )
538
- it(R.value) && we(R.value, p);
539
- }
540
- }
541
- }
542
- function Lt(s) {
543
- {
544
- var p = s.type;
545
- if (p == null || typeof p == "string")
546
- return;
547
- var k;
548
- if (typeof p == "function")
549
- k = p.propTypes;
550
- else if (typeof p == "object" && (p.$$typeof === c || // Note: Memo only checks outer props here.
551
- // Inner props are checked in the reconciler.
552
- p.$$typeof === g))
553
- k = p.propTypes;
554
- else
555
- return;
556
- if (k) {
557
- var w = ee(p);
558
- Ue(k, s.props, "prop", w, s);
559
- } else if (p.PropTypes !== void 0 && !Se) {
560
- Se = !0;
561
- var S = ee(p);
562
- $("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", S || "Unknown");
563
- }
564
- typeof p.getDefaultProps == "function" && !p.getDefaultProps.isReactClassApproved && $("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
565
- }
566
- }
567
- function ot(s) {
568
- {
569
- for (var p = Object.keys(s.props), k = 0; k < p.length; k++) {
570
- var w = p[k];
571
- if (w !== "children" && w !== "key") {
572
- le(s), $("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", w), le(null);
573
- break;
574
- }
575
- }
576
- s.ref !== null && (le(s), $("Invalid attribute `ref` supplied to `React.Fragment`."), le(null));
577
- }
578
- }
579
- var st = {};
580
- function at(s, p, k, w, S, L) {
581
- {
582
- var R = Gt(s);
583
- if (!R) {
584
- var E = "";
585
- (s === void 0 || typeof s == "object" && s !== null && Object.keys(s).length === 0) && (E += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
586
- var G = qt();
587
- G ? E += G : E += Oe();
588
- var d;
589
- s === null ? d = "null" : Be(s) ? d = "array" : s !== void 0 && s.$$typeof === e ? (d = "<" + (ee(s.type) || "Unknown") + " />", E = " Did you accidentally export a JSX literal instead of a component?") : d = typeof s, $("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", d, E);
590
- }
591
- var i = rt(s, p, k, S, L);
592
- if (i == null)
593
- return i;
594
- if (R) {
595
- var f = p.children;
596
- if (f !== void 0)
597
- if (w)
598
- if (Be(f)) {
599
- for (var b = 0; b < f.length; b++)
600
- Ct(f[b], s);
601
- Object.freeze && Object.freeze(f);
602
- } else
603
- $("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
604
- else
605
- Ct(f, s);
606
- }
607
- if (ke.call(p, "key")) {
608
- var O = ee(s), C = Object.keys(p).filter(function(ce) {
609
- return ce !== "key";
610
- }), M = C.length > 0 ? "{key: someKey, " + C.join(": ..., ") + ": ...}" : "{key: someKey}";
611
- if (!st[O + M]) {
612
- var q = C.length > 0 ? "{" + C.join(": ..., ") + ": ...}" : "{}";
613
- $(`A props object containing a "key" prop is being spread into JSX:
614
- let props = %s;
615
- <%s {...props} />
616
- React keys must be passed directly to JSX without using spread:
617
- let props = %s;
618
- <%s key={someKey} {...props} />`, M, O, q, O), st[O + M] = !0;
619
- }
620
- }
621
- return s === n ? ot(i) : Lt(i), i;
622
- }
623
- }
624
- function Vt(s, p, k) {
625
- return at(s, p, k, !0);
626
- }
627
- function ne(s, p, k) {
628
- return at(s, p, k, !1);
629
- }
630
- var _e = ne, It = Vt;
631
- ct.Fragment = n, ct.jsx = _e, ct.jsxs = It;
632
- }()), ct;
633
- }
634
- process.env.NODE_ENV === "production" ? nn.exports = rr() : nn.exports = ir();
635
- var _ = nn.exports, Mn = {
636
- color: void 0,
637
- size: void 0,
638
- className: void 0,
639
- style: void 0,
640
- attr: void 0
641
- }, _n = me.createContext && me.createContext(Mn), Ce = function() {
642
- return Ce = Object.assign || function(l) {
643
- for (var e, t = 1, n = arguments.length; t < n; t++) {
644
- e = arguments[t];
645
- for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (l[o] = e[o]);
646
- }
647
- return l;
648
- }, Ce.apply(this, arguments);
649
- }, or = function(l, e) {
650
- var t = {};
651
- for (var n in l) Object.prototype.hasOwnProperty.call(l, n) && e.indexOf(n) < 0 && (t[n] = l[n]);
652
- if (l != null && typeof Object.getOwnPropertySymbols == "function") for (var o = 0, n = Object.getOwnPropertySymbols(l); o < n.length; o++)
653
- e.indexOf(n[o]) < 0 && Object.prototype.propertyIsEnumerable.call(l, n[o]) && (t[n[o]] = l[n[o]]);
654
- return t;
655
- };
656
- function jn(l) {
657
- return l && l.map(function(e, t) {
658
- return me.createElement(e.tag, Ce({
659
- key: t
660
- }, e.attr), jn(e.child));
661
- });
662
- }
663
- function fe(l) {
664
- return function(e) {
665
- return me.createElement(sr, Ce({
666
- attr: Ce({}, l.attr)
667
- }, e), jn(l.child));
668
- };
669
- }
670
- function sr(l) {
671
- var e = function(t) {
672
- var n = l.attr, o = l.size, a = l.title, r = or(l, ["attr", "size", "title"]), u = o || t.size || "1em", c;
673
- return t.className && (c = t.className), l.className && (c = (c ? c + " " : "") + l.className), me.createElement("svg", Ce({
674
- stroke: "currentColor",
675
- fill: "currentColor",
676
- strokeWidth: "0"
677
- }, t.attr, n, r, {
678
- className: c,
679
- style: Ce(Ce({
680
- color: l.color || t.color
681
- }, t.style), l.style),
682
- height: u,
683
- width: u,
684
- xmlns: "http://www.w3.org/2000/svg"
685
- }), a && me.createElement("title", null, a), l.children);
686
- };
687
- return _n !== void 0 ? me.createElement(_n.Consumer, null, function(t) {
688
- return e(t);
689
- }) : e(Mn);
690
- }
691
- function ar(l) {
692
- return fe({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { fill: "none", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "48", d: "M112 244l144-144 144 144M256 120v292" } }] })(l);
693
- }
694
- function lr(l) {
695
- return fe({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { fill: "none", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "32", d: "M416 128L192 384l-96-96" } }] })(l);
696
- }
697
- function cr(l) {
698
- return fe({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { fill: "none", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "32", d: "M368 368L144 144m224 0L144 368" } }] })(l);
699
- }
700
- function ur(l) {
701
- return fe({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { fill: "none", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "32", d: "M320 367.79h76c55 0 100-29.21 100-83.6s-53-81.47-96-83.6c-8.89-85.06-71-136.8-144-136.8-69 0-113.44 45.79-128 91.2-60 5.7-112 43.88-112 106.4s54 106.4 120 106.4h56" } }, { tag: "path", attr: { fill: "none", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "32", d: "M320 255.79l-64-64-64 64m64 192.42V207.79" } }] })(l);
702
- }
703
- function fr(l) {
704
- return fe({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "rect", attr: { width: "336", height: "336", x: "128", y: "128", fill: "none", strokeLinejoin: "round", strokeWidth: "32", rx: "57", ry: "57" } }, { tag: "path", attr: { fill: "none", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "32", d: "M383.5 128l.5-24a56.16 56.16 0 00-56-56H112a64.19 64.19 0 00-64 64v216a56.16 56.16 0 0056 56h24" } }] })(l);
705
- }
706
- function pr(l) {
707
- return fe({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { fill: "none", strokeLinejoin: "round", strokeWidth: "32", d: "M416 221.25V416a48 48 0 01-48 48H144a48 48 0 01-48-48V96a48 48 0 0148-48h98.75a32 32 0 0122.62 9.37l141.26 141.26a32 32 0 019.37 22.62z" } }, { tag: "path", attr: { fill: "none", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "32", d: "M256 56v120a32 32 0 0032 32h120m-232 80h160m-160 80h160" } }] })(l);
708
- }
709
- function hr(l) {
710
- return fe({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { fill: "none", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "32", d: "M336 176h40a40 40 0 0140 40v208a40 40 0 01-40 40H136a40 40 0 01-40-40V216a40 40 0 0140-40h40" } }, { tag: "path", attr: { fill: "none", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "32", d: "M176 272l80 80 80-80M256 48v288" } }] })(l);
711
- }
712
- function dr(l) {
713
- return fe({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { fill: "none", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "32", d: "M160 136c0-30.62 4.51-61.61 16-88C99.57 81.27 48 159.32 48 248c0 119.29 96.71 216 216 216 88.68 0 166.73-51.57 200-128-26.39 11.49-57.38 16-88 16-119.29 0-216-96.71-216-216z" } }] })(l);
714
- }
715
- function mr(l) {
716
- return fe({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { fill: "none", strokeMiterlimit: "10", strokeWidth: "32", d: "M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192 192-86 192-192z" } }, { tag: "path", attr: { d: "M310.4 336H201.6a25.62 25.62 0 01-25.6-25.6V201.6a25.62 25.62 0 0125.6-25.6h108.8a25.62 25.62 0 0125.6 25.6v108.8a25.62 25.62 0 01-25.6 25.6z" } }] })(l);
717
- }
718
- function gr(l) {
719
- return fe({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { fill: "none", strokeLinecap: "round", strokeMiterlimit: "10", strokeWidth: "32", d: "M256 48v48m0 320v48m147.08-355.08l-33.94 33.94M142.86 369.14l-33.94 33.94M464 256h-48m-320 0H48m355.08 147.08l-33.94-33.94M142.86 142.86l-33.94-33.94" } }, { tag: "circle", attr: { cx: "256", cy: "256", r: "80", fill: "none", strokeLinecap: "round", strokeMiterlimit: "10", strokeWidth: "32" } }] })(l);
720
- }
721
- function kr(l) {
722
- return fe({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { fill: "none", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "32", d: "M126 192H56a8 8 0 00-8 8v112a8 8 0 008 8h69.65a15.93 15.93 0 0110.14 3.54l91.47 74.89A8 8 0 00240 392V120a8 8 0 00-12.74-6.43l-91.47 74.89A15 15 0 01126 192zm194 128c9.74-19.38 16-40.84 16-64 0-23.48-6-44.42-16-64m48 176c19.48-33.92 32-64.06 32-112s-12-77.74-32-112m48 272c30-46 48-91.43 48-160s-18-113-48-160" } }] })(l);
723
- }
724
- const br = ({ onFileLoaded: l }) => {
725
- const e = nr(null), [t, n] = ye(!1), [o, a] = ye(""), [r, u] = ye(!1), c = (T) => {
726
- if (T.length > 0) {
727
- const D = T[0];
728
- x(D) ? h(D) : alert("Please upload a valid Markdown (.md) file.");
729
- }
730
- }, x = (T) => T.name.endsWith(".md") || T.name.endsWith(".markdown") || T.type === "text/markdown", h = (T) => {
731
- const D = new FileReader();
732
- D.onload = (j) => {
733
- l({ name: T.name, content: j.target.result });
734
- }, D.readAsText(T);
735
- }, g = (T) => {
736
- T.preventDefault(), T.stopPropagation(), T.type === "dragenter" || T.type === "dragover" ? n(!0) : (T.type === "dragleave" || T.type === "drop") && n(!1);
737
- }, m = (T) => {
738
- T.preventDefault(), T.stopPropagation(), n(!1), T.dataTransfer.files && T.dataTransfer.files[0] && c(T.dataTransfer.files);
739
- }, y = async () => {
740
- const T = o.trim();
741
- if (T) {
742
- u(!0);
743
- try {
744
- const D = A(T), j = await fetch(D);
745
- if (!j.ok)
746
- throw new Error(`HTTP error! status: ${j.status}`);
747
- const $ = await j.text();
748
- let K = T.substring(T.lastIndexOf("/") + 1) || "remote-file.md";
749
- K.includes("?") && (K = K.split("?")[0]), l({ name: K, content: $ });
750
- } catch (D) {
751
- console.error("Fetch error:", D), alert(`Failed to load Markdown from URL.
752
-
753
- Note: This might be due to CORS restrictions. Try a raw GitHub URL.`);
754
- } finally {
755
- u(!1);
756
- }
757
- }
758
- }, A = (T) => {
759
- try {
760
- if (new URL(T).hostname === "github.com" && T.includes("/blob/"))
761
- return T.replace("github.com", "raw.githubusercontent.com").replace("/blob/", "/");
762
- } catch {
763
- }
764
- return T;
765
- };
766
- return /* @__PURE__ */ _.jsxs(
767
- "section",
768
- {
769
- className: `upload-zone ${t ? "drag-active" : ""}`,
770
- onClick: () => e.current.click(),
771
- onDragEnter: g,
772
- onDragLeave: g,
773
- onDragOver: g,
774
- onDrop: m,
775
- id: "upload-area",
776
- children: [
777
- /* @__PURE__ */ _.jsx(
778
- "input",
779
- {
780
- type: "file",
781
- ref: e,
782
- accept: ".md,.markdown",
783
- hidden: !0,
784
- onChange: (T) => c(T.target.files)
785
- }
786
- ),
787
- /* @__PURE__ */ _.jsxs("div", { className: "upload-content", children: [
788
- /* @__PURE__ */ _.jsx("div", { className: "icon-wrapper", children: /* @__PURE__ */ _.jsx(ur, {}) }),
789
- /* @__PURE__ */ _.jsx("h2", { children: "Drop your Markdown file here" }),
790
- /* @__PURE__ */ _.jsxs("p", { children: [
791
- "or ",
792
- /* @__PURE__ */ _.jsx("span", { className: "browse-btn", children: "browse files" })
793
- ] }),
794
- /* @__PURE__ */ _.jsx("div", { className: "divider", children: /* @__PURE__ */ _.jsx("span", { children: "OR" }) }),
795
- /* @__PURE__ */ _.jsxs("div", { className: "url-input-container", onClick: (T) => T.stopPropagation(), children: [
796
- /* @__PURE__ */ _.jsx(
797
- "input",
798
- {
799
- type: "url",
800
- id: "url-input",
801
- placeholder: "Paste a raw Markdown URL...",
802
- spellCheck: "false",
803
- value: o,
804
- onChange: (T) => a(T.target.value),
805
- onKeyDown: (T) => T.key === "Enter" && y()
806
- }
807
- ),
808
- /* @__PURE__ */ _.jsx("button", { id: "url-btn", onClick: y, disabled: r, children: r ? "..." : "Go" })
809
- ] }),
810
- /* @__PURE__ */ _.jsxs("p", { className: "sub-text", children: [
811
- "Supports ",
812
- /* @__PURE__ */ _.jsx("span", { style: { color: "aqua" }, children: ".md" }),
813
- " and ",
814
- /* @__PURE__ */ _.jsx("span", { style: { color: "aqua" }, children: ".markdown" })
815
- ] })
816
- ] })
817
- ]
818
- }
819
- );
820
- };
821
- function cn() {
822
- return {
823
- async: !1,
824
- breaks: !1,
825
- extensions: null,
826
- gfm: !0,
827
- hooks: null,
828
- pedantic: !1,
829
- renderer: null,
830
- silent: !1,
831
- tokenizer: null,
832
- walkTokens: null
833
- };
834
- }
835
- let Me = cn();
836
- function zn(l) {
837
- Me = l;
838
- }
839
- const $n = /[&<>"']/, xr = new RegExp($n.source, "g"), Fn = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, Tr = new RegExp(Fn.source, "g"), wr = {
840
- "&": "&amp;",
841
- "<": "&lt;",
842
- ">": "&gt;",
843
- '"': "&quot;",
844
- "'": "&#39;"
845
- }, yn = (l) => wr[l];
846
- function J(l, e) {
847
- if (e) {
848
- if ($n.test(l))
849
- return l.replace(xr, yn);
850
- } else if (Fn.test(l))
851
- return l.replace(Tr, yn);
852
- return l;
853
- }
854
- const _r = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
855
- function yr(l) {
856
- return l.replace(_r, (e, t) => (t = t.toLowerCase(), t === "colon" ? ":" : t.charAt(0) === "#" ? t.charAt(1) === "x" ? String.fromCharCode(parseInt(t.substring(2), 16)) : String.fromCharCode(+t.substring(1)) : ""));
857
- }
858
- const Er = /(^|[^\[])\^/g;
859
- function P(l, e) {
860
- let t = typeof l == "string" ? l : l.source;
861
- e = e || "";
862
- const n = {
863
- replace: (o, a) => {
864
- let r = typeof a == "string" ? a : a.source;
865
- return r = r.replace(Er, "$1"), t = t.replace(o, r), n;
866
- },
867
- getRegex: () => new RegExp(t, e)
868
- };
869
- return n;
870
- }
871
- function En(l) {
872
- try {
873
- l = encodeURI(l).replace(/%25/g, "%");
874
- } catch {
875
- return null;
876
- }
877
- return l;
878
- }
879
- const gt = { exec: () => null };
880
- function vn(l, e) {
881
- const t = l.replace(/\|/g, (a, r, u) => {
882
- let c = !1, x = r;
883
- for (; --x >= 0 && u[x] === "\\"; )
884
- c = !c;
885
- return c ? "|" : " |";
886
- }), n = t.split(/ \|/);
887
- let o = 0;
888
- if (n[0].trim() || n.shift(), n.length > 0 && !n[n.length - 1].trim() && n.pop(), e)
889
- if (n.length > e)
890
- n.splice(e);
891
- else
892
- for (; n.length < e; )
893
- n.push("");
894
- for (; o < n.length; o++)
895
- n[o] = n[o].trim().replace(/\\\|/g, "|");
896
- return n;
897
- }
898
- function Pt(l, e, t) {
899
- const n = l.length;
900
- if (n === 0)
901
- return "";
902
- let o = 0;
903
- for (; o < n && l.charAt(n - o - 1) === e; )
904
- o++;
905
- return l.slice(0, n - o);
906
- }
907
- function vr(l, e) {
908
- if (l.indexOf(e[1]) === -1)
909
- return -1;
910
- let t = 0;
911
- for (let n = 0; n < l.length; n++)
912
- if (l[n] === "\\")
913
- n++;
914
- else if (l[n] === e[0])
915
- t++;
916
- else if (l[n] === e[1] && (t--, t < 0))
917
- return n;
918
- return -1;
919
- }
920
- function Rn(l, e, t, n) {
921
- const o = e.href, a = e.title ? J(e.title) : null, r = l[1].replace(/\\([\[\]])/g, "$1");
922
- if (l[0].charAt(0) !== "!") {
923
- n.state.inLink = !0;
924
- const u = {
925
- type: "link",
926
- raw: t,
927
- href: o,
928
- title: a,
929
- text: r,
930
- tokens: n.inlineTokens(r)
931
- };
932
- return n.state.inLink = !1, u;
933
- }
934
- return {
935
- type: "image",
936
- raw: t,
937
- href: o,
938
- title: a,
939
- text: J(r)
940
- };
941
- }
942
- function Rr(l, e) {
943
- const t = l.match(/^(\s+)(?:```)/);
944
- if (t === null)
945
- return e;
946
- const n = t[1];
947
- return e.split(`
948
- `).map((o) => {
949
- const a = o.match(/^\s+/);
950
- if (a === null)
951
- return o;
952
- const [r] = a;
953
- return r.length >= n.length ? o.slice(n.length) : o;
954
- }).join(`
955
- `);
956
- }
957
- class $t {
958
- // set by the lexer
959
- constructor(e) {
960
- N(this, "options");
961
- N(this, "rules");
962
- // set by the lexer
963
- N(this, "lexer");
964
- this.options = e || Me;
965
- }
966
- space(e) {
967
- const t = this.rules.block.newline.exec(e);
968
- if (t && t[0].length > 0)
969
- return {
970
- type: "space",
971
- raw: t[0]
972
- };
973
- }
974
- code(e) {
975
- const t = this.rules.block.code.exec(e);
976
- if (t) {
977
- const n = t[0].replace(/^ {1,4}/gm, "");
978
- return {
979
- type: "code",
980
- raw: t[0],
981
- codeBlockStyle: "indented",
982
- text: this.options.pedantic ? n : Pt(n, `
983
- `)
984
- };
985
- }
986
- }
987
- fences(e) {
988
- const t = this.rules.block.fences.exec(e);
989
- if (t) {
990
- const n = t[0], o = Rr(n, t[3] || "");
991
- return {
992
- type: "code",
993
- raw: n,
994
- lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2],
995
- text: o
996
- };
997
- }
998
- }
999
- heading(e) {
1000
- const t = this.rules.block.heading.exec(e);
1001
- if (t) {
1002
- let n = t[2].trim();
1003
- if (/#$/.test(n)) {
1004
- const o = Pt(n, "#");
1005
- (this.options.pedantic || !o || / $/.test(o)) && (n = o.trim());
1006
- }
1007
- return {
1008
- type: "heading",
1009
- raw: t[0],
1010
- depth: t[1].length,
1011
- text: n,
1012
- tokens: this.lexer.inline(n)
1013
- };
1014
- }
1015
- }
1016
- hr(e) {
1017
- const t = this.rules.block.hr.exec(e);
1018
- if (t)
1019
- return {
1020
- type: "hr",
1021
- raw: t[0]
1022
- };
1023
- }
1024
- blockquote(e) {
1025
- const t = this.rules.block.blockquote.exec(e);
1026
- if (t) {
1027
- const n = Pt(t[0].replace(/^ *>[ \t]?/gm, ""), `
1028
- `), o = this.lexer.state.top;
1029
- this.lexer.state.top = !0;
1030
- const a = this.lexer.blockTokens(n);
1031
- return this.lexer.state.top = o, {
1032
- type: "blockquote",
1033
- raw: t[0],
1034
- tokens: a,
1035
- text: n
1036
- };
1037
- }
1038
- }
1039
- list(e) {
1040
- let t = this.rules.block.list.exec(e);
1041
- if (t) {
1042
- let n = t[1].trim();
1043
- const o = n.length > 1, a = {
1044
- type: "list",
1045
- raw: "",
1046
- ordered: o,
1047
- start: o ? +n.slice(0, -1) : "",
1048
- loose: !1,
1049
- items: []
1050
- };
1051
- n = o ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = o ? n : "[*+-]");
1052
- const r = new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`);
1053
- let u = "", c = "", x = !1;
1054
- for (; e; ) {
1055
- let h = !1;
1056
- if (!(t = r.exec(e)) || this.rules.block.hr.test(e))
1057
- break;
1058
- u = t[0], e = e.substring(u.length);
1059
- let g = t[2].split(`
1060
- `, 1)[0].replace(/^\t+/, (j) => " ".repeat(3 * j.length)), m = e.split(`
1061
- `, 1)[0], y = 0;
1062
- this.options.pedantic ? (y = 2, c = g.trimStart()) : (y = t[2].search(/[^ ]/), y = y > 4 ? 1 : y, c = g.slice(y), y += t[1].length);
1063
- let A = !1;
1064
- if (!g && /^ *$/.test(m) && (u += m + `
1065
- `, e = e.substring(m.length + 1), h = !0), !h) {
1066
- const j = new RegExp(`^ {0,${Math.min(3, y - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), $ = new RegExp(`^ {0,${Math.min(3, y - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), K = new RegExp(`^ {0,${Math.min(3, y - 1)}}(?:\`\`\`|~~~)`), B = new RegExp(`^ {0,${Math.min(3, y - 1)}}#`);
1067
- for (; e; ) {
1068
- const ie = e.split(`
1069
- `, 1)[0];
1070
- if (m = ie, this.options.pedantic && (m = m.replace(/^ {1,4}(?=( {4})*[^ ])/g, " ")), K.test(m) || B.test(m) || j.test(m) || $.test(e))
1071
- break;
1072
- if (m.search(/[^ ]/) >= y || !m.trim())
1073
- c += `
1074
- ` + m.slice(y);
1075
- else {
1076
- if (A || g.search(/[^ ]/) >= 4 || K.test(g) || B.test(g) || $.test(g))
1077
- break;
1078
- c += `
1079
- ` + m;
1080
- }
1081
- !A && !m.trim() && (A = !0), u += ie + `
1082
- `, e = e.substring(ie.length + 1), g = m.slice(y);
1083
- }
1084
- }
1085
- a.loose || (x ? a.loose = !0 : /\n *\n *$/.test(u) && (x = !0));
1086
- let T = null, D;
1087
- this.options.gfm && (T = /^\[[ xX]\] /.exec(c), T && (D = T[0] !== "[ ] ", c = c.replace(/^\[[ xX]\] +/, ""))), a.items.push({
1088
- type: "list_item",
1089
- raw: u,
1090
- task: !!T,
1091
- checked: D,
1092
- loose: !1,
1093
- text: c,
1094
- tokens: []
1095
- }), a.raw += u;
1096
- }
1097
- a.items[a.items.length - 1].raw = u.trimEnd(), a.items[a.items.length - 1].text = c.trimEnd(), a.raw = a.raw.trimEnd();
1098
- for (let h = 0; h < a.items.length; h++)
1099
- if (this.lexer.state.top = !1, a.items[h].tokens = this.lexer.blockTokens(a.items[h].text, []), !a.loose) {
1100
- const g = a.items[h].tokens.filter((y) => y.type === "space"), m = g.length > 0 && g.some((y) => /\n.*\n/.test(y.raw));
1101
- a.loose = m;
1102
- }
1103
- if (a.loose)
1104
- for (let h = 0; h < a.items.length; h++)
1105
- a.items[h].loose = !0;
1106
- return a;
1107
- }
1108
- }
1109
- html(e) {
1110
- const t = this.rules.block.html.exec(e);
1111
- if (t)
1112
- return {
1113
- type: "html",
1114
- block: !0,
1115
- raw: t[0],
1116
- pre: t[1] === "pre" || t[1] === "script" || t[1] === "style",
1117
- text: t[0]
1118
- };
1119
- }
1120
- def(e) {
1121
- const t = this.rules.block.def.exec(e);
1122
- if (t) {
1123
- const n = t[1].toLowerCase().replace(/\s+/g, " "), o = t[2] ? t[2].replace(/^<(.*)>$/, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", a = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
1124
- return {
1125
- type: "def",
1126
- tag: n,
1127
- raw: t[0],
1128
- href: o,
1129
- title: a
1130
- };
1131
- }
1132
- }
1133
- table(e) {
1134
- const t = this.rules.block.table.exec(e);
1135
- if (!t || !/[:|]/.test(t[2]))
1136
- return;
1137
- const n = vn(t[1]), o = t[2].replace(/^\||\| *$/g, "").split("|"), a = t[3] && t[3].trim() ? t[3].replace(/\n[ \t]*$/, "").split(`
1138
- `) : [], r = {
1139
- type: "table",
1140
- raw: t[0],
1141
- header: [],
1142
- align: [],
1143
- rows: []
1144
- };
1145
- if (n.length === o.length) {
1146
- for (const u of o)
1147
- /^ *-+: *$/.test(u) ? r.align.push("right") : /^ *:-+: *$/.test(u) ? r.align.push("center") : /^ *:-+ *$/.test(u) ? r.align.push("left") : r.align.push(null);
1148
- for (const u of n)
1149
- r.header.push({
1150
- text: u,
1151
- tokens: this.lexer.inline(u)
1152
- });
1153
- for (const u of a)
1154
- r.rows.push(vn(u, r.header.length).map((c) => ({
1155
- text: c,
1156
- tokens: this.lexer.inline(c)
1157
- })));
1158
- return r;
1159
- }
1160
- }
1161
- lheading(e) {
1162
- const t = this.rules.block.lheading.exec(e);
1163
- if (t)
1164
- return {
1165
- type: "heading",
1166
- raw: t[0],
1167
- depth: t[2].charAt(0) === "=" ? 1 : 2,
1168
- text: t[1],
1169
- tokens: this.lexer.inline(t[1])
1170
- };
1171
- }
1172
- paragraph(e) {
1173
- const t = this.rules.block.paragraph.exec(e);
1174
- if (t) {
1175
- const n = t[1].charAt(t[1].length - 1) === `
1176
- ` ? t[1].slice(0, -1) : t[1];
1177
- return {
1178
- type: "paragraph",
1179
- raw: t[0],
1180
- text: n,
1181
- tokens: this.lexer.inline(n)
1182
- };
1183
- }
1184
- }
1185
- text(e) {
1186
- const t = this.rules.block.text.exec(e);
1187
- if (t)
1188
- return {
1189
- type: "text",
1190
- raw: t[0],
1191
- text: t[0],
1192
- tokens: this.lexer.inline(t[0])
1193
- };
1194
- }
1195
- escape(e) {
1196
- const t = this.rules.inline.escape.exec(e);
1197
- if (t)
1198
- return {
1199
- type: "escape",
1200
- raw: t[0],
1201
- text: J(t[1])
1202
- };
1203
- }
1204
- tag(e) {
1205
- const t = this.rules.inline.tag.exec(e);
1206
- if (t)
1207
- 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), {
1208
- type: "html",
1209
- raw: t[0],
1210
- inLink: this.lexer.state.inLink,
1211
- inRawBlock: this.lexer.state.inRawBlock,
1212
- block: !1,
1213
- text: t[0]
1214
- };
1215
- }
1216
- link(e) {
1217
- const t = this.rules.inline.link.exec(e);
1218
- if (t) {
1219
- const n = t[2].trim();
1220
- if (!this.options.pedantic && /^</.test(n)) {
1221
- if (!/>$/.test(n))
1222
- return;
1223
- const r = Pt(n.slice(0, -1), "\\");
1224
- if ((n.length - r.length) % 2 === 0)
1225
- return;
1226
- } else {
1227
- const r = vr(t[2], "()");
1228
- if (r > -1) {
1229
- const c = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + r;
1230
- t[2] = t[2].substring(0, r), t[0] = t[0].substring(0, c).trim(), t[3] = "";
1231
- }
1232
- }
1233
- let o = t[2], a = "";
1234
- if (this.options.pedantic) {
1235
- const r = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(o);
1236
- r && (o = r[1], a = r[3]);
1237
- } else
1238
- a = t[3] ? t[3].slice(1, -1) : "";
1239
- return o = o.trim(), /^</.test(o) && (this.options.pedantic && !/>$/.test(n) ? o = o.slice(1) : o = o.slice(1, -1)), Rn(t, {
1240
- href: o && o.replace(this.rules.inline.anyPunctuation, "$1"),
1241
- title: a && a.replace(this.rules.inline.anyPunctuation, "$1")
1242
- }, t[0], this.lexer);
1243
- }
1244
- }
1245
- reflink(e, t) {
1246
- let n;
1247
- if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
1248
- const o = (n[2] || n[1]).replace(/\s+/g, " "), a = t[o.toLowerCase()];
1249
- if (!a) {
1250
- const r = n[0].charAt(0);
1251
- return {
1252
- type: "text",
1253
- raw: r,
1254
- text: r
1255
- };
1256
- }
1257
- return Rn(n, a, n[0], this.lexer);
1258
- }
1259
- }
1260
- emStrong(e, t, n = "") {
1261
- let o = this.rules.inline.emStrongLDelim.exec(e);
1262
- if (!o || o[3] && n.match(/[\p{L}\p{N}]/u))
1263
- return;
1264
- if (!(o[1] || o[2] || "") || !n || this.rules.inline.punctuation.exec(n)) {
1265
- const r = [...o[0]].length - 1;
1266
- let u, c, x = r, h = 0;
1267
- const g = o[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
1268
- for (g.lastIndex = 0, t = t.slice(-1 * e.length + r); (o = g.exec(t)) != null; ) {
1269
- if (u = o[1] || o[2] || o[3] || o[4] || o[5] || o[6], !u)
1270
- continue;
1271
- if (c = [...u].length, o[3] || o[4]) {
1272
- x += c;
1273
- continue;
1274
- } else if ((o[5] || o[6]) && r % 3 && !((r + c) % 3)) {
1275
- h += c;
1276
- continue;
1277
- }
1278
- if (x -= c, x > 0)
1279
- continue;
1280
- c = Math.min(c, c + x + h);
1281
- const m = [...o[0]][0].length, y = e.slice(0, r + o.index + m + c);
1282
- if (Math.min(r, c) % 2) {
1283
- const T = y.slice(1, -1);
1284
- return {
1285
- type: "em",
1286
- raw: y,
1287
- text: T,
1288
- tokens: this.lexer.inlineTokens(T)
1289
- };
1290
- }
1291
- const A = y.slice(2, -2);
1292
- return {
1293
- type: "strong",
1294
- raw: y,
1295
- text: A,
1296
- tokens: this.lexer.inlineTokens(A)
1297
- };
1298
- }
1299
- }
1300
- }
1301
- codespan(e) {
1302
- const t = this.rules.inline.code.exec(e);
1303
- if (t) {
1304
- let n = t[2].replace(/\n/g, " ");
1305
- const o = /[^ ]/.test(n), a = /^ /.test(n) && / $/.test(n);
1306
- return o && a && (n = n.substring(1, n.length - 1)), n = J(n, !0), {
1307
- type: "codespan",
1308
- raw: t[0],
1309
- text: n
1310
- };
1311
- }
1312
- }
1313
- br(e) {
1314
- const t = this.rules.inline.br.exec(e);
1315
- if (t)
1316
- return {
1317
- type: "br",
1318
- raw: t[0]
1319
- };
1320
- }
1321
- del(e) {
1322
- const t = this.rules.inline.del.exec(e);
1323
- if (t)
1324
- return {
1325
- type: "del",
1326
- raw: t[0],
1327
- text: t[2],
1328
- tokens: this.lexer.inlineTokens(t[2])
1329
- };
1330
- }
1331
- autolink(e) {
1332
- const t = this.rules.inline.autolink.exec(e);
1333
- if (t) {
1334
- let n, o;
1335
- return t[2] === "@" ? (n = J(t[1]), o = "mailto:" + n) : (n = J(t[1]), o = n), {
1336
- type: "link",
1337
- raw: t[0],
1338
- text: n,
1339
- href: o,
1340
- tokens: [
1341
- {
1342
- type: "text",
1343
- raw: n,
1344
- text: n
1345
- }
1346
- ]
1347
- };
1348
- }
1349
- }
1350
- url(e) {
1351
- var n;
1352
- let t;
1353
- if (t = this.rules.inline.url.exec(e)) {
1354
- let o, a;
1355
- if (t[2] === "@")
1356
- o = J(t[0]), a = "mailto:" + o;
1357
- else {
1358
- let r;
1359
- do
1360
- r = t[0], t[0] = ((n = this.rules.inline._backpedal.exec(t[0])) == null ? void 0 : n[0]) ?? "";
1361
- while (r !== t[0]);
1362
- o = J(t[0]), t[1] === "www." ? a = "http://" + t[0] : a = t[0];
1363
- }
1364
- return {
1365
- type: "link",
1366
- raw: t[0],
1367
- text: o,
1368
- href: a,
1369
- tokens: [
1370
- {
1371
- type: "text",
1372
- raw: o,
1373
- text: o
1374
- }
1375
- ]
1376
- };
1377
- }
1378
- }
1379
- inlineText(e) {
1380
- const t = this.rules.inline.text.exec(e);
1381
- if (t) {
1382
- let n;
1383
- return this.lexer.state.inRawBlock ? n = t[0] : n = J(t[0]), {
1384
- type: "text",
1385
- raw: t[0],
1386
- text: n
1387
- };
1388
- }
1389
- }
1390
- }
1391
- const Ar = /^(?: *(?:\n|$))+/, Sr = /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/, Or = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, bt = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Cr = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Un = /(?:[*+-]|\d{1,9}[.)])/, Bn = P(/^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g, Un).getRegex(), un = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Lr = /^[^\n]+/, fn = /(?!\s*\])(?:\\.|[^\[\]\\])+/, Ir = P(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label", fn).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Dr = P(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, Un).getRegex(), Bt = "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|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", pn = /<!--(?!-?>)[\s\S]*?(?:-->|$)/, Pr = P("^ {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", pn).replace("tag", Bt).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), Wn = P(un).replace("hr", bt).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", Bt).getRegex(), Nr = P(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", Wn).getRegex(), hn = {
1392
- blockquote: Nr,
1393
- code: Sr,
1394
- def: Ir,
1395
- fences: Or,
1396
- heading: Cr,
1397
- hr: bt,
1398
- html: Pr,
1399
- lheading: Bn,
1400
- list: Dr,
1401
- newline: Ar,
1402
- paragraph: Wn,
1403
- table: gt,
1404
- text: Lr
1405
- }, An = P("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", bt).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", " {4}[^\\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", Bt).getRegex(), Mr = {
1406
- ...hn,
1407
- table: An,
1408
- paragraph: P(un).replace("hr", bt).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", An).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", Bt).getRegex()
1409
- }, jr = {
1410
- ...hn,
1411
- html: P(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", pn).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(),
1412
- def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
1413
- heading: /^(#{1,6})(.*)(?:\n+|$)/,
1414
- fences: gt,
1415
- // fences not supported
1416
- lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
1417
- paragraph: P(un).replace("hr", bt).replace("heading", ` *#{1,6} *[^
1418
- ]`).replace("lheading", Bn).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
1419
- }, Hn = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, zr = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, Gn = /^( {2,}|\\)\n(?!\s*$)/, $r = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, xt = "\\p{P}$+<=>`^|~", Fr = P(/^((?![*_])[\spunctuation])/, "u").replace(/punctuation/g, xt).getRegex(), Ur = /\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g, Br = P(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/, "u").replace(/punct/g, xt).getRegex(), Wr = P("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])", "gu").replace(/punct/g, xt).getRegex(), Hr = P("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])", "gu").replace(/punct/g, xt).getRegex(), Gr = P(/\\([punct])/, "gu").replace(/punct/g, xt).getRegex(), Yr = P(/^<(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(), qr = P(pn).replace("(?:-->|$)", "-->").getRegex(), Vr = P("^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", qr).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), Ft = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, Zr = P(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label", Ft).replace("href", /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), Yn = P(/^!?\[(label)\]\[(ref)\]/).replace("label", Ft).replace("ref", fn).getRegex(), qn = P(/^!?\[(ref)\](?:\[\])?/).replace("ref", fn).getRegex(), Xr = P("reflink|nolink(?!\\()", "g").replace("reflink", Yn).replace("nolink", qn).getRegex(), dn = {
1420
- _backpedal: gt,
1421
- // only used for GFM url
1422
- anyPunctuation: Gr,
1423
- autolink: Yr,
1424
- blockSkip: Ur,
1425
- br: Gn,
1426
- code: zr,
1427
- del: gt,
1428
- emStrongLDelim: Br,
1429
- emStrongRDelimAst: Wr,
1430
- emStrongRDelimUnd: Hr,
1431
- escape: Hn,
1432
- link: Zr,
1433
- nolink: qn,
1434
- punctuation: Fr,
1435
- reflink: Yn,
1436
- reflinkSearch: Xr,
1437
- tag: Vr,
1438
- text: $r,
1439
- url: gt
1440
- }, Kr = {
1441
- ...dn,
1442
- link: P(/^!?\[(label)\]\((.*?)\)/).replace("label", Ft).getRegex(),
1443
- reflink: P(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", Ft).getRegex()
1444
- }, rn = {
1445
- ...dn,
1446
- escape: P(Hn).replace("])", "~|])").getRegex(),
1447
- url: P(/^((?: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(),
1448
- _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
1449
- del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
1450
- text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
1451
- }, Qr = {
1452
- ...rn,
1453
- br: P(Gn).replace("{2,}", "*").getRegex(),
1454
- text: P(rn.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
1455
- }, Nt = {
1456
- normal: hn,
1457
- gfm: Mr,
1458
- pedantic: jr
1459
- }, ut = {
1460
- normal: dn,
1461
- gfm: rn,
1462
- breaks: Qr,
1463
- pedantic: Kr
1464
- };
1465
- class he {
1466
- constructor(e) {
1467
- N(this, "tokens");
1468
- N(this, "options");
1469
- N(this, "state");
1470
- N(this, "tokenizer");
1471
- N(this, "inlineQueue");
1472
- this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || Me, this.options.tokenizer = this.options.tokenizer || new $t(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
1473
- inLink: !1,
1474
- inRawBlock: !1,
1475
- top: !0
1476
- };
1477
- const t = {
1478
- block: Nt.normal,
1479
- inline: ut.normal
1480
- };
1481
- this.options.pedantic ? (t.block = Nt.pedantic, t.inline = ut.pedantic) : this.options.gfm && (t.block = Nt.gfm, this.options.breaks ? t.inline = ut.breaks : t.inline = ut.gfm), this.tokenizer.rules = t;
1482
- }
1483
- /**
1484
- * Expose Rules
1485
- */
1486
- static get rules() {
1487
- return {
1488
- block: Nt,
1489
- inline: ut
1490
- };
1491
- }
1492
- /**
1493
- * Static Lex Method
1494
- */
1495
- static lex(e, t) {
1496
- return new he(t).lex(e);
1497
- }
1498
- /**
1499
- * Static Lex Inline Method
1500
- */
1501
- static lexInline(e, t) {
1502
- return new he(t).inlineTokens(e);
1503
- }
1504
- /**
1505
- * Preprocessing
1506
- */
1507
- lex(e) {
1508
- e = e.replace(/\r\n|\r/g, `
1509
- `), this.blockTokens(e, this.tokens);
1510
- for (let t = 0; t < this.inlineQueue.length; t++) {
1511
- const n = this.inlineQueue[t];
1512
- this.inlineTokens(n.src, n.tokens);
1513
- }
1514
- return this.inlineQueue = [], this.tokens;
1515
- }
1516
- blockTokens(e, t = []) {
1517
- this.options.pedantic ? e = e.replace(/\t/g, " ").replace(/^ +$/gm, "") : e = e.replace(/^( *)(\t+)/gm, (u, c, x) => c + " ".repeat(x.length));
1518
- let n, o, a, r;
1519
- for (; e; )
1520
- if (!(this.options.extensions && this.options.extensions.block && this.options.extensions.block.some((u) => (n = u.call({ lexer: this }, e, t)) ? (e = e.substring(n.raw.length), t.push(n), !0) : !1))) {
1521
- if (n = this.tokenizer.space(e)) {
1522
- e = e.substring(n.raw.length), n.raw.length === 1 && t.length > 0 ? t[t.length - 1].raw += `
1523
- ` : t.push(n);
1524
- continue;
1525
- }
1526
- if (n = this.tokenizer.code(e)) {
1527
- e = e.substring(n.raw.length), o = t[t.length - 1], o && (o.type === "paragraph" || o.type === "text") ? (o.raw += `
1528
- ` + n.raw, o.text += `
1529
- ` + n.text, this.inlineQueue[this.inlineQueue.length - 1].src = o.text) : t.push(n);
1530
- continue;
1531
- }
1532
- if (n = this.tokenizer.fences(e)) {
1533
- e = e.substring(n.raw.length), t.push(n);
1534
- continue;
1535
- }
1536
- if (n = this.tokenizer.heading(e)) {
1537
- e = e.substring(n.raw.length), t.push(n);
1538
- continue;
1539
- }
1540
- if (n = this.tokenizer.hr(e)) {
1541
- e = e.substring(n.raw.length), t.push(n);
1542
- continue;
1543
- }
1544
- if (n = this.tokenizer.blockquote(e)) {
1545
- e = e.substring(n.raw.length), t.push(n);
1546
- continue;
1547
- }
1548
- if (n = this.tokenizer.list(e)) {
1549
- e = e.substring(n.raw.length), t.push(n);
1550
- continue;
1551
- }
1552
- if (n = this.tokenizer.html(e)) {
1553
- e = e.substring(n.raw.length), t.push(n);
1554
- continue;
1555
- }
1556
- if (n = this.tokenizer.def(e)) {
1557
- e = e.substring(n.raw.length), o = t[t.length - 1], o && (o.type === "paragraph" || o.type === "text") ? (o.raw += `
1558
- ` + n.raw, o.text += `
1559
- ` + n.raw, this.inlineQueue[this.inlineQueue.length - 1].src = o.text) : this.tokens.links[n.tag] || (this.tokens.links[n.tag] = {
1560
- href: n.href,
1561
- title: n.title
1562
- });
1563
- continue;
1564
- }
1565
- if (n = this.tokenizer.table(e)) {
1566
- e = e.substring(n.raw.length), t.push(n);
1567
- continue;
1568
- }
1569
- if (n = this.tokenizer.lheading(e)) {
1570
- e = e.substring(n.raw.length), t.push(n);
1571
- continue;
1572
- }
1573
- if (a = e, this.options.extensions && this.options.extensions.startBlock) {
1574
- let u = 1 / 0;
1575
- const c = e.slice(1);
1576
- let x;
1577
- this.options.extensions.startBlock.forEach((h) => {
1578
- x = h.call({ lexer: this }, c), typeof x == "number" && x >= 0 && (u = Math.min(u, x));
1579
- }), u < 1 / 0 && u >= 0 && (a = e.substring(0, u + 1));
1580
- }
1581
- if (this.state.top && (n = this.tokenizer.paragraph(a))) {
1582
- o = t[t.length - 1], r && o.type === "paragraph" ? (o.raw += `
1583
- ` + n.raw, o.text += `
1584
- ` + n.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src = o.text) : t.push(n), r = a.length !== e.length, e = e.substring(n.raw.length);
1585
- continue;
1586
- }
1587
- if (n = this.tokenizer.text(e)) {
1588
- e = e.substring(n.raw.length), o = t[t.length - 1], o && o.type === "text" ? (o.raw += `
1589
- ` + n.raw, o.text += `
1590
- ` + n.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src = o.text) : t.push(n);
1591
- continue;
1592
- }
1593
- if (e) {
1594
- const u = "Infinite loop on byte: " + e.charCodeAt(0);
1595
- if (this.options.silent) {
1596
- console.error(u);
1597
- break;
1598
- } else
1599
- throw new Error(u);
1600
- }
1601
- }
1602
- return this.state.top = !0, t;
1603
- }
1604
- inline(e, t = []) {
1605
- return this.inlineQueue.push({ src: e, tokens: t }), t;
1606
- }
1607
- /**
1608
- * Lexing/Compiling
1609
- */
1610
- inlineTokens(e, t = []) {
1611
- let n, o, a, r = e, u, c, x;
1612
- if (this.tokens.links) {
1613
- const h = Object.keys(this.tokens.links);
1614
- if (h.length > 0)
1615
- for (; (u = this.tokenizer.rules.inline.reflinkSearch.exec(r)) != null; )
1616
- h.includes(u[0].slice(u[0].lastIndexOf("[") + 1, -1)) && (r = r.slice(0, u.index) + "[" + "a".repeat(u[0].length - 2) + "]" + r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
1617
- }
1618
- for (; (u = this.tokenizer.rules.inline.blockSkip.exec(r)) != null; )
1619
- r = r.slice(0, u.index) + "[" + "a".repeat(u[0].length - 2) + "]" + r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
1620
- for (; (u = this.tokenizer.rules.inline.anyPunctuation.exec(r)) != null; )
1621
- r = r.slice(0, u.index) + "++" + r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
1622
- for (; e; )
1623
- if (c || (x = ""), c = !1, !(this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((h) => (n = h.call({ lexer: this }, e, t)) ? (e = e.substring(n.raw.length), t.push(n), !0) : !1))) {
1624
- if (n = this.tokenizer.escape(e)) {
1625
- e = e.substring(n.raw.length), t.push(n);
1626
- continue;
1627
- }
1628
- if (n = this.tokenizer.tag(e)) {
1629
- e = e.substring(n.raw.length), o = t[t.length - 1], o && n.type === "text" && o.type === "text" ? (o.raw += n.raw, o.text += n.text) : t.push(n);
1630
- continue;
1631
- }
1632
- if (n = this.tokenizer.link(e)) {
1633
- e = e.substring(n.raw.length), t.push(n);
1634
- continue;
1635
- }
1636
- if (n = this.tokenizer.reflink(e, this.tokens.links)) {
1637
- e = e.substring(n.raw.length), o = t[t.length - 1], o && n.type === "text" && o.type === "text" ? (o.raw += n.raw, o.text += n.text) : t.push(n);
1638
- continue;
1639
- }
1640
- if (n = this.tokenizer.emStrong(e, r, x)) {
1641
- e = e.substring(n.raw.length), t.push(n);
1642
- continue;
1643
- }
1644
- if (n = this.tokenizer.codespan(e)) {
1645
- e = e.substring(n.raw.length), t.push(n);
1646
- continue;
1647
- }
1648
- if (n = this.tokenizer.br(e)) {
1649
- e = e.substring(n.raw.length), t.push(n);
1650
- continue;
1651
- }
1652
- if (n = this.tokenizer.del(e)) {
1653
- e = e.substring(n.raw.length), t.push(n);
1654
- continue;
1655
- }
1656
- if (n = this.tokenizer.autolink(e)) {
1657
- e = e.substring(n.raw.length), t.push(n);
1658
- continue;
1659
- }
1660
- if (!this.state.inLink && (n = this.tokenizer.url(e))) {
1661
- e = e.substring(n.raw.length), t.push(n);
1662
- continue;
1663
- }
1664
- if (a = e, this.options.extensions && this.options.extensions.startInline) {
1665
- let h = 1 / 0;
1666
- const g = e.slice(1);
1667
- let m;
1668
- this.options.extensions.startInline.forEach((y) => {
1669
- m = y.call({ lexer: this }, g), typeof m == "number" && m >= 0 && (h = Math.min(h, m));
1670
- }), h < 1 / 0 && h >= 0 && (a = e.substring(0, h + 1));
1671
- }
1672
- if (n = this.tokenizer.inlineText(a)) {
1673
- e = e.substring(n.raw.length), n.raw.slice(-1) !== "_" && (x = n.raw.slice(-1)), c = !0, o = t[t.length - 1], o && o.type === "text" ? (o.raw += n.raw, o.text += n.text) : t.push(n);
1674
- continue;
1675
- }
1676
- if (e) {
1677
- const h = "Infinite loop on byte: " + e.charCodeAt(0);
1678
- if (this.options.silent) {
1679
- console.error(h);
1680
- break;
1681
- } else
1682
- throw new Error(h);
1683
- }
1684
- }
1685
- return t;
1686
- }
1687
- }
1688
- class Ut {
1689
- constructor(e) {
1690
- N(this, "options");
1691
- this.options = e || Me;
1692
- }
1693
- code(e, t, n) {
1694
- var a;
1695
- const o = (a = (t || "").match(/^\S*/)) == null ? void 0 : a[0];
1696
- return e = e.replace(/\n$/, "") + `
1697
- `, o ? '<pre><code class="language-' + J(o) + '">' + (n ? e : J(e, !0)) + `</code></pre>
1698
- ` : "<pre><code>" + (n ? e : J(e, !0)) + `</code></pre>
1699
- `;
1700
- }
1701
- blockquote(e) {
1702
- return `<blockquote>
1703
- ${e}</blockquote>
1704
- `;
1705
- }
1706
- html(e, t) {
1707
- return e;
1708
- }
1709
- heading(e, t, n) {
1710
- return `<h${t}>${e}</h${t}>
1711
- `;
1712
- }
1713
- hr() {
1714
- return `<hr>
1715
- `;
1716
- }
1717
- list(e, t, n) {
1718
- const o = t ? "ol" : "ul", a = t && n !== 1 ? ' start="' + n + '"' : "";
1719
- return "<" + o + a + `>
1720
- ` + e + "</" + o + `>
1721
- `;
1722
- }
1723
- listitem(e, t, n) {
1724
- return `<li>${e}</li>
1725
- `;
1726
- }
1727
- checkbox(e) {
1728
- return "<input " + (e ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
1729
- }
1730
- paragraph(e) {
1731
- return `<p>${e}</p>
1732
- `;
1733
- }
1734
- table(e, t) {
1735
- return t && (t = `<tbody>${t}</tbody>`), `<table>
1736
- <thead>
1737
- ` + e + `</thead>
1738
- ` + t + `</table>
1739
- `;
1740
- }
1741
- tablerow(e) {
1742
- return `<tr>
1743
- ${e}</tr>
1744
- `;
1745
- }
1746
- tablecell(e, t) {
1747
- const n = t.header ? "th" : "td";
1748
- return (t.align ? `<${n} align="${t.align}">` : `<${n}>`) + e + `</${n}>
1749
- `;
1750
- }
1751
- /**
1752
- * span level renderer
1753
- */
1754
- strong(e) {
1755
- return `<strong>${e}</strong>`;
1756
- }
1757
- em(e) {
1758
- return `<em>${e}</em>`;
1759
- }
1760
- codespan(e) {
1761
- return `<code>${e}</code>`;
1762
- }
1763
- br() {
1764
- return "<br>";
1765
- }
1766
- del(e) {
1767
- return `<del>${e}</del>`;
1768
- }
1769
- link(e, t, n) {
1770
- const o = En(e);
1771
- if (o === null)
1772
- return n;
1773
- e = o;
1774
- let a = '<a href="' + e + '"';
1775
- return t && (a += ' title="' + t + '"'), a += ">" + n + "</a>", a;
1776
- }
1777
- image(e, t, n) {
1778
- const o = En(e);
1779
- if (o === null)
1780
- return n;
1781
- e = o;
1782
- let a = `<img src="${e}" alt="${n}"`;
1783
- return t && (a += ` title="${t}"`), a += ">", a;
1784
- }
1785
- text(e) {
1786
- return e;
1787
- }
1788
- }
1789
- class mn {
1790
- // no need for block level renderers
1791
- strong(e) {
1792
- return e;
1793
- }
1794
- em(e) {
1795
- return e;
1796
- }
1797
- codespan(e) {
1798
- return e;
1799
- }
1800
- del(e) {
1801
- return e;
1802
- }
1803
- html(e) {
1804
- return e;
1805
- }
1806
- text(e) {
1807
- return e;
1808
- }
1809
- link(e, t, n) {
1810
- return "" + n;
1811
- }
1812
- image(e, t, n) {
1813
- return "" + n;
1814
- }
1815
- br() {
1816
- return "";
1817
- }
1818
- }
1819
- class de {
1820
- constructor(e) {
1821
- N(this, "options");
1822
- N(this, "renderer");
1823
- N(this, "textRenderer");
1824
- this.options = e || Me, this.options.renderer = this.options.renderer || new Ut(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.textRenderer = new mn();
1825
- }
1826
- /**
1827
- * Static Parse Method
1828
- */
1829
- static parse(e, t) {
1830
- return new de(t).parse(e);
1831
- }
1832
- /**
1833
- * Static Parse Inline Method
1834
- */
1835
- static parseInline(e, t) {
1836
- return new de(t).parseInline(e);
1837
- }
1838
- /**
1839
- * Parse Loop
1840
- */
1841
- parse(e, t = !0) {
1842
- let n = "";
1843
- for (let o = 0; o < e.length; o++) {
1844
- const a = e[o];
1845
- if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[a.type]) {
1846
- const r = a, u = this.options.extensions.renderers[r.type].call({ parser: this }, r);
1847
- if (u !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(r.type)) {
1848
- n += u || "";
1849
- continue;
1850
- }
1851
- }
1852
- switch (a.type) {
1853
- case "space":
1854
- continue;
1855
- case "hr": {
1856
- n += this.renderer.hr();
1857
- continue;
1858
- }
1859
- case "heading": {
1860
- const r = a;
1861
- n += this.renderer.heading(this.parseInline(r.tokens), r.depth, yr(this.parseInline(r.tokens, this.textRenderer)));
1862
- continue;
1863
- }
1864
- case "code": {
1865
- const r = a;
1866
- n += this.renderer.code(r.text, r.lang, !!r.escaped);
1867
- continue;
1868
- }
1869
- case "table": {
1870
- const r = a;
1871
- let u = "", c = "";
1872
- for (let h = 0; h < r.header.length; h++)
1873
- c += this.renderer.tablecell(this.parseInline(r.header[h].tokens), { header: !0, align: r.align[h] });
1874
- u += this.renderer.tablerow(c);
1875
- let x = "";
1876
- for (let h = 0; h < r.rows.length; h++) {
1877
- const g = r.rows[h];
1878
- c = "";
1879
- for (let m = 0; m < g.length; m++)
1880
- c += this.renderer.tablecell(this.parseInline(g[m].tokens), { header: !1, align: r.align[m] });
1881
- x += this.renderer.tablerow(c);
1882
- }
1883
- n += this.renderer.table(u, x);
1884
- continue;
1885
- }
1886
- case "blockquote": {
1887
- const r = a, u = this.parse(r.tokens);
1888
- n += this.renderer.blockquote(u);
1889
- continue;
1890
- }
1891
- case "list": {
1892
- const r = a, u = r.ordered, c = r.start, x = r.loose;
1893
- let h = "";
1894
- for (let g = 0; g < r.items.length; g++) {
1895
- const m = r.items[g], y = m.checked, A = m.task;
1896
- let T = "";
1897
- if (m.task) {
1898
- const D = this.renderer.checkbox(!!y);
1899
- x ? m.tokens.length > 0 && m.tokens[0].type === "paragraph" ? (m.tokens[0].text = D + " " + m.tokens[0].text, m.tokens[0].tokens && m.tokens[0].tokens.length > 0 && m.tokens[0].tokens[0].type === "text" && (m.tokens[0].tokens[0].text = D + " " + m.tokens[0].tokens[0].text)) : m.tokens.unshift({
1900
- type: "text",
1901
- text: D + " "
1902
- }) : T += D + " ";
1903
- }
1904
- T += this.parse(m.tokens, x), h += this.renderer.listitem(T, A, !!y);
1905
- }
1906
- n += this.renderer.list(h, u, c);
1907
- continue;
1908
- }
1909
- case "html": {
1910
- const r = a;
1911
- n += this.renderer.html(r.text, r.block);
1912
- continue;
1913
- }
1914
- case "paragraph": {
1915
- const r = a;
1916
- n += this.renderer.paragraph(this.parseInline(r.tokens));
1917
- continue;
1918
- }
1919
- case "text": {
1920
- let r = a, u = r.tokens ? this.parseInline(r.tokens) : r.text;
1921
- for (; o + 1 < e.length && e[o + 1].type === "text"; )
1922
- r = e[++o], u += `
1923
- ` + (r.tokens ? this.parseInline(r.tokens) : r.text);
1924
- n += t ? this.renderer.paragraph(u) : u;
1925
- continue;
1926
- }
1927
- default: {
1928
- const r = 'Token with "' + a.type + '" type was not found.';
1929
- if (this.options.silent)
1930
- return console.error(r), "";
1931
- throw new Error(r);
1932
- }
1933
- }
1934
- }
1935
- return n;
1936
- }
1937
- /**
1938
- * Parse Inline Tokens
1939
- */
1940
- parseInline(e, t) {
1941
- t = t || this.renderer;
1942
- let n = "";
1943
- for (let o = 0; o < e.length; o++) {
1944
- const a = e[o];
1945
- if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[a.type]) {
1946
- const r = this.options.extensions.renderers[a.type].call({ parser: this }, a);
1947
- if (r !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(a.type)) {
1948
- n += r || "";
1949
- continue;
1950
- }
1951
- }
1952
- switch (a.type) {
1953
- case "escape": {
1954
- const r = a;
1955
- n += t.text(r.text);
1956
- break;
1957
- }
1958
- case "html": {
1959
- const r = a;
1960
- n += t.html(r.text);
1961
- break;
1962
- }
1963
- case "link": {
1964
- const r = a;
1965
- n += t.link(r.href, r.title, this.parseInline(r.tokens, t));
1966
- break;
1967
- }
1968
- case "image": {
1969
- const r = a;
1970
- n += t.image(r.href, r.title, r.text);
1971
- break;
1972
- }
1973
- case "strong": {
1974
- const r = a;
1975
- n += t.strong(this.parseInline(r.tokens, t));
1976
- break;
1977
- }
1978
- case "em": {
1979
- const r = a;
1980
- n += t.em(this.parseInline(r.tokens, t));
1981
- break;
1982
- }
1983
- case "codespan": {
1984
- const r = a;
1985
- n += t.codespan(r.text);
1986
- break;
1987
- }
1988
- case "br": {
1989
- n += t.br();
1990
- break;
1991
- }
1992
- case "del": {
1993
- const r = a;
1994
- n += t.del(this.parseInline(r.tokens, t));
1995
- break;
1996
- }
1997
- case "text": {
1998
- const r = a;
1999
- n += t.text(r.text);
2000
- break;
2001
- }
2002
- default: {
2003
- const r = 'Token with "' + a.type + '" type was not found.';
2004
- if (this.options.silent)
2005
- return console.error(r), "";
2006
- throw new Error(r);
2007
- }
2008
- }
2009
- }
2010
- return n;
2011
- }
2012
- }
2013
- class kt {
2014
- constructor(e) {
2015
- N(this, "options");
2016
- this.options = e || Me;
2017
- }
2018
- /**
2019
- * Process markdown before marked
2020
- */
2021
- preprocess(e) {
2022
- return e;
2023
- }
2024
- /**
2025
- * Process HTML after marked is finished
2026
- */
2027
- postprocess(e) {
2028
- return e;
2029
- }
2030
- /**
2031
- * Process all tokens before walk tokens
2032
- */
2033
- processAllTokens(e) {
2034
- return e;
2035
- }
2036
- }
2037
- N(kt, "passThroughHooks", /* @__PURE__ */ new Set([
2038
- "preprocess",
2039
- "postprocess",
2040
- "processAllTokens"
2041
- ]));
2042
- var Ne, on, Vn;
2043
- class Jr {
2044
- constructor(...e) {
2045
- xn(this, Ne);
2046
- N(this, "defaults", cn());
2047
- N(this, "options", this.setOptions);
2048
- N(this, "parse", Dt(this, Ne, on).call(this, he.lex, de.parse));
2049
- N(this, "parseInline", Dt(this, Ne, on).call(this, he.lexInline, de.parseInline));
2050
- N(this, "Parser", de);
2051
- N(this, "Renderer", Ut);
2052
- N(this, "TextRenderer", mn);
2053
- N(this, "Lexer", he);
2054
- N(this, "Tokenizer", $t);
2055
- N(this, "Hooks", kt);
2056
- this.use(...e);
2057
- }
2058
- /**
2059
- * Run callback for every token
2060
- */
2061
- walkTokens(e, t) {
2062
- var o, a;
2063
- let n = [];
2064
- for (const r of e)
2065
- switch (n = n.concat(t.call(this, r)), r.type) {
2066
- case "table": {
2067
- const u = r;
2068
- for (const c of u.header)
2069
- n = n.concat(this.walkTokens(c.tokens, t));
2070
- for (const c of u.rows)
2071
- for (const x of c)
2072
- n = n.concat(this.walkTokens(x.tokens, t));
2073
- break;
2074
- }
2075
- case "list": {
2076
- const u = r;
2077
- n = n.concat(this.walkTokens(u.items, t));
2078
- break;
2079
- }
2080
- default: {
2081
- const u = r;
2082
- (a = (o = this.defaults.extensions) == null ? void 0 : o.childTokens) != null && a[u.type] ? this.defaults.extensions.childTokens[u.type].forEach((c) => {
2083
- const x = u[c].flat(1 / 0);
2084
- n = n.concat(this.walkTokens(x, t));
2085
- }) : u.tokens && (n = n.concat(this.walkTokens(u.tokens, t)));
2086
- }
2087
- }
2088
- return n;
2089
- }
2090
- use(...e) {
2091
- const t = this.defaults.extensions || { renderers: {}, childTokens: {} };
2092
- return e.forEach((n) => {
2093
- const o = { ...n };
2094
- if (o.async = this.defaults.async || o.async || !1, n.extensions && (n.extensions.forEach((a) => {
2095
- if (!a.name)
2096
- throw new Error("extension name required");
2097
- if ("renderer" in a) {
2098
- const r = t.renderers[a.name];
2099
- r ? t.renderers[a.name] = function(...u) {
2100
- let c = a.renderer.apply(this, u);
2101
- return c === !1 && (c = r.apply(this, u)), c;
2102
- } : t.renderers[a.name] = a.renderer;
2103
- }
2104
- if ("tokenizer" in a) {
2105
- if (!a.level || a.level !== "block" && a.level !== "inline")
2106
- throw new Error("extension level must be 'block' or 'inline'");
2107
- const r = t[a.level];
2108
- r ? r.unshift(a.tokenizer) : t[a.level] = [a.tokenizer], a.start && (a.level === "block" ? t.startBlock ? t.startBlock.push(a.start) : t.startBlock = [a.start] : a.level === "inline" && (t.startInline ? t.startInline.push(a.start) : t.startInline = [a.start]));
2109
- }
2110
- "childTokens" in a && a.childTokens && (t.childTokens[a.name] = a.childTokens);
2111
- }), o.extensions = t), n.renderer) {
2112
- const a = this.defaults.renderer || new Ut(this.defaults);
2113
- for (const r in n.renderer) {
2114
- if (!(r in a))
2115
- throw new Error(`renderer '${r}' does not exist`);
2116
- if (r === "options")
2117
- continue;
2118
- const u = r, c = n.renderer[u], x = a[u];
2119
- a[u] = (...h) => {
2120
- let g = c.apply(a, h);
2121
- return g === !1 && (g = x.apply(a, h)), g || "";
2122
- };
2123
- }
2124
- o.renderer = a;
2125
- }
2126
- if (n.tokenizer) {
2127
- const a = this.defaults.tokenizer || new $t(this.defaults);
2128
- for (const r in n.tokenizer) {
2129
- if (!(r in a))
2130
- throw new Error(`tokenizer '${r}' does not exist`);
2131
- if (["options", "rules", "lexer"].includes(r))
2132
- continue;
2133
- const u = r, c = n.tokenizer[u], x = a[u];
2134
- a[u] = (...h) => {
2135
- let g = c.apply(a, h);
2136
- return g === !1 && (g = x.apply(a, h)), g;
2137
- };
2138
- }
2139
- o.tokenizer = a;
2140
- }
2141
- if (n.hooks) {
2142
- const a = this.defaults.hooks || new kt();
2143
- for (const r in n.hooks) {
2144
- if (!(r in a))
2145
- throw new Error(`hook '${r}' does not exist`);
2146
- if (r === "options")
2147
- continue;
2148
- const u = r, c = n.hooks[u], x = a[u];
2149
- kt.passThroughHooks.has(r) ? a[u] = (h) => {
2150
- if (this.defaults.async)
2151
- return Promise.resolve(c.call(a, h)).then((m) => x.call(a, m));
2152
- const g = c.call(a, h);
2153
- return x.call(a, g);
2154
- } : a[u] = (...h) => {
2155
- let g = c.apply(a, h);
2156
- return g === !1 && (g = x.apply(a, h)), g;
2157
- };
2158
- }
2159
- o.hooks = a;
2160
- }
2161
- if (n.walkTokens) {
2162
- const a = this.defaults.walkTokens, r = n.walkTokens;
2163
- o.walkTokens = function(u) {
2164
- let c = [];
2165
- return c.push(r.call(this, u)), a && (c = c.concat(a.call(this, u))), c;
2166
- };
2167
- }
2168
- this.defaults = { ...this.defaults, ...o };
2169
- }), this;
2170
- }
2171
- setOptions(e) {
2172
- return this.defaults = { ...this.defaults, ...e }, this;
2173
- }
2174
- lexer(e, t) {
2175
- return he.lex(e, t ?? this.defaults);
2176
- }
2177
- parser(e, t) {
2178
- return de.parse(e, t ?? this.defaults);
2179
- }
2180
- }
2181
- Ne = new WeakSet(), on = function(e, t) {
2182
- return (n, o) => {
2183
- const a = { ...o }, r = { ...this.defaults, ...a };
2184
- this.defaults.async === !0 && a.async === !1 && (r.silent || console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."), r.async = !0);
2185
- const u = Dt(this, Ne, Vn).call(this, !!r.silent, !!r.async);
2186
- if (typeof n > "u" || n === null)
2187
- return u(new Error("marked(): input parameter is undefined or null"));
2188
- if (typeof n != "string")
2189
- return u(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
2190
- if (r.hooks && (r.hooks.options = r), r.async)
2191
- return Promise.resolve(r.hooks ? r.hooks.preprocess(n) : n).then((c) => e(c, r)).then((c) => r.hooks ? r.hooks.processAllTokens(c) : c).then((c) => r.walkTokens ? Promise.all(this.walkTokens(c, r.walkTokens)).then(() => c) : c).then((c) => t(c, r)).then((c) => r.hooks ? r.hooks.postprocess(c) : c).catch(u);
2192
- try {
2193
- r.hooks && (n = r.hooks.preprocess(n));
2194
- let c = e(n, r);
2195
- r.hooks && (c = r.hooks.processAllTokens(c)), r.walkTokens && this.walkTokens(c, r.walkTokens);
2196
- let x = t(c, r);
2197
- return r.hooks && (x = r.hooks.postprocess(x)), x;
2198
- } catch (c) {
2199
- return u(c);
2200
- }
2201
- };
2202
- }, Vn = function(e, t) {
2203
- return (n) => {
2204
- if (n.message += `
2205
- Please report this to https://github.com/markedjs/marked.`, e) {
2206
- const o = "<p>An error occurred:</p><pre>" + J(n.message + "", !0) + "</pre>";
2207
- return t ? Promise.resolve(o) : o;
2208
- }
2209
- if (t)
2210
- return Promise.reject(n);
2211
- throw n;
2212
- };
2213
- };
2214
- const Pe = new Jr();
2215
- function I(l, e) {
2216
- return Pe.parse(l, e);
2217
- }
2218
- I.options = I.setOptions = function(l) {
2219
- return Pe.setOptions(l), I.defaults = Pe.defaults, zn(I.defaults), I;
2220
- };
2221
- I.getDefaults = cn;
2222
- I.defaults = Me;
2223
- I.use = function(...l) {
2224
- return Pe.use(...l), I.defaults = Pe.defaults, zn(I.defaults), I;
2225
- };
2226
- I.walkTokens = function(l, e) {
2227
- return Pe.walkTokens(l, e);
2228
- };
2229
- I.parseInline = Pe.parseInline;
2230
- I.Parser = de;
2231
- I.parser = de.parse;
2232
- I.Renderer = Ut;
2233
- I.TextRenderer = mn;
2234
- I.Lexer = he;
2235
- I.lexer = he.lex;
2236
- I.Tokenizer = $t;
2237
- I.Hooks = kt;
2238
- I.parse = I;
2239
- I.options;
2240
- I.setOptions;
2241
- I.use;
2242
- I.walkTokens;
2243
- I.parseInline;
2244
- de.parse;
2245
- he.lex;
2246
- /*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */
2247
- const {
2248
- entries: Zn,
2249
- setPrototypeOf: Sn,
2250
- isFrozen: ei,
2251
- getPrototypeOf: ti,
2252
- getOwnPropertyDescriptor: ni
2253
- } = Object;
2254
- let {
2255
- freeze: Z,
2256
- seal: re,
2257
- create: sn
2258
- } = Object, {
2259
- apply: an,
2260
- construct: ln
2261
- } = typeof Reflect < "u" && Reflect;
2262
- Z || (Z = function(e) {
2263
- return e;
2264
- });
2265
- re || (re = function(e) {
2266
- return e;
2267
- });
2268
- an || (an = function(e, t) {
2269
- for (var n = arguments.length, o = new Array(n > 2 ? n - 2 : 0), a = 2; a < n; a++)
2270
- o[a - 2] = arguments[a];
2271
- return e.apply(t, o);
2272
- });
2273
- ln || (ln = function(e) {
2274
- for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), o = 1; o < t; o++)
2275
- n[o - 1] = arguments[o];
2276
- return new e(...n);
2277
- });
2278
- const Mt = X(Array.prototype.forEach), ri = X(Array.prototype.lastIndexOf), On = X(Array.prototype.pop), ft = X(Array.prototype.push), ii = X(Array.prototype.splice), zt = X(String.prototype.toLowerCase), Xt = X(String.prototype.toString), Kt = X(String.prototype.match), pt = X(String.prototype.replace), oi = X(String.prototype.indexOf), si = X(String.prototype.trim), ue = X(Object.prototype.hasOwnProperty), V = X(RegExp.prototype.test), ht = ai(TypeError);
2279
- function X(l) {
2280
- return function(e) {
2281
- e instanceof RegExp && (e.lastIndex = 0);
2282
- for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), o = 1; o < t; o++)
2283
- n[o - 1] = arguments[o];
2284
- return an(l, e, n);
2285
- };
2286
- }
2287
- function ai(l) {
2288
- return function() {
2289
- for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)
2290
- t[n] = arguments[n];
2291
- return ln(l, t);
2292
- };
2293
- }
2294
- function v(l, e) {
2295
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : zt;
2296
- Sn && Sn(l, null);
2297
- let n = e.length;
2298
- for (; n--; ) {
2299
- let o = e[n];
2300
- if (typeof o == "string") {
2301
- const a = t(o);
2302
- a !== o && (ei(e) || (e[n] = a), o = a);
2303
- }
2304
- l[o] = !0;
2305
- }
2306
- return l;
2307
- }
2308
- function li(l) {
2309
- for (let e = 0; e < l.length; e++)
2310
- ue(l, e) || (l[e] = null);
2311
- return l;
2312
- }
2313
- function pe(l) {
2314
- const e = sn(null);
2315
- for (const [t, n] of Zn(l))
2316
- ue(l, t) && (Array.isArray(n) ? e[t] = li(n) : n && typeof n == "object" && n.constructor === Object ? e[t] = pe(n) : e[t] = n);
2317
- return e;
2318
- }
2319
- function dt(l, e) {
2320
- for (; l !== null; ) {
2321
- const n = ni(l, e);
2322
- if (n) {
2323
- if (n.get)
2324
- return X(n.get);
2325
- if (typeof n.value == "function")
2326
- return X(n.value);
2327
- }
2328
- l = ti(l);
2329
- }
2330
- function t() {
2331
- return null;
2332
- }
2333
- return t;
2334
- }
2335
- const Cn = Z(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "search", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), Qt = Z(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "enterkeyhint", "exportparts", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "inputmode", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "part", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), Jt = Z(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), ci = Z(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), en = Z(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]), ui = Z(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), Ln = Z(["#text"]), In = Z(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]), tn = Z(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "mask-type", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), Dn = Z(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), jt = Z(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), fi = re(/\{\{[\w\W]*|[\w\W]*\}\}/gm), pi = re(/<%[\w\W]*|[\w\W]*%>/gm), hi = re(/\$\{[\w\W]*/gm), di = re(/^data-[\-\w.\u00B7-\uFFFF]+$/), mi = re(/^aria-[\-\w]+$/), Xn = re(
2336
- /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
2337
- // eslint-disable-line no-useless-escape
2338
- ), gi = re(/^(?:\w+script|data):/i), ki = re(
2339
- /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
2340
- // eslint-disable-line no-control-regex
2341
- ), Kn = re(/^html$/i), bi = re(/^[a-z][.\w]*(-[.\w]+)+$/i);
2342
- var Pn = /* @__PURE__ */ Object.freeze({
2343
- __proto__: null,
2344
- ARIA_ATTR: mi,
2345
- ATTR_WHITESPACE: ki,
2346
- CUSTOM_ELEMENT: bi,
2347
- DATA_ATTR: di,
2348
- DOCTYPE_NAME: Kn,
2349
- ERB_EXPR: pi,
2350
- IS_ALLOWED_URI: Xn,
2351
- IS_SCRIPT_OR_DATA: gi,
2352
- MUSTACHE_EXPR: fi,
2353
- TMPLIT_EXPR: hi
2354
- });
2355
- const mt = {
2356
- element: 1,
2357
- text: 3,
2358
- // Deprecated
2359
- progressingInstruction: 7,
2360
- comment: 8,
2361
- document: 9
2362
- }, xi = function() {
2363
- return typeof window > "u" ? null : window;
2364
- }, Ti = function(e, t) {
2365
- if (typeof e != "object" || typeof e.createPolicy != "function")
2366
- return null;
2367
- let n = null;
2368
- const o = "data-tt-policy-suffix";
2369
- t && t.hasAttribute(o) && (n = t.getAttribute(o));
2370
- const a = "dompurify" + (n ? "#" + n : "");
2371
- try {
2372
- return e.createPolicy(a, {
2373
- createHTML(r) {
2374
- return r;
2375
- },
2376
- createScriptURL(r) {
2377
- return r;
2378
- }
2379
- });
2380
- } catch {
2381
- return console.warn("TrustedTypes policy " + a + " could not be created."), null;
2382
- }
2383
- }, Nn = function() {
2384
- return {
2385
- afterSanitizeAttributes: [],
2386
- afterSanitizeElements: [],
2387
- afterSanitizeShadowDOM: [],
2388
- beforeSanitizeAttributes: [],
2389
- beforeSanitizeElements: [],
2390
- beforeSanitizeShadowDOM: [],
2391
- uponSanitizeAttribute: [],
2392
- uponSanitizeElement: [],
2393
- uponSanitizeShadowNode: []
2394
- };
2395
- };
2396
- function Qn() {
2397
- let l = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : xi();
2398
- const e = (d) => Qn(d);
2399
- if (e.version = "3.3.1", e.removed = [], !l || !l.document || l.document.nodeType !== mt.document || !l.Element)
2400
- return e.isSupported = !1, e;
2401
- let {
2402
- document: t
2403
- } = l;
2404
- const n = t, o = n.currentScript, {
2405
- DocumentFragment: a,
2406
- HTMLTemplateElement: r,
2407
- Node: u,
2408
- Element: c,
2409
- NodeFilter: x,
2410
- NamedNodeMap: h = l.NamedNodeMap || l.MozNamedAttrMap,
2411
- HTMLFormElement: g,
2412
- DOMParser: m,
2413
- trustedTypes: y
2414
- } = l, A = c.prototype, T = dt(A, "cloneNode"), D = dt(A, "remove"), j = dt(A, "nextSibling"), $ = dt(A, "childNodes"), K = dt(A, "parentNode");
2415
- if (typeof r == "function") {
2416
- const d = t.createElement("template");
2417
- d.content && d.content.ownerDocument && (t = d.content.ownerDocument);
2418
- }
2419
- let B, ie = "";
2420
- const {
2421
- implementation: qe,
2422
- createNodeIterator: Wt,
2423
- createDocumentFragment: Ht,
2424
- getElementsByTagName: Tt
2425
- } = t, {
2426
- importNode: Gt
2427
- } = n;
2428
- let H = Nn();
2429
- e.isSupported = typeof Zn == "function" && typeof K == "function" && qe && qe.createHTMLDocument !== void 0;
2430
- const {
2431
- MUSTACHE_EXPR: je,
2432
- ERB_EXPR: ee,
2433
- TMPLIT_EXPR: oe,
2434
- DATA_ATTR: Le,
2435
- ARIA_ATTR: wt,
2436
- IS_SCRIPT_OR_DATA: _t,
2437
- ATTR_WHITESPACE: Ve,
2438
- CUSTOM_ELEMENT: yt
2439
- } = Pn;
2440
- let {
2441
- IS_ALLOWED_URI: Ze
2442
- } = Pn, F = null;
2443
- const Xe = v({}, [...Cn, ...Qt, ...Jt, ...en, ...Ln]);
2444
- let W = null;
2445
- const Et = v({}, [...In, ...tn, ...Dn, ...jt]);
2446
- let z = Object.seal(sn(null, {
2447
- tagNameCheck: {
2448
- writable: !0,
2449
- configurable: !1,
2450
- enumerable: !0,
2451
- value: null
2452
- },
2453
- attributeNameCheck: {
2454
- writable: !0,
2455
- configurable: !1,
2456
- enumerable: !0,
2457
- value: null
2458
- },
2459
- allowCustomizedBuiltInElements: {
2460
- writable: !0,
2461
- configurable: !1,
2462
- enumerable: !0,
2463
- value: !1
2464
- }
2465
- })), ge = null, Ie = null;
2466
- const se = Object.seal(sn(null, {
2467
- tagCheck: {
2468
- writable: !0,
2469
- configurable: !1,
2470
- enumerable: !0,
2471
- value: null
2472
- },
2473
- attributeCheck: {
2474
- writable: !0,
2475
- configurable: !1,
2476
- enumerable: !0,
2477
- value: null
2478
- }
2479
- }));
2480
- let ze = !0, Ee = !0, vt = !1, Ke = !0, ve = !1, $e = !0, te = !1, ke = !1, Fe = !1, be = !1, xe = !1, Ue = !1, Rt = !0, Be = !1;
2481
- const Yt = "user-content-";
2482
- let Qe = !0, Re = !1, Te = {}, Q = null;
2483
- const Je = v({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
2484
- let et = null;
2485
- const tt = v({}, ["audio", "video", "img", "source", "image", "track"]);
2486
- let nt = null;
2487
- const At = v({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), We = "http://www.w3.org/1998/Math/MathML", He = "http://www.w3.org/2000/svg", ae = "http://www.w3.org/1999/xhtml";
2488
- let Ae = ae, rt = !1, De = null;
2489
- const St = v({}, [We, He, ae], Xt);
2490
- let le = v({}, ["mi", "mo", "mn", "ms", "mtext"]), Se = v({}, ["annotation-xml"]);
2491
- const it = v({}, ["title", "style", "font", "a", "script"]);
2492
- let Oe = null;
2493
- const qt = ["application/xhtml+xml", "text/html"], Ot = "text/html";
2494
- let U = null, we = null;
2495
- const Ct = t.createElement("form"), Lt = function(i) {
2496
- return i instanceof RegExp || i instanceof Function;
2497
- }, ot = function() {
2498
- let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2499
- if (!(we && we === i)) {
2500
- if ((!i || typeof i != "object") && (i = {}), i = pe(i), Oe = // eslint-disable-next-line unicorn/prefer-includes
2501
- qt.indexOf(i.PARSER_MEDIA_TYPE) === -1 ? Ot : i.PARSER_MEDIA_TYPE, U = Oe === "application/xhtml+xml" ? Xt : zt, F = ue(i, "ALLOWED_TAGS") ? v({}, i.ALLOWED_TAGS, U) : Xe, W = ue(i, "ALLOWED_ATTR") ? v({}, i.ALLOWED_ATTR, U) : Et, De = ue(i, "ALLOWED_NAMESPACES") ? v({}, i.ALLOWED_NAMESPACES, Xt) : St, nt = ue(i, "ADD_URI_SAFE_ATTR") ? v(pe(At), i.ADD_URI_SAFE_ATTR, U) : At, et = ue(i, "ADD_DATA_URI_TAGS") ? v(pe(tt), i.ADD_DATA_URI_TAGS, U) : tt, Q = ue(i, "FORBID_CONTENTS") ? v({}, i.FORBID_CONTENTS, U) : Je, ge = ue(i, "FORBID_TAGS") ? v({}, i.FORBID_TAGS, U) : pe({}), Ie = ue(i, "FORBID_ATTR") ? v({}, i.FORBID_ATTR, U) : pe({}), Te = ue(i, "USE_PROFILES") ? i.USE_PROFILES : !1, ze = i.ALLOW_ARIA_ATTR !== !1, Ee = i.ALLOW_DATA_ATTR !== !1, vt = i.ALLOW_UNKNOWN_PROTOCOLS || !1, Ke = i.ALLOW_SELF_CLOSE_IN_ATTR !== !1, ve = i.SAFE_FOR_TEMPLATES || !1, $e = i.SAFE_FOR_XML !== !1, te = i.WHOLE_DOCUMENT || !1, be = i.RETURN_DOM || !1, xe = i.RETURN_DOM_FRAGMENT || !1, Ue = i.RETURN_TRUSTED_TYPE || !1, Fe = i.FORCE_BODY || !1, Rt = i.SANITIZE_DOM !== !1, Be = i.SANITIZE_NAMED_PROPS || !1, Qe = i.KEEP_CONTENT !== !1, Re = i.IN_PLACE || !1, Ze = i.ALLOWED_URI_REGEXP || Xn, Ae = i.NAMESPACE || ae, le = i.MATHML_TEXT_INTEGRATION_POINTS || le, Se = i.HTML_INTEGRATION_POINTS || Se, z = i.CUSTOM_ELEMENT_HANDLING || {}, i.CUSTOM_ELEMENT_HANDLING && Lt(i.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (z.tagNameCheck = i.CUSTOM_ELEMENT_HANDLING.tagNameCheck), i.CUSTOM_ELEMENT_HANDLING && Lt(i.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (z.attributeNameCheck = i.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), i.CUSTOM_ELEMENT_HANDLING && typeof i.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (z.allowCustomizedBuiltInElements = i.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), ve && (Ee = !1), xe && (be = !0), Te && (F = v({}, Ln), W = [], Te.html === !0 && (v(F, Cn), v(W, In)), Te.svg === !0 && (v(F, Qt), v(W, tn), v(W, jt)), Te.svgFilters === !0 && (v(F, Jt), v(W, tn), v(W, jt)), Te.mathMl === !0 && (v(F, en), v(W, Dn), v(W, jt))), i.ADD_TAGS && (typeof i.ADD_TAGS == "function" ? se.tagCheck = i.ADD_TAGS : (F === Xe && (F = pe(F)), v(F, i.ADD_TAGS, U))), i.ADD_ATTR && (typeof i.ADD_ATTR == "function" ? se.attributeCheck = i.ADD_ATTR : (W === Et && (W = pe(W)), v(W, i.ADD_ATTR, U))), i.ADD_URI_SAFE_ATTR && v(nt, i.ADD_URI_SAFE_ATTR, U), i.FORBID_CONTENTS && (Q === Je && (Q = pe(Q)), v(Q, i.FORBID_CONTENTS, U)), i.ADD_FORBID_CONTENTS && (Q === Je && (Q = pe(Q)), v(Q, i.ADD_FORBID_CONTENTS, U)), Qe && (F["#text"] = !0), te && v(F, ["html", "head", "body"]), F.table && (v(F, ["tbody"]), delete ge.tbody), i.TRUSTED_TYPES_POLICY) {
2502
- if (typeof i.TRUSTED_TYPES_POLICY.createHTML != "function")
2503
- throw ht('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
2504
- if (typeof i.TRUSTED_TYPES_POLICY.createScriptURL != "function")
2505
- throw ht('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
2506
- B = i.TRUSTED_TYPES_POLICY, ie = B.createHTML("");
2507
- } else
2508
- B === void 0 && (B = Ti(y, o)), B !== null && typeof ie == "string" && (ie = B.createHTML(""));
2509
- Z && Z(i), we = i;
2510
- }
2511
- }, st = v({}, [...Qt, ...Jt, ...ci]), at = v({}, [...en, ...ui]), Vt = function(i) {
2512
- let f = K(i);
2513
- (!f || !f.tagName) && (f = {
2514
- namespaceURI: Ae,
2515
- tagName: "template"
2516
- });
2517
- const b = zt(i.tagName), O = zt(f.tagName);
2518
- return De[i.namespaceURI] ? i.namespaceURI === He ? f.namespaceURI === ae ? b === "svg" : f.namespaceURI === We ? b === "svg" && (O === "annotation-xml" || le[O]) : !!st[b] : i.namespaceURI === We ? f.namespaceURI === ae ? b === "math" : f.namespaceURI === He ? b === "math" && Se[O] : !!at[b] : i.namespaceURI === ae ? f.namespaceURI === He && !Se[O] || f.namespaceURI === We && !le[O] ? !1 : !at[b] && (it[b] || !st[b]) : !!(Oe === "application/xhtml+xml" && De[i.namespaceURI]) : !1;
2519
- }, ne = function(i) {
2520
- ft(e.removed, {
2521
- element: i
2522
- });
2523
- try {
2524
- K(i).removeChild(i);
2525
- } catch {
2526
- D(i);
2527
- }
2528
- }, _e = function(i, f) {
2529
- try {
2530
- ft(e.removed, {
2531
- attribute: f.getAttributeNode(i),
2532
- from: f
2533
- });
2534
- } catch {
2535
- ft(e.removed, {
2536
- attribute: null,
2537
- from: f
2538
- });
2539
- }
2540
- if (f.removeAttribute(i), i === "is")
2541
- if (be || xe)
2542
- try {
2543
- ne(f);
2544
- } catch {
2545
- }
2546
- else
2547
- try {
2548
- f.setAttribute(i, "");
2549
- } catch {
2550
- }
2551
- }, It = function(i) {
2552
- let f = null, b = null;
2553
- if (Fe)
2554
- i = "<remove></remove>" + i;
2555
- else {
2556
- const M = Kt(i, /^[\r\n\t ]+/);
2557
- b = M && M[0];
2558
- }
2559
- Oe === "application/xhtml+xml" && Ae === ae && (i = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + i + "</body></html>");
2560
- const O = B ? B.createHTML(i) : i;
2561
- if (Ae === ae)
2562
- try {
2563
- f = new m().parseFromString(O, Oe);
2564
- } catch {
2565
- }
2566
- if (!f || !f.documentElement) {
2567
- f = qe.createDocument(Ae, "template", null);
2568
- try {
2569
- f.documentElement.innerHTML = rt ? ie : O;
2570
- } catch {
2571
- }
2572
- }
2573
- const C = f.body || f.documentElement;
2574
- return i && b && C.insertBefore(t.createTextNode(b), C.childNodes[0] || null), Ae === ae ? Tt.call(f, te ? "html" : "body")[0] : te ? f.documentElement : C;
2575
- }, s = function(i) {
2576
- return Wt.call(
2577
- i.ownerDocument || i,
2578
- i,
2579
- // eslint-disable-next-line no-bitwise
2580
- x.SHOW_ELEMENT | x.SHOW_COMMENT | x.SHOW_TEXT | x.SHOW_PROCESSING_INSTRUCTION | x.SHOW_CDATA_SECTION,
2581
- null
2582
- );
2583
- }, p = function(i) {
2584
- return i instanceof g && (typeof i.nodeName != "string" || typeof i.textContent != "string" || typeof i.removeChild != "function" || !(i.attributes instanceof h) || typeof i.removeAttribute != "function" || typeof i.setAttribute != "function" || typeof i.namespaceURI != "string" || typeof i.insertBefore != "function" || typeof i.hasChildNodes != "function");
2585
- }, k = function(i) {
2586
- return typeof u == "function" && i instanceof u;
2587
- };
2588
- function w(d, i, f) {
2589
- Mt(d, (b) => {
2590
- b.call(e, i, f, we);
2591
- });
2592
- }
2593
- const S = function(i) {
2594
- let f = null;
2595
- if (w(H.beforeSanitizeElements, i, null), p(i))
2596
- return ne(i), !0;
2597
- const b = U(i.nodeName);
2598
- if (w(H.uponSanitizeElement, i, {
2599
- tagName: b,
2600
- allowedTags: F
2601
- }), $e && i.hasChildNodes() && !k(i.firstElementChild) && V(/<[/\w!]/g, i.innerHTML) && V(/<[/\w!]/g, i.textContent) || i.nodeType === mt.progressingInstruction || $e && i.nodeType === mt.comment && V(/<[/\w]/g, i.data))
2602
- return ne(i), !0;
2603
- if (!(se.tagCheck instanceof Function && se.tagCheck(b)) && (!F[b] || ge[b])) {
2604
- if (!ge[b] && R(b) && (z.tagNameCheck instanceof RegExp && V(z.tagNameCheck, b) || z.tagNameCheck instanceof Function && z.tagNameCheck(b)))
2605
- return !1;
2606
- if (Qe && !Q[b]) {
2607
- const O = K(i) || i.parentNode, C = $(i) || i.childNodes;
2608
- if (C && O) {
2609
- const M = C.length;
2610
- for (let q = M - 1; q >= 0; --q) {
2611
- const ce = T(C[q], !0);
2612
- ce.__removalCount = (i.__removalCount || 0) + 1, O.insertBefore(ce, j(i));
2613
- }
2614
- }
2615
- }
2616
- return ne(i), !0;
2617
- }
2618
- return i instanceof c && !Vt(i) || (b === "noscript" || b === "noembed" || b === "noframes") && V(/<\/no(script|embed|frames)/i, i.innerHTML) ? (ne(i), !0) : (ve && i.nodeType === mt.text && (f = i.textContent, Mt([je, ee, oe], (O) => {
2619
- f = pt(f, O, " ");
2620
- }), i.textContent !== f && (ft(e.removed, {
2621
- element: i.cloneNode()
2622
- }), i.textContent = f)), w(H.afterSanitizeElements, i, null), !1);
2623
- }, L = function(i, f, b) {
2624
- if (Rt && (f === "id" || f === "name") && (b in t || b in Ct))
2625
- return !1;
2626
- if (!(Ee && !Ie[f] && V(Le, f))) {
2627
- if (!(ze && V(wt, f))) {
2628
- if (!(se.attributeCheck instanceof Function && se.attributeCheck(f, i))) {
2629
- if (!W[f] || Ie[f]) {
2630
- if (
2631
- // First condition does a very basic check if a) it's basically a valid custom element tagname AND
2632
- // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
2633
- // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
2634
- !(R(i) && (z.tagNameCheck instanceof RegExp && V(z.tagNameCheck, i) || z.tagNameCheck instanceof Function && z.tagNameCheck(i)) && (z.attributeNameCheck instanceof RegExp && V(z.attributeNameCheck, f) || z.attributeNameCheck instanceof Function && z.attributeNameCheck(f, i)) || // Alternative, second condition checks if it's an `is`-attribute, AND
2635
- // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
2636
- f === "is" && z.allowCustomizedBuiltInElements && (z.tagNameCheck instanceof RegExp && V(z.tagNameCheck, b) || z.tagNameCheck instanceof Function && z.tagNameCheck(b)))
2637
- ) return !1;
2638
- } else if (!nt[f]) {
2639
- if (!V(Ze, pt(b, Ve, ""))) {
2640
- if (!((f === "src" || f === "xlink:href" || f === "href") && i !== "script" && oi(b, "data:") === 0 && et[i])) {
2641
- if (!(vt && !V(_t, pt(b, Ve, "")))) {
2642
- if (b)
2643
- return !1;
2644
- }
2645
- }
2646
- }
2647
- }
2648
- }
2649
- }
2650
- }
2651
- return !0;
2652
- }, R = function(i) {
2653
- return i !== "annotation-xml" && Kt(i, yt);
2654
- }, E = function(i) {
2655
- w(H.beforeSanitizeAttributes, i, null);
2656
- const {
2657
- attributes: f
2658
- } = i;
2659
- if (!f || p(i))
2660
- return;
2661
- const b = {
2662
- attrName: "",
2663
- attrValue: "",
2664
- keepAttr: !0,
2665
- allowedAttributes: W,
2666
- forceKeepAttr: void 0
2667
- };
2668
- let O = f.length;
2669
- for (; O--; ) {
2670
- const C = f[O], {
2671
- name: M,
2672
- namespaceURI: q,
2673
- value: ce
2674
- } = C, Ge = U(M), Zt = ce;
2675
- let Y = M === "value" ? Zt : si(Zt);
2676
- if (b.attrName = Ge, b.attrValue = Y, b.keepAttr = !0, b.forceKeepAttr = void 0, w(H.uponSanitizeAttribute, i, b), Y = b.attrValue, Be && (Ge === "id" || Ge === "name") && (_e(M, i), Y = Yt + Y), $e && V(/((--!?|])>)|<\/(style|title|textarea)/i, Y)) {
2677
- _e(M, i);
2678
- continue;
2679
- }
2680
- if (Ge === "attributename" && Kt(Y, "href")) {
2681
- _e(M, i);
2682
- continue;
2683
- }
2684
- if (b.forceKeepAttr)
2685
- continue;
2686
- if (!b.keepAttr) {
2687
- _e(M, i);
2688
- continue;
2689
- }
2690
- if (!Ke && V(/\/>/i, Y)) {
2691
- _e(M, i);
2692
- continue;
2693
- }
2694
- ve && Mt([je, ee, oe], (kn) => {
2695
- Y = pt(Y, kn, " ");
2696
- });
2697
- const gn = U(i.nodeName);
2698
- if (!L(gn, Ge, Y)) {
2699
- _e(M, i);
2700
- continue;
2701
- }
2702
- if (B && typeof y == "object" && typeof y.getAttributeType == "function" && !q)
2703
- switch (y.getAttributeType(gn, Ge)) {
2704
- case "TrustedHTML": {
2705
- Y = B.createHTML(Y);
2706
- break;
2707
- }
2708
- case "TrustedScriptURL": {
2709
- Y = B.createScriptURL(Y);
2710
- break;
2711
- }
2712
- }
2713
- if (Y !== Zt)
2714
- try {
2715
- q ? i.setAttributeNS(q, M, Y) : i.setAttribute(M, Y), p(i) ? ne(i) : On(e.removed);
2716
- } catch {
2717
- _e(M, i);
2718
- }
2719
- }
2720
- w(H.afterSanitizeAttributes, i, null);
2721
- }, G = function d(i) {
2722
- let f = null;
2723
- const b = s(i);
2724
- for (w(H.beforeSanitizeShadowDOM, i, null); f = b.nextNode(); )
2725
- w(H.uponSanitizeShadowNode, f, null), S(f), E(f), f.content instanceof a && d(f.content);
2726
- w(H.afterSanitizeShadowDOM, i, null);
2727
- };
2728
- return e.sanitize = function(d) {
2729
- let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, f = null, b = null, O = null, C = null;
2730
- if (rt = !d, rt && (d = "<!-->"), typeof d != "string" && !k(d))
2731
- if (typeof d.toString == "function") {
2732
- if (d = d.toString(), typeof d != "string")
2733
- throw ht("dirty is not a string, aborting");
2734
- } else
2735
- throw ht("toString is not a function");
2736
- if (!e.isSupported)
2737
- return d;
2738
- if (ke || ot(i), e.removed = [], typeof d == "string" && (Re = !1), Re) {
2739
- if (d.nodeName) {
2740
- const ce = U(d.nodeName);
2741
- if (!F[ce] || ge[ce])
2742
- throw ht("root node is forbidden and cannot be sanitized in-place");
2743
- }
2744
- } else if (d instanceof u)
2745
- f = It("<!---->"), b = f.ownerDocument.importNode(d, !0), b.nodeType === mt.element && b.nodeName === "BODY" || b.nodeName === "HTML" ? f = b : f.appendChild(b);
2746
- else {
2747
- if (!be && !ve && !te && // eslint-disable-next-line unicorn/prefer-includes
2748
- d.indexOf("<") === -1)
2749
- return B && Ue ? B.createHTML(d) : d;
2750
- if (f = It(d), !f)
2751
- return be ? null : Ue ? ie : "";
2752
- }
2753
- f && Fe && ne(f.firstChild);
2754
- const M = s(Re ? d : f);
2755
- for (; O = M.nextNode(); )
2756
- S(O), E(O), O.content instanceof a && G(O.content);
2757
- if (Re)
2758
- return d;
2759
- if (be) {
2760
- if (xe)
2761
- for (C = Ht.call(f.ownerDocument); f.firstChild; )
2762
- C.appendChild(f.firstChild);
2763
- else
2764
- C = f;
2765
- return (W.shadowroot || W.shadowrootmode) && (C = Gt.call(n, C, !0)), C;
2766
- }
2767
- let q = te ? f.outerHTML : f.innerHTML;
2768
- return te && F["!doctype"] && f.ownerDocument && f.ownerDocument.doctype && f.ownerDocument.doctype.name && V(Kn, f.ownerDocument.doctype.name) && (q = "<!DOCTYPE " + f.ownerDocument.doctype.name + `>
2769
- ` + q), ve && Mt([je, ee, oe], (ce) => {
2770
- q = pt(q, ce, " ");
2771
- }), B && Ue ? B.createHTML(q) : q;
2772
- }, e.setConfig = function() {
2773
- let d = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2774
- ot(d), ke = !0;
2775
- }, e.clearConfig = function() {
2776
- we = null, ke = !1;
2777
- }, e.isValidAttribute = function(d, i, f) {
2778
- we || ot({});
2779
- const b = U(d), O = U(i);
2780
- return L(b, O, f);
2781
- }, e.addHook = function(d, i) {
2782
- typeof i == "function" && ft(H[d], i);
2783
- }, e.removeHook = function(d, i) {
2784
- if (i !== void 0) {
2785
- const f = ri(H[d], i);
2786
- return f === -1 ? void 0 : ii(H[d], f, 1)[0];
2787
- }
2788
- return On(H[d]);
2789
- }, e.removeHooks = function(d) {
2790
- H[d] = [];
2791
- }, e.removeAllHooks = function() {
2792
- H = Nn();
2793
- }, e;
2794
- }
2795
- var wi = Qn();
2796
- const _i = {
2797
- heading(l, e, t) {
2798
- typeof l == "object" && l !== null && (t = l.raw || t, e = l.depth || l.level || e, l = l.text || "");
2799
- const o = (t || String(l)).toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
2800
- return `<h${e} id="${o}">${l}</h${e}>`;
2801
- }
2802
- };
2803
- I.use({ renderer: _i });
2804
- function yi(l) {
2805
- const e = I.parse(l);
2806
- return wi.sanitize(e, {
2807
- ADD_ATTR: ["id", "name"],
2808
- // 'name' sometimes used for anchors too
2809
- ADD_TAGS: ["h1", "h2", "h3", "h4", "h5", "h6"]
2810
- // Ensure headers aren't stripped (redundant but safe)
2811
- });
2812
- }
2813
- const Ei = ({ content: l, filename: e, onClose: t }) => {
2814
- const [n, o] = ye(""), [a, r] = ye(!1), [u, c] = ye(!1);
2815
- Ye(() => {
2816
- if (l) {
2817
- const m = yi(l);
2818
- o(m);
2819
- }
2820
- }, [l]), Ye(() => {
2821
- const m = (A) => {
2822
- var D;
2823
- const T = (D = A.target.getAttribute("href")) == null ? void 0 : D.substring(1);
2824
- if (T) {
2825
- const j = document.getElementById(T);
2826
- j && (A.preventDefault(), j.scrollIntoView({ behavior: "smooth", block: "start" }));
2827
- }
2828
- }, y = document.querySelectorAll('.markdown-body a[href^="#"]');
2829
- return y.forEach((A) => A.addEventListener("click", m)), () => {
2830
- y.forEach((A) => A.removeEventListener("click", m));
2831
- };
2832
- }, [n]);
2833
- const x = () => {
2834
- var m;
2835
- if (a)
2836
- window.speechSynthesis.cancel(), r(!1);
2837
- else {
2838
- const y = (m = document.getElementById("markdown-content")) == null ? void 0 : m.innerText;
2839
- if (!y) return;
2840
- const A = new SpeechSynthesisUtterance(y);
2841
- A.rate = 1, A.onend = () => r(!1), A.onerror = () => r(!1), window.speechSynthesis.speak(A), r(!0);
2842
- }
2843
- };
2844
- Ye(() => () => window.speechSynthesis.cancel(), []);
2845
- const h = () => {
2846
- const m = document.getElementById("markdown-content");
2847
- if (!m) return;
2848
- const y = m.innerText, A = m.innerHTML, T = new Blob([A], { type: "text/html" }), D = new Blob([y], { type: "text/plain" }), j = [new ClipboardItem({
2849
- "text/html": T,
2850
- "text/plain": D
2851
- })];
2852
- navigator.clipboard.write(j).then(() => {
2853
- c(!0), setTimeout(() => c(!1), 2e3);
2854
- }).catch(() => {
2855
- navigator.clipboard.writeText(y).then(() => {
2856
- c(!0), setTimeout(() => c(!1), 2e3);
2857
- });
2858
- });
2859
- }, g = () => {
2860
- alert("💡 Tip: To preserve the visual theme in your PDF, make sure to check 'Background graphics' in the print settings window."), window.print();
2861
- };
2862
- return /* @__PURE__ */ _.jsxs("section", { className: "preview-zone", children: [
2863
- /* @__PURE__ */ _.jsxs("div", { className: "preview-header", children: [
2864
- /* @__PURE__ */ _.jsx("span", { id: "filename-display", children: e || "filename.md" }),
2865
- /* @__PURE__ */ _.jsxs("div", { className: "header-actions", children: [
2866
- /* @__PURE__ */ _.jsx(
2867
- "button",
2868
- {
2869
- className: `icon-btn ${a ? "speaking" : ""}`,
2870
- onClick: x,
2871
- title: a ? "Stop Reading" : "Read Aloud",
2872
- children: a ? /* @__PURE__ */ _.jsx(mr, {}) : /* @__PURE__ */ _.jsx(kr, {})
2873
- }
2874
- ),
2875
- /* @__PURE__ */ _.jsx(
2876
- "button",
2877
- {
2878
- className: "icon-btn",
2879
- onClick: h,
2880
- title: "Copy to Clipboard",
2881
- style: { color: u ? "var(--accent-color)" : "" },
2882
- children: u ? /* @__PURE__ */ _.jsx(lr, {}) : /* @__PURE__ */ _.jsx(fr, {})
2883
- }
2884
- ),
2885
- /* @__PURE__ */ _.jsx("button", { className: "icon-btn", onClick: g, title: "Save as PDF", children: /* @__PURE__ */ _.jsx(hr, {}) }),
2886
- /* @__PURE__ */ _.jsx("button", { className: "icon-btn", onClick: t, title: "Close File", id: "close-btn", children: /* @__PURE__ */ _.jsx(cr, {}) })
2887
- ] })
2888
- ] }),
2889
- /* @__PURE__ */ _.jsx(
2890
- "div",
2891
- {
2892
- id: "markdown-content",
2893
- className: "markdown-body",
2894
- dangerouslySetInnerHTML: { __html: n }
2895
- }
2896
- )
2897
- ] });
2898
- }, Ai = () => {
2899
- const [l, e] = ye("light"), [t, n] = ye(null), [o, a] = ye(!1), r = me.useRef(null);
2900
- Ye(() => {
2901
- const g = localStorage.getItem("theme"), m = window.matchMedia("(prefers-color-scheme: dark)").matches;
2902
- e(g || (m ? "dark" : "light"));
2903
- }, []);
2904
- const u = () => {
2905
- const g = l === "light" ? "dark" : "light";
2906
- e(g), localStorage.setItem("theme", g);
2907
- };
2908
- Ye(() => {
2909
- const g = r.current;
2910
- if (!g) return;
2911
- const m = () => {
2912
- g.scrollTop > 300 ? a(!0) : a(!1);
2913
- };
2914
- return g.addEventListener("scroll", m), () => g.removeEventListener("scroll", m);
2915
- }, []);
2916
- const c = () => {
2917
- r.current && r.current.scrollTo({ top: 0, behavior: "smooth" });
2918
- }, x = (g) => {
2919
- n(g), r.current && (r.current.scrollTop = 0);
2920
- }, h = () => {
2921
- n(null);
2922
- const g = new URL(window.location);
2923
- g.searchParams.delete("url"), window.history.pushState({}, "", g);
2924
- };
2925
- return Ye(() => {
2926
- new URLSearchParams(window.location.search).get("url");
2927
- }, []), /* @__PURE__ */ _.jsxs("div", { className: "scripto-wrapper", "data-theme": l, children: [
2928
- /* @__PURE__ */ _.jsxs("div", { className: "background-blobs", children: [
2929
- /* @__PURE__ */ _.jsx("div", { className: "blob blob-1" }),
2930
- /* @__PURE__ */ _.jsx("div", { className: "blob blob-2" }),
2931
- /* @__PURE__ */ _.jsx("div", { className: "blob blob-3" })
2932
- ] }),
2933
- /* @__PURE__ */ _.jsx("button", { id: "theme-toggle", "aria-label": "Toggle Theme", onClick: u, children: l === "light" ? /* @__PURE__ */ _.jsx(gr, {}) : /* @__PURE__ */ _.jsx(dr, {}) }),
2934
- /* @__PURE__ */ _.jsxs("main", { className: "app-container", ref: r, children: [
2935
- /* @__PURE__ */ _.jsxs("header", { className: "glass-header", children: [
2936
- /* @__PURE__ */ _.jsxs("div", { className: "logo", children: [
2937
- /* @__PURE__ */ _.jsx(pr, {}),
2938
- /* @__PURE__ */ _.jsxs("h1", { children: [
2939
- "Scr!p",
2940
- /* @__PURE__ */ _.jsx("span", { children: "tō" })
2941
- ] })
2942
- ] }),
2943
- /* @__PURE__ */ _.jsx("p", { children: "“Simple, elegant visualization — where every mark becomes meaning.”" })
2944
- ] }),
2945
- t ? /* @__PURE__ */ _.jsx(
2946
- Ei,
2947
- {
2948
- content: t.content,
2949
- filename: t.name,
2950
- onClose: h
2951
- }
2952
- ) : /* @__PURE__ */ _.jsx(br, { onFileLoaded: x }),
2953
- /* @__PURE__ */ _.jsx("footer", { className: "app-footer", children: /* @__PURE__ */ _.jsxs("p", { children: [
2954
- "🎯 App created by ",
2955
- /* @__PURE__ */ _.jsx("a", { href: "https://bio.link/shijoshaji", target: "_blank", rel: "noopener noreferrer", children: "Shijo Shaji" })
2956
- ] }) })
2957
- ] }),
2958
- /* @__PURE__ */ _.jsx(
2959
- "button",
2960
- {
2961
- id: "scroll-top-btn",
2962
- "aria-label": "Scroll to Top",
2963
- className: o ? "visible" : "",
2964
- onClick: c,
2965
- children: /* @__PURE__ */ _.jsx(ar, {})
2966
- }
2967
- )
2968
- ] });
2969
- };
2970
- export {
2971
- Ai as Scripto,
2972
- Ai as default
2973
- };