@xlxz/markdown-editor 2.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.
Files changed (66) hide show
  1. package/dist/index.cjs +1806 -0
  2. package/dist/index.d.ts +23 -0
  3. package/dist/index.js +1774 -0
  4. package/dist/plugins/attachment.d.ts +7 -0
  5. package/dist/plugins/base-extensions.d.ts +8 -0
  6. package/dist/plugins/close-brackets.d.ts +8 -0
  7. package/dist/plugins/expand-text.d.ts +11 -0
  8. package/dist/plugins/fold.d.ts +8 -0
  9. package/dist/plugins/hanging-indent.d.ts +7 -0
  10. package/dist/plugins/indent-guide.d.ts +7 -0
  11. package/dist/plugins/index.d.ts +22 -0
  12. package/dist/plugins/keymap.d.ts +8 -0
  13. package/dist/plugins/line-numbers.d.ts +7 -0
  14. package/dist/plugins/link-handler.d.ts +8 -0
  15. package/dist/plugins/list-continuation.d.ts +8 -0
  16. package/dist/plugins/live-preview.d.ts +8 -0
  17. package/dist/plugins/markdown-language.d.ts +8 -0
  18. package/dist/plugins/on-change.d.ts +7 -0
  19. package/dist/plugins/suggest.d.ts +16 -0
  20. package/dist/plugins/table-continuation.d.ts +9 -0
  21. package/dist/plugins/table.d.ts +7 -0
  22. package/dist/plugins/theme.d.ts +8 -0
  23. package/dist/plugins/types.d.ts +29 -0
  24. package/dist/table/copy-widget.d.ts +17 -0
  25. package/dist/table/detect.d.ts +15 -0
  26. package/dist/table/format.d.ts +15 -0
  27. package/dist/table/index.d.ts +6 -0
  28. package/dist/table/theme.d.ts +8 -0
  29. package/package.json +57 -0
  30. package/vendor/app.css +15715 -0
  31. package/vendor/enhance.js +641 -0
  32. package/vendor/i18n/en.json +2144 -0
  33. package/vendor/i18n/zh.json +2144 -0
  34. package/vendor/lib/codemirror.js +14806 -0
  35. package/vendor/lib/i18next.min.js +2654 -0
  36. package/vendor/lib/markdown.js +1717 -0
  37. package/vendor/lib/mathjax/output/chtml/fonts/tex.js +1 -0
  38. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_AMS-Regular.woff +0 -0
  39. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Calligraphic-Bold.woff +0 -0
  40. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Calligraphic-Regular.woff +0 -0
  41. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Fraktur-Bold.woff +0 -0
  42. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Fraktur-Regular.woff +0 -0
  43. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Main-Bold.woff +0 -0
  44. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Main-Italic.woff +0 -0
  45. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Main-Regular.woff +0 -0
  46. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Math-BoldItalic.woff +0 -0
  47. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Math-Italic.woff +0 -0
  48. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Math-Regular.woff +0 -0
  49. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_SansSerif-Bold.woff +0 -0
  50. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_SansSerif-Italic.woff +0 -0
  51. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_SansSerif-Regular.woff +0 -0
  52. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Script-Regular.woff +0 -0
  53. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Size1-Regular.woff +0 -0
  54. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Size2-Regular.woff +0 -0
  55. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Size3-Regular.woff +0 -0
  56. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Size4-Regular.woff +0 -0
  57. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Typewriter-Regular.woff +0 -0
  58. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Vector-Bold.woff +0 -0
  59. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Vector-Regular.woff +0 -0
  60. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Zero.woff +0 -0
  61. package/vendor/lib/mathjax/tex-chtml-full.js +36 -0
  62. package/vendor/lib/meta.min.js +1 -0
  63. package/vendor/lib/modes.min.js +236 -0
  64. package/vendor/lib/turndown.js +679 -0
  65. package/vendor/mock.js +28 -0
  66. package/vendor/obsidian-app.patched.js +161786 -0
@@ -0,0 +1,641 @@
1
+ (() => {
2
+ "use strict";
3
+ function t() {
4
+ function t(t, e, n) {
5
+ Object.defineProperty(t, e, {
6
+ value: n,
7
+ enumerable: !1,
8
+ configurable: !0,
9
+ writable: !0,
10
+ });
11
+ }
12
+ function e(t, e, n) {
13
+ Object.defineProperty(t, e, { get: n, enumerable: !1, configurable: !0 });
14
+ }
15
+ for (var n = window, r = 0, o = ["TouchEvent"]; r < o.length; r++) {
16
+ var i = o[r];
17
+ void 0 === n[i] && (n[i] = function () {});
18
+ }
19
+ try {
20
+ var s = window.matchMedia;
21
+ s &&
22
+ !s("(prefers-color-scheme: dark)").addEventListener &&
23
+ (window.matchMedia = function (t) {
24
+ var e = s(t);
25
+ return (
26
+ e.addEventListener ||
27
+ (e.addEventListener = function (t, e) {
28
+ this.addListener(e);
29
+ }),
30
+ e.removeEventListener ||
31
+ (e.removeEventListener = function (t, e) {
32
+ this.removeListener(e);
33
+ }),
34
+ e
35
+ );
36
+ });
37
+ } catch (t) {
38
+ console.error(t);
39
+ }
40
+ (window.ResizeObserver ||
41
+ (window.ResizeObserver = (function () {
42
+ function t() {}
43
+ return (
44
+ (t.prototype.observe = function () {}),
45
+ (t.prototype.unobserve = function () {}),
46
+ (t.prototype.disconnect = function () {}),
47
+ t
48
+ );
49
+ })()),
50
+ Object.isEmpty ||
51
+ t(Object, "isEmpty", function (t) {
52
+ for (var e in t) if (t.hasOwnProperty(e)) return !1;
53
+ return !0;
54
+ }),
55
+ Object.each ||
56
+ (Object.each = function (t, e, n) {
57
+ for (var r in t)
58
+ if (t.hasOwnProperty(r) && !1 === e.call(n, t[r], r)) return !1;
59
+ return !0;
60
+ }),
61
+ Array.combine ||
62
+ (Array.combine = function (t) {
63
+ for (var e = 0, n = 0, r = t; n < r.length; n++) {
64
+ e += r[n].length;
65
+ }
66
+ for (var o = new Array(e), i = 0, s = 0, a = t; s < a.length; s++)
67
+ for (var p = 0, c = a[s]; p < c.length; p++) {
68
+ var u = c[p];
69
+ ((o[i] = u), i++);
70
+ }
71
+ return o;
72
+ }),
73
+ Array.prototype.first ||
74
+ t(Array.prototype, "first", function () {
75
+ if (0 !== this.length) return this[0];
76
+ }),
77
+ Array.prototype.last ||
78
+ t(Array.prototype, "last", function () {
79
+ if (0 !== this.length) return this[this.length - 1];
80
+ }),
81
+ Array.prototype.contains ||
82
+ t(
83
+ Array.prototype,
84
+ "contains",
85
+ Array.prototype.includes ||
86
+ function (t) {
87
+ return -1 !== this.indexOf(t);
88
+ },
89
+ ),
90
+ Array.prototype.remove ||
91
+ t(Array.prototype, "remove", function (t) {
92
+ for (var e = this.length - 1; e >= 0; e--)
93
+ this[e] === t && this.splice(e, 1);
94
+ }),
95
+ Array.prototype.shuffle ||
96
+ t(Array.prototype, "shuffle", function () {
97
+ for (var t, e, n = this.length; 0 !== n; )
98
+ ((e = Math.floor(Math.random() * n)),
99
+ (t = this[(n -= 1)]),
100
+ (this[n] = this[e]),
101
+ (this[e] = t));
102
+ return this;
103
+ }),
104
+ Array.prototype.findLastIndex ||
105
+ t(Array.prototype, "findLastIndex", function (t) {
106
+ for (var e = this.length - 1; e <= 0; e--)
107
+ if (t(this[e], e)) return e;
108
+ return -1;
109
+ }),
110
+ Array.prototype.unique ||
111
+ t(Array.prototype, "unique", function () {
112
+ return Array.from(new Set(this).values());
113
+ }),
114
+ Math.clamp ||
115
+ (Math.clamp = function (t, e, n) {
116
+ return Math.min(Math.max(t, e), n);
117
+ }),
118
+ Math.square ||
119
+ (Math.square = function (t) {
120
+ return t * t;
121
+ }),
122
+ String.isString ||
123
+ (String.isString = function (t) {
124
+ return "string" == typeof t || t instanceof String;
125
+ }),
126
+ String.prototype.contains ||
127
+ t(
128
+ String.prototype,
129
+ "contains",
130
+ String.prototype.includes ||
131
+ function (t) {
132
+ return -1 !== this.indexOf(t);
133
+ },
134
+ ),
135
+ String.prototype.startsWith ||
136
+ (String.prototype.startsWith = function (t, e) {
137
+ return this.substr(!e || e < 0 ? 0 : +e, t.length) === t;
138
+ }),
139
+ String.prototype.endsWith ||
140
+ (String.prototype.endsWith = function (t, e) {
141
+ var n = void 0 === e || e > this.length ? this.length : e;
142
+ return this.substring(n - t.length, n) === t;
143
+ }),
144
+ String.prototype.format ||
145
+ (String.prototype.format = function () {
146
+ for (var t = [], e = 0; e < arguments.length; e++)
147
+ t[e] = arguments[e];
148
+ return this.replace(/{(\d+)}/g, function (e, n) {
149
+ return void 0 !== t[n] ? t[n] : e;
150
+ });
151
+ }),
152
+ Number.isNumber ||
153
+ t(Number, "isNumber", function (t) {
154
+ return "number" == typeof t;
155
+ }),
156
+ t(window, "isBoolean", function (t) {
157
+ return "boolean" == typeof t;
158
+ }));
159
+ var a = function (t) {
160
+ var e = t.nodeType;
161
+ if (1 === e || 9 === e || 11 === e) {
162
+ if ("string" == typeof t.textContent) return t.textContent;
163
+ for (var n = [], r = t.firstChild; r; r = r.nextSibling) n.push(a(r));
164
+ return n.join("");
165
+ }
166
+ return ((3 === e || 4 === e) && t.nodeValue) || "";
167
+ };
168
+ function p(t) {
169
+ var e = this.style;
170
+ for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]);
171
+ }
172
+ function c(t) {
173
+ var e = this.style;
174
+ for (var n in t) t.hasOwnProperty(n) && e.setProperty(n, t[n]);
175
+ }
176
+ ((Element.prototype.getText = function () {
177
+ return a(this);
178
+ }),
179
+ (Element.prototype.setText = function (t) {
180
+ !(function (t, e) {
181
+ if (e instanceof DocumentFragment || e instanceof Node)
182
+ return (t.empty(), void t.appendChild(e));
183
+ String.isString(e) || (e = String(e));
184
+ var n = t.nodeType;
185
+ (1 !== n && 9 !== n && 11 !== n) || (t.textContent = e);
186
+ })(this, t);
187
+ }),
188
+ (Element.prototype.addClass = function () {
189
+ for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
190
+ this.addClasses(t);
191
+ }),
192
+ (Element.prototype.addClasses = function (t) {
193
+ if (t) for (var e = 0; e < t.length; e++) this.classList.add(t[e]);
194
+ }),
195
+ (Element.prototype.removeClass = function () {
196
+ for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
197
+ this.removeClasses(t);
198
+ }),
199
+ (Element.prototype.removeClasses = function (t) {
200
+ for (var e = 0; e < t.length; e++) this.classList.remove(t[e]);
201
+ }),
202
+ (Element.prototype.toggleClass = function (t, e) {
203
+ (t instanceof Array || (t = [t]),
204
+ e ? this.addClasses(t) : this.removeClasses(t));
205
+ }),
206
+ (Element.prototype.hasClass = function (t) {
207
+ return this.classList.contains(t);
208
+ }),
209
+ [
210
+ Element.prototype,
211
+ Document.prototype,
212
+ DocumentFragment.prototype,
213
+ ].forEach(function (e) {
214
+ t(e, "prepend", function () {
215
+ for (var t = [], e = 0; e < arguments.length; e++)
216
+ t[e] = arguments[e];
217
+ for (
218
+ var n = document.createDocumentFragment(), r = 0, o = t;
219
+ r < o.length;
220
+ r++
221
+ ) {
222
+ var i = o[r];
223
+ n.appendChild(
224
+ i instanceof Node ? i : document.createTextNode(String(i)),
225
+ );
226
+ }
227
+ this.insertBefore(n, this.firstChild);
228
+ });
229
+ }),
230
+ (Node.prototype.detach = function () {
231
+ this.parentNode && this.parentNode.removeChild(this);
232
+ }),
233
+ (Node.prototype.empty = function () {
234
+ for (; this.lastChild; ) this.removeChild(this.lastChild);
235
+ }),
236
+ (Node.prototype.insertAfter = function (t, e) {
237
+ return (
238
+ e
239
+ ? this.insertBefore(t, e.nextSibling)
240
+ : this.insertBefore(t, this.firstChild),
241
+ t
242
+ );
243
+ }),
244
+ (Node.prototype.indexOf = function (t) {
245
+ return Array.prototype.indexOf.call(this.childNodes, t);
246
+ }),
247
+ (Node.prototype.setChildrenInPlace = function (t) {
248
+ for (
249
+ var e = this.firstChild, n = new Set(t), r = 0, o = t;
250
+ r < o.length;
251
+ r++
252
+ ) {
253
+ for (var i = o[r]; e && !n.has(e); ) {
254
+ var s = e;
255
+ ((e = e.nextSibling), this.removeChild(s));
256
+ }
257
+ i !== e ? this.insertBefore(i, e) : (e = e.nextSibling);
258
+ }
259
+ for (; e; ) {
260
+ s = e;
261
+ ((e = e.nextSibling), this.removeChild(s));
262
+ }
263
+ }),
264
+ (Node.prototype.appendText = function (t) {
265
+ this.appendChild(document.createTextNode(t));
266
+ }),
267
+ (Node.prototype.instanceOf = function (t) {
268
+ if (this instanceof t) return !0;
269
+ var e = this.win[t.name];
270
+ return (
271
+ !!(e && this instanceof e) ||
272
+ !!((e = this.constructorWin[t.name]) && this instanceof e)
273
+ );
274
+ }),
275
+ e(Node.prototype, "doc", function () {
276
+ return this.ownerDocument || document;
277
+ }),
278
+ e(Node.prototype, "win", function () {
279
+ return this.doc.defaultView || window;
280
+ }),
281
+ (Node.prototype.constructorWin = window),
282
+ (Element.prototype.setAttr = function (t, e) {
283
+ null === e ? this.removeAttribute(t) : this.setAttribute(t, String(e));
284
+ }),
285
+ (Element.prototype.setAttrs = function (t) {
286
+ for (var e in t)
287
+ if (t.hasOwnProperty(e)) {
288
+ var n = t[e];
289
+ this.setAttr(e, n);
290
+ }
291
+ }),
292
+ (Element.prototype.getAttr = Element.prototype.getAttribute),
293
+ t(Element.prototype, "matchParent", function (t, e) {
294
+ if (this.matches(t)) return this;
295
+ if (this === e) return null;
296
+ var n = this.parentElement;
297
+ return n ? n.matchParent(t, e) : null;
298
+ }),
299
+ (Element.prototype.getCssPropertyValue = function (t, e) {
300
+ return getComputedStyle(this, e).getPropertyValue(t).trim();
301
+ }),
302
+ t(Element.prototype, "isActiveElement", function () {
303
+ for (var t = this; t; ) {
304
+ if (t.doc.activeElement !== t) return !1;
305
+ var e = t.win.frameElement;
306
+ if (!e) return t.win === activeWindow;
307
+ t = e;
308
+ }
309
+ return !1;
310
+ }),
311
+ HTMLElement.prototype.show ||
312
+ (HTMLElement.prototype.show = function () {
313
+ "none" === this.style.display &&
314
+ ((this.style.display = this.getAttribute("data-display") || ""),
315
+ this.removeAttribute("data-display"));
316
+ }),
317
+ HTMLElement.prototype.hide ||
318
+ (HTMLElement.prototype.hide = function () {
319
+ var t = this.style.display;
320
+ "none" !== t &&
321
+ ((this.style.display = "none"),
322
+ t
323
+ ? this.setAttribute("data-display", t)
324
+ : this.removeAttribute("data-display"));
325
+ }),
326
+ HTMLElement.prototype.toggle ||
327
+ (HTMLElement.prototype.toggle = function (t) {
328
+ t ? this.show() : this.hide();
329
+ }),
330
+ HTMLElement.prototype.toggleVisibility ||
331
+ (HTMLElement.prototype.toggleVisibility = function (t) {
332
+ this.style.visibility = t ? "" : "hidden";
333
+ }),
334
+ t(HTMLElement.prototype, "isShown", function () {
335
+ return !!this.offsetParent;
336
+ }),
337
+ e(HTMLElement.prototype, "innerWidth", function () {
338
+ var t = getComputedStyle(this),
339
+ e = parseFloat(t.paddingLeft),
340
+ n = parseFloat(t.paddingRight);
341
+ return (
342
+ isNaN(e) && (e = 0),
343
+ isNaN(n) && (n = 0),
344
+ this.scrollWidth - e - n
345
+ );
346
+ }),
347
+ e(HTMLElement.prototype, "innerHeight", function () {
348
+ var t = getComputedStyle(this),
349
+ e = parseFloat(t.paddingTop),
350
+ n = parseFloat(t.paddingBottom);
351
+ return (
352
+ isNaN(e) && (e = 0),
353
+ isNaN(n) && (n = 0),
354
+ this.scrollHeight - e - n
355
+ );
356
+ }),
357
+ t(HTMLElement.prototype, "setCssStyles", p),
358
+ t(SVGElement.prototype, "setCssStyles", p),
359
+ t(HTMLElement.prototype, "setCssProps", c),
360
+ t(SVGElement.prototype, "setCssProps", c),
361
+ t(HTMLElement.prototype, "addEventListeners", function (t) {
362
+ for (var e in t)
363
+ if (t.hasOwnProperty(e)) {
364
+ var n = e,
365
+ r = t[n];
366
+ "function" == typeof r && this.addEventListener(n, r);
367
+ }
368
+ }),
369
+ (window.fish = function (t) {
370
+ return document.querySelector(t);
371
+ }),
372
+ (window.fishAll = function (t) {
373
+ return Array.prototype.slice.call(document.querySelectorAll(t));
374
+ }),
375
+ (Element.prototype.find = function (t) {
376
+ return this.querySelector(t);
377
+ }),
378
+ (Element.prototype.findAll = function (t) {
379
+ return Array.prototype.slice.call(this.querySelectorAll(t));
380
+ }),
381
+ (Element.prototype.findAllSelf = function (t) {
382
+ var e = Array.prototype.slice.call(this.querySelectorAll(t));
383
+ return (this.matches(t) && e.unshift(this), e);
384
+ }),
385
+ (DocumentFragment.prototype.find = function (t) {
386
+ return this.querySelector(t);
387
+ }),
388
+ (DocumentFragment.prototype.findAll = function (t) {
389
+ return Array.prototype.slice.call(this.querySelectorAll(t));
390
+ }),
391
+ (Node.prototype.createEl = function (t, e, n) {
392
+ return (
393
+ "string" == typeof e && (e = { cls: e }),
394
+ ((e = e || {}).parent = this),
395
+ createEl(t, e, n)
396
+ );
397
+ }),
398
+ (Node.prototype.createDiv = function (t, e) {
399
+ return this.createEl("div", t, e);
400
+ }),
401
+ (Node.prototype.createSpan = function (t, e) {
402
+ return this.createEl("span", t, e);
403
+ }),
404
+ (Node.prototype.createSvg = function (t, e, n) {
405
+ return (
406
+ "string" == typeof e && (e = { cls: e }),
407
+ ((e = e || {}).parent = this),
408
+ createSvg(t, e, n)
409
+ );
410
+ }),
411
+ (window.createEl = function (t, e, n) {
412
+ var r = document.createElement(t);
413
+ "string" == typeof e && (e = { cls: e });
414
+ var o = e || {},
415
+ i = o.cls,
416
+ s = o.text,
417
+ a = o.attr,
418
+ p = o.title,
419
+ c = o.value,
420
+ u = o.placeholder,
421
+ l = o.type,
422
+ f = o.parent,
423
+ d = o.prepend,
424
+ h = o.href;
425
+ for (var y in (i &&
426
+ (Array.isArray(i) ? (r.className = i.join(" ")) : (r.className = i)),
427
+ s && r.setText(s),
428
+ a && r.setAttrs(a),
429
+ void 0 !== p && (r.title = p),
430
+ void 0 !== c &&
431
+ (r instanceof HTMLInputElement ||
432
+ r instanceof HTMLSelectElement ||
433
+ r instanceof HTMLOptionElement) &&
434
+ (r.value = c),
435
+ l && r instanceof HTMLInputElement && (r.type = l),
436
+ l && r instanceof HTMLStyleElement && r.setAttribute("type", l),
437
+ u && r instanceof HTMLInputElement && (r.placeholder = u),
438
+ h &&
439
+ (r instanceof HTMLAnchorElement ||
440
+ r instanceof HTMLLinkElement ||
441
+ r instanceof HTMLBaseElement) &&
442
+ (r.href = h),
443
+ n && n(r),
444
+ f && (d ? f.insertBefore(r, f.firstChild) : f.appendChild(r)),
445
+ e))
446
+ if (e.hasOwnProperty(y) && y.startsWith("on")) {
447
+ var m = y,
448
+ v = e[m];
449
+ "function" == typeof v && r.addEventListener(m.substring(2), v);
450
+ }
451
+ return r;
452
+ }),
453
+ (window.createDiv = function (t, e) {
454
+ return createEl("div", t, e);
455
+ }),
456
+ (window.createSpan = function (t, e) {
457
+ return createEl("span", t, e);
458
+ }),
459
+ (window.createSvg = function (t, e, n) {
460
+ var r,
461
+ o = document.createElementNS("http://www.w3.org/2000/svg", t);
462
+ "string" == typeof e && (e = { cls: e });
463
+ var i = e || {},
464
+ s = i.cls,
465
+ a = i.attr,
466
+ p = i.parent,
467
+ c = i.prepend;
468
+ return (
469
+ s &&
470
+ (Array.isArray(s)
471
+ ? (r = o.classList).add.apply(r, s)
472
+ : o.classList.add(s)),
473
+ a && o.setAttrs(a),
474
+ n && n(o),
475
+ p && (c ? p.insertBefore(o, p.firstChild) : p.appendChild(o)),
476
+ o
477
+ );
478
+ }),
479
+ (window.createFragment = function (t) {
480
+ var e = document.createDocumentFragment();
481
+ return (t && t(e), e);
482
+ }));
483
+ var u = function (t, e, n, r) {
484
+ var o = this._EVENTS;
485
+ o || ((o = {}), (this._EVENTS = o));
486
+ var i = o[t];
487
+ i || ((i = []), (o[t] = i));
488
+ var s = function (t) {
489
+ var r = t.target;
490
+ if (r.matchParent) {
491
+ var o = r.matchParent(e, t.currentTarget);
492
+ o && n.call(this, t, o);
493
+ }
494
+ };
495
+ (i.push({ selector: e, listener: n, options: r, callback: s }),
496
+ this.addEventListener(t, s, r));
497
+ },
498
+ l = function (t, e, n, r) {
499
+ var o = this,
500
+ i = this._EVENTS;
501
+ if (i) {
502
+ var s = i[t];
503
+ s &&
504
+ (i[t] = s.filter(function (i) {
505
+ if (i.selector === e && i.listener === n && i.options === r) {
506
+ var s = i.callback;
507
+ return (o.removeEventListener(t, s, r), !1);
508
+ }
509
+ return !0;
510
+ }));
511
+ }
512
+ };
513
+ ((HTMLElement.prototype.on = u),
514
+ (HTMLElement.prototype.off = l),
515
+ (Document.prototype.on = u),
516
+ (Document.prototype.off = l),
517
+ (HTMLElement.prototype.onClickEvent = function (t, e) {
518
+ (this.addEventListener("click", t, e),
519
+ this.addEventListener("auxclick", t, e));
520
+ }),
521
+ (HTMLElement.prototype.trigger = function (t) {
522
+ var e = document.createEvent("HTMLEvents");
523
+ (e.initEvent(t, !0, !1), this.dispatchEvent(e));
524
+ }),
525
+ e(UIEvent.prototype, "targetNode", function () {
526
+ return this.target;
527
+ }),
528
+ e(UIEvent.prototype, "win", function () {
529
+ return this.view || window;
530
+ }),
531
+ e(UIEvent.prototype, "doc", function () {
532
+ return this.win.document;
533
+ }),
534
+ (UIEvent.prototype.instanceOf = function (t) {
535
+ if (this instanceof t) return !0;
536
+ var e = this.view;
537
+ if (!e) return !1;
538
+ var n = e[t.name];
539
+ return !(!n || n === t) && this instanceof n;
540
+ }));
541
+ var f = new WeakMap();
542
+ ((HTMLElement.prototype.onNodeInserted = function (t, e) {
543
+ var n = this,
544
+ r = function (r) {
545
+ n.isShown() && (e && o(), "node-inserted" === r.animationName && t());
546
+ },
547
+ o = function () {
548
+ n.removeEventListener("animationstart", r);
549
+ var t = (f.get(n) || 0) - 1;
550
+ t <= 0
551
+ ? (f.delete(n), n.removeClass("node-insert-event"))
552
+ : f.set(n, t);
553
+ };
554
+ return (
555
+ f.set(this, (f.get(this) || 0) + 1),
556
+ this.addClass("node-insert-event"),
557
+ this.addEventListener("animationstart", r),
558
+ o
559
+ );
560
+ }),
561
+ (HTMLElement.prototype.onWindowMigrated = function (t) {
562
+ var e = this,
563
+ n = this.win;
564
+ return this.onNodeInserted(function () {
565
+ var r = e.win;
566
+ r !== n && t((n = r));
567
+ });
568
+ }),
569
+ (window.ajax = function (t) {
570
+ var e = t.method,
571
+ n = t.url,
572
+ r = t.success,
573
+ o = t.error,
574
+ i = t.data,
575
+ s = t.headers,
576
+ a = t.withCredentials;
577
+ e = e || "GET";
578
+ var p = new XMLHttpRequest();
579
+ if (
580
+ ((t.req = p),
581
+ p.open(e, n, !0),
582
+ (p.onload = function () {
583
+ var t = p.status,
584
+ e = p.response;
585
+ t >= 200 && t < 400 ? r && r(e, p) : o && o(e, p);
586
+ }),
587
+ (p.onerror = function (t) {
588
+ o && o(t, p);
589
+ }),
590
+ s)
591
+ )
592
+ for (var c in s) s.hasOwnProperty(c) && p.setRequestHeader(c, s[c]);
593
+ ((p.withCredentials = a || !1),
594
+ i
595
+ ? (void 0 === a && (p.withCredentials = !0),
596
+ String.isString(i)
597
+ ? p.send(i)
598
+ : i instanceof ArrayBuffer
599
+ ? (p.setRequestHeader(
600
+ "Content-Type",
601
+ "application/octet-stream",
602
+ ),
603
+ p.send(i))
604
+ : (p.setRequestHeader(
605
+ "Content-Type",
606
+ "application/json; charset=utf-8",
607
+ ),
608
+ p.send(JSON.stringify(i))))
609
+ : p.send());
610
+ }),
611
+ (window.ajaxPromise = function (t) {
612
+ return new Promise(function (e, n) {
613
+ ((t.success = e),
614
+ (t.error = function (t, e) {
615
+ return n(e);
616
+ }),
617
+ ajax(t));
618
+ });
619
+ }),
620
+ (window.ready = function (t) {
621
+ "loading" !== document.readyState
622
+ ? t()
623
+ : document.addEventListener("DOMContentLoaded", t);
624
+ }),
625
+ (window.sleep = function (t) {
626
+ return new Promise(function (e) {
627
+ return window.setTimeout(e, t);
628
+ });
629
+ }),
630
+ (window.nextFrame = function () {
631
+ return new Promise(function (t) {
632
+ return window.requestAnimationFrame(function () {
633
+ return t();
634
+ });
635
+ });
636
+ }),
637
+ (window.activeWindow = window),
638
+ (window.activeDocument = document));
639
+ }
640
+ (t(), (window.globalEnhance = t));
641
+ })();