@ryzeup/richtexteditor 1.0.29 → 1.0.31

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