@remloyal/docsify-plugins 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4614 @@
1
+ /*!
2
+ * Docsify Plugin: flexsearch v1.0.0
3
+ * https://github.com/remloyal/docsify-plugins#readme
4
+ * (c) 2017-2026
5
+ * MIT license
6
+ */
7
+ (function() {
8
+ "use strict";
9
+ var _documentCurrentScript = typeof document !== "undefined" ? document.currentScript : null;
10
+ var w$1;
11
+ function H(a, c, b) {
12
+ const e = typeof b, d = typeof a;
13
+ if (e !== "undefined") {
14
+ if (d !== "undefined") {
15
+ if (b) {
16
+ if (d === "function" && e === d) return function(k) {
17
+ return a(b(k));
18
+ };
19
+ c = a.constructor;
20
+ if (c === b.constructor) {
21
+ if (c === Array) return b.concat(a);
22
+ if (c === Map) {
23
+ var f = new Map(b);
24
+ for (var g of a) f.set(g[0], g[1]);
25
+ return f;
26
+ }
27
+ if (c === Set) {
28
+ g = new Set(b);
29
+ for (f of a.values()) g.add(f);
30
+ return g;
31
+ }
32
+ }
33
+ }
34
+ return a;
35
+ }
36
+ return b;
37
+ }
38
+ return d === "undefined" ? c : a;
39
+ }
40
+ function aa(a, c) {
41
+ return typeof a === "undefined" ? c : a;
42
+ }
43
+ function I$1() {
44
+ return Object.create(null);
45
+ }
46
+ function M$1(a) {
47
+ return typeof a === "string";
48
+ }
49
+ function ba(a) {
50
+ return typeof a === "object";
51
+ }
52
+ function ca(a, c) {
53
+ if (M$1(c)) a = a[c]; else for (let b = 0; a && b < c.length; b++) a = a[c[b]];
54
+ return a;
55
+ }
56
+ const ea = /[^\p{L}\p{N}]+/u, fa = /(\d{3})/g, ha = /(\D)(\d{3})/g, ia = /(\d{3})(\D)/g, ja = /[\u0300-\u036f]/g;
57
+ function ka(a = {}) {
58
+ if (!this || this.constructor !== ka) return new ka(...arguments);
59
+ if (arguments.length) for (a = 0; a < arguments.length; a++) this.assign(arguments[a]); else this.assign(a);
60
+ }
61
+ w$1 = ka.prototype;
62
+ w$1.assign = function(a) {
63
+ this.normalize = H(a.normalize, true, this.normalize);
64
+ let c = a.include, b = c || a.exclude || a.split, e;
65
+ if (b || b === "") {
66
+ if (typeof b === "object" && b.constructor !== RegExp) {
67
+ let d = "";
68
+ e = !c;
69
+ c || (d += "\\p{Z}");
70
+ b.letter && (d += "\\p{L}");
71
+ b.number && (d += "\\p{N}", e = !!c);
72
+ b.symbol && (d += "\\p{S}");
73
+ b.punctuation && (d += "\\p{P}");
74
+ b.control && (d += "\\p{C}");
75
+ if (b = b.char) d += typeof b === "object" ? b.join("") : b;
76
+ try {
77
+ this.split = new RegExp("[" + (c ? "^" : "") + d + "]+", "u");
78
+ } catch (f) {
79
+ this.split = /\s+/;
80
+ }
81
+ } else this.split = b, e = b === false || "a1a".split(b).length < 2;
82
+ this.numeric = H(a.numeric, e);
83
+ } else {
84
+ try {
85
+ this.split = H(this.split, ea);
86
+ } catch (d) {
87
+ this.split = /\s+/;
88
+ }
89
+ this.numeric = H(a.numeric, H(this.numeric, true));
90
+ }
91
+ this.prepare = H(a.prepare, null, this.prepare);
92
+ this.finalize = H(a.finalize, null, this.finalize);
93
+ b = a.filter;
94
+ this.filter = typeof b === "function" ? b : H(b && new Set(b), null, this.filter);
95
+ this.dedupe = H(a.dedupe, true, this.dedupe);
96
+ this.matcher = H((b = a.matcher) && new Map(b), null, this.matcher);
97
+ this.mapper = H((b = a.mapper) && new Map(b), null, this.mapper);
98
+ this.stemmer = H((b = a.stemmer) && new Map(b), null, this.stemmer);
99
+ this.replacer = H(a.replacer, null, this.replacer);
100
+ this.minlength = H(a.minlength, 1, this.minlength);
101
+ this.maxlength = H(a.maxlength, 1024, this.maxlength);
102
+ this.rtl = H(a.rtl, false, this.rtl);
103
+ if (this.cache = b = H(a.cache, true, this.cache)) this.F = null, this.L = typeof b === "number" ? b : 2e5,
104
+ this.B = new Map, this.D = new Map, this.I = this.H = 128;
105
+ this.h = "";
106
+ this.J = null;
107
+ this.A = "";
108
+ this.K = null;
109
+ if (this.matcher) for (const d of this.matcher.keys()) this.h += (this.h ? "|" : "") + d;
110
+ if (this.stemmer) for (const d of this.stemmer.keys()) this.A += (this.A ? "|" : "") + d;
111
+ return this;
112
+ };
113
+ w$1.addStemmer = function(a, c) {
114
+ this.stemmer || (this.stemmer = new Map);
115
+ this.stemmer.set(a, c);
116
+ this.A += (this.A ? "|" : "") + a;
117
+ this.K = null;
118
+ this.cache && Q$1(this);
119
+ return this;
120
+ };
121
+ w$1.addFilter = function(a) {
122
+ typeof a === "function" ? this.filter = a : (this.filter || (this.filter = new Set),
123
+ this.filter.add(a));
124
+ this.cache && Q$1(this);
125
+ return this;
126
+ };
127
+ w$1.addMapper = function(a, c) {
128
+ if (typeof a === "object") return this.addReplacer(a, c);
129
+ if (a.length > 1) return this.addMatcher(a, c);
130
+ this.mapper || (this.mapper = new Map);
131
+ this.mapper.set(a, c);
132
+ this.cache && Q$1(this);
133
+ return this;
134
+ };
135
+ w$1.addMatcher = function(a, c) {
136
+ if (typeof a === "object") return this.addReplacer(a, c);
137
+ if (a.length < 2 && (this.dedupe || this.mapper)) return this.addMapper(a, c);
138
+ this.matcher || (this.matcher = new Map);
139
+ this.matcher.set(a, c);
140
+ this.h += (this.h ? "|" : "") + a;
141
+ this.J = null;
142
+ this.cache && Q$1(this);
143
+ return this;
144
+ };
145
+ w$1.addReplacer = function(a, c) {
146
+ if (typeof a === "string") return this.addMatcher(a, c);
147
+ this.replacer || (this.replacer = []);
148
+ this.replacer.push(a, c);
149
+ this.cache && Q$1(this);
150
+ return this;
151
+ };
152
+ w$1.encode = function(a, c) {
153
+ if (this.cache && a.length <= this.H) if (this.F) {
154
+ if (this.B.has(a)) return this.B.get(a);
155
+ } else this.F = setTimeout(Q$1, 50, this);
156
+ this.normalize && (typeof this.normalize === "function" ? a = this.normalize(a) : a = ja ? a.normalize("NFKD").replace(ja, "").toLowerCase() : a.toLowerCase());
157
+ this.prepare && (a = this.prepare(a));
158
+ this.numeric && a.length > 3 && (a = a.replace(ha, "$1 $2").replace(ia, "$1 $2").replace(fa, "$1 "));
159
+ const b = !(this.dedupe || this.mapper || this.filter || this.matcher || this.stemmer || this.replacer);
160
+ let e = [], d = I$1(), f, g, k = this.split || this.split === "" ? a.split(this.split) : [ a ];
161
+ for (let l = 0, m, p; l < k.length; l++) if ((m = p = k[l]) && !(m.length < this.minlength || m.length > this.maxlength)) {
162
+ if (c) {
163
+ if (d[m]) continue;
164
+ d[m] = 1;
165
+ } else {
166
+ if (f === m) continue;
167
+ f = m;
168
+ }
169
+ if (b) e.push(m); else if (!this.filter || (typeof this.filter === "function" ? this.filter(m) : !this.filter.has(m))) {
170
+ if (this.cache && m.length <= this.I) if (this.F) {
171
+ var h = this.D.get(m);
172
+ if (h || h === "") {
173
+ h && e.push(h);
174
+ continue;
175
+ }
176
+ } else this.F = setTimeout(Q$1, 50, this);
177
+ if (this.stemmer) {
178
+ this.K || (this.K = new RegExp("(?!^)(" + this.A + ")$"));
179
+ let u;
180
+ for (;u !== m && m.length > 2; ) u = m, m = m.replace(this.K, r => this.stemmer.get(r));
181
+ }
182
+ if (m && (this.mapper || this.dedupe && m.length > 1)) {
183
+ h = "";
184
+ for (let u = 0, r = "", t, n; u < m.length; u++) t = m.charAt(u), t === r && this.dedupe || ((n = this.mapper && this.mapper.get(t)) || n === "" ? n === r && this.dedupe || !(r = n) || (h += n) : h += r = t);
185
+ m = h;
186
+ }
187
+ this.matcher && m.length > 1 && (this.J || (this.J = new RegExp("(" + this.h + ")", "g")),
188
+ m = m.replace(this.J, u => this.matcher.get(u)));
189
+ if (m && this.replacer) for (h = 0; m && h < this.replacer.length; h += 2) m = m.replace(this.replacer[h], this.replacer[h + 1]);
190
+ this.cache && p.length <= this.I && (this.D.set(p, m), this.D.size > this.L && (this.D.clear(),
191
+ this.I = this.I / 1.1 | 0));
192
+ if (m) {
193
+ if (m !== p) if (c) {
194
+ if (d[m]) continue;
195
+ d[m] = 1;
196
+ } else {
197
+ if (g === m) continue;
198
+ g = m;
199
+ }
200
+ e.push(m);
201
+ }
202
+ }
203
+ }
204
+ this.finalize && (e = this.finalize(e) || e);
205
+ this.cache && a.length <= this.H && (this.B.set(a, e), this.B.size > this.L && (this.B.clear(),
206
+ this.H = this.H / 1.1 | 0));
207
+ return e;
208
+ };
209
+ function Q$1(a) {
210
+ a.F = null;
211
+ a.B.clear();
212
+ a.D.clear();
213
+ }
214
+ function la(a, c, b) {
215
+ b || (c || typeof a !== "object" ? typeof c === "object" && (b = c, c = 0) : b = a);
216
+ b && (a = b.query || a, c = b.limit || c);
217
+ let e = "" + (c || 0);
218
+ b && (e += (b.offset || 0) + !!b.context + !!b.suggest + (b.resolve !== false) + (b.resolution || this.resolution) + (b.boost || 0));
219
+ a = ("" + a).toLowerCase();
220
+ this.cache || (this.cache = new ma);
221
+ let d = this.cache.get(a + e);
222
+ if (!d) {
223
+ const f = b && b.cache;
224
+ f && (b.cache = false);
225
+ d = this.search(a, c, b);
226
+ f && (b.cache = f);
227
+ this.cache.set(a + e, d);
228
+ }
229
+ return d;
230
+ }
231
+ function ma(a) {
232
+ this.limit = a && a !== true ? a : 1e3;
233
+ this.cache = new Map;
234
+ this.h = "";
235
+ }
236
+ ma.prototype.set = function(a, c) {
237
+ this.cache.set(this.h = a, c);
238
+ this.cache.size > this.limit && this.cache.delete(this.cache.keys().next().value);
239
+ };
240
+ ma.prototype.get = function(a) {
241
+ const c = this.cache.get(a);
242
+ c && this.h !== a && (this.cache.delete(a), this.cache.set(this.h = a, c));
243
+ return c;
244
+ };
245
+ ma.prototype.remove = function(a) {
246
+ for (const c of this.cache) {
247
+ const b = c[0];
248
+ c[1].includes(a) && this.cache.delete(b);
249
+ }
250
+ };
251
+ ma.prototype.clear = function() {
252
+ this.cache.clear();
253
+ this.h = "";
254
+ };
255
+ const na = {
256
+ normalize: false,
257
+ numeric: false,
258
+ dedupe: false
259
+ };
260
+ const oa = {};
261
+ const ra = new Map([ [ "b", "p" ], [ "v", "f" ], [ "w", "f" ], [ "z", "s" ], [ "x", "s" ], [ "d", "t" ], [ "n", "m" ], [ "c", "k" ], [ "g", "k" ], [ "j", "k" ], [ "q", "k" ], [ "i", "e" ], [ "y", "e" ], [ "u", "o" ] ]);
262
+ const sa = new Map([ [ "ae", "a" ], [ "oe", "o" ], [ "sh", "s" ], [ "kh", "k" ], [ "th", "t" ], [ "ph", "f" ], [ "pf", "f" ] ]), ta = [ /([^aeo])h(.)/g, "$1$2", /([aeo])h([^aeo]|$)/g, "$1$2", /(.)\1+/g, "$1" ];
263
+ const ua = {
264
+ a: "",
265
+ e: "",
266
+ i: "",
267
+ o: "",
268
+ u: "",
269
+ y: "",
270
+ b: 1,
271
+ f: 1,
272
+ p: 1,
273
+ v: 1,
274
+ c: 2,
275
+ g: 2,
276
+ j: 2,
277
+ k: 2,
278
+ q: 2,
279
+ s: 2,
280
+ x: 2,
281
+ z: 2,
282
+ "ß": 2,
283
+ d: 3,
284
+ t: 3,
285
+ l: 4,
286
+ m: 5,
287
+ n: 5,
288
+ r: 6
289
+ };
290
+ var va = {
291
+ Exact: na,
292
+ Default: oa,
293
+ Normalize: oa,
294
+ LatinBalance: {
295
+ mapper: ra
296
+ },
297
+ LatinAdvanced: {
298
+ mapper: ra,
299
+ matcher: sa,
300
+ replacer: ta
301
+ },
302
+ LatinExtra: {
303
+ mapper: ra,
304
+ replacer: ta.concat([ /(?!^)[aeo]/g, "" ]),
305
+ matcher: sa
306
+ },
307
+ LatinSoundex: {
308
+ dedupe: false,
309
+ include: {
310
+ letter: true
311
+ },
312
+ finalize: function(a) {
313
+ for (let b = 0; b < a.length; b++) {
314
+ var c = a[b];
315
+ let e = c.charAt(0), d = ua[e];
316
+ for (let f = 1, g; f < c.length && (g = c.charAt(f), g === "h" || g === "w" || !(g = ua[g]) || g === d || (e += g,
317
+ d = g, e.length !== 4)); f++) ;
318
+ a[b] = e;
319
+ }
320
+ }
321
+ },
322
+ CJK: {
323
+ split: ""
324
+ },
325
+ LatinExact: na,
326
+ LatinDefault: oa,
327
+ LatinSimple: oa
328
+ };
329
+ function wa(a, c, b, e) {
330
+ let d = [];
331
+ for (let f = 0, g; f < a.index.length; f++) if (g = a.index[f], c >= g.length) c -= g.length; else {
332
+ c = g[e ? "splice" : "slice"](c, b);
333
+ const k = c.length;
334
+ if (k && (d = d.length ? d.concat(c) : c, b -= k, e && (a.length -= k), !b)) break;
335
+ c = 0;
336
+ }
337
+ return d;
338
+ }
339
+ function xa(a) {
340
+ if (!this || this.constructor !== xa) return new xa(a);
341
+ this.index = a ? [ a ] : [];
342
+ this.length = a ? a.length : 0;
343
+ const c = this;
344
+ return new Proxy([], {
345
+ get(b, e) {
346
+ if (e === "length") return c.length;
347
+ if (e === "push") return function(d) {
348
+ c.index[c.index.length - 1].push(d);
349
+ c.length++;
350
+ };
351
+ if (e === "pop") return function() {
352
+ if (c.length) return c.length--, c.index[c.index.length - 1].pop();
353
+ };
354
+ if (e === "indexOf") return function(d) {
355
+ let f = 0;
356
+ for (let g = 0, k, h; g < c.index.length; g++) {
357
+ k = c.index[g];
358
+ h = k.indexOf(d);
359
+ if (h >= 0) return f + h;
360
+ f += k.length;
361
+ }
362
+ return -1;
363
+ };
364
+ if (e === "includes") return function(d) {
365
+ for (let f = 0; f < c.index.length; f++) if (c.index[f].includes(d)) return true;
366
+ return false;
367
+ };
368
+ if (e === "slice") return function(d, f) {
369
+ return wa(c, d || 0, f || c.length, false);
370
+ };
371
+ if (e === "splice") return function(d, f) {
372
+ return wa(c, d || 0, f || c.length, true);
373
+ };
374
+ if (e === "constructor") return Array;
375
+ if (typeof e !== "symbol") return (b = c.index[e / 2 ** 31 | 0]) && b[e];
376
+ },
377
+ set(b, e, d) {
378
+ b = e / 2 ** 31 | 0;
379
+ (c.index[b] || (c.index[b] = []))[e] = d;
380
+ c.length++;
381
+ return true;
382
+ }
383
+ });
384
+ }
385
+ xa.prototype.clear = function() {
386
+ this.index.length = 0;
387
+ };
388
+ xa.prototype.push = function() {};
389
+ function R(a = 8) {
390
+ if (!this || this.constructor !== R) return new R(a);
391
+ this.index = I$1();
392
+ this.h = [];
393
+ this.size = 0;
394
+ a > 32 ? (this.B = Aa, this.A = BigInt(a)) : (this.B = Ba, this.A = a);
395
+ }
396
+ R.prototype.get = function(a) {
397
+ const c = this.index[this.B(a)];
398
+ return c && c.get(a);
399
+ };
400
+ R.prototype.set = function(a, c) {
401
+ var b = this.B(a);
402
+ let e = this.index[b];
403
+ e ? (b = e.size, e.set(a, c), (b -= e.size) && this.size++) : (this.index[b] = e = new Map([ [ a, c ] ]),
404
+ this.h.push(e), this.size++);
405
+ };
406
+ function S$1(a = 8) {
407
+ if (!this || this.constructor !== S$1) return new S$1(a);
408
+ this.index = I$1();
409
+ this.h = [];
410
+ this.size = 0;
411
+ a > 32 ? (this.B = Aa, this.A = BigInt(a)) : (this.B = Ba, this.A = a);
412
+ }
413
+ S$1.prototype.add = function(a) {
414
+ var c = this.B(a);
415
+ let b = this.index[c];
416
+ b ? (c = b.size, b.add(a), (c -= b.size) && this.size++) : (this.index[c] = b = new Set([ a ]),
417
+ this.h.push(b), this.size++);
418
+ };
419
+ w$1 = R.prototype;
420
+ w$1.has = S$1.prototype.has = function(a) {
421
+ const c = this.index[this.B(a)];
422
+ return c && c.has(a);
423
+ };
424
+ w$1.delete = S$1.prototype.delete = function(a) {
425
+ const c = this.index[this.B(a)];
426
+ c && c.delete(a) && this.size--;
427
+ };
428
+ w$1.clear = S$1.prototype.clear = function() {
429
+ this.index = I$1();
430
+ this.h = [];
431
+ this.size = 0;
432
+ };
433
+ w$1.values = S$1.prototype.values = function*() {
434
+ for (let a = 0; a < this.h.length; a++) for (let c of this.h[a].values()) yield c;
435
+ };
436
+ w$1.keys = S$1.prototype.keys = function*() {
437
+ for (let a = 0; a < this.h.length; a++) for (let c of this.h[a].keys()) yield c;
438
+ };
439
+ w$1.entries = S$1.prototype.entries = function*() {
440
+ for (let a = 0; a < this.h.length; a++) for (let c of this.h[a].entries()) yield c;
441
+ };
442
+ function Ba(a) {
443
+ let c = 2 ** this.A - 1;
444
+ if (typeof a == "number") return a & c;
445
+ let b = 0, e = this.A + 1;
446
+ for (let d = 0; d < a.length; d++) b = (b * e ^ a.charCodeAt(d)) & c;
447
+ return this.A === 32 ? b + 2 ** 31 : b;
448
+ }
449
+ function Aa(a) {
450
+ let c = BigInt(2) ** this.A - BigInt(1);
451
+ var b = typeof a;
452
+ if (b === "bigint") return a & c;
453
+ if (b === "number") return BigInt(a) & c;
454
+ b = BigInt(0);
455
+ let e = this.A + BigInt(1);
456
+ for (let d = 0; d < a.length; d++) b = (b * e ^ BigInt(a.charCodeAt(d))) & c;
457
+ return b;
458
+ }
459
+ let Ca, Da;
460
+ async function Ea(a) {
461
+ a = a.data;
462
+ var c = a.task;
463
+ const b = a.id;
464
+ let e = a.args;
465
+ switch (c) {
466
+ case "init":
467
+ Da = a.options || {};
468
+ (c = a.factory) ? (Function("return " + c)()(self), Ca = new self.FlexSearch.Index(Da),
469
+ delete self.FlexSearch) : Ca = new T$1(Da);
470
+ postMessage({
471
+ id: b
472
+ });
473
+ break;
474
+
475
+ default:
476
+ let d;
477
+ c === "export" && (e[1] ? (e[0] = Da.export, e[2] = 0, e[3] = 1) : e = null);
478
+ c === "import" ? e[0] && (a = await Da.import.call(Ca, e[0]), Ca.import(e[0], a)) : ((d = e && Ca[c].apply(Ca, e)) && d.then && (d = await d),
479
+ d && d.await && (d = await d.await), c === "search" && d.result && (d = d.result));
480
+ postMessage(c === "search" ? {
481
+ id: b,
482
+ msg: d
483
+ } : {
484
+ id: b
485
+ });
486
+ }
487
+ }
488
+ function Fa(a) {
489
+ Ga.call(a, "add");
490
+ Ga.call(a, "append");
491
+ Ga.call(a, "search");
492
+ Ga.call(a, "update");
493
+ Ga.call(a, "remove");
494
+ Ga.call(a, "searchCache");
495
+ }
496
+ let Ha, Ia, Ja;
497
+ function Ka() {
498
+ Ha = Ja = 0;
499
+ }
500
+ function Ga(a) {
501
+ this[a + "Async"] = function() {
502
+ const c = arguments;
503
+ var b = c[c.length - 1];
504
+ let e;
505
+ typeof b === "function" && (e = b, delete c[c.length - 1]);
506
+ Ha ? Ja || (Ja = Date.now() - Ia >= this.priority * this.priority * 3) : (Ha = setTimeout(Ka, 0),
507
+ Ia = Date.now());
508
+ if (Ja) {
509
+ const f = this;
510
+ return new Promise(g => {
511
+ setTimeout(function() {
512
+ g(f[a + "Async"].apply(f, c));
513
+ }, 0);
514
+ });
515
+ }
516
+ const d = this[a].apply(this, c);
517
+ b = d.then ? d : new Promise(f => f(d));
518
+ e && b.then(e);
519
+ return b;
520
+ };
521
+ }
522
+ let V = 0;
523
+ function La(a = {}, c) {
524
+ function b(k) {
525
+ function h(l) {
526
+ l = l.data || l;
527
+ const m = l.id, p = m && f.h[m];
528
+ p && (p(l.msg), delete f.h[m]);
529
+ }
530
+ this.worker = k;
531
+ this.h = I$1();
532
+ if (this.worker) {
533
+ d ? this.worker.on("message", h) : this.worker.onmessage = h;
534
+ if (a.config) return new Promise(function(l) {
535
+ V > 1e9 && (V = 0);
536
+ f.h[++V] = function() {
537
+ l(f);
538
+ };
539
+ f.worker.postMessage({
540
+ id: V,
541
+ task: "init",
542
+ factory: e,
543
+ options: a
544
+ });
545
+ });
546
+ this.priority = a.priority || 4;
547
+ this.encoder = c || null;
548
+ this.worker.postMessage({
549
+ task: "init",
550
+ factory: e,
551
+ options: a
552
+ });
553
+ return this;
554
+ }
555
+ }
556
+ if (!this || this.constructor !== La) return new La(a);
557
+ let e = typeof self !== "undefined" ? self._factory : typeof window !== "undefined" ? window._factory : null;
558
+ e && (e = e.toString());
559
+ const d = typeof window === "undefined", f = this, g = Ma(e, d, a.worker);
560
+ return g.then ? g.then(function(k) {
561
+ return b.call(f, k);
562
+ }) : b.call(this, g);
563
+ }
564
+ W$1("add");
565
+ W$1("append");
566
+ W$1("search");
567
+ W$1("update");
568
+ W$1("remove");
569
+ W$1("clear");
570
+ W$1("export");
571
+ W$1("import");
572
+ La.prototype.searchCache = la;
573
+ Fa(La.prototype);
574
+ function W$1(a) {
575
+ La.prototype[a] = function() {
576
+ const c = this, b = [].slice.call(arguments);
577
+ var e = b[b.length - 1];
578
+ let d;
579
+ typeof e === "function" && (d = e, b.pop());
580
+ e = new Promise(function(f) {
581
+ a === "export" && typeof b[0] === "function" && (b[0] = null);
582
+ V > 1e9 && (V = 0);
583
+ c.h[++V] = f;
584
+ c.worker.postMessage({
585
+ task: a,
586
+ id: V,
587
+ args: b
588
+ });
589
+ });
590
+ return d ? (e.then(d), this) : e;
591
+ };
592
+ }
593
+ function Ma(a, c, b) {
594
+ return c ? typeof module !== "undefined" ? new (require("worker_threads")["Worker"])(__dirname + "/worker/node.js") : import("worker_threads").then(function(worker) {
595
+ return new worker["Worker"](undefined + "/node/node.mjs");
596
+ }) : a ? new window.Worker(URL.createObjectURL(new Blob([ "onmessage=" + Ea.toString() ], {
597
+ type: "text/javascript"
598
+ }))) : new window.Worker(typeof b === "string" ? b : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("docsify-flexsearch.js", document.baseURI).href).replace("/worker.js", "/worker/worker.js").replace("flexsearch.bundle.module.min.js", "module/worker/worker.js").replace("flexsearch.bundle.module.min.mjs", "module/worker/worker.js"), {
599
+ type: "module"
600
+ });
601
+ }
602
+ Na.prototype.add = function(a, c, b) {
603
+ ba(a) && (c = a, a = ca(c, this.key));
604
+ if (c && (a || a === 0)) {
605
+ if (!b && this.reg.has(a)) return this.update(a, c);
606
+ for (let k = 0, h; k < this.field.length; k++) {
607
+ h = this.B[k];
608
+ var e = this.index.get(this.field[k]);
609
+ if (typeof h === "function") {
610
+ var d = h(c);
611
+ d && e.add(a, d, b, true);
612
+ } else if (d = h.G, !d || d(c)) h.constructor === String ? h = [ "" + h ] : M$1(h) && (h = [ h ]),
613
+ Qa(c, h, this.D, 0, e, a, h[0], b);
614
+ }
615
+ if (this.tag) for (e = 0; e < this.A.length; e++) {
616
+ var f = this.A[e];
617
+ d = this.tag.get(this.F[e]);
618
+ let k = I$1();
619
+ if (typeof f === "function") {
620
+ if (f = f(c), !f) continue;
621
+ } else {
622
+ var g = f.G;
623
+ if (g && !g(c)) continue;
624
+ f.constructor === String && (f = "" + f);
625
+ f = ca(c, f);
626
+ }
627
+ if (d && f) {
628
+ M$1(f) && (f = [ f ]);
629
+ for (let h = 0, l, m; h < f.length; h++) if (l = f[h], !k[l] && (k[l] = 1, (g = d.get(l)) ? m = g : d.set(l, m = []),
630
+ !b || !m.includes(a))) {
631
+ if (m.length === 2 ** 31 - 1) {
632
+ g = new xa(m);
633
+ if (this.fastupdate) for (let p of this.reg.values()) p.includes(m) && (p[p.indexOf(m)] = g);
634
+ d.set(l, m = g);
635
+ }
636
+ m.push(a);
637
+ this.fastupdate && ((g = this.reg.get(a)) ? g.push(m) : this.reg.set(a, [ m ]));
638
+ }
639
+ }
640
+ }
641
+ if (this.store && (!b || !this.store.has(a))) {
642
+ let k;
643
+ if (this.h) {
644
+ k = I$1();
645
+ for (let h = 0, l; h < this.h.length; h++) {
646
+ l = this.h[h];
647
+ if ((b = l.G) && !b(c)) continue;
648
+ let m;
649
+ if (typeof l === "function") {
650
+ m = l(c);
651
+ if (!m) continue;
652
+ l = [ l.O ];
653
+ } else if (M$1(l) || l.constructor === String) {
654
+ k[l] = c[l];
655
+ continue;
656
+ }
657
+ Ra(c, k, l, 0, l[0], m);
658
+ }
659
+ }
660
+ this.store.set(a, k || c);
661
+ }
662
+ this.worker && (this.fastupdate || this.reg.add(a));
663
+ }
664
+ return this;
665
+ };
666
+ function Ra(a, c, b, e, d, f) {
667
+ a = a[d];
668
+ if (e === b.length - 1) c[d] = f || a; else if (a) if (a.constructor === Array) for (c = c[d] = Array(a.length),
669
+ d = 0; d < a.length; d++) Ra(a, c, b, e, d); else c = c[d] || (c[d] = I$1()), d = b[++e],
670
+ Ra(a, c, b, e, d);
671
+ }
672
+ function Qa(a, c, b, e, d, f, g, k) {
673
+ if (a = a[g]) if (e === c.length - 1) {
674
+ if (a.constructor === Array) {
675
+ if (b[e]) {
676
+ for (c = 0; c < a.length; c++) d.add(f, a[c], true, true);
677
+ return;
678
+ }
679
+ a = a.join(" ");
680
+ }
681
+ d.add(f, a, k, true);
682
+ } else if (a.constructor === Array) for (g = 0; g < a.length; g++) Qa(a, c, b, e, d, f, g, k); else g = c[++e],
683
+ Qa(a, c, b, e, d, f, g, k);
684
+ }
685
+ function Sa(a, c, b, e) {
686
+ if (!a.length) return a;
687
+ if (a.length === 1) return a = a[0], a = b || a.length > c ? a.slice(b, b + c) : a,
688
+ e ? Ta.call(this, a) : a;
689
+ let d = [];
690
+ for (let f = 0, g, k; f < a.length; f++) if ((g = a[f]) && (k = g.length)) {
691
+ if (b) {
692
+ if (b >= k) {
693
+ b -= k;
694
+ continue;
695
+ }
696
+ g = g.slice(b, b + c);
697
+ k = g.length;
698
+ b = 0;
699
+ }
700
+ k > c && (g = g.slice(0, c), k = c);
701
+ if (!d.length && k >= c) return e ? Ta.call(this, g) : g;
702
+ d.push(g);
703
+ c -= k;
704
+ if (!c) break;
705
+ }
706
+ d = d.length > 1 ? [].concat.apply([], d) : d[0];
707
+ return e ? Ta.call(this, d) : d;
708
+ }
709
+ function Ua(a, c, b, e) {
710
+ var d = e[0];
711
+ if (d[0] && d[0].query) return a[c].apply(a, d);
712
+ if (!(c !== "and" && c !== "not" || a.result.length || a.await || d.suggest)) return e.length > 1 && (d = e[e.length - 1]),
713
+ (e = d.resolve) ? a.await || a.result : a;
714
+ let f = [], g = 0, k = 0, h, l, m, p, u;
715
+ for (c = 0; c < e.length; c++) if (d = e[c]) {
716
+ var r = void 0;
717
+ if (d.constructor === X$1) r = d.await || d.result; else if (d.then || d.constructor === Array) r = d; else {
718
+ g = d.limit || 0;
719
+ k = d.offset || 0;
720
+ m = d.suggest;
721
+ l = d.resolve;
722
+ h = ((p = d.highlight || a.highlight) || d.enrich) && l;
723
+ r = d.queue;
724
+ let t = d.async || r, n = d.index, q = d.query;
725
+ n ? a.index || (a.index = n) : n = a.index;
726
+ if (q || d.tag) {
727
+ const x = d.field || d.pluck;
728
+ x && (!q || a.query && !p || (a.query = q, a.field = x, a.highlight = p), n = n.index.get(x));
729
+ if (r && (u || a.await)) {
730
+ u = 1;
731
+ let v;
732
+ const A = a.C.length, D = new Promise(function(F) {
733
+ v = F;
734
+ });
735
+ (function(F, E) {
736
+ D.h = function() {
737
+ E.index = null;
738
+ E.resolve = false;
739
+ let B = t ? F.searchAsync(E) : F.search(E);
740
+ if (B.then) return B.then(function(z) {
741
+ a.C[A] = z = z.result || z;
742
+ v(z);
743
+ return z;
744
+ });
745
+ B = B.result || B;
746
+ v(B);
747
+ return B;
748
+ };
749
+ })(n, Object.assign({}, d));
750
+ a.C.push(D);
751
+ f[c] = D;
752
+ continue;
753
+ } else d.resolve = false, d.index = null, r = t ? n.searchAsync(d) : n.search(d),
754
+ d.resolve = l, d.index = n;
755
+ } else if (d.and) r = Va(d, "and", n); else if (d.or) r = Va(d, "or", n); else if (d.not) r = Va(d, "not", n); else if (d.xor) r = Va(d, "xor", n); else continue;
756
+ }
757
+ r.await ? (u = 1, r = r.await) : r.then ? (u = 1, r = r.then(function(t) {
758
+ return t.result || t;
759
+ })) : r = r.result || r;
760
+ f[c] = r;
761
+ }
762
+ u && !a.await && (a.await = new Promise(function(t) {
763
+ a.return = t;
764
+ }));
765
+ if (u) {
766
+ const t = Promise.all(f).then(function(n) {
767
+ for (let q = 0; q < a.C.length; q++) if (a.C[q] === t) {
768
+ a.C[q] = function() {
769
+ return b.call(a, n, g, k, h, l, m, p);
770
+ };
771
+ break;
772
+ }
773
+ Wa(a);
774
+ });
775
+ a.C.push(t);
776
+ } else if (a.await) a.C.push(function() {
777
+ return b.call(a, f, g, k, h, l, m, p);
778
+ }); else return b.call(a, f, g, k, h, l, m, p);
779
+ return l ? a.await || a.result : a;
780
+ }
781
+ function Va(a, c, b) {
782
+ a = a[c];
783
+ const e = a[0] || a;
784
+ e.index || (e.index = b);
785
+ b = new X$1(e);
786
+ a.length > 1 && (b = b[c].apply(b, a.slice(1)));
787
+ return b;
788
+ }
789
+ X$1.prototype.or = function() {
790
+ return Ua(this, "or", Xa, arguments);
791
+ };
792
+ function Xa(a, c, b, e, d, f, g) {
793
+ a.length && (this.result.length && a.push(this.result), a.length < 2 ? this.result = a[0] : (this.result = Ya(a, c, b, false, this.h),
794
+ b = 0));
795
+ d && (this.await = null);
796
+ return d ? this.resolve(c, b, e, g) : this;
797
+ }
798
+ X$1.prototype.and = function() {
799
+ return Ua(this, "and", Za, arguments);
800
+ };
801
+ function Za(a, c, b, e, d, f, g) {
802
+ if (!f && !this.result.length) return d ? this.result : this;
803
+ let k;
804
+ if (a.length) {
805
+ if (this.result.length && a.unshift(this.result), a.length < 2) this.result = a[0]; else {
806
+ let h = 0;
807
+ for (let l = 0, m, p; l < a.length; l++) if ((m = a[l]) && (p = m.length)) h < p && (h = p); else if (!f) {
808
+ h = 0;
809
+ break;
810
+ }
811
+ h ? (this.result = $a(a, h, c, b, f, this.h, d), k = true) : this.result = [];
812
+ }
813
+ } else f || (this.result = a);
814
+ d && (this.await = null);
815
+ return d ? this.resolve(c, b, e, g, k) : this;
816
+ }
817
+ X$1.prototype.xor = function() {
818
+ return Ua(this, "xor", ab, arguments);
819
+ };
820
+ function ab(a, c, b, e, d, f, g) {
821
+ if (a.length) {
822
+ if (this.result.length && a.unshift(this.result), a.length < 2) this.result = a[0]; else {
823
+ a: {
824
+ f = b;
825
+ var k = this.h;
826
+ const h = [], l = I$1();
827
+ let m = 0;
828
+ for (let p = 0, u; p < a.length; p++) if (u = a[p]) {
829
+ m < u.length && (m = u.length);
830
+ for (let r = 0, t; r < u.length; r++) if (t = u[r]) for (let n = 0, q; n < t.length; n++) q = t[n],
831
+ l[q] = l[q] ? 2 : 1;
832
+ }
833
+ for (let p = 0, u, r = 0; p < m; p++) for (let t = 0, n; t < a.length; t++) if (n = a[t]) if (u = n[p]) for (let q = 0, x; q < u.length; q++) if (x = u[q],
834
+ l[x] === 1) if (f) f--; else if (d) {
835
+ if (h.push(x), h.length === c) {
836
+ a = h;
837
+ break a;
838
+ }
839
+ } else {
840
+ const v = p + (t ? k : 0);
841
+ h[v] || (h[v] = []);
842
+ h[v].push(x);
843
+ if (++r === c) {
844
+ a = h;
845
+ break a;
846
+ }
847
+ }
848
+ a = h;
849
+ }
850
+ this.result = a;
851
+ k = true;
852
+ }
853
+ } else f || (this.result = a);
854
+ d && (this.await = null);
855
+ return d ? this.resolve(c, b, e, g, k) : this;
856
+ }
857
+ X$1.prototype.not = function() {
858
+ return Ua(this, "not", bb, arguments);
859
+ };
860
+ function bb(a, c, b, e, d, f, g) {
861
+ if (!f && !this.result.length) return d ? this.result : this;
862
+ if (a.length && this.result.length) {
863
+ a: {
864
+ f = b;
865
+ var k = [];
866
+ a = new Set(a.flat().flat());
867
+ for (let h = 0, l, m = 0; h < this.result.length; h++) if (l = this.result[h]) for (let p = 0, u; p < l.length; p++) if (u = l[p],
868
+ !a.has(u)) if (f) f--; else if (d) {
869
+ if (k.push(u), k.length === c) {
870
+ a = k;
871
+ break a;
872
+ }
873
+ } else if (k[h] || (k[h] = []), k[h].push(u), ++m === c) {
874
+ a = k;
875
+ break a;
876
+ }
877
+ a = k;
878
+ }
879
+ this.result = a;
880
+ k = true;
881
+ }
882
+ d && (this.await = null);
883
+ return d ? this.resolve(c, b, e, g, k) : this;
884
+ }
885
+ function cb(a, c, b, e, d) {
886
+ let f, g, k;
887
+ typeof d === "string" ? (f = d, d = "") : f = d.template;
888
+ g = f.indexOf("$1");
889
+ k = f.substring(g + 2);
890
+ g = f.substring(0, g);
891
+ let h = d && d.boundary, l = !d || d.clip !== false, m = d && d.merge && k && g && new RegExp(k + " " + g, "g");
892
+ d = d && d.ellipsis;
893
+ var p = 0;
894
+ if (typeof d === "object") {
895
+ var u = d.template;
896
+ p = u.length - 2;
897
+ d = d.pattern;
898
+ }
899
+ typeof d !== "string" && (d = d === false ? "" : "...");
900
+ p && (d = u.replace("$1", d));
901
+ u = d.length - p;
902
+ let r, t;
903
+ typeof h === "object" && (r = h.before, r === 0 && (r = -1), t = h.after, t === 0 && (t = -1),
904
+ h = h.total || 9e5);
905
+ p = new Map;
906
+ for (let Oa = 0, da, db, pa; Oa < c.length; Oa++) {
907
+ let qa;
908
+ if (e) qa = c, pa = e; else {
909
+ var n = c[Oa];
910
+ pa = n.field;
911
+ if (!pa) continue;
912
+ qa = n.result;
913
+ }
914
+ db = b.get(pa);
915
+ da = db.encoder;
916
+ n = p.get(da);
917
+ typeof n !== "string" && (n = da.encode(a), p.set(da, n));
918
+ for (let ya = 0; ya < qa.length; ya++) {
919
+ var q = qa[ya].doc;
920
+ if (!q) continue;
921
+ q = ca(q, pa);
922
+ if (!q) continue;
923
+ var x = q.trim().split(/\s+/);
924
+ if (!x.length) continue;
925
+ q = "";
926
+ var v = [];
927
+ let za = [];
928
+ var A = -1, D = -1, F = 0;
929
+ for (var E = 0; E < x.length; E++) {
930
+ var B = x[E], z = da.encode(B);
931
+ z = z.length > 1 ? z.join(" ") : z[0];
932
+ let y;
933
+ if (z && B) {
934
+ var C = B.length, J = (da.split ? B.replace(da.split, "") : B).length - z.length, G = "", N = 0;
935
+ for (var O = 0; O < n.length; O++) {
936
+ var P = n[O];
937
+ if (P) {
938
+ var L = P.length;
939
+ L += J < 0 ? 0 : J;
940
+ N && L <= N || (P = z.indexOf(P), P > -1 && (G = (P ? B.substring(0, P) : "") + g + B.substring(P, P + L) + k + (P + L < C ? B.substring(P + L) : ""),
941
+ N = L, y = true));
942
+ }
943
+ }
944
+ G && (h && (A < 0 && (A = q.length + (q ? 1 : 0)), D = q.length + (q ? 1 : 0) + G.length,
945
+ F += C, za.push(v.length), v.push({
946
+ match: G
947
+ })), q += (q ? " " : "") + G);
948
+ }
949
+ if (!y) B = x[E], q += (q ? " " : "") + B, h && v.push({
950
+ text: B
951
+ }); else if (h && F >= h) break;
952
+ }
953
+ F = za.length * (f.length - 2);
954
+ if (r || t || h && q.length - F > h) if (F = h + F - u * 2, E = D - A, r > 0 && (E += r),
955
+ t > 0 && (E += t), E <= F) x = r ? A - (r > 0 ? r : 0) : A - ((F - E) / 2 | 0),
956
+ v = t ? D + (t > 0 ? t : 0) : x + F, l || (x > 0 && q.charAt(x) !== " " && q.charAt(x - 1) !== " " && (x = q.indexOf(" ", x),
957
+ x < 0 && (x = 0)), v < q.length && q.charAt(v - 1) !== " " && q.charAt(v) !== " " && (v = q.lastIndexOf(" ", v),
958
+ v < D ? v = D : ++v)), q = (x ? d : "") + q.substring(x, v) + (v < q.length ? d : ""); else {
959
+ D = [];
960
+ A = {};
961
+ F = {};
962
+ E = {};
963
+ B = {};
964
+ z = {};
965
+ G = J = C = 0;
966
+ for (O = N = 1; ;) {
967
+ var U = void 0;
968
+ for (let y = 0, K; y < za.length; y++) {
969
+ K = za[y];
970
+ if (G) {
971
+ if (J !== G) {
972
+ if (E[y + 1]) continue;
973
+ K += G;
974
+ if (A[K]) {
975
+ C -= u;
976
+ F[y + 1] = 1;
977
+ E[y + 1] = 1;
978
+ continue;
979
+ }
980
+ if (K >= v.length - 1) {
981
+ if (K >= v.length) {
982
+ E[y + 1] = 1;
983
+ K >= x.length && (F[y + 1] = 1);
984
+ continue;
985
+ }
986
+ C -= u;
987
+ }
988
+ q = v[K].text;
989
+ if (L = t && z[y]) if (L > 0) {
990
+ if (q.length > L) if (E[y + 1] = 1, l) q = q.substring(0, L); else continue;
991
+ (L -= q.length) || (L = -1);
992
+ z[y] = L;
993
+ } else {
994
+ E[y + 1] = 1;
995
+ continue;
996
+ }
997
+ if (C + q.length + 1 <= h) q = " " + q, D[y] += q; else if (l) U = h - C - 1, U > 0 && (q = " " + q.substring(0, U),
998
+ D[y] += q), E[y + 1] = 1; else {
999
+ E[y + 1] = 1;
1000
+ continue;
1001
+ }
1002
+ } else {
1003
+ if (E[y]) continue;
1004
+ K -= J;
1005
+ if (A[K]) {
1006
+ C -= u;
1007
+ E[y] = 1;
1008
+ F[y] = 1;
1009
+ continue;
1010
+ }
1011
+ if (K <= 0) {
1012
+ if (K < 0) {
1013
+ E[y] = 1;
1014
+ F[y] = 1;
1015
+ continue;
1016
+ }
1017
+ C -= u;
1018
+ }
1019
+ q = v[K].text;
1020
+ if (L = r && B[y]) if (L > 0) {
1021
+ if (q.length > L) if (E[y] = 1, l) q = q.substring(q.length - L); else continue;
1022
+ (L -= q.length) || (L = -1);
1023
+ B[y] = L;
1024
+ } else {
1025
+ E[y] = 1;
1026
+ continue;
1027
+ }
1028
+ if (C + q.length + 1 <= h) q += " ", D[y] = q + D[y]; else if (l) U = q.length + 1 - (h - C),
1029
+ U >= 0 && U < q.length && (q = q.substring(U) + " ", D[y] = q + D[y]), E[y] = 1; else {
1030
+ E[y] = 1;
1031
+ continue;
1032
+ }
1033
+ }
1034
+ } else {
1035
+ q = v[K].match;
1036
+ r && (B[y] = r);
1037
+ t && (z[y] = t);
1038
+ y && C++;
1039
+ let Pa;
1040
+ K ? !y && u && (C += u) : (F[y] = 1, E[y] = 1);
1041
+ K >= x.length - 1 ? Pa = 1 : K < v.length - 1 && v[K + 1].match ? Pa = 1 : u && (C += u);
1042
+ C -= f.length - 2;
1043
+ if (!y || C + q.length <= h) D[y] = q; else {
1044
+ U = N = O = F[y] = 0;
1045
+ break;
1046
+ }
1047
+ Pa && (F[y + 1] = 1, E[y + 1] = 1);
1048
+ }
1049
+ C += q.length;
1050
+ U = A[K] = 1;
1051
+ }
1052
+ if (U) J === G ? G++ : J++; else {
1053
+ J === G ? N = 0 : O = 0;
1054
+ if (!N && !O) break;
1055
+ N ? (J++, G = J) : G++;
1056
+ }
1057
+ }
1058
+ q = "";
1059
+ for (let y = 0, K; y < D.length; y++) K = (F[y] ? y ? " " : "" : (y && !d ? " " : "") + d) + D[y],
1060
+ q += K;
1061
+ d && !F[D.length] && (q += d);
1062
+ }
1063
+ m && (q = q.replace(m, " "));
1064
+ qa[ya].highlight = q;
1065
+ }
1066
+ if (e) break;
1067
+ }
1068
+ return c;
1069
+ }
1070
+ function X$1(a, c) {
1071
+ if (!this || this.constructor !== X$1) return new X$1(a, c);
1072
+ let b = 0, e, d, f, g, k, h;
1073
+ if (a && a.index) {
1074
+ const l = a;
1075
+ c = l.index;
1076
+ b = l.boost || 0;
1077
+ if (d = l.query) {
1078
+ f = l.field || l.pluck;
1079
+ g = l.highlight;
1080
+ const m = l.resolve;
1081
+ a = l.async || l.queue;
1082
+ l.resolve = false;
1083
+ l.index = null;
1084
+ a = a ? c.searchAsync(l) : c.search(l);
1085
+ l.resolve = m;
1086
+ l.index = c;
1087
+ a = a.result || a;
1088
+ } else a = [];
1089
+ }
1090
+ if (a && a.then) {
1091
+ const l = this;
1092
+ a = a.then(function(m) {
1093
+ l.C[0] = l.result = m.result || m;
1094
+ Wa(l);
1095
+ });
1096
+ e = [ a ];
1097
+ a = [];
1098
+ k = new Promise(function(m) {
1099
+ h = m;
1100
+ });
1101
+ }
1102
+ this.index = c || null;
1103
+ this.result = a || [];
1104
+ this.h = b;
1105
+ this.C = e || [];
1106
+ this.await = k || null;
1107
+ this.return = h || null;
1108
+ this.highlight = g || null;
1109
+ this.query = d || "";
1110
+ this.field = f || "";
1111
+ }
1112
+ w$1 = X$1.prototype;
1113
+ w$1.limit = function(a) {
1114
+ if (this.await) {
1115
+ const c = this;
1116
+ this.C.push(function() {
1117
+ return c.limit(a).result;
1118
+ });
1119
+ } else if (this.result.length) {
1120
+ const c = [];
1121
+ for (let b = 0, e; b < this.result.length; b++) if (e = this.result[b]) if (e.length <= a) {
1122
+ if (c[b] = e, a -= e.length, !a) break;
1123
+ } else {
1124
+ c[b] = e.slice(0, a);
1125
+ break;
1126
+ }
1127
+ this.result = c;
1128
+ }
1129
+ return this;
1130
+ };
1131
+ w$1.offset = function(a) {
1132
+ if (this.await) {
1133
+ const c = this;
1134
+ this.C.push(function() {
1135
+ return c.offset(a).result;
1136
+ });
1137
+ } else if (this.result.length) {
1138
+ const c = [];
1139
+ for (let b = 0, e; b < this.result.length; b++) if (e = this.result[b]) e.length <= a ? a -= e.length : (c[b] = e.slice(a),
1140
+ a = 0);
1141
+ this.result = c;
1142
+ }
1143
+ return this;
1144
+ };
1145
+ w$1.boost = function(a) {
1146
+ if (this.await) {
1147
+ const c = this;
1148
+ this.C.push(function() {
1149
+ return c.boost(a).result;
1150
+ });
1151
+ } else this.h += a;
1152
+ return this;
1153
+ };
1154
+ function Wa(a, c) {
1155
+ let b = a.result;
1156
+ var e = a.await;
1157
+ a.await = null;
1158
+ for (let d = 0, f; d < a.C.length; d++) if (f = a.C[d]) if (typeof f === "function") b = f(),
1159
+ a.C[d] = b = b.result || b, d--; else if (f.h) b = f.h(), a.C[d] = b = b.result || b,
1160
+ d--; else if (f.then) return a.await = e;
1161
+ e = a.return;
1162
+ a.C = [];
1163
+ a.return = null;
1164
+ c || e(b);
1165
+ return b;
1166
+ }
1167
+ w$1.resolve = function(a, c, b, e, d) {
1168
+ let f = this.await ? Wa(this, true) : this.result;
1169
+ if (f.then) {
1170
+ const g = this;
1171
+ return f.then(function() {
1172
+ return g.resolve(a, c, b, e, d);
1173
+ });
1174
+ }
1175
+ f.length && (typeof a === "object" ? (e = a.highlight || this.highlight, b = !!e || a.enrich,
1176
+ c = a.offset, a = a.limit) : (e = e || this.highlight, b = !!e || b), f = d ? b ? Ta.call(this.index, f) : f : Sa.call(this.index, f, a || 100, c, b));
1177
+ return this.finalize(f, e);
1178
+ };
1179
+ w$1.finalize = function(a, c) {
1180
+ if (a.then) {
1181
+ const e = this;
1182
+ return a.then(function(d) {
1183
+ return e.finalize(d, c);
1184
+ });
1185
+ }
1186
+ c && a.length && this.query && (a = cb(this.query, a, this.index.index, this.field, c));
1187
+ const b = this.return;
1188
+ this.highlight = this.index = this.result = this.C = this.await = this.return = null;
1189
+ this.query = this.field = "";
1190
+ b && b(a);
1191
+ return a;
1192
+ };
1193
+ function $a(a, c, b, e, d, f, g) {
1194
+ const k = a.length;
1195
+ let h = [], l, m;
1196
+ l = I$1();
1197
+ for (let p = 0, u, r, t, n; p < c; p++) for (let q = 0; q < k; q++) if (t = a[q],
1198
+ p < t.length && (u = t[p])) for (let x = 0; x < u.length; x++) {
1199
+ r = u[x];
1200
+ (m = l[r]) ? l[r]++ : (m = 0, l[r] = 1);
1201
+ n = h[m] || (h[m] = []);
1202
+ if (!g) {
1203
+ let v = p + (q || !d ? 0 : f || 0);
1204
+ n = n[v] || (n[v] = []);
1205
+ }
1206
+ n.push(r);
1207
+ if (g && b && m === k - 1 && n.length - e === b) return e ? n.slice(e) : n;
1208
+ }
1209
+ if (a = h.length) if (d) h = h.length > 1 ? Ya(h, b, e, g, f) : (h = h[0]) && b && h.length > b || e ? h.slice(e, b + e) : h; else {
1210
+ if (a < k) return [];
1211
+ h = h[a - 1];
1212
+ if (b || e) if (g) {
1213
+ if (h.length > b || e) h = h.slice(e, b + e);
1214
+ } else {
1215
+ d = [];
1216
+ for (let p = 0, u; p < h.length; p++) if (u = h[p]) if (e && u.length > e) e -= u.length; else {
1217
+ if (b && u.length > b || e) u = u.slice(e, b + e), b -= u.length, e && (e -= u.length);
1218
+ d.push(u);
1219
+ if (!b) break;
1220
+ }
1221
+ h = d;
1222
+ }
1223
+ }
1224
+ return h;
1225
+ }
1226
+ function Ya(a, c, b, e, d) {
1227
+ const f = [], g = I$1();
1228
+ let k;
1229
+ var h = a.length;
1230
+ let l;
1231
+ if (e) for (d = h - 1; d >= 0; d--) {
1232
+ if (l = (e = a[d]) && e.length) for (h = 0; h < l; h++) if (k = e[h], !g[k]) if (g[k] = 1,
1233
+ b) b--; else if (f.push(k), f.length === c) return f;
1234
+ } else for (let m = h - 1, p, u = 0; m >= 0; m--) {
1235
+ p = a[m];
1236
+ for (let r = 0; r < p.length; r++) if (l = (e = p[r]) && e.length) for (let t = 0; t < l; t++) if (k = e[t],
1237
+ !g[k]) if (g[k] = 1, b) b--; else {
1238
+ let n = (r + (m < h - 1 ? d || 0 : 0)) / (m + 1) | 0;
1239
+ (f[n] || (f[n] = [])).push(k);
1240
+ if (++u === c) return f;
1241
+ }
1242
+ }
1243
+ return f;
1244
+ }
1245
+ function eb(a, c, b, e, d) {
1246
+ const f = I$1(), g = [];
1247
+ for (let k = 0, h; k < c.length; k++) {
1248
+ h = c[k];
1249
+ for (let l = 0; l < h.length; l++) f[h[l]] = 1;
1250
+ }
1251
+ if (d) for (let k = 0, h; k < a.length; k++) {
1252
+ if (h = a[k], f[h]) if (e) e--; else if (g.push(h), f[h] = 0, b && --b === 0) break;
1253
+ } else for (let k = 0, h, l; k < a.result.length; k++) for (h = a.result[k], c = 0; c < h.length; c++) l = h[c],
1254
+ f[l] && ((g[k] || (g[k] = [])).push(l), f[l] = 0);
1255
+ return g;
1256
+ }
1257
+ Na.prototype.search = function(a, c, b, e) {
1258
+ b || (!c && ba(a) ? (b = a, a = "") : ba(c) && (b = c, c = 0));
1259
+ let d = [];
1260
+ var f = [];
1261
+ let g;
1262
+ let k, h, l, m, p;
1263
+ let u = 0, r = true, t;
1264
+ if (b) {
1265
+ b.constructor === Array && (b = {
1266
+ index: b
1267
+ });
1268
+ a = b.query || a;
1269
+ g = b.pluck;
1270
+ k = b.merge;
1271
+ l = b.boost;
1272
+ p = g || b.field || (p = b.index) && (p.index ? null : p);
1273
+ var n = this.tag && b.tag;
1274
+ h = b.suggest;
1275
+ r = b.resolve !== false;
1276
+ m = b.cache;
1277
+ t = r && this.store && b.highlight;
1278
+ var q = !!t || r && this.store && b.enrich;
1279
+ c = b.limit || c;
1280
+ var x = b.offset || 0;
1281
+ c || (c = r ? 100 : 0);
1282
+ if (n && (!this.db || !e)) {
1283
+ n.constructor !== Array && (n = [ n ]);
1284
+ var v = [];
1285
+ for (let B = 0, z; B < n.length; B++) if (z = n[B], z.field && z.tag) {
1286
+ var A = z.tag;
1287
+ if (A.constructor === Array) for (var D = 0; D < A.length; D++) v.push(z.field, A[D]); else v.push(z.field, A);
1288
+ } else {
1289
+ A = Object.keys(z);
1290
+ for (let C = 0, J, G; C < A.length; C++) if (J = A[C], G = z[J], G.constructor === Array) for (D = 0; D < G.length; D++) v.push(J, G[D]); else v.push(J, G);
1291
+ }
1292
+ n = v;
1293
+ if (!a) {
1294
+ f = [];
1295
+ if (v.length) for (n = 0; n < v.length; n += 2) {
1296
+ if (this.db) {
1297
+ e = this.index.get(v[n]);
1298
+ if (!e) continue;
1299
+ f.push(e = e.db.tag(v[n + 1], c, x, q));
1300
+ } else e = fb.call(this, v[n], v[n + 1], c, x, q);
1301
+ d.push(r ? {
1302
+ field: v[n],
1303
+ tag: v[n + 1],
1304
+ result: e
1305
+ } : [ e ]);
1306
+ }
1307
+ if (f.length) {
1308
+ const B = this;
1309
+ return Promise.all(f).then(function(z) {
1310
+ for (let C = 0; C < z.length; C++) r ? d[C].result = z[C] : d[C] = z[C];
1311
+ return r ? d : new X$1(d.length > 1 ? $a(d, 1, 0, 0, h, l) : d[0], B);
1312
+ });
1313
+ }
1314
+ return r ? d : new X$1(d.length > 1 ? $a(d, 1, 0, 0, h, l) : d[0], this);
1315
+ }
1316
+ }
1317
+ r || g || !(p = p || this.field) || (M$1(p) ? g = p : (p.constructor === Array && p.length === 1 && (p = p[0]),
1318
+ g = p.field || p.index));
1319
+ p && p.constructor !== Array && (p = [ p ]);
1320
+ }
1321
+ p || (p = this.field);
1322
+ let F;
1323
+ v = (this.worker || this.db) && !e && [];
1324
+ for (let B = 0, z, C, J; B < p.length; B++) {
1325
+ C = p[B];
1326
+ if (this.db && this.tag && !this.B[B]) continue;
1327
+ let G;
1328
+ M$1(C) || (G = C, C = G.field, a = G.query || a, c = aa(G.limit, c), x = aa(G.offset, x),
1329
+ h = aa(G.suggest, h), t = r && this.store && aa(G.highlight, t), q = !!t || r && this.store && aa(G.enrich, q),
1330
+ m = aa(G.cache, m));
1331
+ if (e) z = e[B]; else {
1332
+ A = G || b || {};
1333
+ D = A.enrich;
1334
+ var E = this.index.get(C);
1335
+ n && (this.db && (A.tag = n, A.field = p, F = E.db.support_tag_search), !F && D && (A.enrich = false),
1336
+ F || (A.limit = 0, A.offset = 0));
1337
+ z = m ? E.searchCache(a, n && !F ? 0 : c, A) : E.search(a, n && !F ? 0 : c, A);
1338
+ n && !F && (A.limit = c, A.offset = x);
1339
+ D && (A.enrich = D);
1340
+ if (v) {
1341
+ v[B] = z;
1342
+ continue;
1343
+ }
1344
+ }
1345
+ J = (z = z.result || z) && z.length;
1346
+ if (n && J) {
1347
+ A = [];
1348
+ D = 0;
1349
+ if (this.db && e) {
1350
+ if (!F) for (E = p.length; E < e.length; E++) {
1351
+ let N = e[E];
1352
+ if (N && N.length) D++, A.push(N); else if (!h) return r ? d : new X$1(d, this);
1353
+ }
1354
+ } else for (let N = 0, O, P; N < n.length; N += 2) {
1355
+ O = this.tag.get(n[N]);
1356
+ if (!O) if (h) continue; else return r ? d : new X$1(d, this);
1357
+ if (P = (O = O && O.get(n[N + 1])) && O.length) D++, A.push(O); else if (!h) return r ? d : new X$1(d, this);
1358
+ }
1359
+ if (D) {
1360
+ z = eb(z, A, c, x, r);
1361
+ J = z.length;
1362
+ if (!J && !h) return r ? z : new X$1(z, this);
1363
+ D--;
1364
+ }
1365
+ }
1366
+ if (J) f[u] = C, d.push(z), u++; else if (p.length === 1) return r ? d : new X$1(d, this);
1367
+ }
1368
+ if (v) {
1369
+ if (this.db && n && n.length && !F) for (q = 0; q < n.length; q += 2) {
1370
+ f = this.index.get(n[q]);
1371
+ if (!f) if (h) continue; else return r ? d : new X$1(d, this);
1372
+ v.push(f.db.tag(n[q + 1], c, x, false));
1373
+ }
1374
+ const B = this;
1375
+ return Promise.all(v).then(function(z) {
1376
+ b && (b.resolve = r);
1377
+ z.length && (z = B.search(a, c, b, z));
1378
+ return z;
1379
+ });
1380
+ }
1381
+ if (!u) return r ? d : new X$1(d, this);
1382
+ if (g && (!q || !this.store)) return d = d[0], r ? d : new X$1(d, this);
1383
+ v = [];
1384
+ for (x = 0; x < f.length; x++) {
1385
+ n = d[x];
1386
+ q && n.length && typeof n[0].doc === "undefined" && (this.db ? v.push(n = this.index.get(this.field[0]).db.enrich(n)) : n = Ta.call(this, n));
1387
+ if (g) return r ? t ? cb(a, n, this.index, g, t) : n : new X$1(n, this);
1388
+ d[x] = {
1389
+ field: f[x],
1390
+ result: n
1391
+ };
1392
+ }
1393
+ if (q && this.db && v.length) {
1394
+ const B = this;
1395
+ return Promise.all(v).then(function(z) {
1396
+ for (let C = 0; C < z.length; C++) d[C].result = z[C];
1397
+ t && (d = cb(a, d, B.index, g, t));
1398
+ return k ? gb(d) : d;
1399
+ });
1400
+ }
1401
+ t && (d = cb(a, d, this.index, g, t));
1402
+ return k ? gb(d) : d;
1403
+ };
1404
+ function gb(a) {
1405
+ const c = [], b = I$1(), e = I$1();
1406
+ for (let d = 0, f, g, k, h, l, m, p; d < a.length; d++) {
1407
+ f = a[d];
1408
+ g = f.field;
1409
+ k = f.result;
1410
+ for (let u = 0; u < k.length; u++) if (l = k[u], typeof l !== "object" ? l = {
1411
+ id: h = l
1412
+ } : h = l.id, (m = b[h]) ? m.push(g) : (l.field = b[h] = [ g ], c.push(l)), p = l.highlight) m = e[h],
1413
+ m || (e[h] = m = {}, l.highlight = m), m[g] = p;
1414
+ }
1415
+ return c;
1416
+ }
1417
+ function fb(a, c, b, e, d) {
1418
+ a = this.tag.get(a);
1419
+ if (!a) return [];
1420
+ a = a.get(c);
1421
+ if (!a) return [];
1422
+ c = a.length - e;
1423
+ if (c > 0) {
1424
+ if (b && c > b || e) a = a.slice(e, e + b);
1425
+ d && (a = Ta.call(this, a));
1426
+ }
1427
+ return a;
1428
+ }
1429
+ function Ta(a) {
1430
+ if (!this || !this.store) return a;
1431
+ if (this.db) return this.index.get(this.field[0]).db.enrich(a);
1432
+ const c = Array(a.length);
1433
+ for (let b = 0, e; b < a.length; b++) e = a[b], c[b] = {
1434
+ id: e,
1435
+ doc: this.store.get(e)
1436
+ };
1437
+ return c;
1438
+ }
1439
+ function Na(a) {
1440
+ if (!this || this.constructor !== Na) return new Na(a);
1441
+ const c = a.document || a.doc || a;
1442
+ let b, e;
1443
+ this.B = [];
1444
+ this.field = [];
1445
+ this.D = [];
1446
+ this.key = (b = c.key || c.id) && hb(b, this.D) || "id";
1447
+ (e = a.keystore || 0) && (this.keystore = e);
1448
+ this.fastupdate = !!a.fastupdate;
1449
+ this.reg = !this.fastupdate || a.worker || a.db ? e ? new S$1(e) : new Set : e ? new R(e) : new Map;
1450
+ this.h = (b = c.store || null) && b && b !== true && [];
1451
+ this.store = b ? e ? new R(e) : new Map : null;
1452
+ this.cache = (b = a.cache || null) && new ma(b);
1453
+ a.cache = false;
1454
+ this.worker = a.worker || false;
1455
+ this.priority = a.priority || 4;
1456
+ this.index = ib.call(this, a, c);
1457
+ this.tag = null;
1458
+ if (b = c.tag) if (typeof b === "string" && (b = [ b ]), b.length) {
1459
+ this.tag = new Map;
1460
+ this.A = [];
1461
+ this.F = [];
1462
+ for (let d = 0, f, g; d < b.length; d++) {
1463
+ f = b[d];
1464
+ g = f.field || f;
1465
+ if (!g) throw Error("The tag field from the document descriptor is undefined.");
1466
+ f.custom ? this.A[d] = f.custom : (this.A[d] = hb(g, this.D), f.filter && (typeof this.A[d] === "string" && (this.A[d] = new String(this.A[d])),
1467
+ this.A[d].G = f.filter));
1468
+ this.F[d] = g;
1469
+ this.tag.set(g, new Map);
1470
+ }
1471
+ }
1472
+ if (this.worker) {
1473
+ this.fastupdate = false;
1474
+ a = [];
1475
+ for (const d of this.index.values()) d.then && a.push(d);
1476
+ if (a.length) {
1477
+ const d = this;
1478
+ return Promise.all(a).then(function(f) {
1479
+ let g = 0;
1480
+ for (const k of d.index.entries()) {
1481
+ const h = k[0];
1482
+ let l = k[1];
1483
+ l.then && (l = f[g], d.index.set(h, l), g++);
1484
+ }
1485
+ return d;
1486
+ });
1487
+ }
1488
+ } else a.db && (this.fastupdate = false, this.mount(a.db));
1489
+ }
1490
+ w$1 = Na.prototype;
1491
+ w$1.mount = function(a) {
1492
+ let c = this.field;
1493
+ if (this.tag) for (let f = 0, g; f < this.F.length; f++) {
1494
+ g = this.F[f];
1495
+ var b = void 0;
1496
+ this.index.set(g, b = new T$1({}, this.reg));
1497
+ c === this.field && (c = c.slice(0));
1498
+ c.push(g);
1499
+ b.tag = this.tag.get(g);
1500
+ }
1501
+ b = [];
1502
+ const e = {
1503
+ db: a.db,
1504
+ type: a.type,
1505
+ fastupdate: a.fastupdate
1506
+ };
1507
+ for (let f = 0, g, k; f < c.length; f++) {
1508
+ e.field = k = c[f];
1509
+ g = this.index.get(k);
1510
+ const h = new a.constructor(a.id, e);
1511
+ h.id = a.id;
1512
+ b[f] = h.mount(g);
1513
+ g.document = true;
1514
+ f ? g.bypass = true : g.store = this.store;
1515
+ }
1516
+ const d = this;
1517
+ return this.db = Promise.all(b).then(function() {
1518
+ d.db = true;
1519
+ });
1520
+ };
1521
+ w$1.commit = async function() {
1522
+ const a = [];
1523
+ for (const c of this.index.values()) a.push(c.commit());
1524
+ await Promise.all(a);
1525
+ this.reg.clear();
1526
+ };
1527
+ w$1.destroy = function() {
1528
+ const a = [];
1529
+ for (const c of this.index.values()) a.push(c.destroy());
1530
+ return Promise.all(a);
1531
+ };
1532
+ function ib(a, c) {
1533
+ const b = new Map;
1534
+ let e = c.index || c.field || c;
1535
+ M$1(e) && (e = [ e ]);
1536
+ for (let f = 0, g, k; f < e.length; f++) {
1537
+ g = e[f];
1538
+ M$1(g) || (k = g, g = g.field);
1539
+ k = ba(k) ? Object.assign({}, a, k) : a;
1540
+ if (this.worker) {
1541
+ var d = void 0;
1542
+ d = (d = k.encoder) && d.encode ? d : new ka(typeof d === "string" ? va[d] : d || {});
1543
+ d = new La(k, d);
1544
+ b.set(g, d);
1545
+ }
1546
+ this.worker || b.set(g, new T$1(k, this.reg));
1547
+ k.custom ? this.B[f] = k.custom : (this.B[f] = hb(g, this.D), k.filter && (typeof this.B[f] === "string" && (this.B[f] = new String(this.B[f])),
1548
+ this.B[f].G = k.filter));
1549
+ this.field[f] = g;
1550
+ }
1551
+ if (this.h) {
1552
+ a = c.store;
1553
+ M$1(a) && (a = [ a ]);
1554
+ for (let f = 0, g, k; f < a.length; f++) g = a[f], k = g.field || g, g.custom ? (this.h[f] = g.custom,
1555
+ g.custom.O = k) : (this.h[f] = hb(k, this.D), g.filter && (typeof this.h[f] === "string" && (this.h[f] = new String(this.h[f])),
1556
+ this.h[f].G = g.filter));
1557
+ }
1558
+ return b;
1559
+ }
1560
+ function hb(a, c) {
1561
+ const b = a.split(":");
1562
+ let e = 0;
1563
+ for (let d = 0; d < b.length; d++) a = b[d], a[a.length - 1] === "]" && (a = a.substring(0, a.length - 2)) && (c[e] = true),
1564
+ a && (b[e++] = a);
1565
+ e < b.length && (b.length = e);
1566
+ return e > 1 ? b : b[0];
1567
+ }
1568
+ w$1.append = function(a, c) {
1569
+ return this.add(a, c, true);
1570
+ };
1571
+ w$1.update = function(a, c) {
1572
+ return this.remove(a).add(a, c);
1573
+ };
1574
+ w$1.remove = function(a) {
1575
+ ba(a) && (a = ca(a, this.key));
1576
+ for (var c of this.index.values()) c.remove(a, true);
1577
+ if (this.reg.has(a)) {
1578
+ if (this.tag && !this.fastupdate) for (let b of this.tag.values()) for (let e of b) {
1579
+ c = e[0];
1580
+ const d = e[1], f = d.indexOf(a);
1581
+ f > -1 && (d.length > 1 ? d.splice(f, 1) : b.delete(c));
1582
+ }
1583
+ this.store && this.store.delete(a);
1584
+ this.reg.delete(a);
1585
+ }
1586
+ this.cache && this.cache.remove(a);
1587
+ return this;
1588
+ };
1589
+ w$1.clear = function() {
1590
+ const a = [];
1591
+ for (const c of this.index.values()) {
1592
+ const b = c.clear();
1593
+ b.then && a.push(b);
1594
+ }
1595
+ if (this.tag) for (const c of this.tag.values()) c.clear();
1596
+ this.store && this.store.clear();
1597
+ this.cache && this.cache.clear();
1598
+ return a.length ? Promise.all(a) : this;
1599
+ };
1600
+ w$1.contain = function(a) {
1601
+ return this.db ? this.index.get(this.field[0]).db.has(a) : this.reg.has(a);
1602
+ };
1603
+ w$1.cleanup = function() {
1604
+ for (const a of this.index.values()) a.cleanup();
1605
+ return this;
1606
+ };
1607
+ w$1.get = function(a) {
1608
+ return this.db ? this.index.get(this.field[0]).db.enrich(a).then(function(c) {
1609
+ return c[0] && c[0].doc || null;
1610
+ }) : this.store.get(a) || null;
1611
+ };
1612
+ w$1.set = function(a, c) {
1613
+ typeof a === "object" && (c = a, a = ca(c, this.key));
1614
+ this.store.set(a, c);
1615
+ return this;
1616
+ };
1617
+ w$1.searchCache = la;
1618
+ w$1.export = jb;
1619
+ w$1.import = kb;
1620
+ Fa(Na.prototype);
1621
+ function lb(a, c = 0) {
1622
+ let b = [], e = [];
1623
+ c && (c = 25e4 / c * 5e3 | 0);
1624
+ for (const d of a.entries()) e.push(d), e.length === c && (b.push(e), e = []);
1625
+ e.length && b.push(e);
1626
+ return b;
1627
+ }
1628
+ function mb(a, c) {
1629
+ c || (c = new Map);
1630
+ for (let b = 0, e; b < a.length; b++) e = a[b], c.set(e[0], e[1]);
1631
+ return c;
1632
+ }
1633
+ function nb(a, c = 0) {
1634
+ let b = [], e = [];
1635
+ c && (c = 25e4 / c * 1e3 | 0);
1636
+ for (const d of a.entries()) e.push([ d[0], lb(d[1])[0] || [] ]), e.length === c && (b.push(e),
1637
+ e = []);
1638
+ e.length && b.push(e);
1639
+ return b;
1640
+ }
1641
+ function ob(a, c) {
1642
+ c || (c = new Map);
1643
+ for (let b = 0, e, d; b < a.length; b++) e = a[b], d = c.get(e[0]), c.set(e[0], mb(e[1], d));
1644
+ return c;
1645
+ }
1646
+ function pb(a) {
1647
+ let c = [], b = [];
1648
+ for (const e of a.keys()) b.push(e), b.length === 25e4 && (c.push(b), b = []);
1649
+ b.length && c.push(b);
1650
+ return c;
1651
+ }
1652
+ function qb(a, c) {
1653
+ c || (c = new Set);
1654
+ for (let b = 0; b < a.length; b++) c.add(a[b]);
1655
+ return c;
1656
+ }
1657
+ function rb(a, c, b, e, d, f, g = 0) {
1658
+ const k = e && e.constructor === Array;
1659
+ var h = k ? e.shift() : e;
1660
+ if (!h) return this.export(a, c, d, f + 1);
1661
+ if ((h = a((c ? c + "." : "") + (g + 1) + "." + b, JSON.stringify(h))) && h.then) {
1662
+ const l = this;
1663
+ return h.then(function() {
1664
+ return rb.call(l, a, c, b, k ? e : null, d, f, g + 1);
1665
+ });
1666
+ }
1667
+ return rb.call(this, a, c, b, k ? e : null, d, f, g + 1);
1668
+ }
1669
+ function jb(a, c, b = 0, e = 0) {
1670
+ if (b < this.field.length) {
1671
+ const g = this.field[b];
1672
+ if ((c = this.index.get(g).export(a, g, b, e = 1)) && c.then) {
1673
+ const k = this;
1674
+ return c.then(function() {
1675
+ return k.export(a, g, b + 1);
1676
+ });
1677
+ }
1678
+ return this.export(a, g, b + 1);
1679
+ }
1680
+ let d, f;
1681
+ switch (e) {
1682
+ case 0:
1683
+ d = "reg";
1684
+ f = pb(this.reg);
1685
+ c = null;
1686
+ break;
1687
+
1688
+ case 1:
1689
+ d = "tag";
1690
+ f = this.tag && nb(this.tag, this.reg.size);
1691
+ c = null;
1692
+ break;
1693
+
1694
+ case 2:
1695
+ d = "doc";
1696
+ f = this.store && lb(this.store);
1697
+ c = null;
1698
+ break;
1699
+
1700
+ default:
1701
+ return;
1702
+ }
1703
+ return rb.call(this, a, c, d, f || null, b, e);
1704
+ }
1705
+ function kb(a, c) {
1706
+ var b = a.split(".");
1707
+ b[b.length - 1] === "json" && b.pop();
1708
+ const e = b.length > 2 ? b[0] : "";
1709
+ b = b.length > 2 ? b[2] : b[1];
1710
+ if (this.worker && e) return this.index.get(e).import(a);
1711
+ if (c) {
1712
+ typeof c === "string" && (c = JSON.parse(c));
1713
+ if (e) return this.index.get(e).import(b, c);
1714
+ switch (b) {
1715
+ case "reg":
1716
+ this.fastupdate = false;
1717
+ this.reg = qb(c, this.reg);
1718
+ for (let d = 0, f; d < this.field.length; d++) f = this.index.get(this.field[d]),
1719
+ f.fastupdate = false, f.reg = this.reg;
1720
+ if (this.worker) {
1721
+ c = [];
1722
+ for (const d of this.index.values()) c.push(d.import(a));
1723
+ return Promise.all(c);
1724
+ }
1725
+ break;
1726
+
1727
+ case "tag":
1728
+ this.tag = ob(c, this.tag);
1729
+ break;
1730
+
1731
+ case "doc":
1732
+ this.store = mb(c, this.store);
1733
+ }
1734
+ }
1735
+ }
1736
+ function sb(a, c) {
1737
+ let b = "";
1738
+ for (const e of a.entries()) {
1739
+ a = e[0];
1740
+ const d = e[1];
1741
+ let f = "";
1742
+ for (let g = 0, k; g < d.length; g++) {
1743
+ k = d[g] || [ "" ];
1744
+ let h = "";
1745
+ for (let l = 0; l < k.length; l++) h += (h ? "," : "") + (c === "string" ? '"' + k[l] + '"' : k[l]);
1746
+ h = "[" + h + "]";
1747
+ f += (f ? "," : "") + h;
1748
+ }
1749
+ f = '["' + a + '",[' + f + "]]";
1750
+ b += (b ? "," : "") + f;
1751
+ }
1752
+ return b;
1753
+ }
1754
+ T$1.prototype.remove = function(a, c) {
1755
+ const b = this.reg.size && (this.fastupdate ? this.reg.get(a) : this.reg.has(a));
1756
+ if (b) {
1757
+ if (this.fastupdate) for (let e = 0, d, f; e < b.length; e++) {
1758
+ if ((d = b[e]) && (f = d.length)) if (d[f - 1] === a) d.pop(); else {
1759
+ const g = d.indexOf(a);
1760
+ g >= 0 && d.splice(g, 1);
1761
+ }
1762
+ } else tb(this.map, a), this.depth && tb(this.ctx, a);
1763
+ c || this.reg.delete(a);
1764
+ }
1765
+ this.db && (this.commit_task.push({
1766
+ del: a
1767
+ }), this.M && ub(this));
1768
+ this.cache && this.cache.remove(a);
1769
+ return this;
1770
+ };
1771
+ function tb(a, c) {
1772
+ let b = 0;
1773
+ var e = typeof c === "undefined";
1774
+ if (a.constructor === Array) for (let d = 0, f, g, k; d < a.length; d++) {
1775
+ if ((f = a[d]) && f.length) {
1776
+ if (e) return 1;
1777
+ g = f.indexOf(c);
1778
+ if (g >= 0) {
1779
+ if (f.length > 1) return f.splice(g, 1), 1;
1780
+ delete a[d];
1781
+ if (b) return 1;
1782
+ k = 1;
1783
+ } else {
1784
+ if (k) return 1;
1785
+ b++;
1786
+ }
1787
+ }
1788
+ } else for (let d of a.entries()) e = d[0], tb(d[1], c) ? b++ : a.delete(e);
1789
+ return b;
1790
+ }
1791
+ const vb = {
1792
+ memory: {
1793
+ resolution: 1
1794
+ },
1795
+ performance: {
1796
+ resolution: 3,
1797
+ fastupdate: true,
1798
+ context: {
1799
+ depth: 1,
1800
+ resolution: 1
1801
+ }
1802
+ },
1803
+ match: {
1804
+ tokenize: "forward"
1805
+ },
1806
+ score: {
1807
+ resolution: 9,
1808
+ context: {
1809
+ depth: 2,
1810
+ resolution: 3
1811
+ }
1812
+ }
1813
+ };
1814
+ T$1.prototype.add = function(a, c, b, e) {
1815
+ if (c && (a || a === 0)) {
1816
+ if (!e && !b && this.reg.has(a)) return this.update(a, c);
1817
+ e = this.depth;
1818
+ c = this.encoder.encode(c, !e);
1819
+ const l = c.length;
1820
+ if (l) {
1821
+ const m = I$1(), p = I$1(), u = this.resolution;
1822
+ for (let r = 0; r < l; r++) {
1823
+ let t = c[this.rtl ? l - 1 - r : r];
1824
+ var d = t.length;
1825
+ if (d && (e || !p[t])) {
1826
+ var f = this.score ? this.score(c, t, r, null, 0) : wb(u, l, r), g = "";
1827
+ switch (this.tokenize) {
1828
+ case "tolerant":
1829
+ Y(this, p, t, f, a, b);
1830
+ if (d > 2) {
1831
+ for (let n = 1, q, x, v, A; n < d - 1; n++) q = t.charAt(n), x = t.charAt(n + 1),
1832
+ v = t.substring(0, n) + x, A = t.substring(n + 2), g = v + q + A, Y(this, p, g, f, a, b),
1833
+ g = v + A, Y(this, p, g, f, a, b);
1834
+ Y(this, p, t.substring(0, t.length - 1), f, a, b);
1835
+ }
1836
+ break;
1837
+
1838
+ case "full":
1839
+ if (d > 2) {
1840
+ for (let n = 0, q; n < d; n++) for (f = d; f > n; f--) {
1841
+ g = t.substring(n, f);
1842
+ q = this.rtl ? d - 1 - n : n;
1843
+ var k = this.score ? this.score(c, t, r, g, q) : wb(u, l, r, d, q);
1844
+ Y(this, p, g, k, a, b);
1845
+ }
1846
+ break;
1847
+ }
1848
+
1849
+ case "bidirectional":
1850
+ case "reverse":
1851
+ if (d > 1) {
1852
+ for (k = d - 1; k > 0; k--) {
1853
+ g = t[this.rtl ? d - 1 - k : k] + g;
1854
+ var h = this.score ? this.score(c, t, r, g, k) : wb(u, l, r, d, k);
1855
+ Y(this, p, g, h, a, b);
1856
+ }
1857
+ g = "";
1858
+ }
1859
+
1860
+ case "forward":
1861
+ if (d > 1) {
1862
+ for (k = 0; k < d; k++) g += t[this.rtl ? d - 1 - k : k], Y(this, p, g, f, a, b);
1863
+ break;
1864
+ }
1865
+
1866
+ default:
1867
+ if (Y(this, p, t, f, a, b), e && l > 1 && r < l - 1) for (d = this.N, g = t, f = Math.min(e + 1, this.rtl ? r + 1 : l - r),
1868
+ k = 1; k < f; k++) {
1869
+ t = c[this.rtl ? l - 1 - r - k : r + k];
1870
+ h = this.bidirectional && t > g;
1871
+ const n = this.score ? this.score(c, g, r, t, k - 1) : wb(d + (l / 2 > d ? 0 : 1), l, r, f - 1, k - 1);
1872
+ Y(this, m, h ? g : t, n, a, b, h ? t : g);
1873
+ }
1874
+ }
1875
+ }
1876
+ }
1877
+ this.fastupdate || this.reg.add(a);
1878
+ }
1879
+ }
1880
+ this.db && (this.commit_task.push(b ? {
1881
+ ins: a
1882
+ } : {
1883
+ del: a
1884
+ }), this.M && ub(this));
1885
+ return this;
1886
+ };
1887
+ function Y(a, c, b, e, d, f, g) {
1888
+ let k, h;
1889
+ if (!(k = c[b]) || g && !k[g]) {
1890
+ g ? (c = k || (c[b] = I$1()), c[g] = 1, h = a.ctx, (k = h.get(g)) ? h = k : h.set(g, h = a.keystore ? new R(a.keystore) : new Map)) : (h = a.map,
1891
+ c[b] = 1);
1892
+ (k = h.get(b)) ? h = k : h.set(b, h = k = []);
1893
+ if (f) for (let l = 0, m; l < k.length; l++) if ((m = k[l]) && m.includes(d)) {
1894
+ if (l <= e) return;
1895
+ m.splice(m.indexOf(d), 1);
1896
+ a.fastupdate && (c = a.reg.get(d)) && c.splice(c.indexOf(m), 1);
1897
+ break;
1898
+ }
1899
+ h = h[e] || (h[e] = []);
1900
+ h.push(d);
1901
+ if (h.length === 2 ** 31 - 1) {
1902
+ c = new xa(h);
1903
+ if (a.fastupdate) for (let l of a.reg.values()) l.includes(h) && (l[l.indexOf(h)] = c);
1904
+ k[e] = h = c;
1905
+ }
1906
+ a.fastupdate && ((e = a.reg.get(d)) ? e.push(h) : a.reg.set(d, [ h ]));
1907
+ }
1908
+ }
1909
+ function wb(a, c, b, e, d) {
1910
+ return b && a > 1 ? c + (e || 0) <= a ? b + (d || 0) : (a - 1) / (c + (e || 0)) * (b + (d || 0)) + 1 | 0 : 0;
1911
+ }
1912
+ T$1.prototype.search = function(a, c, b) {
1913
+ b || (c || typeof a !== "object" ? typeof c === "object" && (b = c, c = 0) : (b = a,
1914
+ a = ""));
1915
+ if (b && b.cache) return b.cache = false, a = this.searchCache(a, c, b), b.cache = true,
1916
+ a;
1917
+ let e = [], d, f, g, k = 0, h, l, m, p, u;
1918
+ b && (a = b.query || a, c = b.limit || c, k = b.offset || 0, f = b.context, g = b.suggest,
1919
+ u = (h = b.resolve) && b.enrich, m = b.boost, p = b.resolution, l = this.db && b.tag);
1920
+ typeof h === "undefined" && (h = this.resolve);
1921
+ f = this.depth && f !== false;
1922
+ let r = this.encoder.encode(a, !f);
1923
+ d = r.length;
1924
+ c = c || (h ? 100 : 0);
1925
+ if (d === 1) return xb.call(this, r[0], "", c, k, h, u, l);
1926
+ if (d === 2 && f && !g) return xb.call(this, r[1], r[0], c, k, h, u, l);
1927
+ let t = I$1(), n = 0, q;
1928
+ f && (q = r[0], n = 1);
1929
+ p || p === 0 || (p = q ? this.N : this.resolution);
1930
+ if (this.db) {
1931
+ if (this.db.search && (b = this.db.search(this, r, c, k, g, h, u, l), b !== false)) return b;
1932
+ const x = this;
1933
+ return async function() {
1934
+ for (let v, A; n < d; n++) {
1935
+ if ((A = r[n]) && !t[A]) {
1936
+ t[A] = 1;
1937
+ v = await yb(x, A, q, 0, 0, false, false);
1938
+ if (v = zb(v, e, g, p)) {
1939
+ e = v;
1940
+ break;
1941
+ }
1942
+ q && (g && v && e.length || (q = A));
1943
+ }
1944
+ g && q && n === d - 1 && !e.length && (p = x.resolution, q = "", n = -1, t = I$1());
1945
+ }
1946
+ return Ab(e, p, c, k, g, m, h);
1947
+ }();
1948
+ }
1949
+ for (let x, v; n < d; n++) {
1950
+ if ((v = r[n]) && !t[v]) {
1951
+ t[v] = 1;
1952
+ x = yb(this, v, q, 0, 0, false, false);
1953
+ if (x = zb(x, e, g, p)) {
1954
+ e = x;
1955
+ break;
1956
+ }
1957
+ q && (g && x && e.length || (q = v));
1958
+ }
1959
+ g && q && n === d - 1 && !e.length && (p = this.resolution, q = "", n = -1, t = I$1());
1960
+ }
1961
+ return Ab(e, p, c, k, g, m, h);
1962
+ };
1963
+ function Ab(a, c, b, e, d, f, g) {
1964
+ let k = a.length, h = a;
1965
+ if (k > 1) h = $a(a, c, b, e, d, f, g); else if (k === 1) return g ? Sa.call(null, a[0], b, e) : new X$1(a[0], this);
1966
+ return g ? h : new X$1(h, this);
1967
+ }
1968
+ function xb(a, c, b, e, d, f, g) {
1969
+ a = yb(this, a, c, b, e, d, f, g);
1970
+ return this.db ? a.then(function(k) {
1971
+ return d ? k || [] : new X$1(k, this);
1972
+ }) : a && a.length ? d ? Sa.call(this, a, b, e) : new X$1(a, this) : d ? [] : new X$1([], this);
1973
+ }
1974
+ function zb(a, c, b, e) {
1975
+ let d = [];
1976
+ if (a && a.length) {
1977
+ if (a.length <= e) {
1978
+ c.push(a);
1979
+ return;
1980
+ }
1981
+ for (let f = 0, g; f < e; f++) if (g = a[f]) d[f] = g;
1982
+ if (d.length) {
1983
+ c.push(d);
1984
+ return;
1985
+ }
1986
+ }
1987
+ if (!b) return d;
1988
+ }
1989
+ function yb(a, c, b, e, d, f, g, k) {
1990
+ let h;
1991
+ b && (h = a.bidirectional && c > b) && (h = b, b = c, c = h);
1992
+ if (a.db) return a.db.get(c, b, e, d, f, g, k);
1993
+ a = b ? (a = a.ctx.get(b)) && a.get(c) : a.map.get(c);
1994
+ return a;
1995
+ }
1996
+ function T$1(a, c) {
1997
+ if (!this || this.constructor !== T$1) return new T$1(a);
1998
+ if (a) {
1999
+ var b = M$1(a) ? a : a.preset;
2000
+ b && (a = Object.assign({}, vb[b], a));
2001
+ } else a = {};
2002
+ b = a.context;
2003
+ const e = b === true ? {
2004
+ depth: 1
2005
+ } : b || {}, d = M$1(a.encoder) ? va[a.encoder] : a.encode || a.encoder || {};
2006
+ this.encoder = d.encode ? d : typeof d === "object" ? new ka(d) : {
2007
+ encode: d
2008
+ };
2009
+ this.resolution = a.resolution || 9;
2010
+ this.tokenize = b = (b = a.tokenize) && b !== "default" && b !== "exact" && b || "strict";
2011
+ this.depth = b === "strict" && e.depth || 0;
2012
+ this.bidirectional = e.bidirectional !== false;
2013
+ this.fastupdate = !!a.fastupdate;
2014
+ this.score = a.score || null;
2015
+ (b = a.keystore || 0) && (this.keystore = b);
2016
+ this.map = b ? new R(b) : new Map;
2017
+ this.ctx = b ? new R(b) : new Map;
2018
+ this.reg = c || (this.fastupdate ? b ? new R(b) : new Map : b ? new S$1(b) : new Set);
2019
+ this.N = e.resolution || 3;
2020
+ this.rtl = d.rtl || a.rtl || false;
2021
+ this.cache = (b = a.cache || null) && new ma(b);
2022
+ this.resolve = a.resolve !== false;
2023
+ if (b = a.db) this.db = this.mount(b);
2024
+ this.M = a.commit !== false;
2025
+ this.commit_task = [];
2026
+ this.commit_timer = null;
2027
+ this.priority = a.priority || 4;
2028
+ }
2029
+ w$1 = T$1.prototype;
2030
+ w$1.mount = function(a) {
2031
+ this.commit_timer && (clearTimeout(this.commit_timer), this.commit_timer = null);
2032
+ return a.mount(this);
2033
+ };
2034
+ w$1.commit = function() {
2035
+ this.commit_timer && (clearTimeout(this.commit_timer), this.commit_timer = null);
2036
+ return this.db.commit(this);
2037
+ };
2038
+ w$1.destroy = function() {
2039
+ this.commit_timer && (clearTimeout(this.commit_timer), this.commit_timer = null);
2040
+ return this.db.destroy();
2041
+ };
2042
+ function ub(a) {
2043
+ a.commit_timer || (a.commit_timer = setTimeout(function() {
2044
+ a.commit_timer = null;
2045
+ a.db.commit(a);
2046
+ }, 1));
2047
+ }
2048
+ w$1.clear = function() {
2049
+ this.map.clear();
2050
+ this.ctx.clear();
2051
+ this.reg.clear();
2052
+ this.cache && this.cache.clear();
2053
+ return this.db ? (this.commit_timer && clearTimeout(this.commit_timer), this.commit_timer = null,
2054
+ this.commit_task = [], this.db.clear()) : this;
2055
+ };
2056
+ w$1.append = function(a, c) {
2057
+ return this.add(a, c, true);
2058
+ };
2059
+ w$1.contain = function(a) {
2060
+ return this.db ? this.db.has(a) : this.reg.has(a);
2061
+ };
2062
+ w$1.update = function(a, c) {
2063
+ const b = this, e = this.remove(a);
2064
+ return e && e.then ? e.then(() => b.add(a, c)) : this.add(a, c);
2065
+ };
2066
+ w$1.cleanup = function() {
2067
+ if (!this.fastupdate) return this;
2068
+ tb(this.map);
2069
+ this.depth && tb(this.ctx);
2070
+ return this;
2071
+ };
2072
+ w$1.searchCache = la;
2073
+ w$1.export = function(a, c, b = 0, e = 0) {
2074
+ let d, f;
2075
+ switch (e) {
2076
+ case 0:
2077
+ d = "reg";
2078
+ f = pb(this.reg);
2079
+ break;
2080
+
2081
+ case 1:
2082
+ d = "cfg";
2083
+ f = null;
2084
+ break;
2085
+
2086
+ case 2:
2087
+ d = "map";
2088
+ f = lb(this.map, this.reg.size);
2089
+ break;
2090
+
2091
+ case 3:
2092
+ d = "ctx";
2093
+ f = nb(this.ctx, this.reg.size);
2094
+ break;
2095
+
2096
+ default:
2097
+ return;
2098
+ }
2099
+ return rb.call(this, a, c, d, f, b, e);
2100
+ };
2101
+ w$1.import = function(a, c) {
2102
+ if (c) switch (typeof c === "string" && (c = JSON.parse(c)), a = a.split("."), a[a.length - 1] === "json" && a.pop(),
2103
+ a.length === 3 && a.shift(), a = a.length > 1 ? a[1] : a[0], a) {
2104
+ case "reg":
2105
+ this.fastupdate = false;
2106
+ this.reg = qb(c, this.reg);
2107
+ break;
2108
+
2109
+ case "map":
2110
+ this.map = mb(c, this.map);
2111
+ break;
2112
+
2113
+ case "ctx":
2114
+ this.ctx = ob(c, this.ctx);
2115
+ }
2116
+ };
2117
+ w$1.serialize = function(a = true) {
2118
+ let c = "", b = "", e = "";
2119
+ if (this.reg.size) {
2120
+ let f;
2121
+ for (var d of this.reg.keys()) f || (f = typeof d), c += (c ? "," : "") + (f === "string" ? '"' + d + '"' : d);
2122
+ c = "index.reg=new Set([" + c + "]);";
2123
+ b = sb(this.map, f);
2124
+ b = "index.map=new Map([" + b + "]);";
2125
+ for (const g of this.ctx.entries()) {
2126
+ d = g[0];
2127
+ let k = sb(g[1], f);
2128
+ k = "new Map([" + k + "])";
2129
+ k = '["' + d + '",' + k + "]";
2130
+ e += (e ? "," : "") + k;
2131
+ }
2132
+ e = "index.ctx=new Map([" + e + "]);";
2133
+ }
2134
+ return a ? "function inject(index){" + c + b + e + "}" : c + b + e;
2135
+ };
2136
+ Fa(T$1.prototype);
2137
+ const Bb = typeof window !== "undefined" && (window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB), Cb = [ "map", "ctx", "tag", "reg", "cfg" ], Db = I$1();
2138
+ function Eb(a, c = {}) {
2139
+ if (!this || this.constructor !== Eb) return new Eb(a, c);
2140
+ typeof a === "object" && (c = a, a = a.name);
2141
+ a || console.info("Default storage space was used, because a name was not passed.");
2142
+ this.id = "flexsearch" + (a ? ":" + a.toLowerCase().replace(/[^a-z0-9_\-]/g, "") : "");
2143
+ this.field = c.field ? c.field.toLowerCase().replace(/[^a-z0-9_\-]/g, "") : "";
2144
+ this.type = c.type;
2145
+ this.fastupdate = this.support_tag_search = false;
2146
+ this.db = null;
2147
+ this.h = {};
2148
+ }
2149
+ w$1 = Eb.prototype;
2150
+ w$1.mount = function(a) {
2151
+ if (a.index) return a.mount(this);
2152
+ a.db = this;
2153
+ return this.open();
2154
+ };
2155
+ w$1.open = function() {
2156
+ if (this.db) return this.db;
2157
+ let a = this;
2158
+ navigator.storage && navigator.storage.persist && navigator.storage.persist();
2159
+ Db[a.id] || (Db[a.id] = []);
2160
+ Db[a.id].push(a.field);
2161
+ const c = Bb.open(a.id, 1);
2162
+ c.onupgradeneeded = function() {
2163
+ const b = a.db = this.result;
2164
+ for (let e = 0, d; e < Cb.length; e++) {
2165
+ d = Cb[e];
2166
+ for (let f = 0, g; f < Db[a.id].length; f++) g = Db[a.id][f], b.objectStoreNames.contains(d + (d !== "reg" ? g ? ":" + g : "" : "")) || b.createObjectStore(d + (d !== "reg" ? g ? ":" + g : "" : ""));
2167
+ }
2168
+ };
2169
+ return a.db = Z$1(c, function(b) {
2170
+ a.db = b;
2171
+ a.db.onversionchange = function() {
2172
+ a.close();
2173
+ };
2174
+ });
2175
+ };
2176
+ w$1.close = function() {
2177
+ this.db && this.db.close();
2178
+ this.db = null;
2179
+ };
2180
+ w$1.destroy = function() {
2181
+ const a = Bb.deleteDatabase(this.id);
2182
+ return Z$1(a);
2183
+ };
2184
+ w$1.clear = function() {
2185
+ const a = [];
2186
+ for (let b = 0, e; b < Cb.length; b++) {
2187
+ e = Cb[b];
2188
+ for (let d = 0, f; d < Db[this.id].length; d++) f = Db[this.id][d], a.push(e + (e !== "reg" ? f ? ":" + f : "" : ""));
2189
+ }
2190
+ const c = this.db.transaction(a, "readwrite");
2191
+ for (let b = 0; b < a.length; b++) c.objectStore(a[b]).clear();
2192
+ return Z$1(c);
2193
+ };
2194
+ w$1.get = function(a, c, b = 0, e = 0, d = true, f = false) {
2195
+ a = this.db.transaction((c ? "ctx" : "map") + (this.field ? ":" + this.field : ""), "readonly").objectStore((c ? "ctx" : "map") + (this.field ? ":" + this.field : "")).get(c ? c + ":" + a : a);
2196
+ const g = this;
2197
+ return Z$1(a).then(function(k) {
2198
+ let h = [];
2199
+ if (!k || !k.length) return h;
2200
+ if (d) {
2201
+ if (!b && !e && k.length === 1) return k[0];
2202
+ for (let l = 0, m; l < k.length; l++) if ((m = k[l]) && m.length) {
2203
+ if (e >= m.length) {
2204
+ e -= m.length;
2205
+ continue;
2206
+ }
2207
+ const p = b ? e + Math.min(m.length - e, b) : m.length;
2208
+ for (let u = e; u < p; u++) h.push(m[u]);
2209
+ e = 0;
2210
+ if (h.length === b) break;
2211
+ }
2212
+ return f ? g.enrich(h) : h;
2213
+ }
2214
+ return k;
2215
+ });
2216
+ };
2217
+ w$1.tag = function(a, c = 0, b = 0, e = false) {
2218
+ a = this.db.transaction("tag" + (this.field ? ":" + this.field : ""), "readonly").objectStore("tag" + (this.field ? ":" + this.field : "")).get(a);
2219
+ const d = this;
2220
+ return Z$1(a).then(function(f) {
2221
+ if (!f || !f.length || b >= f.length) return [];
2222
+ if (!c && !b) return f;
2223
+ f = f.slice(b, b + c);
2224
+ return e ? d.enrich(f) : f;
2225
+ });
2226
+ };
2227
+ w$1.enrich = function(a) {
2228
+ typeof a !== "object" && (a = [ a ]);
2229
+ const c = this.db.transaction("reg", "readonly").objectStore("reg"), b = [];
2230
+ for (let e = 0; e < a.length; e++) b[e] = Z$1(c.get(a[e]));
2231
+ return Promise.all(b).then(function(e) {
2232
+ for (let d = 0; d < e.length; d++) e[d] = {
2233
+ id: a[d],
2234
+ doc: e[d] ? JSON.parse(e[d]) : null
2235
+ };
2236
+ return e;
2237
+ });
2238
+ };
2239
+ w$1.has = function(a) {
2240
+ a = this.db.transaction("reg", "readonly").objectStore("reg").getKey(a);
2241
+ return Z$1(a).then(function(c) {
2242
+ return !!c;
2243
+ });
2244
+ };
2245
+ w$1.search = null;
2246
+ w$1.info = function() {};
2247
+ w$1.transaction = function(a, c, b) {
2248
+ a += a !== "reg" ? this.field ? ":" + this.field : "" : "";
2249
+ let e = this.h[a + ":" + c];
2250
+ if (e) return b.call(this, e);
2251
+ let d = this.db.transaction(a, c);
2252
+ this.h[a + ":" + c] = e = d.objectStore(a);
2253
+ const f = b.call(this, e);
2254
+ this.h[a + ":" + c] = null;
2255
+ return Z$1(d).finally(function() {
2256
+ return f;
2257
+ });
2258
+ };
2259
+ w$1.commit = async function(a) {
2260
+ let c = a.commit_task, b = [];
2261
+ a.commit_task = [];
2262
+ for (let e = 0, d; e < c.length; e++) d = c[e], d.del && b.push(d.del);
2263
+ b.length && await this.remove(b);
2264
+ a.reg.size && (await this.transaction("map", "readwrite", function(e) {
2265
+ for (const d of a.map) {
2266
+ const f = d[0], g = d[1];
2267
+ g.length && (e.get(f).onsuccess = function() {
2268
+ let k = this.result;
2269
+ var h;
2270
+ if (k && k.length) {
2271
+ const l = Math.max(k.length, g.length);
2272
+ for (let m = 0, p, u; m < l; m++) if ((u = g[m]) && u.length) {
2273
+ if ((p = k[m]) && p.length) for (h = 0; h < u.length; h++) p.push(u[h]); else k[m] = u;
2274
+ h = 1;
2275
+ }
2276
+ } else k = g, h = 1;
2277
+ h && e.put(k, f);
2278
+ });
2279
+ }
2280
+ }), await this.transaction("ctx", "readwrite", function(e) {
2281
+ for (const d of a.ctx) {
2282
+ const f = d[0], g = d[1];
2283
+ for (const k of g) {
2284
+ const h = k[0], l = k[1];
2285
+ l.length && (e.get(f + ":" + h).onsuccess = function() {
2286
+ let m = this.result;
2287
+ var p;
2288
+ if (m && m.length) {
2289
+ const u = Math.max(m.length, l.length);
2290
+ for (let r = 0, t, n; r < u; r++) if ((n = l[r]) && n.length) {
2291
+ if ((t = m[r]) && t.length) for (p = 0; p < n.length; p++) t.push(n[p]); else m[r] = n;
2292
+ p = 1;
2293
+ }
2294
+ } else m = l, p = 1;
2295
+ p && e.put(m, f + ":" + h);
2296
+ });
2297
+ }
2298
+ }
2299
+ }), a.store ? await this.transaction("reg", "readwrite", function(e) {
2300
+ for (const d of a.store) {
2301
+ const f = d[0], g = d[1];
2302
+ e.put(typeof g === "object" ? JSON.stringify(g) : 1, f);
2303
+ }
2304
+ }) : a.bypass || await this.transaction("reg", "readwrite", function(e) {
2305
+ for (const d of a.reg.keys()) e.put(1, d);
2306
+ }), a.tag && await this.transaction("tag", "readwrite", function(e) {
2307
+ for (const d of a.tag) {
2308
+ const f = d[0], g = d[1];
2309
+ g.length && (e.get(f).onsuccess = function() {
2310
+ let k = this.result;
2311
+ k = k && k.length ? k.concat(g) : g;
2312
+ e.put(k, f);
2313
+ });
2314
+ }
2315
+ }), a.map.clear(), a.ctx.clear(), a.tag && a.tag.clear(), a.store && a.store.clear(),
2316
+ a.document || a.reg.clear());
2317
+ };
2318
+ function Fb(a, c, b) {
2319
+ const e = a.value;
2320
+ let d, f = 0;
2321
+ for (let g = 0, k; g < e.length; g++) {
2322
+ if (k = b ? e : e[g]) {
2323
+ for (let h = 0, l, m; h < c.length; h++) if (m = c[h], l = k.indexOf(m), l >= 0) if (d = 1,
2324
+ k.length > 1) k.splice(l, 1); else {
2325
+ e[g] = [];
2326
+ break;
2327
+ }
2328
+ f += k.length;
2329
+ }
2330
+ if (b) break;
2331
+ }
2332
+ f ? d && a.update(e) : a.delete();
2333
+ a.continue();
2334
+ }
2335
+ w$1.remove = function(a) {
2336
+ typeof a !== "object" && (a = [ a ]);
2337
+ return Promise.all([ this.transaction("map", "readwrite", function(c) {
2338
+ c.openCursor().onsuccess = function() {
2339
+ const b = this.result;
2340
+ b && Fb(b, a);
2341
+ };
2342
+ }), this.transaction("ctx", "readwrite", function(c) {
2343
+ c.openCursor().onsuccess = function() {
2344
+ const b = this.result;
2345
+ b && Fb(b, a);
2346
+ };
2347
+ }), this.transaction("tag", "readwrite", function(c) {
2348
+ c.openCursor().onsuccess = function() {
2349
+ const b = this.result;
2350
+ b && Fb(b, a, true);
2351
+ };
2352
+ }), this.transaction("reg", "readwrite", function(c) {
2353
+ for (let b = 0; b < a.length; b++) c.delete(a[b]);
2354
+ }) ]);
2355
+ };
2356
+ function Z$1(a, c) {
2357
+ return new Promise((b, e) => {
2358
+ a.onsuccess = a.oncomplete = function() {
2359
+ c && c(this.result);
2360
+ c = null;
2361
+ b(this.result);
2362
+ };
2363
+ a.onerror = a.onblocked = e;
2364
+ a = null;
2365
+ });
2366
+ }
2367
+ var FlexSearch = {
2368
+ Document: Na,
2369
+ IndexedDB: Eb
2370
+ };
2371
+ function getAndRemoveConfig(str = "") {
2372
+ const config = {};
2373
+ if (str) {
2374
+ str = str.replace(/^('|")/, "").replace(/('|")$/, "").replace(/(?:^|\s):([\w-]+:?)=?([\w-%]+)?/g, (m, key, value) => {
2375
+ if (key.indexOf(":") !== -1) {
2376
+ return m;
2377
+ }
2378
+ value = value && value.replace(/&quot;/g, "") || true;
2379
+ if (value !== true && config[key] !== undefined) {
2380
+ if (!Array.isArray(config[key]) && value !== config[key]) {
2381
+ config[key] = [ config[key] ];
2382
+ }
2383
+ config[key].includes(value) || config[key].push(value);
2384
+ } else {
2385
+ config[key] = value;
2386
+ }
2387
+ return "";
2388
+ }).trim();
2389
+ }
2390
+ return {
2391
+ str: str,
2392
+ config: config
2393
+ };
2394
+ }
2395
+ function removeAtag(str = "") {
2396
+ return str.replace(/(<\/?a.*?>)/gi, "");
2397
+ }
2398
+ function getAndRemoveDocsifyIgnoreConfig(content = "") {
2399
+ let ignoreAllSubs, ignoreSubHeading;
2400
+ if (/<!-- {docsify-ignore} -->/g.test(content)) {
2401
+ content = content.replace("\x3c!-- {docsify-ignore} --\x3e", "");
2402
+ ignoreSubHeading = true;
2403
+ }
2404
+ if (/{docsify-ignore}/g.test(content)) {
2405
+ content = content.replace("{docsify-ignore}", "");
2406
+ ignoreSubHeading = true;
2407
+ }
2408
+ if (/<!-- {docsify-ignore-all} -->/g.test(content)) {
2409
+ content = content.replace("\x3c!-- {docsify-ignore-all} --\x3e", "");
2410
+ ignoreAllSubs = true;
2411
+ }
2412
+ if (/{docsify-ignore-all}/g.test(content)) {
2413
+ content = content.replace("{docsify-ignore-all}", "");
2414
+ ignoreAllSubs = true;
2415
+ }
2416
+ return {
2417
+ content: content,
2418
+ ignoreAllSubs: ignoreAllSubs,
2419
+ ignoreSubHeading: ignoreSubHeading
2420
+ };
2421
+ }
2422
+ function L() {
2423
+ return {
2424
+ async: false,
2425
+ breaks: false,
2426
+ extensions: null,
2427
+ gfm: true,
2428
+ hooks: null,
2429
+ pedantic: false,
2430
+ renderer: null,
2431
+ silent: false,
2432
+ tokenizer: null,
2433
+ walkTokens: null
2434
+ };
2435
+ }
2436
+ var T = L();
2437
+ function Z(u) {
2438
+ T = u;
2439
+ }
2440
+ var C = {
2441
+ exec: () => null
2442
+ };
2443
+ function k(u, e = "") {
2444
+ let t = typeof u == "string" ? u : u.source, n = {
2445
+ replace: (r, i) => {
2446
+ let s = typeof i == "string" ? i : i.source;
2447
+ return s = s.replace(m.caret, "$1"), t = t.replace(r, s), n;
2448
+ },
2449
+ getRegex: () => new RegExp(t, e)
2450
+ };
2451
+ return n;
2452
+ }
2453
+ var me = (() => {
2454
+ try {
2455
+ return !!new RegExp("(?<=1)(?<!1)");
2456
+ } catch {
2457
+ return false;
2458
+ }
2459
+ })(), m = {
2460
+ codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm,
2461
+ outputLinkReplace: /\\([\[\]])/g,
2462
+ indentCodeCompensation: /^(\s+)(?:```)/,
2463
+ beginningSpace: /^\s+/,
2464
+ endingHash: /#$/,
2465
+ startingSpaceChar: /^ /,
2466
+ endingSpaceChar: / $/,
2467
+ nonSpaceChar: /[^ ]/,
2468
+ newLineCharGlobal: /\n/g,
2469
+ tabCharGlobal: /\t/g,
2470
+ multipleSpaceGlobal: /\s+/g,
2471
+ blankLine: /^[ \t]*$/,
2472
+ doubleBlankLine: /\n[ \t]*\n[ \t]*$/,
2473
+ blockquoteStart: /^ {0,3}>/,
2474
+ blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g,
2475
+ blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm,
2476
+ listReplaceTabs: /^\t+/,
2477
+ listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g,
2478
+ listIsTask: /^\[[ xX]\] +\S/,
2479
+ listReplaceTask: /^\[[ xX]\] +/,
2480
+ listTaskCheckbox: /\[[ xX]\]/,
2481
+ anyLine: /\n.*\n/,
2482
+ hrefBrackets: /^<(.*)>$/,
2483
+ tableDelimiter: /[:|]/,
2484
+ tableAlignChars: /^\||\| *$/g,
2485
+ tableRowBlankLine: /\n[ \t]*$/,
2486
+ tableAlignRight: /^ *-+: *$/,
2487
+ tableAlignCenter: /^ *:-+: *$/,
2488
+ tableAlignLeft: /^ *:-+ *$/,
2489
+ startATag: /^<a /i,
2490
+ endATag: /^<\/a>/i,
2491
+ startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i,
2492
+ endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i,
2493
+ startAngleBracket: /^</,
2494
+ endAngleBracket: />$/,
2495
+ pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/,
2496
+ unicodeAlphaNumeric: /[\p{L}\p{N}]/u,
2497
+ escapeTest: /[&<>"']/,
2498
+ escapeReplace: /[&<>"']/g,
2499
+ escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,
2500
+ escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,
2501
+ unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,
2502
+ caret: /(^|[^\[])\^/g,
2503
+ percentDecode: /%25/g,
2504
+ findPipe: /\|/g,
2505
+ splitPipe: / \|/,
2506
+ slashPipe: /\\\|/g,
2507
+ carriageReturn: /\r\n|\r/g,
2508
+ spaceLine: /^ +$/gm,
2509
+ notSpaceStart: /^\S*/,
2510
+ endingNewline: /\n$/,
2511
+ listItemRegex: u => new RegExp(`^( {0,3}${u})((?:[\t ][^\\n]*)?(?:\\n|$))`),
2512
+ nextBulletRegex: u => new RegExp(`^ {0,${Math.min(3, u - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),
2513
+ hrRegex: u => new RegExp(`^ {0,${Math.min(3, u - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),
2514
+ fencesBeginRegex: u => new RegExp(`^ {0,${Math.min(3, u - 1)}}(?:\`\`\`|~~~)`),
2515
+ headingBeginRegex: u => new RegExp(`^ {0,${Math.min(3, u - 1)}}#`),
2516
+ htmlBeginRegex: u => new RegExp(`^ {0,${Math.min(3, u - 1)}}<(?:[a-z].*>|!--)`, "i")
2517
+ }, xe = /^(?:[ \t]*(?:\n|$))+/, be = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Re = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, I = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Te = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, N = /(?:[*+-]|\d{1,9}[.)])/, re = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, se = k(re).replace(/bull/g, N).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), Oe = k(re).replace(/bull/g, N).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), Q = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, we = /^[^\n]+/, F = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, ye = k(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", F).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Pe = k(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, N).getRegex(), v = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", j = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Se = k("^ {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[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))", "i").replace("comment", j).replace("tag", v).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), ie = k(Q).replace("hr", I).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", v).getRegex(), $e = k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", ie).getRegex(), U = {
2518
+ blockquote: $e,
2519
+ code: be,
2520
+ def: ye,
2521
+ fences: Re,
2522
+ heading: Te,
2523
+ hr: I,
2524
+ html: Se,
2525
+ lheading: se,
2526
+ list: Pe,
2527
+ newline: xe,
2528
+ paragraph: ie,
2529
+ table: C,
2530
+ text: we
2531
+ }, te = k("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3}\t)[^\\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", v).getRegex(), _e = {
2532
+ ...U,
2533
+ lheading: Oe,
2534
+ table: te,
2535
+ paragraph: k(Q).replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", te).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", v).getRegex()
2536
+ }, Le = {
2537
+ ...U,
2538
+ html: k(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", j).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(),
2539
+ def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
2540
+ heading: /^(#{1,6})(.*)(?:\n+|$)/,
2541
+ fences: C,
2542
+ lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
2543
+ paragraph: k(Q).replace("hr", I).replace("heading", ` *#{1,6} *[^\n]`).replace("lheading", se).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
2544
+ }, Me = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, ze = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, oe = /^( {2,}|\\)\n(?!\s*$)/, Ae = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, D = /[\p{P}\p{S}]/u, K = /[\s\p{P}\p{S}]/u, ae = /[^\s\p{P}\p{S}]/u, Ce = k(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, K).getRegex(), le = /(?!~)[\p{P}\p{S}]/u, Ie = /(?!~)[\s\p{P}\p{S}]/u, Ee = /(?:[^\s\p{P}\p{S}]|~)/u, Be = k(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", me ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), ue = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, qe = k(ue, "u").replace(/punct/g, D).getRegex(), ve = k(ue, "u").replace(/punct/g, le).getRegex(), pe = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", De = k(pe, "gu").replace(/notPunctSpace/g, ae).replace(/punctSpace/g, K).replace(/punct/g, D).getRegex(), He = k(pe, "gu").replace(/notPunctSpace/g, Ee).replace(/punctSpace/g, Ie).replace(/punct/g, le).getRegex(), Ze = k("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, ae).replace(/punctSpace/g, K).replace(/punct/g, D).getRegex(), Ge = k(/\\(punct)/, "gu").replace(/punct/g, D).getRegex(), Ne = k(/^<(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(), Qe = k(j).replace("(?:--\x3e|$)", "--\x3e").getRegex(), Fe = k("^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", Qe).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), q = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/, je = k(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", q).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), ce = k(/^!?\[(label)\]\[(ref)\]/).replace("label", q).replace("ref", F).getRegex(), he = k(/^!?\[(ref)\](?:\[\])?/).replace("ref", F).getRegex(), Ue = k("reflink|nolink(?!\\()", "g").replace("reflink", ce).replace("nolink", he).getRegex(), ne = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, W = {
2545
+ _backpedal: C,
2546
+ anyPunctuation: Ge,
2547
+ autolink: Ne,
2548
+ blockSkip: Be,
2549
+ br: oe,
2550
+ code: ze,
2551
+ del: C,
2552
+ emStrongLDelim: qe,
2553
+ emStrongRDelimAst: De,
2554
+ emStrongRDelimUnd: Ze,
2555
+ escape: Me,
2556
+ link: je,
2557
+ nolink: he,
2558
+ punctuation: Ce,
2559
+ reflink: ce,
2560
+ reflinkSearch: Ue,
2561
+ tag: Fe,
2562
+ text: Ae,
2563
+ url: C
2564
+ }, Ke = {
2565
+ ...W,
2566
+ link: k(/^!?\[(label)\]\((.*?)\)/).replace("label", q).getRegex(),
2567
+ reflink: k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", q).getRegex()
2568
+ }, G = {
2569
+ ...W,
2570
+ emStrongRDelimAst: He,
2571
+ emStrongLDelim: ve,
2572
+ url: k(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", ne).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
2573
+ _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
2574
+ del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,
2575
+ text: k(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", ne).getRegex()
2576
+ }, We = {
2577
+ ...G,
2578
+ br: k(oe).replace("{2,}", "*").getRegex(),
2579
+ text: k(G.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
2580
+ }, E = {
2581
+ normal: U,
2582
+ gfm: _e,
2583
+ pedantic: Le
2584
+ }, M = {
2585
+ normal: W,
2586
+ gfm: G,
2587
+ breaks: We,
2588
+ pedantic: Ke
2589
+ };
2590
+ var Xe = {
2591
+ "&": "&amp;",
2592
+ "<": "&lt;",
2593
+ ">": "&gt;",
2594
+ '"': "&quot;",
2595
+ "'": "&#39;"
2596
+ }, ke = u => Xe[u];
2597
+ function w(u, e) {
2598
+ if (e) {
2599
+ if (m.escapeTest.test(u)) return u.replace(m.escapeReplace, ke);
2600
+ } else if (m.escapeTestNoEncode.test(u)) return u.replace(m.escapeReplaceNoEncode, ke);
2601
+ return u;
2602
+ }
2603
+ function X(u) {
2604
+ try {
2605
+ u = encodeURI(u).replace(m.percentDecode, "%");
2606
+ } catch {
2607
+ return null;
2608
+ }
2609
+ return u;
2610
+ }
2611
+ function J(u, e) {
2612
+ let t = u.replace(m.findPipe, (i, s, a) => {
2613
+ let o = false, l = s;
2614
+ for (;--l >= 0 && a[l] === "\\"; ) o = !o;
2615
+ return o ? "|" : " |";
2616
+ }), n = t.split(m.splitPipe), r = 0;
2617
+ if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), e) if (n.length > e) n.splice(e); else for (;n.length < e; ) n.push("");
2618
+ for (;r < n.length; r++) n[r] = n[r].trim().replace(m.slashPipe, "|");
2619
+ return n;
2620
+ }
2621
+ function z(u, e, t) {
2622
+ let n = u.length;
2623
+ if (n === 0) return "";
2624
+ let r = 0;
2625
+ for (;r < n; ) {
2626
+ let i = u.charAt(n - r - 1);
2627
+ if (i === e && true) r++; else break;
2628
+ }
2629
+ return u.slice(0, n - r);
2630
+ }
2631
+ function de(u, e) {
2632
+ if (u.indexOf(e[1]) === -1) return -1;
2633
+ let t = 0;
2634
+ for (let n = 0; n < u.length; n++) if (u[n] === "\\") n++; else if (u[n] === e[0]) t++; else if (u[n] === e[1] && (t--,
2635
+ t < 0)) return n;
2636
+ return t > 0 ? -2 : -1;
2637
+ }
2638
+ function ge(u, e, t, n, r) {
2639
+ let i = e.href, s = e.title || null, a = u[1].replace(r.other.outputLinkReplace, "$1");
2640
+ n.state.inLink = true;
2641
+ let o = {
2642
+ type: u[0].charAt(0) === "!" ? "image" : "link",
2643
+ raw: t,
2644
+ href: i,
2645
+ title: s,
2646
+ text: a,
2647
+ tokens: n.inlineTokens(a)
2648
+ };
2649
+ return n.state.inLink = false, o;
2650
+ }
2651
+ function Je(u, e, t) {
2652
+ let n = u.match(t.other.indentCodeCompensation);
2653
+ if (n === null) return e;
2654
+ let r = n[1];
2655
+ return e.split(`\n`).map(i => {
2656
+ let s = i.match(t.other.beginningSpace);
2657
+ if (s === null) return i;
2658
+ let [a] = s;
2659
+ return a.length >= r.length ? i.slice(r.length) : i;
2660
+ }).join(`\n`);
2661
+ }
2662
+ var y = class {
2663
+ options;
2664
+ rules;
2665
+ lexer;
2666
+ constructor(e) {
2667
+ this.options = e || T;
2668
+ }
2669
+ space(e) {
2670
+ let t = this.rules.block.newline.exec(e);
2671
+ if (t && t[0].length > 0) return {
2672
+ type: "space",
2673
+ raw: t[0]
2674
+ };
2675
+ }
2676
+ code(e) {
2677
+ let t = this.rules.block.code.exec(e);
2678
+ if (t) {
2679
+ let n = t[0].replace(this.rules.other.codeRemoveIndent, "");
2680
+ return {
2681
+ type: "code",
2682
+ raw: t[0],
2683
+ codeBlockStyle: "indented",
2684
+ text: this.options.pedantic ? n : z(n, `\n`)
2685
+ };
2686
+ }
2687
+ }
2688
+ fences(e) {
2689
+ let t = this.rules.block.fences.exec(e);
2690
+ if (t) {
2691
+ let n = t[0], r = Je(n, t[3] || "", this.rules);
2692
+ return {
2693
+ type: "code",
2694
+ raw: n,
2695
+ lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2],
2696
+ text: r
2697
+ };
2698
+ }
2699
+ }
2700
+ heading(e) {
2701
+ let t = this.rules.block.heading.exec(e);
2702
+ if (t) {
2703
+ let n = t[2].trim();
2704
+ if (this.rules.other.endingHash.test(n)) {
2705
+ let r = z(n, "#");
2706
+ (this.options.pedantic || !r || this.rules.other.endingSpaceChar.test(r)) && (n = r.trim());
2707
+ }
2708
+ return {
2709
+ type: "heading",
2710
+ raw: t[0],
2711
+ depth: t[1].length,
2712
+ text: n,
2713
+ tokens: this.lexer.inline(n)
2714
+ };
2715
+ }
2716
+ }
2717
+ hr(e) {
2718
+ let t = this.rules.block.hr.exec(e);
2719
+ if (t) return {
2720
+ type: "hr",
2721
+ raw: z(t[0], `\n`)
2722
+ };
2723
+ }
2724
+ blockquote(e) {
2725
+ let t = this.rules.block.blockquote.exec(e);
2726
+ if (t) {
2727
+ let n = z(t[0], `\n`).split(`\n`), r = "", i = "", s = [];
2728
+ for (;n.length > 0; ) {
2729
+ let a = false, o = [], l;
2730
+ for (l = 0; l < n.length; l++) if (this.rules.other.blockquoteStart.test(n[l])) o.push(n[l]),
2731
+ a = true; else if (!a) o.push(n[l]); else break;
2732
+ n = n.slice(l);
2733
+ let p = o.join(`\n`), c = p.replace(this.rules.other.blockquoteSetextReplace, `\n $1`).replace(this.rules.other.blockquoteSetextReplace2, "");
2734
+ r = r ? `${r}\n${p}` : p, i = i ? `${i}\n${c}` : c;
2735
+ let g = this.lexer.state.top;
2736
+ if (this.lexer.state.top = true, this.lexer.blockTokens(c, s, true), this.lexer.state.top = g,
2737
+ n.length === 0) break;
2738
+ let h = s.at(-1);
2739
+ if (h?.type === "code") break;
2740
+ if (h?.type === "blockquote") {
2741
+ let R = h, f = R.raw + `\n` + n.join(`\n`), O = this.blockquote(f);
2742
+ s[s.length - 1] = O, r = r.substring(0, r.length - R.raw.length) + O.raw, i = i.substring(0, i.length - R.text.length) + O.text;
2743
+ break;
2744
+ } else if (h?.type === "list") {
2745
+ let R = h, f = R.raw + `\n` + n.join(`\n`), O = this.list(f);
2746
+ s[s.length - 1] = O, r = r.substring(0, r.length - h.raw.length) + O.raw, i = i.substring(0, i.length - R.raw.length) + O.raw,
2747
+ n = f.substring(s.at(-1).raw.length).split(`\n`);
2748
+ continue;
2749
+ }
2750
+ }
2751
+ return {
2752
+ type: "blockquote",
2753
+ raw: r,
2754
+ tokens: s,
2755
+ text: i
2756
+ };
2757
+ }
2758
+ }
2759
+ list(e) {
2760
+ let t = this.rules.block.list.exec(e);
2761
+ if (t) {
2762
+ let n = t[1].trim(), r = n.length > 1, i = {
2763
+ type: "list",
2764
+ raw: "",
2765
+ ordered: r,
2766
+ start: r ? +n.slice(0, -1) : "",
2767
+ loose: false,
2768
+ items: []
2769
+ };
2770
+ n = r ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = r ? n : "[*+-]");
2771
+ let s = this.rules.other.listItemRegex(n), a = false;
2772
+ for (;e; ) {
2773
+ let l = false, p = "", c = "";
2774
+ if (!(t = s.exec(e)) || this.rules.block.hr.test(e)) break;
2775
+ p = t[0], e = e.substring(p.length);
2776
+ let g = t[2].split(`\n`, 1)[0].replace(this.rules.other.listReplaceTabs, O => " ".repeat(3 * O.length)), h = e.split(`\n`, 1)[0], R = !g.trim(), f = 0;
2777
+ if (this.options.pedantic ? (f = 2, c = g.trimStart()) : R ? f = t[1].length + 1 : (f = t[2].search(this.rules.other.nonSpaceChar),
2778
+ f = f > 4 ? 1 : f, c = g.slice(f), f += t[1].length), R && this.rules.other.blankLine.test(h) && (p += h + `\n`,
2779
+ e = e.substring(h.length + 1), l = true), !l) {
2780
+ let O = this.rules.other.nextBulletRegex(f), V = this.rules.other.hrRegex(f), Y = this.rules.other.fencesBeginRegex(f), ee = this.rules.other.headingBeginRegex(f), fe = this.rules.other.htmlBeginRegex(f);
2781
+ for (;e; ) {
2782
+ let H = e.split(`\n`, 1)[0], A;
2783
+ if (h = H, this.options.pedantic ? (h = h.replace(this.rules.other.listReplaceNesting, " "),
2784
+ A = h) : A = h.replace(this.rules.other.tabCharGlobal, " "), Y.test(h) || ee.test(h) || fe.test(h) || O.test(h) || V.test(h)) break;
2785
+ if (A.search(this.rules.other.nonSpaceChar) >= f || !h.trim()) c += `\n` + A.slice(f); else {
2786
+ if (R || g.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || Y.test(g) || ee.test(g) || V.test(g)) break;
2787
+ c += `\n` + h;
2788
+ }
2789
+ !R && !h.trim() && (R = true), p += H + `\n`, e = e.substring(H.length + 1), g = A.slice(f);
2790
+ }
2791
+ }
2792
+ i.loose || (a ? i.loose = true : this.rules.other.doubleBlankLine.test(p) && (a = true)),
2793
+ i.items.push({
2794
+ type: "list_item",
2795
+ raw: p,
2796
+ task: !!this.options.gfm && this.rules.other.listIsTask.test(c),
2797
+ loose: false,
2798
+ text: c,
2799
+ tokens: []
2800
+ }), i.raw += p;
2801
+ }
2802
+ let o = i.items.at(-1);
2803
+ if (o) o.raw = o.raw.trimEnd(), o.text = o.text.trimEnd(); else return;
2804
+ i.raw = i.raw.trimEnd();
2805
+ for (let l of i.items) {
2806
+ if (this.lexer.state.top = false, l.tokens = this.lexer.blockTokens(l.text, []),
2807
+ l.task) {
2808
+ if (l.text = l.text.replace(this.rules.other.listReplaceTask, ""), l.tokens[0]?.type === "text" || l.tokens[0]?.type === "paragraph") {
2809
+ l.tokens[0].raw = l.tokens[0].raw.replace(this.rules.other.listReplaceTask, ""),
2810
+ l.tokens[0].text = l.tokens[0].text.replace(this.rules.other.listReplaceTask, "");
2811
+ for (let c = this.lexer.inlineQueue.length - 1; c >= 0; c--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[c].src)) {
2812
+ this.lexer.inlineQueue[c].src = this.lexer.inlineQueue[c].src.replace(this.rules.other.listReplaceTask, "");
2813
+ break;
2814
+ }
2815
+ }
2816
+ let p = this.rules.other.listTaskCheckbox.exec(l.raw);
2817
+ if (p) {
2818
+ let c = {
2819
+ type: "checkbox",
2820
+ raw: p[0] + " ",
2821
+ checked: p[0] !== "[ ]"
2822
+ };
2823
+ l.checked = c.checked, i.loose ? l.tokens[0] && [ "paragraph", "text" ].includes(l.tokens[0].type) && "tokens" in l.tokens[0] && l.tokens[0].tokens ? (l.tokens[0].raw = c.raw + l.tokens[0].raw,
2824
+ l.tokens[0].text = c.raw + l.tokens[0].text, l.tokens[0].tokens.unshift(c)) : l.tokens.unshift({
2825
+ type: "paragraph",
2826
+ raw: c.raw,
2827
+ text: c.raw,
2828
+ tokens: [ c ]
2829
+ }) : l.tokens.unshift(c);
2830
+ }
2831
+ }
2832
+ if (!i.loose) {
2833
+ let p = l.tokens.filter(g => g.type === "space"), c = p.length > 0 && p.some(g => this.rules.other.anyLine.test(g.raw));
2834
+ i.loose = c;
2835
+ }
2836
+ }
2837
+ if (i.loose) for (let l of i.items) {
2838
+ l.loose = true;
2839
+ for (let p of l.tokens) p.type === "text" && (p.type = "paragraph");
2840
+ }
2841
+ return i;
2842
+ }
2843
+ }
2844
+ html(e) {
2845
+ let t = this.rules.block.html.exec(e);
2846
+ if (t) return {
2847
+ type: "html",
2848
+ block: true,
2849
+ raw: t[0],
2850
+ pre: t[1] === "pre" || t[1] === "script" || t[1] === "style",
2851
+ text: t[0]
2852
+ };
2853
+ }
2854
+ def(e) {
2855
+ let t = this.rules.block.def.exec(e);
2856
+ if (t) {
2857
+ let n = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), r = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", i = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
2858
+ return {
2859
+ type: "def",
2860
+ tag: n,
2861
+ raw: t[0],
2862
+ href: r,
2863
+ title: i
2864
+ };
2865
+ }
2866
+ }
2867
+ table(e) {
2868
+ let t = this.rules.block.table.exec(e);
2869
+ if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
2870
+ let n = J(t[1]), r = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), i = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`\n`) : [], s = {
2871
+ type: "table",
2872
+ raw: t[0],
2873
+ header: [],
2874
+ align: [],
2875
+ rows: []
2876
+ };
2877
+ if (n.length === r.length) {
2878
+ for (let a of r) this.rules.other.tableAlignRight.test(a) ? s.align.push("right") : this.rules.other.tableAlignCenter.test(a) ? s.align.push("center") : this.rules.other.tableAlignLeft.test(a) ? s.align.push("left") : s.align.push(null);
2879
+ for (let a = 0; a < n.length; a++) s.header.push({
2880
+ text: n[a],
2881
+ tokens: this.lexer.inline(n[a]),
2882
+ header: true,
2883
+ align: s.align[a]
2884
+ });
2885
+ for (let a of i) s.rows.push(J(a, s.header.length).map((o, l) => ({
2886
+ text: o,
2887
+ tokens: this.lexer.inline(o),
2888
+ header: false,
2889
+ align: s.align[l]
2890
+ })));
2891
+ return s;
2892
+ }
2893
+ }
2894
+ lheading(e) {
2895
+ let t = this.rules.block.lheading.exec(e);
2896
+ if (t) return {
2897
+ type: "heading",
2898
+ raw: t[0],
2899
+ depth: t[2].charAt(0) === "=" ? 1 : 2,
2900
+ text: t[1],
2901
+ tokens: this.lexer.inline(t[1])
2902
+ };
2903
+ }
2904
+ paragraph(e) {
2905
+ let t = this.rules.block.paragraph.exec(e);
2906
+ if (t) {
2907
+ let n = t[1].charAt(t[1].length - 1) === `\n` ? t[1].slice(0, -1) : t[1];
2908
+ return {
2909
+ type: "paragraph",
2910
+ raw: t[0],
2911
+ text: n,
2912
+ tokens: this.lexer.inline(n)
2913
+ };
2914
+ }
2915
+ }
2916
+ text(e) {
2917
+ let t = this.rules.block.text.exec(e);
2918
+ if (t) return {
2919
+ type: "text",
2920
+ raw: t[0],
2921
+ text: t[0],
2922
+ tokens: this.lexer.inline(t[0])
2923
+ };
2924
+ }
2925
+ escape(e) {
2926
+ let t = this.rules.inline.escape.exec(e);
2927
+ if (t) return {
2928
+ type: "escape",
2929
+ raw: t[0],
2930
+ text: t[1]
2931
+ };
2932
+ }
2933
+ tag(e) {
2934
+ let t = this.rules.inline.tag.exec(e);
2935
+ if (t) return !this.lexer.state.inLink && this.rules.other.startATag.test(t[0]) ? this.lexer.state.inLink = true : this.lexer.state.inLink && this.rules.other.endATag.test(t[0]) && (this.lexer.state.inLink = false),
2936
+ !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t[0]) ? this.lexer.state.inRawBlock = true : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t[0]) && (this.lexer.state.inRawBlock = false),
2937
+ {
2938
+ type: "html",
2939
+ raw: t[0],
2940
+ inLink: this.lexer.state.inLink,
2941
+ inRawBlock: this.lexer.state.inRawBlock,
2942
+ block: false,
2943
+ text: t[0]
2944
+ };
2945
+ }
2946
+ link(e) {
2947
+ let t = this.rules.inline.link.exec(e);
2948
+ if (t) {
2949
+ let n = t[2].trim();
2950
+ if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
2951
+ if (!this.rules.other.endAngleBracket.test(n)) return;
2952
+ let s = z(n.slice(0, -1), "\\");
2953
+ if ((n.length - s.length) % 2 === 0) return;
2954
+ } else {
2955
+ let s = de(t[2], "()");
2956
+ if (s === -2) return;
2957
+ if (s > -1) {
2958
+ let o = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + s;
2959
+ t[2] = t[2].substring(0, s), t[0] = t[0].substring(0, o).trim(), t[3] = "";
2960
+ }
2961
+ }
2962
+ let r = t[2], i = "";
2963
+ if (this.options.pedantic) {
2964
+ let s = this.rules.other.pedanticHrefTitle.exec(r);
2965
+ s && (r = s[1], i = s[3]);
2966
+ } else i = t[3] ? t[3].slice(1, -1) : "";
2967
+ return r = r.trim(), this.rules.other.startAngleBracket.test(r) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? r = r.slice(1) : r = r.slice(1, -1)),
2968
+ ge(t, {
2969
+ href: r && r.replace(this.rules.inline.anyPunctuation, "$1"),
2970
+ title: i && i.replace(this.rules.inline.anyPunctuation, "$1")
2971
+ }, t[0], this.lexer, this.rules);
2972
+ }
2973
+ }
2974
+ reflink(e, t) {
2975
+ let n;
2976
+ if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
2977
+ let r = (n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "), i = t[r.toLowerCase()];
2978
+ if (!i) {
2979
+ let s = n[0].charAt(0);
2980
+ return {
2981
+ type: "text",
2982
+ raw: s,
2983
+ text: s
2984
+ };
2985
+ }
2986
+ return ge(n, i, n[0], this.lexer, this.rules);
2987
+ }
2988
+ }
2989
+ emStrong(e, t, n = "") {
2990
+ let r = this.rules.inline.emStrongLDelim.exec(e);
2991
+ if (!r || r[3] && n.match(this.rules.other.unicodeAlphaNumeric)) return;
2992
+ if (!(r[1] || r[2] || "") || !n || this.rules.inline.punctuation.exec(n)) {
2993
+ let s = [ ...r[0] ].length - 1, a, o, l = s, p = 0, c = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
2994
+ for (c.lastIndex = 0, t = t.slice(-1 * e.length + s); (r = c.exec(t)) != null; ) {
2995
+ if (a = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !a) continue;
2996
+ if (o = [ ...a ].length, r[3] || r[4]) {
2997
+ l += o;
2998
+ continue;
2999
+ } else if ((r[5] || r[6]) && s % 3 && !((s + o) % 3)) {
3000
+ p += o;
3001
+ continue;
3002
+ }
3003
+ if (l -= o, l > 0) continue;
3004
+ o = Math.min(o, o + l + p);
3005
+ let g = [ ...r[0] ][0].length, h = e.slice(0, s + r.index + g + o);
3006
+ if (Math.min(s, o) % 2) {
3007
+ let f = h.slice(1, -1);
3008
+ return {
3009
+ type: "em",
3010
+ raw: h,
3011
+ text: f,
3012
+ tokens: this.lexer.inlineTokens(f)
3013
+ };
3014
+ }
3015
+ let R = h.slice(2, -2);
3016
+ return {
3017
+ type: "strong",
3018
+ raw: h,
3019
+ text: R,
3020
+ tokens: this.lexer.inlineTokens(R)
3021
+ };
3022
+ }
3023
+ }
3024
+ }
3025
+ codespan(e) {
3026
+ let t = this.rules.inline.code.exec(e);
3027
+ if (t) {
3028
+ let n = t[2].replace(this.rules.other.newLineCharGlobal, " "), r = this.rules.other.nonSpaceChar.test(n), i = this.rules.other.startingSpaceChar.test(n) && this.rules.other.endingSpaceChar.test(n);
3029
+ return r && i && (n = n.substring(1, n.length - 1)), {
3030
+ type: "codespan",
3031
+ raw: t[0],
3032
+ text: n
3033
+ };
3034
+ }
3035
+ }
3036
+ br(e) {
3037
+ let t = this.rules.inline.br.exec(e);
3038
+ if (t) return {
3039
+ type: "br",
3040
+ raw: t[0]
3041
+ };
3042
+ }
3043
+ del(e) {
3044
+ let t = this.rules.inline.del.exec(e);
3045
+ if (t) return {
3046
+ type: "del",
3047
+ raw: t[0],
3048
+ text: t[2],
3049
+ tokens: this.lexer.inlineTokens(t[2])
3050
+ };
3051
+ }
3052
+ autolink(e) {
3053
+ let t = this.rules.inline.autolink.exec(e);
3054
+ if (t) {
3055
+ let n, r;
3056
+ return t[2] === "@" ? (n = t[1], r = "mailto:" + n) : (n = t[1], r = n), {
3057
+ type: "link",
3058
+ raw: t[0],
3059
+ text: n,
3060
+ href: r,
3061
+ tokens: [ {
3062
+ type: "text",
3063
+ raw: n,
3064
+ text: n
3065
+ } ]
3066
+ };
3067
+ }
3068
+ }
3069
+ url(e) {
3070
+ let t;
3071
+ if (t = this.rules.inline.url.exec(e)) {
3072
+ let n, r;
3073
+ if (t[2] === "@") n = t[0], r = "mailto:" + n; else {
3074
+ let i;
3075
+ do {
3076
+ i = t[0], t[0] = this.rules.inline._backpedal.exec(t[0])?.[0] ?? "";
3077
+ } while (i !== t[0]);
3078
+ n = t[0], t[1] === "www." ? r = "http://" + t[0] : r = t[0];
3079
+ }
3080
+ return {
3081
+ type: "link",
3082
+ raw: t[0],
3083
+ text: n,
3084
+ href: r,
3085
+ tokens: [ {
3086
+ type: "text",
3087
+ raw: n,
3088
+ text: n
3089
+ } ]
3090
+ };
3091
+ }
3092
+ }
3093
+ inlineText(e) {
3094
+ let t = this.rules.inline.text.exec(e);
3095
+ if (t) {
3096
+ let n = this.lexer.state.inRawBlock;
3097
+ return {
3098
+ type: "text",
3099
+ raw: t[0],
3100
+ text: t[0],
3101
+ escaped: n
3102
+ };
3103
+ }
3104
+ }
3105
+ };
3106
+ var x = class u {
3107
+ tokens;
3108
+ options;
3109
+ state;
3110
+ inlineQueue;
3111
+ tokenizer;
3112
+ constructor(e) {
3113
+ this.tokens = [], this.tokens.links = Object.create(null), this.options = e || T,
3114
+ this.options.tokenizer = this.options.tokenizer || new y, this.tokenizer = this.options.tokenizer,
3115
+ this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [],
3116
+ this.state = {
3117
+ inLink: false,
3118
+ inRawBlock: false,
3119
+ top: true
3120
+ };
3121
+ let t = {
3122
+ other: m,
3123
+ block: E.normal,
3124
+ inline: M.normal
3125
+ };
3126
+ this.options.pedantic ? (t.block = E.pedantic, t.inline = M.pedantic) : this.options.gfm && (t.block = E.gfm,
3127
+ this.options.breaks ? t.inline = M.breaks : t.inline = M.gfm), this.tokenizer.rules = t;
3128
+ }
3129
+ static get rules() {
3130
+ return {
3131
+ block: E,
3132
+ inline: M
3133
+ };
3134
+ }
3135
+ static lex(e, t) {
3136
+ return new u(t).lex(e);
3137
+ }
3138
+ static lexInline(e, t) {
3139
+ return new u(t).inlineTokens(e);
3140
+ }
3141
+ lex(e) {
3142
+ e = e.replace(m.carriageReturn, `\n`), this.blockTokens(e, this.tokens);
3143
+ for (let t = 0; t < this.inlineQueue.length; t++) {
3144
+ let n = this.inlineQueue[t];
3145
+ this.inlineTokens(n.src, n.tokens);
3146
+ }
3147
+ return this.inlineQueue = [], this.tokens;
3148
+ }
3149
+ blockTokens(e, t = [], n = false) {
3150
+ for (this.options.pedantic && (e = e.replace(m.tabCharGlobal, " ").replace(m.spaceLine, "")); e; ) {
3151
+ let r;
3152
+ if (this.options.extensions?.block?.some(s => (r = s.call({
3153
+ lexer: this
3154
+ }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), true) : false)) continue;
3155
+ if (r = this.tokenizer.space(e)) {
3156
+ e = e.substring(r.raw.length);
3157
+ let s = t.at(-1);
3158
+ r.raw.length === 1 && s !== void 0 ? s.raw += `\n` : t.push(r);
3159
+ continue;
3160
+ }
3161
+ if (r = this.tokenizer.code(e)) {
3162
+ e = e.substring(r.raw.length);
3163
+ let s = t.at(-1);
3164
+ s?.type === "paragraph" || s?.type === "text" ? (s.raw += (s.raw.endsWith(`\n`) ? "" : `\n`) + r.raw,
3165
+ s.text += `\n` + r.text, this.inlineQueue.at(-1).src = s.text) : t.push(r);
3166
+ continue;
3167
+ }
3168
+ if (r = this.tokenizer.fences(e)) {
3169
+ e = e.substring(r.raw.length), t.push(r);
3170
+ continue;
3171
+ }
3172
+ if (r = this.tokenizer.heading(e)) {
3173
+ e = e.substring(r.raw.length), t.push(r);
3174
+ continue;
3175
+ }
3176
+ if (r = this.tokenizer.hr(e)) {
3177
+ e = e.substring(r.raw.length), t.push(r);
3178
+ continue;
3179
+ }
3180
+ if (r = this.tokenizer.blockquote(e)) {
3181
+ e = e.substring(r.raw.length), t.push(r);
3182
+ continue;
3183
+ }
3184
+ if (r = this.tokenizer.list(e)) {
3185
+ e = e.substring(r.raw.length), t.push(r);
3186
+ continue;
3187
+ }
3188
+ if (r = this.tokenizer.html(e)) {
3189
+ e = e.substring(r.raw.length), t.push(r);
3190
+ continue;
3191
+ }
3192
+ if (r = this.tokenizer.def(e)) {
3193
+ e = e.substring(r.raw.length);
3194
+ let s = t.at(-1);
3195
+ s?.type === "paragraph" || s?.type === "text" ? (s.raw += (s.raw.endsWith(`\n`) ? "" : `\n`) + r.raw,
3196
+ s.text += `\n` + r.raw, this.inlineQueue.at(-1).src = s.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = {
3197
+ href: r.href,
3198
+ title: r.title
3199
+ }, t.push(r));
3200
+ continue;
3201
+ }
3202
+ if (r = this.tokenizer.table(e)) {
3203
+ e = e.substring(r.raw.length), t.push(r);
3204
+ continue;
3205
+ }
3206
+ if (r = this.tokenizer.lheading(e)) {
3207
+ e = e.substring(r.raw.length), t.push(r);
3208
+ continue;
3209
+ }
3210
+ let i = e;
3211
+ if (this.options.extensions?.startBlock) {
3212
+ let s = 1 / 0, a = e.slice(1), o;
3213
+ this.options.extensions.startBlock.forEach(l => {
3214
+ o = l.call({
3215
+ lexer: this
3216
+ }, a), typeof o == "number" && o >= 0 && (s = Math.min(s, o));
3217
+ }), s < 1 / 0 && s >= 0 && (i = e.substring(0, s + 1));
3218
+ }
3219
+ if (this.state.top && (r = this.tokenizer.paragraph(i))) {
3220
+ let s = t.at(-1);
3221
+ n && s?.type === "paragraph" ? (s.raw += (s.raw.endsWith(`\n`) ? "" : `\n`) + r.raw,
3222
+ s.text += `\n` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = s.text) : t.push(r),
3223
+ n = i.length !== e.length, e = e.substring(r.raw.length);
3224
+ continue;
3225
+ }
3226
+ if (r = this.tokenizer.text(e)) {
3227
+ e = e.substring(r.raw.length);
3228
+ let s = t.at(-1);
3229
+ s?.type === "text" ? (s.raw += (s.raw.endsWith(`\n`) ? "" : `\n`) + r.raw, s.text += `\n` + r.text,
3230
+ this.inlineQueue.pop(), this.inlineQueue.at(-1).src = s.text) : t.push(r);
3231
+ continue;
3232
+ }
3233
+ if (e) {
3234
+ let s = "Infinite loop on byte: " + e.charCodeAt(0);
3235
+ if (this.options.silent) {
3236
+ console.error(s);
3237
+ break;
3238
+ } else throw new Error(s);
3239
+ }
3240
+ }
3241
+ return this.state.top = true, t;
3242
+ }
3243
+ inline(e, t = []) {
3244
+ return this.inlineQueue.push({
3245
+ src: e,
3246
+ tokens: t
3247
+ }), t;
3248
+ }
3249
+ inlineTokens(e, t = []) {
3250
+ let n = e, r = null;
3251
+ if (this.tokens.links) {
3252
+ let o = Object.keys(this.tokens.links);
3253
+ if (o.length > 0) for (;(r = this.tokenizer.rules.inline.reflinkSearch.exec(n)) != null; ) o.includes(r[0].slice(r[0].lastIndexOf("[") + 1, -1)) && (n = n.slice(0, r.index) + "[" + "a".repeat(r[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
3254
+ }
3255
+ for (;(r = this.tokenizer.rules.inline.anyPunctuation.exec(n)) != null; ) n = n.slice(0, r.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
3256
+ let i;
3257
+ for (;(r = this.tokenizer.rules.inline.blockSkip.exec(n)) != null; ) i = r[2] ? r[2].length : 0,
3258
+ n = n.slice(0, r.index + i) + "[" + "a".repeat(r[0].length - i - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
3259
+ n = this.options.hooks?.emStrongMask?.call({
3260
+ lexer: this
3261
+ }, n) ?? n;
3262
+ let s = false, a = "";
3263
+ for (;e; ) {
3264
+ s || (a = ""), s = false;
3265
+ let o;
3266
+ if (this.options.extensions?.inline?.some(p => (o = p.call({
3267
+ lexer: this
3268
+ }, e, t)) ? (e = e.substring(o.raw.length), t.push(o), true) : false)) continue;
3269
+ if (o = this.tokenizer.escape(e)) {
3270
+ e = e.substring(o.raw.length), t.push(o);
3271
+ continue;
3272
+ }
3273
+ if (o = this.tokenizer.tag(e)) {
3274
+ e = e.substring(o.raw.length), t.push(o);
3275
+ continue;
3276
+ }
3277
+ if (o = this.tokenizer.link(e)) {
3278
+ e = e.substring(o.raw.length), t.push(o);
3279
+ continue;
3280
+ }
3281
+ if (o = this.tokenizer.reflink(e, this.tokens.links)) {
3282
+ e = e.substring(o.raw.length);
3283
+ let p = t.at(-1);
3284
+ o.type === "text" && p?.type === "text" ? (p.raw += o.raw, p.text += o.text) : t.push(o);
3285
+ continue;
3286
+ }
3287
+ if (o = this.tokenizer.emStrong(e, n, a)) {
3288
+ e = e.substring(o.raw.length), t.push(o);
3289
+ continue;
3290
+ }
3291
+ if (o = this.tokenizer.codespan(e)) {
3292
+ e = e.substring(o.raw.length), t.push(o);
3293
+ continue;
3294
+ }
3295
+ if (o = this.tokenizer.br(e)) {
3296
+ e = e.substring(o.raw.length), t.push(o);
3297
+ continue;
3298
+ }
3299
+ if (o = this.tokenizer.del(e)) {
3300
+ e = e.substring(o.raw.length), t.push(o);
3301
+ continue;
3302
+ }
3303
+ if (o = this.tokenizer.autolink(e)) {
3304
+ e = e.substring(o.raw.length), t.push(o);
3305
+ continue;
3306
+ }
3307
+ if (!this.state.inLink && (o = this.tokenizer.url(e))) {
3308
+ e = e.substring(o.raw.length), t.push(o);
3309
+ continue;
3310
+ }
3311
+ let l = e;
3312
+ if (this.options.extensions?.startInline) {
3313
+ let p = 1 / 0, c = e.slice(1), g;
3314
+ this.options.extensions.startInline.forEach(h => {
3315
+ g = h.call({
3316
+ lexer: this
3317
+ }, c), typeof g == "number" && g >= 0 && (p = Math.min(p, g));
3318
+ }), p < 1 / 0 && p >= 0 && (l = e.substring(0, p + 1));
3319
+ }
3320
+ if (o = this.tokenizer.inlineText(l)) {
3321
+ e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (a = o.raw.slice(-1)),
3322
+ s = true;
3323
+ let p = t.at(-1);
3324
+ p?.type === "text" ? (p.raw += o.raw, p.text += o.text) : t.push(o);
3325
+ continue;
3326
+ }
3327
+ if (e) {
3328
+ let p = "Infinite loop on byte: " + e.charCodeAt(0);
3329
+ if (this.options.silent) {
3330
+ console.error(p);
3331
+ break;
3332
+ } else throw new Error(p);
3333
+ }
3334
+ }
3335
+ return t;
3336
+ }
3337
+ };
3338
+ var P = class {
3339
+ options;
3340
+ parser;
3341
+ constructor(e) {
3342
+ this.options = e || T;
3343
+ }
3344
+ space(e) {
3345
+ return "";
3346
+ }
3347
+ code({text: e, lang: t, escaped: n}) {
3348
+ let r = (t || "").match(m.notSpaceStart)?.[0], i = e.replace(m.endingNewline, "") + `\n`;
3349
+ return r ? '<pre><code class="language-' + w(r) + '">' + (n ? i : w(i, true)) + `</code></pre>\n` : "<pre><code>" + (n ? i : w(i, true)) + `</code></pre>\n`;
3350
+ }
3351
+ blockquote({tokens: e}) {
3352
+ return `<blockquote>\n${this.parser.parse(e)}</blockquote>\n`;
3353
+ }
3354
+ html({text: e}) {
3355
+ return e;
3356
+ }
3357
+ def(e) {
3358
+ return "";
3359
+ }
3360
+ heading({tokens: e, depth: t}) {
3361
+ return `<h${t}>${this.parser.parseInline(e)}</h${t}>\n`;
3362
+ }
3363
+ hr(e) {
3364
+ return `<hr>\n`;
3365
+ }
3366
+ list(e) {
3367
+ let t = e.ordered, n = e.start, r = "";
3368
+ for (let a = 0; a < e.items.length; a++) {
3369
+ let o = e.items[a];
3370
+ r += this.listitem(o);
3371
+ }
3372
+ let i = t ? "ol" : "ul", s = t && n !== 1 ? ' start="' + n + '"' : "";
3373
+ return "<" + i + s + `>\n` + r + "</" + i + `>\n`;
3374
+ }
3375
+ listitem(e) {
3376
+ return `<li>${this.parser.parse(e.tokens)}</li>\n`;
3377
+ }
3378
+ checkbox({checked: e}) {
3379
+ return "<input " + (e ? 'checked="" ' : "") + 'disabled="" type="checkbox"> ';
3380
+ }
3381
+ paragraph({tokens: e}) {
3382
+ return `<p>${this.parser.parseInline(e)}</p>\n`;
3383
+ }
3384
+ table(e) {
3385
+ let t = "", n = "";
3386
+ for (let i = 0; i < e.header.length; i++) n += this.tablecell(e.header[i]);
3387
+ t += this.tablerow({
3388
+ text: n
3389
+ });
3390
+ let r = "";
3391
+ for (let i = 0; i < e.rows.length; i++) {
3392
+ let s = e.rows[i];
3393
+ n = "";
3394
+ for (let a = 0; a < s.length; a++) n += this.tablecell(s[a]);
3395
+ r += this.tablerow({
3396
+ text: n
3397
+ });
3398
+ }
3399
+ return r && (r = `<tbody>${r}</tbody>`), `<table>\n<thead>\n` + t + `</thead>\n` + r + `</table>\n`;
3400
+ }
3401
+ tablerow({text: e}) {
3402
+ return `<tr>\n${e}</tr>\n`;
3403
+ }
3404
+ tablecell(e) {
3405
+ let t = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td";
3406
+ return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>\n`;
3407
+ }
3408
+ strong({tokens: e}) {
3409
+ return `<strong>${this.parser.parseInline(e)}</strong>`;
3410
+ }
3411
+ em({tokens: e}) {
3412
+ return `<em>${this.parser.parseInline(e)}</em>`;
3413
+ }
3414
+ codespan({text: e}) {
3415
+ return `<code>${w(e, true)}</code>`;
3416
+ }
3417
+ br(e) {
3418
+ return "<br>";
3419
+ }
3420
+ del({tokens: e}) {
3421
+ return `<del>${this.parser.parseInline(e)}</del>`;
3422
+ }
3423
+ link({href: e, title: t, tokens: n}) {
3424
+ let r = this.parser.parseInline(n), i = X(e);
3425
+ if (i === null) return r;
3426
+ e = i;
3427
+ let s = '<a href="' + e + '"';
3428
+ return t && (s += ' title="' + w(t) + '"'), s += ">" + r + "</a>", s;
3429
+ }
3430
+ image({href: e, title: t, text: n, tokens: r}) {
3431
+ r && (n = this.parser.parseInline(r, this.parser.textRenderer));
3432
+ let i = X(e);
3433
+ if (i === null) return w(n);
3434
+ e = i;
3435
+ let s = `<img src="${e}" alt="${n}"`;
3436
+ return t && (s += ` title="${w(t)}"`), s += ">", s;
3437
+ }
3438
+ text(e) {
3439
+ return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : w(e.text);
3440
+ }
3441
+ };
3442
+ var $ = class {
3443
+ strong({text: e}) {
3444
+ return e;
3445
+ }
3446
+ em({text: e}) {
3447
+ return e;
3448
+ }
3449
+ codespan({text: e}) {
3450
+ return e;
3451
+ }
3452
+ del({text: e}) {
3453
+ return e;
3454
+ }
3455
+ html({text: e}) {
3456
+ return e;
3457
+ }
3458
+ text({text: e}) {
3459
+ return e;
3460
+ }
3461
+ link({text: e}) {
3462
+ return "" + e;
3463
+ }
3464
+ image({text: e}) {
3465
+ return "" + e;
3466
+ }
3467
+ br() {
3468
+ return "";
3469
+ }
3470
+ checkbox({raw: e}) {
3471
+ return e;
3472
+ }
3473
+ };
3474
+ var b = class u {
3475
+ options;
3476
+ renderer;
3477
+ textRenderer;
3478
+ constructor(e) {
3479
+ this.options = e || T, this.options.renderer = this.options.renderer || new P, this.renderer = this.options.renderer,
3480
+ this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new $;
3481
+ }
3482
+ static parse(e, t) {
3483
+ return new u(t).parse(e);
3484
+ }
3485
+ static parseInline(e, t) {
3486
+ return new u(t).parseInline(e);
3487
+ }
3488
+ parse(e) {
3489
+ let t = "";
3490
+ for (let n = 0; n < e.length; n++) {
3491
+ let r = e[n];
3492
+ if (this.options.extensions?.renderers?.[r.type]) {
3493
+ let s = r, a = this.options.extensions.renderers[s.type].call({
3494
+ parser: this
3495
+ }, s);
3496
+ if (a !== false || ![ "space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text" ].includes(s.type)) {
3497
+ t += a || "";
3498
+ continue;
3499
+ }
3500
+ }
3501
+ let i = r;
3502
+ switch (i.type) {
3503
+ case "space":
3504
+ {
3505
+ t += this.renderer.space(i);
3506
+ break;
3507
+ }
3508
+
3509
+ case "hr":
3510
+ {
3511
+ t += this.renderer.hr(i);
3512
+ break;
3513
+ }
3514
+
3515
+ case "heading":
3516
+ {
3517
+ t += this.renderer.heading(i);
3518
+ break;
3519
+ }
3520
+
3521
+ case "code":
3522
+ {
3523
+ t += this.renderer.code(i);
3524
+ break;
3525
+ }
3526
+
3527
+ case "table":
3528
+ {
3529
+ t += this.renderer.table(i);
3530
+ break;
3531
+ }
3532
+
3533
+ case "blockquote":
3534
+ {
3535
+ t += this.renderer.blockquote(i);
3536
+ break;
3537
+ }
3538
+
3539
+ case "list":
3540
+ {
3541
+ t += this.renderer.list(i);
3542
+ break;
3543
+ }
3544
+
3545
+ case "checkbox":
3546
+ {
3547
+ t += this.renderer.checkbox(i);
3548
+ break;
3549
+ }
3550
+
3551
+ case "html":
3552
+ {
3553
+ t += this.renderer.html(i);
3554
+ break;
3555
+ }
3556
+
3557
+ case "def":
3558
+ {
3559
+ t += this.renderer.def(i);
3560
+ break;
3561
+ }
3562
+
3563
+ case "paragraph":
3564
+ {
3565
+ t += this.renderer.paragraph(i);
3566
+ break;
3567
+ }
3568
+
3569
+ case "text":
3570
+ {
3571
+ t += this.renderer.text(i);
3572
+ break;
3573
+ }
3574
+
3575
+ default:
3576
+ {
3577
+ let s = 'Token with "' + i.type + '" type was not found.';
3578
+ if (this.options.silent) return console.error(s), "";
3579
+ throw new Error(s);
3580
+ }
3581
+ }
3582
+ }
3583
+ return t;
3584
+ }
3585
+ parseInline(e, t = this.renderer) {
3586
+ let n = "";
3587
+ for (let r = 0; r < e.length; r++) {
3588
+ let i = e[r];
3589
+ if (this.options.extensions?.renderers?.[i.type]) {
3590
+ let a = this.options.extensions.renderers[i.type].call({
3591
+ parser: this
3592
+ }, i);
3593
+ if (a !== false || ![ "escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text" ].includes(i.type)) {
3594
+ n += a || "";
3595
+ continue;
3596
+ }
3597
+ }
3598
+ let s = i;
3599
+ switch (s.type) {
3600
+ case "escape":
3601
+ {
3602
+ n += t.text(s);
3603
+ break;
3604
+ }
3605
+
3606
+ case "html":
3607
+ {
3608
+ n += t.html(s);
3609
+ break;
3610
+ }
3611
+
3612
+ case "link":
3613
+ {
3614
+ n += t.link(s);
3615
+ break;
3616
+ }
3617
+
3618
+ case "image":
3619
+ {
3620
+ n += t.image(s);
3621
+ break;
3622
+ }
3623
+
3624
+ case "checkbox":
3625
+ {
3626
+ n += t.checkbox(s);
3627
+ break;
3628
+ }
3629
+
3630
+ case "strong":
3631
+ {
3632
+ n += t.strong(s);
3633
+ break;
3634
+ }
3635
+
3636
+ case "em":
3637
+ {
3638
+ n += t.em(s);
3639
+ break;
3640
+ }
3641
+
3642
+ case "codespan":
3643
+ {
3644
+ n += t.codespan(s);
3645
+ break;
3646
+ }
3647
+
3648
+ case "br":
3649
+ {
3650
+ n += t.br(s);
3651
+ break;
3652
+ }
3653
+
3654
+ case "del":
3655
+ {
3656
+ n += t.del(s);
3657
+ break;
3658
+ }
3659
+
3660
+ case "text":
3661
+ {
3662
+ n += t.text(s);
3663
+ break;
3664
+ }
3665
+
3666
+ default:
3667
+ {
3668
+ let a = 'Token with "' + s.type + '" type was not found.';
3669
+ if (this.options.silent) return console.error(a), "";
3670
+ throw new Error(a);
3671
+ }
3672
+ }
3673
+ }
3674
+ return n;
3675
+ }
3676
+ };
3677
+ var S = class {
3678
+ options;
3679
+ block;
3680
+ constructor(e) {
3681
+ this.options = e || T;
3682
+ }
3683
+ static passThroughHooks=new Set([ "preprocess", "postprocess", "processAllTokens", "emStrongMask" ]);
3684
+ static passThroughHooksRespectAsync=new Set([ "preprocess", "postprocess", "processAllTokens" ]);
3685
+ preprocess(e) {
3686
+ return e;
3687
+ }
3688
+ postprocess(e) {
3689
+ return e;
3690
+ }
3691
+ processAllTokens(e) {
3692
+ return e;
3693
+ }
3694
+ emStrongMask(e) {
3695
+ return e;
3696
+ }
3697
+ provideLexer() {
3698
+ return this.block ? x.lex : x.lexInline;
3699
+ }
3700
+ provideParser() {
3701
+ return this.block ? b.parse : b.parseInline;
3702
+ }
3703
+ };
3704
+ var B = class {
3705
+ defaults=L();
3706
+ options=this.setOptions;
3707
+ parse=this.parseMarkdown(true);
3708
+ parseInline=this.parseMarkdown(false);
3709
+ Parser=b;
3710
+ Renderer=P;
3711
+ TextRenderer=$;
3712
+ Lexer=x;
3713
+ Tokenizer=y;
3714
+ Hooks=S;
3715
+ constructor(...e) {
3716
+ this.use(...e);
3717
+ }
3718
+ walkTokens(e, t) {
3719
+ let n = [];
3720
+ for (let r of e) switch (n = n.concat(t.call(this, r)), r.type) {
3721
+ case "table":
3722
+ {
3723
+ let i = r;
3724
+ for (let s of i.header) n = n.concat(this.walkTokens(s.tokens, t));
3725
+ for (let s of i.rows) for (let a of s) n = n.concat(this.walkTokens(a.tokens, t));
3726
+ break;
3727
+ }
3728
+
3729
+ case "list":
3730
+ {
3731
+ let i = r;
3732
+ n = n.concat(this.walkTokens(i.items, t));
3733
+ break;
3734
+ }
3735
+
3736
+ default:
3737
+ {
3738
+ let i = r;
3739
+ this.defaults.extensions?.childTokens?.[i.type] ? this.defaults.extensions.childTokens[i.type].forEach(s => {
3740
+ let a = i[s].flat(1 / 0);
3741
+ n = n.concat(this.walkTokens(a, t));
3742
+ }) : i.tokens && (n = n.concat(this.walkTokens(i.tokens, t)));
3743
+ }
3744
+ }
3745
+ return n;
3746
+ }
3747
+ use(...e) {
3748
+ let t = this.defaults.extensions || {
3749
+ renderers: {},
3750
+ childTokens: {}
3751
+ };
3752
+ return e.forEach(n => {
3753
+ let r = {
3754
+ ...n
3755
+ };
3756
+ if (r.async = this.defaults.async || r.async || false, n.extensions && (n.extensions.forEach(i => {
3757
+ if (!i.name) throw new Error("extension name required");
3758
+ if ("renderer" in i) {
3759
+ let s = t.renderers[i.name];
3760
+ s ? t.renderers[i.name] = function(...a) {
3761
+ let o = i.renderer.apply(this, a);
3762
+ return o === false && (o = s.apply(this, a)), o;
3763
+ } : t.renderers[i.name] = i.renderer;
3764
+ }
3765
+ if ("tokenizer" in i) {
3766
+ if (!i.level || i.level !== "block" && i.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
3767
+ let s = t[i.level];
3768
+ s ? s.unshift(i.tokenizer) : t[i.level] = [ i.tokenizer ], i.start && (i.level === "block" ? t.startBlock ? t.startBlock.push(i.start) : t.startBlock = [ i.start ] : i.level === "inline" && (t.startInline ? t.startInline.push(i.start) : t.startInline = [ i.start ]));
3769
+ }
3770
+ "childTokens" in i && i.childTokens && (t.childTokens[i.name] = i.childTokens);
3771
+ }), r.extensions = t), n.renderer) {
3772
+ let i = this.defaults.renderer || new P(this.defaults);
3773
+ for (let s in n.renderer) {
3774
+ if (!(s in i)) throw new Error(`renderer '${s}' does not exist`);
3775
+ if ([ "options", "parser" ].includes(s)) continue;
3776
+ let a = s, o = n.renderer[a], l = i[a];
3777
+ i[a] = (...p) => {
3778
+ let c = o.apply(i, p);
3779
+ return c === false && (c = l.apply(i, p)), c || "";
3780
+ };
3781
+ }
3782
+ r.renderer = i;
3783
+ }
3784
+ if (n.tokenizer) {
3785
+ let i = this.defaults.tokenizer || new y(this.defaults);
3786
+ for (let s in n.tokenizer) {
3787
+ if (!(s in i)) throw new Error(`tokenizer '${s}' does not exist`);
3788
+ if ([ "options", "rules", "lexer" ].includes(s)) continue;
3789
+ let a = s, o = n.tokenizer[a], l = i[a];
3790
+ i[a] = (...p) => {
3791
+ let c = o.apply(i, p);
3792
+ return c === false && (c = l.apply(i, p)), c;
3793
+ };
3794
+ }
3795
+ r.tokenizer = i;
3796
+ }
3797
+ if (n.hooks) {
3798
+ let i = this.defaults.hooks || new S;
3799
+ for (let s in n.hooks) {
3800
+ if (!(s in i)) throw new Error(`hook '${s}' does not exist`);
3801
+ if ([ "options", "block" ].includes(s)) continue;
3802
+ let a = s, o = n.hooks[a], l = i[a];
3803
+ S.passThroughHooks.has(s) ? i[a] = p => {
3804
+ if (this.defaults.async && S.passThroughHooksRespectAsync.has(s)) return (async () => {
3805
+ let g = await o.call(i, p);
3806
+ return l.call(i, g);
3807
+ })();
3808
+ let c = o.call(i, p);
3809
+ return l.call(i, c);
3810
+ } : i[a] = (...p) => {
3811
+ if (this.defaults.async) return (async () => {
3812
+ let g = await o.apply(i, p);
3813
+ return g === false && (g = await l.apply(i, p)), g;
3814
+ })();
3815
+ let c = o.apply(i, p);
3816
+ return c === false && (c = l.apply(i, p)), c;
3817
+ };
3818
+ }
3819
+ r.hooks = i;
3820
+ }
3821
+ if (n.walkTokens) {
3822
+ let i = this.defaults.walkTokens, s = n.walkTokens;
3823
+ r.walkTokens = function(a) {
3824
+ let o = [];
3825
+ return o.push(s.call(this, a)), i && (o = o.concat(i.call(this, a))), o;
3826
+ };
3827
+ }
3828
+ this.defaults = {
3829
+ ...this.defaults,
3830
+ ...r
3831
+ };
3832
+ }), this;
3833
+ }
3834
+ setOptions(e) {
3835
+ return this.defaults = {
3836
+ ...this.defaults,
3837
+ ...e
3838
+ }, this;
3839
+ }
3840
+ lexer(e, t) {
3841
+ return x.lex(e, t ?? this.defaults);
3842
+ }
3843
+ parser(e, t) {
3844
+ return b.parse(e, t ?? this.defaults);
3845
+ }
3846
+ parseMarkdown(e) {
3847
+ return (n, r) => {
3848
+ let i = {
3849
+ ...r
3850
+ }, s = {
3851
+ ...this.defaults,
3852
+ ...i
3853
+ }, a = this.onError(!!s.silent, !!s.async);
3854
+ if (this.defaults.async === true && i.async === false) return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
3855
+ if (typeof n > "u" || n === null) return a(new Error("marked(): input parameter is undefined or null"));
3856
+ if (typeof n != "string") return a(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
3857
+ if (s.hooks && (s.hooks.options = s, s.hooks.block = e), s.async) return (async () => {
3858
+ let o = s.hooks ? await s.hooks.preprocess(n) : n, p = await (s.hooks ? await s.hooks.provideLexer() : e ? x.lex : x.lexInline)(o, s), c = s.hooks ? await s.hooks.processAllTokens(p) : p;
3859
+ s.walkTokens && await Promise.all(this.walkTokens(c, s.walkTokens));
3860
+ let h = await (s.hooks ? await s.hooks.provideParser() : e ? b.parse : b.parseInline)(c, s);
3861
+ return s.hooks ? await s.hooks.postprocess(h) : h;
3862
+ })().catch(a);
3863
+ try {
3864
+ s.hooks && (n = s.hooks.preprocess(n));
3865
+ let l = (s.hooks ? s.hooks.provideLexer() : e ? x.lex : x.lexInline)(n, s);
3866
+ s.hooks && (l = s.hooks.processAllTokens(l)), s.walkTokens && this.walkTokens(l, s.walkTokens);
3867
+ let c = (s.hooks ? s.hooks.provideParser() : e ? b.parse : b.parseInline)(l, s);
3868
+ return s.hooks && (c = s.hooks.postprocess(c)), c;
3869
+ } catch (o) {
3870
+ return a(o);
3871
+ }
3872
+ };
3873
+ }
3874
+ onError(e, t) {
3875
+ return n => {
3876
+ if (n.message += `\nPlease report this to https://github.com/markedjs/marked.`,
3877
+ e) {
3878
+ let r = "<p>An error occurred:</p><pre>" + w(n.message + "", true) + "</pre>";
3879
+ return t ? Promise.resolve(r) : r;
3880
+ }
3881
+ if (t) return Promise.reject(n);
3882
+ throw n;
3883
+ };
3884
+ }
3885
+ };
3886
+ var _ = new B;
3887
+ function d(u, e) {
3888
+ return _.parse(u, e);
3889
+ }
3890
+ d.options = d.setOptions = function(u) {
3891
+ return _.setOptions(u), d.defaults = _.defaults, Z(d.defaults), d;
3892
+ };
3893
+ d.getDefaults = L;
3894
+ d.defaults = T;
3895
+ d.use = function(...u) {
3896
+ return _.use(...u), d.defaults = _.defaults, Z(d.defaults), d;
3897
+ };
3898
+ d.walkTokens = function(u, e) {
3899
+ return _.walkTokens(u, e);
3900
+ };
3901
+ d.parseInline = _.parseInline;
3902
+ d.Parser = b;
3903
+ d.parser = b.parse;
3904
+ d.Renderer = P;
3905
+ d.TextRenderer = $;
3906
+ d.Lexer = x;
3907
+ d.lexer = x.lex;
3908
+ d.Tokenizer = y;
3909
+ d.Hooks = S;
3910
+ d.parse = d;
3911
+ d.options;
3912
+ d.setOptions;
3913
+ d.use;
3914
+ d.walkTokens;
3915
+ d.parseInline;
3916
+ b.parse;
3917
+ x.lex;
3918
+ const reEscapedHtml = /&(?:amp|lt|gt|quot|#(0+)?39);/g;
3919
+ const reHasEscapedHtml = RegExp(reEscapedHtml.source);
3920
+ const htmlUnescapes = {
3921
+ "&amp;": "&",
3922
+ "&lt;": "<",
3923
+ "&gt;": ">",
3924
+ "&quot;": '"',
3925
+ "&#39;": "'"
3926
+ };
3927
+ function unescape(string) {
3928
+ return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, entity => htmlUnescapes[entity] || "'") : string || "";
3929
+ }
3930
+ const reUnescapedHtml = /[&<>"']/g;
3931
+ const reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
3932
+ const htmlEscapes = {
3933
+ "&": "&amp;",
3934
+ "<": "&lt;",
3935
+ ">": "&gt;",
3936
+ '"': "&quot;",
3937
+ "'": "&#39;"
3938
+ };
3939
+ function escape(string) {
3940
+ return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, chr => htmlEscapes[chr]) : string || "";
3941
+ }
3942
+ function helpersCleanup(string) {
3943
+ return string && string.replace("!>", "").replace("?>", "");
3944
+ }
3945
+ const markdownToTxtRenderer = {
3946
+ space() {
3947
+ return "";
3948
+ },
3949
+ code({text: text}) {
3950
+ const code = text.replace(/\n$/, "");
3951
+ return escape(code);
3952
+ },
3953
+ blockquote({tokens: tokens}) {
3954
+ return this.parser?.parse(tokens) || "";
3955
+ },
3956
+ html() {
3957
+ return "";
3958
+ },
3959
+ heading({tokens: tokens}) {
3960
+ return this.parser?.parseInline(tokens) || "";
3961
+ },
3962
+ hr() {
3963
+ return "";
3964
+ },
3965
+ list(token) {
3966
+ let body = "";
3967
+ for (let j = 0; j < token.items.length; j++) {
3968
+ const item = token.items[j];
3969
+ body += this.listitem?.(item);
3970
+ }
3971
+ return body;
3972
+ },
3973
+ listitem(item) {
3974
+ let itemBody = "";
3975
+ if (item.task) {
3976
+ const checkbox = this.checkbox?.({
3977
+ checked: !!item.checked
3978
+ });
3979
+ if (item.loose) {
3980
+ if (item.tokens.length > 0 && item.tokens[0].type === "paragraph") {
3981
+ item.tokens[0].text = checkbox + " " + item.tokens[0].text;
3982
+ if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === "text") {
3983
+ item.tokens[0].tokens[0].text = checkbox + " " + item.tokens[0].tokens[0].text;
3984
+ }
3985
+ } else {
3986
+ item.tokens.unshift({
3987
+ type: "text",
3988
+ raw: checkbox + " ",
3989
+ text: checkbox + " "
3990
+ });
3991
+ }
3992
+ } else {
3993
+ itemBody += checkbox + " ";
3994
+ }
3995
+ }
3996
+ itemBody += this.parser?.parse(item.tokens, !!item.loose);
3997
+ return `${itemBody || ""}`;
3998
+ },
3999
+ checkbox(options) {
4000
+ return "";
4001
+ },
4002
+ paragraph({tokens: tokens}) {
4003
+ return this.parser?.parseInline(tokens) || "";
4004
+ },
4005
+ table(token) {
4006
+ let header = "";
4007
+ let cell = "";
4008
+ for (let j = 0; j < token.header.length; j++) {
4009
+ cell += this.tablecell?.(token.header[j]);
4010
+ }
4011
+ header += this.tablerow?.({
4012
+ text: cell
4013
+ });
4014
+ let body = "";
4015
+ for (let j = 0; j < token.rows.length; j++) {
4016
+ const row = token.rows[j];
4017
+ cell = "";
4018
+ for (let k = 0; k < row.length; k++) {
4019
+ cell += this.tablecell?.(row[k]);
4020
+ }
4021
+ body += this.tablerow?.({
4022
+ text: cell
4023
+ });
4024
+ }
4025
+ return header + " " + body;
4026
+ },
4027
+ tablerow({text: text}) {
4028
+ return text;
4029
+ },
4030
+ tablecell(token) {
4031
+ return this.parser?.parseInline(token.tokens) || "";
4032
+ },
4033
+ strong({text: text}) {
4034
+ return text;
4035
+ },
4036
+ em({tokens: tokens}) {
4037
+ return this.parser?.parseInline(tokens) || "";
4038
+ },
4039
+ codespan({text: text}) {
4040
+ return text;
4041
+ },
4042
+ br() {
4043
+ return " ";
4044
+ },
4045
+ del({tokens: tokens}) {
4046
+ return this.parser?.parseInline(tokens);
4047
+ },
4048
+ link({tokens: tokens, href: href, title: title}) {
4049
+ return `${this.parser?.parseInline(tokens) || ""} ${href || ""} ${title || ""}`;
4050
+ },
4051
+ image({title: title, text: text, href: href}) {
4052
+ return `${text || ""} ${href || ""} ${title || ""}`;
4053
+ },
4054
+ text(token) {
4055
+ return token.tokens ? this.parser?.parseInline(token.tokens) || "" : token.text || "";
4056
+ }
4057
+ };
4058
+ const _marked = d.setOptions({
4059
+ renderer: markdownToTxtRenderer
4060
+ });
4061
+ function markdownToTxt(markdown) {
4062
+ const unmarked = _marked.parse(markdown);
4063
+ const unescaped = unescape(unmarked);
4064
+ const helpersCleaned = helpersCleanup(unescaped);
4065
+ return helpersCleaned.trim();
4066
+ }
4067
+ let STATE = createState();
4068
+ const CONFIG = {
4069
+ placeholder: "Type to search",
4070
+ noData: "No Results!",
4071
+ paths: "auto",
4072
+ depth: 2,
4073
+ maxAge: 864e5,
4074
+ namespace: undefined,
4075
+ pathNamespaces: undefined,
4076
+ keyBindings: [ "/", "meta+k", "ctrl+k" ],
4077
+ insertAfter: undefined,
4078
+ insertBefore: undefined,
4079
+ limit: 30,
4080
+ mode: "sidebar"
4081
+ };
4082
+ function createState() {
4083
+ return {
4084
+ key: null,
4085
+ index: null,
4086
+ mounted: null,
4087
+ building: null,
4088
+ uiReady: false,
4089
+ noDataText: ""
4090
+ };
4091
+ }
4092
+ function escapeHtml(string) {
4093
+ const entityMap = {
4094
+ "&": "&amp;",
4095
+ "<": "&lt;",
4096
+ ">": "&gt;",
4097
+ '"': "&quot;",
4098
+ "'": "&#39;"
4099
+ };
4100
+ return String(string).replace(/[&<>"']/g, s => entityMap[s]);
4101
+ }
4102
+ function stripDiacritics(text) {
4103
+ if (text && text.normalize) {
4104
+ return text.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
4105
+ }
4106
+ return text || "";
4107
+ }
4108
+ function escapeRegExp(string) {
4109
+ return String(string).replace(/[|\\{}()[\]^$+*?.]/g, "\\$&");
4110
+ }
4111
+ function keywordList(query) {
4112
+ const q = (query || "").trim();
4113
+ if (!q) {
4114
+ return [];
4115
+ }
4116
+ let keywords = q.split(/[\s\-,\\/]+/).filter(Boolean);
4117
+ if (keywords.length !== 1) {
4118
+ keywords = [ q, ...keywords ];
4119
+ }
4120
+ return keywords;
4121
+ }
4122
+ function highlightSnippet(text, query, maxLen = 120) {
4123
+ const content = stripDiacritics(text || "");
4124
+ const keys = keywordList(query).map(k => stripDiacritics(k));
4125
+ const key = keys.find(k => k && content.toLowerCase().includes(k.toLowerCase()));
4126
+ if (!key) {
4127
+ const clipped = content.slice(0, maxLen);
4128
+ return escapeHtml(clipped);
4129
+ }
4130
+ const idx = content.toLowerCase().indexOf(key.toLowerCase());
4131
+ const start = Math.max(0, idx - 30);
4132
+ const end = Math.min(content.length, idx + key.length + 80);
4133
+ const slice = content.slice(start, end);
4134
+ const escapedSlice = escapeHtml(slice);
4135
+ const escapedKey = escapeHtml(key);
4136
+ const reg = new RegExp(escapeRegExp(escapedKey), "ig");
4137
+ const marked = escapedSlice.replace(reg, word => `<mark>${word}</mark>`);
4138
+ return (start > 0 ? "…" : "") + marked + (end < content.length ? "…" : "");
4139
+ }
4140
+ function getAllPaths(router) {
4141
+ const paths = [];
4142
+ Docsify.dom.findAll(".sidebar-nav a:not(.section-link):not([data-nosearch])").forEach(node => {
4143
+ const href = node.href;
4144
+ const originHref = node.getAttribute("href");
4145
+ const parsed = router.parse(href);
4146
+ const path = parsed.path;
4147
+ if (path && paths.indexOf(path) === -1 && !Docsify.util.isAbsolutePath(originHref)) {
4148
+ paths.push(path);
4149
+ }
4150
+ });
4151
+ return paths;
4152
+ }
4153
+ function getTableData(token) {
4154
+ if (!token.text && token.type === "table") {
4155
+ token.rows.unshift(token.header);
4156
+ token.text = token.rows.map(columns => columns.map(r => r.text).join(" | ")).join(" |\n ");
4157
+ }
4158
+ return token.text;
4159
+ }
4160
+ function getListData(token) {
4161
+ if (!token.text && token.type === "list") {
4162
+ token.text = token.raw;
4163
+ }
4164
+ return token.text;
4165
+ }
4166
+ function genIndex(path, content = "", router, depth) {
4167
+ const tokens = window.marked.lexer(content);
4168
+ const slugify = window.Docsify.slugify;
4169
+ const index = {};
4170
+ let slug;
4171
+ let title = "";
4172
+ tokens.forEach((token, tokenIndex) => {
4173
+ if (token.type === "heading" && token.depth <= depth) {
4174
+ const {str: str, config: config} = getAndRemoveConfig(token.text);
4175
+ slug = router.toURL(path, {
4176
+ id: slugify(config.id || token.text)
4177
+ });
4178
+ if (str) {
4179
+ title = getAndRemoveDocsifyIgnoreConfig(str).content;
4180
+ title = removeAtag(title.trim());
4181
+ }
4182
+ index[slug] = {
4183
+ id: slug,
4184
+ slug: slug,
4185
+ title: title,
4186
+ body: "",
4187
+ path: path
4188
+ };
4189
+ } else {
4190
+ if (tokenIndex === 0) {
4191
+ slug = router.toURL(path);
4192
+ index[slug] = {
4193
+ id: slug,
4194
+ slug: slug,
4195
+ title: path !== "/" ? path.slice(1) : "Home Page",
4196
+ body: markdownToTxt(token.text || ""),
4197
+ path: path
4198
+ };
4199
+ }
4200
+ if (!slug) {
4201
+ return;
4202
+ }
4203
+ if (!index[slug]) {
4204
+ index[slug] = {
4205
+ id: slug,
4206
+ slug: slug,
4207
+ title: "",
4208
+ body: "",
4209
+ path: path
4210
+ };
4211
+ }
4212
+ token.text = getTableData(token);
4213
+ token.text = getListData(token);
4214
+ const txt = markdownToTxt(token.text || "");
4215
+ if (!txt) {
4216
+ return;
4217
+ }
4218
+ if (index[slug].body) {
4219
+ index[slug].body += "\n" + txt;
4220
+ } else {
4221
+ index[slug].body = txt;
4222
+ }
4223
+ }
4224
+ });
4225
+ slugify.clear();
4226
+ return index;
4227
+ }
4228
+ function resolveNamespaceSuffix(paths, config) {
4229
+ let namespaceSuffix = "";
4230
+ if (paths.length && config.paths === "auto" && config.pathNamespaces) {
4231
+ const first = paths[0];
4232
+ if (Array.isArray(config.pathNamespaces)) {
4233
+ namespaceSuffix = config.pathNamespaces.filter(prefix => first.slice(0, prefix.length) === prefix)[0] || namespaceSuffix;
4234
+ } else if (config.pathNamespaces instanceof RegExp) {
4235
+ const matches = first.match(config.pathNamespaces);
4236
+ if (matches) {
4237
+ namespaceSuffix = matches[0];
4238
+ }
4239
+ }
4240
+ const isExistHome = paths.indexOf(namespaceSuffix + "/") === -1;
4241
+ const isExistReadme = paths.indexOf(namespaceSuffix + "/README") === -1;
4242
+ if (isExistHome && isExistReadme) {
4243
+ paths.unshift(namespaceSuffix + "/");
4244
+ }
4245
+ } else if (paths.indexOf("/") === -1 && paths.indexOf("/README") === -1) {
4246
+ paths.unshift("/");
4247
+ }
4248
+ return namespaceSuffix;
4249
+ }
4250
+ function storageKey(namespace, suffix) {
4251
+ const ns = namespace ? String(namespace) : "";
4252
+ const sfx = suffix ? String(suffix) : "";
4253
+ return `docsify.flexsearch/${ns}/${sfx}`.replace(/\/+$/, "");
4254
+ }
4255
+ function safeDbName(key) {
4256
+ return key.replace(/[^a-zA-Z0-9._-]+/g, "_");
4257
+ }
4258
+ function configHash(config, paths, suffix) {
4259
+ return JSON.stringify({
4260
+ paths: paths,
4261
+ depth: config.depth,
4262
+ suffix: suffix
4263
+ });
4264
+ }
4265
+ function tpl(vm, defaultValue = "") {
4266
+ const html = `\n\t\t<div class="input-wrap">\n\t\t\t<input type="search" value="${defaultValue}" required aria-keyshortcuts="/ control+k meta+k" />\n\t\t\t<button class="clear-button" title="Clear search">\n\t\t\t\t<span class="visually-hidden">Clear search</span>\n\t\t\t</button>\n\t\t\t<div class="kbd-group">\n\t\t\t\t<kbd title="Press / to search">/</kbd>\n\t\t\t\t<kbd title="Press Control+K to search">⌃K</kbd>\n\t\t\t</div>\n\t\t</div>\n\t\t<p class="results-status" aria-live="polite"></p>\n\t\t<div class="results-panel"></div>\n\t`;
4267
+ const root = Docsify.dom.create("section", html);
4268
+ root.classList.add("flexsearch-search");
4269
+ root.setAttribute("role", "search");
4270
+ return root;
4271
+ }
4272
+ function mountSidebar(vm, defaultValue) {
4273
+ const sidebarElm = Docsify.dom.find(".sidebar");
4274
+ if (!sidebarElm) {
4275
+ return;
4276
+ }
4277
+ const {insertAfter: insertAfter, insertBefore: insertBefore} = vm.config?.search || {};
4278
+ const root = tpl(vm, defaultValue);
4279
+ const insertElm = sidebarElm.querySelector(`:scope ${insertAfter || insertBefore || "> :first-child"}`);
4280
+ sidebarElm.insertBefore(root, insertAfter ? insertElm.nextSibling : insertElm);
4281
+ bindEvents(vm);
4282
+ }
4283
+ function mountModalTrigger(vm, defaultValue) {
4284
+ const sidebarElm = Docsify.dom.find(".sidebar");
4285
+ if (!sidebarElm) {
4286
+ return;
4287
+ }
4288
+ if (Docsify.dom.getNode(".flexsearch-trigger")) {
4289
+ return;
4290
+ }
4291
+ const {insertAfter: insertAfter, insertBefore: insertBefore} = vm.config?.search || {};
4292
+ const html = `\n\t\t<div class="input-wrap">\n\t\t\t<input type="search" value="${defaultValue}" readonly aria-haspopup="dialog" aria-keyshortcuts="/ control+k meta+k" />\n\t\t\t<div class="kbd-group">\n\t\t\t\t<kbd title="Press / to search">/</kbd>\n\t\t\t\t<kbd title="Press Control+K to search">⌃K</kbd>\n\t\t\t</div>\n\t\t</div>\n\t`;
4293
+ const root = Docsify.dom.create("section", html);
4294
+ root.classList.add("flexsearch-trigger");
4295
+ const insertElm = sidebarElm.querySelector(`:scope ${insertAfter || insertBefore || "> :first-child"}`);
4296
+ sidebarElm.insertBefore(root, insertAfter ? insertElm.nextSibling : insertElm);
4297
+ const input = root.querySelector('input[type="search"]');
4298
+ Docsify.dom.on(root, "click", e => e.stopPropagation());
4299
+ const open = () => {
4300
+ ensureUI(vm);
4301
+ openModal();
4302
+ };
4303
+ Docsify.dom.on(input, "focus", open);
4304
+ Docsify.dom.on(input, "click", open);
4305
+ }
4306
+ function mountModal(vm, defaultValue) {
4307
+ if (Docsify.dom.getNode(".flexsearch-modal")) {
4308
+ return;
4309
+ }
4310
+ const modal = document.createElement("div");
4311
+ modal.className = "flexsearch-modal";
4312
+ modal.innerHTML = `\n\t\t<div class="flexsearch-modal__backdrop" aria-hidden="true"></div>\n\t\t<div class="flexsearch-modal__dialog" role="dialog" aria-modal="true"></div>\n\t`;
4313
+ const dialog = modal.querySelector(".flexsearch-modal__dialog");
4314
+ dialog.appendChild(tpl(vm, defaultValue));
4315
+ document.body.appendChild(modal);
4316
+ Docsify.dom.on(modal.querySelector(".flexsearch-modal__backdrop"), "click", () => closeModal());
4317
+ Docsify.dom.on(modal, "keydown", e => {
4318
+ if (e.key === "Escape") {
4319
+ e.preventDefault();
4320
+ closeModal();
4321
+ }
4322
+ });
4323
+ bindEvents(vm);
4324
+ }
4325
+ function openModal() {
4326
+ const modal = Docsify.dom.getNode(".flexsearch-modal");
4327
+ if (!modal) {
4328
+ return;
4329
+ }
4330
+ modal.classList.add("is-open");
4331
+ const input = modal.querySelector('.flexsearch-search input[type="search"]');
4332
+ setTimeout(() => input?.focus(), 0);
4333
+ }
4334
+ function closeModal() {
4335
+ const modal = Docsify.dom.getNode(".flexsearch-modal");
4336
+ if (!modal) {
4337
+ return;
4338
+ }
4339
+ modal.classList.remove("is-open");
4340
+ }
4341
+ function updatePlaceholder(text, path) {
4342
+ const placeholder = typeof text === "string" ? text : text[Object.keys(text).filter(key => path.indexOf(key) > -1)[0]];
4343
+ const searchInput = Docsify.dom.getNode('.flexsearch-search input[type="search"]');
4344
+ if (searchInput) {
4345
+ searchInput.placeholder = placeholder;
4346
+ }
4347
+ const triggerInput = Docsify.dom.getNode('.flexsearch-trigger input[type="search"]');
4348
+ if (triggerInput) {
4349
+ triggerInput.placeholder = placeholder;
4350
+ }
4351
+ }
4352
+ function updateNoData(text, path) {
4353
+ if (typeof text === "string") {
4354
+ STATE.noDataText = text;
4355
+ } else {
4356
+ const match = Object.keys(text).filter(key => path.indexOf(key) > -1)[0];
4357
+ STATE.noDataText = text[match];
4358
+ }
4359
+ }
4360
+ function ensureUI(vm) {
4361
+ if (STATE.uiReady) {
4362
+ return;
4363
+ }
4364
+ if (Docsify.dom.getNode(".flexsearch-search")) {
4365
+ STATE.uiReady = true;
4366
+ return;
4367
+ }
4368
+ const keywords = vm.router.parse().query.s || "";
4369
+ if (CONFIG.mode === "modal") {
4370
+ mountModal(vm, escapeHtml(keywords));
4371
+ mountModalTrigger(vm, "");
4372
+ } else {
4373
+ mountSidebar(vm, escapeHtml(keywords));
4374
+ }
4375
+ STATE.uiReady = true;
4376
+ if (keywords) {
4377
+ setTimeout(() => {
4378
+ if (CONFIG.mode === "modal") {
4379
+ openModal();
4380
+ }
4381
+ void doSearch(vm, keywords);
4382
+ }, 500);
4383
+ }
4384
+ }
4385
+ function bindEvents(vm) {
4386
+ const $root = Docsify.dom.find(".flexsearch-search");
4387
+ const $input = Docsify.dom.find($root, "input");
4388
+ const $clear = Docsify.dom.find($root, ".clear-button");
4389
+ let timeId;
4390
+ Docsify.dom.on($root, "click", e => [ "A", "H2", "P", "EM" ].indexOf(e.target.tagName) === -1 && e.stopPropagation());
4391
+ Docsify.dom.on($input, "input", e => {
4392
+ clearTimeout(timeId);
4393
+ timeId = setTimeout(() => {
4394
+ const value = e.target.value.trim();
4395
+ void doSearch(vm, value);
4396
+ }, 120);
4397
+ });
4398
+ Docsify.dom.on($clear, "click", () => {
4399
+ $input.value = "";
4400
+ void doSearch(vm, "");
4401
+ });
4402
+ Docsify.dom.on($root, "click", e => {
4403
+ const target = e.target;
4404
+ const link = target?.closest?.("a");
4405
+ if (link && CONFIG.mode === "modal") {
4406
+ closeModal();
4407
+ }
4408
+ });
4409
+ }
4410
+ function setStatus(text) {
4411
+ const $status = Docsify.dom.find(".flexsearch-search .results-status");
4412
+ if ($status) {
4413
+ $status.textContent = text || "";
4414
+ }
4415
+ }
4416
+ function setResultsHTML(html) {
4417
+ const $root = Docsify.dom.find(".flexsearch-search");
4418
+ const $panel = Docsify.dom.find($root, ".results-panel");
4419
+ $panel.innerHTML = html || "";
4420
+ }
4421
+ async function computePaths(config, vm) {
4422
+ const isAuto = config.paths === "auto";
4423
+ const paths = isAuto ? getAllPaths(vm.router) : [ ...config.paths ];
4424
+ const suffix = resolveNamespaceSuffix(paths, config);
4425
+ return {
4426
+ paths: paths,
4427
+ suffix: suffix,
4428
+ isAuto: isAuto
4429
+ };
4430
+ }
4431
+ async function ensureIndex(config, vm) {
4432
+ const {paths: paths, suffix: suffix} = await computePaths(config, vm);
4433
+ const key = storageKey(config.namespace, suffix);
4434
+ const expiresKey = `${key}/expires`;
4435
+ const hashKey = `${key}/hash`;
4436
+ const now = Date.now();
4437
+ const expiresAt = Number(localStorage.getItem(expiresKey) || 0);
4438
+ const hash = configHash(config, paths, suffix);
4439
+ const prevHash = localStorage.getItem(hashKey) || "";
4440
+ const expired = expiresAt < now;
4441
+ const changed = prevHash !== hash;
4442
+ if (STATE.key !== key) {
4443
+ STATE = createState();
4444
+ STATE.key = key;
4445
+ }
4446
+ if (!STATE.index) {
4447
+ STATE.index = new FlexSearch.Document({
4448
+ tokenize: "forward",
4449
+ cache: 100,
4450
+ document: {
4451
+ id: "id",
4452
+ index: [ "title", "body" ],
4453
+ store: [ "id", "slug", "title", "body", "path" ]
4454
+ }
4455
+ });
4456
+ }
4457
+ if (!STATE.mounted) {
4458
+ STATE.mounted = (async () => {
4459
+ const idx = STATE.index;
4460
+ const db = new FlexSearch.IndexedDB({
4461
+ name: safeDbName(key),
4462
+ type: "varchar"
4463
+ });
4464
+ await idx.mount(db);
4465
+ })();
4466
+ }
4467
+ await STATE.mounted;
4468
+ if (!STATE.building && (expired || changed)) {
4469
+ STATE.building = (async () => {
4470
+ setStatus("Building search index…");
4471
+ const idx = STATE.index;
4472
+ try {
4473
+ await idx.destroy();
4474
+ } catch (e) {
4475
+ console.log(e);
4476
+ }
4477
+ STATE.index = new FlexSearch.Document({
4478
+ tokenize: "forward",
4479
+ cache: 100,
4480
+ document: {
4481
+ id: "id",
4482
+ index: [ "title", "body" ],
4483
+ store: [ "id", "slug", "title", "body", "path" ]
4484
+ }
4485
+ });
4486
+ const db = new FlexSearch.IndexedDB({
4487
+ name: safeDbName(key),
4488
+ type: "varchar"
4489
+ });
4490
+ const newIdx = STATE.index;
4491
+ await newIdx.mount(db);
4492
+ let count = 0;
4493
+ const total = paths.length;
4494
+ await Promise.all(paths.map(async path => {
4495
+ const file = vm.router.getFile(path);
4496
+ const content = await Docsify.get(file, false, vm.config.requestHeaders);
4497
+ const parts = genIndex(path, content, vm.router, config.depth);
4498
+ Object.values(parts).forEach(doc => {
4499
+ newIdx.add(doc);
4500
+ });
4501
+ count++;
4502
+ if (count === 1 || count === total || count % 10 === 0) {
4503
+ setStatus(`Building search index… (${count}/${total})`);
4504
+ }
4505
+ }));
4506
+ await newIdx.commit();
4507
+ localStorage.setItem(expiresKey, String(now + config.maxAge));
4508
+ localStorage.setItem(hashKey, hash);
4509
+ setStatus("");
4510
+ })().finally(() => {
4511
+ STATE.building = null;
4512
+ });
4513
+ }
4514
+ if (STATE.building) {
4515
+ await STATE.building;
4516
+ }
4517
+ }
4518
+ async function doSearch(vm, value) {
4519
+ const query = (value || "").trim();
4520
+ if (!query) {
4521
+ setResultsHTML("");
4522
+ setStatus("");
4523
+ return;
4524
+ }
4525
+ await ensureIndex(CONFIG, vm);
4526
+ const idx = STATE.index;
4527
+ let results;
4528
+ try {
4529
+ results = await idx.search(query, {
4530
+ limit: CONFIG.limit,
4531
+ enrich: true,
4532
+ merge: true
4533
+ });
4534
+ } catch (e) {
4535
+ console.log(e);
4536
+ results = await idx.search(query, {
4537
+ limit: CONFIG.limit,
4538
+ enrich: true,
4539
+ merge: true
4540
+ });
4541
+ }
4542
+ const list = Array.isArray(results) ? results : [];
4543
+ const items = list.map(r => r && r.doc).filter(Boolean).slice(0, CONFIG.limit);
4544
+ let html = "";
4545
+ items.forEach((doc, i) => {
4546
+ const titlePlain = (doc.title || "").replace(/<[^>]+>/g, "");
4547
+ const title = stripDiacritics(doc.title || "");
4548
+ const content = doc.body ? highlightSnippet(doc.body, query) : "";
4549
+ html += `\n\t\t\t<div class="matching-post" aria-label="search result ${i + 1}">\n\t\t\t\t<a href="${doc.slug}" title="${escapeHtml(titlePlain)}">\n <p class="title clamp-1">${highlightSnippet(title, query, 80)}</p>\n\t\t\t\t\t<p class="content clamp-2">${content ? `...${content}...` : ""}</p>\n\t\t\t\t</a>\n\t\t\t</div>\n\t\t`;
4550
+ });
4551
+ setResultsHTML(html);
4552
+ setStatus(items.length ? `Found ${items.length} results` : STATE.noDataText);
4553
+ }
4554
+ function applyUserConfig(vm) {
4555
+ const {util: util} = Docsify;
4556
+ const opts = vm.config.search || CONFIG;
4557
+ if (Array.isArray(opts)) {
4558
+ CONFIG.paths = opts;
4559
+ } else if (typeof opts === "object") {
4560
+ CONFIG.paths = Array.isArray(opts.paths) ? opts.paths : "auto";
4561
+ CONFIG.maxAge = util.isPrimitive(opts.maxAge) ? opts.maxAge : CONFIG.maxAge;
4562
+ CONFIG.placeholder = opts.placeholder || CONFIG.placeholder;
4563
+ CONFIG.noData = opts.noData || CONFIG.noData;
4564
+ CONFIG.depth = opts.depth || CONFIG.depth;
4565
+ CONFIG.namespace = opts.namespace || CONFIG.namespace;
4566
+ CONFIG.pathNamespaces = opts.pathNamespaces || CONFIG.pathNamespaces;
4567
+ CONFIG.keyBindings = opts.keyBindings || CONFIG.keyBindings;
4568
+ CONFIG.insertAfter = opts.insertAfter || CONFIG.insertAfter;
4569
+ CONFIG.insertBefore = opts.insertBefore || CONFIG.insertBefore;
4570
+ CONFIG.limit = opts.limit || CONFIG.limit;
4571
+ CONFIG.mode = opts.mode || CONFIG.mode;
4572
+ }
4573
+ }
4574
+ const install = function(hook, vm) {
4575
+ applyUserConfig(vm);
4576
+ hook.init(() => {
4577
+ const {keyBindings: keyBindings} = vm.config;
4578
+ if (keyBindings && keyBindings.constructor === Object) {
4579
+ keyBindings.focusFlexSearch = {
4580
+ bindings: CONFIG.keyBindings,
4581
+ callback() {
4582
+ ensureUI(vm);
4583
+ if (CONFIG.mode === "modal") {
4584
+ openModal();
4585
+ return;
4586
+ }
4587
+ const sidebarElm = document.querySelector(".sidebar");
4588
+ const sidebarToggleElm = document.querySelector(".sidebar-toggle");
4589
+ const searchElm = sidebarElm?.querySelector('.flexsearch-search input[type="search"]');
4590
+ const isSidebarHidden = (sidebarElm?.getBoundingClientRect().x ?? 0) < 0;
4591
+ isSidebarHidden && sidebarToggleElm?.click();
4592
+ setTimeout(() => searchElm?.focus(), isSidebarHidden ? 250 : 0);
4593
+ }
4594
+ };
4595
+ }
4596
+ });
4597
+ hook.mounted(() => {
4598
+ ensureUI(vm);
4599
+ updatePlaceholder(CONFIG.placeholder, vm.route.path);
4600
+ updateNoData(CONFIG.noData, vm.route.path);
4601
+ void ensureIndex(CONFIG, vm);
4602
+ });
4603
+ hook.doneEach(() => {
4604
+ ensureUI(vm);
4605
+ updatePlaceholder(CONFIG.placeholder, vm.route.path);
4606
+ updateNoData(CONFIG.noData, vm.route.path);
4607
+ if (CONFIG.paths === "auto") {
4608
+ void ensureIndex(CONFIG, vm);
4609
+ }
4610
+ });
4611
+ };
4612
+ window.$docsify = window.$docsify || {};
4613
+ window.$docsify.plugins = [ install, ...window.$docsify.plugins || [] ];
4614
+ })();