var $o = Object.defineProperty;
var ms = (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;
} }, 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) => {
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) {
switch (s) {
case 0:
return "0 ".concat(v.bytes);
case 1:
return "1 ".concat(v.byte);
default:
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]);
}
} };
const ui = "\uFEFF", Lt = " ", Fr = 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());
};
return h.destroy = () => a.removeEventListener(s, h, d), a.addEventListener(s, h, d), h;
}, qr = 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;
}, 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);
}, 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;
if (s != null) {
if (t == null) return s;
if (s.closest && e == null) return s.closest(t);
for (; s && s !== e; ) {
if (Hr(s, t)) return s;
s = s.parentNode;
}
}
}, On = (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) {
var t;
if ((t = s) === null || t === void 0 || !t.parentNode) return;
let e = 0;
for (s = s.previousSibling; s; ) e++, s = s.previousSibling;
return e;
}, wt = (s) => {
var t;
return s == null || (t = s.parentNode) === null || t === void 0 ? void 0 : t.removeChild(s);
}, ri = function(s) {
let { onlyNodesOfType: t, usingFilter: e, expandEntityReferences: i } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
const n = (() => {
switch (t) {
case "element":
return NodeFilter.SHOW_ELEMENT;
case "text":
return NodeFilter.SHOW_TEXT;
case "comment":
return NodeFilter.SHOW_COMMENT;
default:
return NodeFilter.SHOW_ALL;
}
})();
return document.createTreeWalker(s, n, e ?? null, i === !0);
}, J = (s) => {
var t;
return s == null || (t = s.tagName) === null || t === void 0 ? void 0 : t.toLowerCase();
}, A = 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);
if (i.editable != null && (i.attributes == null && (i.attributes = {}), i.attributes.contenteditable = i.editable), i.attributes) for (t in i.attributes) e = i.attributes[t], n.setAttribute(t, e);
if (i.style) for (t in i.style) e = i.style[t], n.style[t] = e;
if (i.data) for (t in i.data) e = i.data[t], n.dataset[t] = e;
return i.className && i.className.split(" ").forEach((r) => {
n.classList.add(r);
}), i.textContent && (n.textContent = i.textContent), i.childNodes && [].concat(i.childNodes).forEach((r) => {
n.appendChild(r);
}), n;
};
let ue;
const Ee = function() {
if (ue != null) return ue;
ue = [];
for (const s in Y) {
const t = Y[s];
t.tagName && ue.push(t.tagName);
}
return ue;
}, Oi = (s) => Zt(s == null ? void 0 : s.firstChild), fs = 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) {
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() {
return this.level2Enabled && Oe.supportsInputEvents ? 2 : 0;
}, pickFiles(s) {
const t = A("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: `
` }, 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: () => `
`) };
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 {
static proxyMethod(t) {
const { name: e, toMethod: i, toProperty: n, optional: r } = Ko(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));
};
}
}
const Ko = function(s) {
const t = s.match(Go);
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 {
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));
}
static fromCodepoints(t) {
return new this(vn(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;
}
offsetFromUCS2Offset(t) {
return bn(this.ucs2String.slice(0, Math.max(0, t))).length;
}
slice() {
return this.constructor.fromCodepoints(this.codepoints.slice(...arguments));
}
charAt(t) {
return this.slice(t, t + 1);
}
isEqualTo(t) {
return this.constructor.box(t).ucs2String === this.ucs2String;
}
toJSON() {
return this.ucs2String;
}
getCacheKey() {
return this.ucs2String;
}
toString() {
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 t = [];
let e = 0;
const { length: i } = s;
for (; e < i; ) {
let n = s.charCodeAt(e++);
if (55296 <= n && n <= 56319 && e < i) {
const r = s.charCodeAt(e++);
(64512 & r) == 56320 ? n = ((1023 & n) << 10) + (1023 & r) + 65536 : e--;
}
t.push(n);
}
return t;
}, vn = Xo ? (s) => String.fromCodePoint(...Array.from(s || [])) : function(s) {
return (() => {
const t = [];
return Array.from(s).forEach((e) => {
let i = "";
e > 65535 && (e -= 65536, i += String.fromCharCode(e >>> 10 & 1023 | 55296), e = 56320 | 1023 & e), t.push(i + String.fromCharCode(e));
}), t;
})().join("");
};
let Qo = 0;
class Ht extends F {
static fromJSONString(t) {
return this.fromJSON(JSON.parse(t));
}
constructor() {
super(...arguments), this.id = ++Qo;
}
hasSameConstructorAs(t) {
return this.constructor === (t == null ? void 0 : t.constructor);
}
isEqualTo(t) {
return this === t;
}
inspect() {
const t = [], e = this.contentsForInspection() || {};
for (const i in e) {
const n = e[i];
t.push("".concat(i, "=").concat(n));
}
return "#<".concat(this.constructor.name, ":").concat(this.id).concat(t.length ? " ".concat(t.join(", ")) : "", ">");
}
contentsForInspection() {
}
toJSONString() {
return JSON.stringify(this);
}
toUTF16String() {
return ke.box(this);
}
getCacheKey() {
return this.id.toString();
}
}
const Ft = function() {
let s = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
if (s.length !== t.length) return !1;
for (let e = 0; e < s.length; e++)
if (s[e] !== t[e]) return !1;
return !0;
}, Bn = 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");
e.appendChild(s), e.appendChild(t);
const i = function() {
try {
return new FormData(e).has(t.dirName);
} catch {
return !1;
}
}(), n = function() {
try {
return s.matches(":dir(ltr),:dir(rtl)");
} catch {
return !1;
}
}();
return i ? function(r) {
return t.value = r, new FormData(e).get(t.dirName);
} : 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";
};
}();
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) {
const t = document.createElement("style");
t.setAttribute("type", "text/css"), t.setAttribute("data-tag-name", s.toLowerCase());
const e = sa();
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");
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) {
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() {
let s = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
const t = {};
for (const e in s) {
const i = s[e];
t[e] = i;
}
return t;
}, ne = function() {
let s = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
if (Object.keys(s).length !== Object.keys(t).length) return !1;
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) {
if (s == null) return;
const [t, e] = T(s);
return An(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) {
return typeof s == "number" ? s === t : ne(s, t);
};
class Kr extends F {
constructor() {
super(...arguments), this.update = this.update.bind(this), this.selectionManagers = [];
}
start() {
this.started || (this.started = !0, document.addEventListener("selectionchange", this.update, !0));
}
stop() {
if (this.started) return this.started = !1, document.removeEventListener("selectionchange", this.update, !0);
}
registerSelectionManager(t) {
if (!this.selectionManagers.includes(t)) return this.selectionManagers.push(t), this.start();
}
unregisterSelectionManager(t) {
if (this.selectionManagers = this.selectionManagers.filter((e) => e !== t), this.selectionManagers.length === 0) return this.stop();
}
notifySelectionManagersOfSelectionChange() {
return this.selectionManagers.map((t) => t.selectionDidChange());
}
update() {
this.notifySelectionManagersOfSelectionChange();
}
reset() {
this.update();
}
}
const qt = new Kr(), Gr = 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 = 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) {
if (s.isEqualTo(t)) return ["", ""];
const e = Hi(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);
return [e.utf16String.toString(), n.utf16String.toString()];
}, Hi = 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 {
static fromCommonAttributesOfObjects() {
let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
if (!t.length) return new this();
let e = me(t[0]), i = e.getKeys();
return t.slice(1).forEach((n) => {
i = e.getKeysCommonToHash(me(n)), e = e.slice(i);
}), e;
}
static box(t) {
return me(t);
}
constructor() {
let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
super(...arguments), this.values = ni(t);
}
add(t, e) {
return this.merge(oa(t, e));
}
remove(t) {
return new tt(ni(this.values, t));
}
get(t) {
return this.values[t];
}
has(t) {
return t in this.values;
}
merge(t) {
return new tt(aa(this.values, la(t)));
}
slice(t) {
const e = {};
return Array.from(t).forEach((i) => {
this.has(i) && (e[i] = this.values[i]);
}), new tt(e);
}
getKeys() {
return Object.keys(this.values);
}
getKeysCommonToHash(t) {
return t = me(t), this.getKeys().filter((e) => this.values[e] === t.values[e]);
}
isEqualTo(t) {
return Ft(this.toArray(), me(t).toArray());
}
isEmpty() {
return this.getKeys().length === 0;
}
toArray() {
if (!this.array) {
const t = [];
for (const e in this.values) {
const i = this.values[e];
t.push(t.push(e, i));
}
this.array = t.slice(0);
}
return this.array;
}
toObject() {
return ni(this.values);
}
toJSON() {
return this.toObject();
}
contentsForInspection() {
return { values: JSON.stringify(this.values) };
}
}
const oa = function(s, t) {
const e = {};
return e[s] = t, e;
}, aa = function(s, t) {
const e = ni(s);
for (const i in t) {
const n = t[i];
e[i] = n;
}
return e;
}, ni = 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) {
return s instanceof tt ? s.values : s;
};
class qn {
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;
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);
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);
}), t && r.push(new this(t, { depth: i, asTree: n })), r;
}
constructor() {
let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], { depth: e, asTree: i } = arguments.length > 1 ? arguments[1] : void 0;
this.objects = t, i && (this.depth = e, this.objects = this.constructor.groupObjects(this.objects, { asTree: i, depth: this.depth + 1 }));
}
getObjects() {
return this.objects;
}
getDepth() {
return this.depth;
}
getCacheKey() {
const t = ["objectGroup"];
return Array.from(this.getObjects()).forEach((e) => {
t.push(e.getCacheKey());
}), t.join("/");
}
}
class ca extends F {
constructor() {
let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
super(...arguments), this.objects = {}, Array.from(t).forEach((e) => {
const i = JSON.stringify(e);
this.objects[i] == null && (this.objects[i] = e);
});
}
find(t) {
const e = JSON.stringify(t);
return this.objects[e];
}
}
class da {
constructor(t) {
this.reset(t);
}
add(t) {
const e = xs(t);
this.elements[e] = t;
}
remove(t) {
const e = xs(t), i = this.elements[e];
if (i) return delete this.elements[e], i;
}
reset() {
let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
return this.elements = {}, Array.from(t).forEach((e) => {
this.add(e);
}), t;
}
}
const xs = (s) => s.dataset.trixStoreKey;
class ai extends F {
isPerforming() {
return this.performing === !0;
}
hasPerformed() {
return this.performed === !0;
}
hasSucceeded() {
return this.performed && this.succeeded;
}
hasFailed() {
return this.performed && !this.succeeded;
}
getPromise() {
return this.promise || (this.promise = new Promise((t, e) => (this.performing = !0, this.perform((i, n) => {
this.succeeded = i, this.performing = !1, this.performed = !0, this.succeeded ? t(n) : e(n);
})))), this.promise;
}
perform(t) {
return t(!1);
}
release() {
var t, e;
(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 {
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;
}
getNodes() {
return this.nodes || (this.nodes = this.createNodes()), this.nodes.map((t) => t.cloneNode(!0));
}
invalidate() {
var t;
return this.nodes = null, this.childViews = [], (t = this.parentView) === null || t === void 0 ? void 0 : t.invalidate();
}
invalidateViewForObject(t) {
var e;
return (e = this.findViewForObject(t)) === null || e === void 0 ? void 0 : e.invalidate();
}
findOrCreateCachedChildView(t, e, i) {
let n = this.getCachedViewForObject(e);
return n ? this.recordChildView(n) : (n = this.createChildView(...arguments), this.cacheViewForObject(n, e)), n;
}
createChildView(t, e) {
let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
e instanceof qn && (i.viewClass = t, t = ha);
const n = new t(e, i);
return this.recordChildView(n);
}
recordChildView(t) {
return t.parentView = this, t.rootView = this.rootView, this.childViews.push(t), t;
}
getAllChildViews() {
let t = [];
return this.childViews.forEach((e) => {
t.push(e), t = t.concat(e.getAllChildViews());
}), t;
}
findElement() {
return this.findElementForObject(this.object);
}
findElementForObject(t) {
const e = t == null ? void 0 : t.id;
if (e) return this.rootView.element.querySelector("[data-trix-id='".concat(e, "']"));
}
findViewForObject(t) {
for (const e of this.getAllChildViews()) if (e.object === t) return e;
}
getViewCache() {
return this.rootView !== this ? this.rootView.getViewCache() : this.isViewCachingEnabled() ? (this.viewCache || (this.viewCache = {}), this.viewCache) : void 0;
}
isViewCachingEnabled() {
return this.shouldCacheViews !== !1;
}
enableViewCaching() {
this.shouldCacheViews = !0;
}
disableViewCaching() {
this.shouldCacheViews = !1;
}
getCachedViewForObject(t) {
var e;
return (e = this.getViewCache()) === null || e === void 0 ? void 0 : e[t.getCacheKey()];
}
cacheViewForObject(t, e) {
const i = this.getViewCache();
i && (i[e.getCacheKey()] = t);
}
garbageCollectCachedViews() {
const t = this.getViewCache();
if (t) {
const e = this.getAllChildViews().concat(this).map((i) => i.object.getCacheKey());
for (const i in t) e.includes(i) || delete t[i];
}
}
}
class ha extends $t {
constructor() {
super(...arguments), this.objectGroup = this.object, this.viewClass = this.options.viewClass, delete this.options.viewClass;
}
getChildViews() {
return this.childViews.length || Array.from(this.objectGroup.getObjects()).forEach((t) => {
this.findOrCreateCachedChildView(this.viewClass, t, this.options);
}), this.childViews;
}
createNodes() {
const t = this.createContainerElement();
return this.getChildViews().forEach((e) => {
Array.from(e.getNodes()).forEach((i) => {
t.appendChild(i);
});
}), [t];
}
createContainerElement() {
let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.objectGroup.getDepth();
return this.getChildViews()[0].createContainerElement(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;
X || (X = function(s) {
return s;
}), st || (st = function(s) {
return s;
}), En || (En = 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) {
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() {
for (var s = arguments.length, t = new Array(s), e = 0; e < s; e++) t[e] = arguments[e];
return xn(Cs, t);
});
var Cs;
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);
};
}
function x(s, t) {
let e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : si;
Ss && Ss(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);
}
s[n] = !0;
}
return s;
}
function _a(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);
return t;
}
function be(s, t) {
for (; s !== null; ) {
const e = ga(s, t);
if (e) {
if (e.get) return Q(e.get);
if (typeof e.value == "function") return Q(e.value);
}
s = ma(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() {
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 { 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);
}
let S, q = "";
const { implementation: K, createNodeIterator: dt, 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"];
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 : "");
try {
return p.createPolicy(y, { createHTML: (H) => H, createScriptURL: (H) => H });
} 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;
}
}, is = x({}, [...ji, ...Vi, ...ya]), ns = x({}, [...zi, ...Aa]), ht = function(c) {
ge(e.removed, { element: c });
try {
_(c).removeChild(c);
} catch {
P(c);
}
}, kt = function(c, p) {
try {
ge(e.removed, { attribute: p.getAttributeNode(c), from: p });
} catch {
ge(e.removed, { attribute: null, from: p });
}
if (p.removeAttribute(c), c === "is") if (Vt || Fe) try {
ht(p);
} catch {
}
else try {
p.setAttribute(c, "");
} catch {
}
}, ss = function(c) {
let p = null, g = null;
if (Ai) c = "" + c;
else {
const y = Ui(c, /^[\r\n\t ]+/);
g = y && y[0];
}
de === "application/xhtml+xml" && Kt === gt && (c = '' + c + "");
const L = S ? S.createHTML(c) : c;
if (Kt === gt) try {
p = new u().parseFromString(L, de);
} catch {
}
if (!p || !p.documentElement) {
p = K.createDocument(Kt, "template", null);
try {
p.documentElement.innerHTML = Si ? q : L;
} 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;
};
function pt(c, p, g) {
Ke(c, (L) => {
L.call(e, p, 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;
if (!$[g] || le[g]) {
if (!le[g] && cs(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));
}
}
return ht(c), !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, "")))) {
if (g) return !1;
}
}
}
}
}
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);
continue;
}
if (rt === "attributename" && Ui(z, "href")) {
kt(y, c);
continue;
}
if (g.forceKeepAttr) continue;
if (!g.keepAttr) {
kt(y, c);
continue;
}
if (!Gn && G(/\/>/i, z)) {
kt(y, c);
continue;
}
jt && Ke([re, oe, ae], (us) => {
z = pe(z, us, " ");
});
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)) {
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);
} catch {
kt(y, c);
}
} else kt(y, c);
}
pt(j.afterSanitizeAttributes, c, null);
}, Ho = function c(p) {
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);
};
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");
}
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 (!$[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 (!Vt && !jt && !Tt && c.indexOf("<") === -1) return S && qe ? S.createHTML(c) : c;
if (g = ss(c), !g) return Vt ? null : qe ? q : "";
}
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) {
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;
}
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) => {
At = pe(At, rt, " ");
}), S && qe ? S.createHTML(At) : At;
}, e.setConfig = function() {
Ci(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}), yi = !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];
}
return Ls(j[c]);
}, e.removeHooks = function(c) {
j[c] = [];
}, e.removeAllHooks = function() {
j = { afterSanitizeAttributes: [], afterSanitizeElements: [], afterSanitizeShadowDOM: [], beforeSanitizeAttributes: [], beforeSanitizeElements: [], beforeSanitizeShadowDOM: [], uponSanitizeAttribute: [], uponSanitizeElement: [], uponSanitizeShadowNode: [] };
}, e;
}();
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 {
static setHTML(t, e, i) {
const n = new this(e, i).sanitize(), r = n.getHTML ? n.getHTML() : n.outerHTML;
t.innerHTML = r;
}
static sanitize(t, e) {
const i = new this(t, e);
return i.sanitize(), i;
}
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);
}
sanitize() {
this.sanitizeElements(), this.normalizeListElementNesting();
const t = Object.assign({}, Nr, this.purifyOptions);
return Ie.setConfig(t), this.body = Ie.sanitize(this.body), this.body;
}
getHTML() {
return this.body.innerHTML;
}
getBody() {
return this.body;
}
sanitizeElements() {
const t = ri(this.body), e = [];
for (; t.nextNode(); ) {
const i = t.currentNode;
switch (i.nodeType) {
case Node.ELEMENT_NODE:
this.elementIsRemovable(i) ? e.push(i) : this.sanitizeElement(i);
break;
case Node.COMMENT_NODE:
e.push(i);
}
}
return e.forEach((i) => wt(i)), this.body;
}
sanitizeElement(t) {
return t.hasAttribute("href") && this.forbiddenProtocols.includes(t.protocol) && t.removeAttribute("href"), Array.from(t.attributes).forEach((e) => {
let { name: i } = e;
this.allowedAttributes.includes(i) || i.indexOf("data-trix") === 0 || t.removeAttribute(i);
}), t;
}
normalizeListElementNesting() {
return Array.from(this.body.querySelectorAll("ul,ol")).forEach((t) => {
const e = t.previousElementSibling;
e && J(e) === "li" && e.appendChild(t);
}), this.body;
}
elementIsRemovable(t) {
if ((t == null ? void 0 : t.nodeType) === Node.ELEMENT_NODE) return this.elementIsForbidden(t) || this.elementIsntSerializable(t);
}
elementIsForbidden(t) {
return this.forbiddenElements.includes(J(t));
}
elementIsntSerializable(t) {
return t.getAttribute("data-trix-serialize") === "false" && !Bt(t);
}
}
const qa = function() {
let s = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
s = s.replace(/<\/html[^>]*>[^]*$/i, "