diff --git a/controllers/api_series.go b/controllers/api_series.go index dcc8301..f050c97 100644 --- a/controllers/api_series.go +++ b/controllers/api_series.go @@ -64,9 +64,10 @@ func (p *SeriesAPI) searchHandler(app core.App) HandleFunc { } seen[series.Id] = true response = append(response, map[string]string{ - "id": series.Id, - "name": series.Title(), - "detail": series.Pseudonyms(), + "id": series.Id, + "name": series.Title(), + "detail": series.Pseudonyms(), + "musenalm_id": strconv.Itoa(series.MusenalmID()), }) if limit > 0 && len(response) >= limit { break diff --git a/views/assets/scripts.js b/views/assets/scripts.js index 5c79532..740c25d 100644 --- a/views/assets/scripts.js +++ b/views/assets/scripts.js @@ -1,22 +1,22 @@ -var $o = Object.defineProperty; -var ms = (s) => { +var Xa = Object.defineProperty; +var ps = (s) => { throw TypeError(s); }; -var Uo = (s, t, e) => t in s ? $o(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e; -var Jt = (s, t, e) => Uo(s, typeof t != "symbol" ? t + "" : t, e), ki = (s, t, e) => t.has(s) || ms("Cannot " + e); -var Ii = (s, t, e) => (ki(s, t, "read from private field"), e ? e.call(s) : t.get(s)), he = (s, t, e) => t.has(s) ? ms("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(s) : t.set(s, e), Ve = (s, t, e, i) => (ki(s, t, "write to private field"), i ? i.call(s, e) : t.set(s, e), e), ze = (s, t, e) => (ki(s, t, "access private method"), e); -var jo = "2.1.16"; -const Mt = "[data-trix-attachment]", Rn = { preview: { presentation: "gallery", caption: { name: !0, size: !0 } }, file: { caption: { size: !0 } } }, Y = { default: { tagName: "div", parse: !1 }, quote: { tagName: "blockquote", nestable: !0 }, heading1: { tagName: "h1", terminal: !0, breakOnReturn: !0, group: !1 }, code: { tagName: "pre", terminal: !0, htmlAttributes: ["language"], text: { plaintext: !0 } }, bulletList: { tagName: "ul", parse: !1 }, bullet: { tagName: "li", listAttribute: "bulletList", group: !1, nestable: !0, test(s) { - return gs(s.parentNode) === Y[this.listAttribute].tagName; +var Qa = (s, t, e) => t in s ? Xa(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e; +var Jt = (s, t, e) => Qa(s, typeof t != "symbol" ? t + "" : t, e), Ii = (s, t, e) => t.has(s) || ps("Cannot " + e); +var Ri = (s, t, e) => (Ii(s, t, "read from private field"), e ? e.call(s) : t.get(s)), he = (s, t, e) => t.has(s) ? ps("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(s) : t.set(s, e), je = (s, t, e, i) => (Ii(s, t, "write to private field"), i ? i.call(s, e) : t.set(s, e), e), We = (s, t, e) => (Ii(s, t, "access private method"), e); +var Za = "2.1.16"; +const Mt = "[data-trix-attachment]", On = { preview: { presentation: "gallery", caption: { name: !0, size: !0 } }, file: { caption: { size: !0 } } }, Y = { default: { tagName: "div", parse: !1 }, quote: { tagName: "blockquote", nestable: !0 }, heading1: { tagName: "h1", terminal: !0, breakOnReturn: !0, group: !1 }, code: { tagName: "pre", terminal: !0, htmlAttributes: ["language"], text: { plaintext: !0 } }, bulletList: { tagName: "ul", parse: !1 }, bullet: { tagName: "li", listAttribute: "bulletList", group: !1, nestable: !0, test(s) { + return fs(s.parentNode) === Y[this.listAttribute].tagName; } }, numberList: { tagName: "ol", parse: !1 }, number: { tagName: "li", listAttribute: "numberList", group: !1, nestable: !0, test(s) { - return gs(s.parentNode) === Y[this.listAttribute].tagName; -} }, attachmentGallery: { tagName: "div", exclusive: !0, terminal: !0, parse: !1, group: !1 } }, gs = (s) => { + return fs(s.parentNode) === Y[this.listAttribute].tagName; +} }, attachmentGallery: { tagName: "div", exclusive: !0, terminal: !0, parse: !1, group: !1 } }, fs = (s) => { var t; return s == null || (t = s.tagName) === null || t === void 0 ? void 0 : t.toLowerCase(); -}, ps = navigator.userAgent.match(/android\s([0-9]+.*Chrome)/i), Ri = ps && parseInt(ps[1]); -var Oe = { composesExistingText: /Android.*Chrome/.test(navigator.userAgent), recentAndroid: Ri && Ri > 12, samsungAndroid: Ri && navigator.userAgent.match(/Android.*SM-/), forcesObjectResizing: /Trident.*rv:11/.test(navigator.userAgent), supportsInputEvents: typeof InputEvent < "u" && ["data", "getTargetRanges", "inputType"].every((s) => s in InputEvent.prototype) }, Nr = { ADD_ATTR: ["language"], SAFE_FOR_XML: !1, RETURN_DOM: !0 }, v = { attachFiles: "Attach Files", bold: "Bold", bullets: "Bullets", byte: "Byte", bytes: "Bytes", captionPlaceholder: "Add a caption…", code: "Code", heading1: "Heading", indent: "Increase Level", italic: "Italic", link: "Link", numbers: "Numbers", outdent: "Decrease Level", quote: "Quote", redo: "Redo", remove: "Remove", strike: "Strikethrough", undo: "Undo", unlink: "Unlink", url: "URL", urlPlaceholder: "Enter a URL…", GB: "GB", KB: "KB", MB: "MB", PB: "PB", TB: "TB" }; -const Vo = [v.bytes, v.KB, v.MB, v.GB, v.TB, v.PB]; -var Pr = { prefix: "IEC", precision: 2, formatter(s) { +}, bs = navigator.userAgent.match(/android\s([0-9]+.*Chrome)/i), Di = bs && parseInt(bs[1]); +var Oe = { composesExistingText: /Android.*Chrome/.test(navigator.userAgent), recentAndroid: Di && Di > 12, samsungAndroid: Di && navigator.userAgent.match(/Android.*SM-/), forcesObjectResizing: /Trident.*rv:11/.test(navigator.userAgent), supportsInputEvents: typeof InputEvent < "u" && ["data", "getTargetRanges", "inputType"].every((s) => s in InputEvent.prototype) }, Kr = { ADD_ATTR: ["language"], SAFE_FOR_XML: !1, RETURN_DOM: !0 }, v = { attachFiles: "Attach Files", bold: "Bold", bullets: "Bullets", byte: "Byte", bytes: "Bytes", captionPlaceholder: "Add a caption…", code: "Code", heading1: "Heading", indent: "Increase Level", italic: "Italic", link: "Link", numbers: "Numbers", outdent: "Decrease Level", quote: "Quote", redo: "Redo", remove: "Remove", strike: "Strikethrough", undo: "Undo", unlink: "Unlink", url: "URL", urlPlaceholder: "Enter a URL…", GB: "GB", KB: "KB", MB: "MB", PB: "PB", TB: "TB" }; +const to = [v.bytes, v.KB, v.MB, v.GB, v.TB, v.PB]; +var Gr = { prefix: "IEC", precision: 2, formatter(s) { switch (s) { case 0: return "0 ".concat(v.bytes); @@ -26,34 +26,34 @@ var Pr = { prefix: "IEC", precision: 2, formatter(s) { let t; this.prefix === "SI" ? t = 1e3 : this.prefix === "IEC" && (t = 1024); const e = Math.floor(Math.log(s) / Math.log(t)), i = (s / Math.pow(t, e)).toFixed(this.precision).replace(/0*$/, "").replace(/\.$/, ""); - return "".concat(i, " ").concat(Vo[e]); + return "".concat(i, " ").concat(to[e]); } } }; -const ui = "\uFEFF", Lt = " ", Fr = function(s) { +const mi = "\uFEFF", Lt = " ", Jr = function(s) { for (const t in s) { const e = s[t]; this[t] = e; } return this; -}, Dn = document.documentElement, zo = Dn.matches, O = function(s) { - let { onElement: t, matchingSelector: e, withCallback: i, inPhase: n, preventDefault: r, times: o } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; - const a = t || Dn, l = e, d = n === "capturing", h = function(m) { - o != null && --o == 0 && h.destroy(); - const f = Ct(m.target, { matchingSelector: l }); - f != null && (i == null || i.call(f, m, f), r && m.preventDefault()); +}, Mn = document.documentElement, eo = Mn.matches, O = function(s) { + let { onElement: t, matchingSelector: e, withCallback: i, inPhase: n, preventDefault: r, times: a } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; + const o = t || Mn, l = e, c = n === "capturing", h = function(m) { + a != null && --a == 0 && h.destroy(); + const p = Ct(m.target, { matchingSelector: l }); + p != null && (i == null || i.call(p, m, p), r && m.preventDefault()); }; - return h.destroy = () => a.removeEventListener(s, h, d), a.addEventListener(s, h, d), h; -}, qr = function(s) { + return h.destroy = () => o.removeEventListener(s, h, c), o.addEventListener(s, h, c), h; +}, Yr = function(s) { let { bubbles: t, cancelable: e, attributes: i } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; t = t !== !1, e = e !== !1; const n = document.createEvent("Events"); - return n.initEvent(s, t, e), i != null && Fr.call(n, i), n; + return n.initEvent(s, t, e), i != null && Jr.call(n, i), n; }, Ae = function(s) { let { onElement: t, bubbles: e, cancelable: i, attributes: n } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; - const r = t ?? Dn, o = qr(s, { bubbles: e, cancelable: i, attributes: n }); - return r.dispatchEvent(o); -}, Hr = function(s, t) { - if ((s == null ? void 0 : s.nodeType) === 1) return zo.call(s, t); + const r = t ?? Mn, a = Yr(s, { bubbles: e, cancelable: i, attributes: n }); + return r.dispatchEvent(a); +}, Xr = function(s, t) { + if ((s == null ? void 0 : s.nodeType) === 1) return eo.call(s, t); }, Ct = function(s) { let { matchingSelector: t, untilNode: e } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; for (; s && s.nodeType !== Node.ELEMENT_NODE; ) s = s.parentNode; @@ -61,16 +61,16 @@ const ui = "\uFEFF", Lt = " ", Fr = function(s) { if (t == null) return s; if (s.closest && e == null) return s.closest(t); for (; s && s !== e; ) { - if (Hr(s, t)) return s; + if (Xr(s, t)) return s; s = s.parentNode; } } -}, On = (s) => document.activeElement !== s && Dt(s, document.activeElement), Dt = function(s, t) { +}, Bn = (s) => document.activeElement !== s && Dt(s, document.activeElement), Dt = function(s, t) { if (s && t) for (; t; ) { if (t === s) return !0; t = t.parentNode; } -}, Di = function(s) { +}, Oi = function(s) { var t; if ((t = s) === null || t === void 0 || !t.parentNode) return; let e = 0; @@ -79,7 +79,7 @@ const ui = "\uFEFF", Lt = " ", Fr = function(s) { }, wt = (s) => { var t; return s == null || (t = s.parentNode) === null || t === void 0 ? void 0 : t.removeChild(s); -}, ri = function(s) { +}, ai = function(s) { let { onlyNodesOfType: t, usingFilter: e, expandEntityReferences: i } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; const n = (() => { switch (t) { @@ -97,7 +97,7 @@ const ui = "\uFEFF", Lt = " ", Fr = function(s) { }, J = (s) => { var t; return s == null || (t = s.tagName) === null || t === void 0 ? void 0 : t.toLowerCase(); -}, A = function(s) { +}, x = function(s) { let t, e, i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; typeof s == "object" ? (i = s, s = i.tagName) : i = { attributes: i }; const n = document.createElement(s); @@ -119,30 +119,30 @@ const Ee = function() { t.tagName && ue.push(t.tagName); } return ue; -}, Oi = (s) => Zt(s == null ? void 0 : s.firstChild), fs = function(s) { +}, Mi = (s) => Zt(s == null ? void 0 : s.firstChild), _s = function(s) { let { strict: t } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : { strict: !0 }; return t ? Zt(s) : Zt(s) || !Zt(s.firstChild) && function(e) { return Ee().includes(J(e)) && !Ee().includes(J(e.firstChild)); }(s); -}, Zt = (s) => Wo(s) && (s == null ? void 0 : s.data) === "block", Wo = (s) => (s == null ? void 0 : s.nodeType) === Node.COMMENT_NODE, te = function(s) { +}, Zt = (s) => io(s) && (s == null ? void 0 : s.data) === "block", io = (s) => (s == null ? void 0 : s.nodeType) === Node.COMMENT_NODE, te = function(s) { let { name: t } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; - if (s) return xe(s) ? s.data === ui ? !t || s.parentNode.dataset.trixCursorTarget === t : void 0 : te(s.firstChild); -}, Bt = (s) => Hr(s, Mt), $r = (s) => xe(s) && (s == null ? void 0 : s.data) === "", xe = (s) => (s == null ? void 0 : s.nodeType) === Node.TEXT_NODE, Mn = { level2Enabled: !0, getLevel() { + if (s) return xe(s) ? s.data === mi ? !t || s.parentNode.dataset.trixCursorTarget === t : void 0 : te(s.firstChild); +}, Bt = (s) => Xr(s, Mt), Qr = (s) => xe(s) && (s == null ? void 0 : s.data) === "", xe = (s) => (s == null ? void 0 : s.nodeType) === Node.TEXT_NODE, Nn = { level2Enabled: !0, getLevel() { return this.level2Enabled && Oe.supportsInputEvents ? 2 : 0; }, pickFiles(s) { - const t = A("input", { type: "file", multiple: !0, hidden: !0, id: this.fileInputId }); + const t = x("input", { type: "file", multiple: !0, hidden: !0, id: this.fileInputId }); t.addEventListener("change", () => { s(t.files), wt(t); }), wt(document.getElementById(this.fileInputId)), document.body.appendChild(t), t.click(); } }; -var ii = { removeBlankTableCells: !1, tableCellSeparator: " | ", tableRowSeparator: ` +var ni = { removeBlankTableCells: !1, tableCellSeparator: " | ", tableRowSeparator: ` ` }, Pt = { bold: { tagName: "strong", inheritable: !0, parser(s) { const t = window.getComputedStyle(s); return t.fontWeight === "bold" || t.fontWeight >= 600; } }, italic: { tagName: "em", inheritable: !0, parser: (s) => window.getComputedStyle(s).fontStyle === "italic" }, href: { groupTagName: "a", parser(s) { const t = "a:not(".concat(Mt, ")"), e = s.closest(t); if (e) return e.getAttribute("href"); -} }, strike: { tagName: "del", inheritable: !0 }, frozen: { style: { backgroundColor: "highlight" } } }, Ur = { getDefaultHTML: () => `
+} }, strike: { tagName: "del", inheritable: !0 }, frozen: { style: { backgroundColor: "highlight" } } }, Zr = { getDefaultHTML: () => `
@@ -183,44 +183,44 @@ var ii = { removeBlankTableCells: !1, tableCellSeparator: " | ", tableRowSeparat
`) }; -const fn = { interval: 5e3 }; -var Me = Object.freeze({ __proto__: null, attachments: Rn, blockAttributes: Y, browser: Oe, css: { attachment: "attachment", attachmentCaption: "attachment__caption", attachmentCaptionEditor: "attachment__caption-editor", attachmentMetadata: "attachment__metadata", attachmentMetadataContainer: "attachment__metadata-container", attachmentName: "attachment__name", attachmentProgress: "attachment__progress", attachmentSize: "attachment__size", attachmentToolbar: "attachment__toolbar", attachmentGallery: "attachment-gallery" }, dompurify: Nr, fileSize: Pr, input: Mn, keyNames: { 8: "backspace", 9: "tab", 13: "return", 27: "escape", 37: "left", 39: "right", 46: "delete", 68: "d", 72: "h", 79: "o" }, lang: v, parser: ii, textAttributes: Pt, toolbar: Ur, undo: fn }); -class F { +const _n = { interval: 5e3 }; +var Me = Object.freeze({ __proto__: null, attachments: On, blockAttributes: Y, browser: Oe, css: { attachment: "attachment", attachmentCaption: "attachment__caption", attachmentCaptionEditor: "attachment__caption-editor", attachmentMetadata: "attachment__metadata", attachmentMetadataContainer: "attachment__metadata-container", attachmentName: "attachment__name", attachmentProgress: "attachment__progress", attachmentSize: "attachment__size", attachmentToolbar: "attachment__toolbar", attachmentGallery: "attachment-gallery" }, dompurify: Kr, fileSize: Gr, input: Nn, keyNames: { 8: "backspace", 9: "tab", 13: "return", 27: "escape", 37: "left", 39: "right", 46: "delete", 68: "d", 72: "h", 79: "o" }, lang: v, parser: ni, textAttributes: Pt, toolbar: Zr, undo: _n }); +class P { static proxyMethod(t) { - const { name: e, toMethod: i, toProperty: n, optional: r } = Ko(t); + const { name: e, toMethod: i, toProperty: n, optional: r } = no(t); this.prototype[e] = function() { - let o, a; - var l, d; - return i ? a = r ? (l = this[i]) === null || l === void 0 ? void 0 : l.call(this) : this[i]() : n && (a = this[n]), r ? (o = (d = a) === null || d === void 0 ? void 0 : d[e], o ? bs.call(o, a, arguments) : void 0) : (o = a[e], bs.call(o, a, arguments)); + let a, o; + var l, c; + return i ? o = r ? (l = this[i]) === null || l === void 0 ? void 0 : l.call(this) : this[i]() : n && (o = this[n]), r ? (a = (c = o) === null || c === void 0 ? void 0 : c[e], a ? vs.call(a, o, arguments) : void 0) : (a = o[e], vs.call(a, o, arguments)); }; } } -const Ko = function(s) { - const t = s.match(Go); +const no = function(s) { + const t = s.match(so); if (!t) throw new Error("can't parse @proxyMethod expression: ".concat(s)); const e = { name: t[4] }; return t[2] != null ? e.toMethod = t[1] : e.toProperty = t[1], t[3] != null && (e.optional = !0), e; -}, { apply: bs } = Function.prototype, Go = new RegExp("^(.+?)(\\(\\))?(\\?)?\\.(.+?)$"); -var Mi, Bi, Ni; -class ke extends F { +}, { apply: vs } = Function.prototype, so = new RegExp("^(.+?)(\\(\\))?(\\?)?\\.(.+?)$"); +var Bi, Ni, Pi; +class ke extends P { static box() { let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ""; return t instanceof this ? t : this.fromUCS2String(t == null ? void 0 : t.toString()); } static fromUCS2String(t) { - return new this(t, bn(t)); + return new this(t, vn(t)); } static fromCodepoints(t) { - return new this(vn(t), t); + return new this(yn(t), t); } constructor(t, e) { super(...arguments), this.ucs2String = t, this.codepoints = e, this.length = this.codepoints.length, this.ucs2Length = this.ucs2String.length; } offsetToUCS2Offset(t) { - return vn(this.codepoints.slice(0, Math.max(0, t))).length; + return yn(this.codepoints.slice(0, Math.max(0, t))).length; } offsetFromUCS2Offset(t) { - return bn(this.ucs2String.slice(0, Math.max(0, t))).length; + return vn(this.ucs2String.slice(0, Math.max(0, t))).length; } slice() { return this.constructor.fromCodepoints(this.codepoints.slice(...arguments)); @@ -241,9 +241,9 @@ class ke extends F { return this.ucs2String; } } -const Jo = ((Mi = Array.from) === null || Mi === void 0 ? void 0 : Mi.call(Array, "👼").length) === 1, Yo = ((Bi = " ".codePointAt) === null || Bi === void 0 ? void 0 : Bi.call(" ", 0)) != null, Xo = ((Ni = String.fromCodePoint) === null || Ni === void 0 ? void 0 : Ni.call(String, 32, 128124)) === " 👼"; -let bn, vn; -bn = Jo && Yo ? (s) => Array.from(s).map((t) => t.codePointAt(0)) : function(s) { +const ro = ((Bi = Array.from) === null || Bi === void 0 ? void 0 : Bi.call(Array, "👼").length) === 1, ao = ((Ni = " ".codePointAt) === null || Ni === void 0 ? void 0 : Ni.call(" ", 0)) != null, oo = ((Pi = String.fromCodePoint) === null || Pi === void 0 ? void 0 : Pi.call(String, 32, 128124)) === " 👼"; +let vn, yn; +vn = ro && ao ? (s) => Array.from(s).map((t) => t.codePointAt(0)) : function(s) { const t = []; let e = 0; const { length: i } = s; @@ -256,7 +256,7 @@ bn = Jo && Yo ? (s) => Array.from(s).map((t) => t.codePointAt(0)) : function(s) t.push(n); } return t; -}, vn = Xo ? (s) => String.fromCodePoint(...Array.from(s || [])) : function(s) { +}, yn = oo ? (s) => String.fromCodePoint(...Array.from(s || [])) : function(s) { return (() => { const t = []; return Array.from(s).forEach((e) => { @@ -265,13 +265,13 @@ bn = Jo && Yo ? (s) => Array.from(s).map((t) => t.codePointAt(0)) : function(s) }), t; })().join(""); }; -let Qo = 0; -class Ht extends F { +let lo = 0; +class qt extends P { static fromJSONString(t) { return this.fromJSON(JSON.parse(t)); } constructor() { - super(...arguments), this.id = ++Qo; + super(...arguments), this.id = ++lo; } hasSameConstructorAs(t) { return this.constructor === (t == null ? void 0 : t.constructor); @@ -305,12 +305,12 @@ const Ft = function() { for (let e = 0; e < s.length; e++) if (s[e] !== t[e]) return !1; return !0; -}, Bn = function(s) { +}, Pn = function(s) { const t = s.slice(0); for (var e = arguments.length, i = new Array(e > 1 ? e - 1 : 0), n = 1; n < e; n++) i[n - 1] = arguments[n]; return t.splice(...i), t; -}, Zo = /[\u05BE\u05C0\u05C3\u05D0-\u05EA\u05F0-\u05F4\u061B\u061F\u0621-\u063A\u0640-\u064A\u066D\u0671-\u06B7\u06BA-\u06BE\u06C0-\u06CE\u06D0-\u06D5\u06E5\u06E6\u200F\u202B\u202E\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE72\uFE74\uFE76-\uFEFC]/, ta = function() { - const s = A("input", { dir: "auto", name: "x", dirName: "x.dir" }), t = A("textarea", { dir: "auto", name: "y", dirName: "y.dir" }), e = A("form"); +}, co = /[\u05BE\u05C0\u05C3\u05D0-\u05EA\u05F0-\u05F4\u061B\u061F\u0621-\u063A\u0640-\u064A\u066D\u0671-\u06B7\u06BA-\u06BE\u06C0-\u06CE\u06D0-\u06D5\u06E5\u06E6\u200F\u202B\u202E\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE72\uFE74\uFE76-\uFEFC]/, ho = function() { + const s = x("input", { dir: "auto", name: "x", dirName: "x.dir" }), t = x("textarea", { dir: "auto", name: "y", dirName: "y.dir" }), e = x("form"); e.appendChild(s), e.appendChild(t); const i = function() { try { @@ -330,32 +330,32 @@ const Ft = function() { } : n ? function(r) { return s.value = r, s.matches(":dir(rtl)") ? "rtl" : "ltr"; } : function(r) { - const o = r.trim().charAt(0); - return Zo.test(o) ? "rtl" : "ltr"; + const a = r.trim().charAt(0); + return co.test(a) ? "rtl" : "ltr"; }; }(); -let Pi = null, Fi = null, qi = null, We = null; -const _n = () => (Pi || (Pi = ia().concat(ea())), Pi), N = (s) => Y[s], ea = () => (Fi || (Fi = Object.keys(Y)), Fi), yn = (s) => Pt[s], ia = () => (qi || (qi = Object.keys(Pt)), qi), jr = function(s, t) { - na(s).textContent = t.replace(/%t/g, s); -}, na = function(s) { +let Fi = null, Hi = null, qi = null, ze = null; +const An = () => (Fi || (Fi = mo().concat(uo())), Fi), N = (s) => Y[s], uo = () => (Hi || (Hi = Object.keys(Y)), Hi), En = (s) => Pt[s], mo = () => (qi || (qi = Object.keys(Pt)), qi), ta = function(s, t) { + go(s).textContent = t.replace(/%t/g, s); +}, go = function(s) { const t = document.createElement("style"); t.setAttribute("type", "text/css"), t.setAttribute("data-tag-name", s.toLowerCase()); - const e = sa(); + const e = po(); return e && t.setAttribute("nonce", e), document.head.insertBefore(t, document.head.firstChild), t; -}, sa = function() { - const s = vs("trix-csp-nonce") || vs("csp-nonce"); +}, po = function() { + const s = ys("trix-csp-nonce") || ys("csp-nonce"); if (s) { const { nonce: t, content: e } = s; return t == "" ? e : t; } -}, vs = (s) => document.head.querySelector("meta[name=".concat(s, "]")), _s = { "application/x-trix-feature-detection": "test" }, Vr = function(s) { +}, ys = (s) => document.head.querySelector("meta[name=".concat(s, "]")), As = { "application/x-trix-feature-detection": "test" }, ea = function(s) { const t = s.getData("text/plain"), e = s.getData("text/html"); if (!t || !e) return t == null ? void 0 : t.length; { const { body: i } = new DOMParser().parseFromString(e, "text/html"); if (i.textContent === t) return !i.querySelector("*"); } -}, zr = /Mac|^iP/.test(navigator.platform) ? (s) => s.metaKey : (s) => s.ctrlKey, Nn = (s) => setTimeout(s, 1), Wr = function() { +}, ia = /Mac|^iP/.test(navigator.platform) ? (s) => s.metaKey : (s) => s.ctrlKey, Fn = (s) => setTimeout(s, 1), na = function() { let s = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; const t = {}; for (const e in s) { @@ -369,22 +369,22 @@ const _n = () => (Pi || (Pi = ia().concat(ea())), Pi), N = (s) => Y[s], ea = () for (const e in s) if (s[e] !== t[e]) return !1; return !0; -}, T = function(s) { - if (s != null) return Array.isArray(s) || (s = [s, s]), [ys(s[0]), ys(s[1] != null ? s[1] : s[0])]; -}, _t = function(s) { +}, k = function(s) { + if (s != null) return Array.isArray(s) || (s = [s, s]), [Es(s[0]), Es(s[1] != null ? s[1] : s[0])]; +}, vt = function(s) { if (s == null) return; - const [t, e] = T(s); - return An(t, e); + const [t, e] = k(s); + return xn(t, e); }, oi = function(s, t) { if (s == null || t == null) return; - const [e, i] = T(s), [n, r] = T(t); - return An(e, n) && An(i, r); -}, ys = function(s) { - return typeof s == "number" ? s : Wr(s); -}, An = function(s, t) { + const [e, i] = k(s), [n, r] = k(t); + return xn(e, n) && xn(i, r); +}, Es = function(s) { + return typeof s == "number" ? s : na(s); +}, xn = function(s, t) { return typeof s == "number" ? s === t : ne(s, t); }; -class Kr extends F { +class sa extends P { constructor() { super(...arguments), this.update = this.update.bind(this), this.selectionManagers = []; } @@ -410,32 +410,32 @@ class Kr extends F { this.update(); } } -const qt = new Kr(), Gr = function() { +const Ht = new sa(), ra = function() { const s = window.getSelection(); if (s.rangeCount > 0) return s; }, Se = function() { var s; - const t = (s = Gr()) === null || s === void 0 ? void 0 : s.getRangeAt(0); - if (t && !ra(t)) return t; -}, Jr = function(s) { + const t = (s = ra()) === null || s === void 0 ? void 0 : s.getRangeAt(0); + if (t && !fo(t)) return t; +}, aa = function(s) { const t = window.getSelection(); - return t.removeAllRanges(), t.addRange(s), qt.update(); -}, ra = (s) => As(s.startContainer) || As(s.endContainer), As = (s) => !Object.getPrototypeOf(s), ye = (s) => s.replace(new RegExp("".concat(ui), "g"), "").replace(new RegExp("".concat(Lt), "g"), " "), Pn = new RegExp("[^\\S".concat(Lt, "]")), Fn = (s) => s.replace(new RegExp("".concat(Pn.source), "g"), " ").replace(/\ {2,}/g, " "), Es = function(s, t) { + return t.removeAllRanges(), t.addRange(s), Ht.update(); +}, fo = (s) => xs(s.startContainer) || xs(s.endContainer), xs = (s) => !Object.getPrototypeOf(s), ye = (s) => s.replace(new RegExp("".concat(mi), "g"), "").replace(new RegExp("".concat(Lt), "g"), " "), Hn = new RegExp("[^\\S".concat(Lt, "]")), qn = (s) => s.replace(new RegExp("".concat(Hn.source), "g"), " ").replace(/\ {2,}/g, " "), Ss = function(s, t) { if (s.isEqualTo(t)) return ["", ""]; - const e = Hi(s, t), { length: i } = e.utf16String; + const e = $i(s, t), { length: i } = e.utf16String; let n; if (i) { - const { offset: r } = e, o = s.codepoints.slice(0, r).concat(s.codepoints.slice(r + i)); - n = Hi(t, ke.fromCodepoints(o)); - } else n = Hi(t, s); + const { offset: r } = e, a = s.codepoints.slice(0, r).concat(s.codepoints.slice(r + i)); + n = $i(t, ke.fromCodepoints(a)); + } else n = $i(t, s); return [e.utf16String.toString(), n.utf16String.toString()]; -}, Hi = function(s, t) { +}, $i = function(s, t) { let e = 0, i = s.length, n = t.length; for (; e < i && s.charAt(e).isEqualTo(t.charAt(e)); ) e++; for (; i > e + 1 && s.charAt(i - 1).isEqualTo(t.charAt(n - 1)); ) i--, n--; return { utf16String: s.slice(e, i), offset: e }; }; -class tt extends Ht { +class tt extends qt { static fromCommonAttributesOfObjects() { let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; if (!t.length) return new this(); @@ -449,13 +449,13 @@ class tt extends Ht { } constructor() { let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; - super(...arguments), this.values = ni(t); + super(...arguments), this.values = si(t); } add(t, e) { - return this.merge(oa(t, e)); + return this.merge(bo(t, e)); } remove(t) { - return new tt(ni(this.values, t)); + return new tt(si(this.values, t)); } get(t) { return this.values[t]; @@ -464,7 +464,7 @@ class tt extends Ht { return t in this.values; } merge(t) { - return new tt(aa(this.values, la(t))); + return new tt(_o(this.values, vo(t))); } slice(t) { const e = {}; @@ -496,7 +496,7 @@ class tt extends Ht { return this.array; } toObject() { - return ni(this.values); + return si(this.values); } toJSON() { return this.toObject(); @@ -505,39 +505,39 @@ class tt extends Ht { return { values: JSON.stringify(this.values) }; } } -const oa = function(s, t) { +const bo = function(s, t) { const e = {}; return e[s] = t, e; -}, aa = function(s, t) { - const e = ni(s); +}, _o = function(s, t) { + const e = si(s); for (const i in t) { const n = t[i]; e[i] = n; } return e; -}, ni = function(s, t) { +}, si = function(s, t) { const e = {}; return Object.keys(s).sort().forEach((i) => { i !== t && (e[i] = s[i]); }), e; }, me = function(s) { return s instanceof tt ? s : new tt(s); -}, la = function(s) { +}, vo = function(s) { return s instanceof tt ? s.values : s; }; -class qn { +class $n { static groupObjects() { let t, e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], { depth: i, asTree: n } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; n && i == null && (i = 0); const r = []; - return Array.from(e).forEach((o) => { - var a; + return Array.from(e).forEach((a) => { + var o; if (t) { - var l, d, h; - if ((l = o.canBeGrouped) !== null && l !== void 0 && l.call(o, i) && (d = (h = t[t.length - 1]).canBeGroupedWith) !== null && d !== void 0 && d.call(h, o, i)) return void t.push(o); + var l, c, h; + if ((l = a.canBeGrouped) !== null && l !== void 0 && l.call(a, i) && (c = (h = t[t.length - 1]).canBeGroupedWith) !== null && c !== void 0 && c.call(h, a, i)) return void t.push(a); r.push(new this(t, { depth: i, asTree: n })), t = null; } - (a = o.canBeGrouped) !== null && a !== void 0 && a.call(o, i) ? t = [o] : r.push(o); + (o = a.canBeGrouped) !== null && o !== void 0 && o.call(a, i) ? t = [a] : r.push(a); }), t && r.push(new this(t, { depth: i, asTree: n })), r; } constructor() { @@ -557,7 +557,7 @@ class qn { }), t.join("/"); } } -class ca extends F { +class yo extends P { constructor() { let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; super(...arguments), this.objects = {}, Array.from(t).forEach((e) => { @@ -570,16 +570,16 @@ class ca extends F { return this.objects[e]; } } -class da { +class Ao { constructor(t) { this.reset(t); } add(t) { - const e = xs(t); + const e = Ls(t); this.elements[e] = t; } remove(t) { - const e = xs(t), i = this.elements[e]; + const e = Ls(t), i = this.elements[e]; if (i) return delete this.elements[e], i; } reset() { @@ -589,8 +589,8 @@ class da { }), t; } } -const xs = (s) => s.dataset.trixStoreKey; -class ai extends F { +const Ls = (s) => s.dataset.trixStoreKey; +class li extends P { isPerforming() { return this.performing === !0; } @@ -616,8 +616,8 @@ class ai extends F { (t = this.promise) === null || t === void 0 || (e = t.cancel) === null || e === void 0 || e.call(t), this.promise = null, this.performing = null, this.performed = null, this.succeeded = null; } } -ai.proxyMethod("getPromise().then"), ai.proxyMethod("getPromise().catch"); -class $t extends F { +li.proxyMethod("getPromise().then"), li.proxyMethod("getPromise().catch"); +class $t extends P { constructor(t) { let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; super(...arguments), this.object = t, this.options = e, this.childViews = [], this.rootView = this; @@ -639,7 +639,7 @@ class $t extends F { } createChildView(t, e) { let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; - e instanceof qn && (i.viewClass = t, t = ha); + e instanceof $n && (i.viewClass = t, t = Eo); const n = new t(e, i); return this.recordChildView(n); } @@ -690,7 +690,7 @@ class $t extends F { } } } -class ha extends $t { +class Eo extends $t { constructor() { super(...arguments), this.objectGroup = this.object, this.viewClass = this.options.viewClass, delete this.options.viewClass; } @@ -713,219 +713,219 @@ class ha extends $t { } } /*! @license DOMPurify 3.2.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.7/LICENSE */ -const { entries: Yr, setPrototypeOf: Ss, isFrozen: ua, getPrototypeOf: ma, getOwnPropertyDescriptor: ga } = Object; -let { freeze: X, seal: st, create: Xr } = Object, { apply: En, construct: xn } = typeof Reflect < "u" && Reflect; +const { entries: oa, setPrototypeOf: Cs, isFrozen: xo, getPrototypeOf: So, getOwnPropertyDescriptor: Lo } = Object; +let { freeze: X, seal: st, create: la } = Object, { apply: Sn, construct: Ln } = typeof Reflect < "u" && Reflect; X || (X = function(s) { return s; }), st || (st = function(s) { return s; -}), En || (En = function(s, t) { +}), Sn || (Sn = function(s, t) { for (var e = arguments.length, i = new Array(e > 2 ? e - 2 : 0), n = 2; n < e; n++) i[n - 2] = arguments[n]; return s.apply(t, i); -}), xn || (xn = function(s) { +}), Ln || (Ln = function(s) { for (var t = arguments.length, e = new Array(t > 1 ? t - 1 : 0), i = 1; i < t; i++) e[i - 1] = arguments[i]; return new s(...e); }); -const Ke = Q(Array.prototype.forEach), pa = Q(Array.prototype.lastIndexOf), Ls = Q(Array.prototype.pop), ge = Q(Array.prototype.push), fa = Q(Array.prototype.splice), si = Q(String.prototype.toLowerCase), $i = Q(String.prototype.toString), Ui = Q(String.prototype.match), pe = Q(String.prototype.replace), ba = Q(String.prototype.indexOf), va = Q(String.prototype.trim), lt = Q(Object.prototype.hasOwnProperty), G = Q(RegExp.prototype.test), fe = (Cs = TypeError, function() { +const Ke = Q(Array.prototype.forEach), Co = Q(Array.prototype.lastIndexOf), ws = Q(Array.prototype.pop), ge = Q(Array.prototype.push), wo = Q(Array.prototype.splice), ri = Q(String.prototype.toLowerCase), Ui = Q(String.prototype.toString), Vi = Q(String.prototype.match), pe = Q(String.prototype.replace), To = Q(String.prototype.indexOf), ko = Q(String.prototype.trim), lt = Q(Object.prototype.hasOwnProperty), G = Q(RegExp.prototype.test), fe = (Ts = TypeError, function() { for (var s = arguments.length, t = new Array(s), e = 0; e < s; e++) t[e] = arguments[e]; - return xn(Cs, t); + return Ln(Ts, t); }); -var Cs; +var Ts; function Q(s) { return function(t) { t instanceof RegExp && (t.lastIndex = 0); for (var e = arguments.length, i = new Array(e > 1 ? e - 1 : 0), n = 1; n < e; n++) i[n - 1] = arguments[n]; - return En(s, t, i); + return Sn(s, t, i); }; } -function x(s, t) { - let e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : si; - Ss && Ss(s, null); +function L(s, t) { + let e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ri; + Cs && Cs(s, null); let i = t.length; for (; i--; ) { let n = t[i]; if (typeof n == "string") { const r = e(n); - r !== n && (ua(t) || (t[i] = r), n = r); + r !== n && (xo(t) || (t[i] = r), n = r); } s[n] = !0; } return s; } -function _a(s) { +function Io(s) { for (let t = 0; t < s.length; t++) lt(s, t) || (s[t] = null); return s; } function ft(s) { - const t = Xr(null); - for (const [e, i] of Yr(s)) - lt(s, e) && (Array.isArray(i) ? t[e] = _a(i) : i && typeof i == "object" && i.constructor === Object ? t[e] = ft(i) : t[e] = i); + const t = la(null); + for (const [e, i] of oa(s)) + lt(s, e) && (Array.isArray(i) ? t[e] = Io(i) : i && typeof i == "object" && i.constructor === Object ? t[e] = ft(i) : t[e] = i); return t; } function be(s, t) { for (; s !== null; ) { - const e = ga(s, t); + const e = Lo(s, t); if (e) { if (e.get) return Q(e.get); if (typeof e.value == "function") return Q(e.value); } - s = ma(s); + s = So(s); } return function() { return null; }; } -const ws = X(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "search", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), ji = X(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "enterkeyhint", "exportparts", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "inputmode", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "part", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "slot", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), Vi = X(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), ya = X(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), zi = X(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]), Aa = X(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), Ts = X(["#text"]), ks = X(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]), Wi = X(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), Is = X(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), Ge = X(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), Ea = st(/\{\{[\w\W]*|[\w\W]*\}\}/gm), xa = st(/<%[\w\W]*|[\w\W]*%>/gm), Sa = st(/\$\{[\w\W]*/gm), La = st(/^data-[\-\w.\u00B7-\uFFFF]+$/), Ca = st(/^aria-[\-\w]+$/), Qr = st(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i), wa = st(/^(?:\w+script|data):/i), Ta = st(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g), Zr = st(/^html$/i), ka = st(/^[a-z][.\w]*(-[.\w]+)+$/i); -var Rs = Object.freeze({ __proto__: null, ARIA_ATTR: Ca, ATTR_WHITESPACE: Ta, CUSTOM_ELEMENT: ka, DATA_ATTR: La, DOCTYPE_NAME: Zr, ERB_EXPR: xa, IS_ALLOWED_URI: Qr, IS_SCRIPT_OR_DATA: wa, MUSTACHE_EXPR: Ea, TMPLIT_EXPR: Sa }); -const Ia = 1, Ra = 3, Da = 7, Oa = 8, Ma = 9, Ba = function() { +const ks = X(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "search", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), ji = X(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "enterkeyhint", "exportparts", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "inputmode", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "part", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "slot", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), Wi = X(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), Ro = X(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), zi = X(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]), Do = X(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), Is = X(["#text"]), Rs = X(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]), Ki = X(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), Ds = X(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), Ge = X(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), Oo = st(/\{\{[\w\W]*|[\w\W]*\}\}/gm), Mo = st(/<%[\w\W]*|[\w\W]*%>/gm), Bo = st(/\$\{[\w\W]*/gm), No = st(/^data-[\-\w.\u00B7-\uFFFF]+$/), Po = st(/^aria-[\-\w]+$/), da = st(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i), Fo = st(/^(?:\w+script|data):/i), Ho = st(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g), ca = st(/^html$/i), qo = st(/^[a-z][.\w]*(-[.\w]+)+$/i); +var Os = Object.freeze({ __proto__: null, ARIA_ATTR: Po, ATTR_WHITESPACE: Ho, CUSTOM_ELEMENT: qo, DATA_ATTR: No, DOCTYPE_NAME: ca, ERB_EXPR: Mo, IS_ALLOWED_URI: da, IS_SCRIPT_OR_DATA: Fo, MUSTACHE_EXPR: Oo, TMPLIT_EXPR: Bo }); +const $o = 1, Uo = 3, Vo = 7, jo = 8, Wo = 9, zo = function() { return typeof window > "u" ? null : window; }; var Ie = function s() { - let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Ba(); - const e = (c) => s(c); - if (e.version = "3.2.7", e.removed = [], !t || !t.document || t.document.nodeType !== Ma || !t.Element) return e.isSupported = !1, e; + let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : zo(); + const e = (d) => s(d); + if (e.version = "3.2.7", e.removed = [], !t || !t.document || t.document.nodeType !== Wo || !t.Element) return e.isSupported = !1, e; let { document: i } = t; - const n = i, r = n.currentScript, { DocumentFragment: o, HTMLTemplateElement: a, Node: l, Element: d, NodeFilter: h, NamedNodeMap: m = t.NamedNodeMap || t.MozNamedAttrMap, HTMLFormElement: f, DOMParser: u, trustedTypes: b } = t, E = d.prototype, I = be(E, "cloneNode"), P = be(E, "remove"), R = be(E, "nextSibling"), k = be(E, "childNodes"), _ = be(E, "parentNode"); - if (typeof a == "function") { - const c = i.createElement("template"); - c.content && c.content.ownerDocument && (i = c.content.ownerDocument); + const n = i, r = n.currentScript, { DocumentFragment: a, HTMLTemplateElement: o, Node: l, Element: c, NodeFilter: h, NamedNodeMap: m = t.NamedNodeMap || t.MozNamedAttrMap, HTMLFormElement: p, DOMParser: u, trustedTypes: b } = t, A = c.prototype, I = be(A, "cloneNode"), F = be(A, "remove"), R = be(A, "nextSibling"), H = be(A, "childNodes"), _ = be(A, "parentNode"); + if (typeof o == "function") { + const d = i.createElement("template"); + d.content && d.content.ownerDocument && (i = d.content.ownerDocument); } - let S, q = ""; - const { implementation: K, createNodeIterator: dt, createDocumentFragment: yt, getElementsByTagName: Be } = i, { importNode: et } = n; + let S, E = ""; + const { implementation: V, createNodeIterator: ct, createDocumentFragment: yt, getElementsByTagName: Be } = i, { importNode: et } = n; let j = { afterSanitizeAttributes: [], afterSanitizeElements: [], afterSanitizeShadowDOM: [], beforeSanitizeAttributes: [], beforeSanitizeElements: [], beforeSanitizeShadowDOM: [], uponSanitizeAttribute: [], uponSanitizeElement: [], uponSanitizeShadowNode: [] }; - e.isSupported = typeof Yr == "function" && typeof _ == "function" && K && K.createHTMLDocument !== void 0; - const { MUSTACHE_EXPR: re, ERB_EXPR: oe, TMPLIT_EXPR: ae, DATA_ATTR: bi, ARIA_ATTR: Ne, IS_SCRIPT_OR_DATA: Z, ATTR_WHITESPACE: mt, CUSTOM_ELEMENT: Un } = Rs; - let { IS_ALLOWED_URI: jn } = Rs, $ = null; - const Vn = x({}, [...ws, ...ji, ...Vi, ...zi, ...Ts]); - let V = null; - const zn = x({}, [...ks, ...Wi, ...Is, ...Ge]); - let M = Object.seal(Xr(null, { tagNameCheck: { writable: !0, configurable: !1, enumerable: !0, value: null }, attributeNameCheck: { writable: !0, configurable: !1, enumerable: !0, value: null }, allowCustomizedBuiltInElements: { writable: !0, configurable: !1, enumerable: !0, value: !1 } })), le = null, vi = null, Wn = !0, _i = !0, Kn = !1, Gn = !0, jt = !1, Pe = !0, Tt = !1, yi = !1, Ai = !1, Vt = !1, Fe = !1, qe = !1, Jn = !0, Yn = !1, Ei = !0, ce = !1, zt = {}, Wt = null; - const Xn = x({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]); - let Qn = null; - const Zn = x({}, ["audio", "video", "img", "source", "image", "track"]); - let xi = null; - const ts = x({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), He = "http://www.w3.org/1998/Math/MathML", $e = "http://www.w3.org/2000/svg", gt = "http://www.w3.org/1999/xhtml"; - let Kt = gt, Si = !1, Li = null; - const No = x({}, [He, $e, gt], $i); - let Ue = x({}, ["mi", "mo", "mn", "ms", "mtext"]), je = x({}, ["annotation-xml"]); - const Po = x({}, ["title", "style", "font", "a", "script"]); - let de = null; - const Fo = ["application/xhtml+xml", "text/html"]; + e.isSupported = typeof oa == "function" && typeof _ == "function" && V && V.createHTMLDocument !== void 0; + const { MUSTACHE_EXPR: re, ERB_EXPR: ae, TMPLIT_EXPR: oe, DATA_ATTR: _i, ARIA_ATTR: Ne, IS_SCRIPT_OR_DATA: Z, ATTR_WHITESPACE: mt, CUSTOM_ELEMENT: jn } = Os; + let { IS_ALLOWED_URI: Wn } = Os, $ = null; + const zn = L({}, [...ks, ...ji, ...Wi, ...zi, ...Is]); + let W = null; + const Kn = L({}, [...Rs, ...Ki, ...Ds, ...Ge]); + let M = Object.seal(la(null, { tagNameCheck: { writable: !0, configurable: !1, enumerable: !0, value: null }, attributeNameCheck: { writable: !0, configurable: !1, enumerable: !0, value: null }, allowCustomizedBuiltInElements: { writable: !0, configurable: !1, enumerable: !0, value: !1 } })), le = null, vi = null, Gn = !0, yi = !0, Jn = !1, Yn = !0, Vt = !1, Pe = !0, Tt = !1, Ai = !1, Ei = !1, jt = !1, Fe = !1, He = !1, Xn = !0, Qn = !1, xi = !0, de = !1, Wt = {}, zt = null; + const Zn = L({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]); + let ts = null; + const es = L({}, ["audio", "video", "img", "source", "image", "track"]); + let Si = null; + const is = L({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), qe = "http://www.w3.org/1998/Math/MathML", $e = "http://www.w3.org/2000/svg", gt = "http://www.w3.org/1999/xhtml"; + let Kt = gt, Li = !1, Ci = null; + const za = L({}, [qe, $e, gt], Ui); + let Ue = L({}, ["mi", "mo", "mn", "ms", "mtext"]), Ve = L({}, ["annotation-xml"]); + const Ka = L({}, ["title", "style", "font", "a", "script"]); + let ce = null; + const Ga = ["application/xhtml+xml", "text/html"]; let U = null, Gt = null; - const qo = i.createElement("form"), es = function(c) { - return c instanceof RegExp || c instanceof Function; - }, Ci = function() { - let c = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; - if (!Gt || Gt !== c) { - if (c && typeof c == "object" || (c = {}), c = ft(c), de = Fo.indexOf(c.PARSER_MEDIA_TYPE) === -1 ? "text/html" : c.PARSER_MEDIA_TYPE, U = de === "application/xhtml+xml" ? $i : si, $ = lt(c, "ALLOWED_TAGS") ? x({}, c.ALLOWED_TAGS, U) : Vn, V = lt(c, "ALLOWED_ATTR") ? x({}, c.ALLOWED_ATTR, U) : zn, Li = lt(c, "ALLOWED_NAMESPACES") ? x({}, c.ALLOWED_NAMESPACES, $i) : No, xi = lt(c, "ADD_URI_SAFE_ATTR") ? x(ft(ts), c.ADD_URI_SAFE_ATTR, U) : ts, Qn = lt(c, "ADD_DATA_URI_TAGS") ? x(ft(Zn), c.ADD_DATA_URI_TAGS, U) : Zn, Wt = lt(c, "FORBID_CONTENTS") ? x({}, c.FORBID_CONTENTS, U) : Xn, le = lt(c, "FORBID_TAGS") ? x({}, c.FORBID_TAGS, U) : ft({}), vi = lt(c, "FORBID_ATTR") ? x({}, c.FORBID_ATTR, U) : ft({}), zt = !!lt(c, "USE_PROFILES") && c.USE_PROFILES, Wn = c.ALLOW_ARIA_ATTR !== !1, _i = c.ALLOW_DATA_ATTR !== !1, Kn = c.ALLOW_UNKNOWN_PROTOCOLS || !1, Gn = c.ALLOW_SELF_CLOSE_IN_ATTR !== !1, jt = c.SAFE_FOR_TEMPLATES || !1, Pe = c.SAFE_FOR_XML !== !1, Tt = c.WHOLE_DOCUMENT || !1, Vt = c.RETURN_DOM || !1, Fe = c.RETURN_DOM_FRAGMENT || !1, qe = c.RETURN_TRUSTED_TYPE || !1, Ai = c.FORCE_BODY || !1, Jn = c.SANITIZE_DOM !== !1, Yn = c.SANITIZE_NAMED_PROPS || !1, Ei = c.KEEP_CONTENT !== !1, ce = c.IN_PLACE || !1, jn = c.ALLOWED_URI_REGEXP || Qr, Kt = c.NAMESPACE || gt, Ue = c.MATHML_TEXT_INTEGRATION_POINTS || Ue, je = c.HTML_INTEGRATION_POINTS || je, M = c.CUSTOM_ELEMENT_HANDLING || {}, c.CUSTOM_ELEMENT_HANDLING && es(c.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (M.tagNameCheck = c.CUSTOM_ELEMENT_HANDLING.tagNameCheck), c.CUSTOM_ELEMENT_HANDLING && es(c.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (M.attributeNameCheck = c.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), c.CUSTOM_ELEMENT_HANDLING && typeof c.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (M.allowCustomizedBuiltInElements = c.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), jt && (_i = !1), Fe && (Vt = !0), zt && ($ = x({}, Ts), V = [], zt.html === !0 && (x($, ws), x(V, ks)), zt.svg === !0 && (x($, ji), x(V, Wi), x(V, Ge)), zt.svgFilters === !0 && (x($, Vi), x(V, Wi), x(V, Ge)), zt.mathMl === !0 && (x($, zi), x(V, Is), x(V, Ge))), c.ADD_TAGS && ($ === Vn && ($ = ft($)), x($, c.ADD_TAGS, U)), c.ADD_ATTR && (V === zn && (V = ft(V)), x(V, c.ADD_ATTR, U)), c.ADD_URI_SAFE_ATTR && x(xi, c.ADD_URI_SAFE_ATTR, U), c.FORBID_CONTENTS && (Wt === Xn && (Wt = ft(Wt)), x(Wt, c.FORBID_CONTENTS, U)), Ei && ($["#text"] = !0), Tt && x($, ["html", "head", "body"]), $.table && (x($, ["tbody"]), delete le.tbody), c.TRUSTED_TYPES_POLICY) { - if (typeof c.TRUSTED_TYPES_POLICY.createHTML != "function") throw fe('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.'); - if (typeof c.TRUSTED_TYPES_POLICY.createScriptURL != "function") throw fe('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.'); - S = c.TRUSTED_TYPES_POLICY, q = S.createHTML(""); - } else S === void 0 && (S = function(p, g) { - if (typeof p != "object" || typeof p.createPolicy != "function") return null; - let L = null; - const w = "data-tt-policy-suffix"; - g && g.hasAttribute(w) && (L = g.getAttribute(w)); - const y = "dompurify" + (L ? "#" + L : ""); + const Ja = i.createElement("form"), ns = function(d) { + return d instanceof RegExp || d instanceof Function; + }, wi = function() { + let d = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; + if (!Gt || Gt !== d) { + if (d && typeof d == "object" || (d = {}), d = ft(d), ce = Ga.indexOf(d.PARSER_MEDIA_TYPE) === -1 ? "text/html" : d.PARSER_MEDIA_TYPE, U = ce === "application/xhtml+xml" ? Ui : ri, $ = lt(d, "ALLOWED_TAGS") ? L({}, d.ALLOWED_TAGS, U) : zn, W = lt(d, "ALLOWED_ATTR") ? L({}, d.ALLOWED_ATTR, U) : Kn, Ci = lt(d, "ALLOWED_NAMESPACES") ? L({}, d.ALLOWED_NAMESPACES, Ui) : za, Si = lt(d, "ADD_URI_SAFE_ATTR") ? L(ft(is), d.ADD_URI_SAFE_ATTR, U) : is, ts = lt(d, "ADD_DATA_URI_TAGS") ? L(ft(es), d.ADD_DATA_URI_TAGS, U) : es, zt = lt(d, "FORBID_CONTENTS") ? L({}, d.FORBID_CONTENTS, U) : Zn, le = lt(d, "FORBID_TAGS") ? L({}, d.FORBID_TAGS, U) : ft({}), vi = lt(d, "FORBID_ATTR") ? L({}, d.FORBID_ATTR, U) : ft({}), Wt = !!lt(d, "USE_PROFILES") && d.USE_PROFILES, Gn = d.ALLOW_ARIA_ATTR !== !1, yi = d.ALLOW_DATA_ATTR !== !1, Jn = d.ALLOW_UNKNOWN_PROTOCOLS || !1, Yn = d.ALLOW_SELF_CLOSE_IN_ATTR !== !1, Vt = d.SAFE_FOR_TEMPLATES || !1, Pe = d.SAFE_FOR_XML !== !1, Tt = d.WHOLE_DOCUMENT || !1, jt = d.RETURN_DOM || !1, Fe = d.RETURN_DOM_FRAGMENT || !1, He = d.RETURN_TRUSTED_TYPE || !1, Ei = d.FORCE_BODY || !1, Xn = d.SANITIZE_DOM !== !1, Qn = d.SANITIZE_NAMED_PROPS || !1, xi = d.KEEP_CONTENT !== !1, de = d.IN_PLACE || !1, Wn = d.ALLOWED_URI_REGEXP || da, Kt = d.NAMESPACE || gt, Ue = d.MATHML_TEXT_INTEGRATION_POINTS || Ue, Ve = d.HTML_INTEGRATION_POINTS || Ve, M = d.CUSTOM_ELEMENT_HANDLING || {}, d.CUSTOM_ELEMENT_HANDLING && ns(d.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (M.tagNameCheck = d.CUSTOM_ELEMENT_HANDLING.tagNameCheck), d.CUSTOM_ELEMENT_HANDLING && ns(d.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (M.attributeNameCheck = d.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), d.CUSTOM_ELEMENT_HANDLING && typeof d.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (M.allowCustomizedBuiltInElements = d.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), Vt && (yi = !1), Fe && (jt = !0), Wt && ($ = L({}, Is), W = [], Wt.html === !0 && (L($, ks), L(W, Rs)), Wt.svg === !0 && (L($, ji), L(W, Ki), L(W, Ge)), Wt.svgFilters === !0 && (L($, Wi), L(W, Ki), L(W, Ge)), Wt.mathMl === !0 && (L($, zi), L(W, Ds), L(W, Ge))), d.ADD_TAGS && ($ === zn && ($ = ft($)), L($, d.ADD_TAGS, U)), d.ADD_ATTR && (W === Kn && (W = ft(W)), L(W, d.ADD_ATTR, U)), d.ADD_URI_SAFE_ATTR && L(Si, d.ADD_URI_SAFE_ATTR, U), d.FORBID_CONTENTS && (zt === Zn && (zt = ft(zt)), L(zt, d.FORBID_CONTENTS, U)), xi && ($["#text"] = !0), Tt && L($, ["html", "head", "body"]), $.table && (L($, ["tbody"]), delete le.tbody), d.TRUSTED_TYPES_POLICY) { + if (typeof d.TRUSTED_TYPES_POLICY.createHTML != "function") throw fe('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.'); + if (typeof d.TRUSTED_TYPES_POLICY.createScriptURL != "function") throw fe('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.'); + S = d.TRUSTED_TYPES_POLICY, E = S.createHTML(""); + } else S === void 0 && (S = function(f, g) { + if (typeof f != "object" || typeof f.createPolicy != "function") return null; + let C = null; + const T = "data-tt-policy-suffix"; + g && g.hasAttribute(T) && (C = g.getAttribute(T)); + const y = "dompurify" + (C ? "#" + C : ""); try { - return p.createPolicy(y, { createHTML: (H) => H, createScriptURL: (H) => H }); + return f.createPolicy(y, { createHTML: (q) => q, createScriptURL: (q) => q }); } catch { return console.warn("TrustedTypes policy " + y + " could not be created."), null; } - }(b, r)), S !== null && typeof q == "string" && (q = S.createHTML("")); - X && X(c), Gt = c; + }(b, r)), S !== null && typeof E == "string" && (E = S.createHTML("")); + X && X(d), Gt = d; } - }, is = x({}, [...ji, ...Vi, ...ya]), ns = x({}, [...zi, ...Aa]), ht = function(c) { - ge(e.removed, { element: c }); + }, ss = L({}, [...ji, ...Wi, ...Ro]), rs = L({}, [...zi, ...Do]), ht = function(d) { + ge(e.removed, { element: d }); try { - _(c).removeChild(c); + _(d).removeChild(d); } catch { - P(c); + F(d); } - }, kt = function(c, p) { + }, kt = function(d, f) { try { - ge(e.removed, { attribute: p.getAttributeNode(c), from: p }); + ge(e.removed, { attribute: f.getAttributeNode(d), from: f }); } catch { - ge(e.removed, { attribute: null, from: p }); + ge(e.removed, { attribute: null, from: f }); } - if (p.removeAttribute(c), c === "is") if (Vt || Fe) try { - ht(p); + if (f.removeAttribute(d), d === "is") if (jt || Fe) try { + ht(f); } catch { } else try { - p.setAttribute(c, ""); + f.setAttribute(d, ""); } catch { } - }, ss = function(c) { - let p = null, g = null; - if (Ai) c = "" + c; + }, as = function(d) { + let f = null, g = null; + if (Ei) d = "" + d; else { - const y = Ui(c, /^[\r\n\t ]+/); + const y = Vi(d, /^[\r\n\t ]+/); g = y && y[0]; } - de === "application/xhtml+xml" && Kt === gt && (c = '' + c + ""); - const L = S ? S.createHTML(c) : c; + ce === "application/xhtml+xml" && Kt === gt && (d = '' + d + ""); + const C = S ? S.createHTML(d) : d; if (Kt === gt) try { - p = new u().parseFromString(L, de); + f = new u().parseFromString(C, ce); } catch { } - if (!p || !p.documentElement) { - p = K.createDocument(Kt, "template", null); + if (!f || !f.documentElement) { + f = V.createDocument(Kt, "template", null); try { - p.documentElement.innerHTML = Si ? q : L; + f.documentElement.innerHTML = Li ? E : C; } catch { } } - const w = p.body || p.documentElement; - return c && g && w.insertBefore(i.createTextNode(g), w.childNodes[0] || null), Kt === gt ? Be.call(p, Tt ? "html" : "body")[0] : Tt ? p.documentElement : w; - }, rs = function(c) { - return dt.call(c.ownerDocument || c, c, h.SHOW_ELEMENT | h.SHOW_COMMENT | h.SHOW_TEXT | h.SHOW_PROCESSING_INSTRUCTION | h.SHOW_CDATA_SECTION, null); - }, wi = function(c) { - return c instanceof f && (typeof c.nodeName != "string" || typeof c.textContent != "string" || typeof c.removeChild != "function" || !(c.attributes instanceof m) || typeof c.removeAttribute != "function" || typeof c.setAttribute != "function" || typeof c.namespaceURI != "string" || typeof c.insertBefore != "function" || typeof c.hasChildNodes != "function"); - }, os = function(c) { - return typeof l == "function" && c instanceof l; + const T = f.body || f.documentElement; + return d && g && T.insertBefore(i.createTextNode(g), T.childNodes[0] || null), Kt === gt ? Be.call(f, Tt ? "html" : "body")[0] : Tt ? f.documentElement : T; + }, os = function(d) { + return ct.call(d.ownerDocument || d, d, h.SHOW_ELEMENT | h.SHOW_COMMENT | h.SHOW_TEXT | h.SHOW_PROCESSING_INSTRUCTION | h.SHOW_CDATA_SECTION, null); + }, Ti = function(d) { + return d instanceof p && (typeof d.nodeName != "string" || typeof d.textContent != "string" || typeof d.removeChild != "function" || !(d.attributes instanceof m) || typeof d.removeAttribute != "function" || typeof d.setAttribute != "function" || typeof d.namespaceURI != "string" || typeof d.insertBefore != "function" || typeof d.hasChildNodes != "function"); + }, ls = function(d) { + return typeof l == "function" && d instanceof l; }; - function pt(c, p, g) { - Ke(c, (L) => { - L.call(e, p, g, Gt); + function pt(d, f, g) { + Ke(d, (C) => { + C.call(e, f, g, Gt); }); } - const as = function(c) { - let p = null; - if (pt(j.beforeSanitizeElements, c, null), wi(c)) return ht(c), !0; - const g = U(c.nodeName); - if (pt(j.uponSanitizeElement, c, { tagName: g, allowedTags: $ }), Pe && c.hasChildNodes() && !os(c.firstElementChild) && G(/<[/\w!]/g, c.innerHTML) && G(/<[/\w!]/g, c.textContent) || c.nodeType === Da || Pe && c.nodeType === Oa && G(/<[/\w]/g, c.data)) return ht(c), !0; + const ds = function(d) { + let f = null; + if (pt(j.beforeSanitizeElements, d, null), Ti(d)) return ht(d), !0; + const g = U(d.nodeName); + if (pt(j.uponSanitizeElement, d, { tagName: g, allowedTags: $ }), Pe && d.hasChildNodes() && !ls(d.firstElementChild) && G(/<[/\w!]/g, d.innerHTML) && G(/<[/\w!]/g, d.textContent) || d.nodeType === Vo || Pe && d.nodeType === jo && G(/<[/\w]/g, d.data)) return ht(d), !0; if (!$[g] || le[g]) { - if (!le[g] && cs(g) && (M.tagNameCheck instanceof RegExp && G(M.tagNameCheck, g) || M.tagNameCheck instanceof Function && M.tagNameCheck(g))) + if (!le[g] && hs(g) && (M.tagNameCheck instanceof RegExp && G(M.tagNameCheck, g) || M.tagNameCheck instanceof Function && M.tagNameCheck(g))) return !1; - if (Ei && !Wt[g]) { - const L = _(c) || c.parentNode, w = k(c) || c.childNodes; - if (w && L) - for (let y = w.length - 1; y >= 0; --y) { - const H = I(w[y], !0); - H.__removalCount = (c.__removalCount || 0) + 1, L.insertBefore(H, R(c)); + if (xi && !zt[g]) { + const C = _(d) || d.parentNode, T = H(d) || d.childNodes; + if (T && C) + for (let y = T.length - 1; y >= 0; --y) { + const q = I(T[y], !0); + q.__removalCount = (d.__removalCount || 0) + 1, C.insertBefore(q, R(d)); } } - return ht(c), !0; + return ht(d), !0; } - return c instanceof d && !function(L) { - let w = _(L); - w && w.tagName || (w = { namespaceURI: Kt, tagName: "template" }); - const y = si(L.tagName), H = si(w.tagName); - return !!Li[L.namespaceURI] && (L.namespaceURI === $e ? w.namespaceURI === gt ? y === "svg" : w.namespaceURI === He ? y === "svg" && (H === "annotation-xml" || Ue[H]) : !!is[y] : L.namespaceURI === He ? w.namespaceURI === gt ? y === "math" : w.namespaceURI === $e ? y === "math" && je[H] : !!ns[y] : L.namespaceURI === gt ? !(w.namespaceURI === $e && !je[H]) && !(w.namespaceURI === He && !Ue[H]) && !ns[y] && (Po[y] || !is[y]) : !(de !== "application/xhtml+xml" || !Li[L.namespaceURI])); - }(c) ? (ht(c), !0) : g !== "noscript" && g !== "noembed" && g !== "noframes" || !G(/<\/no(script|embed|frames)/i, c.innerHTML) ? (jt && c.nodeType === Ra && (p = c.textContent, Ke([re, oe, ae], (L) => { - p = pe(p, L, " "); - }), c.textContent !== p && (ge(e.removed, { element: c.cloneNode() }), c.textContent = p)), pt(j.afterSanitizeElements, c, null), !1) : (ht(c), !0); - }, ls = function(c, p, g) { - if (Jn && (p === "id" || p === "name") && (g in i || g in qo)) return !1; - if (!(_i && !vi[p] && G(bi, p))) { - if (!(Wn && G(Ne, p))) { - if (!V[p] || vi[p]) { - if (!(cs(c) && (M.tagNameCheck instanceof RegExp && G(M.tagNameCheck, c) || M.tagNameCheck instanceof Function && M.tagNameCheck(c)) && (M.attributeNameCheck instanceof RegExp && G(M.attributeNameCheck, p) || M.attributeNameCheck instanceof Function && M.attributeNameCheck(p, c)) || p === "is" && M.allowCustomizedBuiltInElements && (M.tagNameCheck instanceof RegExp && G(M.tagNameCheck, g) || M.tagNameCheck instanceof Function && M.tagNameCheck(g)))) return !1; - } else if (!xi[p]) { - if (!G(jn, pe(g, mt, ""))) { - if ((p !== "src" && p !== "xlink:href" && p !== "href" || c === "script" || ba(g, "data:") !== 0 || !Qn[c]) && !(Kn && !G(Z, pe(g, mt, "")))) { + return d instanceof c && !function(C) { + let T = _(C); + T && T.tagName || (T = { namespaceURI: Kt, tagName: "template" }); + const y = ri(C.tagName), q = ri(T.tagName); + return !!Ci[C.namespaceURI] && (C.namespaceURI === $e ? T.namespaceURI === gt ? y === "svg" : T.namespaceURI === qe ? y === "svg" && (q === "annotation-xml" || Ue[q]) : !!ss[y] : C.namespaceURI === qe ? T.namespaceURI === gt ? y === "math" : T.namespaceURI === $e ? y === "math" && Ve[q] : !!rs[y] : C.namespaceURI === gt ? !(T.namespaceURI === $e && !Ve[q]) && !(T.namespaceURI === qe && !Ue[q]) && !rs[y] && (Ka[y] || !ss[y]) : !(ce !== "application/xhtml+xml" || !Ci[C.namespaceURI])); + }(d) ? (ht(d), !0) : g !== "noscript" && g !== "noembed" && g !== "noframes" || !G(/<\/no(script|embed|frames)/i, d.innerHTML) ? (Vt && d.nodeType === Uo && (f = d.textContent, Ke([re, ae, oe], (C) => { + f = pe(f, C, " "); + }), d.textContent !== f && (ge(e.removed, { element: d.cloneNode() }), d.textContent = f)), pt(j.afterSanitizeElements, d, null), !1) : (ht(d), !0); + }, cs = function(d, f, g) { + if (Xn && (f === "id" || f === "name") && (g in i || g in Ja)) return !1; + if (!(yi && !vi[f] && G(_i, f))) { + if (!(Gn && G(Ne, f))) { + if (!W[f] || vi[f]) { + if (!(hs(d) && (M.tagNameCheck instanceof RegExp && G(M.tagNameCheck, d) || M.tagNameCheck instanceof Function && M.tagNameCheck(d)) && (M.attributeNameCheck instanceof RegExp && G(M.attributeNameCheck, f) || M.attributeNameCheck instanceof Function && M.attributeNameCheck(f, d)) || f === "is" && M.allowCustomizedBuiltInElements && (M.tagNameCheck instanceof RegExp && G(M.tagNameCheck, g) || M.tagNameCheck instanceof Function && M.tagNameCheck(g)))) return !1; + } else if (!Si[f]) { + if (!G(Wn, pe(g, mt, ""))) { + if ((f !== "src" && f !== "xlink:href" && f !== "href" || d === "script" || To(g, "data:") !== 0 || !ts[d]) && !(Jn && !G(Z, pe(g, mt, "")))) { if (g) return !1; } } @@ -933,109 +933,109 @@ var Ie = function s() { } } return !0; - }, cs = function(c) { - return c !== "annotation-xml" && Ui(c, Un); - }, ds = function(c) { - pt(j.beforeSanitizeAttributes, c, null); - const { attributes: p } = c; - if (!p || wi(c)) return; - const g = { attrName: "", attrValue: "", keepAttr: !0, allowedAttributes: V, forceKeepAttr: void 0 }; - let L = p.length; - for (; L--; ) { - const w = p[L], { name: y, namespaceURI: H, value: At } = w, rt = U(y), Ti = At; - let z = y === "value" ? Ti : va(Ti); - if (g.attrName = rt, g.attrValue = z, g.keepAttr = !0, g.forceKeepAttr = void 0, pt(j.uponSanitizeAttribute, c, g), z = g.attrValue, !Yn || rt !== "id" && rt !== "name" || (kt(y, c), z = "user-content-" + z), Pe && G(/((--!?|])>)|<\/(style|title|textarea)/i, z)) { - kt(y, c); + }, hs = function(d) { + return d !== "annotation-xml" && Vi(d, jn); + }, us = function(d) { + pt(j.beforeSanitizeAttributes, d, null); + const { attributes: f } = d; + if (!f || Ti(d)) return; + const g = { attrName: "", attrValue: "", keepAttr: !0, allowedAttributes: W, forceKeepAttr: void 0 }; + let C = f.length; + for (; C--; ) { + const T = f[C], { name: y, namespaceURI: q, value: At } = T, rt = U(y), ki = At; + let z = y === "value" ? ki : ko(ki); + if (g.attrName = rt, g.attrValue = z, g.keepAttr = !0, g.forceKeepAttr = void 0, pt(j.uponSanitizeAttribute, d, g), z = g.attrValue, !Qn || rt !== "id" && rt !== "name" || (kt(y, d), z = "user-content-" + z), Pe && G(/((--!?|])>)|<\/(style|title|textarea)/i, z)) { + kt(y, d); continue; } - if (rt === "attributename" && Ui(z, "href")) { - kt(y, c); + if (rt === "attributename" && Vi(z, "href")) { + kt(y, d); continue; } if (g.forceKeepAttr) continue; if (!g.keepAttr) { - kt(y, c); + kt(y, d); continue; } - if (!Gn && G(/\/>/i, z)) { - kt(y, c); + if (!Yn && G(/\/>/i, z)) { + kt(y, d); continue; } - jt && Ke([re, oe, ae], (us) => { - z = pe(z, us, " "); + Vt && Ke([re, ae, oe], (gs) => { + z = pe(z, gs, " "); }); - const hs = U(c.nodeName); - if (ls(hs, rt, z)) { - if (S && typeof b == "object" && typeof b.getAttributeType == "function" && !H) switch (b.getAttributeType(hs, rt)) { + const ms = U(d.nodeName); + if (cs(ms, rt, z)) { + if (S && typeof b == "object" && typeof b.getAttributeType == "function" && !q) switch (b.getAttributeType(ms, rt)) { case "TrustedHTML": z = S.createHTML(z); break; case "TrustedScriptURL": z = S.createScriptURL(z); } - if (z !== Ti) try { - H ? c.setAttributeNS(H, y, z) : c.setAttribute(y, z), wi(c) ? ht(c) : Ls(e.removed); + if (z !== ki) try { + q ? d.setAttributeNS(q, y, z) : d.setAttribute(y, z), Ti(d) ? ht(d) : ws(e.removed); } catch { - kt(y, c); + kt(y, d); } - } else kt(y, c); + } else kt(y, d); } - pt(j.afterSanitizeAttributes, c, null); - }, Ho = function c(p) { + pt(j.afterSanitizeAttributes, d, null); + }, Ya = function d(f) { let g = null; - const L = rs(p); - for (pt(j.beforeSanitizeShadowDOM, p, null); g = L.nextNode(); ) pt(j.uponSanitizeShadowNode, g, null), as(g), ds(g), g.content instanceof o && c(g.content); - pt(j.afterSanitizeShadowDOM, p, null); + const C = os(f); + for (pt(j.beforeSanitizeShadowDOM, f, null); g = C.nextNode(); ) pt(j.uponSanitizeShadowNode, g, null), ds(g), us(g), g.content instanceof a && d(g.content); + pt(j.afterSanitizeShadowDOM, f, null); }; - return e.sanitize = function(c) { - let p = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, g = null, L = null, w = null, y = null; - if (Si = !c, Si && (c = ""), typeof c != "string" && !os(c)) { - if (typeof c.toString != "function") throw fe("toString is not a function"); - if (typeof (c = c.toString()) != "string") throw fe("dirty is not a string, aborting"); + return e.sanitize = function(d) { + let f = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, g = null, C = null, T = null, y = null; + if (Li = !d, Li && (d = ""), typeof d != "string" && !ls(d)) { + if (typeof d.toString != "function") throw fe("toString is not a function"); + if (typeof (d = d.toString()) != "string") throw fe("dirty is not a string, aborting"); } - if (!e.isSupported) return c; - if (yi || Ci(p), e.removed = [], typeof c == "string" && (ce = !1), ce) { - if (c.nodeName) { - const rt = U(c.nodeName); + if (!e.isSupported) return d; + if (Ai || wi(f), e.removed = [], typeof d == "string" && (de = !1), de) { + if (d.nodeName) { + const rt = U(d.nodeName); if (!$[rt] || le[rt]) throw fe("root node is forbidden and cannot be sanitized in-place"); } - } else if (c instanceof l) g = ss(""), L = g.ownerDocument.importNode(c, !0), L.nodeType === Ia && L.nodeName === "BODY" || L.nodeName === "HTML" ? g = L : g.appendChild(L); + } else if (d instanceof l) g = as(""), C = g.ownerDocument.importNode(d, !0), C.nodeType === $o && C.nodeName === "BODY" || C.nodeName === "HTML" ? g = C : g.appendChild(C); else { - if (!Vt && !jt && !Tt && c.indexOf("<") === -1) return S && qe ? S.createHTML(c) : c; - if (g = ss(c), !g) return Vt ? null : qe ? q : ""; + if (!jt && !Vt && !Tt && d.indexOf("<") === -1) return S && He ? S.createHTML(d) : d; + if (g = as(d), !g) return jt ? null : He ? E : ""; } - g && Ai && ht(g.firstChild); - const H = rs(ce ? c : g); - for (; w = H.nextNode(); ) as(w), ds(w), w.content instanceof o && Ho(w.content); - if (ce) return c; - if (Vt) { + g && Ei && ht(g.firstChild); + const q = os(de ? d : g); + for (; T = q.nextNode(); ) ds(T), us(T), T.content instanceof a && Ya(T.content); + if (de) return d; + if (jt) { if (Fe) for (y = yt.call(g.ownerDocument); g.firstChild; ) y.appendChild(g.firstChild); else y = g; - return (V.shadowroot || V.shadowrootmode) && (y = et.call(n, y, !0)), y; + return (W.shadowroot || W.shadowrootmode) && (y = et.call(n, y, !0)), y; } let At = Tt ? g.outerHTML : g.innerHTML; - return Tt && $["!doctype"] && g.ownerDocument && g.ownerDocument.doctype && g.ownerDocument.doctype.name && G(Zr, g.ownerDocument.doctype.name) && (At = " -` + At), jt && Ke([re, oe, ae], (rt) => { + return Tt && $["!doctype"] && g.ownerDocument && g.ownerDocument.doctype && g.ownerDocument.doctype.name && G(ca, g.ownerDocument.doctype.name) && (At = " +` + At), Vt && Ke([re, ae, oe], (rt) => { At = pe(At, rt, " "); - }), S && qe ? S.createHTML(At) : At; + }), S && He ? S.createHTML(At) : At; }, e.setConfig = function() { - Ci(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}), yi = !0; + wi(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}), Ai = !0; }, e.clearConfig = function() { - Gt = null, yi = !1; - }, e.isValidAttribute = function(c, p, g) { - Gt || Ci({}); - const L = U(c), w = U(p); - return ls(L, w, g); - }, e.addHook = function(c, p) { - typeof p == "function" && ge(j[c], p); - }, e.removeHook = function(c, p) { - if (p !== void 0) { - const g = pa(j[c], p); - return g === -1 ? void 0 : fa(j[c], g, 1)[0]; + Gt = null, Ai = !1; + }, e.isValidAttribute = function(d, f, g) { + Gt || wi({}); + const C = U(d), T = U(f); + return cs(C, T, g); + }, e.addHook = function(d, f) { + typeof f == "function" && ge(j[d], f); + }, e.removeHook = function(d, f) { + if (f !== void 0) { + const g = Co(j[d], f); + return g === -1 ? void 0 : wo(j[d], g, 1)[0]; } - return Ls(j[c]); - }, e.removeHooks = function(c) { - j[c] = []; + return ws(j[d]); + }, e.removeHooks = function(d) { + j[d] = []; }, e.removeAllHooks = function() { j = { afterSanitizeAttributes: [], afterSanitizeElements: [], afterSanitizeShadowDOM: [], beforeSanitizeAttributes: [], beforeSanitizeElements: [], beforeSanitizeShadowDOM: [], uponSanitizeAttribute: [], uponSanitizeElement: [], uponSanitizeShadowNode: [] }; }, e; @@ -1043,8 +1043,8 @@ var Ie = function s() { Ie.addHook("uponSanitizeAttribute", function(s, t) { /^data-trix-/.test(t.attrName) && (t.forceKeepAttr = !0); }); -const Na = "style href src width height language class".split(" "), Pa = "javascript:".split(" "), Fa = "script iframe form noscript".split(" "); -class mi extends F { +const Ko = "style href src width height language class".split(" "), Go = "javascript:".split(" "), Jo = "script iframe form noscript".split(" "); +class gi extends P { static setHTML(t, e, i) { const n = new this(e, i).sanitize(), r = n.getHTML ? n.getHTML() : n.outerHTML; t.innerHTML = r; @@ -1055,11 +1055,11 @@ class mi extends F { } constructor(t) { let { allowedAttributes: e, forbiddenProtocols: i, forbiddenElements: n, purifyOptions: r } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; - super(...arguments), this.allowedAttributes = e || Na, this.forbiddenProtocols = i || Pa, this.forbiddenElements = n || Fa, this.purifyOptions = r || {}, this.body = qa(t); + super(...arguments), this.allowedAttributes = e || Ko, this.forbiddenProtocols = i || Go, this.forbiddenElements = n || Jo, this.purifyOptions = r || {}, this.body = Yo(t); } sanitize() { this.sanitizeElements(), this.normalizeListElementNesting(); - const t = Object.assign({}, Nr, this.purifyOptions); + const t = Object.assign({}, Kr, this.purifyOptions); return Ie.setConfig(t), this.body = Ie.sanitize(this.body), this.body; } getHTML() { @@ -1069,7 +1069,7 @@ class mi extends F { return this.body; } sanitizeElements() { - const t = ri(this.body), e = []; + const t = ai(this.body), e = []; for (; t.nextNode(); ) { const i = t.currentNode; switch (i.nodeType) { @@ -1104,7 +1104,7 @@ class mi extends F { return t.getAttribute("data-trix-serialize") === "false" && !Bt(t); } } -const qa = function() { +const Yo = function() { let s = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ""; s = s.replace(/<\/html[^>]*>[^]*$/i, ""); const t = document.implementation.createHTMLDocument(""); @@ -1112,7 +1112,7 @@ const qa = function() { t.body.appendChild(e); }), t.body; }, { css: Et } = Me; -class Hn extends $t { +class Un extends $t { constructor() { super(...arguments), this.attachment = this.object, this.attachment.uploadProgressDelegate = this, this.attachmentPiece = this.options.piece; } @@ -1121,25 +1121,25 @@ class Hn extends $t { } createNodes() { let t; - const e = t = A({ tagName: "figure", className: this.getClassName(), data: this.getData(), editable: !1 }), i = this.getHref(); - return i && (t = A({ tagName: "a", editable: !1, attributes: { href: i, tabindex: -1 } }), e.appendChild(t)), this.attachment.hasContent() ? mi.setHTML(t, this.attachment.getContent()) : this.createContentNodes().forEach((n) => { + const e = t = x({ tagName: "figure", className: this.getClassName(), data: this.getData(), editable: !1 }), i = this.getHref(); + return i && (t = x({ tagName: "a", editable: !1, attributes: { href: i, tabindex: -1 } }), e.appendChild(t)), this.attachment.hasContent() ? gi.setHTML(t, this.attachment.getContent()) : this.createContentNodes().forEach((n) => { t.appendChild(n); - }), t.appendChild(this.createCaptionElement()), this.attachment.isPending() && (this.progressElement = A({ tagName: "progress", attributes: { class: Et.attachmentProgress, value: this.attachment.getUploadProgress(), max: 100 }, data: { trixMutable: !0, trixStoreKey: ["progressElement", this.attachment.id].join("/") } }), e.appendChild(this.progressElement)), [Ds("left"), e, Ds("right")]; + }), t.appendChild(this.createCaptionElement()), this.attachment.isPending() && (this.progressElement = x({ tagName: "progress", attributes: { class: Et.attachmentProgress, value: this.attachment.getUploadProgress(), max: 100 }, data: { trixMutable: !0, trixStoreKey: ["progressElement", this.attachment.id].join("/") } }), e.appendChild(this.progressElement)), [Ms("left"), e, Ms("right")]; } createCaptionElement() { - const t = A({ tagName: "figcaption", className: Et.attachmentCaption }), e = this.attachmentPiece.getCaption(); + const t = x({ tagName: "figcaption", className: Et.attachmentCaption }), e = this.attachmentPiece.getCaption(); if (e) t.classList.add("".concat(Et.attachmentCaption, "--edited")), t.textContent = e; else { let i, n; const r = this.getCaptionConfig(); if (r.name && (i = this.attachment.getFilename()), r.size && (n = this.attachment.getFormattedFilesize()), i) { - const o = A({ tagName: "span", className: Et.attachmentName, textContent: i }); - t.appendChild(o); + const a = x({ tagName: "span", className: Et.attachmentName, textContent: i }); + t.appendChild(a); } if (n) { i && t.appendChild(document.createTextNode(" ")); - const o = A({ tagName: "span", className: Et.attachmentSize, textContent: n }); - t.appendChild(o); + const a = x({ tagName: "span", className: Et.attachmentSize, textContent: n }); + t.appendChild(a); } } return t; @@ -1153,14 +1153,14 @@ class Hn extends $t { return e.isEmpty() || (t.trixAttributes = JSON.stringify(e)), this.attachment.isPending() && (t.trixSerialize = !1), t; } getHref() { - if (!Ha(this.attachment.getContent(), "a")) { + if (!Xo(this.attachment.getContent(), "a")) { const t = this.attachment.getHref(); if (t && Ie.isValidAttribute("a", "href", t)) return t; } } getCaptionConfig() { var t; - const e = this.attachment.getType(), i = Wr((t = Rn[e]) === null || t === void 0 ? void 0 : t.caption); + const e = this.attachment.getType(), i = na((t = On[e]) === null || t === void 0 ? void 0 : t.caption); return e === "file" && (i.name = !0), i; } findProgressElement() { @@ -1172,16 +1172,16 @@ class Hn extends $t { e && (e.value = t); } } -const Ds = (s) => A({ tagName: "span", textContent: ui, data: { trixCursorTarget: s, trixSerialize: !1 } }), Ha = function(s, t) { - const e = A("div"); - return mi.setHTML(e, s || ""), e.querySelector(t); +const Ms = (s) => x({ tagName: "span", textContent: mi, data: { trixCursorTarget: s, trixSerialize: !1 } }), Xo = function(s, t) { + const e = x("div"); + return gi.setHTML(e, s || ""), e.querySelector(t); }; -class to extends Hn { +class ha extends Un { constructor() { super(...arguments), this.attachment.previewDelegate = this; } createContentNodes() { - return this.image = A({ tagName: "img", attributes: { src: "" }, data: { trixMutable: !0 } }), this.refresh(this.image), [this.image]; + return this.image = x({ tagName: "img", attributes: { src: "" }, data: { trixMutable: !0 } }), this.refresh(this.image), [this.image]; } createCaptionElement() { const t = super.createCaptionElement(...arguments); @@ -1198,16 +1198,16 @@ class to extends Hn { const l = JSON.stringify({ src: e }); t.setAttribute("data-trix-serialized-attributes", l); } - const n = this.attachment.getWidth(), r = this.attachment.getHeight(), o = this.attachment.getAttribute("alt"); - n != null && (t.width = n), r != null && (t.height = r), o != null && (t.alt = o); - const a = ["imageElement", this.attachment.id, t.src, t.width, t.height].join("/"); - t.dataset.trixStoreKey = a; + const n = this.attachment.getWidth(), r = this.attachment.getHeight(), a = this.attachment.getAttribute("alt"); + n != null && (t.width = n), r != null && (t.height = r), a != null && (t.alt = a); + const o = ["imageElement", this.attachment.id, t.src, t.width, t.height].join("/"); + t.dataset.trixStoreKey = o; } attachmentDidChangeAttributes() { return this.refresh(this.image), this.refresh(); } } -class eo extends $t { +class ua extends $t { constructor() { super(...arguments), this.piece = this.object, this.attributes = this.piece.getAttributes(), this.textConfig = this.options.textConfig, this.context = this.options.context, this.piece.attachment ? this.attachment = this.piece.attachment : this.string = this.piece.toString(); } @@ -1229,7 +1229,7 @@ class eo extends $t { return t; } createAttachmentNodes() { - const t = this.attachment.isPreviewable() ? to : Hn; + const t = this.attachment.isPreviewable() ? ha : Un; return this.createChildView(t, this.piece.attachment, { piece: this.piece }).getNodes(); } createStringNodes() { @@ -1241,12 +1241,12 @@ class eo extends $t { for (let n = 0; n < i.length; n++) { const r = i[n]; if (n > 0) { - const o = A("br"); - e.push(o); + const a = x("br"); + e.push(a); } if (r.length) { - const o = document.createTextNode(this.preserveSpaces(r)); - e.push(o); + const a = document.createTextNode(this.preserveSpaces(r)); + e.push(a); } } return e; @@ -1257,25 +1257,25 @@ class eo extends $t { const n = {}; for (e in this.attributes) { i = this.attributes[e]; - const o = yn(e); - if (o) { - if (o.tagName) { + const a = En(e); + if (a) { + if (a.tagName) { var r; - const a = A(o.tagName); - r ? (r.appendChild(a), r = a) : t = r = a; + const o = x(a.tagName); + r ? (r.appendChild(o), r = o) : t = r = o; } - if (o.styleProperty && (n[o.styleProperty] = i), o.style) for (e in o.style) i = o.style[e], n[e] = i; + if (a.styleProperty && (n[a.styleProperty] = i), a.style) for (e in a.style) i = a.style[e], n[e] = i; } } - if (Object.keys(n).length) for (e in t || (t = A("span")), n) i = n[e], t.style[e] = i; + if (Object.keys(n).length) for (e in t || (t = x("span")), n) i = n[e], t.style[e] = i; return t; } createContainerElement() { for (const t in this.attributes) { - const e = this.attributes[t], i = yn(t); + const e = this.attributes[t], i = En(t); if (i && i.groupTagName) { const n = {}; - return n[t] = e, A(i.groupTagName, n); + return n[t] = e, x(i.groupTagName, n); } } } @@ -1283,18 +1283,18 @@ class eo extends $t { return this.context.isLast && (t = t.replace(/\ $/, Lt)), t = t.replace(/(\S)\ {3}(\S)/g, "$1 ".concat(Lt, " $2")).replace(/\ {2}/g, "".concat(Lt, " ")).replace(/\ {2}/g, " ".concat(Lt)), (this.context.isFirst || this.context.followsWhitespace) && (t = t.replace(/^\ /, Lt)), t; } } -class io extends $t { +class ma extends $t { constructor() { super(...arguments), this.text = this.object, this.textConfig = this.options.textConfig; } createNodes() { - const t = [], e = qn.groupObjects(this.getPieces()), i = e.length - 1; + const t = [], e = $n.groupObjects(this.getPieces()), i = e.length - 1; for (let r = 0; r < e.length; r++) { - const o = e[r], a = {}; - r === 0 && (a.isFirst = !0), r === i && (a.isLast = !0), $a(n) && (a.followsWhitespace = !0); - const l = this.findOrCreateCachedChildView(eo, o, { textConfig: this.textConfig, context: a }); + const a = e[r], o = {}; + r === 0 && (o.isFirst = !0), r === i && (o.isLast = !0), Qo(n) && (o.followsWhitespace = !0); + const l = this.findOrCreateCachedChildView(ua, a, { textConfig: this.textConfig, context: o }); t.push(...Array.from(l.getNodes() || [])); - var n = o; + var n = a; } return t; } @@ -1302,70 +1302,70 @@ class io extends $t { return Array.from(this.text.getPieces()).filter((t) => !t.hasAttribute("blockBreak")); } } -const $a = (s) => /\s$/.test(s == null ? void 0 : s.toString()), { css: Os } = Me; -class no extends $t { +const Qo = (s) => /\s$/.test(s == null ? void 0 : s.toString()), { css: Bs } = Me; +class ga extends $t { constructor() { super(...arguments), this.block = this.object, this.attributes = this.block.getAttributes(); } createNodes() { const t = [document.createComment("block")]; - if (this.block.isEmpty()) t.push(A("br")); + if (this.block.isEmpty()) t.push(x("br")); else { var e; - const i = (e = N(this.block.getLastAttribute())) === null || e === void 0 ? void 0 : e.text, n = this.findOrCreateCachedChildView(io, this.block.text, { textConfig: i }); - t.push(...Array.from(n.getNodes() || [])), this.shouldAddExtraNewlineElement() && t.push(A("br")); + const i = (e = N(this.block.getLastAttribute())) === null || e === void 0 ? void 0 : e.text, n = this.findOrCreateCachedChildView(ma, this.block.text, { textConfig: i }); + t.push(...Array.from(n.getNodes() || [])), this.shouldAddExtraNewlineElement() && t.push(x("br")); } if (this.attributes.length) return t; { let i; const { tagName: n } = Y.default; this.block.isRTL() && (i = { dir: "rtl" }); - const r = A({ tagName: n, attributes: i }); - return t.forEach((o) => r.appendChild(o)), [r]; + const r = x({ tagName: n, attributes: i }); + return t.forEach((a) => r.appendChild(a)), [r]; } } createContainerElement(t) { const e = {}; let i; - const n = this.attributes[t], { tagName: r, htmlAttributes: o = [] } = N(n); + const n = this.attributes[t], { tagName: r, htmlAttributes: a = [] } = N(n); if (t === 0 && this.block.isRTL() && Object.assign(e, { dir: "rtl" }), n === "attachmentGallery") { - const a = this.block.getBlockBreakPosition(); - i = "".concat(Os.attachmentGallery, " ").concat(Os.attachmentGallery, "--").concat(a); + const o = this.block.getBlockBreakPosition(); + i = "".concat(Bs.attachmentGallery, " ").concat(Bs.attachmentGallery, "--").concat(o); } - return Object.entries(this.block.htmlAttributes).forEach((a) => { - let [l, d] = a; - o.includes(l) && (e[l] = d); - }), A({ tagName: r, className: i, attributes: e }); + return Object.entries(this.block.htmlAttributes).forEach((o) => { + let [l, c] = o; + a.includes(l) && (e[l] = c); + }), x({ tagName: r, className: i, attributes: e }); } shouldAddExtraNewlineElement() { return /\n\n$/.test(this.block.toString()); } } -class gi extends $t { +class pi extends $t { static render(t) { - const e = A("div"), i = new this(t, { element: e }); + const e = x("div"), i = new this(t, { element: e }); return i.render(), i.sync(), e; } constructor() { - super(...arguments), this.element = this.options.element, this.elementStore = new da(), this.setDocument(this.object); + super(...arguments), this.element = this.options.element, this.elementStore = new Ao(), this.setDocument(this.object); } setDocument(t) { t.isEqualTo(this.document) || (this.document = this.object = t); } render() { - if (this.childViews = [], this.shadowElement = A("div"), !this.document.isEmpty()) { - const t = qn.groupObjects(this.document.getBlocks(), { asTree: !0 }); + if (this.childViews = [], this.shadowElement = x("div"), !this.document.isEmpty()) { + const t = $n.groupObjects(this.document.getBlocks(), { asTree: !0 }); Array.from(t).forEach((e) => { - const i = this.findOrCreateCachedChildView(no, e); + const i = this.findOrCreateCachedChildView(ga, e); Array.from(i.getNodes()).map((n) => this.shadowElement.appendChild(n)); }); } } isSynced() { - return Ua(this.shadowElement, this.element); + return Zo(this.shadowElement, this.element); } sync() { - const t = qr("trix-before-render", { cancelable: !1, attributes: { render: (i, n) => { + const t = Yr("trix-before-render", { cancelable: !1, attributes: { render: (i, n) => { for (; i.lastChild; ) i.removeChild(i.lastChild); i.appendChild(n); } } }); @@ -1374,20 +1374,20 @@ class gi extends $t { return t.render(this.element, e), this.didSync(); } didSync() { - return this.elementStore.reset(Ms(this.element)), Nn(() => this.garbageCollectCachedViews()); + return this.elementStore.reset(Ns(this.element)), Fn(() => this.garbageCollectCachedViews()); } createDocumentFragmentForSync() { const t = document.createDocumentFragment(); return Array.from(this.shadowElement.childNodes).forEach((e) => { t.appendChild(e.cloneNode(!0)); - }), Array.from(Ms(t)).forEach((e) => { + }), Array.from(Ns(t)).forEach((e) => { const i = this.elementStore.remove(e); i && e.parentNode.replaceChild(i, e); }), t; } } -const Ms = (s) => s.querySelectorAll("[data-trix-store-key]"), Ua = (s, t) => Bs(s.innerHTML) === Bs(t.innerHTML), Bs = (s) => s.replace(/ /g, " "); -function ja(s) { +const Ns = (s) => s.querySelectorAll("[data-trix-store-key]"), Zo = (s, t) => Ps(s.innerHTML) === Ps(t.innerHTML), Ps = (s) => s.replace(/ /g, " "); +function tl(s) { var t = function(e, i) { if (typeof e != "object" || !e) return e; var n = e[Symbol.toPrimitive]; @@ -1400,23 +1400,23 @@ function ja(s) { }(s, "string"); return typeof t == "symbol" ? t : String(t); } -function W(s, t, e) { - return (t = ja(t)) in s ? Object.defineProperty(s, t, { value: e, enumerable: !0, configurable: !0, writable: !0 }) : s[t] = e, s; +function K(s, t, e) { + return (t = tl(t)) in s ? Object.defineProperty(s, t, { value: e, enumerable: !0, configurable: !0, writable: !0 }) : s[t] = e, s; } -function C(s, t) { - return Va(s, so(s, t, "get")); +function w(s, t) { + return el(s, pa(s, t, "get")); } function Le(s, t, e) { - return za(s, so(s, t, "set"), e), e; + return il(s, pa(s, t, "set"), e), e; } -function so(s, t, e) { +function pa(s, t, e) { if (!t.has(s)) throw new TypeError("attempted to " + e + " private field on non-instance"); return t.get(s); } -function Va(s, t) { +function el(s, t) { return t.get ? t.get.call(s) : t.value; } -function za(s, t, e) { +function il(s, t, e) { if (t.set) t.set.call(s, e); else { if (!t.writable) throw new TypeError("attempted to set read only private field"); @@ -1427,13 +1427,13 @@ function Je(s, t, e) { if (!t.has(s)) throw new TypeError("attempted to get private field on non-instance"); return e; } -function ro(s, t) { +function fa(s, t) { if (t.has(s)) throw new TypeError("Cannot initialize the same private elements twice on an object"); } function ee(s, t, e) { - ro(s, t), t.set(s, e); + fa(s, t), t.set(s, e); } -class Ut extends Ht { +class Ut extends qt { static registerType(t, e) { e.type = t, this.types[t] = e; } @@ -1506,8 +1506,8 @@ class Ut extends Ht { return !1; } } -W(Ut, "types", {}); -class oo extends ai { +K(Ut, "types", {}); +class ba extends li { constructor(t) { super(...arguments), this.url = t; } @@ -1516,7 +1516,7 @@ class oo extends ai { e.onload = () => (e.width = this.width = e.naturalWidth, e.height = this.height = e.naturalHeight, t(!0, e)), e.onerror = () => t(!1), e.src = this.url; } } -class se extends Ht { +class se extends qt { static attachmentForFile(t) { const e = new this(this.attributesForFile(t)); return e.setFile(t), e; @@ -1546,8 +1546,8 @@ class se extends Ht { setAttributes() { let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; const e = this.attributes.merge(t); - var i, n, r, o; - if (!this.attributes.isEqualTo(e)) return this.attributes = e, this.didChangeAttributes(), (i = this.previewDelegate) === null || i === void 0 || (n = i.attachmentDidChangeAttributes) === null || n === void 0 || n.call(i, this), (r = this.delegate) === null || r === void 0 || (o = r.attachmentDidChangeAttributes) === null || o === void 0 ? void 0 : o.call(r, this); + var i, n, r, a; + if (!this.attributes.isEqualTo(e)) return this.attributes = e, this.didChangeAttributes(), (i = this.previewDelegate) === null || i === void 0 || (n = i.attachmentDidChangeAttributes) === null || n === void 0 || n.call(i, this), (r = this.delegate) === null || r === void 0 || (a = r.attachmentDidChangeAttributes) === null || a === void 0 ? void 0 : a.call(r, this); } didChangeAttributes() { if (this.isPreviewable()) return this.preloadURL(); @@ -1575,7 +1575,7 @@ class se extends Ht { } getFormattedFilesize() { const t = this.attributes.get("filesize"); - return typeof t == "number" ? Pr.formatter(t) : ""; + return typeof t == "number" ? Gr.formatter(t) : ""; } getExtension() { var t; @@ -1636,13 +1636,13 @@ class se extends Ht { } preload(t, e) { if (t && t !== this.getPreviewURL()) - return this.preloadingURL = t, new oo(t).then((i) => { + return this.preloadingURL = t, new ba(t).then((i) => { let { width: n, height: r } = i; return this.getWidth() && this.getHeight() || this.setAttributes({ width: n, height: r }), this.preloadingURL = null, this.setPreviewURL(t), e == null ? void 0 : e(); }).catch(() => (this.preloadingURL = null, e == null ? void 0 : e())); } } -W(se, "previewablePattern", /^image(\/(gif|png|webp|jpe?g)|$)/); +K(se, "previewablePattern", /^image(\/(gif|png|webp|jpe?g)|$)/); class ie extends Ut { static fromJSON(t) { return new this(se.fromJSON(t.attachment), t.attributes); @@ -1684,8 +1684,8 @@ class ie extends Ut { return JSON.stringify(this.toString()); } } -W(ie, "permittedAttributes", ["caption", "presentation"]), Ut.registerType("attachment", ie); -class $n extends Ut { +K(ie, "permittedAttributes", ["caption", "presentation"]), Ut.registerType("attachment", ie); +class Vn extends Ut { static fromJSON(t) { return new this(t.string, t.attributes); } @@ -1722,8 +1722,8 @@ class $n extends Ut { return t.length > 15 && (t = t.slice(0, 14) + "…"), JSON.stringify(t.toString()); } } -Ut.registerType("string", $n); -class li extends Ht { +Ut.registerType("string", Vn); +class di extends qt { static box(t) { return t instanceof this ? t : new this(t); } @@ -1736,7 +1736,7 @@ class li extends Ht { } splice() { for (var t = arguments.length, e = new Array(t), i = 0; i < t; i++) e[i] = arguments[i]; - return new this.constructor(Bn(this.objects, ...e)); + return new this.constructor(Pn(this.objects, ...e)); } eachObject(t) { return this.objects.map((e, i) => t(e, i)); @@ -1776,12 +1776,12 @@ class li extends Ht { return new this.constructor(e).splice(i, n - i + 1); } transformObjectsInRange(t, e) { - const [i, n, r] = this.splitObjectsAtRange(t), o = i.map((a, l) => n <= l && l <= r ? e(a) : a); - return new this.constructor(o); + const [i, n, r] = this.splitObjectsAtRange(t), a = i.map((o, l) => n <= l && l <= r ? e(o) : o); + return new this.constructor(a); } splitObjectsAtRange(t) { - let e, [i, n, r] = this.splitObjectAtPosition(Ka(t)); - return [i, e] = new this.constructor(i).splitObjectAtPosition(Ga(t) + r), [i, n, e - 1]; + let e, [i, n, r] = this.splitObjectAtPosition(sl(t)); + return [i, e] = new this.constructor(i).splitObjectAtPosition(rl(t) + r), [i, n, e - 1]; } getObjectAtPosition(t) { const { index: e } = this.findIndexAndOffsetAtPosition(t); @@ -1789,14 +1789,14 @@ class li extends Ht { } splitObjectAtPosition(t) { let e, i; - const { index: n, offset: r } = this.findIndexAndOffsetAtPosition(t), o = this.objects.slice(0); + const { index: n, offset: r } = this.findIndexAndOffsetAtPosition(t), a = this.objects.slice(0); if (n != null) if (r === 0) e = n, i = 0; else { - const a = this.getObjectAtIndex(n), [l, d] = a.splitAtOffset(r); - o.splice(n, 1, l, d), e = n + 1, i = l.getLength() - r; + const o = this.getObjectAtIndex(n), [l, c] = o.splitAtOffset(r); + a.splice(n, 1, l, c), e = n + 1, i = l.getLength() - r; } - else e = o.length, i = 0; - return [o, e, i]; + else e = a.length, i = 0; + return [a, e, i]; } consolidate() { const t = []; @@ -1844,13 +1844,13 @@ class li extends Ht { return this.toArray(); } isEqualTo(t) { - return super.isEqualTo(...arguments) || Wa(this.objects, t == null ? void 0 : t.objects); + return super.isEqualTo(...arguments) || nl(this.objects, t == null ? void 0 : t.objects); } contentsForInspection() { return { objects: "[".concat(this.objects.map((t) => t.inspect()).join(", "), "]") }; } } -const Wa = function(s) { +const nl = function(s) { let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : []; if (s.length !== t.length) return !1; let e = !0; @@ -1859,13 +1859,13 @@ const Wa = function(s) { e && !n.isEqualTo(t[i]) && (e = !1); } return e; -}, Ka = (s) => s[0], Ga = (s) => s[1]; -class ct extends Ht { +}, sl = (s) => s[0], rl = (s) => s[1]; +class dt extends qt { static textForAttachmentWithAttributes(t, e) { return new this([new ie(t, e)]); } static textForStringWithAttributes(t, e) { - return new this([new $n(t, e)]); + return new this([new Vn(t, e)]); } static fromJSON(t) { return new this(Array.from(t).map((e) => Ut.fromJSON(e))); @@ -1874,7 +1874,7 @@ class ct extends Ht { let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; super(...arguments); const e = t.filter((i) => !i.isEmpty()); - this.pieceList = new li(e); + this.pieceList = new di(e); } copy() { return this.copyWithPieceList(this.pieceList); @@ -2016,18 +2016,18 @@ class ct extends Ht { return JSON.stringify(this.pieceList.toArray().map((t) => JSON.parse(t.toConsole()))); } getDirection() { - return ta(this.toString()); + return ho(this.toString()); } isRTL() { return this.getDirection() === "rtl"; } } -class ut extends Ht { +class ut extends qt { static fromJSON(t) { - return new this(ct.fromJSON(t.text), t.attributes, t.htmlAttributes); + return new this(dt.fromJSON(t.text), t.attributes, t.htmlAttributes); } constructor(t, e, i) { - super(...arguments), this.text = Ja(t || new ct()), this.attributes = e || [], this.htmlAttributes = i || {}; + super(...arguments), this.text = al(t || new dt()), this.attributes = e || [], this.htmlAttributes = i || {}; } isEmpty() { return this.text.isBlockBreak(); @@ -2052,7 +2052,7 @@ class ut extends Ht { return e ? this.copyWithText(e) : this.copyWithText(this.text.copyUsingObjectMap(t)); } addAttribute(t) { - const e = this.attributes.concat(Ns(t)); + const e = this.attributes.concat(Fs(t)); return this.copyWithAttributes(e); } addHTMLAttribute(t, e) { @@ -2060,14 +2060,14 @@ class ut extends Ht { return new ut(this.text, this.attributes, i); } removeAttribute(t) { - const { listAttribute: e } = N(t), i = Fs(Fs(this.attributes, t), e); + const { listAttribute: e } = N(t), i = qs(qs(this.attributes, t), e); return this.copyWithAttributes(i); } removeLastAttribute() { return this.removeAttribute(this.getLastAttribute()); } getLastAttribute() { - return Ps(this.attributes); + return Hs(this.attributes); } getAttributes() { return this.attributes.slice(0); @@ -2085,7 +2085,7 @@ class ut extends Ht { return this.getAttributeLevel() > 0; } getLastNestableAttribute() { - return Ps(this.getNestableAttributes()); + return Hs(this.getNestableAttributes()); } getNestableAttributes() { return this.attributes.filter((t) => N(t).nestable); @@ -2100,7 +2100,7 @@ class ut extends Ht { increaseNestingLevel() { const t = this.getLastNestableAttribute(); if (t) { - const e = this.attributes.lastIndexOf(t), i = Bn(this.attributes, e + 1, 0, ...Ns(t)); + const e = this.attributes.lastIndexOf(t), i = Pn(this.attributes, e + 1, 0, ...Fs(t)); return this.copyWithAttributes(i); } return this; @@ -2156,7 +2156,7 @@ class ut extends Ht { return !this.hasAttributes() && !t.hasAttributes() && this.getDirection() === t.getDirection(); } consolidateWith(t) { - const e = ct.textForStringWithAttributes(` + const e = dt.textForStringWithAttributes(` `), i = this.getTextWithoutBlockBreak().appendText(e); return this.copyWithText(i.appendText(t.text)); } @@ -2168,7 +2168,7 @@ class ut extends Ht { return this.text.getLength() - 1; } getTextWithoutBlockBreak() { - return ao(this.text) ? this.text.getTextAtRange([0, this.getBlockBreakPosition()]) : this.text.copy(); + return _a(this.text) ? this.text.getTextAtRange([0, this.getBlockBreakPosition()]) : this.text.copy(); } canBeGrouped(t) { return this.attributes[t]; @@ -2176,49 +2176,49 @@ class ut extends Ht { canBeGroupedWith(t, e) { const i = t.getAttributes(), n = i[e], r = this.attributes[e]; return r === n && !(N(r).group === !1 && !(() => { - if (!We) { - We = []; - for (const o in Y) { - const { listAttribute: a } = Y[o]; - a != null && We.push(a); + if (!ze) { + ze = []; + for (const a in Y) { + const { listAttribute: o } = Y[a]; + o != null && ze.push(o); } } - return We; + return ze; })().includes(i[e + 1])) && (this.getDirection() === t.getDirection() || t.isEmpty()); } } -const Ja = function(s) { - return s = Ya(s), s = Qa(s); -}, Ya = function(s) { +const al = function(s) { + return s = ol(s), s = dl(s); +}, ol = function(s) { let t = !1; const e = s.getPieces(); let i = e.slice(0, e.length - 1); const n = e[e.length - 1]; - return n ? (i = i.map((r) => r.isBlockBreak() ? (t = !0, Za(r)) : r), t ? new ct([...i, n]) : s) : s; -}, Xa = ct.textForStringWithAttributes(` -`, { blockBreak: !0 }), Qa = function(s) { - return ao(s) ? s : s.appendText(Xa); -}, ao = function(s) { + return n ? (i = i.map((r) => r.isBlockBreak() ? (t = !0, cl(r)) : r), t ? new dt([...i, n]) : s) : s; +}, ll = dt.textForStringWithAttributes(` +`, { blockBreak: !0 }), dl = function(s) { + return _a(s) ? s : s.appendText(ll); +}, _a = function(s) { const t = s.getLength(); return t === 0 ? !1 : s.getTextAtRange([t - 1, t]).isBlockBreak(); -}, Za = (s) => s.copyWithoutAttribute("blockBreak"), Ns = function(s) { +}, cl = (s) => s.copyWithoutAttribute("blockBreak"), Fs = function(s) { const { listAttribute: t } = N(s); return t ? [t, s] : [s]; -}, Ps = (s) => s.slice(-1)[0], Fs = function(s, t) { +}, Hs = (s) => s.slice(-1)[0], qs = function(s, t) { const e = s.lastIndexOf(t); - return e === -1 ? s : Bn(s, e, 1); + return e === -1 ? s : Pn(s, e, 1); }; -class nt extends Ht { +class nt extends qt { static fromJSON(t) { return new this(Array.from(t).map((e) => ut.fromJSON(e))); } static fromString(t, e) { - const i = ct.textForStringWithAttributes(t, e); + const i = dt.textForStringWithAttributes(t, e); return new this([new ut(i)]); } constructor() { let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; - super(...arguments), t.length === 0 && (t = [new ut()]), this.blockList = li.box(t); + super(...arguments), t.length === 0 && (t = [new ut()]), this.blockList = di.box(t); } isEmpty() { const t = this.getBlockAtIndex(0); @@ -2229,7 +2229,7 @@ class nt extends Ht { return new this.constructor(t); } copyUsingObjectsFromDocument(t) { - const e = new ca(t.getObjects()); + const e = new yo(t.getObjects()); return this.copyUsingObjectMap(e); } copyUsingObjectMap(t) { @@ -2250,69 +2250,69 @@ class nt extends Ht { } insertDocumentAtRange(t, e) { const { blockList: i } = t; - e = T(e); + e = k(e); let [n] = e; - const { index: r, offset: o } = this.locationFromPosition(n); - let a = this; + const { index: r, offset: a } = this.locationFromPosition(n); + let o = this; const l = this.getBlockAtPosition(n); - return _t(e) && l.isEmpty() && !l.hasAttributes() ? a = new this.constructor(a.blockList.removeObjectAtIndex(r)) : l.getBlockBreakPosition() === o && n++, a = a.removeTextAtRange(e), new this.constructor(a.blockList.insertSplittableListAtPosition(i, n)); + return vt(e) && l.isEmpty() && !l.hasAttributes() ? o = new this.constructor(o.blockList.removeObjectAtIndex(r)) : l.getBlockBreakPosition() === a && n++, o = o.removeTextAtRange(e), new this.constructor(o.blockList.insertSplittableListAtPosition(i, n)); } mergeDocumentAtRange(t, e) { let i, n; - e = T(e); - const [r] = e, o = this.locationFromPosition(r), a = this.getBlockAtIndex(o.index).getAttributes(), l = t.getBaseBlockAttributes(), d = a.slice(-l.length); - if (Ft(l, d)) { - const f = a.slice(0, -l.length); - i = t.copyWithBaseBlockAttributes(f); - } else i = t.copy({ consolidateBlocks: !0 }).copyWithBaseBlockAttributes(a); + e = k(e); + const [r] = e, a = this.locationFromPosition(r), o = this.getBlockAtIndex(a.index).getAttributes(), l = t.getBaseBlockAttributes(), c = o.slice(-l.length); + if (Ft(l, c)) { + const p = o.slice(0, -l.length); + i = t.copyWithBaseBlockAttributes(p); + } else i = t.copy({ consolidateBlocks: !0 }).copyWithBaseBlockAttributes(o); const h = i.getBlockCount(), m = i.getBlockAtIndex(0); - if (Ft(a, m.getAttributes())) { - const f = m.getTextWithoutBlockBreak(); - if (n = this.insertTextAtRange(f, e), h > 1) { + if (Ft(o, m.getAttributes())) { + const p = m.getTextWithoutBlockBreak(); + if (n = this.insertTextAtRange(p, e), h > 1) { i = new this.constructor(i.getBlocks().slice(1)); - const u = r + f.getLength(); + const u = r + p.getLength(); n = n.insertDocumentAtRange(i, u); } } else n = this.insertDocumentAtRange(i, e); return n; } insertTextAtRange(t, e) { - e = T(e); - const [i] = e, { index: n, offset: r } = this.locationFromPosition(i), o = this.removeTextAtRange(e); - return new this.constructor(o.blockList.editObjectAtIndex(n, (a) => a.copyWithText(a.text.insertTextAtPosition(t, r)))); + e = k(e); + const [i] = e, { index: n, offset: r } = this.locationFromPosition(i), a = this.removeTextAtRange(e); + return new this.constructor(a.blockList.editObjectAtIndex(n, (o) => o.copyWithText(o.text.insertTextAtPosition(t, r)))); } removeTextAtRange(t) { let e; - t = T(t); + t = k(t); const [i, n] = t; - if (_t(t)) return this; - const [r, o] = Array.from(this.locationRangeFromRange(t)), a = r.index, l = r.offset, d = this.getBlockAtIndex(a), h = o.index, m = o.offset, f = this.getBlockAtIndex(h); - if (n - i == 1 && d.getBlockBreakPosition() === l && f.getBlockBreakPosition() !== m && f.text.getStringAtPosition(m) === ` + if (vt(t)) return this; + const [r, a] = Array.from(this.locationRangeFromRange(t)), o = r.index, l = r.offset, c = this.getBlockAtIndex(o), h = a.index, m = a.offset, p = this.getBlockAtIndex(h); + if (n - i == 1 && c.getBlockBreakPosition() === l && p.getBlockBreakPosition() !== m && p.text.getStringAtPosition(m) === ` `) e = this.blockList.editObjectAtIndex(h, (u) => u.copyWithText(u.text.removeTextAtRange([m, m + 1]))); else { let u; - const b = d.text.getTextAtRange([0, l]), E = f.text.getTextAtRange([m, f.getLength()]), I = b.appendText(E); - u = a !== h && l === 0 && d.getAttributeLevel() >= f.getAttributeLevel() ? f.copyWithText(I) : d.copyWithText(I); - const P = h + 1 - a; - e = this.blockList.splice(a, P, u); + const b = c.text.getTextAtRange([0, l]), A = p.text.getTextAtRange([m, p.getLength()]), I = b.appendText(A); + u = o !== h && l === 0 && c.getAttributeLevel() >= p.getAttributeLevel() ? p.copyWithText(I) : c.copyWithText(I); + const F = h + 1 - o; + e = this.blockList.splice(o, F, u); } return new this.constructor(e); } moveTextFromRangeToPosition(t, e) { let i; - t = T(t); + t = k(t); const [n, r] = t; if (n <= e && e <= r) return this; - let o = this.getDocumentAtRange(t), a = this.removeTextAtRange(t); + let a = this.getDocumentAtRange(t), o = this.removeTextAtRange(t); const l = n < e; - l && (e -= o.getLength()); - const [d, ...h] = o.getBlocks(); - return h.length === 0 ? (i = d.getTextWithoutBlockBreak(), l && (e += 1)) : i = d.text, a = a.insertTextAtRange(i, e), h.length === 0 ? a : (o = new this.constructor(h), e += i.getLength(), a.insertDocumentAtRange(o, e)); + l && (e -= a.getLength()); + const [c, ...h] = a.getBlocks(); + return h.length === 0 ? (i = c.getTextWithoutBlockBreak(), l && (e += 1)) : i = c.text, o = o.insertTextAtRange(i, e), h.length === 0 ? o : (a = new this.constructor(h), e += i.getLength(), o.insertDocumentAtRange(a, e)); } addAttributeAtRange(t, e, i) { let { blockList: n } = this; - return this.eachBlockAtRange(i, (r, o, a) => n = n.editObjectAtIndex(a, function() { - return N(t) ? r.addAttribute(t, e) : o[0] === o[1] ? r : r.copyWithText(r.text.addAttributeAtRange(t, e, o)); + return this.eachBlockAtRange(i, (r, a, o) => n = n.editObjectAtIndex(o, function() { + return N(t) ? r.addAttribute(t, e) : a[0] === a[1] ? r : r.copyWithText(r.text.addAttributeAtRange(t, e, a)); })), new this.constructor(n); } addAttribute(t, e) { @@ -2321,13 +2321,13 @@ class nt extends Ht { } removeAttributeAtRange(t, e) { let { blockList: i } = this; - return this.eachBlockAtRange(e, function(n, r, o) { - N(t) ? i = i.editObjectAtIndex(o, () => n.removeAttribute(t)) : r[0] !== r[1] && (i = i.editObjectAtIndex(o, () => n.copyWithText(n.text.removeAttributeAtRange(t, r)))); + return this.eachBlockAtRange(e, function(n, r, a) { + N(t) ? i = i.editObjectAtIndex(a, () => n.removeAttribute(t)) : r[0] !== r[1] && (i = i.editObjectAtIndex(a, () => n.copyWithText(n.text.removeAttributeAtRange(t, r)))); }), new this.constructor(i); } updateAttributesForAttachment(t, e) { - const i = this.getRangeOfAttachment(e), [n] = Array.from(i), { index: r } = this.locationFromPosition(n), o = this.getTextAtIndex(r); - return new this.constructor(this.blockList.editObjectAtIndex(r, (a) => a.copyWithText(o.updateAttributesForAttachment(t, e)))); + const i = this.getRangeOfAttachment(e), [n] = Array.from(i), { index: r } = this.locationFromPosition(n), a = this.getTextAtIndex(r); + return new this.constructor(this.blockList.editObjectAtIndex(r, (o) => o.copyWithText(a.updateAttributesForAttachment(t, e)))); } removeAttributeForAttachment(t, e) { const i = this.getRangeOfAttachment(e); @@ -2339,34 +2339,34 @@ class nt extends Ht { } insertBlockBreakAtRange(t) { let e; - t = T(t); + t = k(t); const [i] = t, { offset: n } = this.locationFromPosition(i), r = this.removeTextAtRange(t); - return n === 0 && (e = [new ut()]), new this.constructor(r.blockList.insertSplittableListAtPosition(new li(e), i)); + return n === 0 && (e = [new ut()]), new this.constructor(r.blockList.insertSplittableListAtPosition(new di(e), i)); } applyBlockAttributeAtRange(t, e, i) { const n = this.expandRangeToLineBreaksAndSplitBlocks(i); let r = n.document; i = n.range; - const o = N(t); - if (o.listAttribute) { + const a = N(t); + if (a.listAttribute) { r = r.removeLastListAttributeAtRange(i, { exceptAttributeName: t }); - const a = r.convertLineBreaksToBlockBreaksInRange(i); - r = a.document, i = a.range; - } else r = o.exclusive ? r.removeBlockAttributesAtRange(i) : o.terminal ? r.removeLastTerminalAttributeAtRange(i) : r.consolidateBlocksAtRange(i); + const o = r.convertLineBreaksToBlockBreaksInRange(i); + r = o.document, i = o.range; + } else r = a.exclusive ? r.removeBlockAttributesAtRange(i) : a.terminal ? r.removeLastTerminalAttributeAtRange(i) : r.consolidateBlocksAtRange(i); return r.addAttributeAtRange(t, e, i); } removeLastListAttributeAtRange(t) { let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, { blockList: i } = this; - return this.eachBlockAtRange(t, function(n, r, o) { - const a = n.getLastAttribute(); - a && N(a).listAttribute && a !== e.exceptAttributeName && (i = i.editObjectAtIndex(o, () => n.removeAttribute(a))); + return this.eachBlockAtRange(t, function(n, r, a) { + const o = n.getLastAttribute(); + o && N(o).listAttribute && o !== e.exceptAttributeName && (i = i.editObjectAtIndex(a, () => n.removeAttribute(o))); }), new this.constructor(i); } removeLastTerminalAttributeAtRange(t) { let { blockList: e } = this; return this.eachBlockAtRange(t, function(i, n, r) { - const o = i.getLastAttribute(); - o && N(o).terminal && (e = e.editObjectAtIndex(r, () => i.removeAttribute(o))); + const a = i.getLastAttribute(); + a && N(a).terminal && (e = e.editObjectAtIndex(r, () => i.removeAttribute(a))); }), new this.constructor(e); } removeBlockAttributesAtRange(t) { @@ -2377,21 +2377,21 @@ class nt extends Ht { } expandRangeToLineBreaksAndSplitBlocks(t) { let e; - t = T(t); + t = k(t); let [i, n] = t; - const r = this.locationFromPosition(i), o = this.locationFromPosition(n); - let a = this; - const l = a.getBlockAtIndex(r.index); - if (r.offset = l.findLineBreakInDirectionFromPosition("backward", r.offset), r.offset != null && (e = a.positionFromLocation(r), a = a.insertBlockBreakAtRange([e, e + 1]), o.index += 1, o.offset -= a.getBlockAtIndex(r.index).getLength(), r.index += 1), r.offset = 0, o.offset === 0 && o.index > r.index) o.index -= 1, o.offset = a.getBlockAtIndex(o.index).getBlockBreakPosition(); + const r = this.locationFromPosition(i), a = this.locationFromPosition(n); + let o = this; + const l = o.getBlockAtIndex(r.index); + if (r.offset = l.findLineBreakInDirectionFromPosition("backward", r.offset), r.offset != null && (e = o.positionFromLocation(r), o = o.insertBlockBreakAtRange([e, e + 1]), a.index += 1, a.offset -= o.getBlockAtIndex(r.index).getLength(), r.index += 1), r.offset = 0, a.offset === 0 && a.index > r.index) a.index -= 1, a.offset = o.getBlockAtIndex(a.index).getBlockBreakPosition(); else { - const d = a.getBlockAtIndex(o.index); - d.text.getStringAtRange([o.offset - 1, o.offset]) === ` -` ? o.offset -= 1 : o.offset = d.findLineBreakInDirectionFromPosition("forward", o.offset), o.offset !== d.getBlockBreakPosition() && (e = a.positionFromLocation(o), a = a.insertBlockBreakAtRange([e, e + 1])); + const c = o.getBlockAtIndex(a.index); + c.text.getStringAtRange([a.offset - 1, a.offset]) === ` +` ? a.offset -= 1 : a.offset = c.findLineBreakInDirectionFromPosition("forward", a.offset), a.offset !== c.getBlockBreakPosition() && (e = o.positionFromLocation(a), o = o.insertBlockBreakAtRange([e, e + 1])); } - return i = a.positionFromLocation(r), n = a.positionFromLocation(o), { document: a, range: t = T([i, n]) }; + return i = o.positionFromLocation(r), n = o.positionFromLocation(a), { document: o, range: t = k([i, n]) }; } convertLineBreaksToBlockBreaksInRange(t) { - t = T(t); + t = k(t); let [e] = t; const i = this.getStringAtRange(t).slice(0, -1); let n = this; @@ -2400,18 +2400,18 @@ class nt extends Ht { }), { document: n, range: t }; } consolidateBlocksAtRange(t) { - t = T(t); + t = k(t); const [e, i] = t, n = this.locationFromPosition(e).index, r = this.locationFromPosition(i).index; return new this.constructor(this.blockList.consolidateFromIndexToIndex(n, r)); } getDocumentAtRange(t) { - t = T(t); + t = k(t); const e = this.blockList.getSplittableListInRange(t).toArray(); return new this.constructor(e); } getStringAtRange(t) { let e; - const i = t = T(t); + const i = t = k(t); return i[i.length - 1] !== this.getLength() && (e = -1), this.getDocumentAtRange(t).toString().slice(0, e); } getBlockAtIndex(t) { @@ -2454,13 +2454,13 @@ class nt extends Ht { } eachBlockAtRange(t, e) { let i, n; - t = T(t); - const [r, o] = t, a = this.locationFromPosition(r), l = this.locationFromPosition(o); - if (a.index === l.index) return i = this.getBlockAtIndex(a.index), n = [a.offset, l.offset], e(i, n, a.index); - for (let d = a.index; d <= l.index; d++) if (i = this.getBlockAtIndex(d), i) { - switch (d) { - case a.index: - n = [a.offset, i.text.getLength()]; + t = k(t); + const [r, a] = t, o = this.locationFromPosition(r), l = this.locationFromPosition(a); + if (o.index === l.index) return i = this.getBlockAtIndex(o.index), n = [o.offset, l.offset], e(i, n, o.index); + for (let c = o.index; c <= l.index; c++) if (i = this.getBlockAtIndex(c), i) { + switch (c) { + case o.index: + n = [o.offset, i.text.getLength()]; break; case l.index: n = [0, l.offset]; @@ -2468,31 +2468,31 @@ class nt extends Ht { default: n = [0, i.text.getLength()]; } - e(i, n, d); + e(i, n, c); } } getCommonAttributesAtRange(t) { - t = T(t); + t = k(t); const [e] = t; - if (_t(t)) return this.getCommonAttributesAtPosition(e); + if (vt(t)) return this.getCommonAttributesAtPosition(e); { const i = [], n = []; - return this.eachBlockAtRange(t, function(r, o) { - if (o[0] !== o[1]) return i.push(r.text.getCommonAttributesAtRange(o)), n.push(qs(r)); + return this.eachBlockAtRange(t, function(r, a) { + if (a[0] !== a[1]) return i.push(r.text.getCommonAttributesAtRange(a)), n.push($s(r)); }), tt.fromCommonAttributesOfObjects(i).merge(tt.fromCommonAttributesOfObjects(n)).toObject(); } } getCommonAttributesAtPosition(t) { let e, i; - const { index: n, offset: r } = this.locationFromPosition(t), o = this.getBlockAtIndex(n); - if (!o) return {}; - const a = qs(o), l = o.text.getAttributesAtPosition(r), d = o.text.getAttributesAtPosition(r - 1), h = Object.keys(Pt).filter((m) => Pt[m].inheritable); - for (e in d) i = d[e], (i === l[e] || h.includes(e)) && (a[e] = i); - return a; + const { index: n, offset: r } = this.locationFromPosition(t), a = this.getBlockAtIndex(n); + if (!a) return {}; + const o = $s(a), l = a.text.getAttributesAtPosition(r), c = a.text.getAttributesAtPosition(r - 1), h = Object.keys(Pt).filter((m) => Pt[m].inheritable); + for (e in c) i = c[e], (i === l[e] || h.includes(e)) && (o[e] = i); + return o; } getRangeOfCommonAttributeAtPosition(t, e) { - const { index: i, offset: n } = this.locationFromPosition(e), r = this.getTextAtIndex(i), [o, a] = Array.from(r.getExpandedRangeForAttributeAtOffset(t, n)), l = this.positionFromLocation({ index: i, offset: o }), d = this.positionFromLocation({ index: i, offset: a }); - return T([l, d]); + const { index: i, offset: n } = this.locationFromPosition(e), r = this.getTextAtIndex(i), [a, o] = Array.from(r.getExpandedRangeForAttributeAtOffset(t, n)), l = this.positionFromLocation({ index: i, offset: a }), c = this.positionFromLocation({ index: i, offset: o }); + return k([l, c]); } getBaseBlockAttributes() { let t = this.getBlockAtIndex(0).getAttributes(); @@ -2500,7 +2500,7 @@ class nt extends Ht { const i = this.getBlockAtIndex(e).getAttributes(), n = Math.min(t.length, i.length); t = (() => { const r = []; - for (let o = 0; o < n && i[o] === t[o]; o++) r.push(i[o]); + for (let a = 0; a < n && i[a] === t[a]; a++) r.push(i[a]); return r; })(); } @@ -2523,8 +2523,8 @@ class nt extends Ht { let e = 0; const i = this.blockList.toArray(); for (let n = 0; n < i.length; n++) { - const { text: r } = i[n], o = r.getRangeOfAttachment(t); - if (o) return T([e + o[0], e + o[1]]); + const { text: r } = i[n], a = r.getRangeOfAttachment(t); + if (a) return k([e + a[0], e + a[1]]); e += r.getLength(); } } @@ -2546,11 +2546,11 @@ class nt extends Ht { findRangesForTextAttribute(t) { let { withValue: e } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, i = 0, n = []; const r = []; - return this.getPieces().forEach((o) => { - const a = o.getLength(); + return this.getPieces().forEach((a) => { + const o = a.getLength(); (function(l) { return e ? l.getAttribute(t) === e : l.hasAttribute(t); - })(o) && (n[1] === i ? n[1] = i + a : r.push(n = [i, i + a])), i += a; + })(a) && (n[1] === i ? n[1] = i + o : r.push(n = [i, i + o])), i += o; }), r; } locationFromPosition(t) { @@ -2565,18 +2565,18 @@ class nt extends Ht { return this.blockList.findPositionAtIndexAndOffset(t.index, t.offset); } locationRangeFromPosition(t) { - return T(this.locationFromPosition(t)); + return k(this.locationFromPosition(t)); } locationRangeFromRange(t) { - if (!(t = T(t))) return; + if (!(t = k(t))) return; const [e, i] = Array.from(t), n = this.locationFromPosition(e), r = this.locationFromPosition(i); - return T([n, r]); + return k([n, r]); } rangeFromLocationRange(t) { let e; - t = T(t); + t = k(t); const i = this.positionFromLocation(t[0]); - return _t(t) || (e = this.positionFromLocation(t[1])), T([i, e]); + return vt(t) || (e = this.positionFromLocation(t[1])), k([i, e]); } isEqualTo(t) { return this.blockList.isEqualTo(t == null ? void 0 : t.blockList); @@ -2607,20 +2607,20 @@ class nt extends Ht { return JSON.stringify(this.blockList.toArray().map((t) => JSON.parse(t.text.toConsole()))); } } -const qs = function(s) { +const $s = function(s) { const t = {}, e = s.getLastAttribute(); return e && (t[e] = !0), t; -}, Ki = function(s) { +}, Gi = function(s) { let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; return { string: s = ye(s), attributes: t, type: "string" }; -}, Hs = (s, t) => { +}, Us = (s, t) => { try { return JSON.parse(s.getAttribute("data-trix-".concat(t))); } catch { return {}; } }; -class Re extends F { +class Re extends P { static parse(t, e) { const i = new this(t, e); return i.parse(), i; @@ -2634,8 +2634,8 @@ class Re extends F { } parse() { try { - this.createHiddenContainer(), mi.setHTML(this.containerElement, this.html, { purifyOptions: this.purifyOptions }); - const t = ri(this.containerElement, { usingFilter: el }); + this.createHiddenContainer(), gi.setHTML(this.containerElement, this.html, { purifyOptions: this.purifyOptions }); + const t = ai(this.containerElement, { usingFilter: ul }); for (; t.nextNode(); ) this.processNode(t.currentNode); return this.translateBlockElementMarginsToNewlines(); } finally { @@ -2643,7 +2643,7 @@ class Re extends F { } } createHiddenContainer() { - return this.referenceElement ? (this.containerElement = this.referenceElement.cloneNode(!1), this.containerElement.removeAttribute("id"), this.containerElement.setAttribute("data-trix-internal", ""), this.containerElement.style.display = "none", this.referenceElement.parentNode.insertBefore(this.containerElement, this.referenceElement.nextSibling)) : (this.containerElement = A({ tagName: "div", style: { display: "none" } }), document.body.appendChild(this.containerElement)); + return this.referenceElement ? (this.containerElement = this.referenceElement.cloneNode(!1), this.containerElement.removeAttribute("id"), this.containerElement.setAttribute("data-trix-internal", ""), this.containerElement.style.display = "none", this.referenceElement.parentNode.insertBefore(this.containerElement, this.referenceElement.nextSibling)) : (this.containerElement = x({ tagName: "div", style: { display: "none" } }), document.body.appendChild(this.containerElement)); } removeHiddenContainer() { return wt(this.containerElement); @@ -2695,12 +2695,12 @@ class Re extends F { processTextNode(t) { let e = t.data; var i; - return $s(t.parentNode) || (e = Fn(e), lo((i = t.previousSibling) === null || i === void 0 ? void 0 : i.textContent) && (e = il(e))), this.appendStringWithAttributes(e, this.getTextAttributes(t.parentNode)); + return Vs(t.parentNode) || (e = qn(e), va((i = t.previousSibling) === null || i === void 0 ? void 0 : i.textContent) && (e = ml(e))), this.appendStringWithAttributes(e, this.getTextAttributes(t.parentNode)); } processElement(t) { let e; if (Bt(t)) { - if (e = Hs(t, "attachment"), Object.keys(e).length) { + if (e = Us(t, "attachment"), Object.keys(e).length) { const i = this.getTextAttributes(t); this.appendAttachmentWithAttributes(e, i), t.innerHTML = ""; } @@ -2713,8 +2713,8 @@ class Re extends F { case "img": e = { url: t.getAttribute("src"), contentType: "image" }; const i = ((n) => { - const r = n.getAttribute("width"), o = n.getAttribute("height"), a = {}; - return r && (a.width = parseInt(r, 10)), o && (a.height = parseInt(o, 10)), a; + const r = n.getAttribute("width"), a = n.getAttribute("height"), o = {}; + return r && (o.width = parseInt(r, 10)), a && (o.height = parseInt(a, 10)), o; })(t); for (const n in i) { const r = i[n]; @@ -2722,10 +2722,10 @@ class Re extends F { } return this.appendAttachmentWithAttributes(e, this.getTextAttributes(t)), this.processedElements.push(t); case "tr": - if (this.needsTableSeparator(t)) return this.appendStringWithAttributes(ii.tableRowSeparator); + if (this.needsTableSeparator(t)) return this.appendStringWithAttributes(ni.tableRowSeparator); break; case "td": - if (this.needsTableSeparator(t)) return this.appendStringWithAttributes(ii.tableCellSeparator); + if (this.needsTableSeparator(t)) return this.appendStringWithAttributes(ni.tableCellSeparator); } } appendBlockForAttributesWithElement(t, e) { @@ -2740,7 +2740,7 @@ class Re extends F { return this.appendBlockForAttributesWithElement([], null); } appendStringWithAttributes(t, e) { - return this.appendPiece(Ki(t, e)); + return this.appendPiece(Gi(t, e)); } appendAttachmentWithAttributes(t, e) { return this.appendPiece(function(i) { @@ -2752,12 +2752,12 @@ class Re extends F { } appendStringToTextAtIndex(t, e) { const { text: i } = this.blocks[e], n = i[i.length - 1]; - if ((n == null ? void 0 : n.type) !== "string") return i.push(Ki(t)); + if ((n == null ? void 0 : n.type) !== "string") return i.push(Gi(t)); n.string += t; } prependStringToTextAtIndex(t, e) { const { text: i } = this.blocks[e], n = i[0]; - if ((n == null ? void 0 : n.type) !== "string") return i.unshift(Ki(t)); + if ((n == null ? void 0 : n.type) !== "string") return i.unshift(Gi(t)); n.string = t + n.string; } getTextAttributes(t) { @@ -2768,17 +2768,17 @@ class Re extends F { if (r.tagName && Ct(t, { matchingSelector: r.tagName, untilNode: this.containerElement })) i[n] = !0; else if (r.parser) { if (e = r.parser(t), e) { - let o = !1; - for (const a of this.findBlockElementAncestors(t)) if (r.parser(a) === e) { - o = !0; + let a = !1; + for (const o of this.findBlockElementAncestors(t)) if (r.parser(o) === e) { + a = !0; break; } - o || (i[n] = e); + a || (i[n] = e); } } else r.styleProperty && (e = t.style[r.styleProperty], e && (i[n] = e)); } if (Bt(t)) { - const n = Hs(t, "attributes"); + const n = Us(t, "attributes"); for (const r in n) e = n[r], i[r] = e; } return i; @@ -2813,15 +2813,15 @@ class Re extends F { if ((t == null ? void 0 : t.nodeType) === Node.ELEMENT_NODE && !Bt(t) && !Ct(t, { matchingSelector: "td", untilNode: this.containerElement })) return Ee().includes(J(t)) || window.getComputedStyle(t).display === "block"; } isInsignificantTextNode(t) { - if ((t == null ? void 0 : t.nodeType) !== Node.TEXT_NODE || !nl(t.data)) return; + if ((t == null ? void 0 : t.nodeType) !== Node.TEXT_NODE || !gl(t.data)) return; const { parentNode: e, previousSibling: i, nextSibling: n } = t; - return tl(e.previousSibling) && !this.isBlockElement(e.previousSibling) || $s(e) ? void 0 : !i || this.isBlockElement(i) || !n || this.isBlockElement(n); + return hl(e.previousSibling) && !this.isBlockElement(e.previousSibling) || Vs(e) ? void 0 : !i || this.isBlockElement(i) || !n || this.isBlockElement(n); } isExtraBR(t) { return J(t) === "br" && this.isBlockElement(t.parentNode) && t.parentNode.lastChild === t; } needsTableSeparator(t) { - if (ii.removeBlankTableCells) { + if (ni.removeBlankTableCells) { var e; const i = (e = t.previousSibling) === null || e === void 0 ? void 0 : e.textContent; return i && /\S/.test(i); @@ -2839,22 +2839,22 @@ class Re extends F { } getMarginOfBlockElementAtIndex(t) { const e = this.blockElements[t]; - if (e && e.textContent && !Ee().includes(J(e)) && !this.processedElements.includes(e)) return Us(e); + if (e && e.textContent && !Ee().includes(J(e)) && !this.processedElements.includes(e)) return js(e); } getMarginOfDefaultBlockElement() { - const t = A(Y.default.tagName); - return this.containerElement.appendChild(t), Us(t); + const t = x(Y.default.tagName); + return this.containerElement.appendChild(t), js(t); } } -const $s = function(s) { +const Vs = function(s) { const { whiteSpace: t } = window.getComputedStyle(s); return ["pre", "pre-wrap", "pre-line"].includes(t); -}, tl = (s) => s && !lo(s.textContent), Us = function(s) { +}, hl = (s) => s && !va(s.textContent), js = function(s) { const t = window.getComputedStyle(s); if (t.display === "block") return { top: parseInt(t.marginTop), bottom: parseInt(t.marginBottom) }; -}, el = function(s) { +}, ul = function(s) { return J(s) === "style" ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT; -}, il = (s) => s.replace(new RegExp("^".concat(Pn.source, "+")), ""), nl = (s) => new RegExp("^".concat(Pn.source, "*$")).test(s), lo = (s) => /\s$/.test(s), sl = ["contenteditable", "data-trix-id", "data-trix-store-key", "data-trix-mutable", "data-trix-placeholder", "tabindex"], Sn = "data-trix-serialized-attributes", rl = "[".concat(Sn, "]"), ol = new RegExp("", "g"), al = { "application/json": function(s) { +}, ml = (s) => s.replace(new RegExp("^".concat(Hn.source, "+")), ""), gl = (s) => new RegExp("^".concat(Hn.source, "*$")).test(s), va = (s) => /\s$/.test(s), pl = ["contenteditable", "data-trix-id", "data-trix-store-key", "data-trix-mutable", "data-trix-placeholder", "tabindex"], Cn = "data-trix-serialized-attributes", fl = "[".concat(Cn, "]"), bl = new RegExp("", "g"), _l = { "application/json": function(s) { let t; if (s instanceof nt) t = s; else { @@ -2864,31 +2864,31 @@ const $s = function(s) { return t.toSerializableDocument().toJSONString(); }, "text/html": function(s) { let t; - if (s instanceof nt) t = gi.render(s); + if (s instanceof nt) t = pi.render(s); else { if (!(s instanceof HTMLElement)) throw new Error("unserializable object"); t = s.cloneNode(!0); } return Array.from(t.querySelectorAll("[data-trix-serialize=false]")).forEach((e) => { wt(e); - }), sl.forEach((e) => { + }), pl.forEach((e) => { Array.from(t.querySelectorAll("[".concat(e, "]"))).forEach((i) => { i.removeAttribute(e); }); - }), Array.from(t.querySelectorAll(rl)).forEach((e) => { + }), Array.from(t.querySelectorAll(fl)).forEach((e) => { try { - const i = JSON.parse(e.getAttribute(Sn)); - e.removeAttribute(Sn); + const i = JSON.parse(e.getAttribute(Cn)); + e.removeAttribute(Cn); for (const n in i) { const r = i[n]; e.setAttribute(n, r); } } catch { } - }), t.innerHTML.replace(ol, ""); + }), t.innerHTML.replace(bl, ""); } }; -var ll = Object.freeze({ __proto__: null }); -class D extends F { +var vl = Object.freeze({ __proto__: null }); +class D extends P { constructor(t, e) { super(...arguments), this.attachmentManager = t, this.attachment = e, this.id = this.attachment.id, this.file = this.attachment.file; } @@ -2897,7 +2897,7 @@ class D extends F { } } D.proxyMethod("attachment.getAttribute"), D.proxyMethod("attachment.hasAttribute"), D.proxyMethod("attachment.setAttribute"), D.proxyMethod("attachment.getAttributes"), D.proxyMethod("attachment.setAttributes"), D.proxyMethod("attachment.isPending"), D.proxyMethod("attachment.isPreviewable"), D.proxyMethod("attachment.getURL"), D.proxyMethod("attachment.getPreviewURL"), D.proxyMethod("attachment.setPreviewURL"), D.proxyMethod("attachment.getHref"), D.proxyMethod("attachment.getFilename"), D.proxyMethod("attachment.getFilesize"), D.proxyMethod("attachment.getFormattedFilesize"), D.proxyMethod("attachment.getExtension"), D.proxyMethod("attachment.getContentType"), D.proxyMethod("attachment.getFile"), D.proxyMethod("attachment.setFile"), D.proxyMethod("attachment.releaseFile"), D.proxyMethod("attachment.getUploadProgress"), D.proxyMethod("attachment.setUploadProgress"); -class co extends F { +class ya extends P { constructor() { let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; super(...arguments), this.managedAttachments = {}, Array.from(t).forEach((e) => { @@ -2927,7 +2927,7 @@ class co extends F { return delete this.managedAttachments[t.id], e; } } -class ho { +class Aa { constructor(t) { this.composition = t, this.document = this.composition.document; const e = this.composition.getSelectedRange(); @@ -2952,7 +2952,7 @@ class ho { return this.block.hasAttributes() && !this.block.isListItem() && this.block.isEmpty(); } } -class St extends F { +class St extends P { constructor() { super(...arguments), this.document = new nt(), this.attachments = [], this.currentAttributes = {}, this.revision = 0; } @@ -2965,8 +2965,8 @@ class St extends F { } loadSnapshot(t) { var e, i, n, r; - let { document: o, selectedRange: a } = t; - return (e = this.delegate) === null || e === void 0 || (i = e.compositionWillLoadSnapshot) === null || i === void 0 || i.call(e), this.setDocument(o ?? new nt()), this.setSelection(a ?? [0, 0]), (n = this.delegate) === null || n === void 0 || (r = n.compositionDidLoadSnapshot) === null || r === void 0 ? void 0 : r.call(n); + let { document: a, selectedRange: o } = t; + return (e = this.delegate) === null || e === void 0 || (i = e.compositionWillLoadSnapshot) === null || i === void 0 || i.call(e), this.setDocument(a ?? new nt()), this.setSelection(o ?? [0, 0]), (n = this.delegate) === null || n === void 0 || (r = n.compositionDidLoadSnapshot) === null || r === void 0 ? void 0 : r.call(n); } insertText(t) { let { updatePosition: e } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : { updatePosition: !0 }; @@ -2988,7 +2988,7 @@ class St extends F { return this.setSelection(n), this.notifyDelegateOfInsertionAtRange([i, n]); } insertString(t, e) { - const i = this.getCurrentTextAttributes(), n = ct.textForStringWithAttributes(t, i); + const i = this.getCurrentTextAttributes(), n = dt.textForStringWithAttributes(t, i); return this.insertText(n, e); } insertBlockBreak() { @@ -2998,7 +2998,7 @@ class St extends F { return this.setSelection(i), this.notifyDelegateOfInsertionAtRange([e, i]); } insertLineBreak() { - const t = new ho(this); + const t = new Aa(this); if (t.shouldDecreaseListLevel()) return this.decreaseListLevel(), this.setSelection(t.startPosition); if (t.shouldPrependListItem()) { const e = new nt([t.block.copyWithoutText()]); @@ -3034,32 +3034,32 @@ class St extends F { return this.insertAttachments([t]); } insertAttachments(t) { - let e = new ct(); + let e = new dt(); return Array.from(t).forEach((i) => { var n; - const r = i.getType(), o = (n = Rn[r]) === null || n === void 0 ? void 0 : n.presentation, a = this.getCurrentTextAttributes(); - o && (a.presentation = o); - const l = ct.textForAttachmentWithAttributes(i, a); + const r = i.getType(), a = (n = On[r]) === null || n === void 0 ? void 0 : n.presentation, o = this.getCurrentTextAttributes(); + a && (o.presentation = a); + const l = dt.textForAttachmentWithAttributes(i, o); e = e.appendText(l); }), this.insertText(e); } shouldManageDeletingInDirection(t) { const e = this.getLocationRange(); - if (_t(e)) { + if (vt(e)) { if (t === "backward" && e[0].offset === 0 || this.shouldManageMovingCursorInDirection(t)) return !0; } else if (e[0].index !== e[1].index) return !0; return !1; } deleteInDirection(t) { let e, i, n, { length: r } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; - const o = this.getLocationRange(); - let a = this.getSelectedRange(); - const l = _t(a); - if (l ? i = t === "backward" && o[0].offset === 0 : n = o[0].index !== o[1].index, i && this.canDecreaseBlockAttributeLevel()) { - const d = this.getBlock(); - if (d.isListItem() ? this.decreaseListLevel() : this.decreaseBlockAttributeLevel(), this.setSelection(a[0]), d.isEmpty()) return !1; + const a = this.getLocationRange(); + let o = this.getSelectedRange(); + const l = vt(o); + if (l ? i = t === "backward" && a[0].offset === 0 : n = a[0].index !== a[1].index, i && this.canDecreaseBlockAttributeLevel()) { + const c = this.getBlock(); + if (c.isListItem() ? this.decreaseListLevel() : this.decreaseBlockAttributeLevel(), this.setSelection(o[0]), c.isEmpty()) return !1; } - return l && (a = this.getExpandedRangeInDirection(t, { length: r }), t === "backward" && (e = this.getAttachmentAtRange(a))), e ? (this.editAttachment(e), !1) : (this.setDocument(this.document.removeTextAtRange(a)), this.setSelection(a[0]), !i && !n && void 0); + return l && (o = this.getExpandedRangeInDirection(t, { length: r }), t === "backward" && (e = this.getAttachmentAtRange(o))), e ? (this.editAttachment(e), !1) : (this.setDocument(this.document.removeTextAtRange(o)), this.setSelection(o[0]), !i && !n && void 0); } moveTextFromRange(t) { const [e] = Array.from(this.getSelectedRange()); @@ -3109,10 +3109,10 @@ class St extends F { } setHTMLAtributeAtPosition(t, e, i) { var n; - const r = this.document.getBlockAtPosition(t), o = (n = N(r.getLastAttribute())) === null || n === void 0 ? void 0 : n.htmlAttributes; - if (r && o != null && o.includes(e)) { - const a = this.document.setHTMLAttributeAtPosition(t, e, i); - this.setDocument(a); + const r = this.document.getBlockAtPosition(t), a = (n = N(r.getLastAttribute())) === null || n === void 0 ? void 0 : n.htmlAttributes; + if (r && a != null && a.includes(e)) { + const o = this.document.setHTMLAttributeAtPosition(t, e, i); + this.setDocument(o); } } setTextAttribute(t, e) { @@ -3121,8 +3121,8 @@ class St extends F { const [n, r] = Array.from(i); if (n !== r) return this.setDocument(this.document.addAttributeAtRange(t, e, i)); if (t === "href") { - const o = ct.textForStringWithAttributes(e, { href: e }); - return this.insertText(o); + const a = dt.textForStringWithAttributes(e, { href: e }); + return this.insertText(a); } } setBlockAttribute(t, e) { @@ -3183,26 +3183,26 @@ class St extends F { let r = this.document.getBlockAtIndex(i + 1); for (; r && r.isListItem() && !(r.getAttributeLevel() <= n); ) i++, r = this.document.getBlockAtIndex(i + 1); t = this.document.positionFromLocation({ index: e, offset: 0 }); - const o = this.document.positionFromLocation({ index: i, offset: 0 }); - return this.setDocument(this.document.removeLastListAttributeAtRange([t, o])); + const a = this.document.positionFromLocation({ index: i, offset: 0 }); + return this.setDocument(this.document.removeLastListAttributeAtRange([t, a])); } updateCurrentAttributes() { const t = this.getSelectedRange({ ignoreLock: !0 }); if (t) { const e = this.document.getCommonAttributesAtRange(t); - if (Array.from(_n()).forEach((i) => { + if (Array.from(An()).forEach((i) => { e[i] || this.canSetCurrentAttribute(i) || (e[i] = !1); }), !ne(e, this.currentAttributes)) return this.currentAttributes = e, this.notifyDelegateOfCurrentAttributesChange(); } } getCurrentAttributes() { - return Fr.call({}, this.currentAttributes); + return Jr.call({}, this.currentAttributes); } getCurrentTextAttributes() { const t = {}; for (const e in this.currentAttributes) { const i = this.currentAttributes[e]; - i !== !1 && yn(e) && (t[e] = i); + i !== !1 && En(e) && (t[e] = i); } return t; } @@ -3233,7 +3233,7 @@ class St extends F { if (t) return this.document.positionFromLocation(t[0]); } getLocationRange(t) { - return this.targetLocationRange ? this.targetLocationRange : this.getSelectionManager().getLocationRange(t) || T({ index: 0, offset: 0 }); + return this.targetLocationRange ? this.targetLocationRange : this.getSelectionManager().getLocationRange(t) || k({ index: 0, offset: 0 }); } withTargetLocationRange(t, e) { let i; @@ -3255,7 +3255,7 @@ class St extends F { } getExpandedRangeInDirection(t) { let { length: e } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, [i, n] = Array.from(this.getSelectedRange()); - return t === "backward" ? e ? i -= e : i = this.translateUTF16PositionFromOffset(i, -1) : e ? n += e : n = this.translateUTF16PositionFromOffset(n, 1), T([i, n]); + return t === "backward" ? e ? i -= e : i = this.translateUTF16PositionFromOffset(i, -1) : e ? n += e : n = this.translateUTF16PositionFromOffset(n, 1), k([i, n]); } shouldManageMovingCursorInDirection(t) { if (this.editingAttachment) return !0; @@ -3315,25 +3315,25 @@ class St extends F { refreshAttachments() { const t = this.document.getAttachments(), { added: e, removed: i } = function() { let n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : []; - const o = [], a = [], l = /* @__PURE__ */ new Set(); + const a = [], o = [], l = /* @__PURE__ */ new Set(); n.forEach((h) => { l.add(h); }); - const d = /* @__PURE__ */ new Set(); + const c = /* @__PURE__ */ new Set(); return r.forEach((h) => { - d.add(h), l.has(h) || o.push(h); + c.add(h), l.has(h) || a.push(h); }), n.forEach((h) => { - d.has(h) || a.push(h); - }), { added: o, removed: a }; + c.has(h) || o.push(h); + }), { added: a, removed: o }; }(this.attachments, t); return this.attachments = t, Array.from(i).forEach((n) => { - var r, o; - n.delegate = null, (r = this.delegate) === null || r === void 0 || (o = r.compositionDidRemoveAttachment) === null || o === void 0 || o.call(r, n); + var r, a; + n.delegate = null, (r = this.delegate) === null || r === void 0 || (a = r.compositionDidRemoveAttachment) === null || a === void 0 || a.call(r, n); }), (() => { const n = []; return Array.from(e).forEach((r) => { - var o, a; - r.delegate = this, n.push((o = this.delegate) === null || o === void 0 || (a = o.compositionDidAddAttachment) === null || a === void 0 ? void 0 : a.call(o, r)); + var a, o; + r.delegate = this, n.push((a = this.delegate) === null || a === void 0 || (o = a.compositionDidAddAttachment) === null || o === void 0 ? void 0 : o.call(a, r)); }), n; })(); } @@ -3367,8 +3367,8 @@ class St extends F { ` ? n += 1 : e = e.removeTextAtRange(r), r = [n, n]) : t.nextCharacter === ` ` ? t.previousCharacter === ` ` ? r = [n - 1, n + 1] : (r = [n, n + 1], n += 1) : t.startLocation.offset - 1 != 0 && (n += 1); - const o = new nt([i.removeLastAttribute().copyWithoutText()]); - return this.setDocument(e.insertDocumentAtRange(o, r)), this.setSelection(n); + const a = new nt([i.removeLastAttribute().copyWithoutText()]); + return this.setDocument(e.insertDocumentAtRange(a, r)), this.setSelection(n); } getPreviousBlock() { const t = this.getLocationRange(); @@ -3400,14 +3400,14 @@ class St extends F { } } St.proxyMethod("getSelectionManager().getPointRange"), St.proxyMethod("getSelectionManager().setLocationRangeFromPointRange"), St.proxyMethod("getSelectionManager().createLocationRangeFromDOMRange"), St.proxyMethod("getSelectionManager().locationIsCursorTarget"), St.proxyMethod("getSelectionManager().selectionIsExpanded"), St.proxyMethod("delegate?.getSelectionManager"); -class Ln extends F { +class wn extends P { constructor(t) { super(...arguments), this.composition = t, this.undoEntries = [], this.redoEntries = []; } recordUndoEntry(t) { let { context: e, consolidatable: i } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; const n = this.undoEntries.slice(-1)[0]; - if (!i || !cl(n, t, e)) { + if (!i || !yl(n, t, e)) { const r = this.createEntry({ description: t, context: e }); this.undoEntries.push(r), this.redoEntries = []; } @@ -3437,8 +3437,8 @@ class Ln extends F { return { description: t == null ? void 0 : t.toString(), context: JSON.stringify(e), snapshot: this.composition.getSnapshot() }; } } -const cl = (s, t, e) => (s == null ? void 0 : s.description) === (t == null ? void 0 : t.toString()) && (s == null ? void 0 : s.context) === JSON.stringify(e), Gi = "attachmentGallery"; -class uo { +const yl = (s, t, e) => (s == null ? void 0 : s.description) === (t == null ? void 0 : t.toString()) && (s == null ? void 0 : s.context) === JSON.stringify(e), Ji = "attachmentGallery"; +class Ea { constructor(t) { this.document = t.document, this.selectedRange = t.selectedRange; } @@ -3449,18 +3449,18 @@ class uo { return { document: this.document, selectedRange: this.selectedRange }; } removeBlockAttribute() { - return this.findRangesOfBlocks().map((t) => this.document = this.document.removeAttributeAtRange(Gi, t)); + return this.findRangesOfBlocks().map((t) => this.document = this.document.removeAttributeAtRange(Ji, t)); } applyBlockAttribute() { let t = 0; this.findRangesOfPieces().forEach((e) => { e[1] - e[0] > 1 && (e[0] += t, e[1] += t, this.document.getCharacterAtPosition(e[1]) !== ` ` && (this.document = this.document.insertBlockBreakAtRange(e[1]), e[1] < this.selectedRange[1] && this.moveSelectedRangeForward(), e[1]++, t++), e[0] !== 0 && this.document.getCharacterAtPosition(e[0] - 1) !== ` -` && (this.document = this.document.insertBlockBreakAtRange(e[0]), e[0] < this.selectedRange[0] && this.moveSelectedRangeForward(), e[0]++, t++), this.document = this.document.applyBlockAttributeAtRange(Gi, !0, e)); +` && (this.document = this.document.insertBlockBreakAtRange(e[0]), e[0] < this.selectedRange[0] && this.moveSelectedRangeForward(), e[0]++, t++), this.document = this.document.applyBlockAttributeAtRange(Ji, !0, e)); }); } findRangesOfBlocks() { - return this.document.findRangesForBlockAttribute(Gi); + return this.document.findRangesForBlockAttribute(Ji); } findRangesOfPieces() { return this.document.findRangesForTextAttribute("presentation", { withValue: "gallery" }); @@ -3469,13 +3469,13 @@ class uo { this.selectedRange[0] += 1, this.selectedRange[1] += 1; } } -const mo = function(s) { - const t = new uo(s); +const xa = function(s) { + const t = new Ea(s); return t.perform(), t.getSnapshot(); -}, dl = [mo]; -class go { +}, Al = [xa]; +class Sa { constructor(t, e, i) { - this.insertFiles = this.insertFiles.bind(this), this.composition = t, this.selectionManager = e, this.element = i, this.undoManager = new Ln(this.composition), this.filters = dl.slice(0); + this.insertFiles = this.insertFiles.bind(this), this.composition = t, this.selectionManager = e, this.element = i, this.undoManager = new wn(this.composition), this.filters = Al.slice(0); } loadDocument(t) { return this.loadSnapshot({ document: t, selectedRange: [0, 0] }); @@ -3490,7 +3490,7 @@ class go { return e = nt.fromJSON(e), this.loadSnapshot({ document: e, selectedRange: i }); } loadSnapshot(t) { - return this.undoManager = new Ln(this.composition), this.composition.loadSnapshot(t); + return this.undoManager = new wn(this.composition), this.composition.loadSnapshot(t); } getDocument() { return this.composition.document; @@ -3598,32 +3598,32 @@ class go { if (this.canUndo()) return this.undoManager.undo(); } } -class po { +class La { constructor(t) { this.element = t; } findLocationFromContainerAndOffset(t, e) { let { strict: i } = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : { strict: !0 }, n = 0, r = !1; - const o = { index: 0, offset: 0 }, a = this.findAttachmentElementParentForNode(t); - a && (t = a.parentNode, e = Di(a)); - const l = ri(this.element, { usingFilter: fo }); + const a = { index: 0, offset: 0 }, o = this.findAttachmentElementParentForNode(t); + o && (t = o.parentNode, e = Oi(o)); + const l = ai(this.element, { usingFilter: Ca }); for (; l.nextNode(); ) { - const d = l.currentNode; - if (d === t && xe(t)) { - te(d) || (o.offset += e); + const c = l.currentNode; + if (c === t && xe(t)) { + te(c) || (a.offset += e); break; } - if (d.parentNode === t) { + if (c.parentNode === t) { if (n++ === e) break; - } else if (!Dt(t, d) && n > 0) break; - fs(d, { strict: i }) ? (r && o.index++, o.offset = 0, r = !0) : o.offset += Ji(d); + } else if (!Dt(t, c) && n > 0) break; + _s(c, { strict: i }) ? (r && a.index++, a.offset = 0, r = !0) : a.offset += Yi(c); } - return o; + return a; } findContainerAndOffsetFromLocation(t) { let e, i; if (t.index === 0 && t.offset === 0) { - for (e = this.element, i = 0; e.firstChild; ) if (e = e.firstChild, Oi(e)) { + for (e = this.element, i = 0; e.firstChild; ) if (e = e.firstChild, Mi(e)) { i = 1; break; } @@ -3631,10 +3631,10 @@ class po { } let [n, r] = this.findNodeAndOffsetFromLocation(t); if (n) { - if (xe(n)) Ji(n) === 0 ? (e = n.parentNode.parentNode, i = Di(n.parentNode), te(n, { name: "right" }) && i++) : (e = n, i = t.offset - r); + if (xe(n)) Yi(n) === 0 ? (e = n.parentNode.parentNode, i = Oi(n.parentNode), te(n, { name: "right" }) && i++) : (e = n, i = t.offset - r); else { - if (e = n.parentNode, !fs(n.previousSibling) && !Oi(e)) for (; n === e.lastChild && (n = e, e = e.parentNode, !Oi(e)); ) ; - i = Di(n), t.offset !== 0 && i++; + if (e = n.parentNode, !_s(n.previousSibling) && !Mi(e)) for (; n === e.lastChild && (n = e, e = e.parentNode, !Mi(e)); ) ; + i = Oi(n), t.offset !== 0 && i++; } return [e, i]; } @@ -3642,11 +3642,11 @@ class po { findNodeAndOffsetFromLocation(t) { let e, i, n = 0; for (const r of this.getSignificantNodesForIndex(t.index)) { - const o = Ji(r); - if (t.offset <= n + o) if (xe(r)) { + const a = Yi(r); + if (t.offset <= n + a) if (xe(r)) { if (e = r, i = n, t.offset === i && te(e)) break; } else e || (e = r, i = n); - if (n += o, n > t.offset) break; + if (n += a, n > t.offset) break; } return [e, i]; } @@ -3657,44 +3657,44 @@ class po { } } getSignificantNodesForIndex(t) { - const e = [], i = ri(this.element, { usingFilter: hl }); + const e = [], i = ai(this.element, { usingFilter: El }); let n = !1; for (; i.nextNode(); ) { - const o = i.currentNode; + const a = i.currentNode; var r; - if (Zt(o)) { + if (Zt(a)) { if (r != null ? r++ : r = 0, r === t) n = !0; else if (n) break; - } else n && e.push(o); + } else n && e.push(a); } return e; } } -const Ji = function(s) { +const Yi = function(s) { return s.nodeType === Node.TEXT_NODE ? te(s) ? 0 : s.textContent.length : J(s) === "br" || Bt(s) ? 1 : 0; -}, hl = function(s) { - return ul(s) === NodeFilter.FILTER_ACCEPT ? fo(s) : NodeFilter.FILTER_REJECT; -}, ul = function(s) { - return $r(s) ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT; -}, fo = function(s) { +}, El = function(s) { + return xl(s) === NodeFilter.FILTER_ACCEPT ? Ca(s) : NodeFilter.FILTER_REJECT; +}, xl = function(s) { + return Qr(s) ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT; +}, Ca = function(s) { return Bt(s.parentNode) ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT; }; -class bo { +class wa { createDOMRangeFromPoint(t) { let e, { x: i, y: n } = t; if (document.caretPositionFromPoint) { - const { offsetNode: r, offset: o } = document.caretPositionFromPoint(i, n); - return e = document.createRange(), e.setStart(r, o), e; + const { offsetNode: r, offset: a } = document.caretPositionFromPoint(i, n); + return e = document.createRange(), e.setStart(r, a), e; } if (document.caretRangeFromPoint) return document.caretRangeFromPoint(i, n); if (document.body.createTextRange) { const r = Se(); try { - const o = document.body.createTextRange(); - o.moveToPoint(i, n), o.select(); + const a = document.body.createTextRange(); + a.moveToPoint(i, n), a.select(); } catch { } - return e = Se(), Jr(r), e; + return e = Se(), aa(r), e; } } getClientRectsForDOMRange(t) { @@ -3702,9 +3702,9 @@ class bo { return [e[0], e[e.length - 1]]; } } -class Rt extends F { +class Rt extends P { constructor(t) { - super(...arguments), this.didMouseDown = this.didMouseDown.bind(this), this.selectionDidChange = this.selectionDidChange.bind(this), this.element = t, this.locationMapper = new po(this.element), this.pointMapper = new bo(), this.lockCount = 0, O("mousedown", { onElement: this.element, withCallback: this.didMouseDown }); + super(...arguments), this.didMouseDown = this.didMouseDown.bind(this), this.selectionDidChange = this.selectionDidChange.bind(this), this.element = t, this.locationMapper = new La(this.element), this.pointMapper = new wa(), this.lockCount = 0, O("mousedown", { onElement: this.element, withCallback: this.didMouseDown }); } getLocationRange() { let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; @@ -3712,12 +3712,12 @@ class Rt extends F { } setLocationRange(t) { if (this.lockedLocationRange) return; - t = T(t); + t = k(t); const e = this.createDOMRangeFromLocationRange(t); - e && (Jr(e), this.updateCurrentLocationRange(t)); + e && (aa(e), this.updateCurrentLocationRange(t)); } setLocationRangeFromPointRange(t) { - t = T(t); + t = k(t); const e = this.getLocationAtPoint(t[0]), i = this.getLocationAtPoint(t[1]); this.setLocationRange([e, i]); } @@ -3740,7 +3740,7 @@ class Rt extends F { } clearSelection() { var t; - return (t = Gr()) === null || t === void 0 ? void 0 : t.removeAllRanges(); + return (t = ra()) === null || t === void 0 ? void 0 : t.removeAllRanges(); } selectionIsCollapsed() { var t; @@ -3754,7 +3754,7 @@ class Rt extends F { const i = this.findLocationFromContainerAndOffset(t.startContainer, t.startOffset, e); if (!i) return; const n = t.collapsed ? void 0 : this.findLocationFromContainerAndOffset(t.endContainer, t.endOffset, e); - return T([i, n]); + return k([i, n]); } didMouseDown() { return this.pauseTemporarily(); @@ -3770,14 +3770,14 @@ class Rt extends F { t = ["mousemove", "keydown"].map((n) => O(n, { onElement: document, withCallback: e })); } selectionDidChange() { - if (!this.paused && !On(this.element)) return this.updateCurrentLocationRange(); + if (!this.paused && !Bn(this.element)) return this.updateCurrentLocationRange(); } updateCurrentLocationRange(t) { var e, i; if ((t ?? (t = this.createLocationRangeFromDOMRange(Se()))) && !oi(t, this.currentLocationRange)) return this.currentLocationRange = t, (e = this.delegate) === null || e === void 0 || (i = e.locationRangeDidChange) === null || i === void 0 ? void 0 : i.call(e, this.currentLocationRange.slice(0)); } createDOMRangeFromLocationRange(t) { - const e = this.findContainerAndOffsetFromLocation(t[0]), i = _t(t) ? e : this.findContainerAndOffsetFromLocation(t[1]) || e; + const e = this.findContainerAndOffsetFromLocation(t[0]), i = vt(t) ? e : this.findContainerAndOffsetFromLocation(t[1]) || e; if (e != null && i != null) { const n = document.createRange(); return n.setStart(...Array.from(e || [])), n.setEnd(...Array.from(i || [])), n; @@ -3793,35 +3793,35 @@ class Rt extends F { } } Rt.proxyMethod("locationMapper.findLocationFromContainerAndOffset"), Rt.proxyMethod("locationMapper.findContainerAndOffsetFromLocation"), Rt.proxyMethod("locationMapper.findNodeAndOffsetFromLocation"), Rt.proxyMethod("pointMapper.createDOMRangeFromPoint"), Rt.proxyMethod("pointMapper.getClientRectsForDOMRange"); -var vo = Object.freeze({ __proto__: null, Attachment: se, AttachmentManager: co, AttachmentPiece: ie, Block: ut, Composition: St, Document: nt, Editor: go, HTMLParser: Re, HTMLSanitizer: mi, LineBreakInsertion: ho, LocationMapper: po, ManagedAttachment: D, Piece: Ut, PointMapper: bo, SelectionManager: Rt, SplittableList: li, StringPiece: $n, Text: ct, UndoManager: Ln }), ml = Object.freeze({ __proto__: null, ObjectView: $t, AttachmentView: Hn, BlockView: no, DocumentView: gi, PieceView: eo, PreviewableAttachmentView: to, TextView: io }); -const { lang: Yi, css: It, keyNames: gl } = Me, Xi = function(s) { +var Ta = Object.freeze({ __proto__: null, Attachment: se, AttachmentManager: ya, AttachmentPiece: ie, Block: ut, Composition: St, Document: nt, Editor: Sa, HTMLParser: Re, HTMLSanitizer: gi, LineBreakInsertion: Aa, LocationMapper: La, ManagedAttachment: D, Piece: Ut, PointMapper: wa, SelectionManager: Rt, SplittableList: di, StringPiece: Vn, Text: dt, UndoManager: wn }), Sl = Object.freeze({ __proto__: null, ObjectView: $t, AttachmentView: Un, BlockView: ga, DocumentView: pi, PieceView: ua, PreviewableAttachmentView: ha, TextView: ma }); +const { lang: Xi, css: It, keyNames: Ll } = Me, Qi = function(s) { return function() { const t = s.apply(this, arguments); t.do(), this.undos || (this.undos = []), this.undos.push(t.undo); }; }; -class _o extends F { +class ka extends P { constructor(t, e, i) { let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; - super(...arguments), W(this, "makeElementMutable", Xi(() => ({ do: () => { + super(...arguments), K(this, "makeElementMutable", Qi(() => ({ do: () => { this.element.dataset.trixMutable = !0; - }, undo: () => delete this.element.dataset.trixMutable }))), W(this, "addToolbar", Xi(() => { - const r = A({ tagName: "div", className: It.attachmentToolbar, data: { trixMutable: !0 }, childNodes: A({ tagName: "div", className: "trix-button-row", childNodes: A({ tagName: "span", className: "trix-button-group trix-button-group--actions", childNodes: A({ tagName: "button", className: "trix-button trix-button--remove", textContent: Yi.remove, attributes: { title: Yi.remove }, data: { trixAction: "remove" } }) }) }) }); - return this.attachment.isPreviewable() && r.appendChild(A({ tagName: "div", className: It.attachmentMetadataContainer, childNodes: A({ tagName: "span", className: It.attachmentMetadata, childNodes: [A({ tagName: "span", className: It.attachmentName, textContent: this.attachment.getFilename(), attributes: { title: this.attachment.getFilename() } }), A({ tagName: "span", className: It.attachmentSize, textContent: this.attachment.getFormattedFilesize() })] }) })), O("click", { onElement: r, withCallback: this.didClickToolbar }), O("click", { onElement: r, matchingSelector: "[data-trix-action]", withCallback: this.didClickActionButton }), Ae("trix-attachment-before-toolbar", { onElement: this.element, attributes: { toolbar: r, attachment: this.attachment } }), { do: () => this.element.appendChild(r), undo: () => wt(r) }; - })), W(this, "installCaptionEditor", Xi(() => { - const r = A({ tagName: "textarea", className: It.attachmentCaptionEditor, attributes: { placeholder: Yi.captionPlaceholder }, data: { trixMutable: !0 } }); + }, undo: () => delete this.element.dataset.trixMutable }))), K(this, "addToolbar", Qi(() => { + const r = x({ tagName: "div", className: It.attachmentToolbar, data: { trixMutable: !0 }, childNodes: x({ tagName: "div", className: "trix-button-row", childNodes: x({ tagName: "span", className: "trix-button-group trix-button-group--actions", childNodes: x({ tagName: "button", className: "trix-button trix-button--remove", textContent: Xi.remove, attributes: { title: Xi.remove }, data: { trixAction: "remove" } }) }) }) }); + return this.attachment.isPreviewable() && r.appendChild(x({ tagName: "div", className: It.attachmentMetadataContainer, childNodes: x({ tagName: "span", className: It.attachmentMetadata, childNodes: [x({ tagName: "span", className: It.attachmentName, textContent: this.attachment.getFilename(), attributes: { title: this.attachment.getFilename() } }), x({ tagName: "span", className: It.attachmentSize, textContent: this.attachment.getFormattedFilesize() })] }) })), O("click", { onElement: r, withCallback: this.didClickToolbar }), O("click", { onElement: r, matchingSelector: "[data-trix-action]", withCallback: this.didClickActionButton }), Ae("trix-attachment-before-toolbar", { onElement: this.element, attributes: { toolbar: r, attachment: this.attachment } }), { do: () => this.element.appendChild(r), undo: () => wt(r) }; + })), K(this, "installCaptionEditor", Qi(() => { + const r = x({ tagName: "textarea", className: It.attachmentCaptionEditor, attributes: { placeholder: Xi.captionPlaceholder }, data: { trixMutable: !0 } }); r.value = this.attachmentPiece.getCaption(); - const o = r.cloneNode(); - o.classList.add("trix-autoresize-clone"), o.tabIndex = -1; - const a = function() { - o.value = r.value, r.style.height = o.scrollHeight + "px"; + const a = r.cloneNode(); + a.classList.add("trix-autoresize-clone"), a.tabIndex = -1; + const o = function() { + a.value = r.value, r.style.height = a.scrollHeight + "px"; }; - O("input", { onElement: r, withCallback: a }), O("input", { onElement: r, withCallback: this.didInputCaption }), O("keydown", { onElement: r, withCallback: this.didKeyDownCaption }), O("change", { onElement: r, withCallback: this.didChangeCaption }), O("blur", { onElement: r, withCallback: this.didBlurCaption }); - const l = this.element.querySelector("figcaption"), d = l.cloneNode(); + O("input", { onElement: r, withCallback: o }), O("input", { onElement: r, withCallback: this.didInputCaption }), O("keydown", { onElement: r, withCallback: this.didKeyDownCaption }), O("change", { onElement: r, withCallback: this.didChangeCaption }), O("blur", { onElement: r, withCallback: this.didBlurCaption }); + const l = this.element.querySelector("figcaption"), c = l.cloneNode(); return { do: () => { - if (l.style.display = "none", d.appendChild(r), d.appendChild(o), d.classList.add("".concat(It.attachmentCaption, "--editing")), l.parentElement.insertBefore(d, l), a(), this.options.editCaption) return Nn(() => r.focus()); + if (l.style.display = "none", c.appendChild(r), c.appendChild(a), c.classList.add("".concat(It.attachmentCaption, "--editing")), l.parentElement.insertBefore(c, l), o(), this.options.editCaption) return Fn(() => r.focus()); }, undo() { - wt(d), l.style.display = null; + wt(c), l.style.display = null; } }; })), this.didClickToolbar = this.didClickToolbar.bind(this), this.didClickActionButton = this.didClickActionButton.bind(this), this.didKeyDownCaption = this.didKeyDownCaption.bind(this), this.didInputCaption = this.didInputCaption.bind(this), this.didChangeCaption = this.didChangeCaption.bind(this), this.didBlurCaption = this.didBlurCaption.bind(this), this.attachmentPiece = t, this.element = e, this.container = i, this.options = n, this.attachment = this.attachmentPiece.attachment, J(this.element) === "a" && (this.element = this.element.firstChild), this.install(); } @@ -3850,7 +3850,7 @@ class _o extends F { } didKeyDownCaption(t) { var e, i; - if (gl[t.keyCode] === "return") return t.preventDefault(), this.savePendingCaption(), (e = this.delegate) === null || e === void 0 || (i = e.attachmentEditorDidRequestDeselectingAttachment) === null || i === void 0 ? void 0 : i.call(e, this.attachment); + if (Ll[t.keyCode] === "return") return t.preventDefault(), this.savePendingCaption(), (e = this.delegate) === null || e === void 0 || (i = e.attachmentEditorDidRequestDeselectingAttachment) === null || i === void 0 ? void 0 : i.call(e, this.attachment); } didInputCaption(t) { this.pendingCaption = t.target.value.replace(/\s/g, " ").trim(); @@ -3862,9 +3862,9 @@ class _o extends F { return this.savePendingCaption(); } } -class yo extends F { +class Ia extends P { constructor(t, e) { - super(...arguments), this.didFocus = this.didFocus.bind(this), this.didBlur = this.didBlur.bind(this), this.didClickAttachment = this.didClickAttachment.bind(this), this.element = t, this.composition = e, this.documentView = new gi(this.composition.document, { element: this.element }), O("focus", { onElement: this.element, withCallback: this.didFocus }), O("blur", { onElement: this.element, withCallback: this.didBlur }), O("click", { onElement: this.element, matchingSelector: "a[contenteditable=false]", preventDefault: !0 }), O("mousedown", { onElement: this.element, matchingSelector: Mt, withCallback: this.didClickAttachment }), O("click", { onElement: this.element, matchingSelector: "a".concat(Mt), preventDefault: !0 }); + super(...arguments), this.didFocus = this.didFocus.bind(this), this.didBlur = this.didBlur.bind(this), this.didClickAttachment = this.didClickAttachment.bind(this), this.element = t, this.composition = e, this.documentView = new pi(this.composition.document, { element: this.element }), O("focus", { onElement: this.element, withCallback: this.didFocus }), O("blur", { onElement: this.element, withCallback: this.didBlur }), O("click", { onElement: this.element, matchingSelector: "a[contenteditable=false]", preventDefault: !0 }), O("mousedown", { onElement: this.element, matchingSelector: Mt, withCallback: this.didClickAttachment }), O("click", { onElement: this.element, matchingSelector: "a".concat(Mt), preventDefault: !0 }); } didFocus(t) { var e; @@ -3875,22 +3875,22 @@ class yo extends F { return ((e = this.blurPromise) === null || e === void 0 ? void 0 : e.then(i)) || i(); } didBlur(t) { - this.blurPromise = new Promise((e) => Nn(() => { + this.blurPromise = new Promise((e) => Fn(() => { var i, n; - return On(this.element) || (this.focused = null, (i = this.delegate) === null || i === void 0 || (n = i.compositionControllerDidBlur) === null || n === void 0 || n.call(i)), this.blurPromise = null, e(); + return Bn(this.element) || (this.focused = null, (i = this.delegate) === null || i === void 0 || (n = i.compositionControllerDidBlur) === null || n === void 0 || n.call(i)), this.blurPromise = null, e(); })); } didClickAttachment(t, e) { var i, n; - const r = this.findAttachmentForElement(e), o = !!Ct(t.target, { matchingSelector: "figcaption" }); - return (i = this.delegate) === null || i === void 0 || (n = i.compositionControllerDidSelectAttachment) === null || n === void 0 ? void 0 : n.call(i, r, { editCaption: o }); + const r = this.findAttachmentForElement(e), a = !!Ct(t.target, { matchingSelector: "figcaption" }); + return (i = this.delegate) === null || i === void 0 || (n = i.compositionControllerDidSelectAttachment) === null || n === void 0 ? void 0 : n.call(i, r, { editCaption: a }); } getSerializableElement() { return this.isEditingAttachment() ? this.documentView.shadowElement : this.element; } render() { - var t, e, i, n, r, o; - return this.revision !== this.composition.revision && (this.documentView.setDocument(this.composition.document), this.documentView.render(), this.revision = this.composition.revision), this.canSyncDocumentView() && !this.documentView.isSynced() && ((i = this.delegate) === null || i === void 0 || (n = i.compositionControllerWillSyncDocumentView) === null || n === void 0 || n.call(i), this.documentView.sync(), (r = this.delegate) === null || r === void 0 || (o = r.compositionControllerDidSyncDocumentView) === null || o === void 0 || o.call(r)), (t = this.delegate) === null || t === void 0 || (e = t.compositionControllerDidRender) === null || e === void 0 ? void 0 : e.call(t); + var t, e, i, n, r, a; + return this.revision !== this.composition.revision && (this.documentView.setDocument(this.composition.document), this.documentView.render(), this.revision = this.composition.revision), this.canSyncDocumentView() && !this.documentView.isSynced() && ((i = this.delegate) === null || i === void 0 || (n = i.compositionControllerWillSyncDocumentView) === null || n === void 0 || n.call(i), this.documentView.sync(), (r = this.delegate) === null || r === void 0 || (a = r.compositionControllerDidSyncDocumentView) === null || a === void 0 || a.call(r)), (t = this.delegate) === null || t === void 0 || (e = t.compositionControllerDidRender) === null || e === void 0 ? void 0 : e.call(t); } rerenderViewForObject(t) { return this.invalidateViewForObject(t), this.render(); @@ -3920,7 +3920,7 @@ class yo extends F { if (!n) return; this.uninstallAttachmentEditor(); const r = this.composition.document.getAttachmentPieceForAttachment(t); - this.attachmentEditor = new _o(r, n, this.element, e), this.attachmentEditor.delegate = this; + this.attachmentEditor = new ka(r, n, this.element, e), this.attachmentEditor.delegate = this; } uninstallAttachmentEditor() { var t; @@ -3952,15 +3952,15 @@ class yo extends F { return this.composition.document.getAttachmentById(parseInt(t.dataset.trixId, 10)); } } -class Ao extends F { +class Ra extends P { } -const Eo = "data-trix-mutable", pl = "[".concat(Eo, "]"), fl = { attributes: !0, childList: !0, characterData: !0, characterDataOldValue: !0, subtree: !0 }; -class xo extends F { +const Da = "data-trix-mutable", Cl = "[".concat(Da, "]"), wl = { attributes: !0, childList: !0, characterData: !0, characterDataOldValue: !0, subtree: !0 }; +class Oa extends P { constructor(t) { super(t), this.didMutate = this.didMutate.bind(this), this.element = t, this.observer = new window.MutationObserver(this.didMutate), this.start(); } start() { - return this.reset(), this.observer.observe(this.element, fl); + return this.reset(), this.observer.observe(this.element, wl); } stop() { return this.observer.disconnect(); @@ -3981,16 +3981,16 @@ class xo extends F { return !1; } nodeIsSignificant(t) { - return t !== this.element && !this.nodeIsMutable(t) && !$r(t); + return t !== this.element && !this.nodeIsMutable(t) && !Qr(t); } nodeIsMutable(t) { - return Ct(t, { matchingSelector: pl }); + return Ct(t, { matchingSelector: Cl }); } nodesModifiedByMutation(t) { const e = []; switch (t.type) { case "attributes": - t.attributeName !== Eo && e.push(t.target); + t.attributeName !== Da && e.push(t.target); break; case "characterData": e.push(t.target.parentNode), e.push(t.target); @@ -4005,13 +4005,13 @@ class xo extends F { } getTextMutationSummary() { const { additions: t, deletions: e } = this.getTextChangesFromCharacterData(), i = this.getTextChangesFromChildList(); - Array.from(i.additions).forEach((a) => { - Array.from(t).includes(a) || t.push(a); + Array.from(i.additions).forEach((o) => { + Array.from(t).includes(o) || t.push(o); }), e.push(...Array.from(i.deletions || [])); const n = {}, r = t.join(""); r && (n.textAdded = r); - const o = e.join(""); - return o && (n.textDeleted = o), n; + const a = e.join(""); + return a && (n.textDeleted = a), n; } getMutationsByType(t) { return Array.from(this.mutations).filter((e) => e.type === t); @@ -4019,27 +4019,27 @@ class xo extends F { getTextChangesFromChildList() { let t, e; const i = [], n = []; - Array.from(this.getMutationsByType("childList")).forEach((a) => { - i.push(...Array.from(a.addedNodes || [])), n.push(...Array.from(a.removedNodes || [])); + Array.from(this.getMutationsByType("childList")).forEach((o) => { + i.push(...Array.from(o.addedNodes || [])), n.push(...Array.from(o.removedNodes || [])); }), i.length === 0 && n.length === 1 && Zt(n[0]) ? (t = [], e = [` -`]) : (t = Cn(i), e = Cn(n)); - const r = t.filter((a, l) => a !== e[l]).map(ye), o = e.filter((a, l) => a !== t[l]).map(ye); - return { additions: r, deletions: o }; +`]) : (t = Tn(i), e = Tn(n)); + const r = t.filter((o, l) => o !== e[l]).map(ye), a = e.filter((o, l) => o !== t[l]).map(ye); + return { additions: r, deletions: a }; } getTextChangesFromCharacterData() { let t, e; const i = this.getMutationsByType("characterData"); if (i.length) { - const n = i[0], r = i[i.length - 1], o = function(a, l) { - let d, h; - return a = ke.box(a), (l = ke.box(l)).length < a.length ? [h, d] = Es(a, l) : [d, h] = Es(l, a), { added: d, removed: h }; + const n = i[0], r = i[i.length - 1], a = function(o, l) { + let c, h; + return o = ke.box(o), (l = ke.box(l)).length < o.length ? [h, c] = Ss(o, l) : [c, h] = Ss(l, o), { added: c, removed: h }; }(ye(n.oldValue), ye(r.target.data)); - t = o.added, e = o.removed; + t = a.added, e = a.removed; } return { additions: t ? [t] : [], deletions: e ? [e] : [] }; } } -const Cn = function() { +const Tn = function() { let s = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; const t = []; for (const e of Array.from(s)) switch (e.nodeType) { @@ -4048,11 +4048,11 @@ const Cn = function() { break; case Node.ELEMENT_NODE: J(e) === "br" ? t.push(` -`) : t.push(...Array.from(Cn(e.childNodes) || [])); +`) : t.push(...Array.from(Tn(e.childNodes) || [])); } return t; }; -class So extends ai { +class Ma extends li { constructor(t) { super(...arguments), this.file = t; } @@ -4068,7 +4068,7 @@ class So extends ai { }, e.readAsArrayBuffer(this.file); } } -class bl { +class Tl { constructor(t) { this.element = t; } @@ -4076,7 +4076,7 @@ class bl { return !!Oe.samsungAndroid && (this.previousEvent = this.event, this.event = t, this.checkSamsungKeyboardBuggyModeStart(), this.checkSamsungKeyboardBuggyModeEnd(), this.buggyMode); } checkSamsungKeyboardBuggyModeStart() { - this.insertingLongTextAfterUnidentifiedChar() && vl(this.element.innerText, this.event.data) && (this.buggyMode = !0, this.event.preventDefault()); + this.insertingLongTextAfterUnidentifiedChar() && kl(this.element.innerText, this.event.data) && (this.buggyMode = !0, this.event.preventDefault()); } checkSamsungKeyboardBuggyModeEnd() { this.buggyMode && this.event.inputType !== "insertText" && (this.buggyMode = !1); @@ -4093,10 +4093,10 @@ class bl { return ((t = this.previousEvent) === null || t === void 0 ? void 0 : t.type) === "keydown" && ((e = this.previousEvent) === null || e === void 0 ? void 0 : e.key) === "Unidentified"; } } -const vl = (s, t) => js(s) === js(t), _l = new RegExp("(".concat("", "|").concat(ui, "|").concat(Lt, "|\\s)+"), "g"), js = (s) => s.replace(_l, " ").trim(); -class pi extends F { +const kl = (s, t) => Ws(s) === Ws(t), Il = new RegExp("(".concat("", "|").concat(mi, "|").concat(Lt, "|\\s)+"), "g"), Ws = (s) => s.replace(Il, " ").trim(); +class fi extends P { constructor(t) { - super(...arguments), this.element = t, this.mutationObserver = new xo(this.element), this.mutationObserver.delegate = this, this.flakyKeyboardDetector = new bl(this.element); + super(...arguments), this.element = t, this.mutationObserver = new Oa(this.element), this.mutationObserver.delegate = this, this.flakyKeyboardDetector = new Tl(this.element); for (const e in this.constructor.events) O(e, { onElement: this.element, withCallback: this.handlerFor(e) }); } elementDidMutate(t) { @@ -4116,7 +4116,7 @@ class pi extends F { return (t = this.delegate) === null || t === void 0 || (e = t.inputControllerDidRequestReparse) === null || e === void 0 || e.call(t), this.requestRender(); } attachFiles(t) { - const e = Array.from(t).map((i) => new So(i)); + const e = Array.from(t).map((i) => new Ma(i)); return Promise.all(e).then((i) => { this.handleInput(function() { var n, r; @@ -4127,7 +4127,7 @@ class pi extends F { handlerFor(t) { return (e) => { e.defaultPrevented || this.handleInput(() => { - if (!On(this.element)) { + if (!Bn(this.element)) { if (this.flakyKeyboardDetector.shouldIgnore(e)) return; this.eventName = t, this.constructor.events[t].call(this, e); } @@ -4148,11 +4148,11 @@ class pi extends F { return i.href = t, i.textContent = e || t, i.outerHTML; } } -var Qi; -W(pi, "events", {}); -const { browser: yl, keyNames: Lo } = Me; -let Al = 0; -class bt extends pi { +var Zi; +K(fi, "events", {}); +const { browser: Rl, keyNames: Ba } = Me; +let Dl = 0; +class bt extends fi { constructor() { super(...arguments), this.resetInputSummary(); } @@ -4169,7 +4169,7 @@ class bt extends pi { this.inputSummary = {}; } reset() { - return this.resetInputSummary(), qt.reset(); + return this.resetInputSummary(), Ht.reset(); } elementDidMutate(t) { var e, i; @@ -4180,16 +4180,16 @@ class bt extends pi { mutationIsExpected(t) { let { textAdded: e, textDeleted: i } = t; if (this.inputSummary.preferDocument) return !0; - const n = e != null ? e === this.inputSummary.textAdded : !this.inputSummary.textAdded, r = i != null ? this.inputSummary.didDelete : !this.inputSummary.didDelete, o = [` + const n = e != null ? e === this.inputSummary.textAdded : !this.inputSummary.textAdded, r = i != null ? this.inputSummary.didDelete : !this.inputSummary.didDelete, a = [` `, ` -`].includes(e) && !n, a = i === ` +`].includes(e) && !n, o = i === ` ` && !r; - if (o && !a || a && !o) { - const d = this.getSelectedRange(); - if (d) { + if (a && !o || o && !a) { + const c = this.getSelectedRange(); + if (c) { var l; - const h = o ? e.replace(/\n$/, "").length || -1 : (e == null ? void 0 : e.length) || 1; - if ((l = this.responder) !== null && l !== void 0 && l.positionIsBlockBreak(d[1] + h)) return !0; + const h = a ? e.replace(/\n$/, "").length || -1 : (e == null ? void 0 : e.length) || 1; + if ((l = this.responder) !== null && l !== void 0 && l.positionIsBlockBreak(c[1] + h)) return !0; } } return n && r; @@ -4214,10 +4214,10 @@ class bt extends pi { var e; if (!function(n) { if (n == null || !n.setData) return !1; - for (const r in _s) { - const o = _s[r]; + for (const r in As) { + const a = As[r]; try { - if (n.setData(r, o), !n.getData(r) === o) return !1; + if (n.setData(r, a), !n.getData(r) === a) return !1; } catch { return !1; } @@ -4225,7 +4225,7 @@ class bt extends pi { return !0; }(t)) return; const i = (e = this.responder) === null || e === void 0 ? void 0 : e.getSelectedDocument().toSerializableDocument(); - return t.setData("application/x-trix-document", JSON.stringify(i)), t.setData("text/html", gi.render(i).innerHTML), t.setData("text/plain", i.toString().replace(/\n$/, "")), !0; + return t.setData("application/x-trix-document", JSON.stringify(i)), t.setData("text/html", pi.render(i).innerHTML), t.setData("text/plain", i.toString().replace(/\n$/, "")), !0; } canAcceptDataTransfer(t) { const e = {}; @@ -4234,37 +4234,37 @@ class bt extends pi { }), e.Files || e["application/x-trix-document"] || e["text/html"] || e["text/plain"]; } getPastedHTMLUsingHiddenElement(t) { - const e = this.getSelectedRange(), i = { position: "absolute", left: "".concat(window.pageXOffset, "px"), top: "".concat(window.pageYOffset, "px"), opacity: 0 }, n = A({ style: i, tagName: "div", editable: !0 }); + const e = this.getSelectedRange(), i = { position: "absolute", left: "".concat(window.pageXOffset, "px"), top: "".concat(window.pageYOffset, "px"), opacity: 0 }, n = x({ style: i, tagName: "div", editable: !0 }); return document.body.appendChild(n), n.focus(), requestAnimationFrame(() => { const r = n.innerHTML; return wt(n), this.setSelectedRange(e), t(r); }); } } -W(bt, "events", { keydown(s) { +K(bt, "events", { keydown(s) { this.isComposing() || this.resetInputSummary(), this.inputSummary.didInput = !0; - const t = Lo[s.keyCode]; + const t = Ba[s.keyCode]; if (t) { var e; let n = this.keys; ["ctrl", "alt", "shift", "meta"].forEach((r) => { - var o; - s["".concat(r, "Key")] && (r === "ctrl" && (r = "control"), n = (o = n) === null || o === void 0 ? void 0 : o[r]); - }), ((e = n) === null || e === void 0 ? void 0 : e[t]) != null && (this.setInputSummary({ keyName: t }), qt.reset(), n[t].call(this, s)); + var a; + s["".concat(r, "Key")] && (r === "ctrl" && (r = "control"), n = (a = n) === null || a === void 0 ? void 0 : a[r]); + }), ((e = n) === null || e === void 0 ? void 0 : e[t]) != null && (this.setInputSummary({ keyName: t }), Ht.reset(), n[t].call(this, s)); } - if (zr(s)) { + if (ia(s)) { const n = String.fromCharCode(s.keyCode).toLowerCase(); if (n) { var i; - const r = ["alt", "shift"].map((o) => { - if (s["".concat(o, "Key")]) return o; - }).filter((o) => o); + const r = ["alt", "shift"].map((a) => { + if (s["".concat(a, "Key")]) return a; + }).filter((a) => a); r.push(n), (i = this.delegate) !== null && i !== void 0 && i.inputControllerDidReceiveKeyboardCommand(r) && s.preventDefault(); } } }, keypress(s) { if (this.inputSummary.eventName != null || s.metaKey || s.ctrlKey && !s.altKey) return; - const t = Sl(s); + const t = Bl(s); var e, i; return t ? ((e = this.delegate) === null || e === void 0 || e.inputControllerWillPerformTyping(), (i = this.responder) === null || i === void 0 || i.insertString(t), this.setInputSummary({ textAdded: t, didDelete: this.selectionIsExpanded() })) : void 0; }, textInput(s) { @@ -4295,12 +4295,12 @@ W(bt, "events", { keydown(s) { const i = (t = s.dataTransfer) === null || t === void 0 ? void 0 : t.files, n = s.dataTransfer.getData("application/x-trix-document"), r = { x: s.clientX, y: s.clientY }; if ((e = this.responder) === null || e === void 0 || e.setLocationRangeFromPointRange(r), i != null && i.length) this.attachFiles(i); else if (this.draggedRange) { - var o, a; - (o = this.delegate) === null || o === void 0 || o.inputControllerWillMoveText(), (a = this.responder) === null || a === void 0 || a.moveTextFromRange(this.draggedRange), this.draggedRange = null, this.requestRender(); + var a, o; + (a = this.delegate) === null || a === void 0 || a.inputControllerWillMoveText(), (o = this.responder) === null || o === void 0 || o.moveTextFromRange(this.draggedRange), this.draggedRange = null, this.requestRender(); } else if (n) { var l; - const d = nt.fromJSONString(n); - (l = this.responder) === null || l === void 0 || l.insertDocument(d), this.requestRender(); + const c = nt.fromJSONString(n); + (l = this.responder) === null || l === void 0 || l.insertDocument(c), this.requestRender(); } this.draggedRange = null, this.draggingPoint = null; }, cut(s) { @@ -4311,28 +4311,28 @@ W(bt, "events", { keydown(s) { (t = this.responder) !== null && t !== void 0 && t.selectionIsExpanded() && this.serializeSelectionToDataTransfer(s.clipboardData) && s.preventDefault(); }, paste(s) { const t = s.clipboardData || s.testClipboardData, e = { clipboard: t }; - if (!t || Ll(s)) return void this.getPastedHTMLUsingHiddenElement((_) => { - var S, q, K; - return e.type = "text/html", e.html = _, (S = this.delegate) === null || S === void 0 || S.inputControllerWillPaste(e), (q = this.responder) === null || q === void 0 || q.insertHTML(e.html), this.requestRender(), (K = this.delegate) === null || K === void 0 ? void 0 : K.inputControllerDidPaste(e); + if (!t || Nl(s)) return void this.getPastedHTMLUsingHiddenElement((_) => { + var S, E, V; + return e.type = "text/html", e.html = _, (S = this.delegate) === null || S === void 0 || S.inputControllerWillPaste(e), (E = this.responder) === null || E === void 0 || E.insertHTML(e.html), this.requestRender(), (V = this.delegate) === null || V === void 0 ? void 0 : V.inputControllerDidPaste(e); }); const i = t.getData("URL"), n = t.getData("text/html"), r = t.getData("public.url-name"); if (i) { - var o, a, l; + var a, o, l; let _; - e.type = "text/html", _ = r ? Fn(r).trim() : i, e.html = this.createLinkHTML(i, _), (o = this.delegate) === null || o === void 0 || o.inputControllerWillPaste(e), this.setInputSummary({ textAdded: _, didDelete: this.selectionIsExpanded() }), (a = this.responder) === null || a === void 0 || a.insertHTML(e.html), this.requestRender(), (l = this.delegate) === null || l === void 0 || l.inputControllerDidPaste(e); - } else if (Vr(t)) { - var d, h, m; - e.type = "text/plain", e.string = t.getData("text/plain"), (d = this.delegate) === null || d === void 0 || d.inputControllerWillPaste(e), this.setInputSummary({ textAdded: e.string, didDelete: this.selectionIsExpanded() }), (h = this.responder) === null || h === void 0 || h.insertString(e.string), this.requestRender(), (m = this.delegate) === null || m === void 0 || m.inputControllerDidPaste(e); + e.type = "text/html", _ = r ? qn(r).trim() : i, e.html = this.createLinkHTML(i, _), (a = this.delegate) === null || a === void 0 || a.inputControllerWillPaste(e), this.setInputSummary({ textAdded: _, didDelete: this.selectionIsExpanded() }), (o = this.responder) === null || o === void 0 || o.insertHTML(e.html), this.requestRender(), (l = this.delegate) === null || l === void 0 || l.inputControllerDidPaste(e); + } else if (ea(t)) { + var c, h, m; + e.type = "text/plain", e.string = t.getData("text/plain"), (c = this.delegate) === null || c === void 0 || c.inputControllerWillPaste(e), this.setInputSummary({ textAdded: e.string, didDelete: this.selectionIsExpanded() }), (h = this.responder) === null || h === void 0 || h.insertString(e.string), this.requestRender(), (m = this.delegate) === null || m === void 0 || m.inputControllerDidPaste(e); } else if (n) { - var f, u, b; - e.type = "text/html", e.html = n, (f = this.delegate) === null || f === void 0 || f.inputControllerWillPaste(e), (u = this.responder) === null || u === void 0 || u.insertHTML(e.html), this.requestRender(), (b = this.delegate) === null || b === void 0 || b.inputControllerDidPaste(e); + var p, u, b; + e.type = "text/html", e.html = n, (p = this.delegate) === null || p === void 0 || p.inputControllerWillPaste(e), (u = this.responder) === null || u === void 0 || u.insertHTML(e.html), this.requestRender(), (b = this.delegate) === null || b === void 0 || b.inputControllerDidPaste(e); } else if (Array.from(t.types).includes("Files")) { - var E, I; - const _ = (E = t.items) === null || E === void 0 || (E = E[0]) === null || E === void 0 || (I = E.getAsFile) === null || I === void 0 ? void 0 : I.call(E); + var A, I; + const _ = (A = t.items) === null || A === void 0 || (A = A[0]) === null || A === void 0 || (I = A.getAsFile) === null || I === void 0 ? void 0 : I.call(A); if (_) { - var P, R, k; - const S = El(_); - !_.name && S && (_.name = "pasted-file-".concat(++Al, ".").concat(S)), e.type = "File", e.file = _, (P = this.delegate) === null || P === void 0 || P.inputControllerWillAttachFiles(), (R = this.responder) === null || R === void 0 || R.insertFile(e.file), this.requestRender(), (k = this.delegate) === null || k === void 0 || k.inputControllerDidPaste(e); + var F, R, H; + const S = Ol(_); + !_.name && S && (_.name = "pasted-file-".concat(++Dl, ".").concat(S)), e.type = "File", e.file = _, (F = this.delegate) === null || F === void 0 || F.inputControllerWillAttachFiles(), (R = this.responder) === null || R === void 0 || R.insertFile(e.file), this.requestRender(), (H = this.delegate) === null || H === void 0 || H.inputControllerDidPaste(e); } } s.preventDefault(); @@ -4346,7 +4346,7 @@ W(bt, "events", { keydown(s) { this.inputSummary.didInput = !0; }, input(s) { return this.inputSummary.didInput = !0, s.stopPropagation(); -} }), W(bt, "keys", { backspace(s) { +} }), K(bt, "keys", { backspace(s) { var t; return (t = this.delegate) === null || t === void 0 || t.inputControllerWillPerformTyping(), this.deleteInDirection("backward", s); }, delete(s) { @@ -4392,16 +4392,16 @@ W(bt, "events", { keydown(s) { var t; return this.setInputSummary({ preferDocument: !1 }), (t = this.delegate) === null || t === void 0 ? void 0 : t.inputControllerWillPerformTyping(); } } }), bt.proxyMethod("responder?.getSelectedRange"), bt.proxyMethod("responder?.setSelectedRange"), bt.proxyMethod("responder?.expandSelectionInDirection"), bt.proxyMethod("responder?.selectionIsInCursorTarget"), bt.proxyMethod("responder?.selectionIsExpanded"); -const El = (s) => { +const Ol = (s) => { var t; return (t = s.type) === null || t === void 0 || (t = t.match(/\/(\w+)$/)) === null || t === void 0 ? void 0 : t[1]; -}, xl = !((Qi = " ".codePointAt) === null || Qi === void 0 || !Qi.call(" ", 0)), Sl = function(s) { - if (s.key && xl && s.key.codePointAt(0) === s.keyCode) return s.key; +}, Ml = !((Zi = " ".codePointAt) === null || Zi === void 0 || !Zi.call(" ", 0)), Bl = function(s) { + if (s.key && Ml && s.key.codePointAt(0) === s.keyCode) return s.key; { let t; - if (s.which === null ? t = s.keyCode : s.which !== 0 && s.charCode !== 0 && (t = s.charCode), t != null && Lo[t] !== "escape") return ke.fromCodepoints([t]).toString(); + if (s.which === null ? t = s.keyCode : s.which !== 0 && s.charCode !== 0 && (t = s.charCode), t != null && Ba[t] !== "escape") return ke.fromCodepoints([t]).toString(); } -}, Ll = function(s) { +}, Nl = function(s) { const t = s.clipboardData; if (t) { if (t.types.includes("text/html")) { @@ -4417,7 +4417,7 @@ const El = (s) => { } } }; -class xt extends F { +class xt extends P { constructor(t) { super(...arguments), this.inputController = t, this.responder = this.inputController.responder, this.delegate = this.inputController.delegate, this.inputSummary = this.inputController.inputSummary, this.data = {}; } @@ -4444,7 +4444,7 @@ class xt extends F { return this.getEndData() != null; } isSignificant() { - return !yl.composesExistingText || this.inputSummary.didInput; + return !Rl.composesExistingText || this.inputSummary.didInput; } canApplyToDocument() { var t, e; @@ -4452,7 +4452,7 @@ class xt extends F { } } xt.proxyMethod("inputController.setInputSummary"), xt.proxyMethod("inputController.requestRender"), xt.proxyMethod("inputController.requestReparse"), xt.proxyMethod("responder?.selectionIsExpanded"), xt.proxyMethod("responder?.insertPlaceholder"), xt.proxyMethod("responder?.selectPlaceholder"), xt.proxyMethod("responder?.forgetPlaceholder"); -class Ce extends pi { +class Ce extends fi { constructor() { super(...arguments), this.render = this.render.bind(this); } @@ -4481,14 +4481,14 @@ class Ce extends pi { } toggleAttributeIfSupported(t) { var e; - if (_n().includes(t)) return (e = this.delegate) === null || e === void 0 || e.inputControllerWillPerformFormatting(t), this.withTargetDOMRange(function() { + if (An().includes(t)) return (e = this.delegate) === null || e === void 0 || e.inputControllerWillPerformFormatting(t), this.withTargetDOMRange(function() { var i; return (i = this.responder) === null || i === void 0 ? void 0 : i.toggleCurrentAttribute(t); }); } activateAttributeIfSupported(t, e) { var i; - if (_n().includes(t)) return (i = this.delegate) === null || i === void 0 || i.inputControllerWillPerformFormatting(t), this.withTargetDOMRange(function() { + if (An().includes(t)) return (i = this.delegate) === null || i === void 0 || i.inputControllerWillPerformFormatting(t), this.withTargetDOMRange(function() { var n; return (n = this.responder) === null || n === void 0 ? void 0 : n.setCurrentAttribute(t, e); }); @@ -4498,21 +4498,21 @@ class Ce extends pi { var i; e && ((i = this.delegate) === null || i === void 0 || i.inputControllerWillPerformTyping()); const n = () => { - var o; - return (o = this.responder) === null || o === void 0 ? void 0 : o.deleteInDirection(t); + var a; + return (a = this.responder) === null || a === void 0 ? void 0 : a.deleteInDirection(t); }, r = this.getTargetDOMRange({ minLength: this.composing ? 1 : 2 }); return r ? this.withTargetDOMRange(r, n) : n(); } withTargetDOMRange(t, e) { var i; - return typeof t == "function" && (e = t, t = this.getTargetDOMRange()), t ? (i = this.responder) === null || i === void 0 ? void 0 : i.withTargetDOMRange(t, e.bind(this)) : (qt.reset(), e.call(this)); + return typeof t == "function" && (e = t, t = this.getTargetDOMRange()), t ? (i = this.responder) === null || i === void 0 ? void 0 : i.withTargetDOMRange(t, e.bind(this)) : (Ht.reset(), e.call(this)); } getTargetDOMRange() { var t, e; let { minLength: i } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : { minLength: 0 }; const n = (t = (e = this.event).getTargetRanges) === null || t === void 0 ? void 0 : t.call(e); if (n && n.length) { - const r = Cl(n[0]); + const r = Pl(n[0]); if (i === 0 || r.toString().length >= i) return r; } } @@ -4527,10 +4527,10 @@ class Ce extends pi { return i; } } -W(Ce, "events", { keydown(s) { - if (zr(s)) { +K(Ce, "events", { keydown(s) { + if (ia(s)) { var t; - const e = kl(s); + const e = ql(s); (t = this.delegate) !== null && t !== void 0 && t.inputControllerDidReceiveKeyboardCommand(e) && s.preventDefault(); } else { let e = s.key; @@ -4542,33 +4542,33 @@ W(Ce, "events", { keydown(s) { var t; let e; const i = (t = s.clipboardData) === null || t === void 0 ? void 0 : t.getData("URL"); - return Co(s) ? (s.preventDefault(), this.attachFiles(s.clipboardData.files)) : Tl(s) ? (s.preventDefault(), e = { type: "text/plain", string: s.clipboardData.getData("text/plain") }, (n = this.delegate) === null || n === void 0 || n.inputControllerWillPaste(e), (r = this.responder) === null || r === void 0 || r.insertString(e.string), this.render(), (o = this.delegate) === null || o === void 0 ? void 0 : o.inputControllerDidPaste(e)) : i ? (s.preventDefault(), e = { type: "text/html", html: this.createLinkHTML(i) }, (a = this.delegate) === null || a === void 0 || a.inputControllerWillPaste(e), (l = this.responder) === null || l === void 0 || l.insertHTML(e.html), this.render(), (d = this.delegate) === null || d === void 0 ? void 0 : d.inputControllerDidPaste(e)) : void 0; - var n, r, o, a, l, d; + return Na(s) ? (s.preventDefault(), this.attachFiles(s.clipboardData.files)) : Hl(s) ? (s.preventDefault(), e = { type: "text/plain", string: s.clipboardData.getData("text/plain") }, (n = this.delegate) === null || n === void 0 || n.inputControllerWillPaste(e), (r = this.responder) === null || r === void 0 || r.insertString(e.string), this.render(), (a = this.delegate) === null || a === void 0 ? void 0 : a.inputControllerDidPaste(e)) : i ? (s.preventDefault(), e = { type: "text/html", html: this.createLinkHTML(i) }, (o = this.delegate) === null || o === void 0 || o.inputControllerWillPaste(e), (l = this.responder) === null || l === void 0 || l.insertHTML(e.html), this.render(), (c = this.delegate) === null || c === void 0 ? void 0 : c.inputControllerDidPaste(e)) : void 0; + var n, r, a, o, l, c; }, beforeinput(s) { const t = this.constructor.inputTypes[s.inputType], e = (i = s, !(!/iPhone|iPad/.test(navigator.userAgent) || i.inputType && i.inputType !== "insertParagraph")); var i; t && (this.withEvent(s, t), e || this.scheduleRender()), e && this.render(); }, input(s) { - qt.reset(); + Ht.reset(); }, dragstart(s) { var t, e; - (t = this.responder) !== null && t !== void 0 && t.selectionContainsAttachments() && (s.dataTransfer.setData("application/x-trix-dragging", !0), this.dragging = { range: (e = this.responder) === null || e === void 0 ? void 0 : e.getSelectedRange(), point: tn(s) }); + (t = this.responder) !== null && t !== void 0 && t.selectionContainsAttachments() && (s.dataTransfer.setData("application/x-trix-dragging", !0), this.dragging = { range: (e = this.responder) === null || e === void 0 ? void 0 : e.getSelectedRange(), point: en(s) }); }, dragenter(s) { - Zi(s) && s.preventDefault(); + tn(s) && s.preventDefault(); }, dragover(s) { if (this.dragging) { s.preventDefault(); - const e = tn(s); + const e = en(s); var t; if (!ne(e, this.dragging.point)) return this.dragging.point = e, (t = this.responder) === null || t === void 0 ? void 0 : t.setLocationRangeFromPointRange(e); - } else Zi(s) && s.preventDefault(); + } else tn(s) && s.preventDefault(); }, drop(s) { var t, e; if (this.dragging) return s.preventDefault(), (t = this.delegate) === null || t === void 0 || t.inputControllerWillMoveText(), (e = this.responder) === null || e === void 0 || e.moveTextFromRange(this.dragging.range), this.dragging = null, this.scheduleRender(); - if (Zi(s)) { + if (tn(s)) { var i; s.preventDefault(); - const n = tn(s); + const n = en(s); return (i = this.responder) === null || i === void 0 || i.setLocationRangeFromPointRange(n), this.attachFiles(s.dataTransfer.files); } }, dragend() { @@ -4576,7 +4576,7 @@ W(Ce, "events", { keydown(s) { this.dragging && ((s = this.responder) === null || s === void 0 || s.setSelectedRange(this.dragging.range), this.dragging = null); }, compositionend(s) { this.composing && (this.composing = !1, Oe.recentAndroid || this.scheduleRender()); -} }), W(Ce, "keys", { ArrowLeft() { +} }), K(Ce, "keys", { ArrowLeft() { var s, t; if ((s = this.responder) !== null && s !== void 0 && s.shouldManageMovingCursorInDirection("backward")) return this.event.preventDefault(), (t = this.responder) === null || t === void 0 ? void 0 : t.moveCursorInDirection("backward"); }, ArrowRight() { @@ -4591,7 +4591,7 @@ W(Ce, "events", { keydown(s) { }, "Tab+Shift"() { var s, t; if ((s = this.responder) !== null && s !== void 0 && s.canDecreaseNestingLevel()) return this.event.preventDefault(), (t = this.responder) === null || t === void 0 || t.decreaseNestingLevel(), this.render(); -} }), W(Ce, "inputTypes", { deleteByComposition() { +} }), K(Ce, "inputTypes", { deleteByComposition() { return this.deleteInDirection("backward", { recordUndoEntry: !1 }); }, deleteByCut() { return this.deleteInDirection("backward"); @@ -4694,15 +4694,15 @@ W(Ce, "events", { keydown(s) { var n; let l; this.event.preventDefault(), t.type = "text/html"; - const d = s.getData("public.url-name"); - l = d ? Fn(d).trim() : e, t.html = this.createLinkHTML(e, l), (n = this.delegate) === null || n === void 0 || n.inputControllerWillPaste(t), this.withTargetDOMRange(function() { + const c = s.getData("public.url-name"); + l = c ? qn(c).trim() : e, t.html = this.createLinkHTML(e, l), (n = this.delegate) === null || n === void 0 || n.inputControllerWillPaste(t), this.withTargetDOMRange(function() { var h; return (h = this.responder) === null || h === void 0 ? void 0 : h.insertHTML(t.html); }), this.afterRender = () => { var h; return (h = this.delegate) === null || h === void 0 ? void 0 : h.inputControllerDidPaste(t); }; - } else if (Vr(s)) { + } else if (ea(s)) { var r; t.type = "text/plain", t.string = s.getData("text/plain"), (r = this.delegate) === null || r === void 0 || r.inputControllerWillPaste(t), this.withTargetDOMRange(function() { var l; @@ -4711,9 +4711,9 @@ W(Ce, "events", { keydown(s) { var l; return (l = this.delegate) === null || l === void 0 ? void 0 : l.inputControllerDidPaste(t); }; - } else if (wl(this.event)) { - var o; - t.type = "File", t.file = s.files[0], (o = this.delegate) === null || o === void 0 || o.inputControllerWillPaste(t), this.withTargetDOMRange(function() { + } else if (Fl(this.event)) { + var a; + t.type = "File", t.file = s.files[0], (a = this.delegate) === null || a === void 0 || a.inputControllerWillPaste(t), this.withTargetDOMRange(function() { var l; return (l = this.responder) === null || l === void 0 ? void 0 : l.insertFile(t.file); }), this.afterRender = () => { @@ -4721,8 +4721,8 @@ W(Ce, "events", { keydown(s) { return (l = this.delegate) === null || l === void 0 ? void 0 : l.inputControllerDidPaste(t); }; } else if (i) { - var a; - this.event.preventDefault(), t.type = "text/html", t.html = i, (a = this.delegate) === null || a === void 0 || a.inputControllerWillPaste(t), this.withTargetDOMRange(function() { + var o; + this.event.preventDefault(), t.type = "text/html", t.html = i, (o = this.delegate) === null || o === void 0 || o.inputControllerWillPaste(t), this.withTargetDOMRange(function() { var l; return (l = this.responder) === null || l === void 0 ? void 0 : l.insertHTML(t.html); }), this.afterRender = () => { @@ -4758,37 +4758,37 @@ W(Ce, "events", { keydown(s) { }, insertUnorderedList() { return this.toggleAttributeIfSupported("bullet"); } }); -const Cl = function(s) { +const Pl = function(s) { const t = document.createRange(); return t.setStart(s.startContainer, s.startOffset), t.setEnd(s.endContainer, s.endOffset), t; -}, Zi = (s) => { +}, tn = (s) => { var t; return Array.from(((t = s.dataTransfer) === null || t === void 0 ? void 0 : t.types) || []).includes("Files"); -}, wl = (s) => { +}, Fl = (s) => { var t; - return ((t = s.dataTransfer.files) === null || t === void 0 ? void 0 : t[0]) && !Co(s) && !((e) => { + return ((t = s.dataTransfer.files) === null || t === void 0 ? void 0 : t[0]) && !Na(s) && !((e) => { let { dataTransfer: i } = e; return i.types.includes("Files") && i.types.includes("text/html") && i.getData("text/html").includes("urn:schemas-microsoft-com:office:office"); })(s); -}, Co = function(s) { +}, Na = function(s) { const t = s.clipboardData; if (t) return Array.from(t.types).filter((e) => e.match(/file/i)).length === t.types.length && t.files.length >= 1; -}, Tl = function(s) { +}, Hl = function(s) { const t = s.clipboardData; if (t) return t.types.includes("text/plain") && t.types.length === 1; -}, kl = function(s) { +}, ql = function(s) { const t = []; return s.altKey && t.push("alt"), s.shiftKey && t.push("shift"), t.push(s.key), t; -}, tn = (s) => ({ x: s.clientX, y: s.clientY }), wn = "[data-trix-attribute]", Tn = "[data-trix-action]", Il = "".concat(wn, ", ").concat(Tn), fi = "[data-trix-dialog]", Rl = "".concat(fi, "[data-trix-active]"), Dl = "".concat(fi, " [data-trix-method]"), Vs = "".concat(fi, " [data-trix-input]"), zs = (s, t) => (t || (t = Qt(s)), s.querySelector("[data-trix-input][name='".concat(t, "']"))), Ws = (s) => s.getAttribute("data-trix-action"), Qt = (s) => s.getAttribute("data-trix-attribute") || s.getAttribute("data-trix-dialog-attribute"); -class wo extends F { +}, en = (s) => ({ x: s.clientX, y: s.clientY }), kn = "[data-trix-attribute]", In = "[data-trix-action]", $l = "".concat(kn, ", ").concat(In), bi = "[data-trix-dialog]", Ul = "".concat(bi, "[data-trix-active]"), Vl = "".concat(bi, " [data-trix-method]"), zs = "".concat(bi, " [data-trix-input]"), Ks = (s, t) => (t || (t = Qt(s)), s.querySelector("[data-trix-input][name='".concat(t, "']"))), Gs = (s) => s.getAttribute("data-trix-action"), Qt = (s) => s.getAttribute("data-trix-attribute") || s.getAttribute("data-trix-dialog-attribute"); +class Pa extends P { constructor(t) { - super(t), this.didClickActionButton = this.didClickActionButton.bind(this), this.didClickAttributeButton = this.didClickAttributeButton.bind(this), this.didClickDialogButton = this.didClickDialogButton.bind(this), this.didKeyDownDialogInput = this.didKeyDownDialogInput.bind(this), this.element = t, this.attributes = {}, this.actions = {}, this.resetDialogInputs(), O("mousedown", { onElement: this.element, matchingSelector: Tn, withCallback: this.didClickActionButton }), O("mousedown", { onElement: this.element, matchingSelector: wn, withCallback: this.didClickAttributeButton }), O("click", { onElement: this.element, matchingSelector: Il, preventDefault: !0 }), O("click", { onElement: this.element, matchingSelector: Dl, withCallback: this.didClickDialogButton }), O("keydown", { onElement: this.element, matchingSelector: Vs, withCallback: this.didKeyDownDialogInput }); + super(t), this.didClickActionButton = this.didClickActionButton.bind(this), this.didClickAttributeButton = this.didClickAttributeButton.bind(this), this.didClickDialogButton = this.didClickDialogButton.bind(this), this.didKeyDownDialogInput = this.didKeyDownDialogInput.bind(this), this.element = t, this.attributes = {}, this.actions = {}, this.resetDialogInputs(), O("mousedown", { onElement: this.element, matchingSelector: In, withCallback: this.didClickActionButton }), O("mousedown", { onElement: this.element, matchingSelector: kn, withCallback: this.didClickAttributeButton }), O("click", { onElement: this.element, matchingSelector: $l, preventDefault: !0 }), O("click", { onElement: this.element, matchingSelector: Vl, withCallback: this.didClickDialogButton }), O("keydown", { onElement: this.element, matchingSelector: zs, withCallback: this.didKeyDownDialogInput }); } didClickActionButton(t, e) { var i; (i = this.delegate) === null || i === void 0 || i.toolbarDidClickButton(), t.preventDefault(); - const n = Ws(e); + const n = Gs(e); return this.getDialog(n) ? this.toggleDialog(n) : (r = this.delegate) === null || r === void 0 ? void 0 : r.toolbarDidInvokeAction(n, e); var r; } @@ -4800,7 +4800,7 @@ class wo extends F { return this.getDialog(n) ? this.toggleDialog(n) : (r = this.delegate) === null || r === void 0 || r.toolbarDidToggleAttribute(n), this.refreshAttributeButtons(); } didClickDialogButton(t, e) { - const i = Ct(e, { matchingSelector: fi }); + const i = Ct(e, { matchingSelector: bi }); return this[e.getAttribute("data-trix-method")].call(this, i); } didKeyDownDialogInput(t, e) { @@ -4820,7 +4820,7 @@ class wo extends F { }); } eachActionButton(t) { - return Array.from(this.element.querySelectorAll(Tn)).map((e) => t(e, Ws(e))); + return Array.from(this.element.querySelectorAll(In)).map((e) => t(e, Gs(e))); } updateAttributes(t) { return this.attributes = t, this.refreshAttributeButtons(); @@ -4829,7 +4829,7 @@ class wo extends F { return this.eachAttributeButton((t, e) => (t.disabled = this.attributes[e] === !1, this.attributes[e] || this.dialogIsVisible(e) ? (t.setAttribute("data-trix-active", ""), t.classList.add("trix-active")) : (t.removeAttribute("data-trix-active"), t.classList.remove("trix-active")))); } eachAttributeButton(t) { - return Array.from(this.element.querySelectorAll(wn)).map((e) => t(e, Qt(e))); + return Array.from(this.element.querySelectorAll(kn)).map((e) => t(e, Qt(e))); } applyKeyboardCommand(t) { const e = JSON.stringify(t.sort()); @@ -4850,19 +4850,19 @@ class wo extends F { var e, i; this.hideDialog(), (e = this.delegate) === null || e === void 0 || e.toolbarWillShowDialog(); const n = this.getDialog(t); - n.setAttribute("data-trix-active", ""), n.classList.add("trix-active"), Array.from(n.querySelectorAll("input[disabled]")).forEach((o) => { - o.removeAttribute("disabled"); + n.setAttribute("data-trix-active", ""), n.classList.add("trix-active"), Array.from(n.querySelectorAll("input[disabled]")).forEach((a) => { + a.removeAttribute("disabled"); }); const r = Qt(n); if (r) { - const o = zs(n, t); - o && (o.value = this.attributes[r] || "", o.select()); + const a = Ks(n, t); + a && (a.value = this.attributes[r] || "", a.select()); } return (i = this.delegate) === null || i === void 0 ? void 0 : i.toolbarDidShowDialog(t); } setAttribute(t) { var e; - const i = Qt(t), n = zs(t, i); + const i = Qt(t), n = Ks(t, i); return !n.willValidate || (n.setCustomValidity(""), n.checkValidity() && this.isSafeAttribute(n)) ? ((e = this.delegate) === null || e === void 0 || e.toolbarDidUpdateAttribute(i, n.value), this.hideDialog()) : (n.setCustomValidity("Invalid value"), n.setAttribute("data-trix-validate", ""), n.classList.add("trix-validate"), n.focus()); } isSafeAttribute(t) { @@ -4874,12 +4874,12 @@ class wo extends F { return (e = this.delegate) === null || e === void 0 || e.toolbarDidRemoveAttribute(i), this.hideDialog(); } hideDialog() { - const t = this.element.querySelector(Rl); + const t = this.element.querySelector(Ul); var e; if (t) return t.removeAttribute("data-trix-active"), t.classList.remove("trix-active"), this.resetDialogInputs(), (e = this.delegate) === null || e === void 0 ? void 0 : e.toolbarDidHideDialog(((i) => i.getAttribute("data-trix-dialog"))(t)); } resetDialogInputs() { - Array.from(this.element.querySelectorAll(Vs)).forEach((t) => { + Array.from(this.element.querySelectorAll(zs)).forEach((t) => { t.setAttribute("disabled", "disabled"), t.removeAttribute("data-trix-validate"), t.classList.remove("trix-validate"); }); } @@ -4887,16 +4887,16 @@ class wo extends F { return this.element.querySelector("[data-trix-dialog=".concat(t, "]")); } } -class we extends Ao { +class we extends Ra { constructor(t) { let { editorElement: e, document: i, html: n } = t; - super(...arguments), this.editorElement = e, this.selectionManager = new Rt(this.editorElement), this.selectionManager.delegate = this, this.composition = new St(), this.composition.delegate = this, this.attachmentManager = new co(this.composition.getAttachments()), this.attachmentManager.delegate = this, this.inputController = Mn.getLevel() === 2 ? new Ce(this.editorElement) : new bt(this.editorElement), this.inputController.delegate = this, this.inputController.responder = this.composition, this.compositionController = new yo(this.editorElement, this.composition), this.compositionController.delegate = this, this.toolbarController = new wo(this.editorElement.toolbarElement), this.toolbarController.delegate = this, this.editor = new go(this.composition, this.selectionManager, this.editorElement), i ? this.editor.loadDocument(i) : this.editor.loadHTML(n); + super(...arguments), this.editorElement = e, this.selectionManager = new Rt(this.editorElement), this.selectionManager.delegate = this, this.composition = new St(), this.composition.delegate = this, this.attachmentManager = new ya(this.composition.getAttachments()), this.attachmentManager.delegate = this, this.inputController = Nn.getLevel() === 2 ? new Ce(this.editorElement) : new bt(this.editorElement), this.inputController.delegate = this, this.inputController.responder = this.composition, this.compositionController = new Ia(this.editorElement, this.composition), this.compositionController.delegate = this, this.toolbarController = new Pa(this.editorElement.toolbarElement), this.toolbarController.delegate = this, this.editor = new Sa(this.composition, this.selectionManager, this.editorElement), i ? this.editor.loadDocument(i) : this.editor.loadHTML(n); } registerSelectionManager() { - return qt.registerSelectionManager(this.selectionManager); + return Ht.registerSelectionManager(this.selectionManager); } unregisterSelectionManager() { - return qt.unregisterSelectionManager(this.selectionManager); + return Ht.unregisterSelectionManager(this.selectionManager); } render() { return this.compositionController.render(); @@ -5091,14 +5091,14 @@ class we extends Ao { runEditorFilters() { let t = this.composition.getSnapshot(); if (Array.from(this.editor.filters).forEach((n) => { - const { document: r, selectedRange: o } = t; - t = n.call(this.editor, t) || {}, t.document || (t.document = r), t.selectedRange || (t.selectedRange = o); + const { document: r, selectedRange: a } = t; + t = n.call(this.editor, t) || {}, t.document || (t.document = r), t.selectedRange || (t.selectedRange = a); }), e = t, i = this.composition.getSnapshot(), !oi(e.selectedRange, i.selectedRange) || !e.document.isEqualTo(i.document)) return this.composition.loadSnapshot(t); var e, i; } updateInputElement() { const t = function(e, i) { - const n = al[i]; + const n = _l[i]; if (n) return n(e); throw new Error("unknown content type: ".concat(i)); }(this.compositionController.getSerializableElement(), "text/html"); @@ -5125,7 +5125,7 @@ class we extends Ao { } recordFormattingUndoEntry(t) { const e = N(t), i = this.selectionManager.getLocationRange(); - if (e || !_t(i)) return this.editor.recordUndoEntry("Formatting", { context: this.getUndoContext(), consolidatable: !0 }); + if (e || !vt(i)) return this.editor.recordUndoEntry("Formatting", { context: this.getUndoContext(), consolidatable: !0 }); } recordTypingUndoEntry() { return this.editor.recordUndoEntry("Typing", { context: this.getUndoContext(this.currentAttributes), consolidatable: !0 }); @@ -5136,10 +5136,10 @@ class we extends Ao { } getLocationContext() { const t = this.selectionManager.getLocationRange(); - return _t(t) ? t[0].index : t; + return vt(t) ? t[0].index : t; } getTimeContext() { - return fn.interval > 0 ? Math.floor((/* @__PURE__ */ new Date()).getTime() / fn.interval) : 0; + return _n.interval > 0 ? Math.floor((/* @__PURE__ */ new Date()).getTime() / _n.interval) : 0; } isFocused() { var t; @@ -5152,7 +5152,7 @@ class we extends Ao { return this.constructor.actions; } } -W(we, "actions", { undo: { test() { +K(we, "actions", { undo: { test() { return this.editor.canUndo(); }, perform() { return this.editor.undo(); @@ -5171,10 +5171,10 @@ W(we, "actions", { undo: { test() { }, perform() { return this.editor.decreaseNestingLevel() && this.render(); } }, attachFiles: { test: () => !0, perform() { - return Mn.pickFiles(this.editor.insertFiles); + return Nn.pickFiles(this.editor.insertFiles); } } }), we.proxyMethod("getSelectionManager().setLocationRange"), we.proxyMethod("getSelectionManager().getLocationRange"); -var Ol = Object.freeze({ __proto__: null, AttachmentEditorController: _o, CompositionController: yo, Controller: Ao, EditorController: we, InputController: pi, Level0InputController: bt, Level2InputController: Ce, ToolbarController: wo }), Ml = Object.freeze({ __proto__: null, MutationObserver: xo, SelectionChangeObserver: Kr }), Bl = Object.freeze({ __proto__: null, FileVerificationOperation: So, ImagePreloadOperation: oo }); -jr("trix-toolbar", `%t { +var jl = Object.freeze({ __proto__: null, AttachmentEditorController: ka, CompositionController: Ia, Controller: Ra, EditorController: we, InputController: fi, Level0InputController: bt, Level2InputController: Ce, ToolbarController: Pa }), Wl = Object.freeze({ __proto__: null, MutationObserver: Oa, SelectionChangeObserver: sa }), zl = Object.freeze({ __proto__: null, FileVerificationOperation: Ma, ImagePreloadOperation: ba }); +ta("trix-toolbar", `%t { display: block; } @@ -5193,9 +5193,9 @@ jr("trix-toolbar", `%t { %t [data-trix-dialog] [data-trix-validate]:invalid { background-color: #ffdddd; }`); -class To extends HTMLElement { +class Fa extends HTMLElement { connectedCallback() { - this.innerHTML === "" && (this.innerHTML = Ur.getDefaultHTML()); + this.innerHTML === "" && (this.innerHTML = Zr.getDefaultHTML()); } get editorElements() { if (this.id) { @@ -5210,25 +5210,25 @@ class To extends HTMLElement { return t; } } -let Nl = 0; -const Pl = function(s) { +let Kl = 0; +const Gl = function(s) { if (!s.hasAttribute("contenteditable")) return s.toggleAttribute("contenteditable", !s.disabled), function(t) { let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; return e.times = 1, O(t, e); - }("focus", { onElement: s, withCallback: () => Fl(s) }); -}, Fl = function(s) { - return ql(s), Hl(); -}, ql = function(s) { + }("focus", { onElement: s, withCallback: () => Jl(s) }); +}, Jl = function(s) { + return Yl(s), Xl(); +}, Yl = function(s) { var t, e; if ((t = (e = document).queryCommandSupported) !== null && t !== void 0 && t.call(e, "enableObjectResizing")) return document.execCommand("enableObjectResizing", !1, !1), O("mscontrolselect", { onElement: s, preventDefault: !0 }); -}, Hl = function(s) { +}, Xl = function(s) { var t, e; if ((t = (e = document).queryCommandSupported) !== null && t !== void 0 && t.call(e, "DefaultParagraphSeparator")) { const { tagName: i } = Y.default; if (["div", "p"].includes(i)) return document.execCommand("DefaultParagraphSeparator", !1, i); } -}, Ks = Oe.forcesObjectResizing ? { display: "inline", width: "auto" } : { display: "inline-block", width: "1px" }; -jr("trix-editor", `%t { +}, Js = Oe.forcesObjectResizing ? { display: "inline", width: "auto" } : { display: "inline-block", width: "1px" }; +ta("trix-editor", `%t { display: block; } @@ -5265,8 +5265,8 @@ jr("trix-editor", `%t { } %t [data-trix-cursor-target] { - display: `).concat(Ks.display, ` !important; - width: `).concat(Ks.width, ` !important; + display: `).concat(Js.display, ` !important; + width: `).concat(Js.width, ` !important; padding: 0 !important; margin: 0 !important; border: none !important; @@ -5281,19 +5281,19 @@ jr("trix-editor", `%t { vertical-align: bottom !important; margin-right: -1px !important; }`)); -var at = /* @__PURE__ */ new WeakMap(), Ye = /* @__PURE__ */ new WeakMap(), ve = /* @__PURE__ */ new WeakSet(); -class $l { +var ot = /* @__PURE__ */ new WeakMap(), Ye = /* @__PURE__ */ new WeakMap(), _e = /* @__PURE__ */ new WeakSet(); +class Ql { constructor(t) { var e, i; - ro(e = this, i = ve), i.add(e), W(this, "value", ""), ee(this, at, { writable: !0, value: void 0 }), ee(this, Ye, { writable: !0, value: void 0 }), this.element = t, Le(this, at, t.attachInternals()), Le(this, Ye, !1); + fa(e = this, i = _e), i.add(e), K(this, "value", ""), ee(this, ot, { writable: !0, value: void 0 }), ee(this, Ye, { writable: !0, value: void 0 }), this.element = t, Le(this, ot, t.attachInternals()), Le(this, Ye, !1); } connectedCallback() { - Je(this, ve, Xe).call(this); + Je(this, _e, Xe).call(this); } disconnectedCallback() { } get form() { - return C(this, at).form; + return w(this, ot).form; } get name() { return this.element.getAttribute("name"); @@ -5302,10 +5302,10 @@ class $l { this.element.setAttribute("name", t); } get labels() { - return C(this, at).labels; + return w(this, ot).labels; } get disabled() { - return C(this, Ye) || this.element.hasAttribute("disabled"); + return w(this, Ye) || this.element.hasAttribute("disabled"); } set disabled(t) { this.element.toggleAttribute("disabled", t); @@ -5314,51 +5314,51 @@ class $l { return this.element.hasAttribute("required"); } set required(t) { - this.element.toggleAttribute("required", t), Je(this, ve, Xe).call(this); + this.element.toggleAttribute("required", t), Je(this, _e, Xe).call(this); } get validity() { - return C(this, at).validity; + return w(this, ot).validity; } get validationMessage() { - return C(this, at).validationMessage; + return w(this, ot).validationMessage; } get willValidate() { - return C(this, at).willValidate; + return w(this, ot).willValidate; } formDisabledCallback(t) { Le(this, Ye, t); } setFormValue(t) { - this.value = t, Je(this, ve, Xe).call(this), C(this, at).setFormValue(this.element.disabled ? void 0 : this.value); + this.value = t, Je(this, _e, Xe).call(this), w(this, ot).setFormValue(this.element.disabled ? void 0 : this.value); } checkValidity() { - return C(this, at).checkValidity(); + return w(this, ot).checkValidity(); } reportValidity() { - return C(this, at).reportValidity(); + return w(this, ot).reportValidity(); } setCustomValidity(t) { - Je(this, ve, Xe).call(this, t); + Je(this, _e, Xe).call(this, t); } } function Xe() { let s = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ""; - const { required: t, value: e } = this.element, i = t && !e, n = !!s, r = A("input", { required: t }), o = s || r.validationMessage; - C(this, at).setValidity({ valueMissing: i, customError: n }, o); + const { required: t, value: e } = this.element, i = t && !e, n = !!s, r = x("input", { required: t }), a = s || r.validationMessage; + w(this, ot).setValidity({ valueMissing: i, customError: n }, a); } -var en = /* @__PURE__ */ new WeakMap(), nn = /* @__PURE__ */ new WeakMap(), sn = /* @__PURE__ */ new WeakMap(); -class Ul { +var nn = /* @__PURE__ */ new WeakMap(), sn = /* @__PURE__ */ new WeakMap(), rn = /* @__PURE__ */ new WeakMap(); +class Zl { constructor(t) { - ee(this, en, { writable: !0, value: void 0 }), ee(this, nn, { writable: !0, value: (e) => { + ee(this, nn, { writable: !0, value: void 0 }), ee(this, sn, { writable: !0, value: (e) => { e.defaultPrevented || e.target === this.element.form && this.element.reset(); - } }), ee(this, sn, { writable: !0, value: (e) => { + } }), ee(this, rn, { writable: !0, value: (e) => { if (e.defaultPrevented || this.element.contains(e.target)) return; const i = Ct(e.target, { matchingSelector: "label" }); i && Array.from(this.labels).includes(i) && this.element.focus(); } }), this.element = t; } connectedCallback() { - Le(this, en, function(t) { + Le(this, nn, function(t) { if (t.hasAttribute("aria-label") || t.hasAttribute("aria-labelledby")) return; const e = function() { const i = Array.from(t.labels).map((r) => { @@ -5367,11 +5367,11 @@ class Ul { return n ? t.setAttribute("aria-label", n) : t.removeAttribute("aria-label"); }; return e(), O("focus", { onElement: t, withCallback: e }); - }(this.element)), window.addEventListener("reset", C(this, nn), !1), window.addEventListener("click", C(this, sn), !1); + }(this.element)), window.addEventListener("reset", w(this, sn), !1), window.addEventListener("click", w(this, rn), !1); } disconnectedCallback() { var t; - (t = C(this, en)) === null || t === void 0 || t.destroy(), window.removeEventListener("reset", C(this, nn), !1), window.removeEventListener("click", C(this, sn), !1); + (t = w(this, nn)) === null || t === void 0 || t.destroy(), window.removeEventListener("reset", w(this, sn), !1), window.removeEventListener("click", w(this, rn), !1); } get labels() { const t = []; @@ -5426,36 +5426,36 @@ class Ul { var B = /* @__PURE__ */ new WeakMap(); class ci extends HTMLElement { constructor() { - super(), ee(this, B, { writable: !0, value: void 0 }), this.willCreateInput = !0, Le(this, B, this.constructor.formAssociated ? new $l(this) : new Ul(this)); + super(), ee(this, B, { writable: !0, value: void 0 }), this.willCreateInput = !0, Le(this, B, this.constructor.formAssociated ? new Ql(this) : new Zl(this)); } get trixId() { - return this.hasAttribute("trix-id") ? this.getAttribute("trix-id") : (this.setAttribute("trix-id", ++Nl), this.trixId); + return this.hasAttribute("trix-id") ? this.getAttribute("trix-id") : (this.setAttribute("trix-id", ++Kl), this.trixId); } get labels() { - return C(this, B).labels; + return w(this, B).labels; } get disabled() { const { inputElement: t } = this; - return t ? t.disabled : C(this, B).disabled; + return t ? t.disabled : w(this, B).disabled; } set disabled(t) { const { inputElement: e } = this; - e && (e.disabled = t), C(this, B).disabled = t; + e && (e.disabled = t), w(this, B).disabled = t; } get required() { - return C(this, B).required; + return w(this, B).required; } set required(t) { - C(this, B).required = t; + w(this, B).required = t; } get validity() { - return C(this, B).validity; + return w(this, B).validity; } get validationMessage() { - return C(this, B).validationMessage; + return w(this, B).validationMessage; } get willValidate() { - return C(this, B).willValidate; + return w(this, B).willValidate; } get type() { return this.localName; @@ -5465,12 +5465,12 @@ class ci extends HTMLElement { if (this.hasAttribute("toolbar")) return (t = this.ownerDocument) === null || t === void 0 ? void 0 : t.getElementById(this.getAttribute("toolbar")); if (this.parentNode) { const e = "trix-toolbar-".concat(this.trixId); - return this.setAttribute("toolbar", e), this.internalToolbar = A("trix-toolbar", { id: e }), this.parentNode.insertBefore(this.internalToolbar, this), this.internalToolbar; + return this.setAttribute("toolbar", e), this.internalToolbar = x("trix-toolbar", { id: e }), this.parentNode.insertBefore(this.internalToolbar, this), this.internalToolbar; } } get form() { const { inputElement: t } = this; - return t ? t.form : C(this, B).form; + return t ? t.form : w(this, B).form; } get inputElement() { var t; @@ -5482,15 +5482,15 @@ class ci extends HTMLElement { } get name() { const { inputElement: t } = this; - return t ? t.name : C(this, B).name; + return t ? t.name : w(this, B).name; } set name(t) { const { inputElement: e } = this; - e ? e.name = t : C(this, B).name = t; + e ? e.name = t : w(this, B).name = t; } get value() { const { inputElement: t } = this; - return t ? t.value : C(this, B).value; + return t ? t.value : w(this, B).value; } set value(t) { var e; @@ -5504,29 +5504,29 @@ class ci extends HTMLElement { } setFormValue(t) { const { inputElement: e } = this; - e && (e.value = t), C(this, B).setFormValue(t); + e && (e.value = t), w(this, B).setFormValue(t); } connectedCallback() { if (!this.hasAttribute("data-trix-internal")) { - if (Pl(this), function(t) { + if (Gl(this), function(t) { t.hasAttribute("role") || t.setAttribute("role", "textbox"); }(this), !this.editorController) { if (Ae("trix-before-initialize", { onElement: this }), this.defaultValue = this.inputElement ? this.inputElement.value : this.innerHTML, !this.hasAttribute("input") && this.parentNode && this.willCreateInput) { const t = "trix-input-".concat(this.trixId); this.setAttribute("input", t); - const e = A("input", { type: "hidden", id: t }); + const e = x("input", { type: "hidden", id: t }); this.parentNode.insertBefore(e, this.nextElementSibling); } this.editorController = new we({ editorElement: this, html: this.defaultValue }), requestAnimationFrame(() => Ae("trix-initialize", { onElement: this })); } - this.editorController.registerSelectionManager(), C(this, B).connectedCallback(), this.toggleAttribute("connected", !0), function(t) { + this.editorController.registerSelectionManager(), w(this, B).connectedCallback(), this.toggleAttribute("connected", !0), function(t) { !document.querySelector(":focus") && t.hasAttribute("autofocus") && document.querySelector("[autofocus]") === t && t.focus(); }(this); } } disconnectedCallback() { var t; - (t = this.editorController) === null || t === void 0 || t.unregisterSelectionManager(), C(this, B).disconnectedCallback(), this.toggleAttribute("connected", !1); + (t = this.editorController) === null || t === void 0 || t.unregisterSelectionManager(), w(this, B).disconnectedCallback(), this.toggleAttribute("connected", !1); } reconnect() { this.removeInternalToolbar(), this.disconnectedCallback(), this.connectedCallback(); @@ -5536,17 +5536,17 @@ class ci extends HTMLElement { (t = this.internalToolbar) === null || t === void 0 || t.remove(), this.internalToolbar = null; } checkValidity() { - return C(this, B).checkValidity(); + return w(this, B).checkValidity(); } reportValidity() { - return C(this, B).reportValidity(); + return w(this, B).reportValidity(); } setCustomValidity(t) { - C(this, B).setCustomValidity(t); + w(this, B).setCustomValidity(t); } formDisabledCallback(t) { const { inputElement: e } = this; - e && (e.disabled = t), this.toggleAttribute("contenteditable", !t), C(this, B).formDisabledCallback(t); + e && (e.disabled = t), this.toggleAttribute("contenteditable", !t), w(this, B).formDisabledCallback(t); } formResetCallback() { this.reset(); @@ -5555,12 +5555,12 @@ class ci extends HTMLElement { this.value = this.defaultValue; } } -W(ci, "formAssociated", "ElementInternals" in window), W(ci, "observedAttributes", ["connected"]); -const Gs = { VERSION: jo, config: Me, core: ll, models: vo, views: ml, controllers: Ol, observers: Ml, operations: Bl, elements: Object.freeze({ __proto__: null, TrixEditorElement: ci, TrixToolbarElement: To }), filters: Object.freeze({ __proto__: null, Filter: uo, attachmentGalleryFilter: mo }) }; -Object.assign(Gs, vo), window.Trix = Gs, setTimeout(function() { - customElements.get("trix-toolbar") || customElements.define("trix-toolbar", To), customElements.get("trix-editor") || customElements.define("trix-editor", ci); +K(ci, "formAssociated", "ElementInternals" in window), K(ci, "observedAttributes", ["connected"]); +const Ys = { VERSION: Za, config: Me, core: vl, models: Ta, views: Sl, controllers: jl, observers: Wl, operations: zl, elements: Object.freeze({ __proto__: null, TrixEditorElement: ci, TrixToolbarElement: Fa }), filters: Object.freeze({ __proto__: null, Filter: Ea, attachmentGalleryFilter: xa }) }; +Object.assign(Ys, Ta), window.Trix = Ys, setTimeout(function() { + customElements.get("trix-toolbar") || customElements.define("trix-toolbar", Fa), customElements.get("trix-editor") || customElements.define("trix-editor", ci); }, 0); -class jl extends HTMLElement { +class td extends HTMLElement { constructor() { super(), this._value = "", this.render(); } @@ -5629,9 +5629,9 @@ class jl extends HTMLElement { `; } } -const Qe = "filter-list-list", Vl = "filter-list-item", zl = "filter-list-input", Js = "filter-list-searchable"; -var Ot, De, kn; -class Wl extends HTMLElement { +const Qe = "filter-list-list", ed = "filter-list-item", id = "filter-list-input", Xs = "filter-list-searchable"; +var Ot, De, Rn; +class nd extends HTMLElement { constructor() { super(); he(this, De); @@ -5648,7 +5648,7 @@ class Wl extends HTMLElement { return this._items; } connectedCallback() { - this._url = this.getAttribute("data-url") || "./", this._filterstart = this.getAttribute("data-filterstart") === "true", this._placeholder = this.getAttribute("data-placeholder") || "Liste filtern...", this._queryparam = this.getAttribute("data-queryparam") || "", this._queryparam, this._filterstart && Ve(this, Ot, !0), this.addEventListener("input", this.onInput.bind(this)), this.addEventListener("keydown", this.onEnter.bind(this)), this.addEventListener("focusin", this.onGainFocus.bind(this)), this.addEventListener("focusout", this.onLoseFocus.bind(this)); + this._url = this.getAttribute("data-url") || "./", this._filterstart = this.getAttribute("data-filterstart") === "true", this._placeholder = this.getAttribute("data-placeholder") || "Liste filtern...", this._queryparam = this.getAttribute("data-queryparam") || "", this._queryparam, this._filterstart && je(this, Ot, !0), this.addEventListener("input", this.onInput.bind(this)), this.addEventListener("keydown", this.onEnter.bind(this)), this.addEventListener("focusin", this.onGainFocus.bind(this)), this.addEventListener("focusout", this.onLoseFocus.bind(this)); } attributeChangedCallback(e, i, n) { e === "data-url" && i !== n && (this._url = n, this.render()), e === "data-filterstart" && i !== n && (this._filterstart = n === "true", this.render()), e === "data-placeholder" && i !== n && (this._placeholder = n, this.render()), e === "data-queryparam" && i !== n && (this._queryparam = n, this.render()); @@ -5657,14 +5657,14 @@ class Wl extends HTMLElement { e.target && e.target.tagName.toLowerCase() === "input" && (this._filter = e.target.value, this.renderList()); } onGainFocus(e) { - e.target && e.target.tagName.toLowerCase() === "input" && (Ve(this, Ot, !1), this.renderList()); + e.target && e.target.tagName.toLowerCase() === "input" && (je(this, Ot, !1), this.renderList()); } onLoseFocus(e) { let i = this.querySelector("input"); if (e.target && e.target === i) { if (relatedElement = e.relatedTarget, relatedElement && this.contains(relatedElement)) return; - i.value = "", this._filter = "", this._filterstart && Ve(this, Ot, !0), this.renderList(); + i.value = "", this._filter = "", this._filterstart && je(this, Ot, !0), this.renderList(); } } onEnter(e) { @@ -5680,7 +5680,7 @@ class Wl extends HTMLElement { let e = this.querySelector("#" + Qe); if (!e) return; - let i = new Mark(e.querySelectorAll("." + Js)); + let i = new Mark(e.querySelectorAll("." + Xs)); this._filter && i.mark(this._filter, { separateWordSearch: !0 }); @@ -5720,7 +5720,7 @@ class Wl extends HTMLElement { } getLinkText(e) { let i = this.getSearchText(e); - return i === "" ? "" : `${i}`; + return i === "" ? "" : `${i}`; } getURL(e) { if (this._queryparam) { @@ -5742,7 +5742,7 @@ class Wl extends HTMLElement { `, htmx && htmx.process(this); } ActiveDot(e) { - return ze(this, De, kn).call(this, e), ""; + return We(this, De, Rn).call(this, e), ""; } NoItems(e) { return e.length === 0 ? '
Keine Einträge gefunden
' : ""; @@ -5755,7 +5755,7 @@ class Wl extends HTMLElement { + class="${id} w-full placeholder:italic px-2 py-0.5" /> `; @@ -5770,7 +5770,7 @@ class Wl extends HTMLElement { e = this._items.filter((n) => i.every((r) => this.getSearchText(n).toLowerCase().includes(r.toLowerCase()))); } return ` -
+
${e.map( (i, n) => ` + class="${ed} block px-2.5 py-0.5 hover:bg-slate-200 no-underline ${n % 2 === 0 ? "bg-stone-100" : "bg-stone-50"}" + ${We(this, De, Rn).call(this, i) ? 'aria-current="page"' : ""}> ${this.ActiveDot(i)} ${this.getLinkText(i)} @@ -5791,13 +5791,13 @@ class Wl extends HTMLElement { `; } } -Ot = new WeakMap(), De = new WeakSet(), kn = function(e) { +Ot = new WeakMap(), De = new WeakSet(), Rn = function(e) { if (!e) return !1; let i = this.getHREF(e); return i === "" ? !1 : this._queryparam && (new URLSearchParams(window.location.search).get(this._queryparam) || "") === i ? !0 : !!window.location.href.endsWith(i); }; -class Kl extends HTMLElement { +class sd extends HTMLElement { constructor() { super(), this.handleScroll = this.handleScroll.bind(this), this.scrollToTop = this.scrollToTop.bind(this); } @@ -5833,7 +5833,7 @@ class Kl extends HTMLElement { window.scrollTo({ top: 0, behavior: "smooth" }); } } -const vt = class vt extends HTMLElement { +const _t = class _t extends HTMLElement { static get observedAttributes() { return ["position", "timeout"]; } @@ -5843,26 +5843,26 @@ const vt = class vt extends HTMLElement { }); } static _ensureDragGuard() { - if (vt._dragGuardInitialized) + if (_t._dragGuardInitialized) return; - vt._dragGuardInitialized = !0; + _t._dragGuardInitialized = !0; const t = (i) => { - var r, o; - (((o = (r = i.target) == null ? void 0 : r.closest) == null ? void 0 : o.call(r, "[data-role='content-drag-handle']")) || i.type === "dragstart") && vt._setDragging(!0); + var r, a; + (((a = (r = i.target) == null ? void 0 : r.closest) == null ? void 0 : a.call(r, "[data-role='content-drag-handle']")) || i.type === "dragstart") && _t._setDragging(!0); }, e = () => { - vt._setDragging(!1); + _t._setDragging(!1); }; document.addEventListener("pointerdown", t, !0), document.addEventListener("mousedown", t, !0), document.addEventListener("dragstart", t, !0), document.addEventListener("pointerup", e, !0), document.addEventListener("mouseup", e, !0), document.addEventListener("pointercancel", e, !0), document.addEventListener("dragend", e, !0), document.addEventListener("drop", e, !0), window.addEventListener("blur", e), window.addEventListener("contentsdragging", (i) => { var r; const n = !!((r = i.detail) != null && r.active); - vt._setDragging(n); + _t._setDragging(n); }); } constructor() { super(), this._tooltipBox = null, this._timeout = 200, this._hideTimeout = null, this._hiddenTimeout = null, this._dataTipElem = null, this._observer = null; } connectedCallback() { - vt._ensureDragGuard(), this.classList.add("relative", "block", "leading-none", "[&>*]:leading-normal"), this._dataTipElem = this.querySelector(".data-tip"); + _t._ensureDragGuard(), this.classList.add("relative", "block", "leading-none", "[&>*]:leading-normal"), this._dataTipElem = this.querySelector(".data-tip"); const t = this._dataTipElem ? this._dataTipElem.innerHTML : "Tooltip"; this._dataTipElem && this._dataTipElem.classList.add("hidden"), this._tooltipBox = document.createElement("div"), this._tooltipBox.innerHTML = t, this._tooltipBox.className = [ "tooltip-box", @@ -5978,9 +5978,9 @@ const vt = class vt extends HTMLElement { } } }; -Jt(vt, "_dragGuardInitialized", !1); -let In = vt; -class Gl extends HTMLElement { +Jt(_t, "_dragGuardInitialized", !1); +let Dn = _t; +class rd extends HTMLElement { constructor() { super(), this.overlay = null, this._others = null, this._thisindex = -1, this._preview = null, this._description = null, this._imageURL = "", this._hideDLButton = !1; } @@ -6088,7 +6088,7 @@ class Gl extends HTMLElement { this.overlay.parentNode.removeChild(this.overlay), this.overlay = null; } } -class Jl extends HTMLElement { +class ad extends HTMLElement { static get observedAttributes() { } constructor() { @@ -6157,11 +6157,11 @@ class Jl extends HTMLElement { this._showall = !0, this.shown = -1, this.disable(), this._contents.forEach((t, e) => { t.classList.remove("hidden"); let i = this._headings[e], n = i.querySelectorAll(".show-opened"); - for (let o of n) - o.classList.add("hidden"); + for (let a of n) + a.classList.add("hidden"); let r = i.querySelectorAll(".show-closed"); - for (let o of r) - o.classList.add("hidden"); + for (let a of r) + a.classList.add("hidden"); }); } default() { @@ -6309,17 +6309,17 @@ class Te extends HTMLElement { } const r = this.findLongestAbbrevAt(t, n, e); if (r) { - const { match: o, meaning: a } = r; + const { match: a, meaning: o } = r; i += `
- ${a} + ${o}
- ${o} + ${a}
- `, n += o.length; + `, n += a.length; } else i += t[n], n++; } @@ -6327,15 +6327,15 @@ class Te extends HTMLElement { } findLongestAbbrevAt(t, e, i) { let n = null, r = 0; - for (const o of Object.keys(i)) - t.startsWith(o, e) && o.length > r && (n = o, r = o.length); + for (const a of Object.keys(i)) + t.startsWith(a, e) && a.length > r && (n = a, r = a.length); return n ? { match: n, meaning: i[n] } : null; } isSpaceOrPunct(t) { return /\s|[.,;:!?]/.test(t); } } -class Yl extends HTMLElement { +class od extends HTMLElement { constructor() { super(); } @@ -6353,11 +6353,11 @@ class Yl extends HTMLElement { } } } -var di; -class Xl extends HTMLElement { +var hi; +class ld extends HTMLElement { constructor() { super(); - he(this, di, 176); + he(this, hi, 176); this._images = []; } connectedCallback() { @@ -6373,14 +6373,14 @@ class Xl extends HTMLElement { calculateShownImages() { const e = this.getBoundingClientRect(); console.log(e); - const i = Math.floor(e.width / (Ii(this, di) + 10)); + const i = Math.floor(e.width / (Ri(this, hi) + 10)); for (let n = 0; n < this._images.length; n++) n < i - 1 ? this._images[n].classList.remove("hidden") : this._images[n].classList.add("hidden"); } } -di = new WeakMap(); -const Ql = "msr-component-wrapper", Ys = "msr-selected-items-container", Xs = "msr-placeholder-no-selection-text", Zl = "msr-selected-item-pill", tc = "msr-selected-item-text", ec = "msr-item-name", ic = "msr-item-additional-data", nc = "msr-selected-item-role", Qs = "msr-selected-item-delete-btn", sc = "msr-controls-area", Zs = "msr-pre-add-button", tr = "msr-input-area-wrapper", Ze = "msr-input-area-default-border", rn = "msr-input-area-staged", er = "msr-staging-area-container", rc = "msr-staged-item-pill", oc = "msr-staged-item-text", on = "msr-staged-role-select", ir = "msr-staged-cancel-btn", nr = "msr-text-input", sr = "msr-add-button", rr = "msr-options-list", or = "msr-option-item", ac = "msr-option-item-name", lc = "msr-option-item-detail", ar = "msr-option-item-highlighted", an = "msr-hidden-select", cc = "msr-state-no-selection", dc = "msr-state-has-selection", hc = "msr-state-list-open", uc = "msr-state-item-staged"; -class ko extends HTMLElement { +hi = new WeakMap(); +const dd = "msr-component-wrapper", Qs = "msr-selected-items-container", Zs = "msr-placeholder-no-selection-text", cd = "msr-selected-item-pill", hd = "msr-selected-item-text", ud = "msr-item-name", md = "msr-item-additional-data", gd = "msr-selected-item-role", tr = "msr-selected-item-delete-btn", pd = "msr-controls-area", er = "msr-pre-add-button", ir = "msr-input-area-wrapper", Ze = "msr-input-area-default-border", an = "msr-input-area-staged", nr = "msr-staging-area-container", fd = "msr-staged-item-pill", bd = "msr-staged-item-text", on = "msr-staged-role-select", sr = "msr-staged-cancel-btn", rr = "msr-text-input", ar = "msr-add-button", or = "msr-options-list", lr = "msr-option-item", _d = "msr-option-item-name", vd = "msr-option-item-detail", dr = "msr-option-item-highlighted", ln = "msr-hidden-select", yd = "msr-state-no-selection", Ad = "msr-state-has-selection", Ed = "msr-state-list-open", xd = "msr-state-item-staged"; +class Ha extends HTMLElement { constructor() { super(); Jt(this, "_blurTimeout", null); @@ -6459,21 +6459,21 @@ class ko extends HTMLElement { } _setupTemplates() { this.optionTemplate = document.createElement("template"), this.optionTemplate.innerHTML = ` -
  • - - +
  • + +
  • `, this.selectedItemTemplate = document.createElement("template"), this.selectedItemTemplate.innerHTML = ` - - - + + + `, this.stagedPlacePillTemplate = document.createElement("template"), this.stagedPlacePillTemplate.innerHTML = ` - - + + `, this.stagedCancelBtnTemplate = document.createElement("template"), this.stagedCancelBtnTemplate.innerHTML = ` - + `, this.stagedRoleSelectTemplate = document.createElement("template"), this.stagedRoleSelectTemplate.innerHTML = ` @@ -6510,20 +6510,20 @@ class ko extends HTMLElement { } set value(e) { if (Array.isArray(e)) { - const i = e.map((o) => { - if (typeof o == "string") { - const a = o.split(","); - if (a.length === 2) { - const l = a[0].trim(), d = a[1].trim(); - if (this._getItemById(l) && this._roles.includes(d)) - return { itemId: l, role: d, instanceId: crypto.randomUUID() }; + const i = e.map((a) => { + if (typeof a == "string") { + const o = a.split(","); + if (o.length === 2) { + const l = o[0].trim(), c = o[1].trim(); + if (this._getItemById(l) && this._roles.includes(c)) + return { itemId: l, role: c, instanceId: crypto.randomUUID() }; } } return null; - }).filter((o) => o !== null), n = [], r = /* @__PURE__ */ new Set(); - for (const o of i) { - const a = `${o.itemId},${o.role}`; - r.has(a) || (n.push(o), r.add(a)); + }).filter((a) => a !== null), n = [], r = /* @__PURE__ */ new Set(); + for (const a of i) { + const o = `${a.itemId},${a.role}`; + r.has(o) || (n.push(a), r.add(o)); } this._value = n; } else @@ -6537,7 +6537,7 @@ class ko extends HTMLElement { this.setAttribute("name", e), this.hiddenSelect && (this.hiddenSelect.name = e); } connectedCallback() { - if (this.placeholderNoSelection = this.getAttribute("placeholder-no-selection") || this._placeholderNoSelection, this.placeholderSearch = this.getAttribute("placeholder-search") || this._placeholderSearch, this.placeholderRoleSelect = this.getAttribute("placeholder-role-select") || this._placeholderRoleSelect, this._render(), this.inputAreaWrapper = this.querySelector(`.${tr}`), this.inputElement = this.querySelector(`.${nr}`), this.stagedItemPillContainer = this.querySelector(`.${er}`), this.optionsListElement = this.querySelector(`.${rr}`), this.selectedItemsContainer = this.querySelector(`.${Ys}`), this.addButtonElement = this.querySelector(`.${sr}`), this.preAddButtonElement = this.querySelector(`.${Zs}`), this.hiddenSelect = this.querySelector(`.${an}`), this.name && this.hiddenSelect && (this.hiddenSelect.name = this.name), this.hasAttribute("show-add-button") ? this.showAddButton = this.getAttribute("show-add-button") : this.setAttribute("show-add-button", String(this._showAddButton)), this.inputElement && (this.inputElement.placeholder = this.placeholderSearch), this.inputElement.addEventListener("input", this._handleInput), this.inputElement.addEventListener("keydown", this._handleInputKeyDown), this.inputElement.addEventListener("focus", this._handleFocus), this.inputElement.addEventListener("blur", this._handleBlur), this.optionsListElement.addEventListener("mousedown", this._handleOptionMouseDown), this.optionsListElement.addEventListener("click", this._handleOptionClick), this.addButtonElement.addEventListener("click", this._handleAddButtonClick), this.addEventListener("keydown", this._handleKeyDown), this._renderStagedPillOrInput(), this._updateAddButtonState(), this._updatePreAddButtonVisibility(), this._updateRootElementStateClasses(), this.hasAttribute("value")) { + if (this.placeholderNoSelection = this.getAttribute("placeholder-no-selection") || this._placeholderNoSelection, this.placeholderSearch = this.getAttribute("placeholder-search") || this._placeholderSearch, this.placeholderRoleSelect = this.getAttribute("placeholder-role-select") || this._placeholderRoleSelect, this._render(), this.inputAreaWrapper = this.querySelector(`.${ir}`), this.inputElement = this.querySelector(`.${rr}`), this.stagedItemPillContainer = this.querySelector(`.${nr}`), this.optionsListElement = this.querySelector(`.${or}`), this.selectedItemsContainer = this.querySelector(`.${Qs}`), this.addButtonElement = this.querySelector(`.${ar}`), this.preAddButtonElement = this.querySelector(`.${er}`), this.hiddenSelect = this.querySelector(`.${ln}`), this.name && this.hiddenSelect && (this.hiddenSelect.name = this.name), this.hasAttribute("show-add-button") ? this.showAddButton = this.getAttribute("show-add-button") : this.setAttribute("show-add-button", String(this._showAddButton)), this.inputElement && (this.inputElement.placeholder = this.placeholderSearch), this.inputElement.addEventListener("input", this._handleInput), this.inputElement.addEventListener("keydown", this._handleInputKeyDown), this.inputElement.addEventListener("focus", this._handleFocus), this.inputElement.addEventListener("blur", this._handleBlur), this.optionsListElement.addEventListener("mousedown", this._handleOptionMouseDown), this.optionsListElement.addEventListener("click", this._handleOptionClick), this.addButtonElement.addEventListener("click", this._handleAddButtonClick), this.addEventListener("keydown", this._handleKeyDown), this._renderStagedPillOrInput(), this._updateAddButtonState(), this._updatePreAddButtonVisibility(), this._updateRootElementStateClasses(), this.hasAttribute("value")) { const e = this.getAttribute("value"); try { const i = JSON.parse(e); @@ -6565,7 +6565,7 @@ class ko extends HTMLElement { this.disabledCallback(e); } disabledCallback(e) { - this.inputElement && (this.inputElement.disabled = e), this.classList.toggle("pointer-events-none", e), this.querySelectorAll(`.${Qs}`).forEach( + this.inputElement && (this.inputElement.disabled = e), this.classList.toggle("pointer-events-none", e), this.querySelectorAll(`.${tr}`).forEach( (n) => n.disabled = e ); const i = this.querySelector(`.${on}`); @@ -6588,39 +6588,39 @@ class ko extends HTMLElement { this.internals_.setFormValue(null), this._synchronizeHiddenSelect(); } _updateRootElementStateClasses() { - this.classList.toggle(cc, this._value.length === 0), this.classList.toggle(dc, this._value.length > 0), this.classList.toggle(hc, this._isOptionsListVisible), this.classList.toggle(uc, !!this._stagedItem); + this.classList.toggle(yd, this._value.length === 0), this.classList.toggle(Ad, this._value.length > 0), this.classList.toggle(Ed, this._isOptionsListVisible), this.classList.toggle(xd, !!this._stagedItem); } _render() { const e = this.id || `msr-${crypto.randomUUID().slice(0, 8)}`; this.id || this.setAttribute("id", e), this.innerHTML = ` -
    -
    - ${this._value.length === 0 ? `${this.placeholderNoSelection}` : ""} +
    +
    + ${this._value.length === 0 ? `${this.placeholderNoSelection}` : ""}
    -
    -
    - +
    +
    +
    - +
    - - + +
    `; } @@ -6630,10 +6630,10 @@ class ko extends HTMLElement { } _createStagedRoleSelectElement(e, i) { const r = this.stagedRoleSelectTemplate.content.cloneNode(!0).firstElementChild; - let o = ``; - return e.length === 0 && !this._roles.includes(i) ? (o += "", r.disabled = !0) : (e.forEach((a) => { - o += ``; - }), r.disabled = e.length === 0 && i === ""), r.innerHTML = o, r.addEventListener("change", this._handleStagedRoleChange), r; + let a = ``; + return e.length === 0 && !this._roles.includes(i) ? (a += "", r.disabled = !0) : (e.forEach((o) => { + a += ``; + }), r.disabled = e.length === 0 && i === ""), r.innerHTML = a, r.addEventListener("change", this._handleStagedRoleChange), r; } _createStagedCancelButtonElement(e) { const n = this.stagedCancelBtnTemplate.content.cloneNode(!0).firstElementChild; @@ -6642,7 +6642,7 @@ class ko extends HTMLElement { _renderStagedPillOrInput() { if (!(!this.stagedItemPillContainer || !this.inputElement || !this.inputAreaWrapper)) { if (this.stagedItemPillContainer.innerHTML = "", this._stagedItem && this._stagedItem.item) { - this.inputAreaWrapper.classList.remove(Ze), this.inputAreaWrapper.classList.add(rn); + this.inputAreaWrapper.classList.remove(Ze), this.inputAreaWrapper.classList.add(an); const e = this._createStagedItemPillElement(this._stagedItem.item); this.stagedItemPillContainer.appendChild(e); const i = this._getAvailableRolesForItem(this._stagedItem.item.id), n = this._createStagedRoleSelectElement( @@ -6653,7 +6653,7 @@ class ko extends HTMLElement { const r = this._createStagedCancelButtonElement(this._stagedItem.item.name); this.stagedItemPillContainer.appendChild(r), this.inputElement.classList.add("hidden"), this.inputElement.value = "", this.inputElement.removeAttribute("aria-activedescendant"), this.inputElement.setAttribute("aria-expanded", "false"); } else - this.inputAreaWrapper.classList.add(Ze), this.inputAreaWrapper.classList.remove(rn), this.inputElement.classList.remove("hidden"); + this.inputAreaWrapper.classList.add(Ze), this.inputAreaWrapper.classList.remove(an), this.inputElement.classList.remove("hidden"); this._updateAddButtonState(), this._updatePreAddButtonVisibility(), this._updateRootElementStateClasses(); } } @@ -6671,16 +6671,16 @@ class ko extends HTMLElement { _createSelectedItemElement(e) { const i = this._getItemById(e.itemId); if (!i) return null; - const r = this.selectedItemTemplate.content.cloneNode(!0).firstElementChild, o = r.querySelector('[data-ref="textEl"]'); - let a = `${i.name}`, l = i.additional_data ? ` (${i.additional_data})` : "", d = ` ${e.role}`; - o.innerHTML = `${a}${l}${d}`; + const r = this.selectedItemTemplate.content.cloneNode(!0).firstElementChild, a = r.querySelector('[data-ref="textEl"]'); + let o = `${i.name}`, l = i.additional_data ? ` (${i.additional_data})` : "", c = ` ${e.role}`; + a.innerHTML = `${o}${l}${c}`; const h = r.querySelector('[data-ref="deleteBtn"]'); return h.setAttribute("aria-label", `Entferne ${i.name} als ${e.role}`), h.dataset.instanceId = e.instanceId, h.disabled = this.hasAttribute("disabled"), h.addEventListener("click", (m) => { m.stopPropagation(), this._handleDeleteSelectedItem(e.instanceId); }), r; } _renderSelectedItems() { - this.selectedItemsContainer && (this.selectedItemsContainer.innerHTML = "", this._value.length === 0 ? this.selectedItemsContainer.innerHTML = `${this.placeholderNoSelection}` : this._value.forEach((e) => { + this.selectedItemsContainer && (this.selectedItemsContainer.innerHTML = "", this._value.length === 0 ? this.selectedItemsContainer.innerHTML = `${this.placeholderNoSelection}` : this._value.forEach((e) => { const i = this._createSelectedItemElement(e); i && this.selectedItemsContainer.appendChild(i); }), this._updateRootElementStateClasses()); @@ -6693,7 +6693,7 @@ class ko extends HTMLElement { } _createOptionElement(e, i) { const r = this.optionTemplate.content.cloneNode(!0).firstElementChild; - return r.querySelector('[data-ref="nameEl"]').textContent = e.name, r.querySelector('[data-ref="detailEl"]').textContent = e.additional_data ? `(${e.additional_data})` : "", r.dataset.id = e.id, r.setAttribute("aria-selected", String(i === this._highlightedIndex)), r.id = `${this.id || "msr"}-option-${e.id}`, i === this._highlightedIndex && r.classList.add(ar), r; + return r.querySelector('[data-ref="nameEl"]').textContent = e.name, r.querySelector('[data-ref="detailEl"]').textContent = e.additional_data ? `(${e.additional_data})` : "", r.dataset.id = e.id, r.setAttribute("aria-selected", String(i === this._highlightedIndex)), r.id = `${this.id || "msr"}-option-${e.id}`, i === this._highlightedIndex && r.classList.add(dr), r; } _renderOptionsList() { if (!(!this.optionsListElement || !this.inputElement)) { @@ -6705,7 +6705,7 @@ class ko extends HTMLElement { this.optionsListElement.appendChild(r); }); const e = this.optionsListElement.querySelector( - `.${ar}` + `.${dr}` ); e ? (e.scrollIntoView({ block: "nearest" }), this.inputElement.setAttribute("aria-activedescendant", e.id)) : this.inputElement.removeAttribute("aria-activedescendant"); } @@ -6754,7 +6754,7 @@ class ko extends HTMLElement { if (!this.hasAttribute("disabled")) { if (e.key === "Enter" && this._stagedItem && this._stagedItem.item) { const n = document.activeElement, r = (i = this.stagedItemPillContainer) == null ? void 0 : i.querySelector( - `.${ir}` + `.${sr}` ); if (n === r) { e.preventDefault(), this._handleCancelStagedItem(e); @@ -6792,7 +6792,7 @@ class ko extends HTMLElement { } _handleFocus() { if (!(this.hasAttribute("disabled") || this.inputElement && this.inputElement.disabled || this._stagedItem)) { - if (!this._stagedItem && this.inputAreaWrapper && (this.inputAreaWrapper.classList.add(Ze), this.inputAreaWrapper.classList.remove(rn)), this.inputElement && this.inputElement.value.length > 0) { + if (!this._stagedItem && this.inputAreaWrapper && (this.inputAreaWrapper.classList.add(Ze), this.inputAreaWrapper.classList.remove(an)), this.inputElement && this.inputElement.value.length > 0) { const e = this.inputElement.value.toLowerCase(); this._filteredOptions = this._options.filter((i) => this._getAvailableRolesForItem(i.id).length === 0 ? !1 : i.name.toLowerCase().includes(e) || i.additional_data && i.additional_data.toLowerCase().includes(e)), this._filteredOptions.length > 0 ? (this._isOptionsListVisible = !0, this._highlightedIndex = 0, this._renderOptionsList()) : this._hideOptionsList(); } else @@ -6811,9 +6811,9 @@ class ko extends HTMLElement { } _handleOptionClick(e) { if (this.hasAttribute("disabled")) return; - const i = e.target.closest(`li[data-id].${or}`); + const i = e.target.closest(`li[data-id].${lr}`); if (i) { - const n = i.dataset.id, r = this._filteredOptions.find((o) => o.id === n); + const n = i.dataset.id, r = this._filteredOptions.find((a) => a.id === n); r && this._stageItem(r); } } @@ -6821,9 +6821,9 @@ class ko extends HTMLElement { this.hasAttribute("disabled") || (this._value = this._value.filter((i) => i.instanceId !== e), this._updateFormValue(), this._renderSelectedItems(), this._stagedItem && this._stagedItem.item && this._renderStagedPillOrInput(), this.inputElement && this.inputElement.focus(), this._updatePreAddButtonVisibility()); } } -Jt(ko, "formAssociated", !0); -const mc = "mss-component-wrapper", lr = "mss-selected-items-container", gc = "mss-selected-item-pill", pc = "mss-selected-item-text", fc = "mss-selected-item-pill-detail", cr = "mss-selected-item-delete-btn", bc = "mss-selected-item-edit-link", dr = "mss-input-controls-container", hr = "mss-input-wrapper", ur = "mss-input-wrapper-focused", mr = "mss-text-input", gr = "mss-create-new-button", pr = "mss-toggle-button", vc = "mss-inline-row", fr = "mss-options-list", _c = "mss-option-item", yc = "mss-option-item-name", Ac = "mss-option-item-detail", br = "mss-option-item-highlighted", ln = "mss-hidden-select", cn = "mss-no-items-text", vr = "mss-loading", dn = 1, hn = 10, Ec = 250, xc = "mss-state-no-selection", Sc = "mss-state-has-selection", Lc = "mss-state-list-open"; -class Io extends HTMLElement { +Jt(Ha, "formAssociated", !0); +const Sd = "mss-component-wrapper", cr = "mss-selected-items-container", Ld = "mss-selected-item-pill", Cd = "mss-selected-item-text", wd = "mss-selected-item-pill-detail", hr = "mss-selected-item-delete-btn", Td = "mss-selected-item-edit-link", ur = "mss-input-controls-container", mr = "mss-input-wrapper", gr = "mss-input-wrapper-focused", pr = "mss-text-input", fr = "mss-create-new-button", br = "mss-toggle-button", kd = "mss-inline-row", _r = "mss-options-list", Id = "mss-option-item", Rd = "mss-option-item-name", Dd = "mss-option-item-detail", vr = "mss-option-item-highlighted", dn = "mss-hidden-select", cn = "mss-no-items-text", yr = "mss-loading", hn = 1, un = 10, Od = 250, Md = "mss-state-no-selection", Bd = "mss-state-has-selection", Nd = "mss-state-list-open"; +class qa extends HTMLElement { constructor() { super(); Jt(this, "_blurTimeout", null); @@ -7011,22 +7011,22 @@ class Io extends HTMLElement { { id: "yor", name: "Yoruba" }, { id: "zha", name: "Zhuang" }, { id: "zul", name: "Zulu" } - ], this._filteredOptions = [], this._highlightedIndex = -1, this._isOptionsListVisible = !1, this._remoteEndpoint = null, this._remoteResultKey = "items", this._remoteMinChars = dn, this._remoteLimit = hn, this._remoteFetchController = null, this._remoteFetchTimeout = null, this._placeholder = this.getAttribute("placeholder") || "Search items...", this._showCreateButton = this.getAttribute("show-create-button") !== "false", this._toggleLabel = this.getAttribute("data-toggle-label") || "", this._toggleInput = this._toggleLabel !== "", this._inputCollapsed = this._toggleInput, this._editBase = this.getAttribute("data-edit-base") || "", this._editSuffix = this.getAttribute("data-edit-suffix") || "/edit", this._setupTemplates(), this._bindEventHandlers(); + ], this._filteredOptions = [], this._highlightedIndex = -1, this._isOptionsListVisible = !1, this._remoteEndpoint = null, this._remoteResultKey = "items", this._remoteMinChars = hn, this._remoteLimit = un, this._remoteFetchController = null, this._remoteFetchTimeout = null, this._placeholder = this.getAttribute("placeholder") || "Search items...", this._showCreateButton = this.getAttribute("show-create-button") !== "false", this._toggleLabel = this.getAttribute("data-toggle-label") || "", this._toggleInput = this._toggleLabel !== "", this._inputCollapsed = this._toggleInput, this._editBase = this.getAttribute("data-edit-base") || "", this._editSuffix = this.getAttribute("data-edit-suffix") || "/edit", this._setupTemplates(), this._bindEventHandlers(); } _setupTemplates() { this.optionTemplate = document.createElement("template"), this.optionTemplate.innerHTML = ` -
  • - - +
  • + +
  • `, this.selectedItemTemplate = document.createElement("template"), this.selectedItemTemplate.innerHTML = ` - - - - - + `; } @@ -7068,7 +7068,7 @@ class Io extends HTMLElement { this._value = [...new Set(e.filter((r) => typeof r == "string" && this._getItemById(r)))]; else if (typeof e == "string" && e.trim() !== "") { const r = e.trim(); - this._getItemById(r) && !this._value.includes(r) ? this._value = [r] : this._getItemById(r) || (this._value = this._value.filter((o) => o !== r)); + this._getItemById(r) && !this._value.includes(r) ? this._value = [r] : this._getItemById(r) || (this._value = this._value.filter((a) => a !== r)); } else this._value = []; const n = JSON.stringify([...this._value].sort()); this._value.forEach((r) => { @@ -7084,7 +7084,7 @@ class Io extends HTMLElement { this.setAttribute("name", e), this.hiddenSelect && (this.hiddenSelect.name = e); } connectedCallback() { - this._render(), this.inputControlsContainer = this.querySelector(`.${dr}`), this.inputWrapper = this.querySelector(`.${hr}`), this.inputElement = this.querySelector(`.${mr}`), this.createNewButton = this.querySelector(`.${gr}`), this.toggleButton = this.querySelector(`.${pr}`), this.optionsListElement = this.querySelector(`.${fr}`), this.selectedItemsContainer = this.querySelector(`.${lr}`), this.hiddenSelect = this.querySelector(`.${ln}`), this.placeholder = this.getAttribute("placeholder") || "Search items...", this.showCreateButton = this.getAttribute("show-create-button") !== "false", this._toggleLabel = this.getAttribute("data-toggle-label") || "", this._toggleInput = this._toggleLabel !== "", this._inputCollapsed = this._toggleInput, this._remoteEndpoint = this.getAttribute("data-endpoint") || null, this._remoteResultKey = this.getAttribute("data-result-key") || "items", this._remoteMinChars = this._parsePositiveInt(this.getAttribute("data-minchars"), dn), this._remoteLimit = this._parsePositiveInt(this.getAttribute("data-limit"), hn), this.name && this.hiddenSelect && (this.hiddenSelect.name = this.name), this.inputElement.addEventListener("input", this._handleInput), this.inputElement.addEventListener("keydown", this._handleKeyDown), this.inputElement.addEventListener("focus", this._handleFocus), this.inputElement.addEventListener("blur", this._handleBlur), this.optionsListElement.addEventListener("mousedown", this._handleOptionMouseDown), this.optionsListElement.addEventListener("click", this._handleOptionClick), this.createNewButton.addEventListener("click", this._handleCreateNewButtonClick), this.selectedItemsContainer.addEventListener("click", this._handleSelectedItemsContainerClick), this.toggleButton && this.toggleButton.addEventListener("click", this._handleToggleClick); + this._render(), this.inputControlsContainer = this.querySelector(`.${ur}`), this.inputWrapper = this.querySelector(`.${mr}`), this.inputElement = this.querySelector(`.${pr}`), this.createNewButton = this.querySelector(`.${fr}`), this.toggleButton = this.querySelector(`.${br}`), this.optionsListElement = this.querySelector(`.${_r}`), this.selectedItemsContainer = this.querySelector(`.${cr}`), this.hiddenSelect = this.querySelector(`.${dn}`), this.placeholder = this.getAttribute("placeholder") || "Search items...", this.showCreateButton = this.getAttribute("show-create-button") !== "false", this._toggleLabel = this.getAttribute("data-toggle-label") || "", this._toggleInput = this._toggleLabel !== "", this._inputCollapsed = this._toggleInput, this._remoteEndpoint = this.getAttribute("data-endpoint") || null, this._remoteResultKey = this.getAttribute("data-result-key") || "items", this._remoteMinChars = this._parsePositiveInt(this.getAttribute("data-minchars"), hn), this._remoteLimit = this._parsePositiveInt(this.getAttribute("data-limit"), un), this.name && this.hiddenSelect && (this.hiddenSelect.name = this.name), this.inputElement.addEventListener("input", this._handleInput), this.inputElement.addEventListener("keydown", this._handleKeyDown), this.inputElement.addEventListener("focus", this._handleFocus), this.inputElement.addEventListener("blur", this._handleBlur), this.optionsListElement.addEventListener("mousedown", this._handleOptionMouseDown), this.optionsListElement.addEventListener("click", this._handleOptionClick), this.createNewButton.addEventListener("click", this._handleCreateNewButtonClick), this.selectedItemsContainer.addEventListener("click", this._handleSelectedItemsContainerClick), this.toggleButton && this.toggleButton.addEventListener("click", this._handleToggleClick); const e = this.getAttribute("data-external-toggle-id"); if (e && (this.externalToggleButton = document.getElementById(e), this.externalToggleButton && this.externalToggleButton.addEventListener("click", this._handleToggleClick)), this._updateRootElementStateClasses(), this.hasAttribute("value")) { const i = this.getAttribute("value"); @@ -7122,9 +7122,9 @@ class Io extends HTMLElement { try { this.value = JSON.parse(n); } catch { - this.value = n.split(",").map((o) => o.trim()).filter(Boolean); + this.value = n.split(",").map((a) => a.trim()).filter(Boolean); } - else e === "placeholder" ? this.placeholder = n : e === "show-create-button" ? this.showCreateButton = n : e === "data-endpoint" ? this._remoteEndpoint = n || null : e === "data-result-key" ? this._remoteResultKey = n || "items" : e === "data-minchars" ? this._remoteMinChars = this._parsePositiveInt(n, dn) : e === "data-limit" ? this._remoteLimit = this._parsePositiveInt(n, hn) : e === "data-toggle-label" && (this._toggleLabel = n || "", this._toggleInput = this._toggleLabel !== ""); + else e === "placeholder" ? this.placeholder = n : e === "show-create-button" ? this.showCreateButton = n : e === "data-endpoint" ? this._remoteEndpoint = n || null : e === "data-result-key" ? this._remoteResultKey = n || "items" : e === "data-minchars" ? this._remoteMinChars = this._parsePositiveInt(n, hn) : e === "data-limit" ? this._remoteLimit = this._parsePositiveInt(n, un) : e === "data-toggle-label" && (this._toggleLabel = n || "", this._toggleInput = this._toggleLabel !== ""); } formAssociatedCallback(e) { } @@ -7152,10 +7152,10 @@ class Io extends HTMLElement { this.internals_.setFormValue(null), this._synchronizeHiddenSelect(); } disabledCallback(e) { - this.inputElement && (this.inputElement.disabled = e), this.createNewButton && (this.createNewButton.disabled = e), this.toggleAttribute("disabled", e), this.querySelectorAll(`.${cr}`).forEach((i) => i.disabled = e), this.hiddenSelect && (this.hiddenSelect.disabled = e), e && this._hideOptionsList(); + this.inputElement && (this.inputElement.disabled = e), this.createNewButton && (this.createNewButton.disabled = e), this.toggleAttribute("disabled", e), this.querySelectorAll(`.${hr}`).forEach((i) => i.disabled = e), this.hiddenSelect && (this.hiddenSelect.disabled = e), e && this._hideOptionsList(); } _updateRootElementStateClasses() { - this.classList.toggle(xc, this._value.length === 0), this.classList.toggle(Sc, this._value.length > 0), this.classList.toggle(Lc, this._isOptionsListVisible); + this.classList.toggle(Md, this._value.length === 0), this.classList.toggle(Bd, this._value.length > 0), this.classList.toggle(Nd, this._isOptionsListVisible); } _render() { const e = this.id || `mss-${crypto.randomUUID().slice(0, 8)}`; @@ -7163,43 +7163,43 @@ class Io extends HTMLElement { const i = this.getAttribute("data-toggle-label") || "", n = i !== "", r = n ? "hidden" : ""; this.innerHTML = ` -
    -
    -
    - ${n ? `` : ""} -
    -
    +
    +
    +
    + ${n ? `` : ""} +
    +
    - +
    - - + +
    `; } _createSelectedItemElement(e) { const i = this._getItemById(e); if (!i) return null; - const r = this.selectedItemTemplate.content.cloneNode(!0).firstElementChild, o = r.querySelector('[data-ref="textEl"]'), a = r.querySelector('[data-ref="detailEl"]'), l = r.querySelector('[data-ref="editLink"]'), d = r.querySelector('[data-ref="deleteBtn"]'); - o.textContent = this._normalizeText(i.name); + const r = this.selectedItemTemplate.content.cloneNode(!0).firstElementChild, a = r.querySelector('[data-ref="textEl"]'), o = r.querySelector('[data-ref="detailEl"]'), l = r.querySelector('[data-ref="editLink"]'), c = r.querySelector('[data-ref="deleteBtn"]'); + a.textContent = this._normalizeText(i.name); const h = this._normalizeText(i.additional_data); - h ? (a.textContent = `(${h})`, a.classList.remove("hidden")) : (a.textContent = "", a.classList.add("hidden")); + h ? (o.textContent = `(${h})`, o.classList.remove("hidden")) : (o.textContent = "", o.classList.add("hidden")); const m = this._removedIds.has(e); if (!this._initialValue.includes(e)) { const u = document.createElement("span"); - u.className = "ml-1 text-xs text-gray-600", u.textContent = "(Neu)", o.appendChild(u); + u.className = "ml-1 text-xs text-gray-600", u.textContent = "(Neu)", a.appendChild(u); } - return m && (r.classList.add("bg-red-100"), r.style.position = "relative"), l && (this._editBase && !m ? (l.href = `${this._editBase}${e}${this._editSuffix}`, l.target = "_blank", l.rel = "noreferrer", l.classList.remove("hidden")) : (l.classList.add("hidden"), l.removeAttribute("href"), l.removeAttribute("target"), l.removeAttribute("rel"))), d.setAttribute("aria-label", m ? `Undo remove ${i.name}` : `Remove ${i.name}`), d.dataset.id = e, d.disabled = this.hasAttribute("disabled"), d.innerHTML = m ? '' : "×", d.addEventListener("click", (u) => { + return m && (r.classList.add("bg-red-100"), r.style.position = "relative"), l && (this._editBase && !m ? (l.href = `${this._editBase}${e}${this._editSuffix}`, l.target = "_blank", l.rel = "noreferrer", l.classList.remove("hidden")) : (l.classList.add("hidden"), l.removeAttribute("href"), l.removeAttribute("target"), l.removeAttribute("rel"))), c.setAttribute("aria-label", m ? `Undo remove ${i.name}` : `Remove ${i.name}`), c.dataset.id = e, c.disabled = this.hasAttribute("disabled"), c.innerHTML = m ? '' : "×", c.addEventListener("click", (u) => { u.stopPropagation(), this._handleDeleteSelectedItem(e); }), r; } @@ -7220,12 +7220,12 @@ class Io extends HTMLElement { this._updateRootElementStateClasses(); } _createOptionElement(e, i) { - const r = this.optionTemplate.content.cloneNode(!0).firstElementChild, o = r.querySelector('[data-ref="nameEl"]'), a = r.querySelector('[data-ref="detailEl"]'); - o.textContent = this._normalizeText(e.name); + const r = this.optionTemplate.content.cloneNode(!0).firstElementChild, a = r.querySelector('[data-ref="nameEl"]'), o = r.querySelector('[data-ref="detailEl"]'); + a.textContent = this._normalizeText(e.name); const l = this._normalizeText(e.additional_data); - a.textContent = l ? `(${l})` : "", r.dataset.id = e.id, r.setAttribute("aria-selected", String(i === this._highlightedIndex)); - const d = `option-${this.id || "mss"}-${e.id}`; - return r.id = d, i === this._highlightedIndex && (r.classList.add(br), this.inputElement && this.inputElement.setAttribute("aria-activedescendant", d)), r; + o.textContent = l ? `(${l})` : "", r.dataset.id = e.id, r.setAttribute("aria-selected", String(i === this._highlightedIndex)); + const c = `option-${this.id || "mss"}-${e.id}`; + return r.id = c, i === this._highlightedIndex && (r.classList.add(vr), this.inputElement && this.inputElement.setAttribute("aria-activedescendant", c)), r; } _renderOptionsList() { if (!(!this.optionsListElement || !this.inputElement)) { @@ -7236,7 +7236,7 @@ class Io extends HTMLElement { const r = this._createOptionElement(i, n); this.optionsListElement.appendChild(r); }); - const e = this.optionsListElement.querySelector(`.${br}`); + const e = this.optionsListElement.querySelector(`.${vr}`); e && (e.scrollIntoView({ block: "nearest" }), this.inputElement.setAttribute("aria-activedescendant", e.id)); } this._updateRootElementStateClasses(); @@ -7268,8 +7268,8 @@ class Io extends HTMLElement { const n = i.toLowerCase(); this._filteredOptions = this._options.filter((r) => { if (this._value.includes(r.id)) return !1; - const a = this._normalizeText(r.name).toLowerCase().includes(n), l = this._normalizeText(r.additional_data), d = l && l.toLowerCase().includes(n); - return a || d; + const o = this._normalizeText(r.name).toLowerCase().includes(n), l = this._normalizeText(r.additional_data), c = l && l.toLowerCase().includes(n); + return o || c; }), this._isOptionsListVisible = this._filteredOptions.length > 0; } this._highlightedIndex = this._filteredOptions.length > 0 ? 0 : -1, this._renderOptionsList(); @@ -7303,10 +7303,10 @@ class Io extends HTMLElement { this._isOptionsListVisible = !1, this._highlightedIndex = -1, this.optionsListElement && this._renderOptionsList(); } _handleFocus() { - this.inputElement.disabled || (this.inputWrapper && this.inputWrapper.classList.add(ur), this.inputElement.value.length > 0 && this._handleInput({ target: this.inputElement }), this._updateRootElementStateClasses()); + this.inputElement.disabled || (this.inputWrapper && this.inputWrapper.classList.add(gr), this.inputElement.value.length > 0 && this._handleInput({ target: this.inputElement }), this._updateRootElementStateClasses()); } _handleBlur() { - this.inputWrapper && this.inputWrapper.classList.remove(ur), this._blurTimeout = setTimeout(() => { + this.inputWrapper && this.inputWrapper.classList.remove(gr), this._blurTimeout = setTimeout(() => { this.contains(document.activeElement) || (this._hideOptionsList(), this._toggleInput && (!this.inputElement || this.inputElement.value.trim() === "") && this._hideInputControls()); }, 150); } @@ -7364,14 +7364,14 @@ class Io extends HTMLElement { } this._remoteFetchTimeout = setTimeout(() => { this._fetchRemoteOptions(e); - }, Ec); + }, Od); } _cancelRemoteFetch() { this._remoteFetchController && (this._remoteFetchController.abort(), this._remoteFetchController = null); } async _fetchRemoteOptions(e) { if (!this._remoteEndpoint) return; - this._cancelRemoteFetch(), this.classList.add(vr); + this._cancelRemoteFetch(), this.classList.add(yr); const i = new AbortController(); this._remoteFetchController = i; try { @@ -7384,17 +7384,17 @@ class Io extends HTMLElement { }); if (!r.ok) throw new Error(`Remote fetch failed with status ${r.status}`); - const o = await r.json(); + const a = await r.json(); if (i.signal.aborted) return; - const a = this._extractRemoteOptions(o); - this._applyRemoteResults(a); + const o = this._extractRemoteOptions(a); + this._applyRemoteResults(o); } catch (n) { if (i.signal.aborted) return; console.error("MultiSelectSimple remote fetch error:", n), this._filteredOptions = [], this._isOptionsListVisible = !1, this._renderOptionsList(); } finally { - this._remoteFetchController === i && (this._remoteFetchController = null), this.classList.remove(vr); + this._remoteFetchController === i && (this._remoteFetchController = null), this.classList.remove(yr); } } _extractRemoteOptions(e) { @@ -7402,11 +7402,11 @@ class Io extends HTMLElement { let i = []; return Array.isArray(e) ? i = e : this._remoteResultKey && Array.isArray(e[this._remoteResultKey]) ? i = e[this._remoteResultKey] : Array.isArray(e.items) && (i = e.items), i.map((n) => { if (!n) return null; - const r = n.id ?? n.ID ?? n.value ?? "", o = n.name ?? n.title ?? n.label ?? "", a = n.detail ?? n.additional_data ?? n.annotation ?? "", l = this._normalizeText(o), d = this._normalizeText(a); + const r = n.id ?? n.ID ?? n.value ?? "", a = n.name ?? n.title ?? n.label ?? "", o = n.detail ?? n.additional_data ?? n.annotation ?? "", l = this._normalizeText(a), c = this._normalizeText(o); return !r || !l ? null : { id: String(r), name: l, - additional_data: d + additional_data: c }; }).filter(Boolean); } @@ -7428,9 +7428,9 @@ class Io extends HTMLElement { return (n === '"' && r === '"' || n === "'" && r === "'") && (i = i.slice(1, -1).trim(), !i) ? "" : i; } } -Jt(Io, "formAssociated", !0); -const Cc = "rbi-button", wc = "rbi-icon"; -class Tc extends HTMLElement { +Jt(qa, "formAssociated", !0); +const Pd = "rbi-button", Fd = "rbi-icon"; +class Hd extends HTMLElement { constructor() { super(), this.initialStates = /* @__PURE__ */ new Map(), this._controlledElements = [], this.button = null, this.lastOverallModifiedState = null, this.handleInputChange = this.handleInputChange.bind(this), this.handleReset = this.handleReset.bind(this); } @@ -7439,10 +7439,10 @@ class Tc extends HTMLElement { } connectedCallback() { const t = ` - `; @@ -7586,22 +7586,22 @@ class Tc extends HTMLElement { this.button.setAttribute("aria-label", t); } } -const it = "hidden", _r = "dm-stay", ti = "dm-title", un = "dm-menu-button", kc = "dm-target", Ic = "data-dm-target", yr = "dm-menu", Ar = "dm-menu-item", Rc = "dm-close-button"; -var hi, Ro; -class Dc extends HTMLElement { +const it = "hidden", Ar = "dm-stay", ti = "dm-title", mn = "dm-menu-button", qd = "dm-target", $d = "data-dm-target", Er = "dm-menu", xr = "dm-menu-item", Ud = "dm-close-button"; +var ui, $a; +class Vd extends HTMLElement { constructor() { super(); - he(this, hi); - ze(this, hi, Ro).call(this), this.boundHandleClickOutside = this.handleClickOutside.bind(this); + he(this, ui); + We(this, ui, $a).call(this), this.boundHandleClickOutside = this.handleClickOutside.bind(this); } connectedCallback() { - this._target = document.getElementById(this.getAttribute(kc)), this._target || (this._target = this), this._cildren = Array.from(this.children).filter((i) => i.nodeType === Node.ELEMENT_NODE && !i.classList.contains(un)).map((i) => ({ + this._target = document.getElementById(this.getAttribute(qd)), this._target || (this._target = this), this._cildren = Array.from(this.children).filter((i) => i.nodeType === Node.ELEMENT_NODE && !i.classList.contains(mn)).map((i) => ({ node: i, target: () => { - const n = i.getAttribute(Ic); + const n = i.getAttribute($d); return n ? document.getElementById(n) || this._target : this._target; }, - stay: () => i.hasAttribute(_r) && i.getAttribute(_r) == "true", + stay: () => i.hasAttribute(Ar) && i.getAttribute(Ar) == "true", hidden: () => i.classList.contains(it), name: () => { const n = i.querySelector("label"); @@ -7613,14 +7613,14 @@ class Dc extends HTMLElement { } })); const e = this._button; - this._button = this.querySelector(`.${un}`), !this._button && e && (this._button = e, this._button.parentElement || this.appendChild(this._button)), this._button || (this._button = document.createElement("button"), this._button.type = "button", this._button.classList.add(un, it), this._button.innerHTML = ' Felder hinzufügen', this.appendChild(this._button)), this._originalButtonText || (this._originalButtonText = this._button.innerHTML); + this._button = this.querySelector(`.${mn}`), !this._button && e && (this._button = e, this._button.parentElement || this.appendChild(this._button)), this._button || (this._button = document.createElement("button"), this._button.type = "button", this._button.classList.add(mn, it), this._button.innerHTML = ' Felder hinzufügen', this.appendChild(this._button)), this._originalButtonText || (this._originalButtonText = this._button.innerHTML); for (const i of this._cildren) this.removeChild(i.node); this._button.addEventListener("click", this._toggleMenu.bind(this)), this._button.classList.add("relative"); for (const i of this._cildren) - i.node.querySelectorAll(`.${Rc}`).forEach((r) => { - r.addEventListener("click", (o) => { - this.hideDiv(o, i.node); + i.node.querySelectorAll(`.${Ud}`).forEach((r) => { + r.addEventListener("click", (a) => { + this.hideDiv(a, i.node); }); }); this.renderIntoTarget(), this.refresh(), this._observer = new MutationObserver(() => { @@ -7676,7 +7676,7 @@ ${e[0].nameText()} hinzufügen`, this._menu = null, this.hideMenu(); console.error("DivManagerMenu: Invalid node provided."); return; } - const n = this._cildren.find((o) => o.node === i); + const n = this._cildren.find((a) => a.node === i); if (!n) { console.error("DivManagerMenu: Child not found."); return; @@ -7694,10 +7694,10 @@ ${e[0].nameText()} hinzufügen`, this._menu = null, this.hideMenu(); if (n.node.classList.remove(it), this.insertChildInOrder(n), this.renderMenu(), this.renderButton(), this.updateTargetVisibility(), typeof window.TextareaAutoResize == "function") { const r = n.node.querySelectorAll("textarea"); r.length > 0 && setTimeout(() => { - r.forEach((o) => { - o.dataset.dmResizeBound !== "true" && (o.dataset.dmResizeBound = "true", o.addEventListener("input", () => { - window.TextareaAutoResize(o); - })), window.TextareaAutoResize(o); + r.forEach((a) => { + a.dataset.dmResizeBound !== "true" && (a.dataset.dmResizeBound = "true", a.addEventListener("input", () => { + window.TextareaAutoResize(a); + })), window.TextareaAutoResize(a); }); }, 10); } @@ -7711,10 +7711,10 @@ ${e[0].nameText()} hinzufügen`, this._menu = null, this.hideMenu(); this.hideMenu(); return; } - (!this._menu || !this._button.contains(this._menu)) && (this._button.insertAdjacentHTML("beforeend", ``), this._menu = this._button.querySelector(`.${yr}`)), this._menu.innerHTML = `${e.map((n, r) => ` - `).join("")}`, this._menu.querySelectorAll(`.${Ar}`).forEach((n) => { + `).join("")}`, this._menu.querySelectorAll(`.${xr}`).forEach((n) => { n.addEventListener("click", (r) => { this.showDiv(r, parseInt(n.getAttribute("dm-itemno"))), this.hideMenu(), this.renderButton(); }); @@ -7726,7 +7726,7 @@ ${e[0].nameText()} hinzufügen`, this._menu = null, this.hideMenu(); }), this.updateTargetVisibility(); } insertChildInOrder(e) { - const i = e.target(), n = this._cildren.indexOf(e), r = this._cildren.slice(n + 1).filter((o) => o.target() === i).map((o) => o.node).find((o) => i && i.contains(o)); + const i = e.target(), n = this._cildren.indexOf(e), r = this._cildren.slice(n + 1).filter((a) => a.target() === i).map((a) => a.node).find((a) => i && i.contains(a)); i && (r ? i.insertBefore(e.node, r) : i.appendChild(e.node)); } updateTargetVisibility() { @@ -7772,16 +7772,16 @@ ${e[0].nameText()} hinzufügen`, this._menu = null, this.hideMenu(); } } } -hi = new WeakSet(), Ro = function() { +ui = new WeakSet(), $a = function() { this._cildren = [], this._rendered = [], this._target = null, this._button = null, this._menu = null, this._originalButtonText = null; }; -const ot = "items-row", Oc = "items-list", Mc = "items-template", Bc = "items-add-button", Nc = "items-cancel-button", ei = "items-remove-button", Pc = "items-edit-button", Fc = "items-close-button", qc = "items-summary", Hc = "items-edit-panel", mn = "items_removed[]", _e = "data-items-removed"; -class $c extends HTMLElement { +const at = "items-row", jd = "items-list", Wd = "items-template", zd = "items-add-button", Kd = "items-cancel-button", ei = "items-remove-button", Gd = "items-edit-button", Jd = "items-close-button", Yd = "items-summary", Xd = "items-edit-panel", gn = "items_removed[]", ve = "data-items-removed"; +class Qd extends HTMLElement { constructor() { super(), this._list = null, this._template = null, this._addButton = null, this._idPrefix = `items-editor-${crypto.randomUUID().slice(0, 8)}`, this._handleAdd = this._onAddClick.bind(this); } connectedCallback() { - if (this._list = this.querySelector(`.${Oc}`), this._template = this.querySelector(`template.${Mc}`), this._addButton = this.querySelector(`.${Bc}`), !this._list || !this._template || !this._addButton) { + if (this._list = this.querySelector(`.${jd}`), this._template = this.querySelector(`template.${Wd}`), this._addButton = this.querySelector(`.${zd}`), !this._list || !this._template || !this._addButton) { console.error("ItemsEditor: Missing list, template, or add button."); return; } @@ -7794,7 +7794,7 @@ class $c extends HTMLElement { t.preventDefault(), this.addItem(); } addItem() { - const t = this._template.content.cloneNode(!0), e = t.querySelector(`.${ot}`); + const t = this._template.content.cloneNode(!0), e = t.querySelector(`.${at}`); if (!e) { console.error("ItemsEditor: Template is missing a row element."); return; @@ -7802,10 +7802,10 @@ class $c extends HTMLElement { this._list.appendChild(t), this._captureOriginalValues(e), this._wireCancelButtons(e), this._wireRemoveButtons(e), this._wireEditButtons(e), this._assignRowFieldIds(e, this._rowIndex(e)), this._wireSummarySync(e), this._syncSummary(e), this._setRowMode(e, "edit"); } removeItem(t) { - const e = t.closest(`.${ot}`); + const e = t.closest(`.${at}`); if (!e) return; - const i = e.getAttribute(_e) === "true"; + const i = e.getAttribute(ve) === "true"; this._setRowRemoved(e, !i); } _wireRemoveButtons(t = this) { @@ -7813,43 +7813,43 @@ class $c extends HTMLElement { e.dataset.itemsBound !== "true" && (e.dataset.itemsBound = "true", e.addEventListener("click", (i) => { i.preventDefault(), this.removeItem(e); }), e.addEventListener("mouseenter", () => { - const i = e.closest(`.${ot}`); - if (!i || i.getAttribute(_e) !== "true") + const i = e.closest(`.${at}`); + if (!i || i.getAttribute(ve) !== "true") return; const n = e.querySelector("[data-delete-label]"); n && (n.textContent = n.getAttribute("data-delete-hover") || "Rückgängig"); const r = e.querySelector("i"); r && (r.classList.remove("hidden"), r.classList.add("ri-arrow-go-back-line"), r.classList.remove("ri-delete-bin-line")); }), e.addEventListener("mouseleave", () => { - const i = e.closest(`.${ot}`), n = e.querySelector("[data-delete-label]"); + const i = e.closest(`.${at}`), n = e.querySelector("[data-delete-label]"); if (!n) return; - i && i.getAttribute(_e) === "true" ? n.textContent = n.getAttribute("data-delete-active") || "Wird entfernt" : n.textContent = n.getAttribute("data-delete-default") || "Entfernen"; + i && i.getAttribute(ve) === "true" ? n.textContent = n.getAttribute("data-delete-active") || "Wird entfernt" : n.textContent = n.getAttribute("data-delete-default") || "Entfernen"; const r = e.querySelector("i"); - r && (i && i.getAttribute(_e) === "true" ? (r.classList.add("hidden"), r.classList.remove("ri-delete-bin-line", "ri-arrow-go-back-line")) : (r.classList.remove("hidden"), r.classList.add("ri-delete-bin-line"), r.classList.remove("ri-arrow-go-back-line"))); + r && (i && i.getAttribute(ve) === "true" ? (r.classList.add("hidden"), r.classList.remove("ri-delete-bin-line", "ri-arrow-go-back-line")) : (r.classList.remove("hidden"), r.classList.add("ri-delete-bin-line"), r.classList.remove("ri-arrow-go-back-line"))); })); }); } _wireCancelButtons(t = this) { - t.querySelectorAll(`.${Nc}`).forEach((e) => { + t.querySelectorAll(`.${Kd}`).forEach((e) => { e.dataset.itemsBound !== "true" && (e.dataset.itemsBound = "true", e.addEventListener("click", (i) => { i.preventDefault(); - const n = e.closest(`.${ot}`); + const n = e.closest(`.${at}`); n && this._cancelEdit(n); })); }); } _wireEditButtons(t = this) { - t.querySelectorAll(`.${Pc}`).forEach((e) => { + t.querySelectorAll(`.${Gd}`).forEach((e) => { e.dataset.itemsBound !== "true" && (e.dataset.itemsBound = "true", e.addEventListener("click", (i) => { i.preventDefault(); - const n = e.closest(`.${ot}`); + const n = e.closest(`.${at}`); n && this._setRowMode(n, "edit"); })); - }), t.querySelectorAll(`.${Fc}`).forEach((e) => { + }), t.querySelectorAll(`.${Jd}`).forEach((e) => { e.dataset.itemsBound !== "true" && (e.dataset.itemsBound = "true", e.addEventListener("click", (i) => { i.preventDefault(); - const n = e.closest(`.${ot}`); + const n = e.closest(`.${at}`); n && this._setRowMode(n, "summary"); })); }); @@ -7863,27 +7863,27 @@ class $c extends HTMLElement { this._resetToOriginal(t), this._setRowMode(t, "summary"); } _setRowRemoved(t, e) { - t.setAttribute(_e, e ? "true" : "false"), t.classList.toggle("bg-red-50", e); + t.setAttribute(ve, e ? "true" : "false"), t.classList.toggle("bg-red-50", e); const i = t.querySelector(".items-edit-button"); - i && (e ? i.classList.add("hidden") : i.classList.remove("hidden")), t.querySelectorAll("[data-delete-label]").forEach((o) => { - const a = o.closest(`.${ei}`), l = a && a.matches(":hover"); - let d; - e && l ? d = o.getAttribute("data-delete-hover") || "Rückgängig" : e ? d = o.getAttribute("data-delete-active") || "Wird entfernt" : d = o.getAttribute("data-delete-default") || "Entfernen", o.textContent = d; - }), t.querySelectorAll(`.${ei} i`).forEach((o) => { - const a = o.closest(`.${ei}`), l = a && a.matches(":hover"); - e ? l ? (o.classList.remove("hidden"), o.classList.add("ri-arrow-go-back-line"), o.classList.remove("ri-delete-bin-line")) : (o.classList.add("hidden"), o.classList.remove("ri-delete-bin-line", "ri-arrow-go-back-line")) : (o.classList.remove("hidden"), o.classList.add("ri-delete-bin-line"), o.classList.remove("ri-arrow-go-back-line")); + i && (e ? i.classList.add("hidden") : i.classList.remove("hidden")), t.querySelectorAll("[data-delete-label]").forEach((a) => { + const o = a.closest(`.${ei}`), l = o && o.matches(":hover"); + let c; + e && l ? c = a.getAttribute("data-delete-hover") || "Rückgängig" : e ? c = a.getAttribute("data-delete-active") || "Wird entfernt" : c = a.getAttribute("data-delete-default") || "Entfernen", a.textContent = c; + }), t.querySelectorAll(`.${ei} i`).forEach((a) => { + const o = a.closest(`.${ei}`), l = o && o.matches(":hover"); + e ? l ? (a.classList.remove("hidden"), a.classList.add("ri-arrow-go-back-line"), a.classList.remove("ri-delete-bin-line")) : (a.classList.add("hidden"), a.classList.remove("ri-delete-bin-line", "ri-arrow-go-back-line")) : (a.classList.remove("hidden"), a.classList.add("ri-delete-bin-line"), a.classList.remove("ri-arrow-go-back-line")); }); const n = t.querySelector('input[name="items_id[]"]'), r = n ? n.value.trim() : ""; - r && (e ? this._ensureRemovalInput(r) : this._removeRemovalInput(r)), t.querySelectorAll("[data-field]").forEach((o) => { - o.disabled = e; + r && (e ? this._ensureRemovalInput(r) : this._removeRemovalInput(r)), t.querySelectorAll("[data-field]").forEach((a) => { + a.disabled = e; }); } _setRowMode(t, e) { - const i = t.querySelector(`.${qc}`), n = t.querySelector(`.${Hc}`); + const i = t.querySelector(`.${Yd}`), n = t.querySelector(`.${Xd}`); !i || !n || (e === "edit" ? (i.classList.add("hidden"), n.classList.remove("hidden")) : (i.classList.remove("hidden"), n.classList.add("hidden"), this._syncSummary(t))); } _captureAllOriginals() { - this.querySelectorAll(`.${ot}`).forEach((t) => { + this.querySelectorAll(`.${at}`).forEach((t) => { this._captureOriginalValues(t); }); } @@ -7898,12 +7898,12 @@ class $c extends HTMLElement { }), this._syncSummary(t); } _refreshRowIds() { - Array.from(this.querySelectorAll(`.${ot}`)).forEach((e, i) => { + Array.from(this.querySelectorAll(`.${at}`)).forEach((e, i) => { this._assignRowFieldIds(e, i); }); } _rowIndex(t) { - return Array.from(this.querySelectorAll(`.${ot}`)).indexOf(t); + return Array.from(this.querySelectorAll(`.${at}`)).indexOf(t); } _assignRowFieldIds(t, e) { e < 0 || t.querySelectorAll("[data-field-label]").forEach((i) => { @@ -7913,12 +7913,12 @@ class $c extends HTMLElement { const r = t.querySelector(`[data-field="${n}"]`); if (!r) return; - const o = `${this._idPrefix}-${e}-${n}`; - r.id = o, i.setAttribute("for", o); + const a = `${this._idPrefix}-${e}-${n}`; + r.id = a, i.setAttribute("for", a); }); } _syncAllSummaries() { - this.querySelectorAll(`.${ot}`).forEach((t) => { + this.querySelectorAll(`.${at}`).forEach((t) => { this._wireSummarySync(t), this._syncSummary(t), this._syncNewBadge(t); }); } @@ -7935,8 +7935,8 @@ class $c extends HTMLElement { const n = t.querySelector(`[data-field="${i}"]`); if (!n) return; - const r = this._readFieldValue(n), o = e.getAttribute("data-summary-hide-empty") === "true" ? e.closest("[data-summary-container]") : null; - r ? (this._setSummaryContent(e, r), e.classList.remove("text-gray-400"), o && o.classList.remove("hidden")) : (this._setSummaryContent(e, "—"), e.classList.add("text-gray-400"), o && o.classList.add("hidden")); + const r = this._readFieldValue(n), a = e.getAttribute("data-summary-hide-empty") === "true" ? e.closest("[data-summary-container]") : null; + r ? (this._setSummaryContent(e, r), e.classList.remove("text-gray-400"), a && a.classList.remove("hidden")) : (this._setSummaryContent(e, "—"), e.classList.add("text-gray-400"), a && a.classList.add("hidden")); }), this._syncNewBadge(t); } _syncNewBadge(t) { @@ -7959,35 +7959,49 @@ class $c extends HTMLElement { return t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement ? t.value.trim() : ""; } _ensureRemovalInput(t) { - if (Array.from(this.querySelectorAll(`input[name="${mn}"]`)).some( + if (Array.from(this.querySelectorAll(`input[name="${gn}"]`)).some( (n) => n.value === t )) return; const i = document.createElement("input"); - i.type = "hidden", i.name = mn, i.value = t, this.appendChild(i); + i.type = "hidden", i.name = gn, i.value = t, this.appendChild(i); } _removeRemovalInput(t) { - const e = Array.from(this.querySelectorAll(`input[name="${mn}"]`)); + const e = Array.from(this.querySelectorAll(`input[name="${gn}"]`)); for (const i of e) i.value === t && i.remove(); } } -const Uc = "ssr-wrapper", Er = "ssr-input", xr = "ssr-list", jc = "ssr-option", Vc = "ssr-option-name", zc = "ssr-option-detail", Wc = "ssr-option-bio", Sr = "ssr-hidden-input", Lr = "ssr-clear-button", gn = 1, pn = 10, Kc = 250; -class Gc extends HTMLElement { +const Zd = "ssr-wrapper", Sr = "ssr-input", Lr = "ssr-list", tc = "ssr-option", ec = "ssr-option-name", ic = "ssr-option-detail", nc = "ssr-option-bio", Cr = "ssr-hidden-input", wr = "ssr-clear-button", pn = 1, fn = 10, sc = 250; +class rc extends HTMLElement { constructor() { - super(), this._endpoint = "", this._resultKey = "items", this._minChars = gn, this._limit = pn, this._placeholder = "Search...", this._options = [], this._selected = null, this._highlightedIndex = -1, this._fetchTimeout = null, this._fetchController = null, this._listVisible = !1, this._boundHandleInput = this._handleInput.bind(this), this._boundHandleFocus = this._handleFocus.bind(this), this._boundHandleKeyDown = this._handleKeyDown.bind(this), this._boundHandleClear = this._handleClear.bind(this), this._boundHandleClickOutside = this._handleClickOutside.bind(this); + super(), this._endpoint = "", this._resultKey = "items", this._minChars = pn, this._limit = fn, this._placeholder = "Search...", this._options = [], this._selected = null, this._highlightedIndex = -1, this._fetchTimeout = null, this._fetchController = null, this._listVisible = !1, this._linkBase = "", this._linkTarget = "_blank", this._linkButton = null, this._showWarningIcon = !1, this._linkField = "id", this._boundHandleInput = this._handleInput.bind(this), this._boundHandleFocus = this._handleFocus.bind(this), this._boundHandleKeyDown = this._handleKeyDown.bind(this), this._boundHandleClear = this._handleClear.bind(this), this._boundHandleClickOutside = this._handleClickOutside.bind(this); } static get observedAttributes() { - return ["data-endpoint", "data-result-key", "data-minchars", "data-limit", "placeholder", "name"]; + return [ + "data-endpoint", + "data-result-key", + "data-minchars", + "data-limit", + "placeholder", + "name", + "data-link-base", + "data-link-target", + "data-link-field", + "data-initial-link-id", + "data-show-warning-icon" + ]; } connectedCallback() { - this._render(), this._input = this.querySelector(`.${Er}`), this._list = this.querySelector(`.${xr}`), this._hiddenInput = this.querySelector(`.${Sr}`), this._clearButton = this.querySelector(`.${Lr}`), this._endpoint = this.getAttribute("data-endpoint") || "", this._resultKey = this.getAttribute("data-result-key") || "items", this._minChars = this._parsePositiveInt(this.getAttribute("data-minchars"), gn), this._limit = this._parsePositiveInt(this.getAttribute("data-limit"), pn), this._placeholder = this.getAttribute("placeholder") || "Search...", this._input && (this._input.placeholder = this._placeholder, this._input.addEventListener("input", this._boundHandleInput), this._input.addEventListener("focus", this._boundHandleFocus), this._input.addEventListener("keydown", this._boundHandleKeyDown)), this._clearButton && this._clearButton.addEventListener("click", this._boundHandleClear), document.addEventListener("click", this._boundHandleClickOutside); + this._render(), this._input = this.querySelector(`.${Sr}`), this._list = this.querySelector(`.${Lr}`), this._hiddenInput = this.querySelector(`.${Cr}`), this._clearButton = this.querySelector(`.${wr}`), this._endpoint = this.getAttribute("data-endpoint") || "", this._resultKey = this.getAttribute("data-result-key") || "items", this._minChars = this._parsePositiveInt(this.getAttribute("data-minchars"), pn), this._limit = this._parsePositiveInt(this.getAttribute("data-limit"), fn), this._placeholder = this.getAttribute("placeholder") || "Search..."; + const t = this.getAttribute("data-initial-id") || "", e = this.getAttribute("data-initial-name") || "", i = this.getAttribute("data-initial-link-id") || ""; + this._linkBase = this.getAttribute("data-link-base") || "", this._linkTarget = this.getAttribute("data-link-target") || "_blank", this._linkField = this.getAttribute("data-link-field") || "id", this._showWarningIcon = this.getAttribute("data-show-warning-icon") === "true", this._input && (this._input.placeholder = this._placeholder, this._input.addEventListener("input", this._boundHandleInput), this._input.addEventListener("focus", this._boundHandleFocus), this._input.addEventListener("keydown", this._boundHandleKeyDown)), this._linkButton = this.querySelector("[data-role='ssr-open-link']"), this._clearButton && this._clearButton.addEventListener("click", this._boundHandleClear), t && e && (this._selected = { id: t, name: e, linkId: i }, this._input && (this._input.value = e), this._syncHiddenInput()), this._updateLinkButton(), document.addEventListener("click", this._boundHandleClickOutside); } disconnectedCallback() { document.removeEventListener("click", this._boundHandleClickOutside), this._input && (this._input.removeEventListener("input", this._boundHandleInput), this._input.removeEventListener("focus", this._boundHandleFocus), this._input.removeEventListener("keydown", this._boundHandleKeyDown)), this._clearButton && this._clearButton.removeEventListener("click", this._boundHandleClear); } attributeChangedCallback(t, e, i) { - e !== i && (t === "data-endpoint" && (this._endpoint = i || ""), t === "data-result-key" && (this._resultKey = i || "items"), t === "data-minchars" && (this._minChars = this._parsePositiveInt(i, gn)), t === "data-limit" && (this._limit = this._parsePositiveInt(i, pn)), t === "placeholder" && (this._placeholder = i || "Search...", this._input && (this._input.placeholder = this._placeholder)), t === "name" && this._hiddenInput && (this._hiddenInput.name = i || "")); + e !== i && (t === "data-endpoint" && (this._endpoint = i || ""), t === "data-result-key" && (this._resultKey = i || "items"), t === "data-minchars" && (this._minChars = this._parsePositiveInt(i, pn)), t === "data-limit" && (this._limit = this._parsePositiveInt(i, fn)), t === "placeholder" && (this._placeholder = i || "Search...", this._input && (this._input.placeholder = this._placeholder)), t === "name" && this._hiddenInput && (this._hiddenInput.name = i || ""), t === "data-link-base" && (this._linkBase = i || ""), t === "data-link-target" && (this._linkTarget = i || "_blank"), t === "data-link-field" && (this._linkField = i || "id"), t === "data-show-warning-icon" && (this._showWarningIcon = i === "true")); } _handleInput(t) { const e = t.target.value.trim(); @@ -8030,7 +8044,7 @@ class Gc extends HTMLElement { } } _handleClear(t) { - t.preventDefault(), this._selected = null, this._options = [], this._input && (this._input.value = ""), this._syncHiddenInput(), this._renderOptions(), this._hideList(), this.dispatchEvent(new CustomEvent("ssrchange", { bubbles: !0, detail: { item: null } })); + t.preventDefault(), this._selected = null, this._options = [], this._input && (this._input.value = ""), this._syncHiddenInput(), this._updateLinkButton(), this._renderOptions(), this._hideList(), this.dispatchEvent(new CustomEvent("ssrchange", { bubbles: !0, detail: { item: null } })); } _handleClickOutside(t) { this.contains(t.target) || this._hideList(); @@ -8038,47 +8052,62 @@ class Gc extends HTMLElement { _debouncedFetch(t) { this._fetchTimeout && clearTimeout(this._fetchTimeout), this._fetchTimeout = setTimeout(() => { this._fetchOptions(t); - }, Kc); + }, sc); } async _fetchOptions(t) { + var i; if (!this._endpoint) return; this._fetchController && this._fetchController.abort(), this.dispatchEvent(new CustomEvent("ssrbeforefetch", { bubbles: !0 })), this._fetchController = new AbortController(); const e = new URL(this._endpoint, window.location.origin); e.searchParams.set("q", t), this._limit > 0 && e.searchParams.set("limit", String(this._limit)); try { - const i = await fetch(e.toString(), { signal: this._fetchController.signal }); - if (!i.ok) + const n = await fetch(e.toString(), { signal: this._fetchController.signal }); + if (!n.ok) return; - const n = await i.json(); - let o = (Array.isArray(n == null ? void 0 : n[this._resultKey]) ? n[this._resultKey] : []).filter((a) => a && a.id && a.name); + const r = await n.json(); + let o = (Array.isArray(r == null ? void 0 : r[this._resultKey]) ? r[this._resultKey] : []).filter((l) => l && l.id && l.name); if (this._excludeIds && Array.isArray(this._excludeIds)) { - const a = new Set(this._excludeIds); - o = o.filter((l) => !a.has(l.id)); + const l = new Set(this._excludeIds); + o = o.filter((c) => !l.has(c.id)); } - this._options = o, this._highlightedIndex = this._options.length > 0 ? 0 : -1, this._renderOptions(), this._options.length > 0 ? this._showList() : this._hideList(); - } catch (i) { - if ((i == null ? void 0 : i.name) === "AbortError") + this._options = o, this._highlightedIndex = this._options.length > 0 ? 0 : -1, this._maybeAutoSelectExactMatch(t), this._renderOptions(), this._options.length > 0 ? this._options.length === 1 && this._isExactMatch(t, ((i = this._options[0]) == null ? void 0 : i.name) || "") ? this._hideList() : this._showList() : this._hideList(); + } catch (n) { + if ((n == null ? void 0 : n.name) === "AbortError") return; } } + _isExactMatch(t, e) { + const i = (t || "").trim().toLowerCase(), n = (e || "").trim().toLowerCase(); + return i !== "" && i === n; + } + _maybeAutoSelectExactMatch(t) { + var n; + if (!t) + return; + const e = this._options.find((r) => this._isExactMatch(t, (r == null ? void 0 : r.name) || "")); + if (!e) + return; + const i = ((n = this._selected) == null ? void 0 : n.id) || ""; + this._selected = e, this._syncHiddenInput(), this._updateLinkButton(), e.id !== i && (this.dispatchEvent(new CustomEvent("ssrchange", { bubbles: !0, detail: { item: e } })), this.dispatchEvent(new Event("change", { bubbles: !0 }))); + } _renderOptions() { this._list && (this._list.innerHTML = "", this._options.forEach((t) => { const e = document.createElement("button"); e.type = "button", e.setAttribute("data-index", String(this._options.indexOf(t))), e.className = [ - jc, + tc, "w-full text-left px-3 py-2 hover:bg-slate-100 transition-colors" ].join(" "); const n = this._options.indexOf(t) === this._highlightedIndex; e.classList.toggle("bg-slate-100", n), e.classList.toggle("text-gray-900", n), e.setAttribute("aria-selected", n ? "true" : "false"); const r = document.createElement("div"); - if (r.className = [Vc, "text-sm font-semibold text-gray-800"].join(" "), r.textContent = t.name, e.appendChild(r), t.detail) { - const o = document.createElement("div"); - o.className = [zc, "text-xs text-gray-600"].join(" "), o.textContent = t.detail, e.appendChild(o); + if (r.className = [ec, "text-sm font-semibold text-gray-800"].join(" "), r.textContent = t.name, e.appendChild(r), t.detail) { + const a = document.createElement("div"); + a.className = [ic, "text-xs text-gray-600"].join(" "), a.textContent = t.detail, e.appendChild(a); } if (t.bio) { - const o = document.createElement("div"); - o.className = [Wc, "text-xs text-gray-500"].join(" "), o.textContent = t.bio, e.appendChild(o); + const a = document.createElement("div"); + a.className = [nc, "text-xs text-gray-500"].join(" "), a.textContent = t.bio, e.appendChild(a); } e.addEventListener("click", () => { this._selectOption(t); @@ -8108,7 +8137,7 @@ class Gc extends HTMLElement { t && t.scrollIntoView({ block: "nearest" }); } _selectOption(t) { - this._selected = t, this._input && (this._input.value = t.name || ""), this._syncHiddenInput(), this._hideList(), this.dispatchEvent(new CustomEvent("ssrchange", { bubbles: !0, detail: { item: t } })), this.dispatchEvent(new Event("change", { bubbles: !0 })); + this._selected = t, this._input && (this._input.value = t.name || ""), this._syncHiddenInput(), this._updateLinkButton(), this._hideList(), this.dispatchEvent(new CustomEvent("ssrchange", { bubbles: !0, detail: { item: t } })), this.dispatchEvent(new Event("change", { bubbles: !0 })); } _syncHiddenInput() { var t; @@ -8127,35 +8156,54 @@ class Gc extends HTMLElement { _render() { const t = this.getAttribute("name") || ""; this.innerHTML = ` -
    +
    -
    - - + +
    `; } + _updateLinkButton() { + var i, n, r; + if (!this._linkButton) + return; + const t = ((i = this._selected) == null ? void 0 : i[this._linkField]) || ((n = this._selected) == null ? void 0 : n.linkId) || ((r = this._selected) == null ? void 0 : r.id), e = this._linkButton.querySelector("[data-role='ssr-open-link-icon']"); + if (!t || !this._linkBase) { + this._showWarningIcon ? (this._linkButton.classList.remove("hidden"), this._linkButton.removeAttribute("href"), this._linkButton.classList.add("ssr-open-link-warning"), this._linkButton.setAttribute("aria-label", "Auswahl fehlt"), e && (e.className = "ri-error-warning-line")) : (this._linkButton.classList.add("hidden"), this._linkButton.removeAttribute("href")); + return; + } + this._linkButton.classList.remove("hidden"), this._linkButton.classList.remove("ssr-open-link-warning"), this._linkButton.setAttribute("href", `${this._linkBase}${t}`), this._linkButton.setAttribute("aria-label", "Auswahl öffnen"), e && (e.className = "ri-external-link-line"); + } } -const Jc = "Bevorzugter Reihentitel"; -class Yc extends HTMLElement { +const ii = "Bevorzugter Reihentitel"; +class ac extends HTMLElement { constructor() { - super(), this._pendingAgent = null, this._form = null, this._saveButton = null, this._resetButton = null, this._deleteButton = null, this._deleteDialog = null, this._deleteConfirmButton = null, this._deleteCancelButton = null, this._statusEl = null, this._saveEndpoint = "", this._deleteEndpoint = "", this._isSaving = !1, this._handleSaveClick = this._handleSaveClick.bind(this), this._handleResetClick = this._handleResetClick.bind(this), this._handleDeleteClick = this._handleDeleteClick.bind(this), this._handleDeleteConfirmClick = this._handleDeleteConfirmClick.bind(this), this._handleDeleteCancelClick = this._handleDeleteCancelClick.bind(this); + super(), this._pendingAgent = null, this._form = null, this._saveButton = null, this._resetButton = null, this._deleteButton = null, this._deleteDialog = null, this._deleteConfirmButton = null, this._deleteCancelButton = null, this._statusEl = null, this._saveEndpoint = "", this._deleteEndpoint = "", this._isSaving = !1, this._preferredSeriesRelationId = "", this._preferredSeriesSeriesId = "", this._handleSaveClick = this._handleSaveClick.bind(this), this._handleResetClick = this._handleResetClick.bind(this), this._handleDeleteClick = this._handleDeleteClick.bind(this), this._handleDeleteConfirmClick = this._handleDeleteConfirmClick.bind(this), this._handleDeleteCancelClick = this._handleDeleteCancelClick.bind(this); } connectedCallback() { setTimeout(() => { - this._initForm(), this._initPlaces(), this._initSaveHandling(), this._initStatusSelect(); + this._initForm(), this._initPlaces(), this._initPreferredSeries(), this._initSaveHandling(), this._initStatusSelect(); }, 0); } _initStatusSelect() { @@ -8234,6 +8282,10 @@ class Yc extends HTMLElement { _initSaveHandling() { this._teardownSaveHandling(), this._form = this.querySelector("#changealmanachform"), this._saveButton = this.querySelector("[data-role='almanach-save']"), this._resetButton = this.querySelector("[data-role='almanach-reset']"), this._deleteButton = this.querySelector("[data-role='almanach-delete']"), this._deleteDialog = this.querySelector("[data-role='almanach-delete-dialog']"), this._deleteConfirmButton = this.querySelector("[data-role='almanach-delete-confirm']"), this._deleteCancelButton = this.querySelector("[data-role='almanach-delete-cancel']"), this._statusEl = this.querySelector("#almanach-save-feedback"), !(!this._form || !this._saveButton) && (this._saveEndpoint = this._form.getAttribute("data-save-endpoint") || this._deriveSaveEndpoint(), this._deleteEndpoint = this._form.getAttribute("data-delete-endpoint") || "", this._saveButton.addEventListener("click", this._handleSaveClick), this._resetButton && this._resetButton.addEventListener("click", this._handleResetClick), this._deleteButton && this._deleteButton.addEventListener("click", this._handleDeleteClick), this._deleteConfirmButton && this._deleteConfirmButton.addEventListener("click", this._handleDeleteConfirmClick), this._deleteCancelButton && this._deleteCancelButton.addEventListener("click", this._handleDeleteCancelClick), this._deleteDialog && this._deleteDialog.addEventListener("cancel", this._handleDeleteCancelClick)); } + _initPreferredSeries() { + const t = this.querySelector("#preferred-series-field"); + t && (this._preferredSeriesRelationId = t.getAttribute("data-preferred-relation-id") || "", this._preferredSeriesSeriesId = t.getAttribute("data-preferred-series-id") || ""); + } _teardownSaveHandling() { this._saveButton && this._saveButton.removeEventListener("click", this._handleSaveClick), this._resetButton && this._resetButton.removeEventListener("click", this._handleResetClick), this._deleteButton && this._deleteButton.removeEventListener("click", this._handleDeleteClick), this._deleteConfirmButton && this._deleteConfirmButton.removeEventListener("click", this._handleDeleteConfirmClick), this._deleteCancelButton && this._deleteCancelButton.removeEventListener("click", this._handleDeleteCancelClick), this._deleteDialog && this._deleteDialog.removeEventListener("cancel", this._handleDeleteCancelClick), this._saveButton = null, this._resetButton = null, this._deleteButton = null, this._deleteDialog = null, this._deleteConfirmButton = null, this._deleteCancelButton = null, this._statusEl = null; } @@ -8321,11 +8373,11 @@ class Yc extends HTMLElement { r = null; } if (!n.ok) { - const a = (r == null ? void 0 : r.error) || `Löschen fehlgeschlagen (${n.status}).`; - throw new Error(a); + const o = (r == null ? void 0 : r.error) || `Löschen fehlgeschlagen (${n.status}).`; + throw new Error(o); } - const o = (r == null ? void 0 : r.redirect) || "/suche/baende"; - window.location.assign(o); + const a = (r == null ? void 0 : r.redirect) || "/suche/baende"; + window.location.assign(a); } catch (e) { this._showStatus(e instanceof Error ? e.message : "Löschen fehlgeschlagen.", "error"); } finally { @@ -8363,90 +8415,111 @@ class Yc extends HTMLElement { if (Number.isNaN(n)) throw new Error("Jahr ist ungültig."); e.year = n; - const r = t.getAll("languages[]").map((k) => k.trim()).filter(Boolean), o = t.getAll("places[]").map((k) => k.trim()).filter(Boolean), { items: a, removedIds: l } = this._collectItems(t), { - relations: d, + const r = t.getAll("languages[]").map((E) => E.trim()).filter(Boolean), a = t.getAll("places[]").map((E) => E.trim()).filter(Boolean), { items: o, removedIds: l } = this._collectItems(t), { + relations: c, deleted: h } = this._collectRelations(t, { prefix: "entries_series", targetField: "series" - }), m = this._collectNewRelations("entries_series"), f = [...d, ...m].filter( - (k) => k.type === Jc + }), m = this._collectNewRelations("entries_series"), p = this._readValue(t, "preferred_series_id"); + if (!p) + throw new Error("Reihentitel ist erforderlich."); + const u = (E) => { + E.type = ii, E.uncertain = !1; + }; + let b = !1; + c.forEach((E) => { + E.target_id === p && (u(E), b = !0); + }), m.forEach((E) => { + E.target_id === p && (u(E), b = !0); + }), b || (this._preferredSeriesRelationId && this._preferredSeriesSeriesId === p ? c.push({ + id: this._preferredSeriesRelationId, + target_id: p, + type: ii, + uncertain: !1 + }) : m.push({ + target_id: p, + type: ii, + uncertain: !1 + })), this._preferredSeriesRelationId && this._preferredSeriesSeriesId && this._preferredSeriesSeriesId !== p && !h.includes(this._preferredSeriesRelationId) && h.push(this._preferredSeriesRelationId); + const A = [...c, ...m].filter( + (E) => E.type === ii ).length; - if (f === 0) + if (A === 0) throw new Error("Mindestens ein bevorzugter Reihentitel muss verknüpft sein."); - if (f > 1) + if (A > 1) throw new Error("Es darf nur ein bevorzugter Reihentitel gesetzt sein."); const { - relations: u, - deleted: b + relations: I, + deleted: F } = this._collectRelations(t, { prefix: "entries_agents", targetField: "agent" - }), E = this._collectNewRelations("entries_agents"), P = [...d, ...m].map((k) => k.target_id); - if (P.filter((k, _) => P.indexOf(k) !== _).length > 0) + }), R = this._collectNewRelations("entries_agents"), _ = [...c, ...m].map((E) => E.target_id); + if (_.filter((E, V) => _.indexOf(E) !== V).length > 0) throw new Error("Doppelte Reihenverknüpfungen sind nicht erlaubt."); return { csrf_token: this._readValue(t, "csrf_token"), last_edited: this._readValue(t, "last_edited"), entry: e, languages: r, - places: o, - items: a, + places: a, + items: o, deleted_item_ids: l, - series_relations: d, + series_relations: c, new_series_relations: m, deleted_series_relation_ids: h, - agent_relations: u, - new_agent_relations: E, - deleted_agent_relation_ids: b + agent_relations: I, + new_agent_relations: R, + deleted_agent_relation_ids: F }; } _collectItems(t) { - const e = t.getAll("items_id[]").map((m) => m.trim()), i = t.getAll("items_owner[]"), n = t.getAll("items_identifier[]"), r = t.getAll("items_location[]"), o = t.getAll("items_media[]"), a = t.getAll("items_annotation[]"), l = t.getAll("items_uri[]"), d = new Set( + const e = t.getAll("items_id[]").map((m) => m.trim()), i = t.getAll("items_owner[]"), n = t.getAll("items_identifier[]"), r = t.getAll("items_location[]"), a = t.getAll("items_media[]"), o = t.getAll("items_annotation[]"), l = t.getAll("items_uri[]"), c = new Set( t.getAll("items_removed[]").map((m) => m.trim()).filter(Boolean) ), h = []; for (let m = 0; m < e.length; m += 1) { - const f = e[m] || ""; - if (f && d.has(f)) + const p = e[m] || ""; + if (p && c.has(p)) continue; - const u = (i[m] || "").trim(), b = (n[m] || "").trim(), E = (r[m] || "").trim(), I = (a[m] || "").trim(), P = (l[m] || "").trim(), R = (o[m] || "").trim(); - if (f || u || b || E || I || P || R) { + const u = (i[m] || "").trim(), b = (n[m] || "").trim(), A = (r[m] || "").trim(), I = (o[m] || "").trim(), F = (l[m] || "").trim(), R = (a[m] || "").trim(); + if (p || u || b || A || I || F || R) { if (!R) throw new Error(`Exemplar ${m + 1}: "Vorhanden als" muss ausgefüllt werden.`); h.push({ - id: f, + id: p, owner: u, identifier: b, - location: E, + location: A, annotation: I, - uri: P, + uri: F, media: R ? [R] : [] }); } } return { items: h, - removedIds: Array.from(d) + removedIds: Array.from(c) }; } _collectRelations(t, { prefix: e, targetField: i }) { const n = [], r = []; - for (const [o, a] of t.entries()) { - if (!o.startsWith(`${e}_id[`)) + for (const [a, o] of t.entries()) { + if (!a.startsWith(`${e}_id[`)) continue; - const l = o.slice(o.indexOf("[") + 1, -1), d = `${e}_${i}[${l}]`, h = `${e}_type[${l}]`, m = `${e}_delete[${l}]`, f = `${e}_uncertain[${l}]`, u = (a || "").trim(), b = (t.get(d) || "").trim(); + const l = a.slice(a.indexOf("[") + 1, -1), c = `${e}_${i}[${l}]`, h = `${e}_type[${l}]`, m = `${e}_delete[${l}]`, p = `${e}_uncertain[${l}]`, u = (o || "").trim(), b = (t.get(c) || "").trim(); if (!b || !u) continue; if (t.has(m)) { r.push(u); continue; } - const E = (t.get(h) || "").trim(); + const A = (t.get(h) || "").trim(); n.push({ id: u, target_id: b, - type: E, - uncertain: t.has(f) + type: A, + uncertain: t.has(p) }); } return { relations: n, deleted: r }; @@ -8457,13 +8530,13 @@ class Yc extends HTMLElement { return []; const i = e.querySelectorAll("[data-role='relation-add-row'] [data-rel-row]"), n = []; return i.forEach((r) => { - const o = r.querySelector(`input[name='${t}_new_id']`), a = r.querySelector(`select[name='${t}_new_type']`), l = r.querySelector(`input[name='${t}_new_uncertain']`); - if (!o) + const a = r.querySelector(`input[name='${t}_new_id']`), o = r.querySelector(`select[name='${t}_new_type']`), l = r.querySelector(`input[name='${t}_new_uncertain']`); + if (!a) return; - const d = o.value.trim(); - d && n.push({ - target_id: d, - type: ((a == null ? void 0 : a.value) || "").trim(), + const c = a.value.trim(); + c && n.push({ + target_id: c, + type: ((o == null ? void 0 : o.value) || "").trim(), uncertain: !!(l != null && l.checked) }); }), n; @@ -8480,10 +8553,10 @@ class Yc extends HTMLElement { e && (e.textContent = t ? "Speichern..." : "Speichern"), this._resetButton && (this._resetButton.disabled = t), this._deleteButton && (this._deleteButton.disabled = t); } _clearStatus() { - this._statusEl && (this._statusEl.textContent = "", this._statusEl.classList.remove("text-red-700", "text-green-700")); + this._statusEl && (this._statusEl.textContent = "", this._statusEl.classList.remove("text-red-700", "text-green-700", "save-feedback-error", "save-feedback-success"), this._statusEl.classList.add("hidden")); } _showStatus(t, e) { - this._statusEl && (this._clearStatus(), this._statusEl.textContent = t, e === "success" ? this._statusEl.classList.add("text-green-700") : e === "error" && this._statusEl.classList.add("text-red-700")); + this._statusEl && (this._clearStatus(), this._statusEl.textContent = t, this._statusEl.classList.remove("hidden"), e === "success" ? this._statusEl.classList.add("text-green-700", "save-feedback-success") : e === "error" && this._statusEl.classList.add("text-red-700", "save-feedback-error")); } async _reloadForm(t) { this._teardownSaveHandling(); @@ -8496,22 +8569,22 @@ class Yc extends HTMLElement { }); if (!i.ok) throw new Error("Formular konnte nicht aktualisiert werden."); - const n = await i.text(), o = new DOMParser().parseFromString(n, "text/html"), a = o.querySelector("#changealmanachform"), l = this.querySelector("#changealmanachform"); - if (!a || !l) + const n = await i.text(), a = new DOMParser().parseFromString(n, "text/html"), o = a.querySelector("#changealmanachform"), l = this.querySelector("#changealmanachform"); + if (!o || !l) throw new Error("Formular konnte nicht geladen werden."); - l.replaceWith(a), this._form = a; - const d = o.querySelector("#user-message"), h = this.querySelector("#user-message"); - d && h && h.replaceWith(d); - const m = o.querySelector("#almanach-header-data"), f = this.querySelector("#almanach-header-data"); - m && f && f.replaceWith(m), this._initForm(), this._initPlaces(), this._initSaveHandling(), typeof window.TextareaAutoResize == "function" && setTimeout(() => { + l.replaceWith(o), this._form = o; + const c = a.querySelector("#user-message"), h = this.querySelector("#user-message"); + c && h && h.replaceWith(c); + const m = a.querySelector("#almanach-header-data"), p = this.querySelector("#almanach-header-data"); + m && p && p.replaceWith(m), this._initForm(), this._initPlaces(), this._initSaveHandling(), typeof window.TextareaAutoResize == "function" && setTimeout(() => { this.querySelectorAll("textarea").forEach((u) => { window.TextareaAutoResize(u); }); }, 100); } } -const Xc = "[data-role='relation-add-toggle']", Qc = "[data-role='relation-add-panel']", Zc = "[data-role='relation-add-close']", td = "[data-role='relation-add-apply']", ed = "[data-role='relation-add-error']", id = "[data-role='relation-add-row']", nd = "[data-role='relation-add-select']", sd = "[data-role='relation-type-select']", rd = "[data-role='relation-uncertain']", od = "template[data-role='relation-new-template']", Cr = "[data-role='relation-new-delete']", Yt = "[data-rel-row]"; -class ad extends HTMLElement { +const oc = "[data-role='relation-add-toggle']", lc = "[data-role='relation-add-panel']", dc = "[data-role='relation-add-close']", cc = "[data-role='relation-add-apply']", hc = "[data-role='relation-add-error']", uc = "[data-role='relation-add-row']", mc = "[data-role='relation-add-select']", gc = "[data-role='relation-type-select']", pc = "[data-role='relation-uncertain']", fc = "template[data-role='relation-new-template']", Tr = "[data-role='relation-new-delete']", Yt = "[data-rel-row]"; +class bc extends HTMLElement { constructor() { super(), this._pendingItem = null, this._pendingApply = !1; } @@ -8535,11 +8608,11 @@ class ad extends HTMLElement { this._addPanel && !this._addPanel.classList.contains("hidden") || e || i ? this._emptyText.classList.add("hidden") : this._emptyText.classList.remove("hidden"); } _setupAddPanel() { - if (this._addToggle = this.querySelector(Xc), this._addToggleId) { + if (this._addToggle = this.querySelector(oc), this._addToggleId) { const t = document.getElementById(this._addToggleId); t && (this._addToggle = t); } - this._addPanel = this.querySelector(Qc), this._addClose = this.querySelector(Zc), this._addApply = this.querySelector(td), this._addError = this.querySelector(ed), this._addRow = this.querySelector(id), this._addSelect = this.querySelector(nd), this._typeSelect = this.querySelector(sd), this._uncertain = this.querySelector(rd), this._template = this.querySelector(od), this._addInput = this._addSelect ? this._addSelect.querySelector(".ssr-input") : null, !(!this._addPanel || !this._addRow || !this._addSelect || !this._typeSelect || !this._uncertain || !this._template) && (this._addSelect && this._prefix === "entries_series" && this._addSelect.addEventListener("ssrbeforefetch", () => { + this._addPanel = this.querySelector(lc), this._addClose = this.querySelector(dc), this._addApply = this.querySelector(cc), this._addError = this.querySelector(hc), this._addRow = this.querySelector(uc), this._addSelect = this.querySelector(mc), this._typeSelect = this.querySelector(gc), this._uncertain = this.querySelector(pc), this._template = this.querySelector(fc), this._addInput = this._addSelect ? this._addSelect.querySelector(".ssr-input") : null, !(!this._addPanel || !this._addRow || !this._addSelect || !this._typeSelect || !this._uncertain || !this._template) && (this._addSelect && this._prefix === "entries_series" && this._addSelect.addEventListener("ssrbeforefetch", () => { this._addSelect._excludeIds = Array.from(this._getExistingIds()); }), this._addToggle && this._addToggle.addEventListener("click", () => { const t = this._addPanel.classList.contains("hidden"); @@ -8584,12 +8657,12 @@ class ad extends HTMLElement { i && i.setAttribute("href", `${this._linkBase}${this._pendingItem.id}`); const n = t.querySelector("[data-rel-name]"); n && (n.textContent = this._pendingItem.name || ""); - const r = t.querySelector("[data-rel-detail]"), o = t.querySelector("[data-rel-detail-container]"), a = this._pendingItem.detail || this._pendingItem.bio || ""; - r && a ? r.textContent = a : o && o.remove(); + const r = t.querySelector("[data-rel-detail]"), a = t.querySelector("[data-rel-detail-container]"), o = this._pendingItem.detail || this._pendingItem.bio || ""; + r && o ? r.textContent = o : a && a.remove(); const l = t.querySelector("[data-rel-new]"); l && (l.textContent = this._newLabel); - const d = t.querySelector("[data-rel-input='type']"); - d && this._typeSelect && (d.innerHTML = this._typeSelect.innerHTML, d.value = this._typeSelect.value, d.name = `${this._prefix}_new_type`, d.addEventListener("change", () => this._updatePreferredOptions())); + const c = t.querySelector("[data-rel-input='type']"); + c && this._typeSelect && (c.innerHTML = this._typeSelect.innerHTML, c.value = this._typeSelect.value, c.name = `${this._prefix}_new_type`, c.addEventListener("change", () => this._updatePreferredOptions())); const h = t.querySelector("[data-rel-input='uncertain']"); if (h && this._uncertain) { h.checked = this._uncertain.checked, h.name = `${this._prefix}_new_uncertain`, h.value = this._pendingItem.id; @@ -8600,8 +8673,8 @@ class ad extends HTMLElement { } const m = t.querySelector("[data-rel-input='id']"); m && (m.name = `${this._prefix}_new_id`, m.value = this._pendingItem.id); - const f = t.querySelector(Cr); - f && f.addEventListener("click", () => { + const p = t.querySelector(Tr); + p && p.addEventListener("click", () => { e.remove(), this._pendingItem = null, this._clearAddPanel(), this._addPanel && this._addPanel.classList.add("hidden"), this._updateEmptyTextVisibility(); }), this._addRow.appendChild(t), this._pendingItem = null, this._clearAddPanel(), this._addPanel && this._addPanel.classList.add("hidden"), this._updateEmptyTextVisibility(), this._updatePreferredOptions(); } @@ -8616,13 +8689,13 @@ class ad extends HTMLElement { n && (n.classList.toggle("bg-red-50", i.checked), n.querySelectorAll("select, input[type='checkbox']").forEach((l) => { l !== i && (l.disabled = i.checked); })); - const r = t.matches(":hover"), o = t.querySelector("[data-delete-label]"); - if (o) { + const r = t.matches(":hover"), a = t.querySelector("[data-delete-label]"); + if (a) { let l; - i.checked && r ? l = o.getAttribute("data-delete-hover") || "Rückgängig" : i.checked ? l = o.getAttribute("data-delete-active") || "Wird entfernt" : l = o.getAttribute("data-delete-default") || "Entfernen", o.textContent = l; + i.checked && r ? l = a.getAttribute("data-delete-hover") || "Rückgängig" : i.checked ? l = a.getAttribute("data-delete-active") || "Wird entfernt" : l = a.getAttribute("data-delete-default") || "Entfernen", a.textContent = l; } - const a = t.querySelector("i"); - a && (i.checked ? r ? (a.classList.remove("hidden"), a.classList.add("ri-arrow-go-back-line"), a.classList.remove("ri-delete-bin-line")) : (a.classList.add("hidden"), a.classList.remove("ri-delete-bin-line", "ri-arrow-go-back-line")) : (a.classList.remove("hidden"), a.classList.add("ri-delete-bin-line"), a.classList.remove("ri-arrow-go-back-line"))), this._updatePreferredOptions(); + const o = t.querySelector("i"); + o && (i.checked ? r ? (o.classList.remove("hidden"), o.classList.add("ri-arrow-go-back-line"), o.classList.remove("ri-delete-bin-line")) : (o.classList.add("hidden"), o.classList.remove("ri-delete-bin-line", "ri-arrow-go-back-line")) : (o.classList.remove("hidden"), o.classList.add("ri-delete-bin-line"), o.classList.remove("ri-arrow-go-back-line"))), this._updatePreferredOptions(); }), t.addEventListener("mouseenter", () => { const e = t.getAttribute("data-delete-toggle"), i = this.querySelector(`#${CSS.escape(e)}`); if (!i || !i.checked) @@ -8642,7 +8715,7 @@ class ad extends HTMLElement { }); } _setupNewRowDeletes() { - this._addRow && this._addRow.querySelectorAll(Cr).forEach((t) => { + this._addRow && this._addRow.querySelectorAll(Tr).forEach((t) => { t.dataset.relationNewBound !== "true" && (t.dataset.relationNewBound = "true", t.addEventListener("click", () => { const e = t.closest(Yt); e && e.remove(), this._pendingItem = null, this._clearAddPanel(), this._addPanel && this._addPanel.classList.add("hidden"), this._updateEmptyTextVisibility(), this._updatePreferredOptions(); @@ -8663,34 +8736,34 @@ class ad extends HTMLElement { }), this._addRow && this._addRow.querySelectorAll(`select[name='${this._prefix}_new_type']`).forEach((n) => { e.push({ select: n, row: n.closest(Yt), isAddPanel: !1 }); }), this._typeSelect && e.push({ select: this._typeSelect, row: this._typeSelect.closest(Yt), isAddPanel: !0 }); - const i = e.some(({ select: n, row: r, isAddPanel: o }) => { - if (o) + const i = e.some(({ select: n, row: r, isAddPanel: a }) => { + if (a) return !1; - const a = ((n == null ? void 0 : n.value) || "").trim(); - if (!n || a !== t) + const o = ((n == null ? void 0 : n.value) || "").trim(); + if (!n || o !== t) return !1; if (!r) return !0; const l = r.querySelector(`input[name^="${this._prefix}_delete["]`); return !(l && l.checked); }); - e.forEach(({ select: n, row: r, isAddPanel: o }) => { + e.forEach(({ select: n, row: r, isAddPanel: a }) => { if (!n) return; - const a = Array.from(n.options).find((u) => u.value.trim() === t); - if (!a) + const o = Array.from(n.options).find((u) => u.value.trim() === t); + if (!o) return; - const l = r ? r.querySelector(`input[name^="${this._prefix}_delete["]`) : null, d = !!(l && l.checked), h = (n.value || "").trim(), m = !i || h === t && !d; - if (o && i && h === t) { + const l = r ? r.querySelector(`input[name^="${this._prefix}_delete["]`) : null, c = !!(l && l.checked), h = (n.value || "").trim(), m = !i || h === t && !c; + if (a && i && h === t) { const u = Array.from(n.options).find((b) => b.value.trim() !== t); u && (n.value = u.value); } - const f = !m || o && i; - a.hidden = f, a.disabled = f, a.style.display = f ? "none" : ""; + const p = !m || a && i; + o.hidden = p, o.disabled = p, o.style.display = p ? "none" : ""; }); } } -class ld extends HTMLElement { +class _c extends HTMLElement { connectedCallback() { setTimeout(() => { const t = this.querySelector("form"); @@ -8703,8 +8776,8 @@ class ld extends HTMLElement { var n; const i = (n = e.parentElement) == null ? void 0 : n.querySelector(".status-icon"); e.addEventListener("change", (r) => { - const o = r.target.value; - e.setAttribute("data-status", o), i && this._updateStatusIcon(i, o); + const a = r.target.value; + e.setAttribute("data-status", a), i && this._updateStatusIcon(i, a); }); }); } @@ -8741,20 +8814,20 @@ class ld extends HTMLElement { const e = t.getAttribute("data-delete-endpoint"); if (!e) return; - const i = this.querySelector("[data-role='edit-delete-dialog']"), n = this.querySelector("[data-role='edit-delete']"), r = this.querySelector("[data-role='edit-delete-confirm']"), o = this.querySelector("[data-role='edit-delete-cancel']"); - if (!i || !n || !r || !o) + const i = this.querySelector("[data-role='edit-delete-dialog']"), n = this.querySelector("[data-role='edit-delete']"), r = this.querySelector("[data-role='edit-delete-confirm']"), a = this.querySelector("[data-role='edit-delete-cancel']"); + if (!i || !n || !r || !a) return; n.addEventListener("click", (l) => { l.preventDefault(), typeof i.showModal == "function" && i.showModal(); }); - const a = (l) => { + const o = (l) => { l && l.preventDefault(), i.open && i.close(); }; - o.addEventListener("click", a), i.addEventListener("cancel", a), r.addEventListener("click", async (l) => { - l.preventDefault(), a(); - const d = new FormData(t), h = { - csrf_token: d.get("csrf_token") || "", - last_edited: d.get("last_edited") || "" + a.addEventListener("click", o), i.addEventListener("cancel", o), r.addEventListener("click", async (l) => { + l.preventDefault(), o(); + const c = new FormData(t), h = { + csrf_token: c.get("csrf_token") || "", + last_edited: c.get("last_edited") || "" }, m = await fetch(e, { method: "POST", headers: { @@ -8765,36 +8838,36 @@ class ld extends HTMLElement { }); if (!m.ok) return; - const f = await m.json().catch(() => null), u = (f == null ? void 0 : f.redirect) || "/"; + const p = await m.json().catch(() => null), u = (p == null ? void 0 : p.redirect) || "/"; window.location.assign(u); }); } } -class cd extends HTMLElement { +class vc extends HTMLElement { constructor() { super(), this.state = null, this.handleClick = this.handleClick.bind(this), this.handleClickAway = this.handleClickAway.bind(this); } connectedCallback() { var Ne; - const t = this.getAttribute("data-user-name") || "Benutzer", e = this.getAttribute("data-user-email") || "", i = this.getAttribute("data-user-id") || "", n = this.getAttribute("data-is-admin-or-editor") === "true", r = this.getAttribute("data-is-admin") === "true", o = this.getAttribute("data-redirect-path") || "", a = window.location.pathname; - let l = !1, d = "", h = !1, m = "", f = !1, u = !1, b = !1, E = "", I = !1, P = "", R = "", k = !1, _ = ""; - const S = a.match(/^\/reihe\/([^\/]+)\/?$/); + const t = this.getAttribute("data-user-name") || "Benutzer", e = this.getAttribute("data-user-email") || "", i = this.getAttribute("data-user-id") || "", n = this.getAttribute("data-is-admin-or-editor") === "true", r = this.getAttribute("data-is-admin") === "true", a = this.getAttribute("data-redirect-path") || "", o = window.location.pathname; + let l = !1, c = "", h = !1, m = "", p = !1, u = !1, b = !1, A = "", I = !1, F = "", R = "", H = !1, _ = ""; + const S = o.match(/^\/reihe\/([^\/]+)\/?$/); if (S && S[1] !== "new") { - l = !0, d = S[1]; + l = !0, c = S[1]; const Z = document.querySelector('meta[name="entity-updated"]'); Z && Z.content; } - const q = a.match(/^\/person\/([^\/]+)\/?$/); - q && q[1] !== "new" && (h = !0, m = q[1]); - const K = a.match(/^\/almanach\/([^\/]+)\/?$/); - if (K && K[1] !== "new") { - b = !0, E = K[1]; + const E = o.match(/^\/person\/([^\/]+)\/?$/); + E && E[1] !== "new" && (h = !0, m = E[1]); + const V = o.match(/^\/almanach\/([^\/]+)\/?$/); + if (V && V[1] !== "new") { + b = !0, A = V[1]; const Z = document.querySelector('meta[name="entity-updated"]'); Z && Z.content; } - const dt = a.match(/^\/beitrag\/([^\/]+)\/?$/); - if (dt) { - I = !0, P = dt[1]; + const ct = o.match(/^\/beitrag\/([^\/]+)\/?$/); + if (ct) { + I = !0, F = ct[1]; const Z = document.querySelector('#breadcrumbs a[href^="/almanach/"]'); if (Z) { const mt = (Ne = Z.getAttribute("href")) == null ? void 0 : Ne.match(/^\/almanach\/([^\/#]+)/); @@ -8803,9 +8876,9 @@ class cd extends HTMLElement { } const yt = document.querySelector('meta[name="page-key"]'); if (yt && yt.content) - k = !0, _ = yt.content; + H = !0, _ = yt.content; else { - const Z = a.match(/^\/redaktion\/([^\/]+)\/?$/), mt = Z ? Z[1] : ""; + const Z = o.match(/^\/redaktion\/([^\/]+)\/?$/), mt = Z ? Z[1] : ""; mt && (/* @__PURE__ */ new Set([ "kontakt", "danksagungen", @@ -8813,17 +8886,17 @@ class cd extends HTMLElement { "einleitung", "benutzerhinweise", "lesekabinett" - ])).has(mt) ? (k = !0, _ = mt) : (a === "/" || a === "/index/") && (k = !0, _ = "index"); + ])).has(mt) ? (H = !0, _ = mt) : (o === "/" || o === "/index/") && (H = !0, _ = "index"); } - (a === "/reihen" || a === "/reihen/") && (f = !0), (a === "/personen" || a === "/personen/") && (u = !0); + (o === "/reihen" || o === "/reihen/") && (p = !0), (o === "/personen" || o === "/personen/") && (u = !0); const Be = document.querySelector('input[name="csrf_token"]'); - Be && Be.value, this.hasContext = l || h || b || I || k || f || u; + Be && Be.value, this.hasContext = l || h || b || I || H || p || u; let et = ""; n && l ? et = `
    Reihe
    - + Bearbeiten @@ -8839,15 +8912,15 @@ class cd extends HTMLElement {
    Almanach
    - + Bearbeiten - + Beiträge bearbeiten - + Neuer Beitrag @@ -8855,7 +8928,7 @@ class cd extends HTMLElement {
    Beitrag
    - + Bearbeiten @@ -8867,7 +8940,7 @@ class cd extends HTMLElement { Neuer Beitrag - ` : n && f ? et = ` + ` : n && p ? et = `
    Reihen
    @@ -8883,7 +8956,7 @@ class cd extends HTMLElement { Neue Person - ` : n && k && (et = ` + ` : n && H && (et = `
    Seite
    @@ -8983,43 +9056,43 @@ class cd extends HTMLElement {
    - ` : "", oe = r ? ` + ` : "", ae = r ? `
    Administration
    - ` : "", ae = et || "", bi = et ? '
    ' : ""; + ` : "", oe = et || "", _i = et ? '
    ' : ""; this.innerHTML = `