UNPKG

laif-ds

Version:

Design System di Laif con componenti React basati su principi di Atomic Design

1,399 lines (1,398 loc) 167 kB
"use client"; function v(n, ...e) { const t = new URL("https://lexical.dev/docs/error"), r = new URLSearchParams(); r.append("code", n); for (const i of e) r.append("v", i); throw t.search = r.toString(), Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`); } const le = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, As = le && "documentMode" in document ? document.documentMode : null, ue = le && /Mac|iPod|iPhone|iPad/.test(navigator.platform), ze = le && /^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent), Vt = !(!le || !("InputEvent" in window) || As) && "getTargetRanges" in new window.InputEvent("input"), Ct = le && /Version\/[\d.]+.*Safari/.test(navigator.userAgent), tt = le && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream, ws = le && /Android/.test(navigator.userAgent), bi = le && /^(?=.*Chrome).*/i.test(navigator.userAgent), Pr = le && ws && bi, jt = le && /AppleWebKit\/[\d.]+/.test(navigator.userAgent) && !bi; function qt(...n) { const e = []; for (const t of n) if (t && typeof t == "string") for (const [r] of t.matchAll(/\S+/g)) e.push(r); return e; } const Ds = 1, Ps = 3, Ls = 9, Is = 11, We = 0, Mi = 1, nt = 2, Fs = 0, Rs = 1, Ks = 2, Xt = 4, Qt = 8, rr = 128, Bs = 1792 | (112 | (3 | Xt | Qt) | rr), ir = 1, sr = 2, or = 3, lr = 4, ar = 5, cr = 6, fn = Ct || tt || jt ? " " : "​", Ne = ` `, zs = ze ? " " : fn, Oi = "֑-߿יִ-﷽ﹰ-ﻼ", Ai = "A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿", Ws = new RegExp("^[^" + Ai + "]*[" + Oi + "]"), $s = new RegExp("^[^" + Oi + "]*[" + Ai + "]"), $e = { bold: 1, capitalize: 1024, code: 16, highlight: rr, italic: 2, lowercase: 256, strikethrough: Xt, subscript: 32, superscript: 64, underline: Qt, uppercase: 512 }, Us = { directionless: 1, unmergeable: 2 }, Lr = { center: sr, end: cr, justify: lr, left: ir, right: or, start: ar }, Ys = { [sr]: "center", [cr]: "end", [lr]: "justify", [ir]: "left", [or]: "right", [ar]: "start" }, Js = { normal: 0, segmented: 2, token: 1 }, Hs = { [Fs]: "normal", [Ks]: "segmented", [Rs]: "token" }, Gs = "$"; function wi(n, e, t, r, i, s) { let o = n.getFirstChild(); for (; o !== null; ) { const l = o.__key; o.__parent === e && (N(o) && wi(o, l, t, r, i, s), t.has(l) || s.delete(l), i.push(l)), o = o.getNextSibling(); } } const Vs = 100; let Wn = !1, ur = 0; function js(n) { ur = n.timeStamp; } function bn(n, e, t) { const r = n.nodeName === "BR", i = e.__lexicalLineBreak; return i && (n === i || r && n.previousSibling === i) || r && xn(n, t) !== void 0; } function qs(n, e, t) { const r = Te(se(t)); let i = null, s = null; r !== null && r.anchorNode === n && (i = r.anchorOffset, s = r.focusOffset); const o = n.nodeValue; o !== null && Tr(e, o, i, s, !1); } function Xs(n, e, t) { if (w(n)) { const r = n.anchor.getNode(); if (r.is(t) && n.format !== r.getFormat()) return !1; } return ve(e) && t.isAttached(); } function Qs(n, e, t, r) { for (let i = n; i && !sl(i); i = wt(i)) { const s = xn(i, e); if (s !== void 0) { const o = J(s, t); if (o) return K(o) || !ee(i) ? void 0 : [i, o]; } else if (i === r) return [r, Cs(t)]; } } function Di(n, e, t) { Wn = !0; const r = performance.now() - ur > Vs; try { te(n, (() => { const i = I() || (function(f) { return f.getEditorState().read((() => { const g = I(); return g !== null ? g.clone() : null; })); })(n), s = /* @__PURE__ */ new Map(), o = n.getRootElement(), l = n._editorState, a = n._blockCursorElement; let c = !1, u = ""; for (let f = 0; f < e.length; f++) { const g = e[f], d = g.type, _ = g.target, p = Qs(_, n, l, o); if (!p) continue; const [C, y] = p; if (d === "characterData") r && O(y) && ve(_) && Xs(i, _, y) && qs(_, y, n); else if (d === "childList") { c = !0; const m = g.addedNodes; for (let x = 0; x < m.length; x++) { const b = m[x], T = ys(b), S = b.parentNode; if (S != null && b !== a && T === null && !bn(b, S, n)) { if (ze) { const A = (ee(b) ? b.innerText : null) || b.nodeValue; A && (u += A); } S.removeChild(b); } } const k = g.removedNodes, E = k.length; if (E > 0) { let x = 0; for (let b = 0; b < E; b++) { const T = k[b]; (bn(T, _, n) || a === T) && (_.appendChild(T), x++); } E !== x && s.set(C, y); } } } if (s.size > 0) for (const [f, g] of s) g.reconcileObservedMutation(f, n); const h = t.takeRecords(); if (h.length > 0) { for (let f = 0; f < h.length; f++) { const g = h[f], d = g.addedNodes, _ = g.target; for (let p = 0; p < d.length; p++) { const C = d[p], y = C.parentNode; y == null || C.nodeName !== "BR" || bn(C, _, n) || y.removeChild(C); } } t.takeRecords(); } i !== null && (c && ie(i), ze && Ts(n) && i.insertRawText(u)); })); } finally { Wn = !1; } } function Pi(n) { const e = n._observer; e !== null && Di(n, e.takeRecords(), e); } function Li(n) { (function(e) { ur === 0 && se(e).addEventListener("textInput", js, !0); })(n), n._observer = new MutationObserver(((e, t) => { Di(n, e, t); })); } class fr { constructor(e, t = /* @__PURE__ */ new Map(), r = void 0, i = /* @__PURE__ */ new Map(), s = void 0) { this.node = e, this.sharedConfigMap = t, this.unknownState = r, this.knownState = i; const o = s !== void 0 ? s : (function(l, a, c) { let u = c.size; if (a) for (const h in a) { const f = l.get(h); f && c.has(f) || u++; } return u; })(t, r, i); this.size = o; } getValue(e) { const t = this.knownState.get(e); if (t !== void 0) return t; this.sharedConfigMap.set(e.key, e); let r = e.defaultValue; if (this.unknownState && e.key in this.unknownState) { const i = this.unknownState[e.key]; i !== void 0 && (r = e.parse(i)), this.updateFromKnown(e, r); } return r; } getInternalState() { return [this.unknownState, this.knownState]; } toJSON() { const e = { ...this.unknownState }; for (const [t, r] of this.knownState) t.isEqual(r, t.defaultValue) ? delete e[t.key] : e[t.key] = t.unparse(r); return Ft(e) ? { [Gs]: e } : {}; } getWritable(e) { if (this.node === e) return this; const t = new Map(this.knownState), r = Ft(i = this.unknownState) && { ...i }; var i; if (r) for (const s of t.keys()) delete r[s.key]; return new fr(e, this.sharedConfigMap, Ft(r), t, this.size); } updateFromKnown(e, t) { const r = e.key; this.sharedConfigMap.set(r, e); const { knownState: i, unknownState: s } = this; i.has(e) || s && r in s || this.size++, i.set(e, t); } updateFromUnknown(e, t) { const r = this.sharedConfigMap.get(e); r ? this.updateFromKnown(r, r.parse(t)) : (this.unknownState = this.unknownState || {}, e in this.unknownState || this.size++, this.unknownState[e] = t); } updateFromJSON(e) { const { knownState: t } = this; for (const r of t.keys()) t.set(r, r.defaultValue); if (this.size = t.size, this.unknownState = {}, e) for (const [r, i] of Object.entries(e)) this.updateFromUnknown(r, i); this.unknownState = Ft(this.unknownState); } } function Ft(n) { if (n) for (const e in n) return n; } function Zs(n) { const e = n.getWritable(), t = e.__state ? e.__state.getWritable(e) : new fr(e); return e.__state = t, t; } function Ir(n, e) { const t = n.__mode, r = n.__format, i = n.__style, s = e.__mode, o = e.__format, l = e.__style, a = n.__state, c = e.__state; return (t === null || t === s) && (r === null || r === o) && (i === null || i === l) && (n.__state === null || a === c || (function(u, h) { if (u === h) return !0; if (u && h && u.size !== h.size) return !1; const f = /* @__PURE__ */ new Set(), g = (_, p) => { for (const [C, y] of _.knownState) { if (f.has(C.key)) continue; f.add(C.key); const m = p ? p.getValue(C) : C.defaultValue; if (m !== y && !C.isEqual(m, y)) return !0; } return !1; }, d = (_, p) => { const { unknownState: C } = _, y = p ? p.unknownState : void 0; if (C) { for (const [m, k] of Object.entries(C)) if (!f.has(m) && (f.add(m), k !== (y ? y[m] : void 0))) return !0; } return !1; }; return !(u && g(u, h) || h && g(h, u) || u && d(u, h) || h && d(h, u)); })(a, c)); } function Fr(n, e) { const t = n.mergeWithSibling(e), r = z()._normalizedNodes; return r.add(n.__key), r.add(e.__key), t; } function Rr(n) { let e, t, r = n; if (r.__text !== "" || !r.isSimpleText() || r.isUnmergeable()) { for (; (e = r.getPreviousSibling()) !== null && O(e) && e.isSimpleText() && !e.isUnmergeable(); ) { if (e.__text !== "") { if (Ir(e, r)) { r = Fr(e, r); break; } break; } e.remove(); } for (; (t = r.getNextSibling()) !== null && O(t) && t.isSimpleText() && !t.isUnmergeable(); ) { if (t.__text !== "") { if (Ir(r, t)) { r = Fr(r, t); break; } break; } t.remove(); } } else r.remove(); } function $n(n) { return Kr(n.anchor), Kr(n.focus), n; } function Kr(n) { for (; n.type === "element"; ) { const e = n.getNode(), t = n.offset; let r, i; if (t === e.getChildrenSize() ? (r = e.getChildAtIndex(t - 1), i = !0) : (r = e.getChildAtIndex(t), i = !1), O(r)) { n.set(r.__key, i ? r.getTextContentSize() : 0, "text", !0); break; } if (!N(r)) break; n.set(r.__key, i ? r.getChildrenSize() : 0, "element", !0); } } let Ae, Q, xt, dn, Un, Yn, Ue, oe, Jn, St, $ = "", X = "", ae = null, ce = "", Ce = "", Ii = !1, Nt = !1, $t = null; function Zt(n, e) { const t = Ue.get(n); if (e !== null) { const r = Vn(n); r.parentNode === e && e.removeChild(r); } if (oe.has(n) || Q._keyToDOMMap.delete(n), N(t)) { const r = tn(t, Ue); Hn(r, 0, r.length - 1, null); } t !== void 0 && vr(St, xt, dn, t, "destroyed"); } function Hn(n, e, t, r) { let i = e; for (; i <= t; ++i) { const s = n[i]; s !== void 0 && Zt(s, r); } } function Le(n, e) { n.setProperty("text-align", e); } const eo = "40px"; function Fi(n, e) { const t = Ae.theme.indent; if (typeof t == "string") { const i = n.classList.contains(t); e > 0 && !i ? n.classList.add(t) : e < 1 && i && n.classList.remove(t); } const r = getComputedStyle(n).getPropertyValue("--lexical-indent-base-value") || eo; n.style.setProperty("padding-inline-start", e === 0 ? "" : `calc(${e} * ${r})`); } function Ri(n, e) { const t = n.style; e === 0 ? Le(t, "") : e === ir ? Le(t, "left") : e === sr ? Le(t, "center") : e === or ? Le(t, "right") : e === lr ? Le(t, "justify") : e === ar ? Le(t, "start") : e === cr && Le(t, "end"); } function en(n, e) { const t = oe.get(n); t === void 0 && v(60); const r = t.createDOM(Ae, Q); if ((function(i, s, o) { const l = o._keyToDOMMap; (function(a, c, u) { const h = `__lexicalKey_${c._key}`; a[h] = u; })(s, o, i), l.set(i, s); })(n, r, Q), O(t) ? r.setAttribute("data-lexical-text", "true") : K(t) && r.setAttribute("data-lexical-decorator", "true"), N(t)) { const i = t.__indent, s = t.__size; if (i !== 0 && Fi(r, i), s !== 0) { const l = s - 1; (function(a, c, u, h) { const f = X; X = "", Gn(a, u, 0, c, u.getDOMSlot(h)), Bi(u, h), X = f; })(tn(t, oe), l, t, r); } const o = t.__format; o !== 0 && Ri(r, o), t.isInline() || Ki(null, t, r), Sn(t) && ($ += Ne, Ce += Ne); } else { const i = t.getTextContent(); if (K(t)) { const s = t.decorate(Q, Ae); s !== null && zi(n, s), r.contentEditable = "false"; } else O(t) && (t.isDirectionless() || (X += i)); $ += i, Ce += i; } return e !== null && e.insertChild(r), vr(St, xt, dn, t, "created"), r; } function Gn(n, e, t, r, i) { const s = $; $ = ""; let o = t; for (; o <= r; ++o) { en(n[o], i); const l = oe.get(n[o]); l !== null && O(l) && (ae === null && (ae = l.getFormat()), ce === "" && (ce = l.getStyle())); } Sn(e) && ($ += Ne), i.element.__lexicalTextContent = $, $ = s + $; } function Br(n, e) { if (n) { const t = n.__last; if (t) { const r = e.get(t); if (r) return Ze(r) ? "line-break" : K(r) && r.isInline() ? "decorator" : null; } return "empty"; } return null; } function Ki(n, e, t) { const r = Br(n, Ue), i = Br(e, oe); r !== i && e.getDOMSlot(t).setManagedLineBreak(i); } function Bi(n, e) { const t = e.__lexicalDirTextContent || "", r = e.__lexicalDir || ""; if (t !== X || r !== $t) { const i = X === "", s = i ? $t : (function(o) { return Ws.test(o) ? "rtl" : $s.test(o) ? "ltr" : null; })(X); if (s !== r) { const o = e.classList, l = Ae.theme; let a = r !== null ? l[r] : void 0, c = s !== null ? l[s] : void 0; if (a !== void 0) { if (typeof a == "string") { const u = qt(a); a = l[r] = u; } o.remove(...a); } if (s === null || i && s === "ltr") e.removeAttribute("dir"); else { if (c !== void 0) { if (typeof c == "string") { const u = qt(c); c = l[s] = u; } c !== void 0 && o.add(...c); } e.dir = s; } Nt || (n.getWritable().__dir = s); } $t = s, e.__lexicalDirTextContent = X, e.__lexicalDir = s; } } function to(n, e, t) { const r = X; var i; X = "", ae = null, ce = "", (function(s, o, l) { const a = $, c = s.__size, u = o.__size; $ = ""; const h = l.element; if (c === 1 && u === 1) { const f = s.__first, g = o.__first; if (f === g) ht(f, h); else { const _ = Vn(f), p = en(g, null); try { h.replaceChild(p, _); } catch (C) { if (typeof C == "object" && C != null) { const y = `${C.toString()} Parent: ${h.tagName}, new child: {tag: ${p.tagName} key: ${g}}, old child: {tag: ${_.tagName}, key: ${f}}.`; throw new Error(y); } throw C; } Zt(f, null); } const d = oe.get(g); O(d) && (ae === null && (ae = d.getFormat()), ce === "" && (ce = d.getStyle())); } else { const f = tn(s, Ue), g = tn(o, oe); if (f.length !== c && v(227), g.length !== u && v(228), c === 0) u !== 0 && Gn(g, o, 0, u - 1, l); else if (u === 0) { if (c !== 0) { const d = l.after == null && l.before == null && l.element.__lexicalLineBreak == null; Hn(f, 0, c - 1, d ? null : h), d && (h.textContent = ""); } } else (function(d, _, p, C, y, m) { const k = C - 1, E = y - 1; let x, b, T = m.getFirstChild(), S = 0, A = 0; for (; S <= k && A <= E; ) { const R = _[S], P = p[A]; if (R === P) T = Mn(ht(P, m.element)), S++, A++; else { x === void 0 && (x = new Set(_)), b === void 0 && (b = new Set(p)); const H = b.has(R), he = x.has(P); if (H) if (he) { const ge = it(Q, P); ge === T ? T = Mn(ht(P, m.element)) : (m.withBefore(T).insertChild(ge), ht(P, m.element)), S++, A++; } else en(P, m.withBefore(T)), A++; else T = Mn(Vn(R)), Zt(R, m.element), S++; } const B = oe.get(P); B !== null && O(B) && (ae === null && (ae = B.getFormat()), ce === "" && (ce = B.getStyle())); } const L = S > k, W = A > E; if (L && !W) { const R = p[E + 1], P = R === void 0 ? null : Q.getElementByKey(R); Gn(p, d, A, E, m.withBefore(P)); } else W && !L && Hn(_, S, k, m.element); })(o, f, g, c, u, l); } Sn(o) && ($ += Ne), h.__lexicalTextContent = $, $ = a + $; })(n, e, e.getDOMSlot(t)), Bi(e, t), i = e, ae == null || ae === i.__textFormat || Nt || i.setTextFormat(ae), (function(s) { ce === "" || ce === s.__textStyle || Nt || s.setTextStyle(ce); })(e), X = r; } function tn(n, e) { const t = []; let r = n.__first; for (; r !== null; ) { const i = e.get(r); i === void 0 && v(101), t.push(r), r = i.__next; } return t; } function ht(n, e) { const t = Ue.get(n); let r = oe.get(n); t !== void 0 && r !== void 0 || v(61); const i = Ii || Yn.has(n) || Un.has(n), s = it(Q, n); if (t === r && !i) { if (N(t)) { const o = s.__lexicalTextContent; o !== void 0 && ($ += o, Ce += o); const l = s.__lexicalDirTextContent; l !== void 0 && (X += l); } else { const o = t.getTextContent(); O(t) && !t.isDirectionless() && (X += o), Ce += o, $ += o; } return s; } if (t !== r && i && vr(St, xt, dn, r, "updated"), r.updateDOM(t, s, Ae)) { const o = en(n, null); return e === null && v(62), e.replaceChild(o, s), Zt(n, null), o; } if (N(t) && N(r)) { const o = r.__indent; o !== t.__indent && Fi(s, o); const l = r.__format; l !== t.__format && Ri(s, l), i && (to(t, r, s), ne(r) || r.isInline() || Ki(t, r, s)), Sn(r) && ($ += Ne, Ce += Ne); } else { const o = r.getTextContent(); if (K(r)) { const l = r.decorate(Q, Ae); l !== null && zi(n, l); } else O(r) && !r.isDirectionless() && (X += o); $ += o, Ce += o; } if (!Nt && ne(r) && r.__cachedText !== Ce) { const o = r.getWritable(); o.__cachedText = Ce, r = o; } return s; } function zi(n, e) { let t = Q._pendingDecorators; const r = Q._decorators; if (t === null) { if (r[n] === e) return; t = ms(Q); } t[n] = e; } function Mn(n) { let e = n.nextSibling; return e !== null && e === Q._blockCursorElement && (e = e.nextSibling), e; } function no(n, e, t, r, i, s) { $ = "", Ce = "", X = "", Ii = r === nt, $t = null, Q = t, Ae = t._config, xt = t._nodes, dn = Q._listeners.mutation, Un = i, Yn = s, Ue = n._nodeMap, oe = e._nodeMap, Nt = e._readOnly, Jn = new Map(t._keyToDOMMap); const o = /* @__PURE__ */ new Map(); return St = o, ht("root", null), Q = void 0, xt = void 0, Un = void 0, Yn = void 0, Ue = void 0, oe = void 0, Ae = void 0, Jn = void 0, St = void 0, o; } function Vn(n) { const e = Jn.get(n); return e === void 0 && v(75, n), e; } function D(n) { return { type: n }; } const Wi = D("SELECTION_CHANGE_COMMAND"), ml = D("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"), ro = D("CLICK_COMMAND"), nn = D("DELETE_CHARACTER_COMMAND"), Ut = D("INSERT_LINE_BREAK_COMMAND"), zr = D("INSERT_PARAGRAPH_COMMAND"), gt = D("CONTROLLED_TEXT_INSERTION_COMMAND"), $i = D("PASTE_COMMAND"), Wr = D("REMOVE_TEXT_COMMAND"), rn = D("DELETE_WORD_COMMAND"), sn = D("DELETE_LINE_COMMAND"), Fe = D("FORMAT_TEXT_COMMAND"), Ui = D("UNDO_COMMAND"), Yi = D("REDO_COMMAND"), io = D("KEYDOWN_COMMAND"), so = D("KEY_ARROW_RIGHT_COMMAND"), oo = D("MOVE_TO_END"), lo = D("KEY_ARROW_LEFT_COMMAND"), ao = D("MOVE_TO_START"), co = D("KEY_ARROW_UP_COMMAND"), uo = D("KEY_ARROW_DOWN_COMMAND"), jn = D("KEY_ENTER_COMMAND"), fo = D("KEY_SPACE_COMMAND"), ho = D("KEY_BACKSPACE_COMMAND"), go = D("KEY_ESCAPE_COMMAND"), _o = D("KEY_DELETE_COMMAND"), po = D("KEY_TAB_COMMAND"), Cl = D("INSERT_TAB_COMMAND"), xl = D("INDENT_CONTENT_COMMAND"), Sl = D("OUTDENT_CONTENT_COMMAND"), yo = D("DROP_COMMAND"), Nl = D("FORMAT_ELEMENT_COMMAND"), mo = D("DRAGSTART_COMMAND"), Co = D("DRAGOVER_COMMAND"), xo = D("DRAGEND_COMMAND"), Ji = D("COPY_COMMAND"), Hi = D("CUT_COMMAND"), $r = D("SELECT_ALL_COMMAND"), Tl = D("CLEAR_EDITOR_COMMAND"), vl = D("CLEAR_HISTORY_COMMAND"), kl = D("CAN_REDO_COMMAND"), El = D("CAN_UNDO_COMMAND"), So = D("FOCUS_COMMAND"), No = D("BLUR_COMMAND"), To = D("KEY_MODIFIER_COMMAND"), pe = Object.freeze({}), qn = 30, Xn = [["keydown", function(n, e) { if (_t = n.timeStamp, Gi = n.key, !e.isComposing() && !M(e, io, n) && n.key != null) { if (On && yi(n)) return te(e, (() => { Rt(e, An); })), On = !1, void (An = ""); if ((function(t) { return F(t, "ArrowRight", { shiftKey: "any" }); })(n)) M(e, so, n); else if ((function(t) { return F(t, "ArrowRight", me); })(n)) M(e, oo, n); else if ((function(t) { return F(t, "ArrowLeft", { shiftKey: "any" }); })(n)) M(e, lo, n); else if ((function(t) { return F(t, "ArrowLeft", me); })(n)) M(e, ao, n); else if ((function(t) { return F(t, "ArrowUp", { altKey: "any", shiftKey: "any" }); })(n)) M(e, co, n); else if ((function(t) { return F(t, "ArrowDown", { altKey: "any", shiftKey: "any" }); })(n)) M(e, uo, n); else if ((function(t) { return F(t, "Enter", { altKey: "any", ctrlKey: "any", metaKey: "any", shiftKey: !0 }); })(n)) pt = !0, M(e, jn, n); else if ((function(t) { return t.key === " "; })(n)) M(e, fo, n); else if ((function(t) { return ue && F(t, "o", { ctrlKey: !0 }); })(n)) n.preventDefault(), pt = !0, M(e, Ut, !0); else if ((function(t) { return F(t, "Enter", { altKey: "any", ctrlKey: "any", metaKey: "any" }); })(n)) pt = !1, M(e, jn, n); else if ((function(t) { return F(t, "Backspace", { shiftKey: "any" }) || ue && F(t, "h", { ctrlKey: !0 }); })(n)) yi(n) ? M(e, ho, n) : (n.preventDefault(), M(e, nn, !0)); else if ((function(t) { return t.key === "Escape"; })(n)) M(e, go, n); else if ((function(t) { return F(t, "Delete", {}) || ue && F(t, "d", { ctrlKey: !0 }); })(n)) (function(t) { return t.key === "Delete"; })(n) ? M(e, _o, n) : (n.preventDefault(), M(e, nn, !1)); else if ((function(t) { return F(t, "Backspace", pi); })(n)) n.preventDefault(), M(e, rn, !0); else if ((function(t) { return F(t, "Delete", pi); })(n)) n.preventDefault(), M(e, rn, !1); else if ((function(t) { return ue && F(t, "Backspace", { metaKey: !0 }); })(n)) n.preventDefault(), M(e, sn, !0); else if ((function(t) { return ue && (F(t, "Delete", { metaKey: !0 }) || F(t, "k", { ctrlKey: !0 })); })(n)) n.preventDefault(), M(e, sn, !1); else if ((function(t) { return F(t, "b", me); })(n)) n.preventDefault(), M(e, Fe, "bold"); else if ((function(t) { return F(t, "u", me); })(n)) n.preventDefault(), M(e, Fe, "underline"); else if ((function(t) { return F(t, "i", me); })(n)) n.preventDefault(), M(e, Fe, "italic"); else if ((function(t) { return F(t, "Tab", { shiftKey: "any" }); })(n)) M(e, po, n); else if ((function(t) { return F(t, "z", me); })(n)) n.preventDefault(), M(e, Ui, void 0); else if ((function(t) { return ue ? F(t, "z", { metaKey: !0, shiftKey: !0 }) : F(t, "y", { ctrlKey: !0 }) || F(t, "z", { ctrlKey: !0, shiftKey: !0 }); })(n)) n.preventDefault(), M(e, Yi, void 0); else { const t = e._editorState._selection; t === null || w(t) ? mi(n) && (n.preventDefault(), M(e, $r, n)) : (function(r) { return F(r, "c", me); })(n) ? (n.preventDefault(), M(e, Ji, n)) : (function(r) { return F(r, "x", me); })(n) ? (n.preventDefault(), M(e, Hi, n)) : mi(n) && (n.preventDefault(), M(e, $r, n)); } (function(t) { return t.ctrlKey || t.shiftKey || t.altKey || t.metaKey; })(n) && M(e, To, n); } }], ["pointerdown", function(n, e) { const t = n.target, r = n.pointerType; Dt(t) && r !== "touch" && r !== "pen" && n.button === 0 && te(e, (() => { hi(t) || (Zn = !0); })); }], ["compositionstart", function(n, e) { te(e, (() => { const t = I(); if (w(t) && !e.isComposing()) { const r = t.anchor, i = t.anchor.getNode(); V(r.key), (n.timeStamp < _t + qn || r.type === "element" || !t.isCollapsed() || i.getFormat() !== t.format || O(i) && i.getStyle() !== t.style) && M(e, gt, zs); } })); }], ["compositionend", function(n, e) { ze ? dt = !0 : tt || !Ct && !jt ? te(e, (() => { Rt(e, n.data); })) : (On = !0, An = n.data); }], ["input", function(n, e) { n.stopPropagation(), te(e, (() => { if (ee(n.target) && hi(n.target)) return; const t = I(), r = n.data, i = Qi(n); if (r != null && w(t) && qi(t, i, r, n.timeStamp, !1)) { dt && (Rt(e, r), dt = !1); const s = t.anchor.getNode(), o = Te(se(e)); if (o === null) return; const l = t.isBackward(), a = l ? t.anchor.offset : t.focus.offset, c = l ? t.focus.offset : t.anchor.offset; Vt && !t.isCollapsed() && O(s) && o.anchorNode !== null && s.getTextContent().slice(0, a) + r + s.getTextContent().slice(a + c) === Ns(o.anchorNode) || M(e, gt, r); const u = r.length; ze && u > 1 && n.inputType === "insertCompositionText" && !e.isComposing() && (t.anchor.offset -= u), Ct || tt || jt || !e.isComposing() || (_t = 0, V(null)); } else Nr(!1, e, r !== null ? r : void 0), dt && (Rt(e, r || void 0), dt = !1); (function() { j(); const s = z(); Pi(s); })(); }), { event: n }), qe = null; }], ["click", function(n, e) { te(e, (() => { const t = I(), r = Te(se(e)), i = at(); if (r) { if (w(t)) { const s = t.anchor, o = s.getNode(); if (s.type === "element" && s.offset === 0 && t.isCollapsed() && !ne(o) && re().getChildrenSize() === 1 && o.getTopLevelElementOrThrow().isEmpty() && i !== null && t.is(i)) r.removeAllRanges(), t.dirty = !0; else if (n.detail === 3 && !t.isCollapsed() && o !== t.focus.getNode()) { const l = (function(a, c) { let u = a; for (; u !== re() && u != null; ) { if (c(u)) return u; u = u.getParent(); } return null; })(o, ((a) => N(a) && !a.isInline())); N(l) && l.select(0); } } else if (n.pointerType === "touch" || n.pointerType === "pen") { const s = r.anchorNode; (ee(s) || ve(s)) && ie(_r(i, r, e, n)); } } M(e, ro, n); })); }], ["cut", pe], ["copy", pe], ["dragstart", pe], ["dragover", pe], ["dragend", pe], ["paste", pe], ["focus", pe], ["blur", pe], ["drop", pe]]; Vt && Xn.push(["beforeinput", (n, e) => (function(t, r) { const i = t.inputType, s = Qi(t); i === "deleteCompositionText" || ze && Ts(r) || i !== "insertCompositionText" && te(r, (() => { const o = I(); if (i === "deleteContentBackward") { if (o === null) { const g = at(); if (!w(g)) return; ie(g.clone()); } if (w(o)) { const g = o.anchor.key === o.focus.key; if (l = t.timeStamp, Gi === "MediaLast" && l < _t + qn && r.isComposing() && g) { if (V(null), _t = 0, setTimeout((() => { te(r, (() => { V(null); })); }), qn), w(o)) { const d = o.anchor.getNode(); d.markDirty(), O(d) || v(142), Xi(o, d); } } else { V(null), t.preventDefault(); const d = o.anchor.getNode(), _ = d.getTextContent(), p = d.canInsertTextAfter(), C = o.anchor.offset === 0 && o.focus.offset === _.length; let y = Pr && g && !C && p; if (y && o.isCollapsed() && (y = !K(Vo(o.anchor, !0))), !y) { M(r, nn, !0); const m = I(); Pr && w(m) && m.isCollapsed() && (Ie = m, setTimeout((() => Ie = null))); } } return; } } var l; if (!w(o)) return; const a = t.data; qe !== null && Nr(!1, r, qe), o.dirty && qe === null || !o.isCollapsed() || ne(o.anchor.getNode()) || s === null || o.applyDOMRange(s), qe = null; const c = o.anchor, u = o.focus, h = c.getNode(), f = u.getNode(); if (i !== "insertText" && i !== "insertTranspose") switch (t.preventDefault(), i) { case "insertFromYank": case "insertFromDrop": case "insertReplacementText": M(r, gt, t); break; case "insertFromComposition": V(null), M(r, gt, t); break; case "insertLineBreak": V(null), M(r, Ut, !1); break; case "insertParagraph": V(null), pt && !tt ? (pt = !1, M(r, Ut, !1)) : M(r, zr, void 0); break; case "insertFromPaste": case "insertFromPasteAsQuotation": M(r, $i, t); break; case "deleteByComposition": (function(g, d) { return g !== d || N(g) || N(d) || !Re(g) || !Re(d); })(h, f) && M(r, Wr, t); break; case "deleteByDrag": case "deleteByCut": M(r, Wr, t); break; case "deleteContent": M(r, nn, !1); break; case "deleteWordBackward": M(r, rn, !0); break; case "deleteWordForward": M(r, rn, !1); break; case "deleteHardLineBackward": case "deleteSoftLineBackward": M(r, sn, !0); break; case "deleteContentForward": case "deleteHardLineForward": case "deleteSoftLineForward": M(r, sn, !1); break; case "formatStrikeThrough": M(r, Fe, "strikethrough"); break; case "formatBold": M(r, Fe, "bold"); break; case "formatItalic": M(r, Fe, "italic"); break; case "formatUnderline": M(r, Fe, "underline"); break; case "historyUndo": M(r, Ui, void 0); break; case "historyRedo": M(r, Yi, void 0); } else { if (a === ` `) t.preventDefault(), M(r, Ut, !1); else if (a === Ne) t.preventDefault(), M(r, zr, void 0); else if (a == null && t.dataTransfer) { const g = t.dataTransfer.getData("text/plain"); t.preventDefault(), o.insertRawText(g); } else a != null && qi(o, s, a, t.timeStamp, !0) ? (t.preventDefault(), M(r, gt, a)) : qe = a; Vi = t.timeStamp; } })); })(n, e)]); let _t = 0, Gi = null, Vi = 0, qe = null; const on = /* @__PURE__ */ new WeakMap(); let Qn = !1, Zn = !1, pt = !1, dt = !1, On = !1, An = "", Ie = null, ji = [0, "", 0, "root", 0]; function qi(n, e, t, r, i) { const s = n.anchor, o = n.focus, l = s.getNode(), a = z(), c = Te(se(a)), u = c !== null ? c.anchorNode : null, h = s.key, f = a.getElementByKey(h), g = t.length; return h !== o.key || !O(l) || (!i && (!Vt || Vi < r + 50) || l.isDirty() && g < 2 || xs(t)) && s.offset !== o.offset && !l.isComposing() || Ee(l) || l.isDirty() && g > 1 || (i || !Vt) && f !== null && !l.isComposing() && u !== rt(f) || c !== null && e !== null && (!e.collapsed || e.startContainer !== c.anchorNode || e.startOffset !== c.anchorOffset) || l.getFormat() !== n.format || l.getStyle() !== n.style || (function(d, _) { if (_.isSegmented()) return !0; if (!d.isCollapsed()) return !1; const p = d.anchor.offset, C = _.getParentOrThrow(), y = Re(_); return p === 0 ? !_.canInsertTextBefore() || !C.canInsertTextBefore() && !_.isComposing() || y || (function(m) { const k = m.getPreviousSibling(); return (O(k) || N(k) && k.isInline()) && !k.canInsertTextAfter(); })(_) : p === _.getTextContentSize() && (!_.canInsertTextAfter() || !C.canInsertTextAfter() && !_.isComposing() || y); })(n, l); } function Ur(n, e) { return ve(n) && n.nodeValue !== null && e !== 0 && e !== n.nodeValue.length; } function Yr(n, e, t) { const { anchorNode: r, anchorOffset: i, focusNode: s, focusOffset: o } = n; Qn && (Qn = !1, Ur(r, i) && Ur(s, o) && !Ie) || te(e, (() => { if (!t) return void ie(null); if (!mn(e, r, s)) return; let l = I(); if (Ie && w(l) && l.isCollapsed()) { const a = l.anchor, c = Ie.anchor; (a.key === c.key && a.offset === c.offset + 1 || a.offset === 1 && c.getNode().is(a.getNode().getPreviousSibling())) && (l = Ie.clone(), ie(l)); } if (Ie = null, w(l)) { const a = l.anchor, c = a.getNode(); if (l.isCollapsed()) { n.type === "Range" && n.anchorNode === n.focusNode && (l.dirty = !0); const u = se(e).event, h = u ? u.timeStamp : performance.now(), [f, g, d, _, p] = ji, C = re(), y = e.isComposing() === !1 && C.getTextContent() === ""; if (h < p + 200 && a.offset === d && a.key === _) Yt(l, f, g); else if (a.type === "text") O(c) || v(141), Xi(l, c); else if (a.type === "element" && !y) { N(c) || v(259); const m = a.getNode(); m.isEmpty() ? (function(k, E) { const x = E.getTextFormat(), b = E.getTextStyle(); Yt(k, x, b); })(l, m) : Yt(l, 0, ""); } } else { const u = a.key, h = l.focus.key, f = l.getNodes(), g = f.length, d = l.isBackward(), _ = d ? o : i, p = d ? i : o, C = d ? h : u, y = d ? u : h; let m = Bs, k = !1; for (let E = 0; E < g; E++) { const x = f[E], b = x.getTextContentSize(); if (O(x) && b !== 0 && !(E === 0 && x.__key === C && _ === b || E === g - 1 && x.__key === y && p === 0) && (k = !0, m &= x.getFormat(), m === 0)) break; } l.format = k ? m : 0; } } M(e, Wi, void 0); })); } function Yt(n, e, t) { n.format === e && n.style === t || (n.format = e, n.style = t, n.dirty = !0); } function Xi(n, e) { Yt(n, e.getFormat(), e.getStyle()); } function Qi(n) { if (!n.getTargetRanges) return null; const e = n.getTargetRanges(); return e.length === 0 ? null : e[0]; } function Rt(n, e) { const t = n._compositionKey; if (V(null), t !== null && e != null) { if (e === "") { const r = J(t), i = rt(n.getElementByKey(t)); return void (i !== null && i.nodeValue !== null && O(r) && Tr(r, i.nodeValue, null, null, !0)); } if (e[e.length - 1] === ` `) { const r = I(); if (w(r)) { const i = r.focus; return r.anchor.set(i.key, i.offset, i.type), void M(n, jn, null); } } } Nr(!0, n, e); } function Zi(n) { let e = n.__lexicalEventHandles; return e === void 0 && (e = [], n.__lexicalEventHandles = e), e; } const Qe = /* @__PURE__ */ new Map(); function es(n) { const e = Zo(n.target); if (e === null) return; const t = ps(e.anchorNode); if (t === null) return; Zn && (Zn = !1, te(t, (() => { const a = at(), c = e.anchorNode; (ee(c) || ve(c)) && ie(_r(a, e, t, n)); }))); const r = Sr(t), i = r[r.length - 1], s = i._key, o = Qe.get(s), l = o || i; l !== t && Yr(e, l, !1), Yr(e, t, !0), t !== i ? Qe.set(s, t) : o && Qe.delete(s); } function Jr(n) { n._lexicalHandled = !0; } function Hr(n) { return n._lexicalHandled === !0; } function vo(n) { const e = n.ownerDocument, t = on.get(e); if (t === void 0) return; const r = t - 1; r >= 0 || v(164), on.set(e, r), r === 0 && e.removeEventListener("selectionchange", es); const i = Cn(n); Cr(i) ? ((function(o) { if (o._parentEditor !== null) { const l = Sr(o), a = l[l.length - 1]._key; Qe.get(a) === o && Qe.delete(a); } else Qe.delete(o._key); })(i), n.__lexicalEditor = null) : i && v(198); const s = Zi(n); for (let o = 0; o < s.length; o++) s[o](); n.__lexicalEventHandles = []; } function er(n, e, t) { j(); const r = n.__key, i = n.getParent(); if (i === null) return; const s = (function(l) { const a = I(); if (!w(a) || !N(l)) return a; const { anchor: c, focus: u } = a, h = c.getNode(), f = u.getNode(); return tr(h, l) && c.set(l.__key, 0, "element"), tr(f, l) && u.set(l.__key, 0, "element"), a; })(n); let o = !1; if (w(s) && e) { const l = s.anchor, a = s.focus; l.key === r && (an(l, n, i, n.getPreviousSibling(), n.getNextSibling()), o = !0), a.key === r && (an(a, n, i, n.getPreviousSibling(), n.getNextSibling()), o = !0); } else gr(s) && e && n.isSelected() && n.selectPrevious(); if (w(s) && e && !o) { const l = n.getIndexWithinParent(); Ke(n), ln(s, i, l, -1); } else Ke(n); t || Pe(i) || i.canBeEmpty() || !i.isEmpty() || er(i, e), e && s && ne(i) && i.isEmpty() && i.selectEnd(); } class hn { static getType() { v(64, this.name); } static clone(e) { v(65, this.name); } afterCloneFrom(e) { this.__parent = e.__parent, this.__next = e.__next, this.__prev = e.__prev, this.__state = e.__state; } constructor(e) { this.__type = this.constructor.getType(), this.__parent = null, this.__prev = null, this.__next = null, Object.defineProperty(this, "__state", { configurable: !0, enumerable: !1, value: void 0, writable: !0 }), Ho(this, e); } getType() { return this.__type; } isInline() { v(137, this.constructor.name); } isAttached() { let e = this.__key; for (; e !== null; ) { if (e === "root") return !0; const t = J(e); if (t === null) break; e = t.__parent; } return !1; } isSelected(e) { const t = e || I(); if (t == null) return !1; const r = t.getNodes().some(((i) => i.__key === this.__key)); if (O(this)) return r; if (w(t) && t.anchor.type === "element" && t.focus.type === "element") { if (t.isCollapsed()) return !1; const i = this.getParent(); if (K(this) && this.isInline() && i) { const s = t.isBackward() ? t.focus : t.anchor; if (i.is(s.getNode()) && s.offset === i.getChildrenSize() && this.is(i.getLastChild())) return !1; } } return r; } getKey() { return this.__key; } getIndexWithinParent() { const e = this.getParent(); if (e === null) return -1; let t = e.getFirstChild(), r = 0; for (; t !== null; ) { if (this.is(t)) return r; r++, t = t.getNextSibling(); } return -1; } getParent() { const e = this.getLatest().__parent; return e === null ? null : J(e); } getParentOrThrow() { const e = this.getParent(); return e === null && v(66, this.__key), e; } getTopLevelElement() { let e = this; for (; e !== null; ) { const t = e.getParent(); if (Pe(t)) return N(e) || e === this && K(e) || v(194), e; e = t; } return null; } getTopLevelElementOrThrow() { const e = this.getTopLevelElement(); return e === null && v(67, this.__key), e; } getParents() { const e = []; let t = this.getParent(); for (; t !== null; ) e.push(t), t = t.getParent(); return e; } getParentKeys() { const e = []; let t = this.getParent(); for (; t !== null; ) e.push(t.__key), t = t.getParent(); return e; } getPreviousSibling() { const e = this.getLatest().__prev; return e === null ? null : J(e); } getPreviousSiblings() { const e = [], t = this.getParent(); if (t === null) return e; let r = t.getFirstChild(); for (; r !== null && !r.is(this); ) e.push(r), r = r.getNextSibling(); return e; } getNextSibling() { const e = this.getLatest().__next; return e === null ? null : J(e); } getNextSiblings() { const e = []; let t = this.getNextSibling(); for (; t !== null; ) e.push(t), t = t.getNextSibling(); return e; } getCommonAncestor(e) { const t = N(this) ? this : this.getParent(), r = N(e) ? e : e.getParent(), i = t && r ? Ht(t, r) : null; return i ? i.commonAncestor : null; } is(e) { return e != null && this.__key === e.__key; } isBefore(e) { const t = Ht(this, e); return t !== null && (t.type === "descendant" || (t.type === "branch" ? Ms(t) === -1 : (t.type !== "same" && t.type !== "ancestor" && v(279), !1))); } isParentOf(e) { const t = Ht(this, e); return t !== null && t.type === "ancestor"; } getNodesBetween(e) { const t = this.isBefore(e), r = [], i = /* @__PURE__ */ new Set(); let s = this; for (; s !== null; ) { const o = s.__key; if (i.has(o) || (i.add(o), r.push(s)), s === e) break; const l = N(s) ? t ? s.getFirstChild() : s.getLastChild() : null; if (l !== null) { s = l; continue; } const a = t ? s.getNextSibling() : s.getPreviousSibling(); if (a !== null) { s = a; continue; } const c = s.getParentOrThrow(); if (i.has(c.__key) || r.push(c), c === e) break; let u = null, h = c; do { if (h === null && v(68), u = t ? h.getNextSibling() : h.getPreviousSibling(), h = h.getParent(), h === null) break; u !== null || i.has(h.__key) || r.push(h); } while (u === null); s = u; } return t || r.reverse(), r; } isDirty() { const e = z()._dirtyLeaves; return e !== null && e.has(this.__key); } getLatest() { const e = J(this.__key); return e === null && v(113), e; } getWritable() { j(); const e = De(), t = z(), r = e._nodeMap, i = this.__key, s = this.getLatest(), o = t._cloneNotNeeded, l = I(); if (l !== null && l.setCachedNodes(null), o.has(i)) return un(s), s; const a = rl(s); return o.add(i), un(a), r.set(i, a), a; } getTextContent() { return ""; } getTextContentSize() { return this.getTextContent().length; } createDOM(e, t) { v(70); } updateDOM(e, t, r) { v(71); } exportDOM(e) { return { element: this.createDOM(e._config, e) }; } exportJSON() { const e = this.__state ? this.__state.toJSON() : void 0; return { type: this.__type, version: 1, ...e }; } static importJSON(e) { v(18, this.name); } updateFromJSON(e) { return (function(t, r) { const i = t.getWritable(); return (r || i.__state) && Zs(t).updateFromJSON(r), i; })(this, e.$); } static transform() { return null; } remove(e) { er(this, !0, e); } replace(e, t) { j(); let r = I(); r !== null && (r = r.clone()), Rn(this, e); const i = this.getLatest(), s = this.__key, o = e.__key, l = e.getWritable(), a = this.getParentOrThrow().getWritable(), c = a.__size; Ke(l); const u = i.getPreviousSibling(), h = i.getNextSibling(), f = i.__prev, g = i.__next, d = i.__parent; if (er(i, !1, !0), u === null ? a.__first = o : u.getWritable().__next = o, l.__prev = f, h === null ? a.__last = o : h.getWritable().__prev = o, l.__next = g, l.__parent = d, a.__size = c, t && (N(this) && N(l) || v(139), this.getChildren().forEach(((_) => { l.append(_); }))), w(r)) { ie(r); const _ = r.anchor, p = r.focus; _.key === s && qr(_, l), p.key === s && qr(p, l); } return Me() === s && V(o), l; } insertAfter(e, t = !0) { j(), Rn(this, e); const r = this.getWritable(), i = e.getWritable(), s = i.getParent(), o = I(); let l = !1, a = !1; if (s !== null) { const g = e.getIndexWithinParent(); if (Ke(i), w(o)) { const d = s.__key, _ = o.anchor, p = o.focus; l = _.type === "element" && _.key === d && _.offset === g + 1, a = p.type === "element" && p.key === d && p.offset === g + 1; } } const c = this.getNextSibling(), u = this.getParentOrThrow().getWritable(), h = i.__key, f = r.__next; if (c === null ? u.__last = h : c.getWritable().__prev = h, u.__size++, r.__next = h, i.__next = f, i.__prev = r.__key, i.__parent = r.__parent, t && w(o)) { const g = this.getIndexWithinParent(); ln(o, u, g + 1); const d = u.__key; l && o.anchor.set(d, g + 2, "element"), a && o.focus.set(d, g + 2, "element"); } return e; } insertBefore(e, t = !0) { j(), Rn(this, e); const r = this.getWritable(), i = e.getWritable(), s = i.__key; Ke(i); const o = this.getPreviousSibling(), l = this.getParentOrThrow().getWritable(), a = r.__prev, c = this.getIndexWithinParent(); o === null ? l.__first = s : o.getWritable().__next = s, l.__size++, r.__prev = s, i.__prev = a, i.__next = r.__key, i.__parent = r.__parent; const u = I(); return t && w(u) && ln(u, this.getParentOrThrow(), c), e; } isParentRequired() { return !1; } createParentElementNode() { return Oe(); } selectStart() { return this.selectPrevious(); } selectEnd() { return this.selectNext(0, 0); } selectPrevious(e, t) { j(); const r = this.getPreviousSibling(), i = this.getParentOrThrow(); if (r === null) return i.select(0, 0); if (N(r)) return r.select(); if (!O(r)) { const s = r.getIndexWithinParent() + 1; return i.select(s, s); } return r.select(e, t); } selectNext(e, t) { j(); const r = this.getNextSibling(), i = this.getParentOrThrow(); if (r === null) return i.select(); if (N(r)) return r.select(0, 0); if (!O(r)) { const s = r.getIndexWithinParent(); return i.select(s, s); } return r.select(e, t); } markDirty() { this.getWritable(); } reconcileObservedMutation(e, t) { this.markDirty(); } } class Et extends hn { static getType() { return "linebreak"; } static clone(e) { return new Et(e.__key); } constructor(e) { super(e); } getTextContent() { return ` `; } createDOM() { return document.createElement("br"); } updateDOM() { return !1; } isInline() { return !0; } static importDOM() { return { br: (e) => (function(t) { const r = t.parentElement; if (r !== null && xi(r)) { const i = r.firstChild; if (i === t || i.nextSibling === t && Kt(i)) { const s = r.lastChild; if (s === t || s.previousSibling === t && Kt(s)) return !0; } } return !1; })(e) || (function(t) { const r = t.parentElement; if (r !== null && xi(r)) { const i = r.firstChild; if (i === t || i.nextSibling === t && Kt(i)) return !1; const s = r.lastChild; if (s === t || s.previousSibling === t && Kt(s)) return !0; } return !1; })(e) ? null : { conversion: ko, priority: 0 } }; } static importJSON(e) { return Tt().updateFromJSON(e); } } function ko(n) { return { node: Tt() }; } function Tt() { return Nn(new Et()); } function Ze(n) { return n instanceof Et; } function Kt(n) { return ve(n) && /^( |\t|\r?\n)+$/.test(n.textContent || ""); } function wn(n, e) { return 16 & e ? "code" : e & rr ? "mark" : 32 & e ? "sub" : 64 & e ? "sup" : null; } function Dn(n, e) { return 1 & e ? "strong" : 2 & e ? "em" : "span"; } function ts(n, e, t, r, i) { const s = r.classList; let o = et(i, "base"); o !== void 0 && s.add(...o), o = et(i, "underlineStrikethrough"); let l = !1; const a = e & Qt && e & Xt; o !== void 0 && (t & Qt && t & Xt ? (l = !0, a || s.add(...o)) : a && s.remove(...o)); for (const c in $e) { const u = $e[c]; if (o = et(i, c), o !== void 0) if (t & u) { if (l && (c === "underline" || c === "strikethrough")) { e & u && s.remove(...o); continue; } e & u && (!a || c !== "underline") && c !== "strikethrough" || s.add(...o); } else e & u && s.remove(...o); } } function ns(n, e, t) { const r = e.firstChild, i = t.isComposing(), s = n + (i ? fn : ""); if (r == null) e.textContent = s; else { const o = r.nodeValue; if (o !== s) if (i || ze) { const [l, a, c] = (function(u, h) { const f = u.length, g = h.length; let d = 0, _ = 0; for (; d < f && d < g && u[d] === h[d]; ) d++; for (; _ + d < f && _ + d < g && u[f - _ - 1] === h[g - _ - 1]; ) _++; return [d, f - d - _, h.slice(d, g - _)]; })(o, s); a !== 0 && r.deleteData(l, a), r.insertData(l, c); } else r.nodeValue = s; } } function Gr(n, e, t, r, i, s) { ns(i, n, e); const o = s.theme.text; o !== void 0 && ts(0, 0, r, n, o); } function Bt(n, e) { const t = document.createElement(e); return t.appendChild(n), t; } class lt extends hn { static getType() { return "text"; } static clone(e) { return new lt(e.__text, e.__key); } afterCloneFrom(e) { super.afterCloneFrom(e), this.__text = e.__text, this.__format = e.__format, this.__style = e.__style, this.__mode = e.__mode, this.__detail = e.__detail; } constructor(e = "", t) { super(t), this.__text = e, this.__format = 0, this.__style = "", this.__mode = 0, this.__detail = 0; } getFormat() { return this.getLatest().__format; } getDetail() { return this.getLatest().__detail; } getMode() { const e = this.getLatest(); return Hs[e.__mode]; } getStyle() { return this.getLatest().__style; } isToken() { return this.getLatest().__mode === 1; } isComposing() { return this.__key === Me(); } isSegmented() { return this.getLatest().__mode === 2; } isDirectionless() { return !!(1 & this.getLatest().__detail); } isUnmergeable() { return !!(2 & this.getLatest().__detail); } hasFormat(e) { const t = $e[e]; return !!(this.getFormat() & t); } isSimpleText() { return this.__type === "text" && this.__mode === 0; } getTextContent() { return this.getLatest().__text; } getFormatFlags(e, t) { return cn(this.getLatest().__format, e, t); } canHaveFormat() { return !0; } isInline() { return !0; } createDOM(e, t) { const r = this.__format, i = wn(0, r), s = Dn(0, r), o = i === null ? s : i, l = document.createElement(o); let a = l; this.hasFormat("code") && l.setAttribute("spellcheck", "false"), i !== null && (a = document.createElement(s), l.appendChild(a)), Gr(a, this, 0, r, this.__text, e); const c = this.__style; return c !== "" && (l.style.cssText = c), l; } updateDOM(e, t, r) { const i = this.__text, s = e.__format, o = this.__format, l = wn(0, s), a = wn(0, o), c = Dn(0, s), u = Dn(0, o); if ((l === null ? c : l) !== (a === null ? u : a)) return !0; if (l ==