@ryzeup/richtexteditor 1.0.25 → 1.0.27

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.
package/dist/index.es.js CHANGED
@@ -1,182 +1,182 @@
1
- var ht = Object.defineProperty, pt = Object.defineProperties;
2
- var vt = Object.getOwnPropertyDescriptors;
1
+ var pt = Object.defineProperty, vt = Object.defineProperties;
2
+ var yt = Object.getOwnPropertyDescriptors;
3
3
  var ke = Object.getOwnPropertySymbols;
4
- var yt = Object.prototype.hasOwnProperty, Et = Object.prototype.propertyIsEnumerable;
5
- var Ne = (r, c, u) => c in r ? ht(r, c, { enumerable: !0, configurable: !0, writable: !0, value: u }) : r[c] = u, ce = (r, c) => {
6
- for (var u in c || (c = {}))
7
- yt.call(c, u) && Ne(r, u, c[u]);
4
+ var Et = Object.prototype.hasOwnProperty, wt = Object.prototype.propertyIsEnumerable;
5
+ var ze = (r, s, u) => s in r ? pt(r, s, { enumerable: !0, configurable: !0, writable: !0, value: u }) : r[s] = u, ce = (r, s) => {
6
+ for (var u in s || (s = {}))
7
+ Et.call(s, u) && ze(r, u, s[u]);
8
8
  if (ke)
9
- for (var u of ke(c))
10
- Et.call(c, u) && Ne(r, u, c[u]);
9
+ for (var u of ke(s))
10
+ wt.call(s, u) && ze(r, u, s[u]);
11
11
  return r;
12
- }, se = (r, c) => pt(r, vt(c));
13
- import * as wt from "react";
14
- import o, { useRef as $, useState as k, useEffect as I } from "react";
15
- import { createPortal as Ct } from "react-dom";
16
- window.React = wt;
12
+ }, se = (r, s) => vt(r, yt(s));
13
+ import * as Ct from "react";
14
+ import i, { useRef as W, useState as D, useEffect as U } from "react";
15
+ import { createPortal as bt } from "react-dom";
16
+ window.React = Ct;
17
17
  var je = {
18
18
  color: void 0,
19
19
  size: void 0,
20
20
  className: void 0,
21
21
  style: void 0,
22
22
  attr: void 0
23
- }, De = o.createContext && /* @__PURE__ */ o.createContext(je), bt = ["attr", "size", "title"];
24
- function Lt(r, c) {
23
+ }, De = i.createContext && /* @__PURE__ */ i.createContext(je), Lt = ["attr", "size", "title"];
24
+ function xt(r, s) {
25
25
  if (r == null) return {};
26
- var u = Rt(r, c), m, h;
26
+ var u = Rt(r, s), g, p;
27
27
  if (Object.getOwnPropertySymbols) {
28
- var C = Object.getOwnPropertySymbols(r);
29
- for (h = 0; h < C.length; h++)
30
- m = C[h], !(c.indexOf(m) >= 0) && Object.prototype.propertyIsEnumerable.call(r, m) && (u[m] = r[m]);
28
+ var b = Object.getOwnPropertySymbols(r);
29
+ for (p = 0; p < b.length; p++)
30
+ g = b[p], !(s.indexOf(g) >= 0) && Object.prototype.propertyIsEnumerable.call(r, g) && (u[g] = r[g]);
31
31
  }
32
32
  return u;
33
33
  }
34
- function Rt(r, c) {
34
+ function Rt(r, s) {
35
35
  if (r == null) return {};
36
36
  var u = {};
37
- for (var m in r)
38
- if (Object.prototype.hasOwnProperty.call(r, m)) {
39
- if (c.indexOf(m) >= 0) continue;
40
- u[m] = r[m];
37
+ for (var g in r)
38
+ if (Object.prototype.hasOwnProperty.call(r, g)) {
39
+ if (s.indexOf(g) >= 0) continue;
40
+ u[g] = r[g];
41
41
  }
42
42
  return u;
43
43
  }
44
- function G() {
45
- return G = Object.assign ? Object.assign.bind() : function(r) {
46
- for (var c = 1; c < arguments.length; c++) {
47
- var u = arguments[c];
48
- for (var m in u)
49
- Object.prototype.hasOwnProperty.call(u, m) && (r[m] = u[m]);
44
+ function ee() {
45
+ return ee = Object.assign ? Object.assign.bind() : function(r) {
46
+ for (var s = 1; s < arguments.length; s++) {
47
+ var u = arguments[s];
48
+ for (var g in u)
49
+ Object.prototype.hasOwnProperty.call(u, g) && (r[g] = u[g]);
50
50
  }
51
51
  return r;
52
- }, G.apply(this, arguments);
52
+ }, ee.apply(this, arguments);
53
53
  }
54
- function He(r, c) {
54
+ function He(r, s) {
55
55
  var u = Object.keys(r);
56
56
  if (Object.getOwnPropertySymbols) {
57
- var m = Object.getOwnPropertySymbols(r);
58
- c && (m = m.filter(function(h) {
59
- return Object.getOwnPropertyDescriptor(r, h).enumerable;
60
- })), u.push.apply(u, m);
57
+ var g = Object.getOwnPropertySymbols(r);
58
+ s && (g = g.filter(function(p) {
59
+ return Object.getOwnPropertyDescriptor(r, p).enumerable;
60
+ })), u.push.apply(u, g);
61
61
  }
62
62
  return u;
63
63
  }
64
- function ee(r) {
65
- for (var c = 1; c < arguments.length; c++) {
66
- var u = arguments[c] != null ? arguments[c] : {};
67
- c % 2 ? He(Object(u), !0).forEach(function(m) {
68
- xt(r, m, u[m]);
69
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(u)) : He(Object(u)).forEach(function(m) {
70
- Object.defineProperty(r, m, Object.getOwnPropertyDescriptor(u, m));
64
+ function te(r) {
65
+ for (var s = 1; s < arguments.length; s++) {
66
+ var u = arguments[s] != null ? arguments[s] : {};
67
+ s % 2 ? He(Object(u), !0).forEach(function(g) {
68
+ St(r, g, u[g]);
69
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(u)) : He(Object(u)).forEach(function(g) {
70
+ Object.defineProperty(r, g, Object.getOwnPropertyDescriptor(u, g));
71
71
  });
72
72
  }
73
73
  return r;
74
74
  }
75
- function xt(r, c, u) {
76
- return c = St(c), c in r ? Object.defineProperty(r, c, { value: u, enumerable: !0, configurable: !0, writable: !0 }) : r[c] = u, r;
75
+ function St(r, s, u) {
76
+ return s = Mt(s), s in r ? Object.defineProperty(r, s, { value: u, enumerable: !0, configurable: !0, writable: !0 }) : r[s] = u, r;
77
77
  }
78
- function St(r) {
79
- var c = Mt(r, "string");
80
- return typeof c == "symbol" ? c : c + "";
78
+ function Mt(r) {
79
+ var s = Tt(r, "string");
80
+ return typeof s == "symbol" ? s : s + "";
81
81
  }
82
- function Mt(r, c) {
82
+ function Tt(r, s) {
83
83
  if (typeof r != "object" || !r) return r;
84
84
  var u = r[Symbol.toPrimitive];
85
85
  if (u !== void 0) {
86
- var m = u.call(r, c);
87
- if (typeof m != "object") return m;
86
+ var g = u.call(r, s);
87
+ if (typeof g != "object") return g;
88
88
  throw new TypeError("@@toPrimitive must return a primitive value.");
89
89
  }
90
- return (c === "string" ? String : Number)(r);
90
+ return (s === "string" ? String : Number)(r);
91
91
  }
92
92
  function Fe(r) {
93
- return r && r.map((c, u) => /* @__PURE__ */ o.createElement(c.tag, ee({
93
+ return r && r.map((s, u) => /* @__PURE__ */ i.createElement(s.tag, te({
94
94
  key: u
95
- }, c.attr), Fe(c.child)));
95
+ }, s.attr), Fe(s.child)));
96
96
  }
97
- function z(r) {
98
- return (c) => /* @__PURE__ */ o.createElement(At, G({
99
- attr: ee({}, r.attr)
100
- }, c), Fe(r.child));
97
+ function N(r) {
98
+ return (s) => /* @__PURE__ */ i.createElement(At, ee({
99
+ attr: te({}, r.attr)
100
+ }, s), Fe(r.child));
101
101
  }
102
102
  function At(r) {
103
- var c = (u) => {
103
+ var s = (u) => {
104
104
  var {
105
- attr: m,
106
- size: h,
107
- title: C
108
- } = r, L = Lt(r, bt), T = h || u.size || "1em", E;
109
- return u.className && (E = u.className), r.className && (E = (E ? E + " " : "") + r.className), /* @__PURE__ */ o.createElement("svg", G({
105
+ attr: g,
106
+ size: p,
107
+ title: b
108
+ } = r, S = xt(r, Lt), T = p || u.size || "1em", E;
109
+ return u.className && (E = u.className), r.className && (E = (E ? E + " " : "") + r.className), /* @__PURE__ */ i.createElement("svg", ee({
110
110
  stroke: "currentColor",
111
111
  fill: "currentColor",
112
112
  strokeWidth: "0"
113
- }, u.attr, m, L, {
113
+ }, u.attr, g, S, {
114
114
  className: E,
115
- style: ee(ee({
115
+ style: te(te({
116
116
  color: r.color || u.color
117
117
  }, u.style), r.style),
118
118
  height: T,
119
119
  width: T,
120
120
  xmlns: "http://www.w3.org/2000/svg"
121
- }), C && /* @__PURE__ */ o.createElement("title", null, C), r.children);
121
+ }), b && /* @__PURE__ */ i.createElement("title", null, b), r.children);
122
122
  };
123
- return De !== void 0 ? /* @__PURE__ */ o.createElement(De.Consumer, null, (u) => c(u)) : c(je);
123
+ return De !== void 0 ? /* @__PURE__ */ i.createElement(De.Consumer, null, (u) => s(u)) : s(je);
124
124
  }
125
- function Tt(r) {
126
- return z({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M352 64c0-17.7-14.3-32-32-32L128 32c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32zm96 128c0-17.7-14.3-32-32-32L32 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l384 0c17.7 0 32-14.3 32-32zM0 448c0 17.7 14.3 32 32 32l384 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L32 416c-17.7 0-32 14.3-32 32zM352 320c0-17.7-14.3-32-32-32l-192 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32z" }, child: [] }] })(r);
127
- }
128
- function zt(r) {
129
- return z({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M448 64c0 17.7-14.3 32-32 32L192 96c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zm0 256c0 17.7-14.3 32-32 32l-224 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zM0 192c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 224c-17.7 0-32-14.3-32-32zM448 448c0 17.7-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z" }, child: [] }] })(r);
125
+ function Nt(r) {
126
+ return N({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M352 64c0-17.7-14.3-32-32-32L128 32c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32zm96 128c0-17.7-14.3-32-32-32L32 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l384 0c17.7 0 32-14.3 32-32zM0 448c0 17.7 14.3 32 32 32l384 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L32 416c-17.7 0-32 14.3-32 32zM352 320c0-17.7-14.3-32-32-32l-192 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32z" }, child: [] }] })(r);
130
127
  }
131
128
  function kt(r) {
132
- return z({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M0 96C0 60.7 28.7 32 64 32l384 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96zM323.8 202.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6L170.7 297c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4s12.4 13.6 21.6 13.6l96 0 32 0 208 0c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7l-120-176zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z" }, child: [] }] })(r);
129
+ return N({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M448 64c0 17.7-14.3 32-32 32L192 96c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zm0 256c0 17.7-14.3 32-32 32l-224 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zM0 192c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 224c-17.7 0-32-14.3-32-32zM448 448c0 17.7-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z" }, child: [] }] })(r);
133
130
  }
134
- function Nt(r) {
135
- return z({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M24 56c0-13.3 10.7-24 24-24l32 0c13.3 0 24 10.7 24 24l0 120 16 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-80 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l16 0 0-96-8 0C34.7 80 24 69.3 24 56zM86.7 341.2c-6.5-7.4-18.3-6.9-24 1.2L51.5 357.9c-7.7 10.8-22.7 13.3-33.5 5.6s-13.3-22.7-5.6-33.5l11.1-15.6c23.7-33.2 72.3-35.6 99.2-4.9c21.3 24.4 20.8 60.9-1.1 84.7L86.8 432l33.2 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-88 0c-9.5 0-18.2-5.6-22-14.4s-2.1-18.9 4.3-25.9l72-78c5.3-5.8 5.4-14.6 .3-20.5zM224 64l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32z" }, child: [] }] })(r);
131
+ function zt(r) {
132
+ return N({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M0 96C0 60.7 28.7 32 64 32l384 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96zM323.8 202.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6L170.7 297c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4s12.4 13.6 21.6 13.6l96 0 32 0 208 0c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7l-120-176zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z" }, child: [] }] })(r);
136
133
  }
137
134
  function Dt(r) {
138
- return z({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M12.83 352h262.34A12.82 12.82 0 0 0 288 339.17v-38.34A12.82 12.82 0 0 0 275.17 288H12.83A12.82 12.82 0 0 0 0 300.83v38.34A12.82 12.82 0 0 0 12.83 352zm0-256h262.34A12.82 12.82 0 0 0 288 83.17V44.83A12.82 12.82 0 0 0 275.17 32H12.83A12.82 12.82 0 0 0 0 44.83v38.34A12.82 12.82 0 0 0 12.83 96zM432 160H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0 256H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z" }, child: [] }] })(r);
135
+ return N({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M24 56c0-13.3 10.7-24 24-24l32 0c13.3 0 24 10.7 24 24l0 120 16 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-80 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l16 0 0-96-8 0C34.7 80 24 69.3 24 56zM86.7 341.2c-6.5-7.4-18.3-6.9-24 1.2L51.5 357.9c-7.7 10.8-22.7 13.3-33.5 5.6s-13.3-22.7-5.6-33.5l11.1-15.6c23.7-33.2 72.3-35.6 99.2-4.9c21.3 24.4 20.8 60.9-1.1 84.7L86.8 432l33.2 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-88 0c-9.5 0-18.2-5.6-22-14.4s-2.1-18.9 4.3-25.9l72-78c5.3-5.8 5.4-14.6 .3-20.5zM224 64l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32z" }, child: [] }] })(r);
139
136
  }
140
137
  function Ht(r) {
141
- return z({ attr: { viewBox: "0 0 384 512" }, child: [{ tag: "path", attr: { d: "M333.49 238a122 122 0 0 0 27-65.21C367.87 96.49 308 32 233.42 32H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h31.87v288H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h209.32c70.8 0 134.14-51.75 141-122.4 4.74-48.45-16.39-92.06-50.83-119.6zM145.66 112h87.76a48 48 0 0 1 0 96h-87.76zm87.76 288h-87.76V288h87.76a56 56 0 0 1 0 112z" }, child: [] }] })(r);
138
+ return N({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M12.83 352h262.34A12.82 12.82 0 0 0 288 339.17v-38.34A12.82 12.82 0 0 0 275.17 288H12.83A12.82 12.82 0 0 0 0 300.83v38.34A12.82 12.82 0 0 0 12.83 352zm0-256h262.34A12.82 12.82 0 0 0 288 83.17V44.83A12.82 12.82 0 0 0 275.17 32H12.83A12.82 12.82 0 0 0 0 44.83v38.34A12.82 12.82 0 0 0 12.83 96zM432 160H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0 256H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z" }, child: [] }] })(r);
142
139
  }
143
140
  function Ot(r) {
144
- return z({ attr: { viewBox: "0 0 544 512" }, child: [{ tag: "path", attr: { d: "M0 479.98L99.92 512l35.45-35.45-67.04-67.04L0 479.98zm124.61-240.01a36.592 36.592 0 0 0-10.79 38.1l13.05 42.83-50.93 50.94 96.23 96.23 50.86-50.86 42.74 13.08c13.73 4.2 28.65-.01 38.15-10.78l35.55-41.64-173.34-173.34-41.52 35.44zm403.31-160.7l-63.2-63.2c-20.49-20.49-53.38-21.52-75.12-2.35L190.55 183.68l169.77 169.78L530.27 154.4c19.18-21.74 18.15-54.63-2.35-75.13z" }, child: [] }] })(r);
141
+ return N({ attr: { viewBox: "0 0 384 512" }, child: [{ tag: "path", attr: { d: "M333.49 238a122 122 0 0 0 27-65.21C367.87 96.49 308 32 233.42 32H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h31.87v288H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h209.32c70.8 0 134.14-51.75 141-122.4 4.74-48.45-16.39-92.06-50.83-119.6zM145.66 112h87.76a48 48 0 0 1 0 96h-87.76zm87.76 288h-87.76V288h87.76a56 56 0 0 1 0 112z" }, child: [] }] })(r);
145
142
  }
146
143
  function _t(r) {
147
- return z({ attr: { viewBox: "0 0 320 512" }, child: [{ tag: "path", attr: { d: "M320 48v32a16 16 0 0 1-16 16h-62.76l-80 320H208a16 16 0 0 1 16 16v32a16 16 0 0 1-16 16H16a16 16 0 0 1-16-16v-32a16 16 0 0 1 16-16h62.76l80-320H112a16 16 0 0 1-16-16V48a16 16 0 0 1 16-16h192a16 16 0 0 1 16 16z" }, child: [] }] })(r);
144
+ return N({ attr: { viewBox: "0 0 544 512" }, child: [{ tag: "path", attr: { d: "M0 479.98L99.92 512l35.45-35.45-67.04-67.04L0 479.98zm124.61-240.01a36.592 36.592 0 0 0-10.79 38.1l13.05 42.83-50.93 50.94 96.23 96.23 50.86-50.86 42.74 13.08c13.73 4.2 28.65-.01 38.15-10.78l35.55-41.64-173.34-173.34-41.52 35.44zm403.31-160.7l-63.2-63.2c-20.49-20.49-53.38-21.52-75.12-2.35L190.55 183.68l169.77 169.78L530.27 154.4c19.18-21.74 18.15-54.63-2.35-75.13z" }, child: [] }] })(r);
148
145
  }
149
146
  function jt(r) {
150
- return z({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M326.612 185.391c59.747 59.809 58.927 155.698.36 214.59-.11.12-.24.25-.36.37l-67.2 67.2c-59.27 59.27-155.699 59.262-214.96 0-59.27-59.26-59.27-155.7 0-214.96l37.106-37.106c9.84-9.84 26.786-3.3 27.294 10.606.648 17.722 3.826 35.527 9.69 52.721 1.986 5.822.567 12.262-3.783 16.612l-13.087 13.087c-28.026 28.026-28.905 73.66-1.155 101.96 28.024 28.579 74.086 28.749 102.325.51l67.2-67.19c28.191-28.191 28.073-73.757 0-101.83-3.701-3.694-7.429-6.564-10.341-8.569a16.037 16.037 0 0 1-6.947-12.606c-.396-10.567 3.348-21.456 11.698-29.806l21.054-21.055c5.521-5.521 14.182-6.199 20.584-1.731a152.482 152.482 0 0 1 20.522 17.197zM467.547 44.449c-59.261-59.262-155.69-59.27-214.96 0l-67.2 67.2c-.12.12-.25.25-.36.37-58.566 58.892-59.387 154.781.36 214.59a152.454 152.454 0 0 0 20.521 17.196c6.402 4.468 15.064 3.789 20.584-1.731l21.054-21.055c8.35-8.35 12.094-19.239 11.698-29.806a16.037 16.037 0 0 0-6.947-12.606c-2.912-2.005-6.64-4.875-10.341-8.569-28.073-28.073-28.191-73.639 0-101.83l67.2-67.19c28.239-28.239 74.3-28.069 102.325.51 27.75 28.3 26.872 73.934-1.155 101.96l-13.087 13.087c-4.35 4.35-5.769 10.79-3.783 16.612 5.864 17.194 9.042 34.999 9.69 52.721.509 13.906 17.454 20.446 27.294 10.606l37.106-37.106c59.271-59.259 59.271-155.699.001-214.959z" }, child: [] }] })(r);
147
+ return N({ attr: { viewBox: "0 0 320 512" }, child: [{ tag: "path", attr: { d: "M320 48v32a16 16 0 0 1-16 16h-62.76l-80 320H208a16 16 0 0 1 16 16v32a16 16 0 0 1-16 16H16a16 16 0 0 1-16-16v-32a16 16 0 0 1 16-16h62.76l80-320H112a16 16 0 0 1-16-16V48a16 16 0 0 1 16-16h192a16 16 0 0 1 16 16z" }, child: [] }] })(r);
151
148
  }
152
149
  function Ft(r) {
153
- return z({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M80 368H16a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16v-64a16 16 0 0 0-16-16zm0-320H16A16 16 0 0 0 0 64v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16V64a16 16 0 0 0-16-16zm0 160H16a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16v-64a16 16 0 0 0-16-16zm416 176H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z" }, child: [] }] })(r);
150
+ return N({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M326.612 185.391c59.747 59.809 58.927 155.698.36 214.59-.11.12-.24.25-.36.37l-67.2 67.2c-59.27 59.27-155.699 59.262-214.96 0-59.27-59.26-59.27-155.7 0-214.96l37.106-37.106c9.84-9.84 26.786-3.3 27.294 10.606.648 17.722 3.826 35.527 9.69 52.721 1.986 5.822.567 12.262-3.783 16.612l-13.087 13.087c-28.026 28.026-28.905 73.66-1.155 101.96 28.024 28.579 74.086 28.749 102.325.51l67.2-67.19c28.191-28.191 28.073-73.757 0-101.83-3.701-3.694-7.429-6.564-10.341-8.569a16.037 16.037 0 0 1-6.947-12.606c-.396-10.567 3.348-21.456 11.698-29.806l21.054-21.055c5.521-5.521 14.182-6.199 20.584-1.731a152.482 152.482 0 0 1 20.522 17.197zM467.547 44.449c-59.261-59.262-155.69-59.27-214.96 0l-67.2 67.2c-.12.12-.25.25-.36.37-58.566 58.892-59.387 154.781.36 214.59a152.454 152.454 0 0 0 20.521 17.196c6.402 4.468 15.064 3.789 20.584-1.731l21.054-21.055c8.35-8.35 12.094-19.239 11.698-29.806a16.037 16.037 0 0 0-6.947-12.606c-2.912-2.005-6.64-4.875-10.341-8.569-28.073-28.073-28.191-73.639 0-101.83l67.2-67.19c28.239-28.239 74.3-28.069 102.325.51 27.75 28.3 26.872 73.934-1.155 101.96l-13.087 13.087c-4.35 4.35-5.769 10.79-3.783 16.612 5.864 17.194 9.042 34.999 9.69 52.721.509 13.906 17.454 20.446 27.294 10.606l37.106-37.106c59.271-59.259 59.271-155.699.001-214.959z" }, child: [] }] })(r);
154
151
  }
155
152
  function It(r) {
156
- return z({ attr: { viewBox: "0 0 496 512" }, child: [{ tag: "path", attr: { d: "M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm80 168c17.7 0 32 14.3 32 32s-14.3 32-32 32-32-14.3-32-32 14.3-32 32-32zm-160 0c17.7 0 32 14.3 32 32s-14.3 32-32 32-32-14.3-32-32 14.3-32 32-32zm194.8 170.2C334.3 380.4 292.5 400 248 400s-86.3-19.6-114.8-53.8c-13.6-16.3 11-36.7 24.6-20.5 22.4 26.9 55.2 42.2 90.2 42.2s67.8-15.4 90.2-42.2c13.4-16.2 38.1 4.2 24.6 20.5z" }, child: [] }] })(r);
153
+ return N({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M80 368H16a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16v-64a16 16 0 0 0-16-16zm0-320H16A16 16 0 0 0 0 64v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16V64a16 16 0 0 0-16-16zm0 160H16a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16v-64a16 16 0 0 0-16-16zm416 176H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z" }, child: [] }] })(r);
157
154
  }
158
155
  function Pt(r) {
159
- return z({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M32 64h32v160c0 88.22 71.78 160 160 160s160-71.78 160-160V64h32a16 16 0 0 0 16-16V16a16 16 0 0 0-16-16H272a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h32v160a80 80 0 0 1-160 0V64h32a16 16 0 0 0 16-16V16a16 16 0 0 0-16-16H32a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16zm400 384H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z" }, child: [] }] })(r);
156
+ return N({ attr: { viewBox: "0 0 496 512" }, child: [{ tag: "path", attr: { d: "M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm80 168c17.7 0 32 14.3 32 32s-14.3 32-32 32-32-14.3-32-32 14.3-32 32-32zm-160 0c17.7 0 32 14.3 32 32s-14.3 32-32 32-32-14.3-32-32 14.3-32 32-32zm194.8 170.2C334.3 380.4 292.5 400 248 400s-86.3-19.6-114.8-53.8c-13.6-16.3 11-36.7 24.6-20.5 22.4 26.9 55.2 42.2 90.2 42.2s67.8-15.4 90.2-42.2c13.4-16.2 38.1 4.2 24.6 20.5z" }, child: [] }] })(r);
160
157
  }
161
158
  function qt(r) {
162
- return z({ attr: { viewBox: "0 0 256 256", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM56.84,75.58a8,8,0,0,1,3.58-10.74l16-8A8,8,0,0,1,88,64v48a8,8,0,0,1-16,0V76.94l-4.42,2.22A8,8,0,0,1,56.84,75.58ZM92,180a8,8,0,0,1,0,16H68a8,8,0,0,1-6.4-12.8l21.67-28.89A3.92,3.92,0,0,0,84,152a4,4,0,0,0-7.77-1.33,8,8,0,0,1-15.09-5.34,20,20,0,1,1,35,18.53L84,180Zm100,4H120a8,8,0,0,1,0-16h72a8,8,0,0,1,0,16Zm0-48H120a8,8,0,0,1,0-16h72a8,8,0,0,1,0,16Zm0-48H120a8,8,0,0,1,0-16h72a8,8,0,0,1,0,16Z" }, child: [] }] })(r);
159
+ return N({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M32 64h32v160c0 88.22 71.78 160 160 160s160-71.78 160-160V64h32a16 16 0 0 0 16-16V16a16 16 0 0 0-16-16H272a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h32v160a80 80 0 0 1-160 0V64h32a16 16 0 0 0 16-16V16a16 16 0 0 0-16-16H32a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16zm400 384H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z" }, child: [] }] })(r);
163
160
  }
164
161
  function Bt(r) {
165
- return z({ attr: { viewBox: "0 0 24 24", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M2 18H9V20H2V18ZM2 11H11V13H2V11ZM2 4H22V6H2V4ZM20.674 13.0251L21.8301 12.634L22.8301 14.366L21.914 15.1711C21.9704 15.4386 22 15.7158 22 16C22 16.2842 21.9704 16.5614 21.914 16.8289L22.8301 17.634L21.8301 19.366L20.674 18.9749C20.2635 19.3441 19.7763 19.6295 19.2391 19.8044L19 21H17L16.7609 19.8044C16.2237 19.6295 15.7365 19.3441 15.326 18.9749L14.1699 19.366L13.1699 17.634L14.086 16.8289C14.0296 16.5614 14 16.2842 14 16C14 15.7158 14.0296 15.4386 14.086 15.1711L13.1699 14.366L14.1699 12.634L15.326 13.0251C15.7365 12.6559 16.2237 12.3705 16.7609 12.1956L17 11H19L19.2391 12.1956C19.7763 12.3705 20.2635 12.6559 20.674 13.0251ZM18 17C18.5523 17 19 16.5523 19 16C19 15.4477 18.5523 15 18 15C17.4477 15 17 15.4477 17 16C17 16.5523 17.4477 17 18 17Z" }, child: [] }] })(r);
166
- }
167
- function Ut(r) {
168
- return z({ attr: { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { d: "M12 21h-7a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v7" }, child: [] }, { tag: "path", attr: { d: "M3 10h18" }, child: [] }, { tag: "path", attr: { d: "M10 3v18" }, child: [] }, { tag: "path", attr: { d: "M19.001 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0" }, child: [] }, { tag: "path", attr: { d: "M19.001 15.5v1.5" }, child: [] }, { tag: "path", attr: { d: "M19.001 21v1.5" }, child: [] }, { tag: "path", attr: { d: "M22.032 17.25l-1.299 .75" }, child: [] }, { tag: "path", attr: { d: "M17.27 20l-1.3 .75" }, child: [] }, { tag: "path", attr: { d: "M15.97 17.25l1.3 .75" }, child: [] }, { tag: "path", attr: { d: "M20.733 20l1.3 .75" }, child: [] }] })(r);
162
+ return N({ attr: { viewBox: "0 0 256 256", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM56.84,75.58a8,8,0,0,1,3.58-10.74l16-8A8,8,0,0,1,88,64v48a8,8,0,0,1-16,0V76.94l-4.42,2.22A8,8,0,0,1,56.84,75.58ZM92,180a8,8,0,0,1,0,16H68a8,8,0,0,1-6.4-12.8l21.67-28.89A3.92,3.92,0,0,0,84,152a4,4,0,0,0-7.77-1.33,8,8,0,0,1-15.09-5.34,20,20,0,1,1,35,18.53L84,180Zm100,4H120a8,8,0,0,1,0-16h72a8,8,0,0,1,0,16Zm0-48H120a8,8,0,0,1,0-16h72a8,8,0,0,1,0,16Zm0-48H120a8,8,0,0,1,0-16h72a8,8,0,0,1,0,16Z" }, child: [] }] })(r);
169
163
  }
170
164
  function Vt(r) {
171
- return z({ attr: { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { d: "M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z" }, child: [] }, { tag: "path", attr: { d: "M3 10h18" }, child: [] }, { tag: "path", attr: { d: "M10 3v18" }, child: [] }] })(r);
165
+ return N({ attr: { viewBox: "0 0 24 24", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M2 18H9V20H2V18ZM2 11H11V13H2V11ZM2 4H22V6H2V4ZM20.674 13.0251L21.8301 12.634L22.8301 14.366L21.914 15.1711C21.9704 15.4386 22 15.7158 22 16C22 16.2842 21.9704 16.5614 21.914 16.8289L22.8301 17.634L21.8301 19.366L20.674 18.9749C20.2635 19.3441 19.7763 19.6295 19.2391 19.8044L19 21H17L16.7609 19.8044C16.2237 19.6295 15.7365 19.3441 15.326 18.9749L14.1699 19.366L13.1699 17.634L14.086 16.8289C14.0296 16.5614 14 16.2842 14 16C14 15.7158 14.0296 15.4386 14.086 15.1711L13.1699 14.366L14.1699 12.634L15.326 13.0251C15.7365 12.6559 16.2237 12.3705 16.7609 12.1956L17 11H19L19.2391 12.1956C19.7763 12.3705 20.2635 12.6559 20.674 13.0251ZM18 17C18.5523 17 19 16.5523 19 16C19 15.4477 18.5523 15 18 15C17.4477 15 17 15.4477 17 16C17 16.5523 17.4477 17 18 17Z" }, child: [] }] })(r);
166
+ }
167
+ function Ut(r) {
168
+ return N({ attr: { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { d: "M12 21h-7a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v7" }, child: [] }, { tag: "path", attr: { d: "M3 10h18" }, child: [] }, { tag: "path", attr: { d: "M10 3v18" }, child: [] }, { tag: "path", attr: { d: "M19.001 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0" }, child: [] }, { tag: "path", attr: { d: "M19.001 15.5v1.5" }, child: [] }, { tag: "path", attr: { d: "M19.001 21v1.5" }, child: [] }, { tag: "path", attr: { d: "M22.032 17.25l-1.299 .75" }, child: [] }, { tag: "path", attr: { d: "M17.27 20l-1.3 .75" }, child: [] }, { tag: "path", attr: { d: "M15.97 17.25l1.3 .75" }, child: [] }, { tag: "path", attr: { d: "M20.733 20l1.3 .75" }, child: [] }] })(r);
172
169
  }
173
170
  function $t(r) {
174
- return z({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" }, child: [] }, { tag: "path", attr: { d: "M2 20h20v4H2v-4zm3.49-3h2.42l1.27-3.58h5.65L16.09 17h2.42L13.25 3h-2.5L5.49 17zm4.42-5.61 2.03-5.79h.12l2.03 5.79H9.91z" }, child: [] }] })(r);
171
+ return N({ attr: { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { d: "M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z" }, child: [] }, { tag: "path", attr: { d: "M3 10h18" }, child: [] }, { tag: "path", attr: { d: "M10 3v18" }, child: [] }] })(r);
175
172
  }
176
173
  function Wt(r) {
177
- return z({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0V0z" }, child: [] }, { tag: "path", attr: { d: "M20 8V5H6.39l3 3h1.83l-.55 1.28 2.09 2.1L14.21 8zM3.41 4.86 2 6.27l6.97 6.97L6.5 19h3l1.57-3.66L16.73 21l1.41-1.41z" }, child: [] }] })(r);
174
+ return N({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" }, child: [] }, { tag: "path", attr: { d: "M2 20h20v4H2v-4zm3.49-3h2.42l1.27-3.58h5.65L16.09 17h2.42L13.25 3h-2.5L5.49 17zm4.42-5.61 2.03-5.79h.12l2.03 5.79H9.91z" }, child: [] }] })(r);
178
175
  }
179
- const Zt = [
176
+ function Zt(r) {
177
+ return N({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0V0z" }, child: [] }, { tag: "path", attr: { d: "M20 8V5H6.39l3 3h1.83l-.55 1.28 2.09 2.1L14.21 8zM3.41 4.86 2 6.27l6.97 6.97L6.5 19h3l1.57-3.66L16.73 21l1.41-1.41z" }, child: [] }] })(r);
178
+ }
179
+ const Xt = [
180
180
  "😀",
181
181
  "😁",
182
182
  "😂",
@@ -290,35 +290,35 @@ const Zt = [
290
290
  "👐"
291
291
  ], Kt = ({
292
292
  exec: r,
293
- saveSelection: c,
293
+ saveSelection: s,
294
294
  handleFileChange: u,
295
- handleFontSizeChange: m,
296
- handleFontFamilyChange: h,
295
+ handleFontSizeChange: g,
296
+ handleFontFamilyChange: p,
297
297
  // insertListBlock,
298
- insertEmoji: C,
299
- handleLink: L,
298
+ insertEmoji: b,
299
+ handleLink: S,
300
300
  removeFormatting: T,
301
301
  visibleActions: E,
302
- className: R,
303
- style: S
302
+ className: w,
303
+ style: x
304
304
  }) => {
305
- var W, _;
306
- const A = $(null), B = $(null), N = $(null), [U, V] = k(!1), [P, j] = k({
305
+ var X, B;
306
+ const R = W(null), H = W(null), k = W(null), [O, j] = D(!1), [P, z] = D({
307
307
  x: 0,
308
308
  y: 0
309
309
  });
310
- I(() => {
311
- const f = (b) => {
312
- !b.target.closest(".rte-emoji-popup") && !b.target.closest("button[title='Emoji']") && V(!1);
310
+ U(() => {
311
+ const f = (L) => {
312
+ !L.target.closest(".rte-emoji-popup") && !L.target.closest("button[title='Emoji']") && j(!1);
313
313
  };
314
314
  return document.addEventListener("mousedown", f), () => document.removeEventListener("mousedown", f);
315
315
  }, []);
316
- const q = (f) => {
317
- var F;
316
+ const _ = (f) => {
317
+ var V;
318
318
  f.preventDefault();
319
- const b = f.currentTarget.dataset.command;
320
- if (b)
321
- switch (b) {
319
+ const L = f.currentTarget.dataset.command;
320
+ if (L)
321
+ switch (L) {
322
322
  case "bold":
323
323
  case "italic":
324
324
  case "underline":
@@ -327,20 +327,20 @@ const Zt = [
327
327
  case "insertOrderedList":
328
328
  case "insertStaticOrderedList":
329
329
  case "removeFormat":
330
- r(b);
330
+ r(L);
331
331
  break;
332
332
  case "insertImage": {
333
- (F = A.current) == null || F.click();
333
+ (V = R.current) == null || V.click();
334
334
  break;
335
335
  }
336
336
  default:
337
- console.warn("Unknown command:", b);
337
+ console.warn("Unknown command:", L);
338
338
  }
339
- }, Y = (f) => {
339
+ }, $ = (f) => {
340
340
  r("foreColor", f.target.value);
341
- }, te = (f) => {
341
+ }, Z = (f) => {
342
342
  r("backColor", f.target.value);
343
- }, [x, D] = k({
343
+ }, [M, F] = D({
344
344
  bold: !1,
345
345
  italic: !1,
346
346
  underline: !1,
@@ -357,9 +357,9 @@ const Zt = [
357
357
  color: !1,
358
358
  highlight: !1
359
359
  });
360
- return I(() => {
360
+ return U(() => {
361
361
  const f = () => {
362
- D({
362
+ F({
363
363
  bold: document.queryCommandState("bold"),
364
364
  italic: document.queryCommandState("italic"),
365
365
  underline: document.queryCommandState("underline"),
@@ -378,126 +378,129 @@ const Zt = [
378
378
  });
379
379
  };
380
380
  return document.addEventListener("selectionchange", f), () => document.removeEventListener("selectionchange", f);
381
- }, []), /* @__PURE__ */ o.createElement("div", {
382
- className: `rte-toolbar ${R || ""}`,
383
- style: S
384
- }, E.bold && /* @__PURE__ */ o.createElement("button", {
381
+ }, []), /* @__PURE__ */ i.createElement("div", {
382
+ className: `rte-toolbar ${w || ""}`,
383
+ style: x
384
+ }, E.bold && /* @__PURE__ */ i.createElement("button", {
385
385
  "data-command": "bold",
386
386
  title: "Bold",
387
- onMouseDown: q,
388
- className: x.bold ? "rte-active" : ""
389
- }, /* @__PURE__ */ o.createElement(Ht, null)), E.italic && /* @__PURE__ */ o.createElement("button", {
387
+ onMouseDown: _,
388
+ className: M.bold ? "rte-active" : ""
389
+ }, /* @__PURE__ */ i.createElement(Ot, null)), E.italic && /* @__PURE__ */ i.createElement("button", {
390
390
  "data-command": "italic",
391
391
  title: "Italic",
392
- onMouseDown: q,
393
- className: x.italic ? "rte-active" : ""
394
- }, /* @__PURE__ */ o.createElement(_t, null)), E.underline && /* @__PURE__ */ o.createElement("button", {
392
+ onMouseDown: _,
393
+ className: M.italic ? "rte-active" : ""
394
+ }, /* @__PURE__ */ i.createElement(jt, null)), E.underline && /* @__PURE__ */ i.createElement("button", {
395
395
  "data-command": "underline",
396
396
  title: "Underline",
397
- onMouseDown: q,
398
- className: x.underline ? "rte-active" : ""
399
- }, /* @__PURE__ */ o.createElement(Pt, null)), E.unorderedList && /* @__PURE__ */ o.createElement("button", {
397
+ onMouseDown: _,
398
+ className: M.underline ? "rte-active" : ""
399
+ }, /* @__PURE__ */ i.createElement(qt, null)), E.unorderedList && /* @__PURE__ */ i.createElement("button", {
400
400
  "data-command": "insertUnorderedList",
401
- onMouseDown: q,
401
+ onMouseDown: _,
402
402
  title: "UnorderedList",
403
- className: x.unorderedList ? "rte-active" : ""
404
- }, /* @__PURE__ */ o.createElement(Bt, null)), E.staticUnorderedList && /* @__PURE__ */ o.createElement("button", {
403
+ className: M.unorderedList ? "rte-active" : ""
404
+ }, /* @__PURE__ */ i.createElement(Vt, null)), E.staticUnorderedList && /* @__PURE__ */ i.createElement("button", {
405
405
  "data-command": "insertStaticUnorderedList",
406
- onMouseDown: q,
406
+ onMouseDown: _,
407
407
  title: "StaticUnorderedList",
408
- className: x.unorderedList ? "rte-active" : ""
409
- }, /* @__PURE__ */ o.createElement(Ft, null)), E.orderedList && /* @__PURE__ */ o.createElement("button", {
408
+ className: M.unorderedList ? "rte-active" : ""
409
+ }, /* @__PURE__ */ i.createElement(It, null)), E.orderedList && /* @__PURE__ */ i.createElement("button", {
410
410
  "data-command": "insertOrderedList",
411
411
  title: "OrderedList",
412
- onMouseDown: q,
413
- className: x.orderedList ? "rte-active" : ""
414
- }, /* @__PURE__ */ o.createElement(qt, null)), E.staticOrderedList && /* @__PURE__ */ o.createElement("button", {
412
+ onMouseDown: _,
413
+ className: M.orderedList ? "rte-active" : "",
414
+ style: {
415
+ fontSize: "medium"
416
+ }
417
+ }, /* @__PURE__ */ i.createElement(Bt, null)), E.staticOrderedList && /* @__PURE__ */ i.createElement("button", {
415
418
  "data-command": "insertStaticOrderedList",
416
419
  title: "StaticOrderedList",
417
- onMouseDown: q,
418
- className: x.orderedList ? "rte-active" : ""
419
- }, /* @__PURE__ */ o.createElement(Nt, null)), E.link && /* @__PURE__ */ o.createElement("button", {
420
+ onMouseDown: _,
421
+ className: M.orderedList ? "rte-active" : ""
422
+ }, /* @__PURE__ */ i.createElement(Dt, null)), E.link && /* @__PURE__ */ i.createElement("button", {
420
423
  "data-command": "createLink",
421
424
  title: "Link",
422
- onClick: L,
423
- className: x.link ? "rte-active" : ""
424
- }, /* @__PURE__ */ o.createElement(jt, null)), E.removeFormat && /* @__PURE__ */ o.createElement("button", {
425
+ onClick: S,
426
+ className: M.link ? "rte-active" : ""
427
+ }, /* @__PURE__ */ i.createElement(Ft, null)), E.removeFormat && /* @__PURE__ */ i.createElement("button", {
425
428
  "data-command": "Remove format",
426
429
  title: "removeFormat",
427
430
  onMouseDown: (f) => {
428
- f.preventDefault(), c(), T();
431
+ f.preventDefault(), s(), T();
429
432
  },
430
- className: x.removeFormat ? "rte-active" : ""
431
- }, /* @__PURE__ */ o.createElement(Wt, null)), E.image && /* @__PURE__ */ o.createElement("button", {
433
+ className: M.removeFormat ? "rte-active" : ""
434
+ }, /* @__PURE__ */ i.createElement(Zt, null)), E.image && /* @__PURE__ */ i.createElement("button", {
432
435
  "data-command": "insertImage",
433
436
  title: "Image",
434
- onMouseDown: q,
435
- className: x.image ? "rte-active" : ""
436
- }, /* @__PURE__ */ o.createElement(kt, null)), /* @__PURE__ */ o.createElement("input", {
437
+ onMouseDown: _,
438
+ className: M.image ? "rte-active" : ""
439
+ }, /* @__PURE__ */ i.createElement(zt, null)), /* @__PURE__ */ i.createElement("input", {
437
440
  type: "file",
438
441
  accept: "image/*",
439
- ref: A,
442
+ ref: R,
440
443
  style: {
441
444
  display: "none"
442
445
  },
443
446
  onChange: u
444
- }), E.emoji && /* @__PURE__ */ o.createElement("div", {
447
+ }), E.emoji && /* @__PURE__ */ i.createElement("div", {
445
448
  style: {
446
449
  position: "relative"
447
450
  }
448
- }, /* @__PURE__ */ o.createElement("button", {
451
+ }, /* @__PURE__ */ i.createElement("button", {
449
452
  title: "Emoji",
450
453
  onMouseDown: (f) => {
451
- f.preventDefault(), c();
452
- const b = f.currentTarget.getBoundingClientRect();
453
- j({
454
- x: b.left,
455
- y: b.bottom + 8
454
+ f.preventDefault(), s();
455
+ const L = f.currentTarget.getBoundingClientRect();
456
+ z({
457
+ x: L.left,
458
+ y: L.bottom + 8
456
459
  // small spacing
457
- }), V((F) => !F);
460
+ }), j((V) => !V);
458
461
  },
459
- className: x.emoji ? "rte-active" : ""
460
- }, /* @__PURE__ */ o.createElement(It, null)), U && /* @__PURE__ */ Ct(/* @__PURE__ */ o.createElement("div", {
462
+ className: M.emoji ? "rte-active" : ""
463
+ }, /* @__PURE__ */ i.createElement(Pt, null)), O && /* @__PURE__ */ bt(/* @__PURE__ */ i.createElement("div", {
461
464
  className: "rte-emoji-popup",
462
465
  style: {
463
466
  top: P.y,
464
467
  left: P.x
465
468
  }
466
- }, Zt.map((f, b) => /* @__PURE__ */ o.createElement("span", {
467
- key: b,
469
+ }, Xt.map((f, L) => /* @__PURE__ */ i.createElement("span", {
470
+ key: L,
468
471
  style: {
469
472
  fontSize: "20px",
470
473
  cursor: "pointer",
471
474
  textAlign: "center"
472
475
  },
473
- onMouseDown: (F) => {
474
- F.preventDefault(), C(f), V(!1);
476
+ onMouseDown: (V) => {
477
+ V.preventDefault(), b(f), j(!1);
475
478
  }
476
- }, f))), document.body)), E.color && /* @__PURE__ */ o.createElement("div", {
479
+ }, f))), document.body)), E.color && /* @__PURE__ */ i.createElement("div", {
477
480
  style: {
478
481
  position: "relative"
479
482
  }
480
- }, /* @__PURE__ */ o.createElement("button", {
483
+ }, /* @__PURE__ */ i.createElement("button", {
481
484
  title: "Text Color",
482
485
  onMouseDown: (f) => {
483
- var b;
484
- f.preventDefault(), c(), (b = B.current) == null || b.click();
486
+ var L;
487
+ f.preventDefault(), s(), (L = H.current) == null || L.click();
485
488
  },
486
489
  style: {
487
490
  display: "flex",
488
491
  alignItems: "center",
489
492
  justifyContent: "center",
490
- color: ((W = B.current) == null ? void 0 : W.value) || "#000",
493
+ color: ((X = H.current) == null ? void 0 : X.value) || "#000",
491
494
  fontSize: "18px"
492
495
  },
493
- className: x.color ? "rte-active" : ""
494
- }, /* @__PURE__ */ o.createElement($t, null)), /* @__PURE__ */ o.createElement("input", {
495
- ref: B,
496
+ className: M.color ? "rte-active" : ""
497
+ }, /* @__PURE__ */ i.createElement(Wt, null)), /* @__PURE__ */ i.createElement("input", {
498
+ ref: H,
496
499
  type: "color",
497
500
  defaultValue: "#000000",
498
501
  onChange: (f) => {
499
- var b;
500
- Y(f), ((b = f.target.parentElement) == null ? void 0 : b.querySelector("button")).style.color = f.target.value;
502
+ var L;
503
+ $(f), ((L = f.target.parentElement) == null ? void 0 : L.querySelector("button")).style.color = f.target.value;
501
504
  },
502
505
  style: {
503
506
  position: "absolute",
@@ -506,30 +509,30 @@ const Zt = [
506
509
  height: 0,
507
510
  pointerEvents: "none"
508
511
  }
509
- })), E.highlight && /* @__PURE__ */ o.createElement("div", {
512
+ })), E.highlight && /* @__PURE__ */ i.createElement("div", {
510
513
  style: {
511
514
  position: "relative"
512
515
  }
513
- }, /* @__PURE__ */ o.createElement("button", {
516
+ }, /* @__PURE__ */ i.createElement("button", {
514
517
  title: "Highlight",
515
518
  onMouseDown: (f) => {
516
- var b;
517
- f.preventDefault(), c(), (b = N.current) == null || b.click();
519
+ var L;
520
+ f.preventDefault(), s(), (L = k.current) == null || L.click();
518
521
  },
519
522
  style: {
520
523
  display: "flex",
521
524
  alignItems: "center",
522
525
  justifyContent: "center",
523
- color: ((_ = N.current) == null ? void 0 : _.value) || "#000",
526
+ color: ((B = k.current) == null ? void 0 : B.value) || "#000",
524
527
  fontSize: "18px"
525
528
  },
526
- className: x.highlight ? "rte-active" : ""
527
- }, /* @__PURE__ */ o.createElement(Ot, null)), /* @__PURE__ */ o.createElement("input", {
528
- ref: N,
529
+ className: M.highlight ? "rte-active" : ""
530
+ }, /* @__PURE__ */ i.createElement(_t, null)), /* @__PURE__ */ i.createElement("input", {
531
+ ref: k,
529
532
  type: "color",
530
533
  onChange: (f) => {
531
- var b;
532
- te(f), ((b = f.target.parentElement) == null ? void 0 : b.querySelector("button")).style.color = f.target.value;
534
+ var L;
535
+ Z(f), ((L = f.target.parentElement) == null ? void 0 : L.querySelector("button")).style.color = f.target.value;
533
536
  },
534
537
  defaultValue: "#000000",
535
538
  style: {
@@ -539,141 +542,141 @@ const Zt = [
539
542
  height: 0,
540
543
  pointerEvents: "none"
541
544
  }
542
- })), E.align && /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("button", {
545
+ })), E.align && /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement("button", {
543
546
  title: "Align Left",
544
547
  onMouseDown: (f) => f.preventDefault(),
545
548
  onClick: () => r("justifyLeft"),
546
- className: x.alignLeft ? "rte-active" : ""
547
- }, /* @__PURE__ */ o.createElement(Dt, null)), /* @__PURE__ */ o.createElement("button", {
549
+ className: M.alignLeft ? "rte-active" : ""
550
+ }, /* @__PURE__ */ i.createElement(Ht, null)), /* @__PURE__ */ i.createElement("button", {
548
551
  title: "Align Center",
549
552
  onMouseDown: (f) => f.preventDefault(),
550
553
  onClick: () => r("justifyCenter"),
551
- className: x.alignCenter ? "rte-active" : ""
552
- }, /* @__PURE__ */ o.createElement(Tt, null)), /* @__PURE__ */ o.createElement("button", {
554
+ className: M.alignCenter ? "rte-active" : ""
555
+ }, /* @__PURE__ */ i.createElement(Nt, null)), /* @__PURE__ */ i.createElement("button", {
553
556
  title: "Align Right",
554
557
  onMouseDown: (f) => f.preventDefault(),
555
558
  onClick: () => r("justifyRight"),
556
- className: x.alignRight ? "rte-active" : ""
557
- }, /* @__PURE__ */ o.createElement(zt, null))), E.table && /* @__PURE__ */ o.createElement("button", {
559
+ className: M.alignRight ? "rte-active" : ""
560
+ }, /* @__PURE__ */ i.createElement(kt, null))), E.table && /* @__PURE__ */ i.createElement("button", {
558
561
  title: "Insert Dynamic Table",
559
562
  onMouseDown: (f) => f.preventDefault(),
560
563
  onClick: () => r("insertTable"),
561
- className: x.table ? "rte-active" : "",
564
+ className: M.table ? "rte-active" : "",
562
565
  style: {
563
566
  fontSize: "medium"
564
567
  }
565
- }, /* @__PURE__ */ o.createElement(Ut, null)), E.table && /* @__PURE__ */ o.createElement("button", {
568
+ }, /* @__PURE__ */ i.createElement(Ut, null)), E.table && /* @__PURE__ */ i.createElement("button", {
566
569
  title: "Insert Static Table",
567
570
  onMouseDown: (f) => f.preventDefault(),
568
571
  onClick: () => r("insertStaticTable"),
569
- className: x.table ? "rte-active" : "",
572
+ className: M.table ? "rte-active" : "",
570
573
  style: {
571
574
  fontSize: "medium"
572
575
  }
573
- }, /* @__PURE__ */ o.createElement(Vt, null)), E.fontFamily && /* @__PURE__ */ o.createElement("select", {
576
+ }, /* @__PURE__ */ i.createElement($t, null)), E.fontFamily && /* @__PURE__ */ i.createElement("select", {
574
577
  className: "rte-dropdown",
575
578
  defaultValue: "",
576
- onMouseDown: () => c(),
577
- onChange: h
578
- }, /* @__PURE__ */ o.createElement("option", {
579
+ onMouseDown: () => s(),
580
+ onChange: p
581
+ }, /* @__PURE__ */ i.createElement("option", {
579
582
  value: "",
580
583
  disabled: !0
581
- }, "Font Family"), /* @__PURE__ */ o.createElement("option", {
584
+ }, "Font Family"), /* @__PURE__ */ i.createElement("option", {
582
585
  value: "Arial"
583
- }, "Arial"), /* @__PURE__ */ o.createElement("option", {
586
+ }, "Arial"), /* @__PURE__ */ i.createElement("option", {
584
587
  value: "Georgia"
585
- }, "Georgia"), /* @__PURE__ */ o.createElement("option", {
588
+ }, "Georgia"), /* @__PURE__ */ i.createElement("option", {
586
589
  value: "Times New Roman"
587
- }, "Times New Roman"), /* @__PURE__ */ o.createElement("option", {
590
+ }, "Times New Roman"), /* @__PURE__ */ i.createElement("option", {
588
591
  value: "Courier New"
589
- }, "Courier New"), /* @__PURE__ */ o.createElement("option", {
592
+ }, "Courier New"), /* @__PURE__ */ i.createElement("option", {
590
593
  value: "Verdana"
591
- }, "Verdana")), E.fontSize && /* @__PURE__ */ o.createElement("select", {
594
+ }, "Verdana")), E.fontSize && /* @__PURE__ */ i.createElement("select", {
592
595
  className: "rte-dropdown rte-fontsize-dropdown",
593
596
  defaultValue: "",
594
- onMouseDown: () => c(),
595
- onChange: m
596
- }, /* @__PURE__ */ o.createElement("option", {
597
+ onMouseDown: () => s(),
598
+ onChange: g
599
+ }, /* @__PURE__ */ i.createElement("option", {
597
600
  value: "",
598
601
  disabled: !0
599
602
  }, "Font Size"), Array.from({
600
603
  length: 16
601
- }, (f, b) => 10 + b).map((f) => /* @__PURE__ */ o.createElement("option", {
604
+ }, (f, L) => 10 + L).map((f) => /* @__PURE__ */ i.createElement("option", {
602
605
  key: f,
603
606
  value: f
604
607
  }, f, "px"))));
605
- }, Xt = ({
608
+ }, Yt = ({
606
609
  show: r,
607
- position: c,
610
+ position: s,
608
611
  filtered: u,
609
- insertMention: m,
610
- onClose: h,
611
- query: C
612
+ insertMention: g,
613
+ onClose: p,
614
+ query: b
612
615
  }) => {
613
- const L = $(null), [T, E] = k(0);
614
- return I(() => {
616
+ const S = W(null), [T, E] = D(0);
617
+ return U(() => {
615
618
  r && E(0);
616
- }, [r]), I(() => {
617
- const R = (S) => {
618
- L.current && !L.current.contains(S.target) && h();
619
+ }, [r]), U(() => {
620
+ const w = (x) => {
621
+ S.current && !S.current.contains(x.target) && p();
619
622
  };
620
- return r && document.addEventListener("mousedown", R), () => {
621
- document.removeEventListener("mousedown", R);
623
+ return r && document.addEventListener("mousedown", w), () => {
624
+ document.removeEventListener("mousedown", w);
622
625
  };
623
- }, [r, h]), I(() => {
626
+ }, [r, p]), U(() => {
624
627
  if (!r) return;
625
- const R = (S) => {
626
- if (!(!r || u.length === 0) && (S.key === "ArrowDown" && (S.preventDefault(), E((A) => Math.min(A + 1, u.length - 1))), S.key === "ArrowUp" && (S.preventDefault(), E((A) => Math.max(A - 1, 0))), S.key === "Enter")) {
627
- S.preventDefault();
628
- const A = u[T];
629
- A && m(A);
628
+ const w = (x) => {
629
+ if (!(!r || u.length === 0) && (x.key === "ArrowDown" && (x.preventDefault(), E((R) => Math.min(R + 1, u.length - 1))), x.key === "ArrowUp" && (x.preventDefault(), E((R) => Math.max(R - 1, 0))), x.key === "Enter")) {
630
+ x.preventDefault();
631
+ const R = u[T];
632
+ R && g(R);
630
633
  }
631
634
  };
632
- return window.addEventListener("keydown", R), () => window.removeEventListener("keydown", R);
633
- }, [r, u, T]), I(() => {
634
- if (!L.current) return;
635
- const S = L.current.querySelectorAll("li")[T];
636
- S && S.scrollIntoView({
635
+ return window.addEventListener("keydown", w), () => window.removeEventListener("keydown", w);
636
+ }, [r, u, T]), U(() => {
637
+ if (!S.current) return;
638
+ const x = S.current.querySelectorAll("li")[T];
639
+ x && x.scrollIntoView({
637
640
  block: "nearest",
638
641
  behavior: "smooth"
639
642
  });
640
- }, [T]), r ? /* @__PURE__ */ o.createElement("ul", {
641
- ref: L,
643
+ }, [T]), r ? /* @__PURE__ */ i.createElement("ul", {
644
+ ref: S,
642
645
  className: "rte-popup",
643
646
  style: {
644
- top: c.y,
645
- left: c.x
647
+ top: s.y,
648
+ left: s.x
646
649
  }
647
650
  }, u.length > 0 ? u.map(({
648
- name: R,
649
- value: S
650
- }, A) => {
651
- const B = R.toLowerCase(), N = C.toLowerCase(), U = B.indexOf(N);
652
- let V = R;
653
- if (U !== -1 && C.length > 0) {
654
- const P = U + C.length;
655
- V = R.substring(0, U) + `<span class="rte-highlight">${R.substring(U, P)}</span>` + R.substring(P);
651
+ name: w,
652
+ value: x
653
+ }, R) => {
654
+ const H = w.toLowerCase(), k = b.toLowerCase(), O = H.indexOf(k);
655
+ let j = w;
656
+ if (O !== -1 && b.length > 0) {
657
+ const P = O + b.length;
658
+ j = w.substring(0, O) + `<span class="rte-highlight">${w.substring(O, P)}</span>` + w.substring(P);
656
659
  }
657
- return /* @__PURE__ */ o.createElement("li", {
658
- key: S,
660
+ return /* @__PURE__ */ i.createElement("li", {
661
+ key: x,
659
662
  onMouseDown: (P) => {
660
- P.preventDefault(), m({
661
- name: R,
662
- value: S
663
+ P.preventDefault(), g({
664
+ name: w,
665
+ value: x
663
666
  });
664
667
  },
665
668
  style: {
666
669
  padding: "6px 12px",
667
670
  cursor: "pointer",
668
671
  fontSize: "14px",
669
- background: A === T ? "#dce8ff" : "white"
672
+ background: R === T ? "#dce8ff" : "white"
670
673
  },
671
674
  dangerouslySetInnerHTML: {
672
- __html: V
675
+ __html: j
673
676
  },
674
- onMouseEnter: () => E(A)
677
+ onMouseEnter: () => E(R)
675
678
  });
676
- }) : /* @__PURE__ */ o.createElement("li", {
679
+ }) : /* @__PURE__ */ i.createElement("li", {
677
680
  style: {
678
681
  padding: "6px 12px",
679
682
  color: "#999"
@@ -681,139 +684,178 @@ const Zt = [
681
684
  }, "No matches")) : null;
682
685
  };
683
686
  function Oe(r) {
684
- return z({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "g", attr: { id: "Circle_Minus" }, child: [{ tag: "g", attr: {}, child: [{ tag: "path", attr: { d: "M15,11.5h0a.5.5,0,0,1,0,1H9a.5.5,0,0,1,0-1Z" }, child: [] }, { tag: "path", attr: { d: "M12,21.934A9.933,9.933,0,1,1,21.932,12,9.945,9.945,0,0,1,12,21.934ZM12,3.068A8.933,8.933,0,1,0,20.932,12,8.944,8.944,0,0,0,12,3.068Z" }, child: [] }] }] }] })(r);
687
+ return N({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "g", attr: { id: "Circle_Minus" }, child: [{ tag: "g", attr: {}, child: [{ tag: "path", attr: { d: "M15,11.5h0a.5.5,0,0,1,0,1H9a.5.5,0,0,1,0-1Z" }, child: [] }, { tag: "path", attr: { d: "M12,21.934A9.933,9.933,0,1,1,21.932,12,9.945,9.945,0,0,1,12,21.934ZM12,3.068A8.933,8.933,0,1,0,20.932,12,8.944,8.944,0,0,0,12,3.068Z" }, child: [] }] }] }] })(r);
685
688
  }
686
- function J(r) {
687
- return z({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "g", attr: { id: "Circle_Plus" }, child: [{ tag: "g", attr: {}, child: [{ tag: "path", attr: { d: "M15,12.5H12.5V15a.5.5,0,0,1-1,0V12.5H9a.5.5,0,0,1,0-1h2.5V9a.5.5,0,0,1,1,0v2.5H15A.5.5,0,0,1,15,12.5Z" }, child: [] }, { tag: "path", attr: { d: "M12,21.932A9.934,9.934,0,1,1,21.932,12,9.944,9.944,0,0,1,12,21.932ZM12,3.065A8.934,8.934,0,1,0,20.932,12,8.944,8.944,0,0,0,12,3.065Z" }, child: [] }] }] }] })(r);
689
+ function G(r) {
690
+ return N({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "g", attr: { id: "Circle_Plus" }, child: [{ tag: "g", attr: {}, child: [{ tag: "path", attr: { d: "M15,12.5H12.5V15a.5.5,0,0,1-1,0V12.5H9a.5.5,0,0,1,0-1h2.5V9a.5.5,0,0,1,1,0v2.5H15A.5.5,0,0,1,15,12.5Z" }, child: [] }, { tag: "path", attr: { d: "M12,21.932A9.934,9.934,0,1,1,21.932,12,9.944,9.944,0,0,1,12,21.932ZM12,3.065A8.934,8.934,0,1,0,20.932,12,8.944,8.944,0,0,0,12,3.065Z" }, child: [] }] }] }] })(r);
688
691
  }
689
- const Yt = ({
692
+ const Qt = ({
690
693
  visible: r,
691
- x: c,
694
+ x: s,
692
695
  y: u,
693
- onAction: m,
694
- onClose: h
696
+ onAction: g,
697
+ onClose: p
695
698
  }) => {
696
699
  if (!r) return null;
697
- const C = {
700
+ const b = {
698
701
  top: u,
699
- left: c
702
+ left: s
700
703
  };
701
- return /* @__PURE__ */ o.createElement("div", {
702
- style: C,
704
+ return /* @__PURE__ */ i.createElement("div", {
705
+ style: b,
703
706
  className: "rte-table-menu",
704
- onMouseLeave: h
705
- }, /* @__PURE__ */ o.createElement("button", {
706
- onClick: () => m("insertRowAbove")
707
- }, /* @__PURE__ */ o.createElement(J, null), " Insert row above"), /* @__PURE__ */ o.createElement("button", {
708
- onClick: () => m("insertRowBelow")
709
- }, /* @__PURE__ */ o.createElement(J, null), " Insert row below"), /* @__PURE__ */ o.createElement("button", {
710
- onClick: () => m("insertColLeft")
711
- }, /* @__PURE__ */ o.createElement(J, null), " Insert col left"), /* @__PURE__ */ o.createElement("button", {
712
- onClick: () => m("insertColRight")
713
- }, /* @__PURE__ */ o.createElement(J, null), " Insert col right"), /* @__PURE__ */ o.createElement("button", {
714
- onClick: () => m("deleteRow")
715
- }, /* @__PURE__ */ o.createElement(Oe, null), " Delete row"), /* @__PURE__ */ o.createElement("button", {
716
- onClick: () => m("deleteCol")
717
- }, /* @__PURE__ */ o.createElement(Oe, null), " Delete column"));
718
- }, Qt = ({
707
+ onMouseLeave: p
708
+ }, /* @__PURE__ */ i.createElement("button", {
709
+ onClick: () => g("insertRowAbove")
710
+ }, /* @__PURE__ */ i.createElement(G, null), " Insert row above"), /* @__PURE__ */ i.createElement("button", {
711
+ onClick: () => g("insertRowBelow")
712
+ }, /* @__PURE__ */ i.createElement(G, null), " Insert row below"), /* @__PURE__ */ i.createElement("button", {
713
+ onClick: () => g("insertColLeft")
714
+ }, /* @__PURE__ */ i.createElement(G, null), " Insert col left"), /* @__PURE__ */ i.createElement("button", {
715
+ onClick: () => g("insertColRight")
716
+ }, /* @__PURE__ */ i.createElement(G, null), " Insert col right"), /* @__PURE__ */ i.createElement("button", {
717
+ onClick: () => g("deleteRow")
718
+ }, /* @__PURE__ */ i.createElement(Oe, null), " Delete row"), /* @__PURE__ */ i.createElement("button", {
719
+ onClick: () => g("deleteCol")
720
+ }, /* @__PURE__ */ i.createElement(Oe, null), " Delete column"));
721
+ }, Jt = ({
719
722
  html: r,
720
- className: c,
723
+ className: s,
721
724
  style: u
722
725
  }) => {
723
- const m = (C) => {
724
- const L = C.target;
725
- if (L.tagName === "A") {
726
- C.preventDefault();
727
- const T = L.href;
726
+ const g = (b) => {
727
+ const S = b.target;
728
+ if (S.tagName === "A") {
729
+ b.preventDefault();
730
+ const T = S.href;
728
731
  T && window.open(T, "_blank", "noopener,noreferrer");
729
732
  }
730
- }, h = (C) => {
731
- let L = C.replace(/{{\s*(.*?)\s*}}/g, (T, E) => `<span style="color: blue">${E}</span>`);
732
- return L = L.replace(/#arrayData/g, ""), L = L.replace(/\/arrayData/g, ""), L;
733
+ }, p = (b) => {
734
+ const S = document.createElement("div");
735
+ S.innerHTML = b;
736
+ const T = document.createTreeWalker(S, NodeFilter.SHOW_TEXT, null), E = [];
737
+ for (; T.nextNode(); ) {
738
+ const w = T.currentNode;
739
+ w.nodeValue && /{{\s*[\s\S]*?\s*}}/.test(w.nodeValue) && E.push(w);
740
+ }
741
+ return E.forEach((w) => {
742
+ var P;
743
+ const x = w.nodeValue || "", R = w.parentElement;
744
+ if (!R) return;
745
+ let H = R, k = !1;
746
+ for (; H; ) {
747
+ if (H.tagName === "FONT" && H.getAttribute("color")) {
748
+ k = !0;
749
+ break;
750
+ }
751
+ const z = (P = H.style) == null ? void 0 : P.color;
752
+ if (z && z !== "") {
753
+ k = !0;
754
+ break;
755
+ }
756
+ const _ = window.getComputedStyle(H);
757
+ if (_.color && _.color !== "rgb(0, 0, 0)" && _.color !== "rgba(0, 0, 0, 0)") {
758
+ k = !0;
759
+ break;
760
+ }
761
+ H = H.parentElement;
762
+ }
763
+ const O = document.createDocumentFragment();
764
+ let j = 0;
765
+ x.replace(/{{\s*([\s\S]*?)\s*}}/g, (z, _, $) => {
766
+ if ($ > j && O.appendChild(document.createTextNode(x.slice(j, $))), k)
767
+ O.appendChild(document.createTextNode(z));
768
+ else {
769
+ const Z = document.createElement("span");
770
+ Z.style.color = "blue", Z.textContent = z, O.appendChild(Z);
771
+ }
772
+ return j = $ + z.length, z;
773
+ }), j < x.length && O.appendChild(document.createTextNode(x.slice(j))), R.replaceChild(O, w);
774
+ }), S.innerHTML = S.innerHTML.replace(/{{#arrayData}}/g, "").replace(/{{\/arrayData}}/g, ""), S.innerHTML;
733
775
  };
734
- return /* @__PURE__ */ o.createElement("div", {
735
- className: `rte-preview ${c || ""}`,
776
+ return /* @__PURE__ */ i.createElement("div", {
777
+ className: `rte-preview ${s || ""}`,
736
778
  style: u,
737
- onClick: m,
779
+ onClick: g,
738
780
  dangerouslySetInnerHTML: {
739
- __html: h(r)
781
+ __html: p(r)
740
782
  }
741
783
  });
742
- }, Jt = ({
784
+ }, Gt = ({
743
785
  visible: r,
744
- linkData: c,
786
+ linkData: s,
745
787
  onClose: u,
746
- onInsert: m
788
+ onInsert: g
747
789
  }) => {
748
- const [h, C] = k(""), [L, T] = k(""), [E, R] = k(""), [S, A] = k("_self");
749
- if (I(() => {
750
- r ? (C(c.url || ""), T(c.text || ""), R(c.title || ""), A(c.target || "_self")) : (C(""), T(""), R(""), A("_self"));
751
- }, [r, c]), !r) return null;
752
- const B = () => {
753
- m({
754
- url: h,
755
- text: L,
790
+ const [p, b] = D(""), [S, T] = D(""), [E, w] = D(""), [x, R] = D("_self");
791
+ if (U(() => {
792
+ r ? (b(s.url || ""), T(s.text || ""), w(s.title || ""), R(s.target || "_self")) : (b(""), T(""), w(""), R("_self"));
793
+ }, [r, s]), !r) return null;
794
+ const H = () => {
795
+ g({
796
+ url: p,
797
+ text: S,
756
798
  title: E,
757
- target: S
799
+ target: x
758
800
  });
759
801
  };
760
- return /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("div", {
802
+ return /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement("div", {
761
803
  className: "rte-link-modal-overlay",
762
804
  onClick: u
763
- }), /* @__PURE__ */ o.createElement("div", {
805
+ }), /* @__PURE__ */ i.createElement("div", {
764
806
  className: "rte-link-modal"
765
- }, /* @__PURE__ */ o.createElement("h4", {
807
+ }, /* @__PURE__ */ i.createElement("h4", {
766
808
  className: "rte-link-modal__title"
767
- }, h ? "Edit Link" : "Insert Link"), /* @__PURE__ */ o.createElement("input", {
809
+ }, p ? "Edit Link" : "Insert Link"), /* @__PURE__ */ i.createElement("input", {
768
810
  type: "text",
769
811
  className: "rte-link-modal__input",
770
812
  placeholder: "URL",
771
- value: h,
772
- onChange: (N) => C(N.target.value)
773
- }), /* @__PURE__ */ o.createElement("input", {
813
+ value: p,
814
+ onChange: (k) => b(k.target.value)
815
+ }), /* @__PURE__ */ i.createElement("input", {
774
816
  type: "text",
775
817
  className: "rte-link-modal__input",
776
818
  placeholder: "Text to Display",
777
- value: L,
778
- onChange: (N) => T(N.target.value)
779
- }), /* @__PURE__ */ o.createElement("input", {
819
+ value: S,
820
+ onChange: (k) => T(k.target.value)
821
+ }), /* @__PURE__ */ i.createElement("input", {
780
822
  type: "text",
781
823
  className: "rte-link-modal__input",
782
824
  placeholder: "Title",
783
825
  value: E,
784
- onChange: (N) => R(N.target.value)
785
- }), /* @__PURE__ */ o.createElement("select", {
826
+ onChange: (k) => w(k.target.value)
827
+ }), /* @__PURE__ */ i.createElement("select", {
786
828
  className: "rte-link-modal__select",
787
- value: S,
788
- onChange: (N) => A(N.target.value)
789
- }, /* @__PURE__ */ o.createElement("option", {
829
+ value: x,
830
+ onChange: (k) => R(k.target.value)
831
+ }, /* @__PURE__ */ i.createElement("option", {
790
832
  value: "_self"
791
- }, "Same tab"), /* @__PURE__ */ o.createElement("option", {
833
+ }, "Same tab"), /* @__PURE__ */ i.createElement("option", {
792
834
  value: "_blank"
793
- }, "New tab")), /* @__PURE__ */ o.createElement("div", {
835
+ }, "New tab")), /* @__PURE__ */ i.createElement("div", {
794
836
  className: "rte-link-modal__actions"
795
- }, /* @__PURE__ */ o.createElement("button", {
837
+ }, /* @__PURE__ */ i.createElement("button", {
796
838
  className: "rte-link-modal__btn",
797
839
  onClick: u
798
- }, "Cancel"), /* @__PURE__ */ o.createElement("button", {
840
+ }, "Cancel"), /* @__PURE__ */ i.createElement("button", {
799
841
  className: "rte-link-modal__btn rte-link-modal__btn--ok",
800
- onClick: B
842
+ onClick: H
801
843
  }, "OK"))));
802
844
  };
803
845
  function _e(r) {
804
- const c = /* @__PURE__ */ new Map();
846
+ const s = /* @__PURE__ */ new Map();
805
847
  return r.forEach((u) => {
806
- c.set(u.name, u.value);
807
- }), Array.from(c.entries()).map(([u, m]) => ({
848
+ s.set(u.name, u.value);
849
+ }), Array.from(s.entries()).map(([u, g]) => ({
808
850
  name: u,
809
- value: m
851
+ value: g
810
852
  }));
811
853
  }
812
- const nn = ({
854
+ const rn = ({
813
855
  atSuggestions: r = [],
814
- showOutput: c = !1,
856
+ showOutput: s = !1,
815
857
  showPreview: u = !1,
816
- toolbarConfig: m = {
858
+ toolbarConfig: g = {
817
859
  link: !1,
818
860
  image: !1,
819
861
  emoji: !1,
@@ -827,27 +869,27 @@ const nn = ({
827
869
  staticUnorderedList: !1,
828
870
  staticOrderedList: !1
829
871
  },
830
- classNames: h = {},
831
- styles: C = {},
832
- handleGetHtml: L = () => {
872
+ classNames: p = {},
873
+ styles: b = {},
874
+ handleGetHtml: S = () => {
833
875
  },
834
876
  onChange: T = () => {
835
877
  },
836
878
  value: E,
837
- onMentionSelect: R = () => {
879
+ onMentionSelect: w = () => {
838
880
  },
839
- handleAddAttributes: S = () => {
881
+ handleAddAttributes: x = () => {
840
882
  }
841
883
  }) => {
842
- var Ee, we, Ce, be, Le, Re, xe, Se, Me, Ae, Te, ze;
843
- const A = $(null), [B, N] = k(E != null && E.length ? E : " "), [U, V] = k(""), [P, j] = k(!1), [q, Y] = k({
884
+ var Ee, we, Ce, be, Le, xe, Re, Se, Me, Te, Ae, Ne;
885
+ const R = W(null), [H, k] = D(E != null && E.length ? E : " "), [O, j] = D(""), [P, z] = D(!1), [_, $] = D({
844
886
  x: 0,
845
887
  y: 0
846
- }), [te, x] = k([]), D = $(null), W = $(null), [_, f] = k({
888
+ }), [Z, M] = D([]), F = W(null), X = W(null), [B, f] = D({
847
889
  visible: !1,
848
890
  x: 0,
849
891
  y: 0
850
- }), [b, F] = k(!1), Q = $(null), [Ie, de] = k({
892
+ }), [L, V] = D(!1), J = W(null), [Ie, de] = D({
851
893
  url: "",
852
894
  text: "",
853
895
  title: "",
@@ -857,77 +899,77 @@ const nn = ({
857
899
  italic: !0,
858
900
  underline: !0,
859
901
  removeFormat: !0,
860
- unorderedList: (Ee = m.unorderedList) != null ? Ee : !0,
861
- orderedList: (we = m.orderedList) != null ? we : !0,
862
- staticUnorderedList: (Ce = m.staticUnorderedList) != null ? Ce : !0,
863
- staticOrderedList: (be = m.staticOrderedList) != null ? be : !0,
902
+ unorderedList: (Ee = g.unorderedList) != null ? Ee : !0,
903
+ orderedList: (we = g.orderedList) != null ? we : !0,
904
+ staticUnorderedList: (Ce = g.staticUnorderedList) != null ? Ce : !0,
905
+ staticOrderedList: (be = g.staticOrderedList) != null ? be : !0,
864
906
  align: !0,
865
- link: (Le = m.link) != null ? Le : !1,
866
- image: (Re = m.image) != null ? Re : !1,
867
- emoji: (xe = m.emoji) != null ? xe : !1,
868
- table: (Se = m.table) != null ? Se : !1,
869
- color: (Me = m.color) != null ? Me : !1,
870
- fontFamily: (Ae = m.fontFamily) != null ? Ae : !1,
871
- fontSize: (Te = m.fontSize) != null ? Te : !1,
872
- highlight: (ze = m.fontSize) != null ? ze : !1
873
- }, [qe, ne] = k(""), [ue, re] = k([]), O = () => A.current, M = () => {
907
+ link: (Le = g.link) != null ? Le : !1,
908
+ image: (xe = g.image) != null ? xe : !1,
909
+ emoji: (Re = g.emoji) != null ? Re : !1,
910
+ table: (Se = g.table) != null ? Se : !1,
911
+ color: (Me = g.color) != null ? Me : !1,
912
+ fontFamily: (Te = g.fontFamily) != null ? Te : !1,
913
+ fontSize: (Ae = g.fontSize) != null ? Ae : !1,
914
+ highlight: (Ne = g.fontSize) != null ? Ne : !1
915
+ }, [qe, ne] = D(""), [ue, re] = D([]), q = () => R.current, A = () => {
874
916
  const e = Be(), t = /^<div[^>]*style=["'][^"']*font-size\s*:\s*\d+px[^"']*["'][^>]*>/.test(e.trim());
875
917
  let n = e;
876
- t || (n = `<div style="font-size:12px">${e}</div>`), n = n.replace(/<(ul|ol)([^>]*)>[\s\S]*?<\/\1>/g, (l, v, y) => {
877
- if (/list-type=["']static["']/.test(y) || l.includes("data-hidden-array-start") || l.includes("data-hidden-array-end")) return l;
878
- const g = `<${v}${y}>`, d = '<span data-hidden-array-start="true" style="display:none">{{#arrayData}}</span>', p = '<span data-hidden-array-end="true" style="display:none">{{/arrayData}}</span>', w = `</${v}>`, H = l.replace(new RegExp(`^${g}`), "").replace(new RegExp(`${w}$`), "");
879
- return `${g}${d}${H}${p}${w}`;
880
- }), V(n), L == null || L(n);
918
+ t || (n = `<div style="font-size:12px">${e}</div>`), n = n.replace(/<(ul|ol)([^>]*)>[\s\S]*?<\/\1>/g, (o, h, y) => {
919
+ if (/list-type=["']static["']/.test(y) || o.includes("data-hidden-array-start") || o.includes("data-hidden-array-end")) return o;
920
+ const m = `<${h}${y}>`, c = '<span data-hidden-array-start="true" style="display:none">{{#arrayData}}</span>', v = '<span data-hidden-array-end="true" style="display:none">{{/arrayData}}</span>', C = `</${h}>`, I = o.replace(new RegExp(`^${m}`), "").replace(new RegExp(`${C}$`), "");
921
+ return `${m}${c}${I}${v}${C}`;
922
+ }), j(n), S == null || S(n);
881
923
  const a = ct(e);
882
924
  T(a);
883
- const s = Ye(), i = _e(s);
884
- JSON.stringify(i) !== JSON.stringify(ue) && (re(i), R(i));
925
+ const d = Ye(), l = _e(d);
926
+ JSON.stringify(l) !== JSON.stringify(ue) && (re(l), w(l));
885
927
  }, Be = () => {
886
- const e = O();
887
- if (!e) return B;
928
+ const e = q();
929
+ if (!e) return H;
888
930
  const t = e.cloneNode(!0);
889
931
  t.querySelectorAll("table div").forEach((a) => a.remove()), t.querySelectorAll("table").forEach((a) => {
890
932
  a.removeAttribute("data-has-resize-handle");
891
933
  }), t.querySelectorAll(".rte-cell-highlight").forEach((a) => a.classList.remove("rte-cell-highlight"));
892
934
  let n = t.innerHTML;
893
- return n = Ue(n), n;
894
- }, Ue = (e) => {
935
+ return n = Ve(n), n;
936
+ }, Ve = (e) => {
895
937
  const t = document.createElement("div");
896
938
  return t.innerHTML = e, t.querySelectorAll("tbody").forEach((n) => {
897
939
  n.getAttribute("table-type") === "static" || (n.innerHTML = `{{#arrayData}}${n.innerHTML}{{/arrayData}}`);
898
940
  }), t.innerHTML;
899
- }, Z = () => {
941
+ }, K = () => {
900
942
  const e = window.getSelection();
901
943
  if (!e || e.rangeCount === 0) return;
902
944
  const t = document.getElementById("rte-editor-body");
903
945
  if (!t) return;
904
946
  const n = e.getRangeAt(0);
905
- t.contains(n.startContainer) && (D.current = n.cloneRange());
906
- }, K = () => {
947
+ t.contains(n.startContainer) && (F.current = n.cloneRange());
948
+ }, Y = () => {
907
949
  const e = window.getSelection();
908
- !e || !D.current || (e.removeAllRanges(), e.addRange(D.current));
950
+ !e || !F.current || (e.removeAllRanges(), e.addRange(F.current));
909
951
  }, me = (e, t) => {
910
952
  const n = window.getSelection();
911
- n && n.rangeCount > 0 && (D.current = n.getRangeAt(0)), K(), document.execCommand(e, !1, t), M();
953
+ n && n.rangeCount > 0 && (F.current = n.getRangeAt(0)), Y(), document.execCommand(e, !1, t), A();
912
954
  };
913
- I(() => {
914
- const e = O();
955
+ U(() => {
956
+ const e = q();
915
957
  if (!e || !E) return;
916
- const t = Ve(E);
917
- e.innerHTML = t, M();
958
+ const t = Ue(E);
959
+ e.innerHTML = t, A();
918
960
  }, []);
919
- const Ve = (e) => e.replace(/<span[^>]*data-hidden-table-start[^>]*>.*?<\/span>/g, "").replace(/<span[^>]*data-hidden-table-end[^>]*>.*?<\/span>/g, "").replace(/{{#arrayData}}/g, "").replace(/{{\/arrayData}}/g, "");
920
- I(() => () => {
961
+ const Ue = (e) => e.replace(/(<table[\s\S]*?>[\s\S]*?<\/table>)/g, (t) => t.replace(/{{#arrayData}}/g, "").replace(/{{\/arrayData}}/g, ""));
962
+ U(() => () => {
921
963
  document.removeEventListener("mousemove", null), document.removeEventListener("mouseup", null);
922
- }, []), I(() => {
923
- S && S((e) => {
924
- Xe(e);
964
+ }, []), U(() => {
965
+ x && x((e) => {
966
+ Ke(e);
925
967
  });
926
- }, []), I(() => {
927
- const e = O();
968
+ }, []), U(() => {
969
+ const e = q();
928
970
  if (!e) return;
929
971
  e.querySelectorAll("table").forEach((n) => {
930
- n.hasAttribute("data-has-resize-handle") || (le(n), n.querySelectorAll("th, td").forEach((s) => X(s)));
972
+ n.hasAttribute("data-has-resize-handle") || (le(n), n.querySelectorAll("th, td").forEach((d) => Q(d)));
931
973
  });
932
974
  }, []);
933
975
  const ge = (e) => {
@@ -935,33 +977,33 @@ const nn = ({
935
977
  e = e.parentNode;
936
978
  return e;
937
979
  }, fe = (e, t) => {
938
- var g;
980
+ var m;
939
981
  const n = window.getSelection();
940
982
  if (!(n != null && n.rangeCount)) return;
941
- const a = n.getRangeAt(0), s = ge(a.startContainer);
942
- let i, l;
943
- const v = t === "insertStaticUnorderedList" || t === "insertStaticOrderedList";
944
- if (s) {
945
- let d = s.querySelector(e);
946
- d || (d = document.createElement(e), d.style.margin = "0", d.style.paddingLeft = "20px", s.appendChild(d)), l = d, i = document.createElement("li"), i.textContent = "​", l.appendChild(i);
983
+ const a = n.getRangeAt(0), d = ge(a.startContainer);
984
+ let l, o;
985
+ const h = t === "insertStaticUnorderedList" || t === "insertStaticOrderedList";
986
+ if (d) {
987
+ let c = d.querySelector(e);
988
+ c || (c = document.createElement(e), c.style.margin = "0", c.style.paddingLeft = "20px", d.appendChild(c)), o = c, l = document.createElement("li"), l.textContent = "​", o.appendChild(l);
947
989
  } else {
948
990
  document.execCommand(e === "ul" ? "insertUnorderedList" : "insertOrderedList");
949
- const d = O();
950
- if (l = d == null ? void 0 : d.querySelector(`${e}:last-child`), !l) return;
951
- v && l.setAttribute("list-type", "static"), i = l.querySelector("li:last-child");
991
+ const c = q();
992
+ if (o = c == null ? void 0 : c.querySelector(`${e}:last-child`), !o) return;
993
+ h && o.setAttribute("list-type", "static"), l = o.querySelector("li:last-child");
952
994
  }
953
995
  const y = document.createRange();
954
- y.setStart(i, 0), y.collapse(!0), n.removeAllRanges(), n.addRange(y), (g = O()) == null || g.focus(), M();
996
+ y.setStart(l, 0), y.collapse(!0), n.removeAllRanges(), n.addRange(y), (m = q()) == null || m.focus(), A();
955
997
  }, ae = (e, t) => {
956
998
  e === "insertOrderedList" || e === "insertStaticOrderedList" ? fe("ol", e) : e === "insertUnorderedList" || e === "insertStaticUnorderedList" ? fe("ul", e) : e.startsWith("justify") ? dt(e) : me(e, t), e === "insertTable" && pe(), e === "insertStaticTable" && pe("insertStaticTable");
957
999
  }, $e = (e) => {
958
1000
  const t = document.createElement("span");
959
1001
  t.textContent = "​", e.insertNode(t), e.setStartAfter(t), e.collapse(!0);
960
1002
  const n = t.getBoundingClientRect();
961
- t.remove(), Y({
1003
+ t.remove(), $({
962
1004
  x: n.left,
963
1005
  y: n.bottom + window.scrollY
964
- }), x(r || []), j(!0), W.current = e.cloneRange();
1006
+ }), M(r || []), z(!0), X.current = e.cloneRange();
965
1007
  }, We = () => {
966
1008
  const e = window.getSelection();
967
1009
  if (!e || e.rangeCount === 0) return null;
@@ -971,104 +1013,104 @@ const nn = ({
971
1013
  let a = t;
972
1014
  for (a.nodeType !== Node.TEXT_NODE && (a.childNodes && a.childNodes[n] ? a = a.childNodes[n] : a = t.previousSibling); a; ) {
973
1015
  if (a.nodeType === Node.TEXT_NODE) {
974
- const s = a.textContent || "", i = a === t ? n : s.length, l = s.lastIndexOf("@", i - 1);
975
- if (l !== -1) {
976
- const v = document.createRange();
977
- return v.setStart(a, l), v.setEnd(a, i), v;
1016
+ const d = a.textContent || "", l = a === t ? n : d.length, o = d.lastIndexOf("@", l - 1);
1017
+ if (o !== -1) {
1018
+ const h = document.createRange();
1019
+ return h.setStart(a, o), h.setEnd(a, l), h;
978
1020
  }
979
1021
  }
980
1022
  a = a.previousSibling;
981
1023
  }
982
1024
  return null;
983
1025
  }, Ze = (e) => {
984
- var i;
1026
+ var l;
985
1027
  const t = window.getSelection();
986
1028
  if (!t) return;
987
1029
  const n = We();
988
- n ? (t.removeAllRanges(), t.addRange(n)) : W.current && (t.removeAllRanges(), t.addRange(W.current));
1030
+ n ? (t.removeAllRanges(), t.addRange(n)) : X.current && (t.removeAllRanges(), t.addRange(X.current));
989
1031
  const a = document.createElement("span");
990
1032
  a.textContent = `{{${e.name}}}`, a.style.display = "inline", a.setAttribute("data-mention", e.value || e.name || "");
991
1033
  try {
992
- const l = t.rangeCount ? t.getRangeAt(0) : null;
993
- if (l)
994
- l.deleteContents(), l.insertNode(a);
1034
+ const o = t.rangeCount ? t.getRangeAt(0) : null;
1035
+ if (o)
1036
+ o.deleteContents(), o.insertNode(a);
995
1037
  else {
996
- const g = document.createRange(), d = O();
997
- g.selectNodeContents(d), g.collapse(!1), g.insertNode(a);
1038
+ const m = document.createRange(), c = q();
1039
+ m.selectNodeContents(c), m.collapse(!1), m.insertNode(a);
998
1040
  }
999
- const v = document.createTextNode(" ");
1000
- a.after(v);
1041
+ const h = document.createTextNode("");
1042
+ a.after(h);
1001
1043
  const y = document.createRange();
1002
- y.setStartAfter(v), y.collapse(!0), t.removeAllRanges(), t.addRange(y);
1003
- } catch (l) {
1004
- console.error("insertMention error:", l);
1044
+ y.setStartAfter(h), y.collapse(!0), t.removeAllRanges(), t.addRange(y);
1045
+ } catch (o) {
1046
+ console.error("insertMention error:", o);
1005
1047
  }
1006
- let s = _e([...ue, e]);
1007
- re(s), R(s), j(!1), (i = O()) == null || i.focus(), M();
1008
- }, Ke = (e) => {
1009
- const t = O();
1048
+ let d = _e([...ue, e]);
1049
+ re(d), w(d), z(!1), (l = q()) == null || l.focus(), A();
1050
+ }, Xe = (e) => {
1051
+ const t = q();
1010
1052
  if (!t) return;
1011
1053
  let n = null;
1012
- D.current && t.contains(D.current.startContainer) ? n = D.current.cloneRange() : (n = document.createRange(), n.selectNodeContents(t), n.collapse(!1));
1054
+ F.current && t.contains(F.current.startContainer) ? n = F.current.cloneRange() : (n = document.createRange(), n.selectNodeContents(t), n.collapse(!1));
1013
1055
  const a = window.getSelection();
1014
1056
  if (!a) return;
1015
1057
  a.removeAllRanges(), a.addRange(n);
1016
- const s = document.createElement("span");
1017
- s.textContent = `{{${e.name}}}`, s.style.display = "inline", s.setAttribute("data-mention", e.value || e.name), n.insertNode(s);
1018
- const i = document.createTextNode(" ");
1019
- s.after(i);
1020
- const l = document.createRange();
1021
- l.setStartAfter(i), l.collapse(!0), a.removeAllRanges(), a.addRange(l), D.current = l.cloneRange(), t.focus();
1022
- }, Xe = (e) => {
1023
- e.forEach((t) => Ke(t)), re((t) => {
1024
- const n = [...t, ...e], a = Array.from(new Map(n.map((s) => [s.name, s])).values());
1025
- return R(a), a;
1026
- }), M();
1058
+ const d = document.createElement("span");
1059
+ d.textContent = `{{${e.name}}}`, d.style.display = "inline", d.setAttribute("data-mention", e.value || e.name), n.insertNode(d);
1060
+ const l = document.createTextNode(" ");
1061
+ d.after(l);
1062
+ const o = document.createRange();
1063
+ o.setStartAfter(l), o.collapse(!0), a.removeAllRanges(), a.addRange(o), F.current = o.cloneRange(), t.focus();
1064
+ }, Ke = (e) => {
1065
+ e.forEach((t) => Xe(t)), re((t) => {
1066
+ const n = [...t, ...e], a = Array.from(new Map(n.map((d) => [d.name, d])).values());
1067
+ return w(a), a;
1068
+ }), A();
1027
1069
  }, Ye = () => {
1028
- const e = O();
1070
+ const e = q();
1029
1071
  if (!e) return [];
1030
1072
  const t = e.querySelectorAll("span[data-mention]"), n = [];
1031
1073
  return t.forEach((a) => {
1032
- const s = a.getAttribute("data-mention") || "", l = (a.textContent || "").match(/{{(.+?)}}/);
1033
- l && n.push({
1034
- name: l[1],
1035
- value: s
1074
+ const d = a.getAttribute("data-mention") || "", o = (a.textContent || "").match(/{{(.+?)}}/);
1075
+ o && n.push({
1076
+ name: o[1],
1077
+ value: d
1036
1078
  });
1037
1079
  }), n;
1038
1080
  }, Qe = (e) => {
1039
- var n, a, s;
1081
+ var n, a, d;
1040
1082
  const t = e.key.toLowerCase();
1041
1083
  if ((e.ctrlKey || e.metaKey) && ["b", "i", "u"].includes(t) && (e.preventDefault(), ae(t === "b" ? "bold" : t === "i" ? "italic" : t === "u" ? "underline" : "")), e.shiftKey && e.key === "2" && e.preventDefault(), e.key === "Enter") {
1042
- const i = window.getSelection(), l = i != null && i.anchorNode ? ge(i.anchorNode) : null;
1043
- if (!l) return;
1044
- if (((n = l.textContent) == null ? void 0 : n.replace(/\u200B/g, "").trim()) === "") {
1084
+ const l = window.getSelection(), o = l != null && l.anchorNode ? ge(l.anchorNode) : null;
1085
+ if (!o) return;
1086
+ if (((n = o.textContent) == null ? void 0 : n.replace(/\u200B/g, "").trim()) === "") {
1045
1087
  e.preventDefault();
1046
- const y = l.parentElement, g = y == null ? void 0 : y.closest("li");
1047
- if (g) {
1048
- y == null || y.removeChild(l);
1049
- const d = document.createElement("p");
1050
- d.innerHTML = "<br />", (a = g.parentElement) == null || a.insertBefore(d, g.nextSibling);
1051
- const p = document.createRange();
1052
- p.setStart(d, 0), p.collapse(!0), i == null || i.removeAllRanges(), i == null || i.addRange(p);
1088
+ const y = o.parentElement, m = y == null ? void 0 : y.closest("li");
1089
+ if (m) {
1090
+ y == null || y.removeChild(o);
1091
+ const c = document.createElement("p");
1092
+ c.innerHTML = "<br />", (a = m.parentElement) == null || a.insertBefore(c, m.nextSibling);
1093
+ const v = document.createRange();
1094
+ v.setStart(c, 0), v.collapse(!0), l == null || l.removeAllRanges(), l == null || l.addRange(v);
1053
1095
  } else {
1054
- const d = l.closest("ul, ol");
1055
- if (d) {
1056
- const p = document.createElement("p");
1057
- p.innerHTML = "<br />", (s = d.parentElement) == null || s.insertBefore(p, d.nextSibling), d.removeChild(l);
1058
- const w = document.createRange();
1059
- w.setStart(p, 0), w.collapse(!0), i == null || i.removeAllRanges(), i == null || i.addRange(w);
1096
+ const c = o.closest("ul, ol");
1097
+ if (c) {
1098
+ const v = document.createElement("p");
1099
+ v.innerHTML = "<br />", (d = c.parentElement) == null || d.insertBefore(v, c.nextSibling), c.removeChild(o);
1100
+ const C = document.createRange();
1101
+ C.setStart(v, 0), C.collapse(!0), l == null || l.removeAllRanges(), l == null || l.addRange(C);
1060
1102
  }
1061
1103
  }
1062
- M();
1104
+ A();
1063
1105
  }
1064
1106
  }
1065
1107
  if (t === "backspace" || t === "delete") {
1066
- const i = window.getSelection();
1067
- if (!i || i.rangeCount === 0) return;
1068
- const l = i.getRangeAt(0);
1069
- if (l.cloneContents().querySelector("table"))
1108
+ const l = window.getSelection();
1109
+ if (!l || l.rangeCount === 0) return;
1110
+ const o = l.getRangeAt(0);
1111
+ if (o.cloneContents().querySelector("table"))
1070
1112
  return;
1071
- if (l.cloneContents().querySelectorAll(".rte-resize-handle").length > 0) {
1113
+ if (o.cloneContents().querySelectorAll(".rte-resize-handle").length > 0) {
1072
1114
  e.preventDefault(), e.stopPropagation();
1073
1115
  return;
1074
1116
  }
@@ -1081,7 +1123,7 @@ const nn = ({
1081
1123
  if (oe(a))
1082
1124
  return;
1083
1125
  setTimeout(() => {
1084
- $e(n.getRangeAt(0)), ne(""), x(r), j(!0);
1126
+ $e(n.getRangeAt(0)), ne(""), M(r), z(!0);
1085
1127
  }, 0);
1086
1128
  return;
1087
1129
  }
@@ -1098,87 +1140,87 @@ const nn = ({
1098
1140
  }
1099
1141
  return !1;
1100
1142
  }, he = () => {
1101
- M();
1143
+ A();
1102
1144
  const e = window.getSelection();
1103
1145
  if (!e || !e.anchorNode) return;
1104
1146
  if (oe(e.anchorNode)) {
1105
- j(!1);
1147
+ z(!1);
1106
1148
  return;
1107
1149
  }
1108
1150
  let t = e.anchorNode.textContent || "";
1109
1151
  t = t.replace(/\u00A0/g, " ");
1110
1152
  const n = t.match(/@([^\n]*)$/);
1111
1153
  if (!n) {
1112
- j(!1);
1154
+ z(!1);
1113
1155
  return;
1114
1156
  }
1115
1157
  const a = n[1].trim().toLowerCase();
1116
1158
  ne(a);
1117
- const s = r.filter((i) => i.name.toLowerCase().includes(a));
1118
- s.length > 0 ? (x(s), j(!0)) : j(!1);
1159
+ const d = r.filter((l) => l.name.toLowerCase().includes(a));
1160
+ d.length > 0 ? (M(d), z(!0)) : z(!1);
1119
1161
  }, Ge = (e) => {
1120
1162
  var a;
1121
1163
  const t = (a = e.target.files) == null ? void 0 : a[0];
1122
1164
  if (!t) return;
1123
1165
  const n = new FileReader();
1124
- n.onload = (s) => {
1125
- var w;
1126
- const i = (w = s.target) == null ? void 0 : w.result;
1127
- K();
1128
- const l = window.getSelection();
1129
- let v = l && l.rangeCount ? l.getRangeAt(0) : null;
1166
+ n.onload = (d) => {
1167
+ var C;
1168
+ const l = (C = d.target) == null ? void 0 : C.result;
1169
+ Y();
1170
+ const o = window.getSelection();
1171
+ let h = o && o.rangeCount ? o.getRangeAt(0) : null;
1130
1172
  const y = document.createElement("img");
1131
- y.src = i, y.alt = t.name || "image", y.className = "rte-inserted-image", y.contentEditable = "true";
1132
- const g = O();
1133
- if (!v || !g) {
1134
- g == null || g.appendChild(y);
1135
- const H = document.createTextNode(" ");
1136
- g == null || g.appendChild(H);
1173
+ y.src = l, y.alt = t.name || "image", y.className = "rte-inserted-image", y.contentEditable = "true";
1174
+ const m = q();
1175
+ if (!h || !m) {
1176
+ m == null || m.appendChild(y);
1177
+ const I = document.createTextNode(" ");
1178
+ m == null || m.appendChild(I);
1137
1179
  const ie = document.createRange();
1138
- ie.setStartAfter(H), ie.collapse(!0), l == null || l.removeAllRanges(), l == null || l.addRange(ie), g == null || g.focus(), M(), e.target.value = "";
1180
+ ie.setStartAfter(I), ie.collapse(!0), o == null || o.removeAllRanges(), o == null || o.addRange(ie), m == null || m.focus(), A(), e.target.value = "";
1139
1181
  return;
1140
1182
  }
1141
- v.deleteContents(), v.insertNode(y);
1142
- const d = document.createTextNode(" ");
1143
- y.after(d);
1144
- const p = document.createRange();
1145
- p.setStartAfter(d), p.collapse(!0), l.removeAllRanges(), l.addRange(p), g.focus(), M(), e.target.value = "";
1183
+ h.deleteContents(), h.insertNode(y);
1184
+ const c = document.createTextNode(" ");
1185
+ y.after(c);
1186
+ const v = document.createRange();
1187
+ v.setStartAfter(c), v.collapse(!0), o.removeAllRanges(), o.addRange(v), m.focus(), A(), e.target.value = "";
1146
1188
  }, n.readAsDataURL(t);
1147
1189
  }, et = (e) => {
1148
- var s;
1149
- K();
1190
+ var d;
1191
+ Y();
1150
1192
  const t = window.getSelection();
1151
1193
  if (!(t != null && t.rangeCount)) return;
1152
1194
  const n = t.getRangeAt(0), a = document.createTextNode(e);
1153
- n.insertNode(a), n.setStartAfter(a), n.collapse(!0), t.removeAllRanges(), t.addRange(n), (s = O()) == null || s.focus(), M();
1195
+ n.insertNode(a), n.setStartAfter(a), n.collapse(!0), t.removeAllRanges(), t.addRange(n), (d = q()) == null || d.focus(), A();
1154
1196
  }, pe = (e) => {
1155
- var d;
1156
- ft(), K();
1197
+ var c;
1198
+ ft(), Y();
1157
1199
  const t = document.createElement("table");
1158
- t.style.borderCollapse = "collapse", t.style.width = "100%", t.style.border = "1px solid #ccc", t.style.margin = "8px 0", t.style.position = "relative", t.style.textAlign = "center", h.table && t.classList.add(h.table);
1200
+ t.style.borderCollapse = "collapse", t.style.width = "100%", t.style.border = "1px solid #ccc", t.style.margin = "8px 0", t.style.position = "relative", t.style.textAlign = "center", p.table && t.classList.add(p.table);
1159
1201
  const n = document.createElement("thead");
1160
- h.thead && n.classList.add(h.thead);
1202
+ p.thead && n.classList.add(p.thead);
1161
1203
  const a = document.createElement("tbody");
1162
- h.tbody && a.classList.add(h.tbody), e === "insertStaticTable" && a.setAttribute("table-type", "static");
1163
- const s = document.createElement("tr");
1164
- h.tr && s.classList.add(h.tr);
1165
- const i = document.createElement("tr");
1166
- h.tr && i.classList.add(h.tr);
1167
- for (let p = 0; p < 2; p++) {
1168
- const w = document.createElement("th");
1169
- w.textContent = "", w.style.border = "1px solid #999", w.style.padding = "4px", w.style.position = "relative", w.style.backgroundColor = "lightgray", w.style.height = "20px", h.th && w.classList.add(h.th);
1170
- const H = document.createElement("td");
1171
- H.textContent = "", H.style.border = "1px solid #999", H.style.padding = "4px", H.style.position = "relative", H.style.backgroundColor = "#fff", H.style.height = "20px", h.td && H.classList.add(h.td), X(w), X(H), s.appendChild(w), i.appendChild(H);
1204
+ p.tbody && a.classList.add(p.tbody), e === "insertStaticTable" && a.setAttribute("table-type", "static");
1205
+ const d = document.createElement("tr");
1206
+ p.tr && d.classList.add(p.tr);
1207
+ const l = document.createElement("tr");
1208
+ p.tr && l.classList.add(p.tr);
1209
+ for (let v = 0; v < 2; v++) {
1210
+ const C = document.createElement("th");
1211
+ C.textContent = "", C.style.border = "1px solid #999", C.style.padding = "4px", C.style.position = "relative", C.style.backgroundColor = "lightgray", C.style.height = "20px", p.th && C.classList.add(p.th);
1212
+ const I = document.createElement("td");
1213
+ I.textContent = "", I.style.border = "1px solid #999", I.style.padding = "4px", I.style.position = "relative", I.style.backgroundColor = "#fff", I.style.height = "20px", p.td && I.classList.add(p.td), Q(C), Q(I), d.appendChild(C), l.appendChild(I);
1172
1214
  }
1173
- n.appendChild(s), a.appendChild(i), t.appendChild(n), t.appendChild(a), le(t);
1174
- const l = window.getSelection();
1175
- if (!(l != null && l.rangeCount)) return;
1176
- const v = l.getRangeAt(0);
1177
- v.collapse(!1), v.insertNode(t);
1215
+ n.appendChild(d), a.appendChild(l), t.appendChild(n), t.appendChild(a), le(t);
1216
+ const o = window.getSelection();
1217
+ if (!(o != null && o.rangeCount)) return;
1218
+ const h = o.getRangeAt(0);
1219
+ h.collapse(!1), h.insertNode(t);
1178
1220
  const y = document.createElement("p");
1179
1221
  y.innerHTML = "<br/>", t.after(y);
1180
- const g = document.createRange();
1181
- g.setStart(y, 0), g.collapse(!0), l.removeAllRanges(), l.addRange(g), (d = O()) == null || d.focus(), M();
1222
+ const m = document.createRange();
1223
+ m.setStart(y, 0), m.collapse(!0), o.removeAllRanges(), o.addRange(m), (c = q()) == null || c.focus(), A();
1182
1224
  }, le = (e) => {
1183
1225
  if (e.dataset.hasResizeHandle === "true") return;
1184
1226
  const t = document.createElement("div");
@@ -1193,20 +1235,20 @@ const nn = ({
1193
1235
  zIndex: "20",
1194
1236
  borderRadius: "2px"
1195
1237
  }), t.contentEditable = "false", t.dataset.hasResizeHandle = "true", t.classList.add("rte-resize-handle");
1196
- let n = 0, a = 0, s = 0, i = 0;
1197
- t.addEventListener("mousedown", (l) => {
1198
- l.preventDefault(), n = l.clientX, a = l.clientY;
1199
- const v = e.getBoundingClientRect();
1200
- s = v.width, i = v.height;
1201
- const y = (d) => {
1202
- const p = Math.max(100, s + (d.clientX - n)), w = Math.max(20, i + (d.clientY - a));
1203
- e.style.width = `${p}px`, e.style.height = `${w}px`, M();
1204
- }, g = () => {
1205
- document.removeEventListener("mousemove", y), document.removeEventListener("mouseup", g), M();
1238
+ let n = 0, a = 0, d = 0, l = 0;
1239
+ t.addEventListener("mousedown", (o) => {
1240
+ o.preventDefault(), n = o.clientX, a = o.clientY;
1241
+ const h = e.getBoundingClientRect();
1242
+ d = h.width, l = h.height;
1243
+ const y = (c) => {
1244
+ const v = Math.max(100, d + (c.clientX - n)), C = Math.max(20, l + (c.clientY - a));
1245
+ e.style.width = `${v}px`, e.style.height = `${C}px`, A();
1246
+ }, m = () => {
1247
+ document.removeEventListener("mousemove", y), document.removeEventListener("mouseup", m), A();
1206
1248
  };
1207
- document.addEventListener("mousemove", y), document.addEventListener("mouseup", g);
1249
+ document.addEventListener("mousemove", y), document.addEventListener("mouseup", m);
1208
1250
  }), e.appendChild(t);
1209
- }, X = (e) => {
1251
+ }, Q = (e) => {
1210
1252
  const t = document.createElement("div"), n = document.createElement("div");
1211
1253
  Object.assign(t.style, {
1212
1254
  position: "absolute",
@@ -1234,20 +1276,20 @@ const nn = ({
1234
1276
  pointerEvents: "auto"
1235
1277
  }), n.contentEditable = "false", n.classList.add("rte-resize-handle"), tt(e, t, n), e.appendChild(t), e.appendChild(n);
1236
1278
  }, tt = (e, t, n) => {
1237
- let a = 0, s = 0, i = 0, l = 0;
1238
- t.addEventListener("mousedown", (d) => {
1239
- d.preventDefault(), a = d.clientX, i = e.offsetWidth, document.addEventListener("mousemove", v), document.addEventListener("mouseup", g);
1240
- }), n.addEventListener("mousedown", (d) => {
1241
- d.preventDefault(), s = d.clientY, l = e.offsetHeight, document.addEventListener("mousemove", y), document.addEventListener("mouseup", g);
1279
+ let a = 0, d = 0, l = 0, o = 0;
1280
+ t.addEventListener("mousedown", (c) => {
1281
+ c.preventDefault(), a = c.clientX, l = e.offsetWidth, document.addEventListener("mousemove", h), document.addEventListener("mouseup", m);
1282
+ }), n.addEventListener("mousedown", (c) => {
1283
+ c.preventDefault(), d = c.clientY, o = e.offsetHeight, document.addEventListener("mousemove", y), document.addEventListener("mouseup", m);
1242
1284
  });
1243
- const v = (d) => {
1244
- const p = i + (d.clientX - a);
1245
- e.style.width = `${Math.max(30, p)}px`, M();
1246
- }, y = (d) => {
1247
- const p = l + (d.clientY - s);
1248
- e.style.height = `${Math.max(20, p)}px`, M();
1249
- }, g = () => {
1250
- document.removeEventListener("mousemove", v), document.removeEventListener("mousemove", y), document.removeEventListener("mouseup", g), M();
1285
+ const h = (c) => {
1286
+ const v = l + (c.clientX - a);
1287
+ e.style.width = `${Math.max(30, v)}px`, A();
1288
+ }, y = (c) => {
1289
+ const v = o + (c.clientY - d);
1290
+ e.style.height = `${Math.max(20, v)}px`, A();
1291
+ }, m = () => {
1292
+ document.removeEventListener("mousemove", h), document.removeEventListener("mousemove", y), document.removeEventListener("mouseup", m), A();
1251
1293
  };
1252
1294
  }, nt = (e) => {
1253
1295
  const n = e.target.closest("td, th");
@@ -1260,37 +1302,37 @@ const nn = ({
1260
1302
  }, ve = () => {
1261
1303
  document.querySelectorAll(".rte-cell-highlight").forEach((e) => e.classList.remove("rte-cell-highlight"));
1262
1304
  }, rt = (e) => {
1263
- if (!_.cell) return;
1264
- const t = _.cell.closest("table"), n = _.cell.cellIndex, a = _.cell.parentElement.rowIndex, s = (i) => {
1265
- const l = i.tagName.toLowerCase(), v = document.createElement(l);
1266
- return v.textContent = "", v.style.cssText = i.style.cssText, X(v), v;
1305
+ if (!B.cell) return;
1306
+ const t = B.cell.closest("table"), n = B.cell.cellIndex, a = B.cell.parentElement.rowIndex, d = (l) => {
1307
+ const o = l.tagName.toLowerCase(), h = document.createElement(o);
1308
+ return h.textContent = "", h.style.cssText = l.style.cssText, Q(h), h;
1267
1309
  };
1268
1310
  switch (e) {
1269
1311
  case "insertRowAbove": {
1270
- const i = t.rows[a], l = t.insertRow(a);
1271
- Array.from(i.cells).forEach((v) => {
1272
- l.appendChild(s(v));
1312
+ const l = t.rows[a], o = t.insertRow(a);
1313
+ Array.from(l.cells).forEach((h) => {
1314
+ o.appendChild(d(h));
1273
1315
  });
1274
1316
  break;
1275
1317
  }
1276
1318
  case "insertRowBelow": {
1277
- const i = t.rows[a], l = t.insertRow(a + 1);
1278
- Array.from(i.cells).forEach((v) => {
1279
- l.appendChild(s(v));
1319
+ const l = t.rows[a], o = t.insertRow(a + 1);
1320
+ Array.from(l.cells).forEach((h) => {
1321
+ o.appendChild(d(h));
1280
1322
  });
1281
1323
  break;
1282
1324
  }
1283
1325
  case "insertColLeft": {
1284
- Array.from(t.rows).forEach((i) => {
1285
- const l = i.cells[n];
1286
- i.insertBefore(s(l), l);
1326
+ Array.from(t.rows).forEach((l) => {
1327
+ const o = l.cells[n];
1328
+ l.insertBefore(d(o), o);
1287
1329
  });
1288
1330
  break;
1289
1331
  }
1290
1332
  case "insertColRight": {
1291
- Array.from(t.rows).forEach((i) => {
1292
- const l = i.cells[n];
1293
- i.insertBefore(s(l), l.nextSibling);
1333
+ Array.from(t.rows).forEach((l) => {
1334
+ const o = l.cells[n];
1335
+ l.insertBefore(d(o), o.nextSibling);
1294
1336
  });
1295
1337
  break;
1296
1338
  }
@@ -1298,35 +1340,35 @@ const nn = ({
1298
1340
  t.rows.length > 1 && t.deleteRow(a);
1299
1341
  break;
1300
1342
  case "deleteCol":
1301
- Array.from(t.rows).forEach((i) => {
1302
- i.cells[n] && i.deleteCell(n);
1343
+ Array.from(t.rows).forEach((l) => {
1344
+ l.cells[n] && l.deleteCell(n);
1303
1345
  });
1304
1346
  break;
1305
1347
  }
1306
- M(), f(se(ce({}, _), {
1348
+ A(), f(se(ce({}, B), {
1307
1349
  visible: !1
1308
1350
  })), ve();
1309
1351
  }, at = () => {
1310
- Z(), Q.current = D.current, de({
1352
+ K(), J.current = F.current, de({
1311
1353
  url: "",
1312
1354
  text: "",
1313
1355
  title: "",
1314
1356
  target: "_self"
1315
- }), F(!0);
1357
+ }), V(!0);
1316
1358
  }, ot = (e) => {
1317
1359
  const t = window.getSelection();
1318
- if (!t || !Q.current) return;
1319
- t.removeAllRanges(), t.addRange(Q.current);
1360
+ if (!t || !J.current) return;
1361
+ t.removeAllRanges(), t.addRange(J.current);
1320
1362
  let n = e.url.trim();
1321
1363
  /^https?:\/\//i.test(n) || (n = "https://" + n);
1322
1364
  const a = document.createElement("a");
1323
1365
  a.href = n, a.style.cursor = "pointer", a.style.outline = "none", a.textContent = e.text || n, a.title = e.title, a.target = e.target, a.contentEditable = "true";
1324
- const s = t.getRangeAt(0);
1325
- s.deleteContents(), s.insertNode(a);
1326
- const i = document.createTextNode(" ");
1327
- a.after(i);
1328
- const l = document.createRange();
1329
- l.setStartAfter(i), l.collapse(!0), t.removeAllRanges(), t.addRange(l), F(!1), M();
1366
+ const d = t.getRangeAt(0);
1367
+ d.deleteContents(), d.insertNode(a);
1368
+ const l = document.createTextNode(" ");
1369
+ a.after(l);
1370
+ const o = document.createRange();
1371
+ o.setStartAfter(l), o.collapse(!0), t.removeAllRanges(), t.addRange(o), V(!1), A();
1330
1372
  }, lt = (e) => {
1331
1373
  const t = e.target;
1332
1374
  if (t.tagName === "A") {
@@ -1337,58 +1379,58 @@ const nn = ({
1337
1379
  }
1338
1380
  e.preventDefault();
1339
1381
  const a = document.createRange();
1340
- a.selectNode(n), Q.current = a, de({
1382
+ a.selectNode(n), J.current = a, de({
1341
1383
  url: n.href,
1342
1384
  text: n.textContent || n.href,
1343
1385
  title: n.title,
1344
1386
  target: n.target
1345
- }), F(!0);
1387
+ }), V(!0);
1346
1388
  }
1347
1389
  }, it = () => {
1348
- const e = O();
1390
+ const e = q();
1349
1391
  if (!e) return;
1350
1392
  const t = window.getSelection();
1351
- if ((!t || t.rangeCount === 0) && D.current) {
1352
- const d = window.getSelection();
1353
- d == null || d.removeAllRanges(), d == null || d.addRange(D.current);
1393
+ if ((!t || t.rangeCount === 0) && F.current) {
1394
+ const c = window.getSelection();
1395
+ c == null || c.removeAllRanges(), c == null || c.addRange(F.current);
1354
1396
  }
1355
1397
  const n = window.getSelection();
1356
1398
  if (!n || n.rangeCount === 0) return;
1357
1399
  const a = n.getRangeAt(0);
1358
- K(), document.execCommand("removeFormat", !1);
1359
- const s = a.cloneContents(), i = document.createElement("div");
1360
- i.appendChild(s);
1361
- const l = document.createTreeWalker(i, NodeFilter.SHOW_ELEMENT, null), v = [];
1362
- for (; l.nextNode(); ) {
1363
- const d = l.currentNode, p = d.tagName.toUpperCase(), w = d.getAttribute && d.getAttribute("data-mention") !== null;
1364
- p !== "A" && !w && v.push(d);
1400
+ Y(), document.execCommand("removeFormat", !1);
1401
+ const d = a.cloneContents(), l = document.createElement("div");
1402
+ l.appendChild(d);
1403
+ const o = document.createTreeWalker(l, NodeFilter.SHOW_ELEMENT, null), h = [];
1404
+ for (; o.nextNode(); ) {
1405
+ const c = o.currentNode, v = c.tagName.toUpperCase(), C = c.getAttribute && c.getAttribute("data-mention") !== null;
1406
+ v !== "A" && !C && h.push(c);
1365
1407
  }
1366
- for (let d = v.length - 1; d >= 0; d--) {
1367
- const p = v[d], w = p.parentNode;
1368
- if (w) {
1369
- for (; p.firstChild; ) w.insertBefore(p.firstChild, p);
1370
- w.removeChild(p);
1408
+ for (let c = h.length - 1; c >= 0; c--) {
1409
+ const v = h[c], C = v.parentNode;
1410
+ if (C) {
1411
+ for (; v.firstChild; ) C.insertBefore(v.firstChild, v);
1412
+ C.removeChild(v);
1371
1413
  }
1372
1414
  }
1373
- i.querySelectorAll("[style]").forEach((d) => d.removeAttribute("style")), a.deleteContents();
1415
+ l.querySelectorAll("[style]").forEach((c) => c.removeAttribute("style")), a.deleteContents();
1374
1416
  const y = document.createDocumentFragment();
1375
- for (; i.firstChild; ) y.appendChild(i.firstChild);
1417
+ for (; l.firstChild; ) y.appendChild(l.firstChild);
1376
1418
  a.insertNode(y);
1377
- const g = document.createRange();
1378
- g.setStartAfter(a.endContainer.nodeType === Node.TEXT_NODE ? a.endContainer : a.startContainer), g.collapse(!0), n.removeAllRanges(), n.addRange(g), e.normalize(), M();
1419
+ const m = document.createRange();
1420
+ m.setStartAfter(a.endContainer.nodeType === Node.TEXT_NODE ? a.endContainer : a.startContainer), m.collapse(!0), n.removeAllRanges(), n.addRange(m), e.normalize(), A();
1379
1421
  }, ct = (e) => {
1380
1422
  var a;
1381
1423
  let t = e;
1382
1424
  t = t.replace(/{{#arrayData\d*}}/g, ""), t = t.replace(/{{\/arrayData\d*}}/g, "");
1383
1425
  const n = document.createElement("div");
1384
- return n.innerHTML = t, n.querySelectorAll("br").forEach((s) => {
1385
- s.replaceWith(`
1426
+ return n.innerHTML = t, n.querySelectorAll("br").forEach((d) => {
1427
+ d.replaceWith(`
1386
1428
  `);
1387
- }), n.querySelectorAll("p, div, tr").forEach((s) => {
1388
- s.insertAdjacentText("afterend", `
1429
+ }), n.querySelectorAll("p, div, tr").forEach((d) => {
1430
+ d.insertAdjacentText("afterend", `
1389
1431
  `);
1390
- }), n.querySelectorAll("table").forEach((s) => {
1391
- s.insertAdjacentText("afterend", `
1432
+ }), n.querySelectorAll("table").forEach((d) => {
1433
+ d.insertAdjacentText("afterend", `
1392
1434
  `);
1393
1435
  }), ((a = n.textContent) == null ? void 0 : a.replace(/\n{3,}/g, `
1394
1436
 
@@ -1399,14 +1441,14 @@ const nn = ({
1399
1441
  if (!e || e.rangeCount === 0) return [];
1400
1442
  const t = e.getRangeAt(0);
1401
1443
  if (t.collapsed) {
1402
- let i = t.startContainer, l = i.nodeType === Node.ELEMENT_NODE ? i : i.parentElement;
1403
- const v = l == null ? void 0 : l.closest("td, th");
1404
- return v ? [v] : [];
1444
+ let l = t.startContainer, o = l.nodeType === Node.ELEMENT_NODE ? l : l.parentElement;
1445
+ const h = o == null ? void 0 : o.closest("td, th");
1446
+ return h ? [h] : [];
1405
1447
  }
1406
1448
  const n = t.commonAncestorContainer, a = n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement;
1407
- return Array.from(a.querySelectorAll("td, th")).filter((i) => {
1408
- const l = document.createRange();
1409
- return l.selectNodeContents(i), t.compareBoundaryPoints(Range.END_TO_START, l) < 0 && t.compareBoundaryPoints(Range.START_TO_END, l) > 0;
1449
+ return Array.from(a.querySelectorAll("td, th")).filter((l) => {
1450
+ const o = document.createRange();
1451
+ return o.selectNodeContents(l), t.compareBoundaryPoints(Range.END_TO_START, o) < 0 && t.compareBoundaryPoints(Range.START_TO_END, o) > 0;
1410
1452
  });
1411
1453
  }
1412
1454
  function dt(e) {
@@ -1418,69 +1460,69 @@ const nn = ({
1418
1460
  let n = "left";
1419
1461
  e === "justifyCenter" && (n = "center"), e === "justifyRight" && (n = "right"), t.forEach((a) => {
1420
1462
  a.style.textAlign = n;
1421
- }), M();
1463
+ }), A();
1422
1464
  }
1423
1465
  const ut = (e) => {
1424
1466
  e.preventDefault();
1425
1467
  const t = e.clipboardData.items;
1426
- for (let g = 0; g < t.length; g++) {
1427
- const d = t[g];
1428
- if (d.kind === "file" && d.type.startsWith("image/"))
1468
+ for (let m = 0; m < t.length; m++) {
1469
+ const c = t[m];
1470
+ if (c.kind === "file" && c.type.startsWith("image/"))
1429
1471
  return;
1430
- d.kind === "string" && d.getAsString((p) => {
1431
- /<img\s/i.test(p);
1472
+ c.kind === "string" && c.getAsString((v) => {
1473
+ /<img\s/i.test(v);
1432
1474
  });
1433
1475
  }
1434
1476
  const n = e.clipboardData.getData("text/html") || "";
1435
1477
  if (!n) return;
1436
1478
  const a = document.createElement("div");
1437
1479
  a.innerHTML = n;
1438
- const s = (g) => {
1439
- g.style.borderCollapse = "collapse", g.style.width = "100%", g.style.border = "1px solid #ccc", g.style.margin = "8px 0", g.style.position = "relative", g.style.textAlign = "center", g.querySelectorAll("th").forEach((d) => {
1440
- const p = d;
1441
- p.style.border = "1px solid #999", p.style.padding = "4px", p.style.position = "relative", p.style.backgroundColor = "lightgray", p.style.height = "20px";
1442
- }), g.querySelectorAll("td").forEach((d) => {
1443
- const p = d;
1444
- p.style.border = "1px solid #999", p.style.padding = "4px", p.style.position = "relative", p.style.backgroundColor = "#fff", p.style.height = "20px";
1480
+ const d = (m) => {
1481
+ m.style.borderCollapse = "collapse", m.style.width = "100%", m.style.border = "1px solid #ccc", m.style.margin = "8px 0", m.style.position = "relative", m.style.textAlign = "center", m.querySelectorAll("th").forEach((c) => {
1482
+ const v = c;
1483
+ v.style.border = "1px solid #999", v.style.padding = "4px", v.style.position = "relative", v.style.backgroundColor = "lightgray", v.style.height = "20px";
1484
+ }), m.querySelectorAll("td").forEach((c) => {
1485
+ const v = c;
1486
+ v.style.border = "1px solid #999", v.style.padding = "4px", v.style.position = "relative", v.style.backgroundColor = "#fff", v.style.height = "20px";
1445
1487
  });
1446
1488
  };
1447
- a.querySelectorAll("table").forEach((g) => s(g));
1448
- const i = window.getSelection();
1449
- if (!i || !i.rangeCount) return;
1450
- const l = i.getRangeAt(0);
1451
- l.deleteContents();
1452
- const v = document.createDocumentFragment();
1453
- for (; a.firstChild; ) v.appendChild(a.firstChild);
1454
- l.insertNode(v), l.collapse(!1), i.removeAllRanges(), i.addRange(l);
1455
- const y = A.current;
1456
- y && (y.querySelectorAll("table").forEach((g) => {
1457
- const d = g;
1458
- d.hasAttribute("data-has-resize-handle") || (le(d), d.querySelectorAll("th, td").forEach((p) => {
1459
- const w = p;
1460
- w.dataset.hasResizeHandles || X(w);
1489
+ a.querySelectorAll("table").forEach((m) => d(m));
1490
+ const l = window.getSelection();
1491
+ if (!l || !l.rangeCount) return;
1492
+ const o = l.getRangeAt(0);
1493
+ o.deleteContents();
1494
+ const h = document.createDocumentFragment();
1495
+ for (; a.firstChild; ) h.appendChild(a.firstChild);
1496
+ o.insertNode(h), o.collapse(!1), l.removeAllRanges(), l.addRange(o);
1497
+ const y = R.current;
1498
+ y && (y.querySelectorAll("table").forEach((m) => {
1499
+ const c = m;
1500
+ c.hasAttribute("data-has-resize-handle") || (le(c), c.querySelectorAll("th, td").forEach((v) => {
1501
+ const C = v;
1502
+ C.dataset.hasResizeHandles || Q(C);
1461
1503
  }));
1462
- }), M());
1504
+ }), A());
1463
1505
  }, mt = (e) => {
1464
- K();
1506
+ Y();
1465
1507
  const t = window.getSelection();
1466
1508
  if (!t || !t.rangeCount) return;
1467
1509
  const n = t.getRangeAt(0), a = document.createElement("span");
1468
1510
  a.style.fontSize = `${e}px`, a.appendChild(n.extractContents()), n.insertNode(a);
1469
- const s = document.createRange();
1470
- s.setStartAfter(a), s.collapse(!0), t.removeAllRanges(), t.addRange(s), M();
1511
+ const d = document.createRange();
1512
+ d.setStartAfter(a), d.collapse(!0), t.removeAllRanges(), t.addRange(d), A();
1471
1513
  }, gt = () => {
1472
1514
  const e = window.getSelection();
1473
1515
  if (!e || !e.anchorNode) return null;
1474
1516
  const t = e.anchorNode;
1475
1517
  if (oe(t) || t.nodeType !== Node.TEXT_NODE) return null;
1476
- const n = t.textContent || "", a = e.anchorOffset, s = n.lastIndexOf("@", a - 1);
1477
- if (s === -1) return null;
1478
- const i = n.substring(s + 1, a);
1479
- if (i.includes(" ") || i.includes(" ")) return null;
1480
- const l = document.createRange();
1481
- return l.setStart(t, s), l.setEnd(t, a), {
1482
- range: l,
1483
- query: i
1518
+ const n = t.textContent || "", a = e.anchorOffset, d = n.lastIndexOf("@", a - 1);
1519
+ if (d === -1) return null;
1520
+ const l = n.substring(d + 1, a);
1521
+ if (l.includes(" ") || l.includes(" ")) return null;
1522
+ const o = document.createRange();
1523
+ return o.setStart(t, d), o.setEnd(t, a), {
1524
+ range: o,
1525
+ query: l
1484
1526
  };
1485
1527
  }, ye = () => {
1486
1528
  const e = gt();
@@ -1490,33 +1532,45 @@ const nn = ({
1490
1532
  query: n
1491
1533
  } = e, a = document.createElement("span");
1492
1534
  a.textContent = "​", t.insertNode(a);
1493
- const s = a.getBoundingClientRect();
1494
- a.remove(), Y({
1495
- x: s.left,
1496
- y: s.bottom + window.scrollY
1535
+ const d = a.getBoundingClientRect();
1536
+ a.remove(), $({
1537
+ x: d.left,
1538
+ y: d.bottom + window.scrollY
1497
1539
  }), ne(n.toLowerCase());
1498
- const i = r.filter((l) => l.name.toLowerCase().includes(n.toLowerCase()));
1499
- x(i), j(!0), W.current = t.cloneRange();
1540
+ const l = r.filter((o) => o.name.toLowerCase().includes(n.toLowerCase()));
1541
+ M(l), z(!0), X.current = t.cloneRange();
1500
1542
  };
1501
1543
  function ft() {
1502
- const e = A.current;
1544
+ const e = R.current;
1503
1545
  if (!e) return;
1504
1546
  const t = window.getSelection();
1505
1547
  if (!t || t.rangeCount > 0 && e.contains(t.anchorNode))
1506
1548
  return;
1507
1549
  const n = document.createRange();
1508
- n.selectNodeContents(e), n.collapse(!1), t.removeAllRanges(), t.addRange(n), D.current = n.cloneRange();
1550
+ n.selectNodeContents(e), n.collapse(!1), t.removeAllRanges(), t.addRange(n), F.current = n.cloneRange();
1509
1551
  }
1510
- return /* @__PURE__ */ o.createElement("div", {
1511
- className: `rte-wrapper ${(h == null ? void 0 : h.wrapper) || ""}`,
1512
- style: C.wrapper
1513
- }, /* @__PURE__ */ o.createElement("div", {
1552
+ const ht = (e) => {
1553
+ const t = e.target;
1554
+ if (!t || !(t.textContent || "").match(/{{([\s\S]+?)}}/) || !R.current) return;
1555
+ let l = t.firstChild;
1556
+ if ((!l || l.nodeType !== Node.TEXT_NODE) && (l = t.childNodes[0]), !l || l.nodeType !== Node.TEXT_NODE) return;
1557
+ const o = l.textContent || "", h = o.indexOf("{{"), y = o.indexOf("}}");
1558
+ if (h === -1 || y === -1) return;
1559
+ const m = window.getSelection();
1560
+ if (!m) return;
1561
+ const c = document.createRange();
1562
+ c.setStart(l, h), c.setEnd(l, y + 2), m.removeAllRanges(), m.addRange(c);
1563
+ };
1564
+ return /* @__PURE__ */ i.createElement("div", {
1565
+ className: `rte-wrapper ${(p == null ? void 0 : p.wrapper) || ""}`,
1566
+ style: b.wrapper
1567
+ }, /* @__PURE__ */ i.createElement("div", {
1514
1568
  style: {
1515
1569
  flex: 1
1516
1570
  }
1517
- }, /* @__PURE__ */ o.createElement(Kt, {
1571
+ }, /* @__PURE__ */ i.createElement(Kt, {
1518
1572
  exec: ae,
1519
- saveSelection: Z,
1573
+ saveSelection: K,
1520
1574
  handleFileChange: Ge,
1521
1575
  handleFontSizeChange: (e) => mt(e.target.value),
1522
1576
  handleFontFamilyChange: (e) => ae("fontName", e.target.value),
@@ -1524,62 +1578,63 @@ const nn = ({
1524
1578
  handleLink: at,
1525
1579
  removeFormatting: it,
1526
1580
  visibleActions: Pe,
1527
- className: h.toolbar,
1528
- style: C.toolbar
1529
- }), /* @__PURE__ */ o.createElement("div", {
1530
- ref: A,
1581
+ className: p.toolbar,
1582
+ style: b.toolbar
1583
+ }), /* @__PURE__ */ i.createElement("div", {
1584
+ ref: R,
1531
1585
  id: "rte-editor-body",
1532
- className: `rte-editor ${(h == null ? void 0 : h.editor) || ""}`,
1533
- style: C.editor,
1586
+ className: `rte-editor ${(p == null ? void 0 : p.editor) || ""}`,
1587
+ style: b.editor,
1534
1588
  contentEditable: !0,
1535
1589
  suppressContentEditableWarning: !0,
1536
1590
  onPaste: ut,
1537
1591
  onKeyUp: () => {
1538
- Z(), ye();
1592
+ K(), ye();
1539
1593
  },
1540
- onMouseUp: Z,
1594
+ onMouseUp: K,
1541
1595
  onInput: () => {
1542
- he(), Z();
1596
+ he(), K();
1543
1597
  },
1544
1598
  onKeyDown: Qe,
1545
1599
  onBeforeInput: Je,
1546
1600
  onContextMenu: nt,
1547
1601
  onClick: (e) => {
1548
- lt(e), Z(), ye();
1549
- }
1550
- }), /* @__PURE__ */ o.createElement(Xt, {
1602
+ lt(e), K(), ye();
1603
+ },
1604
+ onDoubleClick: ht
1605
+ }), /* @__PURE__ */ i.createElement(Yt, {
1551
1606
  show: P,
1552
- position: q,
1553
- filtered: te,
1607
+ position: _,
1608
+ filtered: Z,
1554
1609
  insertMention: Ze,
1555
- onClose: () => j(!1),
1610
+ onClose: () => z(!1),
1556
1611
  query: qe
1557
- }), c && /* @__PURE__ */ o.createElement("div", {
1558
- className: `rte-output ${(h == null ? void 0 : h.output) || ""}`,
1559
- style: C.output
1560
- }, /* @__PURE__ */ o.createElement("h4", null, "Output HTML:"), /* @__PURE__ */ o.createElement("p", null, U)), /* @__PURE__ */ o.createElement(Yt, {
1561
- visible: _.visible,
1562
- x: _.x,
1563
- y: _.y,
1612
+ }), s && /* @__PURE__ */ i.createElement("div", {
1613
+ className: `rte-output ${(p == null ? void 0 : p.output) || ""}`,
1614
+ style: b.output
1615
+ }, /* @__PURE__ */ i.createElement("h4", null, "Output HTML:"), /* @__PURE__ */ i.createElement("p", null, O)), /* @__PURE__ */ i.createElement(Qt, {
1616
+ visible: B.visible,
1617
+ x: B.x,
1618
+ y: B.y,
1564
1619
  onAction: rt,
1565
1620
  onClose: () => {
1566
- f(se(ce({}, _), {
1621
+ f(se(ce({}, B), {
1567
1622
  visible: !1
1568
1623
  })), ve();
1569
1624
  }
1570
- }), /* @__PURE__ */ o.createElement(Jt, {
1571
- visible: b,
1625
+ }), /* @__PURE__ */ i.createElement(Gt, {
1626
+ visible: L,
1572
1627
  linkData: Ie,
1573
- onClose: () => F(!1),
1628
+ onClose: () => V(!1),
1574
1629
  onInsert: ot
1575
- })), u ? /* @__PURE__ */ o.createElement(Qt, {
1576
- className: h.preview,
1577
- style: C.preview,
1578
- html: U
1630
+ })), u ? /* @__PURE__ */ i.createElement(Jt, {
1631
+ className: p.preview,
1632
+ style: b.preview,
1633
+ html: O
1579
1634
  }) : null);
1580
1635
  };
1581
1636
  export {
1582
- nn as RichTextEditor,
1583
- Qt as RtePreview,
1637
+ rn as RichTextEditor,
1638
+ Jt as RtePreview,
1584
1639
  Kt as RteToolbar
1585
1640
  };