@ryzeup/richtexteditor 1.0.8 → 1.0.9

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