teem-editor 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- import { jsxs as d, jsx as i, Fragment as ve } from "react/jsx-runtime";
2
- import { useState as E, useRef as F, useEffect as G, useId as ut, forwardRef as dt, useCallback as A, useImperativeHandle as ft } from "react";
3
- import gt from "dompurify";
1
+ import { jsxs as d, jsx as i, Fragment as Le } from "react/jsx-runtime";
2
+ import { useState as w, useRef as F, useEffect as X, useId as dt, forwardRef as ft, useCallback as A, useImperativeHandle as gt } from "react";
3
+ import ht from "dompurify";
4
4
  const b = {
5
5
  fill: "none",
6
6
  stroke: "currentColor",
@@ -8,7 +8,7 @@ const b = {
8
8
  strokeLinecap: "round",
9
9
  strokeLinejoin: "round"
10
10
  };
11
- function L({ children: e, size: t = 18 }) {
11
+ function C({ children: e, size: t = 18 }) {
12
12
  return /* @__PURE__ */ i(
13
13
  "svg",
14
14
  {
@@ -21,16 +21,16 @@ function L({ children: e, size: t = 18 }) {
21
21
  }
22
22
  );
23
23
  }
24
- const C = {
25
- undo: /* @__PURE__ */ d(L, { children: [
24
+ const E = {
25
+ undo: /* @__PURE__ */ d(C, { children: [
26
26
  /* @__PURE__ */ i("path", { ...b, d: "M9 14L4 9l5-5" }),
27
27
  /* @__PURE__ */ i("path", { ...b, d: "M4 9h10a6 6 0 010 12h-3" })
28
28
  ] }),
29
- redo: /* @__PURE__ */ d(L, { children: [
29
+ redo: /* @__PURE__ */ d(C, { children: [
30
30
  /* @__PURE__ */ i("path", { ...b, d: "M15 14l5-5-5-5" }),
31
31
  /* @__PURE__ */ i("path", { ...b, d: "M20 9H10a6 6 0 000 12h3" })
32
32
  ] }),
33
- bold: /* @__PURE__ */ d(L, { children: [
33
+ bold: /* @__PURE__ */ d(C, { children: [
34
34
  /* @__PURE__ */ i(
35
35
  "path",
36
36
  {
@@ -54,22 +54,22 @@ const C = {
54
54
  }
55
55
  )
56
56
  ] }),
57
- italic: /* @__PURE__ */ d(L, { children: [
57
+ italic: /* @__PURE__ */ d(C, { children: [
58
58
  /* @__PURE__ */ i("path", { ...b, d: "M10 5h8" }),
59
59
  /* @__PURE__ */ i("path", { ...b, d: "M6 19h8" }),
60
60
  /* @__PURE__ */ i("path", { ...b, d: "M14 5l-4 14" })
61
61
  ] }),
62
- strike: /* @__PURE__ */ d(L, { children: [
62
+ strike: /* @__PURE__ */ d(C, { children: [
63
63
  /* @__PURE__ */ i("path", { ...b, d: "M5 12h14" }),
64
64
  /* @__PURE__ */ i("path", { ...b, d: "M16 7.5A4 4 0 0012 6c-2.8 0-4.5 1.5-4.5 3.2 0 3.3 7.5 1.7 7.5 5.1A3.4 3.4 0 0112 18c-2.2 0-4-1-4.8-2.4" })
65
65
  ] }),
66
- ul: /* @__PURE__ */ d(L, { children: [
66
+ ul: /* @__PURE__ */ d(C, { children: [
67
67
  /* @__PURE__ */ i("path", { ...b, d: "M9 6h11M9 12h11M9 18h11" }),
68
68
  /* @__PURE__ */ i("circle", { cx: "5", cy: "6", r: "1.2", fill: "currentColor" }),
69
69
  /* @__PURE__ */ i("circle", { cx: "5", cy: "12", r: "1.2", fill: "currentColor" }),
70
70
  /* @__PURE__ */ i("circle", { cx: "5", cy: "18", r: "1.2", fill: "currentColor" })
71
71
  ] }),
72
- ol: /* @__PURE__ */ d(L, { children: [
72
+ ol: /* @__PURE__ */ d(C, { children: [
73
73
  /* @__PURE__ */ i("path", { ...b, d: "M11 6h9M11 12h9M11 18h9" }),
74
74
  /* @__PURE__ */ d(
75
75
  "g",
@@ -87,20 +87,20 @@ const C = {
87
87
  }
88
88
  )
89
89
  ] }),
90
- quote: /* @__PURE__ */ i(L, { children: /* @__PURE__ */ i("path", { fill: "currentColor", stroke: "none", d: "M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z" }) }),
91
- alignRight: /* @__PURE__ */ i(L, { children: /* @__PURE__ */ i("path", { ...b, d: "M4 6h16M8 12h12M4 18h16" }) }),
92
- alignCenter: /* @__PURE__ */ i(L, { children: /* @__PURE__ */ i("path", { ...b, d: "M4 6h16M7 12h10M4 18h16" }) }),
93
- alignLeft: /* @__PURE__ */ i(L, { children: /* @__PURE__ */ i("path", { ...b, d: "M4 6h16M4 12h12M4 18h16" }) }),
94
- link: /* @__PURE__ */ d(L, { children: [
90
+ quote: /* @__PURE__ */ i(C, { children: /* @__PURE__ */ i("path", { fill: "currentColor", stroke: "none", d: "M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z" }) }),
91
+ alignRight: /* @__PURE__ */ i(C, { children: /* @__PURE__ */ i("path", { ...b, d: "M4 6h16M8 12h12M4 18h16" }) }),
92
+ alignCenter: /* @__PURE__ */ i(C, { children: /* @__PURE__ */ i("path", { ...b, d: "M4 6h16M7 12h10M4 18h16" }) }),
93
+ alignLeft: /* @__PURE__ */ i(C, { children: /* @__PURE__ */ i("path", { ...b, d: "M4 6h16M4 12h12M4 18h16" }) }),
94
+ link: /* @__PURE__ */ d(C, { children: [
95
95
  /* @__PURE__ */ i("path", { ...b, d: "M10 13a5 5 0 007.07 0l1.41-1.41a5 5 0 00-7.07-7.07L10 5.93" }),
96
96
  /* @__PURE__ */ i("path", { ...b, d: "M14 11a5 5 0 00-7.07 0L5.52 12.4a5 5 0 007.07 7.07L14 18.07" })
97
97
  ] }),
98
- image: /* @__PURE__ */ d(L, { children: [
98
+ image: /* @__PURE__ */ d(C, { children: [
99
99
  /* @__PURE__ */ i("rect", { ...b, x: "3", y: "5", width: "18", height: "14", rx: "2" }),
100
100
  /* @__PURE__ */ i("circle", { cx: "9", cy: "10", r: "1.5", fill: "currentColor" }),
101
101
  /* @__PURE__ */ i("path", { ...b, d: "M3 16l5-4 4 3 3-2 6 3" })
102
102
  ] }),
103
- rtl: /* @__PURE__ */ d(L, { children: [
103
+ rtl: /* @__PURE__ */ d(C, { children: [
104
104
  /* @__PURE__ */ i(
105
105
  "path",
106
106
  {
@@ -111,7 +111,7 @@ const C = {
111
111
  ),
112
112
  /* @__PURE__ */ i("path", { fill: "currentColor", stroke: "none", d: "M3 18l4-4v3H19v2H7v3l-4-4z" })
113
113
  ] }),
114
- ltr: /* @__PURE__ */ d(L, { children: [
114
+ ltr: /* @__PURE__ */ d(C, { children: [
115
115
  /* @__PURE__ */ i("g", { transform: "translate(24 0) scale(-1 1)", children: /* @__PURE__ */ i(
116
116
  "path",
117
117
  {
@@ -122,31 +122,31 @@ const C = {
122
122
  ) }),
123
123
  /* @__PURE__ */ i("path", { fill: "currentColor", stroke: "none", d: "M21 18l-4-4v3H5v2h12v3l4-4z" })
124
124
  ] }),
125
- hr: /* @__PURE__ */ i(L, { children: /* @__PURE__ */ i("path", { ...b, d: "M4 12h16" }) }),
126
- indent: /* @__PURE__ */ d(L, { children: [
125
+ hr: /* @__PURE__ */ i(C, { children: /* @__PURE__ */ i("path", { ...b, d: "M4 12h16" }) }),
126
+ indent: /* @__PURE__ */ d(C, { children: [
127
127
  /* @__PURE__ */ i("path", { ...b, d: "M4 6h16M12 12h8M4 18h16" }),
128
128
  /* @__PURE__ */ i("path", { ...b, d: "M4 9l4 3-4 3" })
129
129
  ] }),
130
- outdent: /* @__PURE__ */ d(L, { children: [
130
+ outdent: /* @__PURE__ */ d(C, { children: [
131
131
  /* @__PURE__ */ i("path", { ...b, d: "M4 6h16M12 12h8M4 18h16" }),
132
132
  /* @__PURE__ */ i("path", { ...b, d: "M8 9L4 12l4 3" })
133
133
  ] }),
134
- textColor: /* @__PURE__ */ d(L, { children: [
134
+ textColor: /* @__PURE__ */ d(C, { children: [
135
135
  /* @__PURE__ */ i("path", { ...b, d: "M6 16l3.5-9h1L14 16" }),
136
136
  /* @__PURE__ */ i("path", { ...b, d: "M7.5 13h5" })
137
137
  ] }),
138
- bgColor: /* @__PURE__ */ d(L, { children: [
138
+ bgColor: /* @__PURE__ */ d(C, { children: [
139
139
  /* @__PURE__ */ i("path", { ...b, d: "M8 4l8 8-4 4-8-8z" }),
140
140
  /* @__PURE__ */ i("path", { ...b, d: "M5 19h10" })
141
141
  ] }),
142
- chevronDown: /* @__PURE__ */ i(L, { size: 12, children: /* @__PURE__ */ i("path", { ...b, d: "M6 9l6 6 6-6" }) }),
143
- code: /* @__PURE__ */ d(L, { children: [
142
+ chevronDown: /* @__PURE__ */ i(C, { size: 12, children: /* @__PURE__ */ i("path", { ...b, d: "M6 9l6 6 6-6" }) }),
143
+ code: /* @__PURE__ */ d(C, { children: [
144
144
  /* @__PURE__ */ i("path", { ...b, d: "M8 8L4 12l4 4" }),
145
145
  /* @__PURE__ */ i("path", { ...b, d: "M16 8l4 4-4 4" }),
146
146
  /* @__PURE__ */ i("path", { ...b, d: "M14 5l-4 14" })
147
147
  ] }),
148
- close: /* @__PURE__ */ i(L, { size: 16, children: /* @__PURE__ */ i("path", { ...b, d: "M6 6l12 12M18 6L6 18" }) })
149
- }, ht = {
148
+ close: /* @__PURE__ */ i(C, { size: 16, children: /* @__PURE__ */ i("path", { ...b, d: "M6 6l12 12M18 6L6 18" }) })
149
+ }, mt = {
150
150
  placeholder: "Write something…",
151
151
  toolbar: "TeemEditor toolbar",
152
152
  undo: "Undo",
@@ -229,7 +229,7 @@ const C = {
229
229
  fileBadContent: "File content is not a valid image.",
230
230
  fileMimeMismatch: "Declared file type does not match actual content.",
231
231
  fileReadError: "Failed to read the file."
232
- }, mt = {
232
+ }, pt = {
233
233
  placeholder: "متن خود را بنویسید…",
234
234
  toolbar: "نوار ابزار ویرایشگر",
235
235
  undo: "قبل (واگرد)",
@@ -312,7 +312,7 @@ const C = {
312
312
  fileBadContent: "محتوای فایل تصویر معتبر نیست.",
313
313
  fileMimeMismatch: "نوع اعلام‌شده فایل با محتوای واقعی هم‌خوانی ندارد.",
314
314
  fileReadError: "خواندن فایل با خطا مواجه شد."
315
- }, pt = {
315
+ }, bt = {
316
316
  placeholder: "اكتب شيئاً…",
317
317
  toolbar: "شريط أدوات المحرر",
318
318
  undo: "تراجع",
@@ -395,18 +395,18 @@ const C = {
395
395
  fileBadContent: "محتوى الملف ليس صورة صالحة.",
396
396
  fileMimeMismatch: "نوع الملف المعلن لا يطابق المحتوى الفعلي.",
397
397
  fileReadError: "فشل قراءة الملف."
398
- }, He = { en: ht, fa: mt, ar: pt }, bt = /* @__PURE__ */ new Set(["fa", "ar"]);
399
- function Le(e = "en") {
398
+ }, Oe = { en: mt, fa: pt, ar: bt }, yt = /* @__PURE__ */ new Set(["fa", "ar"]);
399
+ function Ce(e = "en") {
400
400
  const t = String(e || "en").toLowerCase();
401
- return He[t] ? t : "en";
401
+ return Oe[t] ? t : "en";
402
402
  }
403
- function Oe(e = "en") {
404
- return He[Le(e)];
403
+ function Be(e = "en") {
404
+ return Oe[Ce(e)];
405
405
  }
406
- function yt(e = "en") {
407
- return bt.has(Le(e)) ? "rtl" : "ltr";
406
+ function kt(e = "en") {
407
+ return yt.has(Ce(e)) ? "rtl" : "ltr";
408
408
  }
409
- function kt(e) {
409
+ function vt(e) {
410
410
  return [
411
411
  { value: "p", label: e.paragraph },
412
412
  { value: "h1", label: e.heading1 },
@@ -419,7 +419,7 @@ function kt(e) {
419
419
  { value: "pre", label: e.preformatted }
420
420
  ];
421
421
  }
422
- const vt = [
422
+ const Lt = [
423
423
  "#111827",
424
424
  "#dc2626",
425
425
  "#ea580c",
@@ -429,7 +429,7 @@ const vt = [
429
429
  "#7c3aed",
430
430
  "#db2777",
431
431
  "#ffffff"
432
- ], Lt = [
432
+ ], Ct = [
433
433
  "transparent",
434
434
  "#fef08a",
435
435
  "#bbf7d0",
@@ -460,7 +460,7 @@ function M({ label: e, active: t, disabled: n, onClick: r, children: l, classNam
460
460
  function K() {
461
461
  return /* @__PURE__ */ i("span", { className: "te-toolbar__divider", "aria-hidden": "true" });
462
462
  }
463
- function Se({
463
+ function _e({
464
464
  label: e,
465
465
  icon: t,
466
466
  colors: n,
@@ -471,30 +471,30 @@ function Se({
471
471
  disabled: c = !1,
472
472
  t: f
473
473
  }) {
474
- const [v, m] = E(!1), [S, I] = E(null), T = F(null), x = F(!1), w = S ?? r, _ = !w || w === "transparent" ? s ? "repeating-conic-gradient(#ddd 0% 25%, #fff 0% 50%) 50% / 6px 6px" : "#111827" : w;
475
- G(() => {
476
- if (!v || c) {
477
- I(null), c && m(!1);
474
+ const [k, v] = w(!1), [L, _] = w(null), T = F(null), x = F(!1), S = L ?? r, O = !S || S === "transparent" ? s ? "repeating-conic-gradient(#ddd 0% 25%, #fff 0% 50%) 50% / 6px 6px" : "#111827" : S;
475
+ X(() => {
476
+ if (!k || c) {
477
+ _(null), c && v(!1);
478
478
  return;
479
479
  }
480
- const h = (D) => {
481
- var P;
482
- x.current || (P = T.current) != null && P.contains(D.target) || m(!1);
483
- }, p = (D) => {
484
- D.key === "Escape" && !x.current && m(!1);
485
- }, u = () => {
480
+ const h = (u) => {
481
+ var D;
482
+ x.current || (D = T.current) != null && D.contains(u.target) || v(!1);
483
+ }, p = (u) => {
484
+ u.key === "Escape" && !x.current && v(!1);
485
+ }, z = () => {
486
486
  window.setTimeout(() => {
487
487
  x.current = !1;
488
488
  }, 50);
489
489
  };
490
- return document.addEventListener("mousedown", h), document.addEventListener("keydown", p), window.addEventListener("focus", u), () => {
491
- document.removeEventListener("mousedown", h), document.removeEventListener("keydown", p), window.removeEventListener("focus", u);
490
+ return document.addEventListener("mousedown", h), document.addEventListener("keydown", p), window.addEventListener("focus", z), () => {
491
+ document.removeEventListener("mousedown", h), document.removeEventListener("keydown", p), window.removeEventListener("focus", z);
492
492
  };
493
- }, [v, c]);
494
- const k = (h, { close: p = !0 } = {}) => {
495
- c || (a == null || a(), l(h), I(null), p && m(!1));
493
+ }, [k, c]);
494
+ const m = (h, { close: p = !0 } = {}) => {
495
+ c || (a == null || a(), l(h), _(null), p && v(!1));
496
496
  };
497
- return /* @__PURE__ */ d("div", { className: `te-color${v ? " is-open" : ""}${c ? " is-disabled" : ""}`, ref: T, children: [
497
+ return /* @__PURE__ */ d("div", { className: `te-color${k ? " is-open" : ""}${c ? " is-disabled" : ""}`, ref: T, children: [
498
498
  /* @__PURE__ */ d("div", { className: "te-color__split", children: [
499
499
  /* @__PURE__ */ d(
500
500
  "button",
@@ -513,7 +513,7 @@ function Se({
513
513
  "span",
514
514
  {
515
515
  className: "te-color__bar",
516
- style: { background: _ },
516
+ style: { background: O },
517
517
  "aria-hidden": "true"
518
518
  }
519
519
  )
@@ -524,20 +524,20 @@ function Se({
524
524
  "button",
525
525
  {
526
526
  type: "button",
527
- className: `te-tool te-color__caret${v ? " is-active" : ""}`,
527
+ className: `te-tool te-color__caret${k ? " is-active" : ""}`,
528
528
  title: `${f.openPalette}: ${e}`,
529
529
  "aria-label": `${f.openPalette}: ${e}`,
530
- "aria-expanded": v,
530
+ "aria-expanded": k,
531
531
  "aria-haspopup": "true",
532
532
  disabled: c,
533
533
  onMouseDown: (h) => {
534
- h.preventDefault(), !c && (a == null || a(), m((p) => !p));
534
+ h.preventDefault(), !c && (a == null || a(), v((p) => !p));
535
535
  },
536
- children: C.chevronDown
536
+ children: E.chevronDown
537
537
  }
538
538
  )
539
539
  ] }),
540
- v && !c ? /* @__PURE__ */ d(
540
+ k && !c ? /* @__PURE__ */ d(
541
541
  "div",
542
542
  {
543
543
  className: "te-color__swatches",
@@ -557,7 +557,7 @@ function Se({
557
557
  title: h === "transparent" ? f.noColor : h,
558
558
  "aria-label": h === "transparent" ? f.noColor : h,
559
559
  onMouseDown: (p) => {
560
- p.preventDefault(), p.stopPropagation(), k(h);
560
+ p.preventDefault(), p.stopPropagation(), m(h);
561
561
  }
562
562
  },
563
563
  h
@@ -574,7 +574,7 @@ function Se({
574
574
  "input",
575
575
  {
576
576
  type: "color",
577
- value: w && w !== "transparent" ? w : "#111827",
577
+ value: S && S !== "transparent" ? S : "#111827",
578
578
  onMouseDown: (h) => {
579
579
  h.stopPropagation(), x.current = !0;
580
580
  },
@@ -582,14 +582,14 @@ function Se({
582
582
  h.stopPropagation(), x.current = !0;
583
583
  },
584
584
  onInput: (h) => {
585
- I(h.target.value);
585
+ _(h.target.value);
586
586
  },
587
587
  onChange: (h) => {
588
- k(h.target.value, { close: !1 }), x.current = !1;
588
+ m(h.target.value, { close: !1 }), x.current = !1;
589
589
  },
590
590
  onBlur: () => {
591
591
  window.setTimeout(() => {
592
- x.current = !1, I(null);
592
+ x.current = !1, _(null);
593
593
  }, 50);
594
594
  },
595
595
  "aria-label": `${f.pickCustomColor}: ${e}`
@@ -602,7 +602,7 @@ function Se({
602
602
  ) : null
603
603
  ] });
604
604
  }
605
- function Ct({
605
+ function Et({
606
606
  t: e,
607
607
  states: t,
608
608
  canUndo: n,
@@ -612,16 +612,16 @@ function Ct({
612
612
  onOpenLink: s,
613
613
  onOpenImage: c,
614
614
  onUndo: f,
615
- onRedo: v,
616
- onRememberSelection: m,
617
- sourceMode: S = !1,
618
- onToggleSource: I
615
+ onRedo: k,
616
+ onRememberSelection: v,
617
+ sourceMode: L = !1,
618
+ onToggleSource: _
619
619
  }) {
620
- const [T, x] = E("#111827"), [w, _] = E("#fef08a"), k = S, h = kt(e);
620
+ const [T, x] = w("#111827"), [S, O] = w("#fef08a"), m = L, h = vt(e);
621
621
  return /* @__PURE__ */ d("div", { className: "te-toolbar", role: "toolbar", "aria-label": e.toolbar, children: [
622
622
  /* @__PURE__ */ d("div", { className: "te-toolbar__group", children: [
623
- /* @__PURE__ */ i(M, { label: e.undo, disabled: k || !n, onClick: f, children: C.undo }),
624
- /* @__PURE__ */ i(M, { label: e.redo, disabled: k || !r, onClick: v, children: C.redo })
623
+ /* @__PURE__ */ i(M, { label: e.undo, disabled: m || !n, onClick: f, children: E.undo }),
624
+ /* @__PURE__ */ i(M, { label: e.redo, disabled: m || !r, onClick: k, children: E.redo })
625
625
  ] }),
626
626
  /* @__PURE__ */ i(K, {}),
627
627
  /* @__PURE__ */ i("div", { className: "te-toolbar__group", children: /* @__PURE__ */ d("label", { className: "te-select-wrap", children: [
@@ -631,10 +631,10 @@ function Ct({
631
631
  {
632
632
  className: "te-select",
633
633
  value: t.format || "p",
634
- disabled: k,
634
+ disabled: m,
635
635
  onChange: (p) => a(p.target.value),
636
636
  onMouseDown: (p) => {
637
- p.stopPropagation(), m == null || m();
637
+ p.stopPropagation(), v == null || v();
638
638
  },
639
639
  children: h.map((p) => /* @__PURE__ */ i("option", { value: p.value, children: p.label }, p.value))
640
640
  }
@@ -647,9 +647,9 @@ function Ct({
647
647
  {
648
648
  label: e.bold,
649
649
  active: t.bold,
650
- disabled: k,
650
+ disabled: m,
651
651
  onClick: () => l("bold"),
652
- children: C.bold
652
+ children: E.bold
653
653
  }
654
654
  ),
655
655
  /* @__PURE__ */ i(
@@ -657,9 +657,9 @@ function Ct({
657
657
  {
658
658
  label: e.italic,
659
659
  active: t.italic,
660
- disabled: k,
660
+ disabled: m,
661
661
  onClick: () => l("italic"),
662
- children: C.italic
662
+ children: E.italic
663
663
  }
664
664
  ),
665
665
  /* @__PURE__ */ i(
@@ -667,9 +667,9 @@ function Ct({
667
667
  {
668
668
  label: e.strike,
669
669
  active: t.strikeThrough,
670
- disabled: k,
670
+ disabled: m,
671
671
  onClick: () => l("strikeThrough"),
672
- children: C.strike
672
+ children: E.strike
673
673
  }
674
674
  )
675
675
  ] }),
@@ -680,9 +680,9 @@ function Ct({
680
680
  {
681
681
  label: e.bulletList,
682
682
  active: t.unorderedList,
683
- disabled: k,
683
+ disabled: m,
684
684
  onClick: () => l("insertUnorderedList"),
685
- children: C.ul
685
+ children: E.ul
686
686
  }
687
687
  ),
688
688
  /* @__PURE__ */ i(
@@ -690,9 +690,9 @@ function Ct({
690
690
  {
691
691
  label: e.numberedList,
692
692
  active: t.orderedList,
693
- disabled: k,
693
+ disabled: m,
694
694
  onClick: () => l("insertOrderedList"),
695
- children: C.ol
695
+ children: E.ol
696
696
  }
697
697
  ),
698
698
  /* @__PURE__ */ i(
@@ -700,9 +700,9 @@ function Ct({
700
700
  {
701
701
  label: e.quote,
702
702
  active: t.format === "blockquote",
703
- disabled: k,
703
+ disabled: m,
704
704
  onClick: () => a(t.format === "blockquote" ? "p" : "blockquote"),
705
- children: C.quote
705
+ children: E.quote
706
706
  }
707
707
  )
708
708
  ] }),
@@ -713,9 +713,9 @@ function Ct({
713
713
  {
714
714
  label: t.hasSelectedImage ? e.alignImageRight : e.alignRight,
715
715
  active: t.justifyRight,
716
- disabled: k,
716
+ disabled: m,
717
717
  onClick: () => l("justifyRight"),
718
- children: C.alignRight
718
+ children: E.alignRight
719
719
  }
720
720
  ),
721
721
  /* @__PURE__ */ i(
@@ -723,9 +723,9 @@ function Ct({
723
723
  {
724
724
  label: t.hasSelectedImage ? e.alignImageCenter : e.alignCenter,
725
725
  active: t.justifyCenter,
726
- disabled: k,
726
+ disabled: m,
727
727
  onClick: () => l("justifyCenter"),
728
- children: C.alignCenter
728
+ children: E.alignCenter
729
729
  }
730
730
  ),
731
731
  /* @__PURE__ */ i(
@@ -733,16 +733,16 @@ function Ct({
733
733
  {
734
734
  label: t.hasSelectedImage ? e.alignImageLeft : e.alignLeft,
735
735
  active: t.justifyLeft,
736
- disabled: k,
736
+ disabled: m,
737
737
  onClick: () => l("justifyLeft"),
738
- children: C.alignLeft
738
+ children: E.alignLeft
739
739
  }
740
740
  )
741
741
  ] }),
742
742
  /* @__PURE__ */ i(K, {}),
743
743
  /* @__PURE__ */ d("div", { className: "te-toolbar__group", children: [
744
- /* @__PURE__ */ i(M, { label: e.rtl, disabled: k, onClick: () => l("rtl"), children: C.rtl }),
745
- /* @__PURE__ */ i(M, { label: e.ltr, disabled: k, onClick: () => l("ltr"), children: C.ltr })
744
+ /* @__PURE__ */ i(M, { label: e.rtl, disabled: m, onClick: () => l("rtl"), children: E.rtl }),
745
+ /* @__PURE__ */ i(M, { label: e.ltr, disabled: m, onClick: () => l("ltr"), children: E.ltr })
746
746
  ] }),
747
747
  /* @__PURE__ */ i(K, {}),
748
748
  /* @__PURE__ */ d("div", { className: "te-toolbar__group", children: [
@@ -751,9 +751,9 @@ function Ct({
751
751
  {
752
752
  label: e.indent,
753
753
  className: "te-tool--indent",
754
- disabled: k,
754
+ disabled: m,
755
755
  onClick: () => l("indent"),
756
- children: C.indent
756
+ children: E.indent
757
757
  }
758
758
  ),
759
759
  /* @__PURE__ */ i(
@@ -761,56 +761,56 @@ function Ct({
761
761
  {
762
762
  label: e.outdent,
763
763
  className: "te-tool--outdent",
764
- disabled: k,
764
+ disabled: m,
765
765
  onClick: () => l("outdent"),
766
- children: C.outdent
766
+ children: E.outdent
767
767
  }
768
768
  )
769
769
  ] }),
770
770
  /* @__PURE__ */ i(K, {}),
771
771
  /* @__PURE__ */ d("div", { className: "te-toolbar__group", children: [
772
- /* @__PURE__ */ i(M, { label: e.insertLink, disabled: k, onClick: s, children: C.link }),
773
- /* @__PURE__ */ i(M, { label: e.insertImage, disabled: k, onClick: c, children: C.image }),
772
+ /* @__PURE__ */ i(M, { label: e.insertLink, disabled: m, onClick: s, children: E.link }),
773
+ /* @__PURE__ */ i(M, { label: e.insertImage, disabled: m, onClick: c, children: E.image }),
774
774
  /* @__PURE__ */ i(
775
775
  M,
776
776
  {
777
777
  label: e.horizontalRule,
778
- disabled: k,
778
+ disabled: m,
779
779
  onClick: () => l("insertHorizontalRule"),
780
- children: C.hr
780
+ children: E.hr
781
781
  }
782
782
  )
783
783
  ] }),
784
784
  /* @__PURE__ */ i(K, {}),
785
785
  /* @__PURE__ */ d("div", { className: "te-toolbar__group te-toolbar__colors", children: [
786
786
  /* @__PURE__ */ i(
787
- Se,
787
+ _e,
788
788
  {
789
789
  label: e.textColor,
790
- icon: C.textColor,
791
- colors: vt,
790
+ icon: E.textColor,
791
+ colors: Lt,
792
792
  value: T,
793
- disabled: k,
793
+ disabled: m,
794
794
  t: e,
795
- onRememberSelection: m,
795
+ onRememberSelection: v,
796
796
  onChange: (p) => {
797
797
  x(p), l("foreColor", p);
798
798
  }
799
799
  }
800
800
  ),
801
801
  /* @__PURE__ */ i(
802
- Se,
802
+ _e,
803
803
  {
804
804
  label: e.bgColor,
805
- icon: C.bgColor,
806
- colors: Lt,
807
- value: w,
805
+ icon: E.bgColor,
806
+ colors: Ct,
807
+ value: S,
808
808
  allowTransparent: !0,
809
- disabled: k,
809
+ disabled: m,
810
810
  t: e,
811
- onRememberSelection: m,
811
+ onRememberSelection: v,
812
812
  onChange: (p) => {
813
- _(p), l("hiliteColor", p);
813
+ O(p), l("hiliteColor", p);
814
814
  }
815
815
  }
816
816
  )
@@ -819,26 +819,26 @@ function Ct({
819
819
  /* @__PURE__ */ i("div", { className: "te-toolbar__group", children: /* @__PURE__ */ i(
820
820
  M,
821
821
  {
822
- label: S ? e.visualMode : e.sourceMode,
823
- active: S,
824
- onClick: I,
825
- children: C.code
822
+ label: L ? e.visualMode : e.sourceMode,
823
+ active: L,
824
+ onClick: _,
825
+ children: E.code
826
826
  }
827
827
  ) })
828
828
  ] });
829
829
  }
830
- function Ce({ open: e, title: t, onClose: n, children: r, footer: l, closeLabel: a = "Close" }) {
831
- const s = ut(), c = F(null);
832
- return G(() => {
833
- var m, S;
830
+ function Ee({ open: e, title: t, onClose: n, children: r, footer: l, closeLabel: a = "Close" }) {
831
+ const s = dt(), c = F(null);
832
+ return X(() => {
833
+ var v, L;
834
834
  if (!e) return;
835
- const f = (I) => {
836
- I.key === "Escape" && (n == null || n());
835
+ const f = (_) => {
836
+ _.key === "Escape" && (n == null || n());
837
837
  };
838
838
  document.addEventListener("keydown", f);
839
- const v = document.activeElement;
840
- return (S = (m = c.current) == null ? void 0 : m.querySelector("input,button,textarea,select")) == null || S.focus(), () => {
841
- document.removeEventListener("keydown", f), v && typeof v.focus == "function" && v.focus();
839
+ const k = document.activeElement;
840
+ return (L = (v = c.current) == null ? void 0 : v.querySelector("input,button,textarea,select")) == null || L.focus(), () => {
841
+ document.removeEventListener("keydown", f), k && typeof k.focus == "function" && k.focus();
842
842
  };
843
843
  }, [e, n]), e ? /* @__PURE__ */ i("div", { className: "te-modal-backdrop", role: "presentation", onMouseDown: n, children: /* @__PURE__ */ d(
844
844
  "div",
@@ -859,7 +859,7 @@ function Ce({ open: e, title: t, onClose: n, children: r, footer: l, closeLabel:
859
859
  className: "te-modal__close",
860
860
  onClick: n,
861
861
  "aria-label": a,
862
- children: C.close
862
+ children: E.close
863
863
  }
864
864
  )
865
865
  ] }),
@@ -869,7 +869,7 @@ function Ce({ open: e, title: t, onClose: n, children: r, footer: l, closeLabel:
869
869
  }
870
870
  ) }) : null;
871
871
  }
872
- function Et({
872
+ function wt({
873
873
  open: e,
874
874
  onClose: t,
875
875
  onSubmit: n,
@@ -877,35 +877,35 @@ function Et({
877
877
  initialText: l = "",
878
878
  t: a
879
879
  }) {
880
- const [s, c] = E(r), [f, v] = E(l), [m, S] = E("");
881
- G(() => {
882
- e && (c(r), v(l), S(""));
880
+ const [s, c] = w(r), [f, k] = w(l), [v, L] = w("");
881
+ X(() => {
882
+ e && (c(r), k(l), L(""));
883
883
  }, [e, r, l]);
884
- const I = (T) => {
884
+ const _ = (T) => {
885
885
  T.preventDefault();
886
886
  const x = s.trim();
887
887
  if (!x) {
888
- S(a.linkUrlRequired);
888
+ L(a.linkUrlRequired);
889
889
  return;
890
890
  }
891
891
  try {
892
892
  n({ url: x, text: f.trim() }), t();
893
- } catch (w) {
894
- S(w.message || a.linkInvalid);
893
+ } catch (S) {
894
+ L(S.message || a.linkInvalid);
895
895
  }
896
896
  };
897
897
  return /* @__PURE__ */ i(
898
- Ce,
898
+ Ee,
899
899
  {
900
900
  open: e,
901
901
  title: a.linkTitle,
902
902
  onClose: t,
903
903
  closeLabel: a.close,
904
- footer: /* @__PURE__ */ d(ve, { children: [
904
+ footer: /* @__PURE__ */ d(Le, { children: [
905
905
  /* @__PURE__ */ i("button", { type: "button", className: "te-btn te-btn--ghost", onClick: t, children: a.cancel }),
906
906
  /* @__PURE__ */ i("button", { type: "submit", form: "te-link-form", className: "te-btn te-btn--primary", children: a.linkSubmit })
907
907
  ] }),
908
- children: /* @__PURE__ */ d("form", { id: "te-link-form", onSubmit: I, className: "te-form", children: [
908
+ children: /* @__PURE__ */ d("form", { id: "te-link-form", onSubmit: _, className: "te-form", children: [
909
909
  /* @__PURE__ */ d("label", { className: "te-field", children: [
910
910
  /* @__PURE__ */ i("span", { children: a.linkUrl }),
911
911
  /* @__PURE__ */ i(
@@ -928,11 +928,11 @@ function Et({
928
928
  type: "text",
929
929
  placeholder: a.linkTextPlaceholder,
930
930
  value: f,
931
- onChange: (T) => v(T.target.value)
931
+ onChange: (T) => k(T.target.value)
932
932
  }
933
933
  )
934
934
  ] }),
935
- m ? /* @__PURE__ */ i("p", { className: "te-error", children: m }) : null
935
+ v ? /* @__PURE__ */ i("p", { className: "te-error", children: v }) : null
936
936
  ] })
937
937
  }
938
938
  );
@@ -945,44 +945,44 @@ function At({
945
945
  accept: l = "image/jpeg,image/png,image/gif,image/webp",
946
946
  t: a
947
947
  }) {
948
- const [s, c] = E("file"), [f, v] = E(""), [m, S] = E(""), [I, T] = E(""), [x, w] = E(!1), _ = F(null);
949
- G(() => {
950
- e && (c("file"), v(""), S(""), T(""), w(!1), _.current && (_.current.value = ""));
948
+ const [s, c] = w("file"), [f, k] = w(""), [v, L] = w(""), [_, T] = w(""), [x, S] = w(!1), O = F(null);
949
+ X(() => {
950
+ e && (c("file"), k(""), L(""), T(""), S(!1), O.current && (O.current.value = ""));
951
951
  }, [e]);
952
- const k = async (p) => {
953
- p.preventDefault(), T(""), w(!0);
952
+ const m = async (p) => {
953
+ p.preventDefault(), T(""), S(!0);
954
954
  try {
955
- await n({ url: f.trim(), alt: m.trim() }), t();
956
- } catch (u) {
957
- T(u.message || a.imageInsertFailed);
955
+ await n({ url: f.trim(), alt: v.trim() }), t();
956
+ } catch (z) {
957
+ T(z.message || a.imageInsertFailed);
958
958
  } finally {
959
- w(!1);
959
+ S(!1);
960
960
  }
961
961
  }, h = async (p) => {
962
- var D, P;
962
+ var u, D;
963
963
  p.preventDefault();
964
- const u = (P = (D = _.current) == null ? void 0 : D.files) == null ? void 0 : P[0];
965
- if (!u) {
964
+ const z = (D = (u = O.current) == null ? void 0 : u.files) == null ? void 0 : D[0];
965
+ if (!z) {
966
966
  T(a.imagePickFile);
967
967
  return;
968
968
  }
969
- T(""), w(!0);
969
+ T(""), S(!0);
970
970
  try {
971
- await r({ file: u, alt: m.trim() }), t();
972
- } catch (q) {
973
- T(q.message || a.imageUploadFailed);
971
+ await r({ file: z, alt: v.trim() }), t();
972
+ } catch (Q) {
973
+ T(Q.message || a.imageUploadFailed);
974
974
  } finally {
975
- w(!1);
975
+ S(!1);
976
976
  }
977
977
  };
978
978
  return /* @__PURE__ */ d(
979
- Ce,
979
+ Ee,
980
980
  {
981
981
  open: e,
982
982
  title: a.imageTitle,
983
983
  onClose: t,
984
984
  closeLabel: a.close,
985
- footer: /* @__PURE__ */ d(ve, { children: [
985
+ footer: /* @__PURE__ */ d(Le, { children: [
986
986
  /* @__PURE__ */ i("button", { type: "button", className: "te-btn te-btn--ghost", onClick: t, disabled: x, children: a.cancel }),
987
987
  /* @__PURE__ */ i(
988
988
  "button",
@@ -1023,7 +1023,7 @@ function At({
1023
1023
  s === "file" ? /* @__PURE__ */ d("form", { id: "te-image-file-form", onSubmit: h, className: "te-form", children: [
1024
1024
  /* @__PURE__ */ d("label", { className: "te-field", children: [
1025
1025
  /* @__PURE__ */ i("span", { children: a.imageFile }),
1026
- /* @__PURE__ */ i("input", { ref: _, type: "file", accept: l })
1026
+ /* @__PURE__ */ i("input", { ref: O, type: "file", accept: l })
1027
1027
  ] }),
1028
1028
  /* @__PURE__ */ d("label", { className: "te-field", children: [
1029
1029
  /* @__PURE__ */ i("span", { children: a.imageAlt }),
@@ -1031,15 +1031,15 @@ function At({
1031
1031
  "input",
1032
1032
  {
1033
1033
  type: "text",
1034
- value: m,
1035
- onChange: (p) => S(p.target.value),
1034
+ value: v,
1035
+ onChange: (p) => L(p.target.value),
1036
1036
  placeholder: a.imageAltPlaceholder
1037
1037
  }
1038
1038
  )
1039
1039
  ] }),
1040
1040
  /* @__PURE__ */ i("p", { className: "te-hint", children: a.imageHint }),
1041
- I ? /* @__PURE__ */ i("p", { className: "te-error", children: I }) : null
1042
- ] }) : /* @__PURE__ */ d("form", { id: "te-image-url-form", onSubmit: k, className: "te-form", children: [
1041
+ _ ? /* @__PURE__ */ i("p", { className: "te-error", children: _ }) : null
1042
+ ] }) : /* @__PURE__ */ d("form", { id: "te-image-url-form", onSubmit: m, className: "te-form", children: [
1043
1043
  /* @__PURE__ */ d("label", { className: "te-field", children: [
1044
1044
  /* @__PURE__ */ i("span", { children: a.imageUrl }),
1045
1045
  /* @__PURE__ */ i(
@@ -1049,7 +1049,7 @@ function At({
1049
1049
  dir: "ltr",
1050
1050
  placeholder: "https://...",
1051
1051
  value: f,
1052
- onChange: (p) => v(p.target.value),
1052
+ onChange: (p) => k(p.target.value),
1053
1053
  required: !0
1054
1054
  }
1055
1055
  )
@@ -1060,34 +1060,34 @@ function At({
1060
1060
  "input",
1061
1061
  {
1062
1062
  type: "text",
1063
- value: m,
1064
- onChange: (p) => S(p.target.value),
1063
+ value: v,
1064
+ onChange: (p) => L(p.target.value),
1065
1065
  placeholder: a.imageAltPlaceholder
1066
1066
  }
1067
1067
  )
1068
1068
  ] }),
1069
- I ? /* @__PURE__ */ i("p", { className: "te-error", children: I }) : null
1069
+ _ ? /* @__PURE__ */ i("p", { className: "te-error", children: _ }) : null
1070
1070
  ] })
1071
1071
  ]
1072
1072
  }
1073
1073
  );
1074
1074
  }
1075
- function wt({ open: e, onClose: t, onSubmit: n, initialAlt: r = "", t: l }) {
1076
- const [a, s] = E(r);
1077
- G(() => {
1075
+ function Nt({ open: e, onClose: t, onSubmit: n, initialAlt: r = "", t: l }) {
1076
+ const [a, s] = w(r);
1077
+ X(() => {
1078
1078
  e && s(r);
1079
1079
  }, [e, r]);
1080
1080
  const c = (f) => {
1081
1081
  f.preventDefault(), n({ alt: a.trim() }), t();
1082
1082
  };
1083
1083
  return /* @__PURE__ */ i(
1084
- Ce,
1084
+ Ee,
1085
1085
  {
1086
1086
  open: e,
1087
1087
  title: l.altTitle,
1088
1088
  onClose: t,
1089
1089
  closeLabel: l.close,
1090
- footer: /* @__PURE__ */ d(ve, { children: [
1090
+ footer: /* @__PURE__ */ d(Le, { children: [
1091
1091
  /* @__PURE__ */ i("button", { type: "button", className: "te-btn te-btn--ghost", onClick: t, children: l.cancel }),
1092
1092
  /* @__PURE__ */ i("button", { type: "submit", form: "te-image-alt-form", className: "te-btn te-btn--primary", children: l.save })
1093
1093
  ] }),
@@ -1109,7 +1109,7 @@ function wt({ open: e, onClose: t, onSubmit: n, initialAlt: r = "", t: l }) {
1109
1109
  }
1110
1110
  );
1111
1111
  }
1112
- const Nt = [
1112
+ const Tt = [
1113
1113
  "p",
1114
1114
  "br",
1115
1115
  "div",
@@ -1137,7 +1137,7 @@ const Nt = [
1137
1137
  "hr",
1138
1138
  "u",
1139
1139
  "font"
1140
- ], Tt = [
1140
+ ], xt = [
1141
1141
  "href",
1142
1142
  "target",
1143
1143
  "rel",
@@ -1156,13 +1156,13 @@ const Nt = [
1156
1156
  "data-align",
1157
1157
  "loading",
1158
1158
  "draggable"
1159
- ], xt = /^(https?:|mailto:|tel:|blob:)/i, Mt = /^(https?:|blob:|data:image\/(png|jpeg|jpg|gif|webp);base64,)/i;
1160
- function ue(e, t = !1) {
1159
+ ], Mt = /^(https?:|mailto:|tel:|blob:)/i, St = /^(https?:|blob:|data:image\/(png|jpeg|jpg|gif|webp);base64,)/i;
1160
+ function de(e, t = !1) {
1161
1161
  if (!e || typeof e != "string") return !1;
1162
1162
  const n = e.trim();
1163
- return n.startsWith("javascript:") || n.startsWith("vbscript:") ? !1 : n.startsWith("#") || n.startsWith("/") ? !0 : t ? Mt.test(n) : xt.test(n) || n.startsWith("/");
1163
+ return n.startsWith("javascript:") || n.startsWith("vbscript:") ? !1 : n.startsWith("#") || n.startsWith("/") ? !0 : t ? St.test(n) : Mt.test(n) || n.startsWith("/");
1164
1164
  }
1165
- function St(e) {
1165
+ function _t(e) {
1166
1166
  if (!e || typeof e != "string") return "";
1167
1167
  const t = /* @__PURE__ */ new Set([
1168
1168
  "color",
@@ -1199,11 +1199,11 @@ function St(e) {
1199
1199
  return !t.has(l) || /expression|url\s*\(|javascript|import/i.test(a) ? null : `${l}: ${a}`;
1200
1200
  }).filter(Boolean).join("; ");
1201
1201
  }
1202
- function W(e) {
1202
+ function $(e) {
1203
1203
  if (!e) return "";
1204
- const t = gt.sanitize(e, {
1205
- ALLOWED_TAGS: Nt,
1206
- ALLOWED_ATTR: Tt,
1204
+ const t = ht.sanitize(e, {
1205
+ ALLOWED_TAGS: Tt,
1206
+ ALLOWED_ATTR: xt,
1207
1207
  ALLOW_DATA_ATTR: !1,
1208
1208
  FORBID_TAGS: ["script", "iframe", "object", "embed", "form", "input", "style"],
1209
1209
  FORBID_ATTR: [
@@ -1225,47 +1225,47 @@ function W(e) {
1225
1225
  r.replaceWith(l);
1226
1226
  }), n.querySelectorAll("a").forEach((r) => {
1227
1227
  const l = r.getAttribute("href") || "";
1228
- ue(l, !1) ? (r.setAttribute("rel", "noopener noreferrer"), /^https?:/i.test(l) && r.setAttribute("target", "_blank")) : r.removeAttribute("href");
1228
+ de(l, !1) ? (r.setAttribute("rel", "noopener noreferrer"), /^https?:/i.test(l) && r.setAttribute("target", "_blank")) : r.removeAttribute("href");
1229
1229
  }), n.querySelectorAll("img").forEach((r) => {
1230
1230
  var a, s, c, f;
1231
1231
  const l = r.getAttribute("src") || "";
1232
- if (!ue(l, !0)) {
1232
+ if (!de(l, !0)) {
1233
1233
  r.remove();
1234
1234
  return;
1235
1235
  }
1236
1236
  if (r.removeAttribute("onerror"), r.removeAttribute("onload"), !((s = (a = r.parentElement) == null ? void 0 : a.classList) != null && s.contains("te-figure"))) {
1237
- const v = document.createElement("div");
1238
- v.className = "te-figure", v.setAttribute("contenteditable", "false");
1239
- const m = r.style.textAlign || r.getAttribute("data-align") || ((f = (c = r.parentElement) == null ? void 0 : c.style) == null ? void 0 : f.textAlign) || "center";
1240
- v.setAttribute("data-align", m), v.style.textAlign = m, r.replaceWith(v), v.appendChild(r);
1237
+ const k = document.createElement("div");
1238
+ k.className = "te-figure", k.setAttribute("contenteditable", "false");
1239
+ const v = r.style.textAlign || r.getAttribute("data-align") || ((f = (c = r.parentElement) == null ? void 0 : c.style) == null ? void 0 : f.textAlign) || "center";
1240
+ k.setAttribute("data-align", v), k.style.textAlign = v, r.replaceWith(k), k.appendChild(r);
1241
1241
  }
1242
1242
  }), n.querySelectorAll(".te-figure").forEach((r) => {
1243
1243
  r.setAttribute("contenteditable", "false"), r.getAttribute("data-align") || r.setAttribute("data-align", r.style.textAlign || "center"), r.querySelectorAll(".te-figure__alt-btn, button").forEach((l) => l.remove()), r.classList.remove("is-selected");
1244
1244
  }), n.querySelectorAll("img.is-selected").forEach((r) => {
1245
1245
  r.classList.remove("is-selected");
1246
1246
  }), n.querySelectorAll("[style]").forEach((r) => {
1247
- const l = St(r.getAttribute("style"));
1247
+ const l = _t(r.getAttribute("style"));
1248
1248
  l ? r.setAttribute("style", l) : r.removeAttribute("style");
1249
- }), le(n), n.innerHTML;
1249
+ }), ie(n), n.innerHTML;
1250
1250
  }
1251
- function me(e) {
1251
+ function pe(e) {
1252
1252
  const t = e.parentNode;
1253
1253
  if (t) {
1254
1254
  for (; e.firstChild; ) t.insertBefore(e.firstChild, e);
1255
1255
  t.removeChild(e);
1256
1256
  }
1257
1257
  }
1258
- function _t(e) {
1258
+ function It(e) {
1259
1259
  const t = [];
1260
1260
  for (let n = 0; n < e.style.length; n += 1) t.push(e.style.item(n));
1261
1261
  return t;
1262
1262
  }
1263
- function pe(e) {
1263
+ function be(e) {
1264
1264
  if (!e || e.nodeType !== Node.ELEMENT_NODE || e.tagName !== "SPAN") return !1;
1265
- const t = _t(e);
1265
+ const t = It(e);
1266
1266
  return t.length ? t.every((n) => n === "color" || n === "background-color") : !1;
1267
1267
  }
1268
- function le(e) {
1268
+ function ie(e) {
1269
1269
  if (!e) return;
1270
1270
  let t = 0, n = !0;
1271
1271
  for (; n && t < 80; )
@@ -1273,30 +1273,30 @@ function le(e) {
1273
1273
  var a;
1274
1274
  if (!r.isConnected) return;
1275
1275
  if (!((a = r.getAttribute("style")) != null && a.trim()) && !r.className) {
1276
- me(r), n = !0;
1276
+ pe(r), n = !0;
1277
1277
  return;
1278
1278
  }
1279
- if (!pe(r)) return;
1279
+ if (!be(r)) return;
1280
1280
  const l = r.parentElement;
1281
- if (l && pe(l) && l.childNodes.length === 1 && l.firstChild === r) {
1281
+ if (l && be(l) && l.childNodes.length === 1 && l.firstChild === r) {
1282
1282
  for (r.style.color && (l.style.color = r.style.color), r.style.backgroundColor && (l.style.backgroundColor = r.style.backgroundColor); r.firstChild; ) l.insertBefore(r.firstChild, r);
1283
1283
  r.remove(), n = !0;
1284
1284
  return;
1285
1285
  }
1286
- l && pe(l) && (r.style.color && (l.style.color = r.style.color), r.style.backgroundColor && (l.style.backgroundColor = r.style.backgroundColor), me(r), n = !0);
1286
+ l && be(l) && (r.style.color && (l.style.color = r.style.color), r.style.backgroundColor && (l.style.backgroundColor = r.style.backgroundColor), pe(r), n = !0);
1287
1287
  });
1288
1288
  e.querySelectorAll("span").forEach((r) => {
1289
1289
  var l;
1290
- !((l = r.getAttribute("style")) != null && l.trim()) && !r.className && me(r);
1290
+ !((l = r.getAttribute("style")) != null && l.trim()) && !r.className && pe(r);
1291
1291
  });
1292
1292
  }
1293
- function It(e) {
1294
- return ue(e, !1);
1295
- }
1296
1293
  function Rt(e) {
1297
- return ue(e, !0);
1294
+ return de(e, !1);
1298
1295
  }
1299
- const Dt = [
1296
+ function Dt(e) {
1297
+ return de(e, !0);
1298
+ }
1299
+ const Ut = [
1300
1300
  { mime: "image/jpeg", bytes: [255, 216, 255] },
1301
1301
  { mime: "image/png", bytes: [137, 80, 78, 71] },
1302
1302
  {
@@ -1307,60 +1307,60 @@ const Dt = [
1307
1307
  mime: "image/webp",
1308
1308
  check: (e) => e.length >= 12 && e[0] === 82 && e[1] === 73 && e[2] === 70 && e[3] === 70 && e[8] === 87 && e[9] === 69 && e[10] === 66 && e[11] === 80
1309
1309
  }
1310
- ], Ut = {
1310
+ ], Ht = {
1311
1311
  maxSizeBytes: 2 * 1024 * 1024,
1312
1312
  allowedMimeTypes: ["image/jpeg", "image/png", "image/gif", "image/webp"],
1313
1313
  allowedExtensions: [".jpg", ".jpeg", ".png", ".gif", ".webp"]
1314
1314
  };
1315
- function Ht(e) {
1315
+ function Ot(e) {
1316
1316
  const t = e.lastIndexOf(".");
1317
1317
  return t === -1 ? "" : e.slice(t).toLowerCase();
1318
1318
  }
1319
- function Ot(e) {
1319
+ function Bt(e) {
1320
1320
  return e.replace(/[/\\?%*:|"<>]/g, "_").replace(/\s+/g, "-").replace(/\.+/g, ".").slice(0, 100) || "image";
1321
1321
  }
1322
- async function Bt(e, t = 16) {
1322
+ async function Ft(e, t = 16) {
1323
1323
  const r = await e.slice(0, t).arrayBuffer();
1324
1324
  return new Uint8Array(r);
1325
1325
  }
1326
- function Ft(e) {
1327
- for (const t of Dt)
1326
+ function Pt(e) {
1327
+ for (const t of Ut)
1328
1328
  if (t.check) {
1329
1329
  if (t.check(e)) return t.mime;
1330
1330
  } else if (t.bytes.every((n, r) => e[r] === n))
1331
1331
  return t.mime;
1332
1332
  return null;
1333
1333
  }
1334
- function Be(e = {}) {
1335
- return e.messages || Oe(e.language || "en");
1334
+ function Fe(e = {}) {
1335
+ return e.messages || Be(e.language || "en");
1336
1336
  }
1337
- async function Pt(e, t = {}) {
1338
- const n = { ...Ut, ...t }, r = Be(t), l = [];
1337
+ async function qt(e, t = {}) {
1338
+ const n = { ...Ht, ...t }, r = Fe(t), l = [];
1339
1339
  if (!e || !(e instanceof Blob))
1340
1340
  return { ok: !1, errors: [r.fileInvalid] };
1341
1341
  if (e.size <= 0 && l.push(r.fileEmpty), e.size > n.maxSizeBytes) {
1342
1342
  const f = (n.maxSizeBytes / 1048576).toFixed(1);
1343
1343
  l.push(r.fileTooLarge(f));
1344
1344
  }
1345
- const a = Ht(e.name || "");
1345
+ const a = Ot(e.name || "");
1346
1346
  n.allowedExtensions.includes(a) || l.push(r.fileBadExtension);
1347
1347
  const s = (e.type || "").toLowerCase();
1348
1348
  s && !n.allowedMimeTypes.includes(s) && l.push(r.fileBadMime);
1349
1349
  let c = null;
1350
1350
  try {
1351
- const f = await Bt(e);
1352
- c = Ft(f), c ? s && s !== c && !(s === "image/jpg" && c === "image/jpeg") && l.push(r.fileMimeMismatch) : l.push(r.fileBadContent);
1351
+ const f = await Ft(e);
1352
+ c = Pt(f), c ? s && s !== c && !(s === "image/jpg" && c === "image/jpeg") && l.push(r.fileMimeMismatch) : l.push(r.fileBadContent);
1353
1353
  } catch {
1354
1354
  l.push(r.fileReadError);
1355
1355
  }
1356
1356
  return l.length ? { ok: !1, errors: l } : {
1357
1357
  ok: !0,
1358
1358
  mime: c || s,
1359
- safeName: Ot(e.name || `image${a}`),
1359
+ safeName: Bt(e.name || `image${a}`),
1360
1360
  errors: []
1361
1361
  };
1362
1362
  }
1363
- function qt(e, t) {
1363
+ function jt(e, t) {
1364
1364
  return new Promise((n, r) => {
1365
1365
  const l = new FileReader();
1366
1366
  l.onload = () => {
@@ -1380,8 +1380,8 @@ function qt(e, t) {
1380
1380
  }, l.onerror = () => r(l.error || new Error("Failed to read file.")), l.readAsDataURL(e);
1381
1381
  });
1382
1382
  }
1383
- async function jt(e, t = {}) {
1384
- const n = Be(t), r = await Pt(e, t);
1383
+ async function $t(e, t = {}) {
1384
+ const n = Fe(t), r = await qt(e, t);
1385
1385
  if (!r.ok)
1386
1386
  throw new Error(r.errors.join(" "));
1387
1387
  if (typeof t.onUpload == "function") {
@@ -1394,12 +1394,12 @@ async function jt(e, t = {}) {
1394
1394
  return l;
1395
1395
  }
1396
1396
  try {
1397
- return await qt(e, r.mime);
1397
+ return await jt(e, r.mime);
1398
1398
  } catch {
1399
1399
  throw new Error(n.fileReadError);
1400
1400
  }
1401
1401
  }
1402
- function $t(e = 50) {
1402
+ function zt(e = 50) {
1403
1403
  let t = [], n = -1;
1404
1404
  return {
1405
1405
  push(r) {
@@ -1428,13 +1428,13 @@ function $t(e = 50) {
1428
1428
  function J(e) {
1429
1429
  e && e.focus({ preventScroll: !0 });
1430
1430
  }
1431
- function re(e) {
1431
+ function ne(e) {
1432
1432
  const t = window.getSelection();
1433
1433
  if (!t || t.rangeCount === 0) return null;
1434
1434
  const n = t.getRangeAt(0);
1435
1435
  return e.contains(n.commonAncestorContainer) ? n.cloneRange() : null;
1436
1436
  }
1437
- function de(e) {
1437
+ function fe(e) {
1438
1438
  if (!e) return !1;
1439
1439
  const t = window.getSelection();
1440
1440
  if (!t) return !1;
@@ -1444,64 +1444,64 @@ function de(e) {
1444
1444
  return !1;
1445
1445
  }
1446
1446
  }
1447
- function O(e, t = null) {
1447
+ function H(e, t = null) {
1448
1448
  try {
1449
1449
  return document.execCommand(e, !1, t);
1450
1450
  } catch {
1451
1451
  return !1;
1452
1452
  }
1453
1453
  }
1454
- function X(e) {
1454
+ function G(e) {
1455
1455
  try {
1456
1456
  return document.queryCommandState(e);
1457
1457
  } catch {
1458
1458
  return !1;
1459
1459
  }
1460
1460
  }
1461
- function zt(e) {
1461
+ function Wt(e) {
1462
1462
  try {
1463
1463
  return document.queryCommandValue(e);
1464
1464
  } catch {
1465
1465
  return "";
1466
1466
  }
1467
1467
  }
1468
- function Wt() {
1469
- const e = (zt("formatBlock") || "").toLowerCase();
1468
+ function Kt() {
1469
+ const e = (Wt("formatBlock") || "").toLowerCase();
1470
1470
  return e ? e.replace(/[<>]/g, "") : "p";
1471
1471
  }
1472
- function Fe() {
1472
+ function Pe() {
1473
1473
  try {
1474
1474
  document.execCommand("styleWithCSS", !1, !0);
1475
1475
  } catch {
1476
1476
  }
1477
1477
  }
1478
- function ie(e) {
1478
+ function ae(e) {
1479
1479
  const t = window.getSelection();
1480
1480
  if (!t || t.rangeCount === 0) return null;
1481
1481
  const n = t.getRangeAt(0);
1482
1482
  return e.contains(n.commonAncestorContainer) ? n : null;
1483
1483
  }
1484
- function _e(e, t) {
1484
+ function Ie(e, t) {
1485
1485
  J(e);
1486
- let n = ie(e);
1486
+ let n = ae(e);
1487
1487
  if (!n) return !1;
1488
1488
  if (n.collapsed) {
1489
- const a = Kt(n);
1489
+ const a = Vt(n);
1490
1490
  if (a)
1491
- de(a), n = a;
1491
+ fe(a), n = a;
1492
1492
  else {
1493
1493
  const s = document.createElement("span");
1494
1494
  t.color && (s.style.color = t.color), t.backgroundColor && (s.style.backgroundColor = t.backgroundColor), s.appendChild(document.createTextNode("​")), n.insertNode(s);
1495
1495
  const c = document.createRange();
1496
- return c.setStart(s.firstChild, 1), c.collapse(!0), de(c), !0;
1496
+ return c.setStart(s.firstChild, 1), c.collapse(!0), fe(c), !0;
1497
1497
  }
1498
1498
  }
1499
- if (Gt(n, t))
1500
- return le(e), !0;
1501
- const l = Jt(e, t);
1502
- return le(e), l;
1499
+ if (Jt(n, t))
1500
+ return ie(e), !0;
1501
+ const l = Qt(e, t);
1502
+ return ie(e), l;
1503
1503
  }
1504
- function Kt(e) {
1504
+ function Vt(e) {
1505
1505
  const t = e.startContainer;
1506
1506
  if (!t || t.nodeType !== Node.TEXT_NODE) return null;
1507
1507
  const n = t.textContent || "";
@@ -1513,17 +1513,17 @@ function Kt(e) {
1513
1513
  const a = e.cloneRange();
1514
1514
  return a.setStart(t, r), a.setEnd(t, l), a;
1515
1515
  }
1516
- function Vt(e) {
1516
+ function Gt(e) {
1517
1517
  const t = [];
1518
1518
  for (let n = 0; n < e.style.length; n += 1) t.push(e.style.item(n));
1519
1519
  return t;
1520
1520
  }
1521
1521
  function Xt(e) {
1522
1522
  if (!e || e.nodeType !== Node.ELEMENT_NODE || e.tagName !== "SPAN") return !1;
1523
- const t = Vt(e);
1523
+ const t = Gt(e);
1524
1524
  return t.length ? t.every((n) => n === "color" || n === "background-color") : !1;
1525
1525
  }
1526
- function Gt(e, t) {
1526
+ function Jt(e, t) {
1527
1527
  var s;
1528
1528
  let n = e.commonAncestorContainer;
1529
1529
  n.nodeType === Node.TEXT_NODE && (n = n.parentElement);
@@ -1548,8 +1548,8 @@ function Gt(e, t) {
1548
1548
  }
1549
1549
  return !0;
1550
1550
  }
1551
- function Jt(e, t) {
1552
- const n = ie(e);
1551
+ function Qt(e, t) {
1552
+ const n = ae(e);
1553
1553
  if (!n || n.collapsed) return !1;
1554
1554
  const r = document.createElement("span");
1555
1555
  t.color && (r.style.color = t.color), t.backgroundColor && (r.style.backgroundColor = t.backgroundColor);
@@ -1557,7 +1557,7 @@ function Jt(e, t) {
1557
1557
  n.surroundContents(r);
1558
1558
  } catch {
1559
1559
  const a = n.extractContents(), s = document.createElement("div");
1560
- for (s.appendChild(a), le(s); s.firstChild; ) r.appendChild(s.firstChild);
1560
+ for (s.appendChild(a), ie(s); s.firstChild; ) r.appendChild(s.firstChild);
1561
1561
  n.insertNode(r);
1562
1562
  }
1563
1563
  const l = window.getSelection();
@@ -1567,66 +1567,66 @@ function Jt(e, t) {
1567
1567
  }
1568
1568
  return !0;
1569
1569
  }
1570
- function Qt(e) {
1570
+ function Yt(e) {
1571
1571
  J(e);
1572
- const t = ie(e);
1573
- t && (Fe(), O("hiliteColor", "transparent"), O("backColor", "transparent"), e.querySelectorAll("span[style]").forEach((n) => {
1572
+ const t = ae(e);
1573
+ t && (Pe(), H("hiliteColor", "transparent"), H("backColor", "transparent"), e.querySelectorAll("span[style]").forEach((n) => {
1574
1574
  var r;
1575
1575
  t.intersectsNode(n) && (n.style.backgroundColor = "", (r = n.getAttribute("style")) != null && r.trim() || n.removeAttribute("style"));
1576
- }), le(e));
1576
+ }), ie(e));
1577
1577
  }
1578
- function Ie(e, t, n, r = {}) {
1579
- switch (J(e), Fe(), t) {
1578
+ function Re(e, t, n, r = {}) {
1579
+ switch (J(e), Pe(), t) {
1580
1580
  case "bold":
1581
- O("bold");
1581
+ H("bold");
1582
1582
  break;
1583
1583
  case "italic":
1584
- O("italic");
1584
+ H("italic");
1585
1585
  break;
1586
1586
  case "strikeThrough":
1587
- O("strikeThrough");
1587
+ H("strikeThrough");
1588
1588
  break;
1589
1589
  case "formatBlock": {
1590
1590
  const l = n || "p";
1591
- O("formatBlock", l === "p" ? "p" : l);
1591
+ H("formatBlock", l === "p" ? "p" : l);
1592
1592
  break;
1593
1593
  }
1594
1594
  case "insertUnorderedList":
1595
- O("insertUnorderedList");
1595
+ H("insertUnorderedList");
1596
1596
  break;
1597
1597
  case "insertOrderedList":
1598
- O("insertOrderedList");
1598
+ H("insertOrderedList");
1599
1599
  break;
1600
1600
  case "justifyRight":
1601
- be(e, "right", r.selectedImage);
1601
+ ye(e, "right", r.selectedImage);
1602
1602
  break;
1603
1603
  case "justifyCenter":
1604
- be(e, "center", r.selectedImage);
1604
+ ye(e, "center", r.selectedImage);
1605
1605
  break;
1606
1606
  case "justifyLeft":
1607
- be(e, "left", r.selectedImage);
1607
+ ye(e, "left", r.selectedImage);
1608
1608
  break;
1609
1609
  case "indent":
1610
- Re(e, 1);
1610
+ De(e, 1);
1611
1611
  break;
1612
1612
  case "outdent":
1613
- Re(e, -1);
1613
+ De(e, -1);
1614
1614
  break;
1615
1615
  case "insertHorizontalRule":
1616
- O("insertHorizontalRule");
1616
+ H("insertHorizontalRule");
1617
1617
  break;
1618
1618
  case "foreColor":
1619
- _e(e, { color: n });
1619
+ Ie(e, { color: n });
1620
1620
  break;
1621
1621
  case "hiliteColor":
1622
- !n || n === "transparent" ? Qt(e) : _e(e, { backgroundColor: n });
1622
+ !n || n === "transparent" ? Yt(e) : Ie(e, { backgroundColor: n });
1623
1623
  break;
1624
1624
  case "removeFormat":
1625
- O("removeFormat");
1625
+ H("removeFormat");
1626
1626
  break;
1627
1627
  }
1628
1628
  }
1629
- function Pe(e, t) {
1629
+ function qe(e, t) {
1630
1630
  var r;
1631
1631
  let n = t;
1632
1632
  for (n && n.nodeType === Node.TEXT_NODE && (n = n.parentElement); n && n !== e; ) {
@@ -1639,8 +1639,8 @@ function Pe(e, t) {
1639
1639
  }
1640
1640
  return null;
1641
1641
  }
1642
- const Yt = 24, Zt = 240;
1643
- function er(e) {
1642
+ const Zt = 24, er = 240;
1643
+ function tr(e) {
1644
1644
  var r, l, a, s;
1645
1645
  const t = (r = e.style) == null ? void 0 : r.marginInlineStart;
1646
1646
  if (t) {
@@ -1654,10 +1654,10 @@ function er(e) {
1654
1654
  }
1655
1655
  return 0;
1656
1656
  }
1657
- function tr(e, t) {
1657
+ function rr(e, t) {
1658
1658
  const n = [], r = /* @__PURE__ */ new Set(), l = (a) => {
1659
1659
  var c;
1660
- const s = Pe(e, a);
1660
+ const s = qe(e, a);
1661
1661
  !s || s === e || r.has(s) || (c = s.matches) != null && c.call(s, "figure,.te-figure") || (r.add(s), n.push(s));
1662
1662
  };
1663
1663
  if (l(t.startContainer), l(t.endContainer), !t.collapsed)
@@ -1681,25 +1681,25 @@ function tr(e, t) {
1681
1681
  }
1682
1682
  return n;
1683
1683
  }
1684
- function Re(e, t) {
1684
+ function De(e, t) {
1685
1685
  J(e);
1686
- const n = ie(e);
1686
+ const n = ae(e);
1687
1687
  if (!n) return;
1688
- const r = tr(e, n);
1688
+ const r = rr(e, n);
1689
1689
  r.length && r.forEach((l) => {
1690
1690
  var c;
1691
1691
  if (l.tagName === "LI") {
1692
- rr(l, t);
1692
+ nr(l, t);
1693
1693
  return;
1694
1694
  }
1695
- const a = er(l), s = Math.max(
1695
+ const a = tr(l), s = Math.max(
1696
1696
  0,
1697
- Math.min(Zt, a + t * Yt)
1697
+ Math.min(er, a + t * Zt)
1698
1698
  );
1699
1699
  s <= 0 ? (l.style.marginInlineStart = "", (c = l.getAttribute("style")) != null && c.trim() || l.removeAttribute("style")) : l.style.marginInlineStart = `${s}px`;
1700
1700
  });
1701
1701
  }
1702
- function rr(e, t) {
1702
+ function nr(e, t) {
1703
1703
  const n = e.parentElement;
1704
1704
  if (!n || n.tagName !== "UL" && n.tagName !== "OL") return;
1705
1705
  if (t > 0) {
@@ -1712,35 +1712,35 @@ function rr(e, t) {
1712
1712
  const r = n.parentElement;
1713
1713
  !r || r.tagName !== "LI" || !r.parentElement || (r.after(e), n.children.length || n.remove());
1714
1714
  }
1715
- function be(e, t, n) {
1715
+ function ye(e, t, n) {
1716
1716
  var c, f;
1717
1717
  const r = n && e.contains(n) ? n : null;
1718
1718
  if (r) {
1719
- De(r, t);
1719
+ Ue(r, t);
1720
1720
  return;
1721
1721
  }
1722
- const l = ie(e), a = l == null ? void 0 : l.commonAncestorContainer, s = (a == null ? void 0 : a.nodeType) === Node.ELEMENT_NODE && a.tagName === "IMG" ? a : (f = (c = a == null ? void 0 : a.parentElement) == null ? void 0 : c.closest) == null ? void 0 : f.call(c, "img");
1722
+ const l = ae(e), a = l == null ? void 0 : l.commonAncestorContainer, s = (a == null ? void 0 : a.nodeType) === Node.ELEMENT_NODE && a.tagName === "IMG" ? a : (f = (c = a == null ? void 0 : a.parentElement) == null ? void 0 : c.closest) == null ? void 0 : f.call(c, "img");
1723
1723
  if (s && e.contains(s)) {
1724
- De(s, t);
1724
+ Ue(s, t);
1725
1725
  return;
1726
1726
  }
1727
- O(t === "right" ? "justifyRight" : t === "center" ? "justifyCenter" : "justifyLeft");
1727
+ H(t === "right" ? "justifyRight" : t === "center" ? "justifyCenter" : "justifyLeft");
1728
1728
  }
1729
- function qe(e) {
1729
+ function je(e) {
1730
1730
  var n, r;
1731
1731
  if ((r = (n = e.parentElement) == null ? void 0 : n.classList) != null && r.contains("te-figure"))
1732
1732
  return e.parentElement;
1733
1733
  const t = document.createElement("div");
1734
1734
  return t.className = "te-figure", t.setAttribute("contenteditable", "false"), e.replaceWith(t), t.appendChild(e), t;
1735
1735
  }
1736
- function De(e, t) {
1737
- const n = qe(e);
1736
+ function Ue(e, t) {
1737
+ const n = je(e);
1738
1738
  n.setAttribute("data-align", t), n.style.textAlign = t, n.style.width = "fit-content", n.style.maxWidth = "100%", e.style.display = "block", e.style.float = "none", e.style.marginLeft = "0", e.style.marginRight = "0", t === "center" ? (n.style.marginLeft = "auto", n.style.marginRight = "auto") : t === "left" ? (n.style.marginLeft = "0", n.style.marginRight = "auto") : (n.style.marginLeft = "auto", n.style.marginRight = "0");
1739
1739
  }
1740
- function ne(e, t, n) {
1740
+ function le(e, t, n) {
1741
1741
  if (!e || !t) return;
1742
- ce(t);
1743
- const r = qe(e);
1742
+ ue(t);
1743
+ const r = je(e);
1744
1744
  r.classList.add("is-selected"), e.classList.add("is-selected");
1745
1745
  let l = r.querySelector(".te-figure__alt-btn");
1746
1746
  l || (l = document.createElement("button"), l.type = "button", l.className = "te-figure__alt-btn", l.setAttribute("contenteditable", "false"), r.appendChild(l));
@@ -1751,12 +1751,12 @@ function ne(e, t, n) {
1751
1751
  const f = window.getSelection();
1752
1752
  f == null || f.removeAllRanges(), f == null || f.addRange(c), J(t);
1753
1753
  }
1754
- function ce(e) {
1754
+ function ue(e) {
1755
1755
  e && (e.querySelectorAll(".te-figure.is-selected, img.is-selected").forEach((t) => {
1756
1756
  t.classList.remove("is-selected");
1757
1757
  }), e.querySelectorAll(".te-figure__alt-btn").forEach((t) => t.remove()));
1758
1758
  }
1759
- function nr(e, t, n) {
1759
+ function lr(e, t, n) {
1760
1760
  var a;
1761
1761
  if (!e) return;
1762
1762
  e.setAttribute("alt", t || "");
@@ -1766,7 +1766,7 @@ function nr(e, t, n) {
1766
1766
  l.textContent = t ? `Alt: ${t.length > 28 ? `${t.slice(0, 28)}…` : t}` : s.editAlt || "Edit Alt";
1767
1767
  }
1768
1768
  }
1769
- function lr(e, t) {
1769
+ function ir(e, t) {
1770
1770
  J(e);
1771
1771
  const n = window.getSelection();
1772
1772
  if (!n || n.rangeCount === 0) {
@@ -1775,33 +1775,33 @@ function lr(e, t) {
1775
1775
  }
1776
1776
  let r = n.anchorNode;
1777
1777
  r && r.nodeType === Node.TEXT_NODE && (r = r.parentElement);
1778
- const l = Pe(e, r);
1778
+ const l = qe(e, r);
1779
1779
  l && l !== e ? (l.setAttribute("dir", t), l.style.direction = t) : e.setAttribute("dir", t);
1780
1780
  }
1781
- function ir(e, t, n, r) {
1782
- if (J(e), !It(t))
1781
+ function ar(e, t, n, r) {
1782
+ if (J(e), !Rt(t))
1783
1783
  throw new Error(r && r.linkUnsafe || "The link URL is invalid or unsafe.");
1784
1784
  const l = window.getSelection();
1785
1785
  if (l && !l.isCollapsed && e.contains(l.anchorNode)) {
1786
- O("createLink", t);
1786
+ H("createLink", t);
1787
1787
  const s = e.querySelectorAll("a[href]"), c = s[s.length - 1];
1788
1788
  c && (c.setAttribute("rel", "noopener noreferrer"), /^https?:/i.test(t) && c.setAttribute("target", "_blank"));
1789
1789
  } else {
1790
1790
  const s = n || t, c = document.createElement("a");
1791
- c.href = t, c.textContent = s, c.rel = "noopener noreferrer", /^https?:/i.test(t) && (c.target = "_blank"), ke(e, c);
1791
+ c.href = t, c.textContent = s, c.rel = "noopener noreferrer", /^https?:/i.test(t) && (c.target = "_blank"), ve(e, c);
1792
1792
  }
1793
1793
  }
1794
- function Ue(e, t, n = "", r) {
1795
- if (J(e), !Rt(t))
1794
+ function He(e, t, n = "", r) {
1795
+ if (J(e), !Dt(t))
1796
1796
  throw new Error(r && r.imageUnsafe || "The image URL is invalid or unsafe.");
1797
1797
  const l = document.createElement("div");
1798
1798
  l.className = "te-figure", l.setAttribute("contenteditable", "false"), l.setAttribute("data-align", "center"), l.style.textAlign = "center", l.style.width = "fit-content", l.style.maxWidth = "100%", l.style.marginLeft = "auto", l.style.marginRight = "auto";
1799
1799
  const a = document.createElement("img");
1800
- a.src = t, a.alt = n || "", a.setAttribute("loading", "lazy"), a.draggable = !1, a.style.display = "block", a.style.maxWidth = "100%", l.appendChild(a), ke(e, l);
1800
+ a.src = t, a.alt = n || "", a.setAttribute("loading", "lazy"), a.draggable = !1, a.style.display = "block", a.style.maxWidth = "100%", l.appendChild(a), ve(e, l);
1801
1801
  const s = document.createElement("p");
1802
- return s.innerHTML = "<br>", ke(e, s), a;
1802
+ return s.innerHTML = "<br>", ve(e, s), a;
1803
1803
  }
1804
- function ke(e, t) {
1804
+ function ve(e, t) {
1805
1805
  const n = window.getSelection();
1806
1806
  if (!n || n.rangeCount === 0) {
1807
1807
  e.appendChild(t);
@@ -1814,7 +1814,7 @@ function ke(e, t) {
1814
1814
  }
1815
1815
  r.deleteContents(), r.insertNode(t), r.setStartAfter(t), r.collapse(!0), n.removeAllRanges(), n.addRange(r);
1816
1816
  }
1817
- function ar(e) {
1817
+ function or(e) {
1818
1818
  var r, l, a;
1819
1819
  const t = (r = e == null ? void 0 : e.querySelector) == null ? void 0 : r.call(e, ".te-figure.is-selected, img.is-selected");
1820
1820
  let n = null;
@@ -1823,30 +1823,31 @@ function ar(e) {
1823
1823
  n = (s == null ? void 0 : s.getAttribute("data-align")) || null;
1824
1824
  }
1825
1825
  return {
1826
- bold: X("bold"),
1827
- italic: X("italic"),
1828
- strikeThrough: X("strikeThrough"),
1829
- unorderedList: X("insertUnorderedList"),
1830
- orderedList: X("insertOrderedList"),
1831
- justifyRight: n ? n === "right" : X("justifyRight"),
1832
- justifyCenter: n ? n === "center" : X("justifyCenter"),
1833
- justifyLeft: n ? n === "left" : X("justifyLeft"),
1834
- format: Wt(),
1826
+ bold: G("bold"),
1827
+ italic: G("italic"),
1828
+ strikeThrough: G("strikeThrough"),
1829
+ unorderedList: G("insertUnorderedList"),
1830
+ orderedList: G("insertOrderedList"),
1831
+ justifyRight: n ? n === "right" : G("justifyRight"),
1832
+ justifyCenter: n ? n === "center" : G("justifyCenter"),
1833
+ justifyLeft: n ? n === "left" : G("justifyLeft"),
1834
+ format: Kt(),
1835
1835
  hasSelectedImage: !!t
1836
1836
  };
1837
1837
  }
1838
- function Z(e) {
1838
+ const sr = "0.2.0", cr = "https://www.npmjs.com/package/teem-editor";
1839
+ function ee(e) {
1839
1840
  const t = (e || "").trim();
1840
1841
  return !t || t === "<br>" || t === "<div><br></div>" ? "<p><br></p>" : t;
1841
1842
  }
1842
- function ye(e) {
1843
+ function ke(e) {
1843
1844
  if (typeof document < "u") {
1844
1845
  const t = document.createElement("div");
1845
1846
  return t.innerHTML = e, t.querySelectorAll(".te-figure__alt-btn").forEach((n) => n.remove()), t.querySelectorAll(".is-selected").forEach((n) => n.classList.remove("is-selected")), t.querySelectorAll('[class=""]').forEach((n) => n.removeAttribute("class")), t.innerHTML;
1846
1847
  }
1847
1848
  return e.replace(/<button[^>]*class="[^"]*te-figure__alt-btn[^"]*"[^>]*>.*?<\/button>/gi, "").replace(/\s*is-selected/g, "").replace(/\sclass=""/g, "").replace(/\sclass=''/g, "");
1848
1849
  }
1849
- const ur = dt(function({
1850
+ const gr = ft(function({
1850
1851
  value: t,
1851
1852
  defaultValue: n = "<p><br></p>",
1852
1853
  onChange: r,
@@ -1855,15 +1856,16 @@ const ur = dt(function({
1855
1856
  dir: s,
1856
1857
  className: c = "",
1857
1858
  style: f,
1858
- minHeight: v = 220,
1859
- disabled: m = !1,
1860
- onUpload: S,
1861
- uploadOptions: I,
1862
- toolbar: T = !0
1863
- }, x) {
1864
- const w = Le(a), _ = Oe(w), k = s || yt(w), h = l ?? _.placeholder, p = F(null), u = F(null), D = F($t()), P = F(null), q = F(""), fe = F(!1), R = F(null), j = F(_);
1865
- j.current = _;
1866
- const [je, $e] = E(() => ({
1859
+ minHeight: k = 220,
1860
+ noscroll: v = !1,
1861
+ disabled: L = !1,
1862
+ onUpload: _,
1863
+ uploadOptions: T,
1864
+ toolbar: x = !0
1865
+ }, S) {
1866
+ const O = Ce(a), m = Be(O), h = s || kt(O), p = l ?? m.placeholder, z = F(null), u = F(null), D = F(zt()), Q = F(null), W = F(""), ge = F(!1), I = F(null), P = F(m);
1867
+ P.current = m;
1868
+ const [$e, ze] = w(() => ({
1867
1869
  bold: !1,
1868
1870
  italic: !1,
1869
1871
  strikeThrough: !1,
@@ -1874,40 +1876,40 @@ const ur = dt(function({
1874
1876
  justifyLeft: !1,
1875
1877
  format: "p",
1876
1878
  hasSelectedImage: !1
1877
- })), [ze, We] = E(!1), [Ke, Ve] = E(!1), [Xe, Ee] = E(!1), [Ge, Ae] = E(!1), [Je, we] = E(!1), [Qe, Ye] = E(""), [Ze, Q] = E(!0), [B, Ne] = E(!1), [te, Te] = E(""), $ = A(() => {
1878
- We(D.current.canUndo()), Ve(D.current.canRedo());
1879
+ })), [We, Ke] = w(!1), [Ve, Ge] = w(!1), [Xe, we] = w(!1), [Je, Ae] = w(!1), [Qe, Ne] = w(!1), [Ye, Ze] = w(""), [et, Y] = w(!0), [B, Te] = w(!1), [re, xe] = w(""), q = A(() => {
1880
+ Ke(D.current.canUndo()), Ge(D.current.canRedo());
1879
1881
  }, []), V = A(
1880
1882
  (o, { recordHistory: g = !0 } = {}) => {
1881
- const y = W(ye(Z(o)));
1882
- q.current = y, Q(!y.replace(/<[^>]+>/g, "").replace(/\u200b/g, "").trim()), g && (D.current.push(y), $()), r == null || r(y);
1883
+ const y = $(ke(ee(o)));
1884
+ W.current = y, Y(!y.replace(/<[^>]+>/g, "").replace(/\u200b/g, "").trim()), g && (D.current.push(y), q()), r == null || r(y);
1883
1885
  },
1884
- [r, $]
1885
- ), z = A(() => {
1886
+ [r, q]
1887
+ ), j = A(() => {
1886
1888
  var o;
1887
1889
  return ((o = u.current) == null ? void 0 : o.innerHTML) || "";
1888
- }, []), xe = A(
1890
+ }, []), Me = A(
1889
1891
  (o, { recordHistory: g = !1 } = {}) => {
1890
1892
  if (!u.current) return;
1891
- const y = W(Z(o));
1892
- u.current.innerHTML = y, q.current = y, Q(!y.replace(/<[^>]+>/g, "").replace(/\u200b/g, "").trim()), R.current = null, g && (D.current.push(y), $());
1893
+ const y = $(ee(o));
1894
+ u.current.innerHTML = y, W.current = y, Y(!y.replace(/<[^>]+>/g, "").replace(/\u200b/g, "").trim()), I.current = null, g && (D.current.push(y), q());
1893
1895
  },
1894
- [$]
1896
+ [q]
1895
1897
  );
1896
- G(() => {
1897
- const o = W(Z(t ?? n));
1898
- u.current && (u.current.innerHTML = o), q.current = o, D.current.reset(o), Q(!o.replace(/<[^>]+>/g, "").replace(/\u200b/g, "").trim()), $();
1899
- }, []), G(() => {
1898
+ X(() => {
1899
+ const o = $(ee(t ?? n));
1900
+ u.current && (u.current.innerHTML = o), W.current = o, D.current.reset(o), Y(!o.replace(/<[^>]+>/g, "").replace(/\u200b/g, "").trim()), q();
1901
+ }, []), X(() => {
1900
1902
  if (t === void 0 || !u.current) return;
1901
- const o = W(Z(t));
1902
- if (o !== q.current) {
1903
- const g = re(u.current);
1904
- u.current.innerHTML = o, q.current = o, Q(!o.replace(/<[^>]+>/g, "").replace(/\u200b/g, "").trim()), R.current = null, de(g);
1903
+ const o = $(ee(t));
1904
+ if (o !== W.current) {
1905
+ const g = ne(u.current);
1906
+ u.current.innerHTML = o, W.current = o, Y(!o.replace(/<[^>]+>/g, "").replace(/\u200b/g, "").trim()), I.current = null, fe(g);
1905
1907
  }
1906
1908
  }, [t]);
1907
1909
  const N = A(() => {
1908
- u.current && $e(ar(u.current));
1910
+ u.current && ze(or(u.current));
1909
1911
  }, []);
1910
- G(() => {
1912
+ X(() => {
1911
1913
  const o = () => {
1912
1914
  if (!u.current) return;
1913
1915
  const g = window.getSelection();
@@ -1915,194 +1917,194 @@ const ur = dt(function({
1915
1917
  };
1916
1918
  return document.addEventListener("selectionchange", o), () => document.removeEventListener("selectionchange", o);
1917
1919
  }, [N]);
1918
- const ee = A(() => {
1919
- const o = re(u.current);
1920
- o && (P.current = o);
1921
- }, []), Y = A(
1920
+ const te = A(() => {
1921
+ const o = ne(u.current);
1922
+ o && (Q.current = o);
1923
+ }, []), Z = A(
1922
1924
  (o) => {
1923
- const g = re(u.current);
1924
- g && (P.current = g), de(P.current), o(), V(z()), N();
1925
+ const g = ne(u.current);
1926
+ g && (Q.current = g), fe(Q.current), o(), V(j()), N();
1925
1927
  },
1926
- [V, z, N]
1927
- ), ae = A(
1928
+ [V, j, N]
1929
+ ), oe = A(
1928
1930
  (o, g) => {
1929
- m || Y(() => {
1930
- o === "rtl" || o === "ltr" ? lr(u.current, o) : Ie(u.current, o, g, {
1931
- selectedImage: R.current
1931
+ L || Z(() => {
1932
+ o === "rtl" || o === "ltr" ? ir(u.current, o) : Re(u.current, o, g, {
1933
+ selectedImage: I.current
1932
1934
  });
1933
1935
  });
1934
1936
  },
1935
- [m, Y]
1936
- ), et = A(
1937
+ [L, Z]
1938
+ ), tt = A(
1937
1939
  (o) => {
1938
- m || Y(() => {
1939
- Ie(u.current, "formatBlock", o);
1940
+ L || Z(() => {
1941
+ Re(u.current, "formatBlock", o);
1940
1942
  });
1941
1943
  },
1942
- [m, Y]
1943
- ), ge = A(() => {
1944
+ [L, Z]
1945
+ ), he = A(() => {
1944
1946
  const o = D.current.undo();
1945
- o == null || !u.current || (u.current.innerHTML = o, q.current = o, Q(!o.replace(/<[^>]+>/g, "").replace(/\u200b/g, "").trim()), R.current = null, $(), r == null || r(o), N());
1946
- }, [r, N, $]), he = A(() => {
1947
+ o == null || !u.current || (u.current.innerHTML = o, W.current = o, Y(!o.replace(/<[^>]+>/g, "").replace(/\u200b/g, "").trim()), I.current = null, q(), r == null || r(o), N());
1948
+ }, [r, N, q]), me = A(() => {
1947
1949
  const o = D.current.redo();
1948
- o == null || !u.current || (u.current.innerHTML = o, q.current = o, Q(!o.replace(/<[^>]+>/g, "").replace(/\u200b/g, "").trim()), R.current = null, $(), r == null || r(o), N());
1949
- }, [r, N, $]), Me = A(() => {
1950
- fe.current || (V(z()), N());
1951
- }, [V, z, N]), tt = A(
1950
+ o == null || !u.current || (u.current.innerHTML = o, W.current = o, Y(!o.replace(/<[^>]+>/g, "").replace(/\u200b/g, "").trim()), I.current = null, q(), r == null || r(o), N());
1951
+ }, [r, N, q]), Se = A(() => {
1952
+ ge.current || (V(j()), N());
1953
+ }, [V, j, N]), rt = A(
1952
1954
  (o) => {
1953
- var H, U;
1955
+ var U, R;
1954
1956
  o.preventDefault();
1955
- const g = ((H = o.clipboardData) == null ? void 0 : H.getData("text/plain")) || "", y = (U = o.clipboardData) == null ? void 0 : U.getData("text/html");
1957
+ const g = ((U = o.clipboardData) == null ? void 0 : U.getData("text/plain")) || "", y = (R = o.clipboardData) == null ? void 0 : R.getData("text/html");
1956
1958
  if (y) {
1957
- const se = W(y);
1958
- document.execCommand("insertHTML", !1, se);
1959
+ const ce = $(y);
1960
+ document.execCommand("insertHTML", !1, ce);
1959
1961
  } else
1960
1962
  document.execCommand("insertText", !1, g);
1961
- V(z());
1963
+ V(j());
1962
1964
  },
1963
- [V, z]
1964
- ), rt = A(
1965
+ [V, j]
1966
+ ), nt = A(
1965
1967
  (o) => {
1966
1968
  const g = o.metaKey || o.ctrlKey;
1967
- g && o.key.toLowerCase() === "z" && !o.shiftKey ? (o.preventDefault(), ge()) : g && (o.key.toLowerCase() === "y" || o.key.toLowerCase() === "z" && o.shiftKey) ? (o.preventDefault(), he()) : g && o.key.toLowerCase() === "b" ? (o.preventDefault(), ae("bold")) : g && o.key.toLowerCase() === "i" ? (o.preventDefault(), ae("italic")) : o.key === "Escape" && R.current && (ce(u.current), R.current = null, N());
1969
+ g && o.key.toLowerCase() === "z" && !o.shiftKey ? (o.preventDefault(), he()) : g && (o.key.toLowerCase() === "y" || o.key.toLowerCase() === "z" && o.shiftKey) ? (o.preventDefault(), me()) : g && o.key.toLowerCase() === "b" ? (o.preventDefault(), oe("bold")) : g && o.key.toLowerCase() === "i" ? (o.preventDefault(), oe("italic")) : o.key === "Escape" && I.current && (ue(u.current), I.current = null, N());
1968
1970
  },
1969
- [ae, he, ge, N]
1970
- ), oe = A((o) => {
1971
- o && (R.current = o, Ye(o.getAttribute("alt") || ""), we(!0));
1972
- }, []), nt = A(
1971
+ [oe, me, he, N]
1972
+ ), se = A((o) => {
1973
+ o && (I.current = o, Ze(o.getAttribute("alt") || ""), Ne(!0));
1974
+ }, []), lt = A(
1973
1975
  (o) => {
1974
1976
  const g = o.target;
1975
1977
  if (!(g instanceof Element) || !u.current) return;
1976
1978
  if (g.closest(".te-figure__alt-btn")) {
1977
1979
  o.preventDefault(), o.stopPropagation();
1978
- const U = g.closest(".te-figure"), se = U == null ? void 0 : U.querySelector("img");
1979
- se && oe(se);
1980
+ const R = g.closest(".te-figure"), ce = R == null ? void 0 : R.querySelector("img");
1981
+ ce && se(ce);
1980
1982
  return;
1981
1983
  }
1982
- const y = g.closest("img"), H = g.closest(".te-figure");
1984
+ const y = g.closest("img"), U = g.closest(".te-figure");
1983
1985
  if (y && u.current.contains(y)) {
1984
- o.preventDefault(), ne(y, u.current, j.current), R.current = y, P.current = re(u.current), N();
1986
+ o.preventDefault(), le(y, u.current, P.current), I.current = y, Q.current = ne(u.current), N();
1985
1987
  return;
1986
1988
  }
1987
- if (H && u.current.contains(H)) {
1988
- const U = H.querySelector("img");
1989
- if (U) {
1990
- o.preventDefault(), ne(U, u.current, j.current), R.current = U, P.current = re(u.current), N();
1989
+ if (U && u.current.contains(U)) {
1990
+ const R = U.querySelector("img");
1991
+ if (R) {
1992
+ o.preventDefault(), le(R, u.current, P.current), I.current = R, Q.current = ne(u.current), N();
1991
1993
  return;
1992
1994
  }
1993
1995
  }
1994
- R.current && (ce(u.current), R.current = null, N());
1996
+ I.current && (ue(u.current), I.current = null, N());
1995
1997
  },
1996
- [oe, N]
1997
- ), lt = A(
1998
+ [se, N]
1999
+ ), it = A(
1998
2000
  (o) => {
1999
2001
  const g = o.target;
2000
2002
  if (!(g instanceof Element) || !u.current) return;
2001
- const y = g.closest("img"), H = g.closest(".te-figure"), U = y || (H == null ? void 0 : H.querySelector("img"));
2002
- U && u.current.contains(U) && (o.preventDefault(), ne(U, u.current, j.current), oe(U));
2003
+ const y = g.closest("img"), U = g.closest(".te-figure"), R = y || (U == null ? void 0 : U.querySelector("img"));
2004
+ R && u.current.contains(R) && (o.preventDefault(), le(R, u.current, P.current), se(R));
2003
2005
  },
2004
- [oe]
2005
- ), it = A(() => {
2006
- ee(), Ee(!0);
2007
- }, [ee]), at = A(() => {
2008
- ee(), Ae(!0);
2009
- }, [ee]), ot = A(() => {
2010
- if (m) return;
2006
+ [se]
2007
+ ), at = A(() => {
2008
+ te(), we(!0);
2009
+ }, [te]), ot = A(() => {
2010
+ te(), Ae(!0);
2011
+ }, [te]), st = A(() => {
2012
+ if (L) return;
2011
2013
  if (!B) {
2012
- ce(u.current), R.current = null;
2013
- const g = W(ye(z()));
2014
- Te(g), Ne(!0);
2014
+ ue(u.current), I.current = null;
2015
+ const g = $(ke(j()));
2016
+ xe(g), Te(!0);
2015
2017
  return;
2016
2018
  }
2017
- const o = W(Z(te));
2018
- u.current && (u.current.innerHTML = o), q.current = o, Q(!o.replace(/<[^>]+>/g, "").replace(/\u200b/g, "").trim()), D.current.push(o), $(), r == null || r(o), Ne(!1), N();
2019
+ const o = $(ee(re));
2020
+ u.current && (u.current.innerHTML = o), W.current = o, Y(!o.replace(/<[^>]+>/g, "").replace(/\u200b/g, "").trim()), D.current.push(o), q(), r == null || r(o), Te(!1), N();
2019
2021
  }, [
2020
- m,
2022
+ L,
2021
2023
  B,
2022
- te,
2023
- z,
2024
+ re,
2025
+ j,
2024
2026
  r,
2025
- $,
2027
+ q,
2026
2028
  N
2027
- ]), st = A((o) => {
2028
- Te(o.target.value);
2029
- }, []), ct = A(() => {
2030
- const o = W(Z(te));
2031
- q.current = o, r == null || r(o);
2032
- }, [te, r]);
2033
- return ft(x, () => ({
2029
+ ]), ct = A((o) => {
2030
+ xe(o.target.value);
2031
+ }, []), ut = A(() => {
2032
+ const o = $(ee(re));
2033
+ W.current = o, r == null || r(o);
2034
+ }, [re, r]);
2035
+ return gt(S, () => ({
2034
2036
  focus: () => {
2035
2037
  var o;
2036
2038
  return (o = u.current) == null ? void 0 : o.focus();
2037
2039
  },
2038
- getHTML: () => W(ye(z())),
2040
+ getHTML: () => $(ke(j())),
2039
2041
  setHTML: (o) => {
2040
- xe(o, { recordHistory: !0 }), r == null || r(W(Z(o)));
2042
+ Me(o, { recordHistory: !0 }), r == null || r($(ee(o)));
2041
2043
  },
2042
2044
  clear: () => {
2043
- xe("<p><br></p>", { recordHistory: !0 }), r == null || r(W("<p><br></p>"));
2045
+ Me("<p><br></p>", { recordHistory: !0 }), r == null || r($("<p><br></p>"));
2044
2046
  },
2045
2047
  getEditorElement: () => u.current
2046
2048
  })), /* @__PURE__ */ d(
2047
2049
  "div",
2048
2050
  {
2049
- ref: p,
2050
- className: `te-root${m ? " is-disabled" : ""}${B ? " is-source" : ""} te-root--${k} ${c}`.trim(),
2051
+ ref: z,
2052
+ className: `te-root${L ? " is-disabled" : ""}${B ? " is-source" : ""}${v ? " te-root--noscroll" : ""} te-root--${h} ${c}`.trim(),
2051
2053
  style: f,
2052
- dir: k,
2053
- lang: w,
2054
+ dir: h,
2055
+ lang: O,
2054
2056
  onMouseDown: (o) => {
2055
2057
  var g, y;
2056
- (y = (g = o.target).closest) != null && y.call(g, ".te-toolbar") && ee();
2058
+ (y = (g = o.target).closest) != null && y.call(g, ".te-toolbar") && te();
2057
2059
  },
2058
2060
  children: [
2059
- T ? /* @__PURE__ */ i(
2060
- Ct,
2061
+ x ? /* @__PURE__ */ i(
2062
+ Et,
2061
2063
  {
2062
- t: _,
2063
- states: je,
2064
- canUndo: ze,
2065
- canRedo: Ke,
2066
- onCommand: ae,
2067
- onBlockChange: et,
2068
- onOpenLink: it,
2069
- onOpenImage: at,
2070
- onUndo: ge,
2071
- onRedo: he,
2072
- onRememberSelection: ee,
2064
+ t: m,
2065
+ states: $e,
2066
+ canUndo: We,
2067
+ canRedo: Ve,
2068
+ onCommand: oe,
2069
+ onBlockChange: tt,
2070
+ onOpenLink: at,
2071
+ onOpenImage: ot,
2072
+ onUndo: he,
2073
+ onRedo: me,
2074
+ onRememberSelection: te,
2073
2075
  sourceMode: B,
2074
- onToggleSource: ot
2076
+ onToggleSource: st
2075
2077
  }
2076
2078
  ) : null,
2077
2079
  /* @__PURE__ */ d("div", { className: "te-editor-shell", children: [
2078
- !B && Ze ? /* @__PURE__ */ i("div", { className: "te-placeholder", children: h }) : null,
2080
+ !B && et ? /* @__PURE__ */ i("div", { className: "te-placeholder", children: p }) : null,
2079
2081
  /* @__PURE__ */ i(
2080
2082
  "div",
2081
2083
  {
2082
2084
  ref: u,
2083
2085
  className: "te-editor",
2084
- contentEditable: !m && !B,
2086
+ contentEditable: !L && !B,
2085
2087
  role: "textbox",
2086
2088
  "aria-multiline": "true",
2087
- "aria-label": _.editorLabel,
2088
- "aria-placeholder": h,
2089
+ "aria-label": m.editorLabel,
2090
+ "aria-placeholder": p,
2089
2091
  "aria-hidden": B,
2090
2092
  suppressContentEditableWarning: !0,
2091
- style: { minHeight: v, display: B ? "none" : void 0 },
2092
- dir: k,
2093
- onInput: Me,
2094
- onPaste: tt,
2095
- onKeyDown: rt,
2096
- onMouseDown: nt,
2097
- onDoubleClick: lt,
2093
+ style: { minHeight: k, display: B ? "none" : void 0 },
2094
+ dir: h,
2095
+ onInput: Se,
2096
+ onPaste: rt,
2097
+ onKeyDown: nt,
2098
+ onMouseDown: lt,
2099
+ onDoubleClick: it,
2098
2100
  onBlur: () => {
2099
- B || V(z(), { recordHistory: !0 });
2101
+ B || V(j(), { recordHistory: !0 });
2100
2102
  },
2101
2103
  onCompositionStart: () => {
2102
- fe.current = !0;
2104
+ ge.current = !0;
2103
2105
  },
2104
2106
  onCompositionEnd: () => {
2105
- fe.current = !1, Me();
2107
+ ge.current = !1, Se();
2106
2108
  },
2107
2109
  onMouseUp: N,
2108
2110
  onKeyUp: N
@@ -2112,26 +2114,41 @@ const ur = dt(function({
2112
2114
  "textarea",
2113
2115
  {
2114
2116
  className: "te-source",
2115
- value: te,
2116
- onChange: st,
2117
- onBlur: ct,
2118
- disabled: m,
2117
+ value: re,
2118
+ onChange: ct,
2119
+ onBlur: ut,
2120
+ disabled: L,
2119
2121
  spellCheck: !1,
2120
2122
  dir: "ltr",
2121
- "aria-label": _.sourceLabel,
2122
- style: { minHeight: v }
2123
+ "aria-label": m.sourceLabel,
2124
+ style: { minHeight: k }
2123
2125
  }
2124
- ) : null
2126
+ ) : null,
2127
+ /* @__PURE__ */ d(
2128
+ "a",
2129
+ {
2130
+ className: "te-credit",
2131
+ href: cr,
2132
+ target: "_blank",
2133
+ rel: "noopener noreferrer",
2134
+ tabIndex: -1,
2135
+ onMouseDown: (o) => o.preventDefault(),
2136
+ children: [
2137
+ "powered by TeemEditor v.",
2138
+ sr
2139
+ ]
2140
+ }
2141
+ )
2125
2142
  ] }),
2126
2143
  /* @__PURE__ */ i(
2127
- Et,
2144
+ wt,
2128
2145
  {
2129
2146
  open: Xe && !B,
2130
- onClose: () => Ee(!1),
2131
- t: _,
2147
+ onClose: () => we(!1),
2148
+ t: m,
2132
2149
  onSubmit: ({ url: o, text: g }) => {
2133
- Y(() => {
2134
- ir(u.current, o, g, j.current);
2150
+ Z(() => {
2151
+ ar(u.current, o, g, P.current);
2135
2152
  });
2136
2153
  }
2137
2154
  }
@@ -2139,40 +2156,40 @@ const ur = dt(function({
2139
2156
  /* @__PURE__ */ i(
2140
2157
  At,
2141
2158
  {
2142
- open: Ge && !B,
2159
+ open: Je && !B,
2143
2160
  onClose: () => Ae(!1),
2144
- t: _,
2161
+ t: m,
2145
2162
  onSubmitUrl: async ({ url: o, alt: g }) => {
2146
- Y(() => {
2147
- const y = Ue(u.current, o, g, j.current);
2148
- y && (ne(y, u.current, j.current), R.current = y);
2163
+ Z(() => {
2164
+ const y = He(u.current, o, g, P.current);
2165
+ y && (le(y, u.current, P.current), I.current = y);
2149
2166
  });
2150
2167
  },
2151
2168
  onSubmitFile: async ({ file: o, alt: g }) => {
2152
- const y = await jt(o, {
2153
- ...I,
2154
- onUpload: S,
2155
- language: w,
2156
- messages: j.current
2169
+ const y = await $t(o, {
2170
+ ...T,
2171
+ onUpload: _,
2172
+ language: O,
2173
+ messages: P.current
2157
2174
  });
2158
- Y(() => {
2159
- const H = Ue(u.current, y, g, j.current);
2160
- H && (ne(H, u.current, j.current), R.current = H);
2175
+ Z(() => {
2176
+ const U = He(u.current, y, g, P.current);
2177
+ U && (le(U, u.current, P.current), I.current = U);
2161
2178
  });
2162
2179
  }
2163
2180
  }
2164
2181
  ),
2165
2182
  /* @__PURE__ */ i(
2166
- wt,
2183
+ Nt,
2167
2184
  {
2168
- open: Je && !B,
2169
- initialAlt: Qe,
2170
- onClose: () => we(!1),
2171
- t: _,
2185
+ open: Qe && !B,
2186
+ initialAlt: Ye,
2187
+ onClose: () => Ne(!1),
2188
+ t: m,
2172
2189
  onSubmit: ({ alt: o }) => {
2173
2190
  var y;
2174
- const g = R.current;
2175
- !g || !((y = u.current) != null && y.contains(g)) || (nr(g, o, j.current), V(z()), N());
2191
+ const g = I.current;
2192
+ !g || !((y = u.current) != null && y.contains(g)) || (lr(g, o, P.current), V(j()), N());
2176
2193
  }
2177
2194
  }
2178
2195
  )
@@ -2181,20 +2198,20 @@ const ur = dt(function({
2181
2198
  );
2182
2199
  });
2183
2200
  export {
2184
- ur as TeemEditor,
2185
- $t as createHistory,
2186
- ur as default,
2187
- le as flattenStyleSpans,
2188
- kt as getBlockOptions,
2189
- yt as getDefaultDir,
2190
- Oe as getMessages,
2191
- It as isSafeHref,
2192
- Rt as isSafeImageSrc,
2193
- He as locales,
2194
- jt as processImageUpload,
2195
- Le as resolveLanguage,
2196
- W as sanitizeHtml,
2197
- Ut as uploadDefaults,
2198
- Pt as validateImageFile
2201
+ gr as TeemEditor,
2202
+ zt as createHistory,
2203
+ gr as default,
2204
+ ie as flattenStyleSpans,
2205
+ vt as getBlockOptions,
2206
+ kt as getDefaultDir,
2207
+ Be as getMessages,
2208
+ Rt as isSafeHref,
2209
+ Dt as isSafeImageSrc,
2210
+ Oe as locales,
2211
+ $t as processImageUpload,
2212
+ Ce as resolveLanguage,
2213
+ $ as sanitizeHtml,
2214
+ Ht as uploadDefaults,
2215
+ qt as validateImageFile
2199
2216
  };
2200
2217
  //# sourceMappingURL=teem-editor.js.map