UNPKG

md-editor-v3

Version:

Markdown editor for vue3, developed in jsx and typescript, dark theme、beautify content by prettier、render articles directly、paste or clip the picture and upload it...

742 lines (741 loc) 29.3 kB
import { default as Ve } from "./MdEditor.mjs"; import { default as Ue } from "./NormalToolbar.mjs"; import { D as ze } from "./chunks/index.mjs"; import { default as Be } from "./ModalToolbar.mjs"; import { M as Qe } from "./chunks/index2.mjs"; import { S as Ze } from "./chunks/dom.mjs"; import { defineComponent as ye, createVNode as Ae } from "vue"; import { p as te } from "./chunks/config.mjs"; import { b as Ke, a as Ye, c as er, e as rr } from "./chunks/config.mjs"; import { g as Te } from "./chunks/vue-tsx.mjs"; import { C as ae } from "./chunks/index3.mjs"; import { M as ar } from "./chunks/index3.mjs"; import { M as nr } from "./chunks/index4.mjs"; import { en_US as or, zh_CN as lr } from "./config.mjs"; function xe(t, n) { for (var i = 0; i < n.length; i++) { const s = n[i]; if (typeof s != "string" && !Array.isArray(s)) { for (const g in s) if (g !== "default" && !(g in t)) { const e = Object.getOwnPropertyDescriptor(s, g); e && Object.defineProperty(t, g, e.get ? e : { enumerable: !0, get: () => s[g] }); } } } return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); } const ke = { onClick: { type: Function, default: void 0 }, /** * ==没有意义,仅用于规避克隆组件自动嵌入insert方法时,传入的是该组件而产生的waring */ language: { type: String, default: void 0 }, theme: { type: String, default: void 0 }, disabled: { type: Boolean, default: void 0 } /** * ==结束 */ }, Q = /* @__PURE__ */ ye({ name: "NormalFooterToolbar", props: ke, emits: ["onClick"], setup(t, n) { return () => { const i = Te({ props: t, ctx: n }); return Ae("div", { class: [`${te}-footer-item`, t.disabled && `${te}-disabled`], onClick: (s) => { t.disabled || (t.onClick?.(s), n.emit("onClick", s)); } }, [i]); }; } }); Q.install = (t) => (t.component(Q.name, Q), t); function Se(t) { return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t; } var z = { exports: {} }, w = {}, M = { exports: {} }, N = {}, ie; function ve() { if (ie) return N; ie = 1; function t() { var e = {}; return e["align-content"] = !1, e["align-items"] = !1, e["align-self"] = !1, e["alignment-adjust"] = !1, e["alignment-baseline"] = !1, e.all = !1, e["anchor-point"] = !1, e.animation = !1, e["animation-delay"] = !1, e["animation-direction"] = !1, e["animation-duration"] = !1, e["animation-fill-mode"] = !1, e["animation-iteration-count"] = !1, e["animation-name"] = !1, e["animation-play-state"] = !1, e["animation-timing-function"] = !1, e.azimuth = !1, e["backface-visibility"] = !1, e.background = !0, e["background-attachment"] = !0, e["background-clip"] = !0, e["background-color"] = !0, e["background-image"] = !0, e["background-origin"] = !0, e["background-position"] = !0, e["background-repeat"] = !0, e["background-size"] = !0, e["baseline-shift"] = !1, e.binding = !1, e.bleed = !1, e["bookmark-label"] = !1, e["bookmark-level"] = !1, e["bookmark-state"] = !1, e.border = !0, e["border-bottom"] = !0, e["border-bottom-color"] = !0, e["border-bottom-left-radius"] = !0, e["border-bottom-right-radius"] = !0, e["border-bottom-style"] = !0, e["border-bottom-width"] = !0, e["border-collapse"] = !0, e["border-color"] = !0, e["border-image"] = !0, e["border-image-outset"] = !0, e["border-image-repeat"] = !0, e["border-image-slice"] = !0, e["border-image-source"] = !0, e["border-image-width"] = !0, e["border-left"] = !0, e["border-left-color"] = !0, e["border-left-style"] = !0, e["border-left-width"] = !0, e["border-radius"] = !0, e["border-right"] = !0, e["border-right-color"] = !0, e["border-right-style"] = !0, e["border-right-width"] = !0, e["border-spacing"] = !0, e["border-style"] = !0, e["border-top"] = !0, e["border-top-color"] = !0, e["border-top-left-radius"] = !0, e["border-top-right-radius"] = !0, e["border-top-style"] = !0, e["border-top-width"] = !0, e["border-width"] = !0, e.bottom = !1, e["box-decoration-break"] = !0, e["box-shadow"] = !0, e["box-sizing"] = !0, e["box-snap"] = !0, e["box-suppress"] = !0, e["break-after"] = !0, e["break-before"] = !0, e["break-inside"] = !0, e["caption-side"] = !1, e.chains = !1, e.clear = !0, e.clip = !1, e["clip-path"] = !1, e["clip-rule"] = !1, e.color = !0, e["color-interpolation-filters"] = !0, e["column-count"] = !1, e["column-fill"] = !1, e["column-gap"] = !1, e["column-rule"] = !1, e["column-rule-color"] = !1, e["column-rule-style"] = !1, e["column-rule-width"] = !1, e["column-span"] = !1, e["column-width"] = !1, e.columns = !1, e.contain = !1, e.content = !1, e["counter-increment"] = !1, e["counter-reset"] = !1, e["counter-set"] = !1, e.crop = !1, e.cue = !1, e["cue-after"] = !1, e["cue-before"] = !1, e.cursor = !1, e.direction = !1, e.display = !0, e["display-inside"] = !0, e["display-list"] = !0, e["display-outside"] = !0, e["dominant-baseline"] = !1, e.elevation = !1, e["empty-cells"] = !1, e.filter = !1, e.flex = !1, e["flex-basis"] = !1, e["flex-direction"] = !1, e["flex-flow"] = !1, e["flex-grow"] = !1, e["flex-shrink"] = !1, e["flex-wrap"] = !1, e.float = !1, e["float-offset"] = !1, e["flood-color"] = !1, e["flood-opacity"] = !1, e["flow-from"] = !1, e["flow-into"] = !1, e.font = !0, e["font-family"] = !0, e["font-feature-settings"] = !0, e["font-kerning"] = !0, e["font-language-override"] = !0, e["font-size"] = !0, e["font-size-adjust"] = !0, e["font-stretch"] = !0, e["font-style"] = !0, e["font-synthesis"] = !0, e["font-variant"] = !0, e["font-variant-alternates"] = !0, e["font-variant-caps"] = !0, e["font-variant-east-asian"] = !0, e["font-variant-ligatures"] = !0, e["font-variant-numeric"] = !0, e["font-variant-position"] = !0, e["font-weight"] = !0, e.grid = !1, e["grid-area"] = !1, e["grid-auto-columns"] = !1, e["grid-auto-flow"] = !1, e["grid-auto-rows"] = !1, e["grid-column"] = !1, e["grid-column-end"] = !1, e["grid-column-start"] = !1, e["grid-row"] = !1, e["grid-row-end"] = !1, e["grid-row-start"] = !1, e["grid-template"] = !1, e["grid-template-areas"] = !1, e["grid-template-columns"] = !1, e["grid-template-rows"] = !1, e["hanging-punctuation"] = !1, e.height = !0, e.hyphens = !1, e.icon = !1, e["image-orientation"] = !1, e["image-resolution"] = !1, e["ime-mode"] = !1, e["initial-letters"] = !1, e["inline-box-align"] = !1, e["justify-content"] = !1, e["justify-items"] = !1, e["justify-self"] = !1, e.left = !1, e["letter-spacing"] = !0, e["lighting-color"] = !0, e["line-box-contain"] = !1, e["line-break"] = !1, e["line-grid"] = !1, e["line-height"] = !1, e["line-snap"] = !1, e["line-stacking"] = !1, e["line-stacking-ruby"] = !1, e["line-stacking-shift"] = !1, e["line-stacking-strategy"] = !1, e["list-style"] = !0, e["list-style-image"] = !0, e["list-style-position"] = !0, e["list-style-type"] = !0, e.margin = !0, e["margin-bottom"] = !0, e["margin-left"] = !0, e["margin-right"] = !0, e["margin-top"] = !0, e["marker-offset"] = !1, e["marker-side"] = !1, e.marks = !1, e.mask = !1, e["mask-box"] = !1, e["mask-box-outset"] = !1, e["mask-box-repeat"] = !1, e["mask-box-slice"] = !1, e["mask-box-source"] = !1, e["mask-box-width"] = !1, e["mask-clip"] = !1, e["mask-image"] = !1, e["mask-origin"] = !1, e["mask-position"] = !1, e["mask-repeat"] = !1, e["mask-size"] = !1, e["mask-source-type"] = !1, e["mask-type"] = !1, e["max-height"] = !0, e["max-lines"] = !1, e["max-width"] = !0, e["min-height"] = !0, e["min-width"] = !0, e["move-to"] = !1, e["nav-down"] = !1, e["nav-index"] = !1, e["nav-left"] = !1, e["nav-right"] = !1, e["nav-up"] = !1, e["object-fit"] = !1, e["object-position"] = !1, e.opacity = !1, e.order = !1, e.orphans = !1, e.outline = !1, e["outline-color"] = !1, e["outline-offset"] = !1, e["outline-style"] = !1, e["outline-width"] = !1, e.overflow = !1, e["overflow-wrap"] = !1, e["overflow-x"] = !1, e["overflow-y"] = !1, e.padding = !0, e["padding-bottom"] = !0, e["padding-left"] = !0, e["padding-right"] = !0, e["padding-top"] = !0, e.page = !1, e["page-break-after"] = !1, e["page-break-before"] = !1, e["page-break-inside"] = !1, e["page-policy"] = !1, e.pause = !1, e["pause-after"] = !1, e["pause-before"] = !1, e.perspective = !1, e["perspective-origin"] = !1, e.pitch = !1, e["pitch-range"] = !1, e["play-during"] = !1, e.position = !1, e["presentation-level"] = !1, e.quotes = !1, e["region-fragment"] = !1, e.resize = !1, e.rest = !1, e["rest-after"] = !1, e["rest-before"] = !1, e.richness = !1, e.right = !1, e.rotation = !1, e["rotation-point"] = !1, e["ruby-align"] = !1, e["ruby-merge"] = !1, e["ruby-position"] = !1, e["shape-image-threshold"] = !1, e["shape-outside"] = !1, e["shape-margin"] = !1, e.size = !1, e.speak = !1, e["speak-as"] = !1, e["speak-header"] = !1, e["speak-numeral"] = !1, e["speak-punctuation"] = !1, e["speech-rate"] = !1, e.stress = !1, e["string-set"] = !1, e["tab-size"] = !1, e["table-layout"] = !1, e["text-align"] = !0, e["text-align-last"] = !0, e["text-combine-upright"] = !0, e["text-decoration"] = !0, e["text-decoration-color"] = !0, e["text-decoration-line"] = !0, e["text-decoration-skip"] = !0, e["text-decoration-style"] = !0, e["text-emphasis"] = !0, e["text-emphasis-color"] = !0, e["text-emphasis-position"] = !0, e["text-emphasis-style"] = !0, e["text-height"] = !0, e["text-indent"] = !0, e["text-justify"] = !0, e["text-orientation"] = !0, e["text-overflow"] = !0, e["text-shadow"] = !0, e["text-space-collapse"] = !0, e["text-transform"] = !0, e["text-underline-position"] = !0, e["text-wrap"] = !0, e.top = !1, e.transform = !1, e["transform-origin"] = !1, e["transform-style"] = !1, e.transition = !1, e["transition-delay"] = !1, e["transition-duration"] = !1, e["transition-property"] = !1, e["transition-timing-function"] = !1, e["unicode-bidi"] = !1, e["vertical-align"] = !1, e.visibility = !1, e["voice-balance"] = !1, e["voice-duration"] = !1, e["voice-family"] = !1, e["voice-pitch"] = !1, e["voice-range"] = !1, e["voice-rate"] = !1, e["voice-stress"] = !1, e["voice-volume"] = !1, e.volume = !1, e["white-space"] = !1, e.widows = !1, e.width = !0, e["will-change"] = !1, e["word-break"] = !0, e["word-spacing"] = !0, e["word-wrap"] = !0, e["wrap-flow"] = !1, e["wrap-through"] = !1, e["writing-mode"] = !1, e["z-index"] = !1, e; } function n(e, v, u) { } function i(e, v, u) { } var s = /javascript\s*\:/img; function g(e, v) { return s.test(v) ? "" : v; } return N.whiteList = t(), N.getDefaultWhiteList = t, N.onAttr = n, N.onIgnoreAttr = i, N.safeAttrValue = g, N; } var j, ne; function he() { return ne || (ne = 1, j = { indexOf: function(t, n) { var i, s; if (Array.prototype.indexOf) return t.indexOf(n); for (i = 0, s = t.length; i < s; i++) if (t[i] === n) return i; return -1; }, forEach: function(t, n, i) { var s, g; if (Array.prototype.forEach) return t.forEach(n, i); for (s = 0, g = t.length; s < g; s++) n.call(i, t[s], s, t); }, trim: function(t) { return String.prototype.trim ? t.trim() : t.replace(/(^\s*)|(\s*$)/g, ""); }, trimRight: function(t) { return String.prototype.trimRight ? t.trimRight() : t.replace(/(\s*$)/g, ""); } }), j; } var Z, se; function Ee() { if (se) return Z; se = 1; var t = he(); function n(i, s) { i = t.trimRight(i), i[i.length - 1] !== ";" && (i += ";"); var g = i.length, e = !1, v = 0, u = 0, T = ""; function k() { if (!e) { var f = t.trim(i.slice(v, u)), a = f.indexOf(":"); if (a !== -1) { var y = t.trim(f.slice(0, a)), x = t.trim(f.slice(a + 1)); if (y) { var c = s(v, T.length, y, x, f); c && (T += c + "; "); } } } v = u + 1; } for (; u < g; u++) { var S = i[u]; if (S === "/" && i[u + 1] === "*") { var r = i.indexOf("*/", u + 2); if (r === -1) break; u = r + 1, v = u + 1, e = !1; } else S === "(" ? e = !0 : S === ")" ? e = !1 : S === ";" ? e || k() : S === ` ` && k(); } return t.trim(T); } return Z = n, Z; } var J, oe; function Ce() { if (oe) return J; oe = 1; var t = ve(), n = Ee(); he(); function i(e) { return e == null; } function s(e) { var v = {}; for (var u in e) v[u] = e[u]; return v; } function g(e) { e = s(e || {}), e.whiteList = e.whiteList || t.whiteList, e.onAttr = e.onAttr || t.onAttr, e.onIgnoreAttr = e.onIgnoreAttr || t.onIgnoreAttr, e.safeAttrValue = e.safeAttrValue || t.safeAttrValue, this.options = e; } return g.prototype.process = function(e) { if (e = e || "", e = e.toString(), !e) return ""; var v = this, u = v.options, T = u.whiteList, k = u.onAttr, S = u.onIgnoreAttr, r = u.safeAttrValue, f = n(e, function(a, y, x, c, I) { var p = T[x], d = !1; if (p === !0 ? d = p : typeof p == "function" ? d = p(c) : p instanceof RegExp && (d = p.test(c)), d !== !0 && (d = !1), c = r(x, c), !!c) { var C = { position: y, sourcePosition: a, source: I, isWhite: d }; if (d) { var b = k(x, c, C); return i(b) ? x + ":" + c : b; } else { var b = S(x, c, C); if (!i(b)) return b; } } }); return f; }, J = g, J; } var le; function ee() { return le || (le = 1, (function(t, n) { var i = ve(), s = Ce(); function g(v, u) { var T = new s(u); return T.process(v); } n = t.exports = g, n.FilterCSS = s; for (var e in i) n[e] = i[e]; typeof window < "u" && (window.filterCSS = t.exports); })(M, M.exports)), M.exports; } var K, fe; function re() { return fe || (fe = 1, K = { indexOf: function(t, n) { var i, s; if (Array.prototype.indexOf) return t.indexOf(n); for (i = 0, s = t.length; i < s; i++) if (t[i] === n) return i; return -1; }, forEach: function(t, n, i) { var s, g; if (Array.prototype.forEach) return t.forEach(n, i); for (s = 0, g = t.length; s < g; s++) n.call(i, t[s], s, t); }, trim: function(t) { return String.prototype.trim ? t.trim() : t.replace(/(^\s*)|(\s*$)/g, ""); }, spaceIndex: function(t) { var n = /\s|\n|\t/, i = n.exec(t); return i ? i.index : -1; } }), K; } var ue; function me() { if (ue) return w; ue = 1; var t = ee().FilterCSS, n = ee().getDefaultWhiteList, i = re(); function s() { return { a: ["target", "href", "title"], abbr: ["title"], address: [], area: ["shape", "coords", "href", "alt"], article: [], aside: [], audio: [ "autoplay", "controls", "crossorigin", "loop", "muted", "preload", "src" ], b: [], bdi: ["dir"], bdo: ["dir"], big: [], blockquote: ["cite"], br: [], caption: [], center: [], cite: [], code: [], col: ["align", "valign", "span", "width"], colgroup: ["align", "valign", "span", "width"], dd: [], del: ["datetime"], details: ["open"], div: [], dl: [], dt: [], em: [], figcaption: [], figure: [], font: ["color", "size", "face"], footer: [], h1: [], h2: [], h3: [], h4: [], h5: [], h6: [], header: [], hr: [], i: [], img: ["src", "alt", "title", "width", "height", "loading"], ins: ["datetime"], kbd: [], li: [], mark: [], nav: [], ol: [], p: [], pre: [], s: [], section: [], small: [], span: [], sub: [], summary: [], sup: [], strong: [], strike: [], table: ["width", "border", "align", "valign"], tbody: ["align", "valign"], td: ["width", "rowspan", "colspan", "align", "valign"], tfoot: ["align", "valign"], th: ["width", "rowspan", "colspan", "align", "valign"], thead: ["align", "valign"], tr: ["rowspan", "align", "valign"], tt: [], u: [], ul: [], video: [ "autoplay", "controls", "crossorigin", "loop", "muted", "playsinline", "poster", "preload", "src", "height", "width" ] }; } var g = new t(); function e(o, m, l) { } function v(o, m, l) { } function u(o, m, l) { } function T(o, m, l) { } function k(o) { return o.replace(r, "&lt;").replace(f, "&gt;"); } function S(o, m, l, h) { if (l = $(l), m === "href" || m === "src") { if (l = i.trim(l), l === "#") return "#"; if (!(l.substr(0, 7) === "http://" || l.substr(0, 8) === "https://" || l.substr(0, 7) === "mailto:" || l.substr(0, 4) === "tel:" || l.substr(0, 11) === "data:image/" || l.substr(0, 6) === "ftp://" || l.substr(0, 2) === "./" || l.substr(0, 3) === "../" || l[0] === "#" || l[0] === "/")) return ""; } else if (m === "background") { if (p.lastIndex = 0, p.test(l)) return ""; } else if (m === "style") { if (d.lastIndex = 0, d.test(l) || (C.lastIndex = 0, C.test(l) && (p.lastIndex = 0, p.test(l)))) return ""; h !== !1 && (h = h || g, l = h.process(l)); } return l = R(l), l; } var r = /</g, f = />/g, a = /"/g, y = /&quot;/g, x = /&#([a-zA-Z0-9]*);?/gim, c = /&colon;?/gim, I = /&newline;?/gim, p = /((j\s*a\s*v\s*a|v\s*b|l\s*i\s*v\s*e)\s*s\s*c\s*r\s*i\s*p\s*t\s*|m\s*o\s*c\s*h\s*a):/gi, d = /e\s*x\s*p\s*r\s*e\s*s\s*s\s*i\s*o\s*n\s*\(.*/gi, C = /u\s*r\s*l\s*\(.*/gi; function b(o) { return o.replace(a, "&quot;"); } function A(o) { return o.replace(y, '"'); } function E(o) { return o.replace(x, function(l, h) { return h[0] === "x" || h[0] === "X" ? String.fromCharCode(parseInt(h.substr(1), 16)) : String.fromCharCode(parseInt(h, 10)); }); } function L(o) { return o.replace(c, ":").replace(I, " "); } function F(o) { for (var m = "", l = 0, h = o.length; l < h; l++) m += o.charCodeAt(l) < 32 ? " " : o.charAt(l); return i.trim(m); } function $(o) { return o = A(o), o = E(o), o = L(o), o = F(o), o; } function R(o) { return o = b(o), o = k(o), o; } function P() { return ""; } function H(o, m) { typeof m != "function" && (m = function() { }); var l = !Array.isArray(o); function h(_) { return l ? !0 : i.indexOf(o, _) !== -1; } var O = [], W = !1; return { onIgnoreTag: function(_, V, q) { if (h(_)) if (q.isClosing) { var G = "[/removed]", we = q.position + G.length; return O.push([ W !== !1 ? W : q.position, we ]), W = !1, G; } else return W || (W = q.position), "[removed]"; else return m(_, V, q); }, remove: function(_) { var V = "", q = 0; return i.forEach(O, function(G) { V += _.slice(q, G[0]), q = G[1]; }), V += _.slice(q), V; } }; } function X(o) { for (var m = "", l = 0; l < o.length; ) { var h = o.indexOf("<!--", l); if (h === -1) { m += o.slice(l); break; } m += o.slice(l, h); var O = o.indexOf("-->", h); if (O === -1) break; l = O + 3; } return m; } function D(o) { var m = o.split(""); return m = m.filter(function(l) { var h = l.charCodeAt(0); return h === 127 ? !1 : h <= 31 ? h === 10 || h === 13 : !0; }), m.join(""); } return w.whiteList = s(), w.getDefaultWhiteList = s, w.onTag = e, w.onIgnoreTag = v, w.onTagAttr = u, w.onIgnoreTagAttr = T, w.safeAttrValue = S, w.escapeHtml = k, w.escapeQuote = b, w.unescapeQuote = A, w.escapeHtmlEntities = E, w.escapeDangerHtml5Entities = L, w.clearNonPrintableCharacter = F, w.friendlyAttrValue = $, w.escapeAttrValue = R, w.onIgnoreTagStripAll = P, w.StripTagBody = H, w.stripCommentTag = X, w.stripBlankChar = D, w.attributeWrapSign = '"', w.cssFilter = g, w.getDefaultCSSWhiteList = n, w; } var B = {}, ce; function be() { if (ce) return B; ce = 1; var t = re(); function n(r) { var f = t.spaceIndex(r), a; return f === -1 ? a = r.slice(1, -1) : a = r.slice(1, f + 1), a = t.trim(a).toLowerCase(), a.slice(0, 1) === "/" && (a = a.slice(1)), a.slice(-1) === "/" && (a = a.slice(0, -1)), a; } function i(r) { return r.slice(0, 2) === "</"; } function s(r, f, a) { var y = "", x = 0, c = !1, I = !1, p = 0, d = r.length, C = "", b = ""; e: for (p = 0; p < d; p++) { var A = r.charAt(p); if (c === !1) { if (A === "<") { c = p; continue; } } else if (I === !1) { if (A === "<") { y += a(r.slice(x, p)), c = p, x = p; continue; } if (A === ">" || p === d - 1) { y += a(r.slice(x, c)), b = r.slice(c, p + 1), C = n(b), y += f( c, y.length, C, b, i(b) ), x = p + 1, c = !1; continue; } if (A === '"' || A === "'") for (var E = 1, L = r.charAt(p - E); L.trim() === "" || L === "="; ) { if (L === "=") { I = A; continue e; } L = r.charAt(p - ++E); } } else if (A === I) { I = !1; continue; } } return x < d && (y += a(r.substr(x))), y; } var g = /[^a-zA-Z0-9\\_:.-]/gim; function e(r, f) { var a = 0, y = 0, x = [], c = !1, I = r.length; function p(E, L) { if (E = t.trim(E), E = E.replace(g, "").toLowerCase(), !(E.length < 1)) { var F = f(E, L || ""); F && x.push(F); } } for (var d = 0; d < I; d++) { var C = r.charAt(d), b, A; if (c === !1 && C === "=") { c = r.slice(a, d), a = d + 1, y = r.charAt(a) === '"' || r.charAt(a) === "'" ? a : u(r, d + 1); continue; } if (c !== !1 && d === y) { if (A = r.indexOf(C, d + 1), A === -1) break; b = t.trim(r.slice(y + 1, A)), p(c, b), c = !1, d = A, a = d + 1; continue; } if (/\s|\n|\t/.test(C)) if (r = r.replace(/\s|\n|\t/g, " "), c === !1) if (A = v(r, d), A === -1) { b = t.trim(r.slice(a, d)), p(b), c = !1, a = d + 1; continue; } else { d = A - 1; continue; } else if (A = T(r, d - 1), A === -1) { b = t.trim(r.slice(a, d)), b = S(b), p(c, b), c = !1, a = d + 1; continue; } else continue; } return a < r.length && (c === !1 ? p(r.slice(a)) : p(c, S(t.trim(r.slice(a))))), t.trim(x.join(" ")); } function v(r, f) { for (; f < r.length; f++) { var a = r[f]; if (a !== " ") return a === "=" ? f : -1; } } function u(r, f) { for (; f < r.length; f++) { var a = r[f]; if (a !== " ") return a === "'" || a === '"' ? f : -1; } } function T(r, f) { for (; f > 0; f--) { var a = r[f]; if (a !== " ") return a === "=" ? f : -1; } } function k(r) { return r[0] === '"' && r[r.length - 1] === '"' || r[0] === "'" && r[r.length - 1] === "'"; } function S(r) { return k(r) ? r.substr(1, r.length - 2) : r; } return B.parseTag = s, B.parseAttr = e, B; } var Y, ge; function Le() { if (ge) return Y; ge = 1; var t = ee().FilterCSS, n = me(), i = be(), s = i.parseTag, g = i.parseAttr, e = re(); function v(r) { return r == null; } function u(r) { var f = e.spaceIndex(r); if (f === -1) return { html: "", closing: r[r.length - 2] === "/" }; r = e.trim(r.slice(f + 1, -1)); var a = r[r.length - 1] === "/"; return a && (r = e.trim(r.slice(0, -1))), { html: r, closing: a }; } function T(r) { var f = {}; for (var a in r) f[a] = r[a]; return f; } function k(r) { var f = {}; for (var a in r) Array.isArray(r[a]) ? f[a.toLowerCase()] = r[a].map(function(y) { return y.toLowerCase(); }) : f[a.toLowerCase()] = r[a]; return f; } function S(r) { r = T(r || {}), r.stripIgnoreTag && (r.onIgnoreTag && console.error( 'Notes: cannot use these two options "stripIgnoreTag" and "onIgnoreTag" at the same time' ), r.onIgnoreTag = n.onIgnoreTagStripAll), r.whiteList || r.allowList ? r.whiteList = k(r.whiteList || r.allowList) : r.whiteList = n.whiteList, this.attributeWrapSign = r.singleQuotedAttributeValue === !0 ? "'" : n.attributeWrapSign, r.onTag = r.onTag || n.onTag, r.onTagAttr = r.onTagAttr || n.onTagAttr, r.onIgnoreTag = r.onIgnoreTag || n.onIgnoreTag, r.onIgnoreTagAttr = r.onIgnoreTagAttr || n.onIgnoreTagAttr, r.safeAttrValue = r.safeAttrValue || n.safeAttrValue, r.escapeHtml = r.escapeHtml || n.escapeHtml, this.options = r, r.css === !1 ? this.cssFilter = !1 : (r.css = r.css || {}, this.cssFilter = new t(r.css)); } return S.prototype.process = function(r) { if (r = r || "", r = r.toString(), !r) return ""; var f = this, a = f.options, y = a.whiteList, x = a.onTag, c = a.onIgnoreTag, I = a.onTagAttr, p = a.onIgnoreTagAttr, d = a.safeAttrValue, C = a.escapeHtml, b = f.attributeWrapSign, A = f.cssFilter; a.stripBlankChar && (r = n.stripBlankChar(r)), a.allowCommentTag || (r = n.stripCommentTag(r)); var E = !1; a.stripIgnoreTagBody && (E = n.StripTagBody( a.stripIgnoreTagBody, c ), c = E.onIgnoreTag); var L = s( r, function(F, $, R, P, H) { var X = { sourcePosition: F, position: $, isClosing: H, isWhite: Object.prototype.hasOwnProperty.call(y, R) }, D = x(R, P, X); if (!v(D)) return D; if (X.isWhite) { if (X.isClosing) return "</" + R + ">"; var o = u(P), m = y[R], l = g(o.html, function(h, O) { var W = e.indexOf(m, h) !== -1, _ = I(R, h, O, W); return v(_) ? W ? (O = d(R, h, O, A), O ? h + "=" + b + O + b : h) : (_ = p(R, h, O, W), v(_) ? void 0 : _) : _; }); return P = "<" + R, l && (P += " " + l), o.closing && (P += " /"), P += ">", P; } else return D = c(R, P, X), v(D) ? C(P) : D; }, C ); return E && (L = E.remove(L)), L; }, Y = S, Y; } var de; function _e() { return de || (de = 1, (function(t, n) { var i = me(), s = be(), g = Le(); function e(u, T) { var k = new g(T); return k.process(u); } n = t.exports = e, n.filterXSS = e, n.FilterXSS = g, (function() { for (var u in i) n[u] = i[u]; for (var T in s) n[T] = s[T]; })(), typeof window < "u" && (window.filterXSS = t.exports); function v() { return typeof self < "u" && typeof DedicatedWorkerGlobalScope < "u" && self instanceof DedicatedWorkerGlobalScope; } v() && (self.filterXSS = t.exports); })(z, z.exports)), z.exports; } var U = _e(); const Ie = /* @__PURE__ */ Se(U), Re = /* @__PURE__ */ xe({ __proto__: null, default: Ie }, [U]), pe = { img: ["class"], // 支持任务列表 input: ["class", "disabled", "type", "checked"], // 主要支持youtobe、腾讯视频、哔哩哔哩等内嵌视频代码 iframe: [ "class", "width", "height", "src", "title", "border", "frameborder", "framespacing", "allow", "allowfullscreen" ] }, Fe = (t, n) => { const { extendedWhiteList: i = {}, xss: s = {} } = n; let g; if (typeof s == "function") g = new U.FilterXSS(s(Re)); else { const e = U.getDefaultWhiteList(); [...Object.keys(i), ...Object.keys(pe)].forEach((u) => { const T = e[u] || [], k = pe[u] || [], S = i[u] || []; e[u] = [ .../* @__PURE__ */ new Set([...T, ...k, ...S]) ]; }), g = new U.FilterXSS({ whiteList: e, // 自定义的优先级最高 ...s }); } t.core.ruler.after("linkify", "xss", (e) => { for (let v = 0; v < e.tokens.length; v++) { const u = e.tokens[v]; switch (u.type) { case "html_block": { u.content = g.process(u.content); break; } case "inline": { (u.children || []).forEach((k) => { k.type === "html_inline" && (k.content = g.process(k.content)); }); break; } } } }); }, De = () => { Object.keys(ae).forEach((t) => { const n = document.getElementById(ae[t]); n && n.remove(); }); }; export { ze as DropdownToolbar, nr as MdCatalog, Ve as MdEditor, Qe as MdModal, ar as MdPreview, Be as ModalToolbar, Q as NormalFooterToolbar, Ue as NormalToolbar, Ze as StrIcon, Fe as XSSPlugin, Ke as allFooter, Ye as allToolbar, De as clearSideEffects, er as config, rr as editorExtensionsAttrs, or as en_US, te as prefix, lr as zh_CN };