@ryzeup/richtexteditor 1.0.17 → 1.0.19

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,173 +1,173 @@
1
- var ct = Object.defineProperty, it = Object.defineProperties;
2
- var st = Object.getOwnPropertyDescriptors;
3
- var Le = Object.getOwnPropertySymbols;
4
- var dt = Object.prototype.hasOwnProperty, ut = Object.prototype.propertyIsEnumerable;
5
- var Se = (r, c, d) => c in r ? ct(r, c, { enumerable: !0, configurable: !0, writable: !0, value: d }) : r[c] = d, ae = (r, c) => {
6
- for (var d in c || (c = {}))
7
- dt.call(c, d) && Se(r, d, c[d]);
8
- if (Le)
9
- for (var d of Le(c))
10
- ut.call(c, d) && Se(r, d, c[d]);
1
+ var dt = Object.defineProperty, ut = Object.defineProperties;
2
+ var mt = Object.getOwnPropertyDescriptors;
3
+ var xe = Object.getOwnPropertySymbols;
4
+ var gt = Object.prototype.hasOwnProperty, ft = Object.prototype.propertyIsEnumerable;
5
+ var Le = (r, i, d) => i in r ? dt(r, i, { enumerable: !0, configurable: !0, writable: !0, value: d }) : r[i] = d, ae = (r, i) => {
6
+ for (var d in i || (i = {}))
7
+ gt.call(i, d) && Le(r, d, i[d]);
8
+ if (xe)
9
+ for (var d of xe(i))
10
+ ft.call(i, d) && Le(r, d, i[d]);
11
11
  return r;
12
- }, oe = (r, c) => it(r, st(c));
13
- import * as mt from "react";
14
- import o, { useRef as P, useState as M, useEffect as B } from "react";
15
- import { createPortal as gt } from "react-dom";
16
- window.React = mt;
12
+ }, oe = (r, i) => ut(r, mt(i));
13
+ import * as ht from "react";
14
+ import o, { useRef as P, useState as A, useEffect as I } from "react";
15
+ import { createPortal as pt } from "react-dom";
16
+ window.React = ht;
17
17
  var ke = {
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
- }, Me = o.createContext && /* @__PURE__ */ o.createContext(ke), ft = ["attr", "size", "title"];
24
- function ht(r, c) {
23
+ }, Se = o.createContext && /* @__PURE__ */ o.createContext(ke), vt = ["attr", "size", "title"];
24
+ function yt(r, i) {
25
25
  if (r == null) return {};
26
- var d = pt(r, c), u, m;
26
+ var d = Et(r, i), u, f;
27
27
  if (Object.getOwnPropertySymbols) {
28
- var y = Object.getOwnPropertySymbols(r);
29
- for (m = 0; m < y.length; m++)
30
- u = y[m], !(c.indexOf(u) >= 0) && Object.prototype.propertyIsEnumerable.call(r, u) && (d[u] = r[u]);
28
+ var w = Object.getOwnPropertySymbols(r);
29
+ for (f = 0; f < w.length; f++)
30
+ u = w[f], !(i.indexOf(u) >= 0) && Object.prototype.propertyIsEnumerable.call(r, u) && (d[u] = r[u]);
31
31
  }
32
32
  return d;
33
33
  }
34
- function pt(r, c) {
34
+ function Et(r, i) {
35
35
  if (r == null) return {};
36
36
  var d = {};
37
37
  for (var u in r)
38
38
  if (Object.prototype.hasOwnProperty.call(r, u)) {
39
- if (c.indexOf(u) >= 0) continue;
39
+ if (i.indexOf(u) >= 0) continue;
40
40
  d[u] = r[u];
41
41
  }
42
42
  return d;
43
43
  }
44
44
  function Q() {
45
45
  return Q = Object.assign ? Object.assign.bind() : function(r) {
46
- for (var c = 1; c < arguments.length; c++) {
47
- var d = arguments[c];
46
+ for (var i = 1; i < arguments.length; i++) {
47
+ var d = arguments[i];
48
48
  for (var u in d)
49
49
  Object.prototype.hasOwnProperty.call(d, u) && (r[u] = d[u]);
50
50
  }
51
51
  return r;
52
52
  }, Q.apply(this, arguments);
53
53
  }
54
- function Ae(r, c) {
54
+ function Me(r, i) {
55
55
  var d = Object.keys(r);
56
56
  if (Object.getOwnPropertySymbols) {
57
57
  var u = Object.getOwnPropertySymbols(r);
58
- c && (u = u.filter(function(m) {
59
- return Object.getOwnPropertyDescriptor(r, m).enumerable;
58
+ i && (u = u.filter(function(f) {
59
+ return Object.getOwnPropertyDescriptor(r, f).enumerable;
60
60
  })), d.push.apply(d, u);
61
61
  }
62
62
  return d;
63
63
  }
64
64
  function J(r) {
65
- for (var c = 1; c < arguments.length; c++) {
66
- var d = arguments[c] != null ? arguments[c] : {};
67
- c % 2 ? Ae(Object(d), !0).forEach(function(u) {
68
- vt(r, u, d[u]);
69
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(d)) : Ae(Object(d)).forEach(function(u) {
65
+ for (var i = 1; i < arguments.length; i++) {
66
+ var d = arguments[i] != null ? arguments[i] : {};
67
+ i % 2 ? Me(Object(d), !0).forEach(function(u) {
68
+ wt(r, u, d[u]);
69
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(d)) : Me(Object(d)).forEach(function(u) {
70
70
  Object.defineProperty(r, u, Object.getOwnPropertyDescriptor(d, u));
71
71
  });
72
72
  }
73
73
  return r;
74
74
  }
75
- function vt(r, c, d) {
76
- return c = Et(c), c in r ? Object.defineProperty(r, c, { value: d, enumerable: !0, configurable: !0, writable: !0 }) : r[c] = d, r;
75
+ function wt(r, i, d) {
76
+ return i = Ct(i), i in r ? Object.defineProperty(r, i, { value: d, enumerable: !0, configurable: !0, writable: !0 }) : r[i] = d, r;
77
77
  }
78
- function Et(r) {
79
- var c = yt(r, "string");
80
- return typeof c == "symbol" ? c : c + "";
78
+ function Ct(r) {
79
+ var i = bt(r, "string");
80
+ return typeof i == "symbol" ? i : i + "";
81
81
  }
82
- function yt(r, c) {
82
+ function bt(r, i) {
83
83
  if (typeof r != "object" || !r) return r;
84
84
  var d = r[Symbol.toPrimitive];
85
85
  if (d !== void 0) {
86
- var u = d.call(r, c);
86
+ var u = d.call(r, i);
87
87
  if (typeof u != "object") return u;
88
88
  throw new TypeError("@@toPrimitive must return a primitive value.");
89
89
  }
90
- return (c === "string" ? String : Number)(r);
90
+ return (i === "string" ? String : Number)(r);
91
91
  }
92
- function Te(r) {
93
- return r && r.map((c, d) => /* @__PURE__ */ o.createElement(c.tag, J({
92
+ function Ne(r) {
93
+ return r && r.map((i, d) => /* @__PURE__ */ o.createElement(i.tag, J({
94
94
  key: d
95
- }, c.attr), Te(c.child)));
95
+ }, i.attr), Ne(i.child)));
96
96
  }
97
- function A(r) {
98
- return (c) => /* @__PURE__ */ o.createElement(wt, Q({
97
+ function z(r) {
98
+ return (i) => /* @__PURE__ */ o.createElement(Rt, Q({
99
99
  attr: J({}, r.attr)
100
- }, c), Te(r.child));
100
+ }, i), Ne(r.child));
101
101
  }
102
- function wt(r) {
103
- var c = (d) => {
102
+ function Rt(r) {
103
+ var i = (d) => {
104
104
  var {
105
105
  attr: u,
106
- size: m,
107
- title: y
108
- } = r, S = ht(r, ft), b = m || d.size || "1em", E;
109
- return d.className && (E = d.className), r.className && (E = (E ? E + " " : "") + r.className), /* @__PURE__ */ o.createElement("svg", Q({
106
+ size: f,
107
+ title: w
108
+ } = r, R = yt(r, vt), b = f || d.size || "1em", p;
109
+ return d.className && (p = d.className), r.className && (p = (p ? p + " " : "") + r.className), /* @__PURE__ */ o.createElement("svg", Q({
110
110
  stroke: "currentColor",
111
111
  fill: "currentColor",
112
112
  strokeWidth: "0"
113
- }, d.attr, u, S, {
114
- className: E,
113
+ }, d.attr, u, R, {
114
+ className: p,
115
115
  style: J(J({
116
116
  color: r.color || d.color
117
117
  }, d.style), r.style),
118
118
  height: b,
119
119
  width: b,
120
120
  xmlns: "http://www.w3.org/2000/svg"
121
- }), y && /* @__PURE__ */ o.createElement("title", null, y), r.children);
121
+ }), w && /* @__PURE__ */ o.createElement("title", null, w), r.children);
122
122
  };
123
- return Me !== void 0 ? /* @__PURE__ */ o.createElement(Me.Consumer, null, (d) => c(d)) : c(ke);
124
- }
125
- function Ct(r) {
126
- return A({ 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 bt(r) {
129
- return A({ 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);
130
- }
131
- function Rt(r) {
132
- return A({ 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);
123
+ return Se !== void 0 ? /* @__PURE__ */ o.createElement(Se.Consumer, null, (d) => i(d)) : i(ke);
133
124
  }
134
125
  function xt(r) {
135
- return A({ 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);
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);
136
127
  }
137
128
  function Lt(r) {
138
- return A({ 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);
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);
139
130
  }
140
131
  function St(r) {
141
- return A({ 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);
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);
142
133
  }
143
134
  function Mt(r) {
144
- return A({ 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);
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);
145
136
  }
146
137
  function At(r) {
147
- return A({ 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);
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);
148
139
  }
149
140
  function zt(r) {
150
- return A({ 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);
151
- }
152
- function Nt(r) {
153
- return A({ 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);
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);
154
142
  }
155
143
  function kt(r) {
156
- return A({ 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);
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);
145
+ }
146
+ function Nt(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);
157
148
  }
158
149
  function Tt(r) {
159
- return A({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M464 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V80c0-26.51-21.49-48-48-48zM224 416H64v-96h160v96zm0-160H64v-96h160v96zm224 160H288v-96h160v96zm0-160H288v-96h160v96z" }, child: [] }] })(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);
160
151
  }
161
152
  function Dt(r) {
162
- return A({ 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);
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);
163
154
  }
164
155
  function Ot(r) {
165
- return A({ 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);
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);
166
157
  }
167
158
  function Ht(r) {
168
- return A({ 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);
159
+ return z({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M464 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V80c0-26.51-21.49-48-48-48zM224 416H64v-96h160v96zm0-160H64v-96h160v96zm224 160H288v-96h160v96zm0-160H288v-96h160v96z" }, child: [] }] })(r);
160
+ }
161
+ function _t(r) {
162
+ 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);
163
+ }
164
+ function jt(r) {
165
+ 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);
169
166
  }
170
- const jt = [
167
+ function Ft(r) {
168
+ 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);
169
+ }
170
+ const Pt = [
171
171
  "😀",
172
172
  "😁",
173
173
  "😂",
@@ -279,57 +279,57 @@ const jt = [
279
279
  "👏",
280
280
  "🫶",
281
281
  "👐"
282
- ], _t = ({
282
+ ], It = ({
283
283
  exec: r,
284
- saveSelection: c,
284
+ saveSelection: i,
285
285
  handleFileChange: d,
286
286
  handleFontSizeChange: u,
287
- handleFontFamilyChange: m,
287
+ handleFontFamilyChange: f,
288
288
  // insertListBlock,
289
- insertEmoji: y,
290
- handleLink: S,
289
+ insertEmoji: w,
290
+ handleLink: R,
291
291
  removeFormatting: b,
292
- visibleActions: E,
292
+ visibleActions: p,
293
293
  className: O,
294
- style: _
294
+ style: j
295
295
  }) => {
296
- var V, T;
297
- const z = P(null), H = P(null), R = P(null), [G, $] = M(!1), [q, I] = M({
296
+ var U, D;
297
+ const k = P(null), _ = P(null), L = P(null), [K, W] = A(!1), [q, B] = A({
298
298
  x: 0,
299
299
  y: 0
300
300
  });
301
- B(() => {
302
- const f = (w) => {
303
- !w.target.closest(".rte-emoji-popup") && !w.target.closest("button[title='Emoji']") && $(!1);
301
+ I(() => {
302
+ const m = (C) => {
303
+ !C.target.closest(".rte-emoji-popup") && !C.target.closest("button[title='Emoji']") && W(!1);
304
304
  };
305
- return document.addEventListener("mousedown", f), () => document.removeEventListener("mousedown", f);
305
+ return document.addEventListener("mousedown", m), () => document.removeEventListener("mousedown", m);
306
306
  }, []);
307
- const F = (f) => {
308
- var j;
309
- f.preventDefault();
310
- const w = f.currentTarget.dataset.command;
311
- if (w)
312
- switch (w) {
307
+ const F = (m) => {
308
+ var H;
309
+ m.preventDefault();
310
+ const C = m.currentTarget.dataset.command;
311
+ if (C)
312
+ switch (C) {
313
313
  case "bold":
314
314
  case "italic":
315
315
  case "underline":
316
316
  case "insertUnorderedList":
317
317
  case "insertOrderedList":
318
318
  case "removeFormat":
319
- r(w);
319
+ r(C);
320
320
  break;
321
321
  case "insertImage": {
322
- (j = z.current) == null || j.click();
322
+ (H = k.current) == null || H.click();
323
323
  break;
324
324
  }
325
325
  default:
326
- console.warn("Unknown command:", w);
326
+ console.warn("Unknown command:", C);
327
327
  }
328
- }, ee = (f) => {
329
- r("foreColor", f.target.value);
330
- }, te = (f) => {
331
- r("backColor", f.target.value);
332
- }, [L, k] = M({
328
+ }, G = (m) => {
329
+ r("foreColor", m.target.value);
330
+ }, ee = (m) => {
331
+ r("backColor", m.target.value);
332
+ }, [M, N] = A({
333
333
  bold: !1,
334
334
  italic: !1,
335
335
  underline: !1,
@@ -346,9 +346,9 @@ const jt = [
346
346
  color: !1,
347
347
  highlight: !1
348
348
  });
349
- return B(() => {
350
- const f = () => {
351
- k({
349
+ return I(() => {
350
+ const m = () => {
351
+ N({
352
352
  bold: document.queryCommandState("bold"),
353
353
  italic: document.queryCommandState("italic"),
354
354
  underline: document.queryCommandState("underline"),
@@ -366,117 +366,117 @@ const jt = [
366
366
  highlight: document.queryCommandState("backColor")
367
367
  });
368
368
  };
369
- return document.addEventListener("selectionchange", f), () => document.removeEventListener("selectionchange", f);
369
+ return document.addEventListener("selectionchange", m), () => document.removeEventListener("selectionchange", m);
370
370
  }, []), /* @__PURE__ */ o.createElement("div", {
371
371
  className: `rte-toolbar ${O || ""}`,
372
- style: _
373
- }, E.bold && /* @__PURE__ */ o.createElement("button", {
372
+ style: j
373
+ }, p.bold && /* @__PURE__ */ o.createElement("button", {
374
374
  "data-command": "bold",
375
375
  title: "Bold",
376
376
  onMouseDown: F,
377
- className: L.bold ? "rte-active" : ""
378
- }, /* @__PURE__ */ o.createElement(St, null)), E.italic && /* @__PURE__ */ o.createElement("button", {
377
+ className: M.bold ? "rte-active" : ""
378
+ }, /* @__PURE__ */ o.createElement(zt, null)), p.italic && /* @__PURE__ */ o.createElement("button", {
379
379
  "data-command": "italic",
380
380
  title: "Italic",
381
381
  onMouseDown: F,
382
- className: L.italic ? "rte-active" : ""
383
- }, /* @__PURE__ */ o.createElement(At, null)), E.underline && /* @__PURE__ */ o.createElement("button", {
382
+ className: M.italic ? "rte-active" : ""
383
+ }, /* @__PURE__ */ o.createElement(Nt, null)), p.underline && /* @__PURE__ */ o.createElement("button", {
384
384
  "data-command": "underline",
385
385
  title: "Underline",
386
386
  onMouseDown: F,
387
- className: L.underline ? "rte-active" : ""
388
- }, /* @__PURE__ */ o.createElement(Dt, null)), E.unorderedList && /* @__PURE__ */ o.createElement("button", {
387
+ className: M.underline ? "rte-active" : ""
388
+ }, /* @__PURE__ */ o.createElement(_t, null)), p.unorderedList && /* @__PURE__ */ o.createElement("button", {
389
389
  "data-command": "insertUnorderedList",
390
390
  onMouseDown: F,
391
391
  title: "UnorderedList",
392
- className: L.unorderedList ? "rte-active" : ""
393
- }, /* @__PURE__ */ o.createElement(Nt, null)), E.orderedList && /* @__PURE__ */ o.createElement("button", {
392
+ className: M.unorderedList ? "rte-active" : ""
393
+ }, /* @__PURE__ */ o.createElement(Dt, null)), p.orderedList && /* @__PURE__ */ o.createElement("button", {
394
394
  "data-command": "insertOrderedList",
395
395
  title: "OrderedList",
396
396
  onMouseDown: F,
397
- className: L.orderedList ? "rte-active" : ""
398
- }, /* @__PURE__ */ o.createElement(xt, null)), E.link && /* @__PURE__ */ o.createElement("button", {
397
+ className: M.orderedList ? "rte-active" : ""
398
+ }, /* @__PURE__ */ o.createElement(Mt, null)), p.link && /* @__PURE__ */ o.createElement("button", {
399
399
  "data-command": "createLink",
400
400
  title: "Link",
401
- onClick: S,
402
- className: L.link ? "rte-active" : ""
403
- }, /* @__PURE__ */ o.createElement(zt, null)), E.removeFormat && /* @__PURE__ */ o.createElement("button", {
401
+ onClick: R,
402
+ className: M.link ? "rte-active" : ""
403
+ }, /* @__PURE__ */ o.createElement(Tt, null)), p.removeFormat && /* @__PURE__ */ o.createElement("button", {
404
404
  "data-command": "Remove format",
405
405
  title: "removeFormat",
406
- onMouseDown: (f) => {
407
- f.preventDefault(), c(), b();
406
+ onMouseDown: (m) => {
407
+ m.preventDefault(), i(), b();
408
408
  },
409
- className: L.removeFormat ? "rte-active" : ""
410
- }, /* @__PURE__ */ o.createElement(Ht, null)), E.image && /* @__PURE__ */ o.createElement("button", {
409
+ className: M.removeFormat ? "rte-active" : ""
410
+ }, /* @__PURE__ */ o.createElement(Ft, null)), p.image && /* @__PURE__ */ o.createElement("button", {
411
411
  "data-command": "insertImage",
412
412
  title: "Image",
413
413
  onMouseDown: F,
414
- className: L.image ? "rte-active" : ""
415
- }, /* @__PURE__ */ o.createElement(Rt, null)), /* @__PURE__ */ o.createElement("input", {
414
+ className: M.image ? "rte-active" : ""
415
+ }, /* @__PURE__ */ o.createElement(St, null)), /* @__PURE__ */ o.createElement("input", {
416
416
  type: "file",
417
417
  accept: "image/*",
418
- ref: z,
418
+ ref: k,
419
419
  style: {
420
420
  display: "none"
421
421
  },
422
422
  onChange: d
423
- }), E.emoji && /* @__PURE__ */ o.createElement("div", {
423
+ }), p.emoji && /* @__PURE__ */ o.createElement("div", {
424
424
  style: {
425
425
  position: "relative"
426
426
  }
427
427
  }, /* @__PURE__ */ o.createElement("button", {
428
428
  title: "Emoji",
429
- onMouseDown: (f) => {
430
- f.preventDefault(), c();
431
- const w = f.currentTarget.getBoundingClientRect();
432
- I({
433
- x: w.left,
434
- y: w.bottom + 8
429
+ onMouseDown: (m) => {
430
+ m.preventDefault(), i();
431
+ const C = m.currentTarget.getBoundingClientRect();
432
+ B({
433
+ x: C.left,
434
+ y: C.bottom + 8
435
435
  // small spacing
436
- }), $((j) => !j);
436
+ }), W((H) => !H);
437
437
  },
438
- className: L.emoji ? "rte-active" : ""
439
- }, /* @__PURE__ */ o.createElement(kt, null)), G && /* @__PURE__ */ gt(/* @__PURE__ */ o.createElement("div", {
438
+ className: M.emoji ? "rte-active" : ""
439
+ }, /* @__PURE__ */ o.createElement(Ot, null)), K && /* @__PURE__ */ pt(/* @__PURE__ */ o.createElement("div", {
440
440
  className: "rte-emoji-popup",
441
441
  style: {
442
442
  top: q.y,
443
443
  left: q.x
444
444
  }
445
- }, jt.map((f, w) => /* @__PURE__ */ o.createElement("span", {
446
- key: w,
445
+ }, Pt.map((m, C) => /* @__PURE__ */ o.createElement("span", {
446
+ key: C,
447
447
  style: {
448
448
  fontSize: "20px",
449
449
  cursor: "pointer",
450
450
  textAlign: "center"
451
451
  },
452
- onMouseDown: (j) => {
453
- j.preventDefault(), y(f), $(!1);
452
+ onMouseDown: (H) => {
453
+ H.preventDefault(), w(m), W(!1);
454
454
  }
455
- }, f))), document.body)), E.color && /* @__PURE__ */ o.createElement("div", {
455
+ }, m))), document.body)), p.color && /* @__PURE__ */ o.createElement("div", {
456
456
  style: {
457
457
  position: "relative"
458
458
  }
459
459
  }, /* @__PURE__ */ o.createElement("button", {
460
460
  title: "Text Color",
461
- onMouseDown: (f) => {
462
- var w;
463
- f.preventDefault(), c(), (w = H.current) == null || w.click();
461
+ onMouseDown: (m) => {
462
+ var C;
463
+ m.preventDefault(), i(), (C = _.current) == null || C.click();
464
464
  },
465
465
  style: {
466
466
  display: "flex",
467
467
  alignItems: "center",
468
468
  justifyContent: "center",
469
- color: ((V = H.current) == null ? void 0 : V.value) || "#000",
469
+ color: ((U = _.current) == null ? void 0 : U.value) || "#000",
470
470
  fontSize: "18px"
471
471
  },
472
- className: L.color ? "rte-active" : ""
473
- }, /* @__PURE__ */ o.createElement(Ot, null)), /* @__PURE__ */ o.createElement("input", {
474
- ref: H,
472
+ className: M.color ? "rte-active" : ""
473
+ }, /* @__PURE__ */ o.createElement(jt, null)), /* @__PURE__ */ o.createElement("input", {
474
+ ref: _,
475
475
  type: "color",
476
476
  defaultValue: "#000000",
477
- onChange: (f) => {
478
- var w;
479
- ee(f), ((w = f.target.parentElement) == null ? void 0 : w.querySelector("button")).style.color = f.target.value;
477
+ onChange: (m) => {
478
+ var C;
479
+ G(m), ((C = m.target.parentElement) == null ? void 0 : C.querySelector("button")).style.color = m.target.value;
480
480
  },
481
481
  style: {
482
482
  position: "absolute",
@@ -485,30 +485,30 @@ const jt = [
485
485
  height: 0,
486
486
  pointerEvents: "none"
487
487
  }
488
- })), E.highlight && /* @__PURE__ */ o.createElement("div", {
488
+ })), p.highlight && /* @__PURE__ */ o.createElement("div", {
489
489
  style: {
490
490
  position: "relative"
491
491
  }
492
492
  }, /* @__PURE__ */ o.createElement("button", {
493
493
  title: "Highlight",
494
- onMouseDown: (f) => {
495
- var w;
496
- f.preventDefault(), c(), (w = R.current) == null || w.click();
494
+ onMouseDown: (m) => {
495
+ var C;
496
+ m.preventDefault(), i(), (C = L.current) == null || C.click();
497
497
  },
498
498
  style: {
499
499
  display: "flex",
500
500
  alignItems: "center",
501
501
  justifyContent: "center",
502
- color: ((T = R.current) == null ? void 0 : T.value) || "#000",
502
+ color: ((D = L.current) == null ? void 0 : D.value) || "#000",
503
503
  fontSize: "18px"
504
504
  },
505
- className: L.highlight ? "rte-active" : ""
506
- }, /* @__PURE__ */ o.createElement(Mt, null)), /* @__PURE__ */ o.createElement("input", {
507
- ref: R,
505
+ className: M.highlight ? "rte-active" : ""
506
+ }, /* @__PURE__ */ o.createElement(kt, null)), /* @__PURE__ */ o.createElement("input", {
507
+ ref: L,
508
508
  type: "color",
509
- onChange: (f) => {
510
- var w;
511
- te(f), ((w = f.target.parentElement) == null ? void 0 : w.querySelector("button")).style.color = f.target.value;
509
+ onChange: (m) => {
510
+ var C;
511
+ ee(m), ((C = m.target.parentElement) == null ? void 0 : C.querySelector("button")).style.color = m.target.value;
512
512
  },
513
513
  defaultValue: "#000000",
514
514
  style: {
@@ -518,31 +518,31 @@ const jt = [
518
518
  height: 0,
519
519
  pointerEvents: "none"
520
520
  }
521
- })), E.align && /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("button", {
521
+ })), p.align && /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("button", {
522
522
  title: "Align Left",
523
- onMouseDown: (f) => f.preventDefault(),
523
+ onMouseDown: (m) => m.preventDefault(),
524
524
  onClick: () => r("justifyLeft"),
525
- className: L.alignLeft ? "rte-active" : ""
526
- }, /* @__PURE__ */ o.createElement(Lt, null)), /* @__PURE__ */ o.createElement("button", {
525
+ className: M.alignLeft ? "rte-active" : ""
526
+ }, /* @__PURE__ */ o.createElement(At, null)), /* @__PURE__ */ o.createElement("button", {
527
527
  title: "Align Center",
528
- onMouseDown: (f) => f.preventDefault(),
528
+ onMouseDown: (m) => m.preventDefault(),
529
529
  onClick: () => r("justifyCenter"),
530
- className: L.alignCenter ? "rte-active" : ""
531
- }, /* @__PURE__ */ o.createElement(Ct, null)), /* @__PURE__ */ o.createElement("button", {
530
+ className: M.alignCenter ? "rte-active" : ""
531
+ }, /* @__PURE__ */ o.createElement(xt, null)), /* @__PURE__ */ o.createElement("button", {
532
532
  title: "Align Right",
533
- onMouseDown: (f) => f.preventDefault(),
533
+ onMouseDown: (m) => m.preventDefault(),
534
534
  onClick: () => r("justifyRight"),
535
- className: L.alignRight ? "rte-active" : ""
536
- }, /* @__PURE__ */ o.createElement(bt, null))), E.table && /* @__PURE__ */ o.createElement("button", {
535
+ className: M.alignRight ? "rte-active" : ""
536
+ }, /* @__PURE__ */ o.createElement(Lt, null))), p.table && /* @__PURE__ */ o.createElement("button", {
537
537
  title: "Insert Table",
538
- onMouseDown: (f) => f.preventDefault(),
538
+ onMouseDown: (m) => m.preventDefault(),
539
539
  onClick: () => r("insertTable"),
540
- className: L.table ? "rte-active" : ""
541
- }, /* @__PURE__ */ o.createElement(Tt, null)), E.fontFamily && /* @__PURE__ */ o.createElement("select", {
540
+ className: M.table ? "rte-active" : ""
541
+ }, /* @__PURE__ */ o.createElement(Ht, null)), p.fontFamily && /* @__PURE__ */ o.createElement("select", {
542
542
  className: "rte-dropdown",
543
543
  defaultValue: "",
544
- onMouseDown: () => c(),
545
- onChange: m
544
+ onMouseDown: () => i(),
545
+ onChange: f
546
546
  }, /* @__PURE__ */ o.createElement("option", {
547
547
  value: "",
548
548
  disabled: !0
@@ -556,62 +556,59 @@ const jt = [
556
556
  value: "Courier New"
557
557
  }, "Courier New"), /* @__PURE__ */ o.createElement("option", {
558
558
  value: "Verdana"
559
- }, "Verdana")), E.fontSize && /* @__PURE__ */ o.createElement("select", {
560
- className: "rte-dropdown",
559
+ }, "Verdana")), p.fontSize && /* @__PURE__ */ o.createElement("select", {
560
+ className: "rte-dropdown rte-fontsize-dropdown",
561
561
  defaultValue: "",
562
- onMouseDown: () => c(),
562
+ onMouseDown: () => i(),
563
563
  onChange: u
564
564
  }, /* @__PURE__ */ o.createElement("option", {
565
565
  value: "",
566
566
  disabled: !0
567
- }, "Font Size"), /* @__PURE__ */ o.createElement("option", {
568
- value: "2"
569
- }, "Small "), /* @__PURE__ */ o.createElement("option", {
570
- value: "3"
571
- }, "Normal"), /* @__PURE__ */ o.createElement("option", {
572
- value: "4"
573
- }, "Medium"), /* @__PURE__ */ o.createElement("option", {
574
- value: "5"
575
- }, "Large")));
576
- }, Ft = ({
567
+ }, "Font Size"), Array.from({
568
+ length: 16
569
+ }, (m, C) => 10 + C).map((m) => /* @__PURE__ */ o.createElement("option", {
570
+ key: m,
571
+ value: m
572
+ }, m, "px"))));
573
+ }, Bt = ({
577
574
  show: r,
578
- position: c,
575
+ position: i,
579
576
  filtered: d,
580
577
  insertMention: u,
581
- onClose: m,
582
- query: y
578
+ onClose: f,
579
+ query: w
583
580
  }) => {
584
- const S = P(null);
585
- return B(() => {
586
- const b = (E) => {
587
- S.current && !S.current.contains(E.target) && m();
581
+ const R = P(null);
582
+ return I(() => {
583
+ const b = (p) => {
584
+ R.current && !R.current.contains(p.target) && f();
588
585
  };
589
586
  return r && document.addEventListener("mousedown", b), () => {
590
587
  document.removeEventListener("mousedown", b);
591
588
  };
592
- }, [r, m]), r ? /* @__PURE__ */ o.createElement("ul", {
593
- ref: S,
589
+ }, [r, f]), r ? /* @__PURE__ */ o.createElement("ul", {
590
+ ref: R,
594
591
  className: "rte-popup",
595
592
  style: {
596
- top: c.y,
597
- left: c.x
593
+ top: i.y,
594
+ left: i.x
598
595
  }
599
596
  }, d.length > 0 ? d.map(({
600
597
  name: b,
601
- value: E
598
+ value: p
602
599
  }) => {
603
- const O = b.toLowerCase(), _ = y.toLowerCase(), z = O.indexOf(_);
604
- let H = b;
605
- if (z !== -1 && y.length > 0) {
606
- const R = z + y.length;
607
- H = b.substring(0, z) + `<span class="rte-highlight">${b.substring(z, R)}</span>` + b.substring(R);
600
+ const O = b.toLowerCase(), j = w.toLowerCase(), k = O.indexOf(j);
601
+ let _ = b;
602
+ if (k !== -1 && w.length > 0) {
603
+ const L = k + w.length;
604
+ _ = b.substring(0, k) + `<span class="rte-highlight">${b.substring(k, L)}</span>` + b.substring(L);
608
605
  }
609
606
  return /* @__PURE__ */ o.createElement("li", {
610
- key: E,
611
- onMouseDown: (R) => {
612
- R.preventDefault(), u({
607
+ key: p,
608
+ onMouseDown: (L) => {
609
+ L.preventDefault(), u({
613
610
  name: b,
614
- value: E
611
+ value: p
615
612
  });
616
613
  },
617
614
  style: {
@@ -620,10 +617,10 @@ const jt = [
620
617
  fontSize: "14px"
621
618
  },
622
619
  dangerouslySetInnerHTML: {
623
- __html: H
620
+ __html: _
624
621
  },
625
- onMouseEnter: (R) => R.currentTarget.style.background = "#f0f0f0",
626
- onMouseLeave: (R) => R.currentTarget.style.background = "#fff"
622
+ onMouseEnter: (L) => L.currentTarget.style.background = "#f0f0f0",
623
+ onMouseLeave: (L) => L.currentTarget.style.background = "#fff"
627
624
  });
628
625
  }) : /* @__PURE__ */ o.createElement("li", {
629
626
  style: {
@@ -632,28 +629,28 @@ const jt = [
632
629
  }
633
630
  }, "No matches")) : null;
634
631
  };
635
- function ze(r) {
636
- return A({ 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);
632
+ function Ae(r) {
633
+ 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);
637
634
  }
638
635
  function Z(r) {
639
- return A({ 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);
636
+ 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);
640
637
  }
641
- const Pt = ({
638
+ const qt = ({
642
639
  visible: r,
643
- x: c,
640
+ x: i,
644
641
  y: d,
645
642
  onAction: u,
646
- onClose: m
643
+ onClose: f
647
644
  }) => {
648
645
  if (!r) return null;
649
- const y = {
646
+ const w = {
650
647
  top: d,
651
- left: c
648
+ left: i
652
649
  };
653
650
  return /* @__PURE__ */ o.createElement("div", {
654
- style: y,
651
+ style: w,
655
652
  className: "rte-table-menu",
656
- onMouseLeave: m
653
+ onMouseLeave: f
657
654
  }, /* @__PURE__ */ o.createElement("button", {
658
655
  onClick: () => u("insertRowAbove")
659
656
  }, /* @__PURE__ */ o.createElement(Z, null), " Insert row above"), /* @__PURE__ */ o.createElement("button", {
@@ -664,46 +661,49 @@ const Pt = ({
664
661
  onClick: () => u("insertColRight")
665
662
  }, /* @__PURE__ */ o.createElement(Z, null), " Insert col right"), /* @__PURE__ */ o.createElement("button", {
666
663
  onClick: () => u("deleteRow")
667
- }, /* @__PURE__ */ o.createElement(ze, null), " Delete row"), /* @__PURE__ */ o.createElement("button", {
664
+ }, /* @__PURE__ */ o.createElement(Ae, null), " Delete row"), /* @__PURE__ */ o.createElement("button", {
668
665
  onClick: () => u("deleteCol")
669
- }, /* @__PURE__ */ o.createElement(ze, null), " Delete column"));
670
- }, Bt = ({
666
+ }, /* @__PURE__ */ o.createElement(Ae, null), " Delete column"));
667
+ }, Ut = ({
671
668
  html: r,
672
- className: c,
669
+ className: i,
673
670
  style: d
674
671
  }) => {
675
- const u = (y) => {
676
- const S = y.target;
677
- if (S.tagName === "A") {
678
- y.preventDefault();
679
- const b = S.href;
672
+ const u = (w) => {
673
+ const R = w.target;
674
+ if (R.tagName === "A") {
675
+ w.preventDefault();
676
+ const b = R.href;
680
677
  b && window.open(b, "_blank", "noopener,noreferrer");
681
678
  }
682
- }, m = (y) => y.replace(/{{\s*(.*?)\s*}}/g, "$1");
679
+ }, f = (w) => {
680
+ let R = w.replace(/{{\s*(.*?)\s*}}/g, (b, p) => `<span style="color: blue">${p}</span>`);
681
+ return R = R.replace(/#arrayData/g, ""), R = R.replace(/\/arrayData/g, ""), R;
682
+ };
683
683
  return /* @__PURE__ */ o.createElement("div", {
684
- className: `rte-preview ${c || ""}`,
684
+ className: `rte-preview ${i || ""}`,
685
685
  style: d,
686
686
  onClick: u,
687
687
  dangerouslySetInnerHTML: {
688
- __html: m(r)
688
+ __html: f(r)
689
689
  }
690
690
  });
691
- }, It = ({
691
+ }, Vt = ({
692
692
  visible: r,
693
- linkData: c,
693
+ linkData: i,
694
694
  onClose: d,
695
695
  onInsert: u
696
696
  }) => {
697
- const [m, y] = M(""), [S, b] = M(""), [E, O] = M(""), [_, z] = M("_self");
698
- if (B(() => {
699
- r ? (y(c.url || ""), b(c.text || ""), O(c.title || ""), z(c.target || "_self")) : (y(""), b(""), O(""), z("_self"));
700
- }, [r, c]), !r) return null;
701
- const H = () => {
697
+ const [f, w] = A(""), [R, b] = A(""), [p, O] = A(""), [j, k] = A("_self");
698
+ if (I(() => {
699
+ r ? (w(i.url || ""), b(i.text || ""), O(i.title || ""), k(i.target || "_self")) : (w(""), b(""), O(""), k("_self"));
700
+ }, [r, i]), !r) return null;
701
+ const _ = () => {
702
702
  u({
703
- url: m,
704
- text: S,
705
- title: E,
706
- target: _
703
+ url: f,
704
+ text: R,
705
+ title: p,
706
+ target: j
707
707
  });
708
708
  };
709
709
  return /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("div", {
@@ -713,28 +713,28 @@ const Pt = ({
713
713
  className: "rte-link-modal"
714
714
  }, /* @__PURE__ */ o.createElement("h4", {
715
715
  className: "rte-link-modal__title"
716
- }, m ? "Edit Link" : "Insert Link"), /* @__PURE__ */ o.createElement("input", {
716
+ }, f ? "Edit Link" : "Insert Link"), /* @__PURE__ */ o.createElement("input", {
717
717
  type: "text",
718
718
  className: "rte-link-modal__input",
719
719
  placeholder: "URL",
720
- value: m,
721
- onChange: (R) => y(R.target.value)
720
+ value: f,
721
+ onChange: (L) => w(L.target.value)
722
722
  }), /* @__PURE__ */ o.createElement("input", {
723
723
  type: "text",
724
724
  className: "rte-link-modal__input",
725
725
  placeholder: "Text to Display",
726
- value: S,
727
- onChange: (R) => b(R.target.value)
726
+ value: R,
727
+ onChange: (L) => b(L.target.value)
728
728
  }), /* @__PURE__ */ o.createElement("input", {
729
729
  type: "text",
730
730
  className: "rte-link-modal__input",
731
731
  placeholder: "Title",
732
- value: E,
733
- onChange: (R) => O(R.target.value)
732
+ value: p,
733
+ onChange: (L) => O(L.target.value)
734
734
  }), /* @__PURE__ */ o.createElement("select", {
735
735
  className: "rte-link-modal__select",
736
- value: _,
737
- onChange: (R) => z(R.target.value)
736
+ value: j,
737
+ onChange: (L) => k(L.target.value)
738
738
  }, /* @__PURE__ */ o.createElement("option", {
739
739
  value: "_self"
740
740
  }, "Same tab"), /* @__PURE__ */ o.createElement("option", {
@@ -746,15 +746,15 @@ const Pt = ({
746
746
  onClick: d
747
747
  }, "Cancel"), /* @__PURE__ */ o.createElement("button", {
748
748
  className: "rte-link-modal__btn rte-link-modal__btn--ok",
749
- onClick: H
749
+ onClick: _
750
750
  }, "OK"))));
751
751
  };
752
- function Ne(r) {
753
- return Array.from(new Map(r.map((c) => [c.value, c])).values());
752
+ function ze(r) {
753
+ return Array.from(new Map(r.map((i) => [i.value, i])).values());
754
754
  }
755
- const $t = ({
755
+ const Xt = ({
756
756
  atSuggestions: r = [],
757
- showOutput: c = !1,
757
+ showOutput: i = !1,
758
758
  showPreview: d = !1,
759
759
  toolbarConfig: u = {
760
760
  link: !1,
@@ -766,32 +766,32 @@ const $t = ({
766
766
  fontSize: !1,
767
767
  highlight: !1
768
768
  },
769
- classNames: m = {},
770
- styles: y = {},
771
- handleGetHtml: S = () => {
769
+ classNames: f = {},
770
+ styles: w = {},
771
+ handleGetHtml: R = () => {
772
772
  },
773
773
  onChange: b = () => {
774
774
  },
775
- value: E,
775
+ value: p,
776
776
  onMentionSelect: O = () => {
777
777
  },
778
- handleAddAttributes: _ = () => {
778
+ handleAddAttributes: j = () => {
779
779
  }
780
780
  }) => {
781
- var pe, ve, Ee, ye, we, Ce, be, Re;
782
- const z = P(null), [H, R] = M(E != null && E.length ? E : " "), [G, $] = M(""), [q, I] = M(!1), [F, ee] = M({
781
+ var he, pe, ve, ye, Ee, we, Ce, be;
782
+ const k = P(null), [_, L] = A(p != null && p.length ? p : " "), [K, W] = A(""), [q, B] = A(!1), [F, G] = A({
783
783
  x: 0,
784
784
  y: 0
785
- }), [te, L] = M([]), k = P(null), V = P(null), [T, f] = M({
785
+ }), [ee, M] = A([]), N = P(null), U = P(null), [D, m] = A({
786
786
  visible: !1,
787
787
  x: 0,
788
788
  y: 0
789
- }), [w, j] = M(!1), K = P(null), [De, le] = M({
789
+ }), [C, H] = A(!1), X = P(null), [Te, le] = A({
790
790
  url: "",
791
791
  text: "",
792
792
  title: "",
793
793
  target: "_self"
794
- }), Oe = {
794
+ }), De = {
795
795
  bold: !0,
796
796
  italic: !0,
797
797
  underline: !0,
@@ -799,46 +799,58 @@ const $t = ({
799
799
  unorderedList: !0,
800
800
  orderedList: !0,
801
801
  align: !0,
802
- link: (pe = u.link) != null ? pe : !1,
803
- image: (ve = u.image) != null ? ve : !1,
804
- emoji: (Ee = u.emoji) != null ? Ee : !1,
802
+ link: (he = u.link) != null ? he : !1,
803
+ image: (pe = u.image) != null ? pe : !1,
804
+ emoji: (ve = u.emoji) != null ? ve : !1,
805
805
  table: (ye = u.table) != null ? ye : !1,
806
- color: (we = u.color) != null ? we : !1,
807
- fontFamily: (Ce = u.fontFamily) != null ? Ce : !1,
808
- fontSize: (be = u.fontSize) != null ? be : !1,
809
- highlight: (Re = u.fontSize) != null ? Re : !1
810
- }, [He, ce] = M(""), [ie, ne] = M([]), D = () => z.current, x = () => {
811
- const e = he();
812
- $(e), S == null || S(e);
813
- const t = at(e);
814
- b(t);
815
- const n = Ve(), a = Ne(n);
816
- JSON.stringify(a) !== JSON.stringify(ie) && (ne(a), O(a));
817
- }, U = () => {
806
+ color: (Ee = u.color) != null ? Ee : !1,
807
+ fontFamily: (we = u.fontFamily) != null ? we : !1,
808
+ fontSize: (Ce = u.fontSize) != null ? Ce : !1,
809
+ highlight: (be = u.fontSize) != null ? be : !1
810
+ }, [Oe, ce] = A(""), [ie, te] = A([]), T = () => k.current, S = () => {
811
+ const e = He(), t = /^<div[^>]*style=["'][^"']*font-size\s*:\s*\d+px[^"']*["'][^>]*>/.test(e.trim());
812
+ let n = e;
813
+ t || (n = `<div style="font-size:12px">${e}</div>`), W(n), R == null || R(n);
814
+ const a = ot(e);
815
+ b(a);
816
+ const s = $e(), l = ze(s);
817
+ JSON.stringify(l) !== JSON.stringify(ie) && (te(l), O(l));
818
+ }, He = () => {
819
+ const e = T();
820
+ if (!e) return _;
821
+ const t = e.cloneNode(!0);
822
+ t.querySelectorAll("table div").forEach((a) => a.remove()), t.querySelectorAll(".rte-cell-highlight").forEach((a) => a.classList.remove("rte-cell-highlight"));
823
+ let n = t.innerHTML;
824
+ return n = _e(n), n;
825
+ }, _e = (e) => e.replace(/<tbody[^>]*>/g, "<tbody>{{#arrayData}}").replace(/<\/tbody>/g, "{{/arrayData}}</tbody>"), V = () => {
818
826
  const e = window.getSelection();
819
827
  if (!e || e.rangeCount === 0) return;
820
828
  const t = document.getElementById("rte-editor-body");
821
829
  if (!t) return;
822
830
  const n = e.getRangeAt(0);
823
- t.contains(n.startContainer) && (k.current = n.cloneRange());
824
- }, W = () => {
831
+ t.contains(n.startContainer) && (N.current = n.cloneRange());
832
+ }, $ = () => {
825
833
  const e = window.getSelection();
826
- !e || !k.current || (e.removeAllRanges(), e.addRange(k.current));
834
+ !e || !N.current || (e.removeAllRanges(), e.addRange(N.current));
827
835
  }, se = (e, t) => {
828
836
  const n = window.getSelection();
829
- n && n.rangeCount > 0 && (k.current = n.getRangeAt(0)), W(), document.execCommand(e, !1, t), x();
837
+ n && n.rangeCount > 0 && (N.current = n.getRangeAt(0)), $(), document.execCommand(e, !1, t), S();
830
838
  };
831
- B(() => {
832
- const e = D();
833
- e && !e.innerHTML && (e.innerHTML = H), x();
834
- }, []), B(() => () => {
839
+ I(() => {
840
+ const e = T();
841
+ if (!e || !p) return;
842
+ const t = je(p);
843
+ e.innerHTML = t, S();
844
+ }, []);
845
+ const je = (e) => e.replace(/<span[^>]*data-hidden-table-start[^>]*>.*?<\/span>/g, "").replace(/<span[^>]*data-hidden-table-end[^>]*>.*?<\/span>/g, "").replace(/{{#arrayData}}/g, "").replace(/{{\/arrayData}}/g, "");
846
+ I(() => () => {
835
847
  document.removeEventListener("mousemove", null), document.removeEventListener("mouseup", null);
836
- }, []), B(() => {
837
- _ && _((e) => {
838
- qe(e);
848
+ }, []), I(() => {
849
+ j && j((e) => {
850
+ Ve(e);
839
851
  });
840
- }, []), B(() => {
841
- const e = D();
852
+ }, []), I(() => {
853
+ const e = T();
842
854
  if (!e) return;
843
855
  e.querySelectorAll("table").forEach((n) => {
844
856
  ge(n), n.querySelectorAll("th, td").forEach((s) => Y(s));
@@ -848,18 +860,18 @@ const $t = ({
848
860
  for (; e && e.nodeName !== "LI"; )
849
861
  e = e.parentNode;
850
862
  return e;
851
- }, je = (e) => {
863
+ }, Fe = (e) => {
852
864
  let t = 0, n = e.parentElement;
853
865
  for (; n; )
854
866
  (n.tagName === "UL" || n.tagName === "OL") && t++, n = n.parentElement;
855
867
  return t;
856
- }, _e = (e) => {
857
- const t = e.querySelector("li"), n = t ? je(t) : 1;
868
+ }, Pe = (e) => {
869
+ const t = e.querySelector("li"), n = t ? Fe(t) : 1;
858
870
  if (e.querySelector("[data-hidden-array-start]")) return;
859
871
  const a = `{{#arrayData${n > 1 ? n : ""}}}`, s = `{{/arrayData${n > 1 ? n : ""}}}`, l = document.createElement("span");
860
872
  l.textContent = a, l.style.display = "none", l.setAttribute("data-hidden-array-start", "true"), e.insertBefore(l, e.firstChild);
861
- const i = document.createElement("span");
862
- i.textContent = s, i.style.display = "none", i.setAttribute("data-hidden-array-end", "true"), e.appendChild(i);
873
+ const c = document.createElement("span");
874
+ c.textContent = s, c.style.display = "none", c.setAttribute("data-hidden-array-end", "true"), e.appendChild(c);
863
875
  }, ue = (e) => {
864
876
  var v;
865
877
  const t = window.getSelection();
@@ -867,28 +879,28 @@ const $t = ({
867
879
  const n = t.getRangeAt(0), a = de(n.startContainer);
868
880
  let s, l;
869
881
  if (a) {
870
- let g = a.querySelector(e);
871
- g || (g = document.createElement(e), g.style.margin = "0", g.style.paddingLeft = "20px", a.appendChild(g)), l = g, s = document.createElement("li"), s.textContent = "​", l.appendChild(s);
882
+ let h = a.querySelector(e);
883
+ h || (h = document.createElement(e), h.style.margin = "0", h.style.paddingLeft = "20px", a.appendChild(h)), l = h, s = document.createElement("li"), s.textContent = "​", l.appendChild(s);
872
884
  } else {
873
885
  document.execCommand(e === "ul" ? "insertUnorderedList" : "insertOrderedList");
874
- const g = D();
875
- if (l = g == null ? void 0 : g.querySelector(`${e}:last-child`), !l) return;
886
+ const h = T();
887
+ if (l = h == null ? void 0 : h.querySelector(`${e}:last-child`), !l) return;
876
888
  s = l.querySelector("li:last-child");
877
889
  }
878
- _e(l);
879
- const i = document.createRange();
880
- i.setStart(s, 0), i.collapse(!0), t.removeAllRanges(), t.addRange(i), (v = D()) == null || v.focus(), x();
881
- }, X = (e, t) => {
882
- e === "insertOrderedList" ? ue("ol") : e === "insertUnorderedList" ? ue("ul") : e.startsWith("justify") ? lt(e) : se(e, t), e === "insertTable" && Ye();
883
- }, Fe = (e) => {
890
+ Pe(l);
891
+ const c = document.createRange();
892
+ c.setStart(s, 0), c.collapse(!0), t.removeAllRanges(), t.addRange(c), (v = T()) == null || v.focus(), S();
893
+ }, ne = (e, t) => {
894
+ e === "insertOrderedList" ? ue("ol") : e === "insertUnorderedList" ? ue("ul") : e.startsWith("justify") ? ct(e) : se(e, t), e === "insertTable" && Qe();
895
+ }, Ie = (e) => {
884
896
  const t = document.createElement("span");
885
897
  t.textContent = "​", e.insertNode(t), e.setStartAfter(t), e.collapse(!0);
886
898
  const n = t.getBoundingClientRect();
887
- t.remove(), ee({
899
+ t.remove(), G({
888
900
  x: n.left,
889
901
  y: n.bottom + window.scrollY
890
- }), L(r || []), I(!0), V.current = e.cloneRange();
891
- }, Pe = () => {
902
+ }), M(r || []), B(!0), U.current = e.cloneRange();
903
+ }, Be = () => {
892
904
  const e = window.getSelection();
893
905
  if (!e || e.rangeCount === 0) return null;
894
906
  const t = e.anchorNode;
@@ -897,106 +909,106 @@ const $t = ({
897
909
  let a = t;
898
910
  for (a.nodeType !== Node.TEXT_NODE && (a.childNodes && a.childNodes[n] ? a = a.childNodes[n] : a = t.previousSibling); a; ) {
899
911
  if (a.nodeType === Node.TEXT_NODE) {
900
- const s = a.textContent || "", l = a === t ? n : s.length, i = s.lastIndexOf("@", l - 1);
901
- if (i !== -1) {
912
+ const s = a.textContent || "", l = a === t ? n : s.length, c = s.lastIndexOf("@", l - 1);
913
+ if (c !== -1) {
902
914
  const v = document.createRange();
903
- return v.setStart(a, i), v.setEnd(a, l), v;
915
+ return v.setStart(a, c), v.setEnd(a, l), v;
904
916
  }
905
917
  }
906
918
  a = a.previousSibling;
907
919
  }
908
920
  return null;
909
- }, Be = (e) => {
921
+ }, qe = (e) => {
910
922
  var l;
911
923
  const t = window.getSelection();
912
924
  if (!t) return;
913
- const n = Pe();
914
- n ? (t.removeAllRanges(), t.addRange(n)) : V.current && (t.removeAllRanges(), t.addRange(V.current));
925
+ const n = Be();
926
+ n ? (t.removeAllRanges(), t.addRange(n)) : U.current && (t.removeAllRanges(), t.addRange(U.current));
915
927
  const a = document.createElement("span");
916
- a.textContent = `{{${e.name}}}`, a.style.display = "inline", a.contentEditable = "false", a.setAttribute("data-mention", e.value || e.name || "");
928
+ a.textContent = `{{${e.name}}}`, a.style.display = "inline", a.setAttribute("data-mention", e.value || e.name || "");
917
929
  try {
918
- const i = t.rangeCount ? t.getRangeAt(0) : null;
919
- if (i)
920
- i.deleteContents(), i.insertNode(a);
930
+ const c = t.rangeCount ? t.getRangeAt(0) : null;
931
+ if (c)
932
+ c.deleteContents(), c.insertNode(a);
921
933
  else {
922
- const p = document.createRange(), h = D();
923
- p.selectNodeContents(h), p.collapse(!1), p.insertNode(a);
934
+ const E = document.createRange(), g = T();
935
+ E.selectNodeContents(g), E.collapse(!1), E.insertNode(a);
924
936
  }
925
937
  const v = document.createTextNode(" ");
926
938
  a.after(v);
927
- const g = document.createRange();
928
- g.setStartAfter(v), g.collapse(!0), t.removeAllRanges(), t.addRange(g);
929
- } catch (i) {
930
- console.error("insertMention error:", i);
939
+ const h = document.createRange();
940
+ h.setStartAfter(v), h.collapse(!0), t.removeAllRanges(), t.addRange(h);
941
+ } catch (c) {
942
+ console.error("insertMention error:", c);
931
943
  }
932
- let s = Ne([...ie, e]);
933
- ne(s), O(s), I(!1), (l = D()) == null || l.focus(), x();
934
- }, Ie = (e) => {
935
- const t = D();
944
+ let s = ze([...ie, e]);
945
+ te(s), O(s), B(!1), (l = T()) == null || l.focus(), S();
946
+ }, Ue = (e) => {
947
+ const t = T();
936
948
  if (!t) return;
937
949
  let n = null;
938
- k.current && t.contains(k.current.startContainer) ? n = k.current.cloneRange() : (n = document.createRange(), n.selectNodeContents(t), n.collapse(!1));
950
+ N.current && t.contains(N.current.startContainer) ? n = N.current.cloneRange() : (n = document.createRange(), n.selectNodeContents(t), n.collapse(!1));
939
951
  const a = window.getSelection();
940
952
  if (!a) return;
941
953
  a.removeAllRanges(), a.addRange(n);
942
954
  const s = document.createElement("span");
943
- s.textContent = `{{${e.name}}}`, s.style.display = "inline", s.contentEditable = "false", s.setAttribute("data-mention", e.value || e.name), n.insertNode(s);
955
+ s.textContent = `{{${e.name}}}`, s.style.display = "inline", s.setAttribute("data-mention", e.value || e.name), n.insertNode(s);
944
956
  const l = document.createTextNode(" ");
945
957
  s.after(l);
946
- const i = document.createRange();
947
- i.setStartAfter(l), i.collapse(!0), a.removeAllRanges(), a.addRange(i), k.current = i.cloneRange(), t.focus();
948
- }, qe = (e) => {
949
- e.forEach((t) => Ie(t)), ne((t) => {
958
+ const c = document.createRange();
959
+ c.setStartAfter(l), c.collapse(!0), a.removeAllRanges(), a.addRange(c), N.current = c.cloneRange(), t.focus();
960
+ }, Ve = (e) => {
961
+ e.forEach((t) => Ue(t)), te((t) => {
950
962
  const n = [...t, ...e], a = Array.from(new Map(n.map((s) => [s.name, s])).values());
951
963
  return O(a), a;
952
- }), x();
953
- }, Ve = () => {
954
- const e = D();
964
+ }), S();
965
+ }, $e = () => {
966
+ const e = T();
955
967
  if (!e) return [];
956
968
  const t = e.querySelectorAll("span[data-mention]"), n = [];
957
969
  return t.forEach((a) => {
958
- const s = a.getAttribute("data-mention") || "", i = (a.textContent || "").match(/{{(.+?)}}/);
959
- i && n.push({
960
- name: i[1],
970
+ const s = a.getAttribute("data-mention") || "", c = (a.textContent || "").match(/{{(.+?)}}/);
971
+ c && n.push({
972
+ name: c[1],
961
973
  value: s
962
974
  });
963
975
  }), n;
964
- }, Ue = (e) => {
976
+ }, We = (e) => {
965
977
  var n, a, s;
966
978
  const t = e.key.toLowerCase();
967
- if ((e.ctrlKey || e.metaKey) && ["b", "i", "u"].includes(t) && (e.preventDefault(), X(t === "b" ? "bold" : t === "i" ? "italic" : t === "u" ? "underline" : "")), e.shiftKey && e.key === "2" && e.preventDefault(), e.key === "Enter") {
968
- const l = window.getSelection(), i = l != null && l.anchorNode ? de(l.anchorNode) : null;
969
- if (!i) return;
970
- if (((n = i.textContent) == null ? void 0 : n.replace(/\u200B/g, "").trim()) === "") {
979
+ if ((e.ctrlKey || e.metaKey) && ["b", "i", "u"].includes(t) && (e.preventDefault(), ne(t === "b" ? "bold" : t === "i" ? "italic" : t === "u" ? "underline" : "")), e.shiftKey && e.key === "2" && e.preventDefault(), e.key === "Enter") {
980
+ const l = window.getSelection(), c = l != null && l.anchorNode ? de(l.anchorNode) : null;
981
+ if (!c) return;
982
+ if (((n = c.textContent) == null ? void 0 : n.replace(/\u200B/g, "").trim()) === "") {
971
983
  e.preventDefault();
972
- const g = i.parentElement, p = g == null ? void 0 : g.closest("li");
973
- if (p) {
974
- g == null || g.removeChild(i);
975
- const h = document.createElement("p");
976
- h.innerHTML = "<br />", (a = p.parentElement) == null || a.insertBefore(h, p.nextSibling);
977
- const C = document.createRange();
978
- C.setStart(h, 0), C.collapse(!0), l == null || l.removeAllRanges(), l == null || l.addRange(C);
984
+ const h = c.parentElement, E = h == null ? void 0 : h.closest("li");
985
+ if (E) {
986
+ h == null || h.removeChild(c);
987
+ const g = document.createElement("p");
988
+ g.innerHTML = "<br />", (a = E.parentElement) == null || a.insertBefore(g, E.nextSibling);
989
+ const y = document.createRange();
990
+ y.setStart(g, 0), y.collapse(!0), l == null || l.removeAllRanges(), l == null || l.addRange(y);
979
991
  } else {
980
- const h = i.closest("ul, ol");
981
- if (h) {
982
- const C = document.createElement("p");
983
- C.innerHTML = "<br />", (s = h.parentElement) == null || s.insertBefore(C, h.nextSibling), h.removeChild(i);
984
- const N = document.createRange();
985
- N.setStart(C, 0), N.collapse(!0), l == null || l.removeAllRanges(), l == null || l.addRange(N);
992
+ const g = c.closest("ul, ol");
993
+ if (g) {
994
+ const y = document.createElement("p");
995
+ y.innerHTML = "<br />", (s = g.parentElement) == null || s.insertBefore(y, g.nextSibling), g.removeChild(c);
996
+ const x = document.createRange();
997
+ x.setStart(y, 0), x.collapse(!0), l == null || l.removeAllRanges(), l == null || l.addRange(x);
986
998
  }
987
999
  }
988
- x();
1000
+ S();
989
1001
  }
990
1002
  }
991
- }, $e = (e) => {
1003
+ }, Ke = (e) => {
992
1004
  if (e.data === "@") {
993
1005
  const n = window.getSelection();
994
1006
  if (!(n != null && n.rangeCount)) return;
995
1007
  const a = n.anchorNode;
996
- if (We(a))
1008
+ if (Xe(a))
997
1009
  return;
998
1010
  setTimeout(() => {
999
- Fe(n.getRangeAt(0)), ce(""), L(r), I(!0);
1011
+ Ie(n.getRangeAt(0)), ce(""), M(r), B(!0);
1000
1012
  }, 0);
1001
1013
  return;
1002
1014
  }
@@ -1004,7 +1016,7 @@ const $t = ({
1004
1016
  setTimeout(() => me(), 0);
1005
1017
  return;
1006
1018
  }
1007
- }, We = (e) => {
1019
+ }, Xe = (e) => {
1008
1020
  if (!e) return !1;
1009
1021
  let t = e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement;
1010
1022
  for (; t; ) {
@@ -1013,75 +1025,81 @@ const $t = ({
1013
1025
  }
1014
1026
  return !1;
1015
1027
  }, me = () => {
1016
- if (x(), !q) return;
1028
+ if (S(), !q) return;
1017
1029
  const e = window.getSelection();
1018
1030
  if (!e || !e.anchorNode) return;
1019
1031
  const n = (e.anchorNode.textContent || "").match(/@([a-zA-Z0-9_]*)$/);
1020
1032
  if (!n) {
1021
- I(!1);
1033
+ B(!1);
1022
1034
  return;
1023
1035
  }
1024
1036
  const a = n[1].toLowerCase();
1025
1037
  ce(a);
1026
1038
  const s = r.filter((l) => l.name.toLowerCase().includes(a));
1027
- L(s);
1028
- }, Ke = (e) => {
1039
+ M(s);
1040
+ }, Ye = (e) => {
1029
1041
  var a;
1030
1042
  const t = (a = e.target.files) == null ? void 0 : a[0];
1031
1043
  if (!t) return;
1032
1044
  const n = new FileReader();
1033
1045
  n.onload = (s) => {
1034
- var N;
1035
- const l = (N = s.target) == null ? void 0 : N.result;
1036
- W();
1037
- const i = window.getSelection();
1038
- let v = i && i.rangeCount ? i.getRangeAt(0) : null;
1039
- const g = document.createElement("img");
1040
- g.src = l, g.alt = t.name || "image", g.className = "rte-inserted-image", g.contentEditable = "true";
1041
- const p = D();
1042
- if (!v || !p) {
1043
- p == null || p.appendChild(g);
1044
- const xe = document.createTextNode(" ");
1045
- p == null || p.appendChild(xe);
1046
+ var x;
1047
+ const l = (x = s.target) == null ? void 0 : x.result;
1048
+ $();
1049
+ const c = window.getSelection();
1050
+ let v = c && c.rangeCount ? c.getRangeAt(0) : null;
1051
+ const h = document.createElement("img");
1052
+ h.src = l, h.alt = t.name || "image", h.className = "rte-inserted-image", h.contentEditable = "true";
1053
+ const E = T();
1054
+ if (!v || !E) {
1055
+ E == null || E.appendChild(h);
1056
+ const Re = document.createTextNode(" ");
1057
+ E == null || E.appendChild(Re);
1046
1058
  const re = document.createRange();
1047
- re.setStartAfter(xe), re.collapse(!0), i == null || i.removeAllRanges(), i == null || i.addRange(re), p == null || p.focus(), x(), e.target.value = "";
1059
+ re.setStartAfter(Re), re.collapse(!0), c == null || c.removeAllRanges(), c == null || c.addRange(re), E == null || E.focus(), S(), e.target.value = "";
1048
1060
  return;
1049
1061
  }
1050
- v.deleteContents(), v.insertNode(g);
1051
- const h = document.createTextNode(" ");
1052
- g.after(h);
1053
- const C = document.createRange();
1054
- C.setStartAfter(h), C.collapse(!0), i.removeAllRanges(), i.addRange(C), p.focus(), x(), e.target.value = "";
1062
+ v.deleteContents(), v.insertNode(h);
1063
+ const g = document.createTextNode(" ");
1064
+ h.after(g);
1065
+ const y = document.createRange();
1066
+ y.setStartAfter(g), y.collapse(!0), c.removeAllRanges(), c.addRange(y), E.focus(), S(), e.target.value = "";
1055
1067
  }, n.readAsDataURL(t);
1056
- }, Xe = (e) => {
1068
+ }, Ze = (e) => {
1057
1069
  var s;
1058
- W();
1070
+ $();
1059
1071
  const t = window.getSelection();
1060
1072
  if (!(t != null && t.rangeCount)) return;
1061
1073
  const n = t.getRangeAt(0), a = document.createTextNode(e);
1062
- n.insertNode(a), n.setStartAfter(a), n.collapse(!0), t.removeAllRanges(), t.addRange(n), (s = D()) == null || s.focus(), x();
1063
- }, Ye = () => {
1064
- W();
1074
+ n.insertNode(a), n.setStartAfter(a), n.collapse(!0), t.removeAllRanges(), t.addRange(n), (s = T()) == null || s.focus(), S();
1075
+ }, Qe = () => {
1076
+ var E;
1077
+ $();
1065
1078
  const e = document.createElement("table");
1066
- e.style.borderCollapse = "collapse", e.style.width = "100%", e.style.border = "1px solid #ccc", e.style.margin = "8px 0", e.style.position = "relative", m.table && e.classList.add(m.table);
1079
+ e.style.borderCollapse = "collapse", e.style.width = "100%", e.style.border = "1px solid #ccc", e.style.margin = "8px 0", e.style.position = "relative", f.table && e.classList.add(f.table);
1067
1080
  const t = document.createElement("thead");
1068
- m.thead && t.classList.add(m.thead);
1081
+ f.thead && t.classList.add(f.thead);
1069
1082
  const n = document.createElement("tbody");
1070
- m.tbody && n.classList.add(m.tbody);
1083
+ f.tbody && n.classList.add(f.tbody);
1071
1084
  const a = document.createElement("tr");
1072
- m.tr && a.classList.add(m.tr);
1085
+ f.tr && a.classList.add(f.tr);
1073
1086
  const s = document.createElement("tr");
1074
- m.tr && s.classList.add(m.tr);
1075
- for (let v = 0; v < 2; v++) {
1076
- const g = document.createElement("th");
1077
- g.textContent = `Header ${v + 1}`, g.style.border = "1px solid #999", g.style.padding = "8px", g.style.position = "relative", g.style.backgroundColor = "lightgray", m.th && g.classList.add(m.th);
1078
- const p = document.createElement("td");
1079
- p.textContent = `Row 1 Col ${v + 1}`, p.style.border = "1px solid #999", p.style.padding = "8px", p.style.position = "relative", p.style.backgroundColor = "#fff", m.td && p.classList.add(m.td), Y(g), Y(p), a.appendChild(g), s.appendChild(p);
1087
+ f.tr && s.classList.add(f.tr);
1088
+ for (let g = 0; g < 2; g++) {
1089
+ const y = document.createElement("th");
1090
+ y.textContent = `Header ${g + 1}`, y.style.border = "1px solid #999", y.style.padding = "4px", y.style.position = "relative", y.style.backgroundColor = "lightgray", f.th && y.classList.add(f.th);
1091
+ const x = document.createElement("td");
1092
+ x.textContent = `Row 1 Col ${g + 1}`, x.style.border = "1px solid #999", x.style.padding = "4px", x.style.position = "relative", x.style.backgroundColor = "#fff", f.td && x.classList.add(f.td), Y(y), Y(x), a.appendChild(y), s.appendChild(x);
1080
1093
  }
1081
- t.appendChild(a), n.appendChild(s), e.appendChild(t), e.appendChild(n), Ge(e), ge(e);
1094
+ t.appendChild(a), n.appendChild(s), e.appendChild(t), e.appendChild(n), ge(e);
1082
1095
  const l = window.getSelection();
1083
1096
  if (!(l != null && l.rangeCount)) return;
1084
- l.getRangeAt(0).insertNode(e), x();
1097
+ const c = l.getRangeAt(0);
1098
+ c.collapse(!1), c.insertNode(e);
1099
+ const v = document.createElement("p");
1100
+ v.innerHTML = "<br/>", e.after(v);
1101
+ const h = document.createRange();
1102
+ h.setStart(v, 0), h.collapse(!0), l.removeAllRanges(), l.addRange(h), (E = T()) == null || E.focus(), S();
1085
1103
  }, ge = (e) => {
1086
1104
  const t = document.createElement("div");
1087
1105
  Object.assign(t.style, {
@@ -1094,19 +1112,19 @@ const $t = ({
1094
1112
  cursor: "nwse-resize",
1095
1113
  zIndex: "20",
1096
1114
  borderRadius: "2px"
1097
- });
1115
+ }), t.style.userSelect = "none", t.contentEditable = "false";
1098
1116
  let n = 0, a = 0, s = 0, l = 0;
1099
- t.addEventListener("mousedown", (i) => {
1100
- i.preventDefault(), n = i.clientX, a = i.clientY;
1117
+ t.addEventListener("mousedown", (c) => {
1118
+ c.preventDefault(), n = c.clientX, a = c.clientY;
1101
1119
  const v = e.getBoundingClientRect();
1102
1120
  s = v.width, l = v.height;
1103
- const g = (h) => {
1104
- const C = Math.max(100, s + (h.clientX - n)), N = Math.max(60, l + (h.clientY - a));
1105
- e.style.width = `${C}px`, e.style.height = `${N}px`, x();
1106
- }, p = () => {
1107
- document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", p), x();
1121
+ const h = (g) => {
1122
+ const y = Math.max(100, s + (g.clientX - n)), x = Math.max(60, l + (g.clientY - a));
1123
+ e.style.width = `${y}px`, e.style.height = `${x}px`, S();
1124
+ }, E = () => {
1125
+ document.removeEventListener("mousemove", h), document.removeEventListener("mouseup", E), S();
1108
1126
  };
1109
- document.addEventListener("mousemove", g), document.addEventListener("mouseup", p);
1127
+ document.addEventListener("mousemove", h), document.addEventListener("mouseup", E);
1110
1128
  }), e.appendChild(t);
1111
1129
  }, Y = (e) => {
1112
1130
  const t = document.createElement("div"), n = document.createElement("div");
@@ -1118,8 +1136,13 @@ const $t = ({
1118
1136
  height: "100%",
1119
1137
  cursor: "col-resize",
1120
1138
  background: "rgba(0,0,0,0.15)",
1121
- zIndex: "10"
1122
- }), Object.assign(n.style, {
1139
+ zIndex: "10",
1140
+ userSelect: "none",
1141
+ WebkitUserSelect: "none",
1142
+ MozUserSelect: "none",
1143
+ msUserSelect: "none",
1144
+ pointerEvents: "auto"
1145
+ }), t.contentEditable = "false", Object.assign(n.style, {
1123
1146
  position: "absolute",
1124
1147
  bottom: "0",
1125
1148
  left: "0",
@@ -1127,27 +1150,32 @@ const $t = ({
1127
1150
  height: "6px",
1128
1151
  cursor: "row-resize",
1129
1152
  background: "rgba(0,0,0,0.15)",
1130
- zIndex: "10"
1131
- }), Ze(e, t, n), e.appendChild(t), e.appendChild(n);
1132
- }, Ze = (e, t, n) => {
1133
- let a = 0, s = 0, l = 0, i = 0;
1134
- t.addEventListener("mousedown", (h) => {
1135
- h.preventDefault(), a = h.clientX, l = e.offsetWidth, document.addEventListener("mousemove", v), document.addEventListener("mouseup", p);
1136
- }), n.addEventListener("mousedown", (h) => {
1137
- h.preventDefault(), s = h.clientY, i = e.offsetHeight, document.addEventListener("mousemove", g), document.addEventListener("mouseup", p);
1153
+ zIndex: "10",
1154
+ userSelect: "none",
1155
+ WebkitUserSelect: "none",
1156
+ MozUserSelect: "none",
1157
+ msUserSelect: "none",
1158
+ pointerEvents: "auto"
1159
+ }), n.contentEditable = "false", Je(e, t, n), e.appendChild(t), e.appendChild(n);
1160
+ }, Je = (e, t, n) => {
1161
+ let a = 0, s = 0, l = 0, c = 0;
1162
+ t.addEventListener("mousedown", (g) => {
1163
+ g.preventDefault(), a = g.clientX, l = e.offsetWidth, document.addEventListener("mousemove", v), document.addEventListener("mouseup", E);
1164
+ }), n.addEventListener("mousedown", (g) => {
1165
+ g.preventDefault(), s = g.clientY, c = e.offsetHeight, document.addEventListener("mousemove", h), document.addEventListener("mouseup", E);
1138
1166
  });
1139
- const v = (h) => {
1140
- const C = l + (h.clientX - a);
1141
- e.style.width = `${Math.max(30, C)}px`, x();
1142
- }, g = (h) => {
1143
- const C = i + (h.clientY - s);
1144
- e.style.height = `${Math.max(20, C)}px`, x();
1145
- }, p = () => {
1146
- document.removeEventListener("mousemove", v), document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", p), x();
1167
+ const v = (g) => {
1168
+ const y = l + (g.clientX - a);
1169
+ e.style.width = `${Math.max(30, y)}px`, S();
1170
+ }, h = (g) => {
1171
+ const y = c + (g.clientY - s);
1172
+ e.style.height = `${Math.max(20, y)}px`, S();
1173
+ }, E = () => {
1174
+ document.removeEventListener("mousemove", v), document.removeEventListener("mousemove", h), document.removeEventListener("mouseup", E), S();
1147
1175
  };
1148
- }, Qe = (e) => {
1176
+ }, Ge = (e) => {
1149
1177
  const n = e.target.closest("td, th");
1150
- n && (e.preventDefault(), document.querySelectorAll(".rte-cell-highlight").forEach((a) => a.classList.remove("rte-cell-highlight")), n.classList.add("rte-cell-highlight"), f({
1178
+ n && (e.preventDefault(), document.querySelectorAll(".rte-cell-highlight").forEach((a) => a.classList.remove("rte-cell-highlight")), n.classList.add("rte-cell-highlight"), m({
1151
1179
  visible: !0,
1152
1180
  x: e.clientX,
1153
1181
  y: e.clientY,
@@ -1155,38 +1183,38 @@ const $t = ({
1155
1183
  }));
1156
1184
  }, fe = () => {
1157
1185
  document.querySelectorAll(".rte-cell-highlight").forEach((e) => e.classList.remove("rte-cell-highlight"));
1158
- }, Je = (e) => {
1159
- if (!T.cell) return;
1160
- const t = T.cell.closest("table"), n = T.cell.cellIndex, a = T.cell.parentElement.rowIndex, s = (l) => {
1161
- const i = l.tagName.toLowerCase(), v = document.createElement(i);
1186
+ }, et = (e) => {
1187
+ if (!D.cell) return;
1188
+ const t = D.cell.closest("table"), n = D.cell.cellIndex, a = D.cell.parentElement.rowIndex, s = (l) => {
1189
+ const c = l.tagName.toLowerCase(), v = document.createElement(c);
1162
1190
  return v.textContent = l.textContent || "", v.style.cssText = l.style.cssText, Y(v), v;
1163
1191
  };
1164
1192
  switch (e) {
1165
1193
  case "insertRowAbove": {
1166
- const l = t.rows[a], i = t.insertRow(a);
1194
+ const l = t.rows[a], c = t.insertRow(a);
1167
1195
  Array.from(l.cells).forEach((v) => {
1168
- i.appendChild(s(v));
1196
+ c.appendChild(s(v));
1169
1197
  });
1170
1198
  break;
1171
1199
  }
1172
1200
  case "insertRowBelow": {
1173
- const l = t.rows[a], i = t.insertRow(a + 1);
1201
+ const l = t.rows[a], c = t.insertRow(a + 1);
1174
1202
  Array.from(l.cells).forEach((v) => {
1175
- i.appendChild(s(v));
1203
+ c.appendChild(s(v));
1176
1204
  });
1177
1205
  break;
1178
1206
  }
1179
1207
  case "insertColLeft": {
1180
1208
  Array.from(t.rows).forEach((l) => {
1181
- const i = l.cells[n];
1182
- l.insertBefore(s(i), i);
1209
+ const c = l.cells[n];
1210
+ l.insertBefore(s(c), c);
1183
1211
  });
1184
1212
  break;
1185
1213
  }
1186
1214
  case "insertColRight": {
1187
1215
  Array.from(t.rows).forEach((l) => {
1188
- const i = l.cells[n];
1189
- l.insertBefore(s(i), i.nextSibling);
1216
+ const c = l.cells[n];
1217
+ l.insertBefore(s(c), c.nextSibling);
1190
1218
  });
1191
1219
  break;
1192
1220
  }
@@ -1199,32 +1227,20 @@ const $t = ({
1199
1227
  });
1200
1228
  break;
1201
1229
  }
1202
- x(), f(oe(ae({}, T), {
1230
+ S(), m(oe(ae({}, D), {
1203
1231
  visible: !1
1204
1232
  })), fe();
1205
- }, Ge = (e) => {
1206
- const t = e.querySelector("tbody");
1207
- if (!t || t.querySelector("[data-hidden-table-start]")) return;
1208
- const n = document.createElement("span");
1209
- n.textContent = "{{#arrayData}}", n.style.display = "none", n.setAttribute("data-hidden-table-start", "true"), t.insertBefore(n, t.firstChild);
1210
- const a = document.createElement("span");
1211
- a.textContent = "{{/arrayData}}", a.style.display = "none", a.setAttribute("data-hidden-table-end", "true"), t.appendChild(a);
1212
- }, he = () => {
1213
- const e = D();
1214
- if (!e) return H;
1215
- const t = e.cloneNode(!0);
1216
- return t.querySelectorAll("table div").forEach((n) => n.remove()), t.querySelectorAll(".rte-cell-highlight").forEach((n) => n.classList.remove("rte-cell-highlight")), t.innerHTML;
1217
- }, et = () => {
1218
- U(), K.current = k.current, le({
1233
+ }, tt = () => {
1234
+ V(), X.current = N.current, le({
1219
1235
  url: "",
1220
1236
  text: "",
1221
1237
  title: "",
1222
1238
  target: "_self"
1223
- }), j(!0);
1224
- }, tt = (e) => {
1239
+ }), H(!0);
1240
+ }, nt = (e) => {
1225
1241
  const t = window.getSelection();
1226
- if (!t || !K.current) return;
1227
- t.removeAllRanges(), t.addRange(K.current);
1242
+ if (!t || !X.current) return;
1243
+ t.removeAllRanges(), t.addRange(X.current);
1228
1244
  let n = e.url.trim();
1229
1245
  /^https?:\/\//i.test(n) || (n = "https://" + n);
1230
1246
  const a = document.createElement("a");
@@ -1233,9 +1249,9 @@ const $t = ({
1233
1249
  s.deleteContents(), s.insertNode(a);
1234
1250
  const l = document.createTextNode(" ");
1235
1251
  a.after(l);
1236
- const i = document.createRange();
1237
- i.setStartAfter(l), i.collapse(!0), t.removeAllRanges(), t.addRange(i), j(!1), x();
1238
- }, nt = (e) => {
1252
+ const c = document.createRange();
1253
+ c.setStartAfter(l), c.collapse(!0), t.removeAllRanges(), t.addRange(c), H(!1), S();
1254
+ }, rt = (e) => {
1239
1255
  const t = e.target;
1240
1256
  if (t.tagName === "A") {
1241
1257
  const n = t;
@@ -1245,46 +1261,46 @@ const $t = ({
1245
1261
  }
1246
1262
  e.preventDefault();
1247
1263
  const a = document.createRange();
1248
- a.selectNode(n), K.current = a, le({
1264
+ a.selectNode(n), X.current = a, le({
1249
1265
  url: n.href,
1250
1266
  text: n.textContent || n.href,
1251
1267
  title: n.title,
1252
1268
  target: n.target
1253
- }), j(!0);
1269
+ }), H(!0);
1254
1270
  }
1255
- }, rt = () => {
1256
- const e = D();
1271
+ }, at = () => {
1272
+ const e = T();
1257
1273
  if (!e) return;
1258
1274
  const t = window.getSelection();
1259
- if ((!t || t.rangeCount === 0) && k.current) {
1260
- const h = window.getSelection();
1261
- h == null || h.removeAllRanges(), h == null || h.addRange(k.current);
1275
+ if ((!t || t.rangeCount === 0) && N.current) {
1276
+ const g = window.getSelection();
1277
+ g == null || g.removeAllRanges(), g == null || g.addRange(N.current);
1262
1278
  }
1263
1279
  const n = window.getSelection();
1264
1280
  if (!n || n.rangeCount === 0) return;
1265
1281
  const a = n.getRangeAt(0);
1266
- W(), document.execCommand("removeFormat", !1);
1282
+ $(), document.execCommand("removeFormat", !1);
1267
1283
  const s = a.cloneContents(), l = document.createElement("div");
1268
1284
  l.appendChild(s);
1269
- const i = document.createTreeWalker(l, NodeFilter.SHOW_ELEMENT, null), v = [];
1270
- for (; i.nextNode(); ) {
1271
- const h = i.currentNode, C = h.tagName.toUpperCase(), N = h.getAttribute && h.getAttribute("data-mention") !== null;
1272
- C !== "A" && !N && v.push(h);
1285
+ const c = document.createTreeWalker(l, NodeFilter.SHOW_ELEMENT, null), v = [];
1286
+ for (; c.nextNode(); ) {
1287
+ const g = c.currentNode, y = g.tagName.toUpperCase(), x = g.getAttribute && g.getAttribute("data-mention") !== null;
1288
+ y !== "A" && !x && v.push(g);
1273
1289
  }
1274
- for (let h = v.length - 1; h >= 0; h--) {
1275
- const C = v[h], N = C.parentNode;
1276
- if (N) {
1277
- for (; C.firstChild; ) N.insertBefore(C.firstChild, C);
1278
- N.removeChild(C);
1290
+ for (let g = v.length - 1; g >= 0; g--) {
1291
+ const y = v[g], x = y.parentNode;
1292
+ if (x) {
1293
+ for (; y.firstChild; ) x.insertBefore(y.firstChild, y);
1294
+ x.removeChild(y);
1279
1295
  }
1280
1296
  }
1281
- l.querySelectorAll("[style]").forEach((h) => h.removeAttribute("style")), a.deleteContents();
1282
- const g = document.createDocumentFragment();
1283
- for (; l.firstChild; ) g.appendChild(l.firstChild);
1284
- a.insertNode(g);
1285
- const p = document.createRange();
1286
- p.setStartAfter(a.endContainer.nodeType === Node.TEXT_NODE ? a.endContainer : a.startContainer), p.collapse(!0), n.removeAllRanges(), n.addRange(p), e.normalize(), x();
1287
- }, at = (e) => {
1297
+ l.querySelectorAll("[style]").forEach((g) => g.removeAttribute("style")), a.deleteContents();
1298
+ const h = document.createDocumentFragment();
1299
+ for (; l.firstChild; ) h.appendChild(l.firstChild);
1300
+ a.insertNode(h);
1301
+ const E = document.createRange();
1302
+ E.setStartAfter(a.endContainer.nodeType === Node.TEXT_NODE ? a.endContainer : a.startContainer), E.collapse(!0), n.removeAllRanges(), n.addRange(E), e.normalize(), S();
1303
+ }, ot = (e) => {
1288
1304
  var a;
1289
1305
  let t = e;
1290
1306
  t = t.replace(/{{#arrayData\d*}}/g, ""), t = t.replace(/{{\/arrayData\d*}}/g, "");
@@ -1302,17 +1318,17 @@ const $t = ({
1302
1318
 
1303
1319
  `).trim()) || "";
1304
1320
  };
1305
- function ot() {
1321
+ function lt() {
1306
1322
  const e = window.getSelection();
1307
1323
  if (!e || e.rangeCount === 0) return [];
1308
1324
  const t = e.getRangeAt(0), n = t.commonAncestorContainer, a = n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement;
1309
1325
  return Array.from(a.querySelectorAll("td, th")).filter((l) => {
1310
- const i = document.createRange();
1311
- return i.selectNodeContents(l), t.compareBoundaryPoints(Range.END_TO_START, i) < 0 && t.compareBoundaryPoints(Range.START_TO_END, i) > 0;
1326
+ const c = document.createRange();
1327
+ return c.selectNodeContents(l), t.compareBoundaryPoints(Range.END_TO_START, c) < 0 && t.compareBoundaryPoints(Range.START_TO_END, c) > 0;
1312
1328
  });
1313
1329
  }
1314
- function lt(e) {
1315
- const t = ot();
1330
+ function ct(e) {
1331
+ const t = lt();
1316
1332
  if (t.length === 0) {
1317
1333
  se(e);
1318
1334
  return;
@@ -1320,78 +1336,100 @@ const $t = ({
1320
1336
  let n = "left";
1321
1337
  e === "justifyCenter" && (n = "center"), e === "justifyRight" && (n = "right"), t.forEach((a) => {
1322
1338
  a.style.textAlign = n;
1323
- }), x();
1339
+ }), S();
1324
1340
  }
1341
+ const it = (e) => {
1342
+ const t = e.clipboardData.items;
1343
+ for (let n = 0; n < t.length; n++) {
1344
+ const a = t[n];
1345
+ if (a.kind === "file" && a.type.startsWith("image/")) {
1346
+ e.preventDefault();
1347
+ return;
1348
+ }
1349
+ a.kind === "string" && a.getAsString((s) => {
1350
+ /<img\s/i.test(s) && e.preventDefault();
1351
+ });
1352
+ }
1353
+ }, st = (e) => {
1354
+ $();
1355
+ const t = window.getSelection();
1356
+ if (!t || !t.rangeCount) return;
1357
+ const n = t.getRangeAt(0), a = document.createElement("span");
1358
+ a.style.fontSize = `${e}px`, a.appendChild(n.extractContents()), n.insertNode(a);
1359
+ const s = document.createRange();
1360
+ s.setStartAfter(a), s.collapse(!0), t.removeAllRanges(), t.addRange(s), S();
1361
+ };
1325
1362
  return /* @__PURE__ */ o.createElement("div", {
1326
- className: `rte-wrapper ${(m == null ? void 0 : m.wrapper) || ""}`,
1327
- style: y.wrapper
1363
+ className: `rte-wrapper ${(f == null ? void 0 : f.wrapper) || ""}`,
1364
+ style: w.wrapper
1328
1365
  }, /* @__PURE__ */ o.createElement("div", {
1329
1366
  style: {
1330
1367
  flex: 1
1331
1368
  }
1332
- }, /* @__PURE__ */ o.createElement(_t, {
1333
- exec: X,
1334
- saveSelection: U,
1335
- handleFileChange: Ke,
1336
- handleFontSizeChange: (e) => X("fontSize", e.target.value),
1337
- handleFontFamilyChange: (e) => X("fontName", e.target.value),
1338
- insertEmoji: Xe,
1339
- handleLink: et,
1340
- removeFormatting: rt,
1341
- visibleActions: Oe,
1342
- className: m.toolbar,
1343
- style: y.toolbar
1369
+ }, /* @__PURE__ */ o.createElement(It, {
1370
+ exec: ne,
1371
+ saveSelection: V,
1372
+ handleFileChange: Ye,
1373
+ handleFontSizeChange: (e) => st(e.target.value),
1374
+ handleFontFamilyChange: (e) => ne("fontName", e.target.value),
1375
+ insertEmoji: Ze,
1376
+ handleLink: tt,
1377
+ removeFormatting: at,
1378
+ visibleActions: De,
1379
+ className: f.toolbar,
1380
+ style: w.toolbar
1344
1381
  }), /* @__PURE__ */ o.createElement("div", {
1345
- ref: z,
1382
+ ref: k,
1346
1383
  id: "rte-editor-body",
1347
- className: `rte-editor ${(m == null ? void 0 : m.editor) || ""}`,
1348
- style: y.editor,
1384
+ className: `rte-editor ${(f == null ? void 0 : f.editor) || ""}`,
1385
+ style: w.editor,
1349
1386
  contentEditable: !0,
1350
1387
  suppressContentEditableWarning: !0,
1351
- onKeyUp: U,
1352
- onMouseUp: U,
1388
+ onPaste: it,
1389
+ onKeyUp: V,
1390
+ onMouseUp: V,
1353
1391
  onInput: () => {
1354
- me(), U();
1392
+ me(), V();
1355
1393
  },
1356
- onKeyDown: Ue,
1357
- onBeforeInput: $e,
1358
- onContextMenu: Qe,
1394
+ onKeyDown: We,
1395
+ onBeforeInput: Ke,
1396
+ onContextMenu: Ge,
1359
1397
  onClick: (e) => {
1360
- nt(e), U();
1398
+ rt(e), V();
1361
1399
  }
1362
- }), /* @__PURE__ */ o.createElement(Ft, {
1400
+ }), /* @__PURE__ */ o.createElement(Bt, {
1363
1401
  show: q,
1364
1402
  position: F,
1365
- filtered: te,
1366
- insertMention: Be,
1367
- onClose: () => I(!1),
1368
- query: He
1369
- }), c && /* @__PURE__ */ o.createElement("div", {
1370
- className: `rte-output ${(m == null ? void 0 : m.output) || ""}`,
1371
- style: y.output
1372
- }, /* @__PURE__ */ o.createElement("h4", null, "Output HTML:"), /* @__PURE__ */ o.createElement("p", null, G)), /* @__PURE__ */ o.createElement(Pt, {
1373
- visible: T.visible,
1374
- x: T.x,
1375
- y: T.y,
1376
- onAction: Je,
1403
+ filtered: ee,
1404
+ insertMention: qe,
1405
+ onClose: () => B(!1),
1406
+ query: Oe
1407
+ }), i && /* @__PURE__ */ o.createElement("div", {
1408
+ className: `rte-output ${(f == null ? void 0 : f.output) || ""}`,
1409
+ style: w.output
1410
+ }, /* @__PURE__ */ o.createElement("h4", null, "Output HTML:"), /* @__PURE__ */ o.createElement("p", null, K)), /* @__PURE__ */ o.createElement(qt, {
1411
+ visible: D.visible,
1412
+ x: D.x,
1413
+ y: D.y,
1414
+ onAction: et,
1377
1415
  onClose: () => {
1378
- f(oe(ae({}, T), {
1416
+ m(oe(ae({}, D), {
1379
1417
  visible: !1
1380
1418
  })), fe();
1381
1419
  }
1382
- }), /* @__PURE__ */ o.createElement(It, {
1383
- visible: w,
1384
- linkData: De,
1385
- onClose: () => j(!1),
1386
- onInsert: tt
1387
- })), d ? /* @__PURE__ */ o.createElement(Bt, {
1388
- className: m.preview,
1389
- style: y.preview,
1390
- html: he()
1420
+ }), /* @__PURE__ */ o.createElement(Vt, {
1421
+ visible: C,
1422
+ linkData: Te,
1423
+ onClose: () => H(!1),
1424
+ onInsert: nt
1425
+ })), d ? /* @__PURE__ */ o.createElement(Ut, {
1426
+ className: f.preview,
1427
+ style: w.preview,
1428
+ html: K
1391
1429
  }) : null);
1392
1430
  };
1393
1431
  export {
1394
- $t as RichTextEditor,
1395
- Bt as RtePreview,
1396
- _t as RteToolbar
1432
+ Xt as RichTextEditor,
1433
+ Ut as RtePreview,
1434
+ It as RteToolbar
1397
1435
  };