@daneshnaik/rich-text-editor 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,13 @@
1
1
  import { jsx as e, jsxs as i } from "react/jsx-runtime";
2
- import { useState as b, useEffect as oe, useRef as Q } from "react";
3
- const It = ({ isOpen: J, onClose: z, onInsert: _, onRemove: re, isEditing: he = !1, initialUrl: O = "", initialText: Z = "", existingLinks: F = [] }) => {
4
- const [D, Y] = b(O), [ee, G] = b(Z);
2
+ import { useState as v, useEffect as oe, useRef as K } from "react";
3
+ const Dt = ({ isOpen: Q, onClose: Y, onInsert: re, onRemove: J, isEditing: me = !1, initialUrl: X = "", initialText: Z = "", existingLinks: z = [] }) => {
4
+ const [D, ee] = v(X), [ae, O] = v(Z);
5
5
  return oe(() => {
6
- J && (Y(O || ""), G(Z || ""));
7
- }, [J, O, Z]), J ? /* @__PURE__ */ e("div", { className: "modal-overlay", onClick: z, children: /* @__PURE__ */ i("div", { className: "modal-content", onClick: (L) => L.stopPropagation(), children: [
6
+ Q && (ee(X || ""), O(Z || ""));
7
+ }, [Q, X, Z]), Q ? /* @__PURE__ */ e("div", { className: "modal-overlay", onClick: Y, children: /* @__PURE__ */ i("div", { className: "modal-content", onClick: (R) => R.stopPropagation(), children: [
8
8
  /* @__PURE__ */ i("div", { className: "modal-header", children: [
9
9
  /* @__PURE__ */ e("h3", { children: "Insert Link" }),
10
- /* @__PURE__ */ e("button", { className: "modal-close", onClick: z, children: "×" })
10
+ /* @__PURE__ */ e("button", { className: "modal-close", onClick: Y, children: "×" })
11
11
  ] }),
12
12
  /* @__PURE__ */ i("div", { className: "modal-body", children: [
13
13
  /* @__PURE__ */ i("div", { className: "form-group", children: [
@@ -19,7 +19,7 @@ const It = ({ isOpen: J, onClose: z, onInsert: _, onRemove: re, isEditing: he =
19
19
  className: "form-input",
20
20
  placeholder: "https://example.com",
21
21
  value: D,
22
- onChange: (L) => Y(L.target.value)
22
+ onChange: (R) => ee(R.target.value)
23
23
  }
24
24
  )
25
25
  ] }),
@@ -30,40 +30,40 @@ const It = ({ isOpen: J, onClose: z, onInsert: _, onRemove: re, isEditing: he =
30
30
  {
31
31
  type: "text",
32
32
  className: "form-input",
33
- value: ee,
34
- onChange: (L) => G(L.target.value)
33
+ value: ae,
34
+ onChange: (R) => O(R.target.value)
35
35
  }
36
36
  )
37
37
  ] }),
38
- F && F.length > 0 && /* @__PURE__ */ i("div", { className: "form-group", children: [
38
+ z && z.length > 0 && /* @__PURE__ */ i("div", { className: "form-group", children: [
39
39
  /* @__PURE__ */ e("label", { children: "Existing links:" }),
40
- /* @__PURE__ */ e("ul", { className: "existing-links", style: { maxHeight: 160, overflow: "auto", paddingLeft: 16 }, children: F.map((L, ue) => /* @__PURE__ */ i("li", { style: { display: "flex", gap: 8, alignItems: "center", marginBottom: 6 }, children: [
41
- /* @__PURE__ */ e("a", { href: L.href, target: "_blank", rel: "noreferrer", children: L.text || L.href }),
40
+ /* @__PURE__ */ e("ul", { className: "existing-links", style: { maxHeight: 160, overflow: "auto", paddingLeft: 16 }, children: z.map((R, V) => /* @__PURE__ */ i("li", { style: { display: "flex", gap: 8, alignItems: "center", marginBottom: 6 }, children: [
41
+ /* @__PURE__ */ e("a", { href: R.href, target: "_blank", rel: "noreferrer", children: R.text || R.href }),
42
42
  /* @__PURE__ */ e("button", { type: "button", className: "toolbar-btn", onClick: () => {
43
- Y(L.href), G(L.text || L.href);
43
+ ee(R.href), O(R.text || R.href);
44
44
  }, style: { marginLeft: "auto" }, children: "Use" })
45
- ] }, ue)) })
45
+ ] }, V)) })
46
46
  ] })
47
47
  ] }),
48
48
  /* @__PURE__ */ i("div", { className: "modal-footer", children: [
49
- /* @__PURE__ */ e("button", { className: "btn-secondary", onClick: z, children: "Cancel" }),
50
- he && re && /* @__PURE__ */ e("button", { className: "btn-secondary", onClick: () => {
51
- re(), z();
49
+ /* @__PURE__ */ e("button", { className: "btn-secondary", onClick: Y, children: "Cancel" }),
50
+ me && J && /* @__PURE__ */ e("button", { className: "btn-secondary", onClick: () => {
51
+ J(), Y();
52
52
  }, style: { marginRight: 8 }, children: "Remove Link" }),
53
53
  /* @__PURE__ */ e(
54
54
  "button",
55
55
  {
56
56
  className: "btn-primary",
57
57
  onClick: () => {
58
- _({ url: D || "", text: ee || D || "" });
58
+ re({ url: D || "", text: ae || D || "" });
59
59
  },
60
60
  children: "Insert"
61
61
  }
62
62
  )
63
63
  ] })
64
64
  ] }) }) : null;
65
- }, qt = () => {
66
- const [J, z] = b(""), [_, re] = b(!1), [he, O] = b(!1), [Z, F] = b(!1), [D, Y] = b(""), [ee, G] = b(!1), [L, ue] = b({ rows: 1, cols: 1 }), [ze, me] = b(!1), [Ve, j] = b(!1), [X, Oe] = b(""), [pe, je] = b(""), [ye, B] = b(""), [De, ae] = b(!1), [be, Ce] = b(3), [xe, we] = b(3), [ke, Xe] = b("a4"), [V, _e] = b({
65
+ }, Xt = ({ width: Q = null, height: Y = null, fullBleed: re = !0, onComponentDrop: J = null }) => {
66
+ const [me, X] = v(!1), [Z, z] = v(""), [D, ee] = v(!1), [ae, O] = v(!1), [R, V] = v(!1), [pe, xe] = v(""), [we, ke] = v(!1), [ce, Xe] = v({ rows: 1, cols: 1 }), [_e, fe] = v(!1), [Ye, j] = v(!1), [_, Ge] = v(""), [ge, Ke] = v(""), [Ne, B] = v(""), [Qe, ie] = v(!1), [Le, Se] = v(3), [Te, Me] = v(3), [Ee, Je] = v("a4"), [P, Ze] = v({
67
67
  bold: !1,
68
68
  italic: !1,
69
69
  underline: !1,
@@ -73,7 +73,7 @@ const It = ({ isOpen: J, onClose: z, onInsert: _, onRemove: re, isEditing: he =
73
73
  justifyRight: !1,
74
74
  insertUnorderedList: !1,
75
75
  insertOrderedList: !1
76
- }), Ne = () => {
76
+ }), Re = () => {
77
77
  try {
78
78
  const t = {
79
79
  bold: document.queryCommandState("bold"),
@@ -86,27 +86,27 @@ const It = ({ isOpen: J, onClose: z, onInsert: _, onRemove: re, isEditing: he =
86
86
  insertUnorderedList: document.queryCommandState("insertUnorderedList"),
87
87
  insertOrderedList: document.queryCommandState("insertOrderedList")
88
88
  };
89
- _e(t);
89
+ Ze(t);
90
90
  try {
91
91
  const n = window.getSelection(), l = n && n.anchorNode ? n.anchorNode.nodeType === 3 ? n.anchorNode.parentElement : n.anchorNode : null;
92
- let r = "";
92
+ let o = "";
93
93
  try {
94
- r = document.queryCommandValue && document.queryCommandValue("fontName") || "";
94
+ o = document.queryCommandValue && document.queryCommandValue("fontName") || "";
95
95
  } catch {
96
- r = "";
96
+ o = "";
97
97
  }
98
- !r && l && (r = (window.getComputedStyle(l).fontFamily || "").split(",")[0].replace(/["']/g, "").trim()), r && (r = String(r).replace(/^[<>"']+|[<>"']+$/g, "").split(",")[0].trim(), Le(r), Qe((u) => u.includes(r) ? u : [r, ...u]));
99
- let a = "";
98
+ !o && l && (o = (window.getComputedStyle(l).fontFamily || "").split(",")[0].replace(/["']/g, "").trim()), o && (o = String(o).replace(/^[<>"']+|[<>"']+$/g, "").split(",")[0].trim(), Ae(o), lt((u) => u.includes(o) ? u : [o, ...u]));
99
+ let r = "";
100
100
  try {
101
- a = document.queryCommandValue("fontSize") || "";
101
+ r = document.queryCommandValue("fontSize") || "";
102
102
  } catch {
103
- a = "";
103
+ r = "";
104
104
  }
105
- if (!a && l) {
105
+ if (!r && l) {
106
106
  const u = parseFloat(window.getComputedStyle(l).fontSize || "16");
107
- u < 12 ? a = "1" : u < 16 ? a = "2" : u < 18 ? a = "3" : u < 22 ? a = "4" : u < 26 ? a = "5" : u < 32 ? a = "6" : a = "7";
107
+ u < 12 ? r = "1" : u < 16 ? r = "2" : u < 18 ? r = "3" : u < 22 ? r = "4" : u < 26 ? r = "5" : u < 32 ? r = "6" : r = "7";
108
108
  }
109
- a && Se(String(a));
109
+ r && He(String(r));
110
110
  let h = "";
111
111
  try {
112
112
  h = document.queryCommandValue && document.queryCommandValue("formatBlock") || "";
@@ -115,7 +115,7 @@ const It = ({ isOpen: J, onClose: z, onInsert: _, onRemove: re, isEditing: he =
115
115
  }
116
116
  if (!h && l) {
117
117
  let u = l;
118
- for (; u && u !== f.current; ) {
118
+ for (; u && u !== p.current; ) {
119
119
  if (u.tagName && /H[1-6]|P|BLOCKQUOTE|DIV/.test(u.tagName)) {
120
120
  h = u.tagName.toLowerCase();
121
121
  break;
@@ -123,12 +123,12 @@ const It = ({ isOpen: J, onClose: z, onInsert: _, onRemove: re, isEditing: he =
123
123
  u = u.parentElement;
124
124
  }
125
125
  }
126
- h && (h = String(h).replace(/[<>]/g, "").toLowerCase(), /^(p|h[1-6]|blockquote)$/.test(h) || (h = "p"), fe(h));
126
+ h && (h = String(h).replace(/[<>]/g, "").toLowerCase(), /^(p|h[1-6]|blockquote)$/.test(h) || (h = "p"), ye(h));
127
127
  } catch {
128
128
  }
129
129
  } catch {
130
130
  }
131
- }, [Ye, Le] = b("Arial"), [Ge, Se] = b("3"), [Ke, fe] = b("p"), [Bt, Qe] = b([
131
+ }, [et, Ae] = v("Arial"), [tt, He] = v("3"), [nt, ye] = v("p"), [Ot, lt] = v([
132
132
  "Arial",
133
133
  "Helvetica",
134
134
  "Segoe UI",
@@ -158,56 +158,92 @@ const It = ({ isOpen: J, onClose: z, onInsert: _, onRemove: re, isEditing: he =
158
158
  "Lucida Sans",
159
159
  "Righteous",
160
160
  "Poppins"
161
- ]), f = Q(null), Te = Q(null), q = Q(null), N = Q(null), E = Q(null), Je = Q(null), v = (t, n = null) => {
161
+ ]), p = K(null), Ie = K(null), F = K(null), N = K(null), M = K(null), ot = K(null), y = (t, n = null) => {
162
162
  try {
163
163
  document.execCommand(t, !1, n);
164
164
  } catch (l) {
165
165
  console.error("execCommand failed:", l);
166
166
  }
167
- }, Ze = () => {
168
- f.current && (z(f.current.innerHTML), Ne());
167
+ }, rt = () => {
168
+ p.current && (z(p.current.innerHTML), Re());
169
+ }, at = (t) => {
170
+ t.preventDefault(), t.dataTransfer.dropEffect = "copy", X(!0);
171
+ }, ct = (t) => {
172
+ X(!1);
173
+ }, it = async (t) => {
174
+ t.preventDefault(), X(!1);
175
+ const n = t.dataTransfer, l = { html: null, text: null, files: [], types: Array.from(n.types || []) };
176
+ try {
177
+ if (n.files && n.files.length > 0)
178
+ for (let o = 0; o < n.files.length; o++) l.files.push(n.files[o]);
179
+ try {
180
+ l.html = n.getData("text/html") || null;
181
+ } catch {
182
+ l.html = null;
183
+ }
184
+ try {
185
+ l.text = n.getData("text/plain") || null;
186
+ } catch {
187
+ l.text = null;
188
+ }
189
+ } catch {
190
+ }
191
+ try {
192
+ if (l.html ? p.current && (p.current.focus(), y("insertHTML", l.html)) : l.text && p.current && (p.current.focus(), y("insertText", l.text)), l.files.length > 0) {
193
+ for (const o of l.files)
194
+ if (o.type && o.type.startsWith("image/")) {
195
+ const r = new FileReader();
196
+ r.onload = (h) => ve(h.target.result), r.readAsDataURL(o);
197
+ }
198
+ }
199
+ } catch {
200
+ }
201
+ try {
202
+ typeof J == "function" && J(l, t);
203
+ } catch {
204
+ }
169
205
  };
170
206
  oe(() => {
171
207
  const t = () => {
172
- (document.activeElement === f.current || f.current?.contains(document.activeElement)) && Ne();
208
+ (document.activeElement === p.current || p.current?.contains(document.activeElement)) && Re();
173
209
  };
174
210
  return document.addEventListener("selectionchange", t), () => document.removeEventListener("selectionchange", t);
175
211
  }, []);
176
- const [te, ne] = b({ open: !1, initialUrl: "", initialText: "", existingLinks: [] }), et = () => {
212
+ const [te, ne] = v({ open: !1, initialUrl: "", initialText: "", existingLinks: [] }), st = () => {
177
213
  let t = "";
178
214
  try {
179
215
  const l = window.getSelection();
180
216
  if (l && l.rangeCount > 0) {
181
- const r = l.getRangeAt(0);
182
- if (f.current && f.current.contains(r.commonAncestorContainer)) {
183
- q.current = r, l.isCollapsed || (t = l.toString().trim());
217
+ const o = l.getRangeAt(0);
218
+ if (p.current && p.current.contains(o.commonAncestorContainer)) {
219
+ F.current = o, l.isCollapsed || (t = l.toString().trim());
184
220
  try {
185
- const a = r.commonAncestorContainer.nodeType === 3 ? r.commonAncestorContainer.parentElement : r.commonAncestorContainer, h = a && a.closest ? a.closest("a") : null;
186
- h && f.current.contains(h) ? N.current = h : N.current = null;
221
+ const r = o.commonAncestorContainer.nodeType === 3 ? o.commonAncestorContainer.parentElement : o.commonAncestorContainer, h = r && r.closest ? r.closest("a") : null;
222
+ h && p.current.contains(h) ? N.current = h : N.current = null;
187
223
  } catch {
188
224
  N.current = null;
189
225
  }
190
226
  } else
191
- q.current = null, N.current = null;
227
+ F.current = null, N.current = null;
192
228
  }
193
229
  } catch {
194
- q.current = null, N.current = null;
230
+ F.current = null, N.current = null;
195
231
  }
196
232
  const n = [];
197
233
  try {
198
- const l = f.current;
199
- l && l.querySelectorAll("a").forEach((a) => n.push({ href: a.getAttribute("href"), text: a.innerText }));
234
+ const l = p.current;
235
+ l && l.querySelectorAll("a").forEach((r) => n.push({ href: r.getAttribute("href"), text: r.innerText }));
200
236
  } catch {
201
237
  }
202
238
  N.current ? ne({ open: !0, initialUrl: N.current.getAttribute("href") || "", initialText: N.current.innerText || "", existingLinks: n, isEditing: !0 }) : ne({ open: !0, initialUrl: "", initialText: t, existingLinks: n, isEditing: !1 });
203
- }, tt = ({ url: t, text: n }) => {
239
+ }, dt = ({ url: t, text: n }) => {
204
240
  if (ne((l) => ({ ...l, open: !1 })), !t) {
205
- q.current = null, N.current = null;
241
+ F.current = null, N.current = null;
206
242
  return;
207
243
  }
208
244
  try {
209
245
  const l = window.getSelection();
210
- l.removeAllRanges(), q.current && l.addRange(q.current);
246
+ l.removeAllRanges(), F.current && l.addRange(F.current);
211
247
  } catch {
212
248
  }
213
249
  try {
@@ -215,519 +251,519 @@ const It = ({ isOpen: J, onClose: z, onInsert: _, onRemove: re, isEditing: he =
215
251
  try {
216
252
  N.current.setAttribute("href", t), N.current.setAttribute("target", "_blank"), N.current.setAttribute("rel", "noopener noreferrer"), N.current.innerText = n || t;
217
253
  } catch {
218
- const l = (a) => String(a).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;"), r = `<a href="${l(t)}" target="_blank" rel="noopener noreferrer" contenteditable="false">${l(n || t)}</a>`;
219
- v("insertHTML", r);
254
+ const l = (r) => String(r).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;"), o = `<a href="${l(t)}" target="_blank" rel="noopener noreferrer" contenteditable="false">${l(n || t)}</a>`;
255
+ y("insertHTML", o);
220
256
  }
221
- else if (f.current) {
222
- f.current.focus();
223
- const l = (a) => String(a).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;"), r = `<a href="${l(t)}" target="_blank" rel="noopener noreferrer" contenteditable="false">${l(n || t)}</a>`;
224
- v("insertHTML", r);
257
+ else if (p.current) {
258
+ p.current.focus();
259
+ const l = (r) => String(r).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;"), o = `<a href="${l(t)}" target="_blank" rel="noopener noreferrer" contenteditable="false">${l(n || t)}</a>`;
260
+ y("insertHTML", o);
225
261
  }
226
262
  } catch {
227
263
  try {
228
- v("createLink", t);
264
+ y("createLink", t);
229
265
  } catch {
230
266
  }
231
267
  }
232
- q.current = null, N.current = null;
233
- }, nt = () => {
268
+ F.current = null, N.current = null;
269
+ }, ht = () => {
234
270
  if (!N.current) return;
235
271
  const t = N.current, n = t.innerText || t.getAttribute("href") || "", l = document.createTextNode(n);
236
- t.parentNode.replaceChild(l, t), N.current = null, ne((r) => ({ ...r, open: !1 }));
237
- }, lt = (t) => {
238
- v("foreColor", t.target.value);
239
- }, ot = (t) => {
240
- v("hiliteColor", t.target.value);
241
- }, rt = (t) => {
272
+ t.parentNode.replaceChild(l, t), N.current = null, ne((o) => ({ ...o, open: !1 }));
273
+ }, ut = (t) => {
274
+ y("foreColor", t.target.value);
275
+ }, mt = (t) => {
276
+ y("hiliteColor", t.target.value);
277
+ }, pt = (t) => {
242
278
  const n = t && t.target ? t.target.value : t;
243
- v("fontSize", n), Se(String(n));
244
- }, at = (t) => {
279
+ y("fontSize", n), He(String(n));
280
+ }, ft = (t) => {
245
281
  const n = t && t.target ? t.target.value : t;
246
- v("fontName", n), Le(String(n));
247
- }, ct = () => {
248
- F(!0);
249
- }, it = () => {
250
- D && (Me(D), Y(""), F(!1));
251
- }, st = (t) => {
282
+ y("fontName", n), Ae(String(n));
283
+ }, gt = () => {
284
+ V(!0);
285
+ }, yt = () => {
286
+ pe && (ve(pe), xe(""), V(!1));
287
+ }, vt = (t) => {
252
288
  const n = t.target.files?.[0];
253
289
  if (n && n.type.startsWith("image/")) {
254
290
  const l = new FileReader();
255
- l.onload = (r) => {
256
- const a = r.target?.result;
257
- Me(a), F(!1);
291
+ l.onload = (o) => {
292
+ const r = o.target?.result;
293
+ ve(r), V(!1);
258
294
  }, l.readAsDataURL(n);
259
295
  }
260
- }, Me = (t) => {
261
- if (!f.current) return;
262
- f.current.focus();
296
+ }, ve = (t) => {
297
+ if (!p.current) return;
298
+ p.current.focus();
263
299
  const n = document.createElement("div");
264
300
  n.className = "editable-image-wrap", n.contentEditable = "false";
265
301
  const l = document.createElement("img");
266
302
  l.src = t, l.alt = "Image", l.style.maxWidth = "100%", l.style.height = "auto", n.appendChild(l);
267
303
  try {
268
- const r = window.getSelection();
269
- if (r && r.rangeCount > 0) {
270
- const a = r.getRangeAt(0);
271
- a.deleteContents(), a.insertNode(n), a.setStartAfter(n), a.collapse(!0), r.removeAllRanges(), r.addRange(a);
304
+ const o = window.getSelection();
305
+ if (o && o.rangeCount > 0) {
306
+ const r = o.getRangeAt(0);
307
+ r.deleteContents(), r.insertNode(n), r.setStartAfter(n), r.collapse(!0), o.removeAllRanges(), o.addRange(r);
272
308
  } else
273
- f.current.appendChild(n);
309
+ p.current.appendChild(n);
274
310
  } catch {
275
- f.current.appendChild(n);
311
+ p.current.appendChild(n);
276
312
  }
277
- setTimeout(() => Ee(n), 50);
278
- }, Ee = (t) => {
313
+ setTimeout(() => Be(n), 50);
314
+ }, Be = (t) => {
279
315
  if (!t || t.dataset.enhanced) return;
280
316
  const n = t.querySelector("img");
281
317
  if (!n) return;
282
318
  const l = (u) => {
283
319
  u.stopPropagation();
284
320
  try {
285
- f.current?.querySelectorAll(".editable-image-wrap")?.forEach((S) => S.classList.remove("selected"));
321
+ p.current?.querySelectorAll(".editable-image-wrap")?.forEach((L) => L.classList.remove("selected"));
286
322
  } catch {
287
323
  }
288
324
  t.classList.add("selected");
289
325
  };
290
326
  t.addEventListener("click", l);
291
- const r = document.createElement("div");
292
- r.className = "image-controls";
293
- const a = (u, x, S) => {
294
- const R = document.createElement("button");
295
- return R.type = "button", R.className = "image-control-btn", R.title = u, R.innerHTML = x, R.addEventListener("click", (U) => {
296
- U.stopPropagation(), S();
297
- }), R;
327
+ const o = document.createElement("div");
328
+ o.className = "image-controls";
329
+ const r = (u, x, L) => {
330
+ const E = document.createElement("button");
331
+ return E.type = "button", E.className = "image-control-btn", E.title = u, E.innerHTML = x, E.addEventListener("click", (q) => {
332
+ q.stopPropagation(), L();
333
+ }), E;
298
334
  }, h = () => {
299
335
  const u = document.createElement("div");
300
336
  return u.className = "image-control-divider", u;
301
337
  };
302
- r.appendChild(a("Align Left", "&#8676;", () => {
338
+ o.appendChild(r("Align Left", "&#8676;", () => {
303
339
  t.style.display = "block", t.style.marginLeft = "0", t.style.marginRight = "auto";
304
- })), r.appendChild(a("Center", "&#8801;", () => {
340
+ })), o.appendChild(r("Center", "&#8801;", () => {
305
341
  t.style.display = "block", t.style.marginLeft = "auto", t.style.marginRight = "auto";
306
- })), r.appendChild(a("Align Right", "&#8677;", () => {
342
+ })), o.appendChild(r("Align Right", "&#8677;", () => {
307
343
  t.style.display = "block", t.style.marginLeft = "auto", t.style.marginRight = "0";
308
- })), r.appendChild(h()), r.appendChild(a("Original Size", "1:1", () => {
344
+ })), o.appendChild(h()), o.appendChild(r("Original Size", "1:1", () => {
309
345
  n.style.width = "", n.style.height = "", n.style.maxWidth = "100%";
310
- })), r.appendChild(a("50% Width", "50%", () => {
346
+ })), o.appendChild(r("50% Width", "50%", () => {
311
347
  n.style.width = "50%", n.style.height = "auto";
312
- })), r.appendChild(a("75% Width", "75%", () => {
348
+ })), o.appendChild(r("75% Width", "75%", () => {
313
349
  n.style.width = "75%", n.style.height = "auto";
314
- })), r.appendChild(h()), r.appendChild(a("Delete Image", "×", () => {
350
+ })), o.appendChild(h()), o.appendChild(r("Delete Image", "×", () => {
315
351
  confirm("Delete this image?") && t.remove();
316
- })), t.appendChild(r), ["nw", "ne", "sw", "se"].forEach((u) => {
352
+ })), t.appendChild(o), ["nw", "ne", "sw", "se"].forEach((u) => {
317
353
  const x = document.createElement("div");
318
- x.className = `image-resize-handle ${u}`, x.addEventListener("mousedown", (S) => {
319
- S.preventDefault(), S.stopPropagation(), dt(S, n, u);
354
+ x.className = `image-resize-handle ${u}`, x.addEventListener("mousedown", (L) => {
355
+ L.preventDefault(), L.stopPropagation(), bt(L, n, u);
320
356
  }), t.appendChild(x);
321
357
  }), t.dataset.enhanced = "1";
322
- }, dt = (t, n, l) => {
323
- const r = t.clientX, a = n.offsetWidth, h = n.offsetHeight, u = a / h, x = (R) => {
324
- const U = R.clientX - r;
325
- let A = a;
326
- l.includes("e") ? A = Math.max(50, a + U) : l.includes("w") && (A = Math.max(50, a - U));
327
- const K = A / u;
328
- n.style.width = A + "px", n.style.height = K + "px", n.style.maxWidth = "none";
329
- }, S = () => {
330
- document.removeEventListener("mousemove", x), document.removeEventListener("mouseup", S), document.body.style.cursor = "";
358
+ }, bt = (t, n, l) => {
359
+ const o = t.clientX, r = n.offsetWidth, h = n.offsetHeight, u = r / h, x = (E) => {
360
+ const q = E.clientX - o;
361
+ let A = r;
362
+ l.includes("e") ? A = Math.max(50, r + q) : l.includes("w") && (A = Math.max(50, r - q));
363
+ const G = A / u;
364
+ n.style.width = A + "px", n.style.height = G + "px", n.style.maxWidth = "none";
365
+ }, L = () => {
366
+ document.removeEventListener("mousemove", x), document.removeEventListener("mouseup", L), document.body.style.cursor = "";
331
367
  };
332
- document.addEventListener("mousemove", x), document.addEventListener("mouseup", S);
368
+ document.addEventListener("mousemove", x), document.addEventListener("mouseup", L);
333
369
  };
334
370
  oe(() => {
335
- const t = f.current;
371
+ const t = p.current;
336
372
  if (!t) return;
337
373
  const n = (l) => {
338
374
  try {
339
- const r = l.target.closest && l.target.closest("a");
340
- if (r && r.getAttribute("href")) {
341
- const a = r.getAttribute("href");
375
+ const o = l.target.closest && l.target.closest("a");
376
+ if (o && o.getAttribute("href")) {
377
+ const r = o.getAttribute("href");
342
378
  if (l.metaKey || l.ctrlKey || l.shiftKey) return;
343
- l.preventDefault(), window.open(a, "_blank");
379
+ l.preventDefault(), window.open(r, "_blank");
344
380
  }
345
381
  } catch {
346
382
  }
347
383
  };
348
384
  return t.addEventListener("click", n), () => t.removeEventListener("click", n);
349
385
  }, []);
350
- const ht = (t) => {
351
- v("formatBlock", t), fe(t);
352
- }, Re = (t, n) => {
386
+ const Ct = (t) => {
387
+ y("formatBlock", t), ye(t);
388
+ }, We = (t, n) => {
353
389
  try {
354
390
  const h = window.getSelection();
355
- if (h.removeAllRanges(), q.current)
356
- h.addRange(q.current);
357
- else if (f.current) {
358
- f.current.focus();
391
+ if (h.removeAllRanges(), F.current)
392
+ h.addRange(F.current);
393
+ else if (p.current) {
394
+ p.current.focus();
359
395
  const u = document.createRange();
360
- u.selectNodeContents(f.current), u.collapse(!1), h.removeAllRanges(), h.addRange(u);
396
+ u.selectNodeContents(p.current), u.collapse(!1), h.removeAllRanges(), h.addRange(u);
361
397
  }
362
398
  } catch {
363
399
  }
364
- const l = typeof t == "number" ? t : be, r = typeof n == "number" ? n : xe;
365
- let a = '<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse; width: auto; margin: 16px 0;">';
366
- a += "<thead><tr>";
367
- for (let h = 0; h < r; h++)
368
- a += `<th style="border: 1px solid #cbd5e1; padding: 12px 16px; background: #f8f9fa; text-align: left; font-weight: 700;">Header ${h + 1}</th>`;
369
- a += "</tr></thead>", a += "<tbody>";
400
+ const l = typeof t == "number" ? t : Le, o = typeof n == "number" ? n : Te;
401
+ let r = '<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse; width: auto; margin: 16px 0;">';
402
+ r += "<thead><tr>";
403
+ for (let h = 0; h < o; h++)
404
+ r += `<th style="border: 1px solid #cbd5e1; padding: 12px 16px; background: #f8f9fa; text-align: left; font-weight: 700;">Header ${h + 1}</th>`;
405
+ r += "</tr></thead>", r += "<tbody>";
370
406
  for (let h = 0; h < l; h++) {
371
- a += "<tr>";
372
- for (let u = 0; u < r; u++)
373
- a += `<td style="border: 1px solid #cbd5e1; padding: 12px 16px; background: #fff;">Cell ${h + 1}-${u + 1}</td>`;
374
- a += "</tr>";
407
+ r += "<tr>";
408
+ for (let u = 0; u < o; u++)
409
+ r += `<td style="border: 1px solid #cbd5e1; padding: 12px 16px; background: #fff;">Cell ${h + 1}-${u + 1}</td>`;
410
+ r += "</tr>";
375
411
  }
376
- a += "</tbody></table>", v("insertHTML", a), setTimeout(() => {
412
+ r += "</tbody></table>", y("insertHTML", r), setTimeout(() => {
377
413
  try {
378
- const h = f.current;
414
+ const h = p.current;
379
415
  if (!h) return;
380
416
  const u = h.querySelector("table:last-of-type");
381
- u && Ae(u);
417
+ u && Fe(u);
382
418
  } catch {
383
419
  }
384
- }, 20), ae(!1), Ce(3), we(3);
385
- }, ut = (t, n) => {
386
- ue({ rows: t + 1, cols: n + 1 });
387
- }, mt = (t, n) => {
388
- Re(t + 1, n + 1), G(!1);
389
- }, ge = () => {
390
- if (!X || !f.current) {
420
+ }, 20), ie(!1), Se(3), Me(3);
421
+ }, xt = (t, n) => {
422
+ Xe({ rows: t + 1, cols: n + 1 });
423
+ }, wt = (t, n) => {
424
+ We(t + 1, n + 1), ke(!1);
425
+ }, be = () => {
426
+ if (!_ || !p.current) {
391
427
  B("Enter text to find");
392
428
  return;
393
429
  }
394
430
  try {
395
- const t = window.find(X, !1, !1, !1, !1, !0, !1);
431
+ const t = window.find(_, !1, !1, !1, !1, !0, !1);
396
432
  B(t ? "Found" : "No matches found");
397
433
  } catch {
398
434
  B("Search not available in this browser");
399
435
  }
400
- }, pt = () => {
401
- if (!X || !f.current) {
436
+ }, kt = () => {
437
+ if (!_ || !p.current) {
402
438
  B("Enter text to find");
403
439
  return;
404
440
  }
405
441
  try {
406
442
  const t = window.getSelection();
407
- if (t && t.toString().toLowerCase() === X.toLowerCase()) {
443
+ if (t && t.toString().toLowerCase() === _.toLowerCase()) {
408
444
  const n = t.getRangeAt(0);
409
- n.deleteContents(), n.insertNode(document.createTextNode(pe)), B("Replaced 1 occurrence"), setTimeout(() => ge(), 100);
445
+ n.deleteContents(), n.insertNode(document.createTextNode(ge)), B("Replaced 1 occurrence"), setTimeout(() => be(), 100);
410
446
  } else
411
- ge();
447
+ be();
412
448
  } catch {
413
449
  B("Replace failed");
414
450
  }
415
- }, ft = () => {
416
- if (!X || !f.current) {
451
+ }, Nt = () => {
452
+ if (!_ || !p.current) {
417
453
  B("Enter text to find");
418
454
  return;
419
455
  }
420
456
  try {
421
457
  let t = 0;
422
- const n = f.current.textContent || "", l = new RegExp(X.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "gi"), r = n.match(l);
423
- if (!r || r.length === 0) {
458
+ const n = p.current.textContent || "", l = new RegExp(_.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "gi"), o = n.match(l);
459
+ if (!o || o.length === 0) {
424
460
  B("No matches found");
425
461
  return;
426
462
  }
427
- const a = document.createTreeWalker(
428
- f.current,
463
+ const r = document.createTreeWalker(
464
+ p.current,
429
465
  NodeFilter.SHOW_TEXT,
430
466
  null,
431
467
  !1
432
468
  ), h = [];
433
469
  let u;
434
- for (; u = a.nextNode(); )
470
+ for (; u = r.nextNode(); )
435
471
  l.test(u.nodeValue) && h.push(u);
436
472
  h.forEach((x) => {
437
- const S = x.nodeValue.replace(l, pe), R = (x.nodeValue.match(l) || []).length;
438
- t += R, x.nodeValue = S;
439
- }), z(f.current.innerHTML), B(`Replaced ${t} occurrence(s)`);
473
+ const L = x.nodeValue.replace(l, ge), E = (x.nodeValue.match(l) || []).length;
474
+ t += E, x.nodeValue = L;
475
+ }), z(p.current.innerHTML), B(`Replaced ${t} occurrence(s)`);
440
476
  } catch {
441
477
  B("Replace all failed");
442
478
  }
443
- }, Ae = (t) => {
479
+ }, Fe = (t) => {
444
480
  if (!t || t.dataset.enhanced) return;
445
481
  const n = document.createElement("div");
446
482
  n.className = "editable-table-wrap", t.parentNode.insertBefore(n, t), n.appendChild(t);
447
- const l = (o) => {
448
- const d = o.target.closest("td,th");
483
+ const l = (a) => {
484
+ const d = a.target.closest("td,th");
449
485
  if (d) {
450
- if (o.shiftKey && E.current && E.current !== d) {
486
+ if (a.shiftKey && M.current && M.current !== d) {
451
487
  try {
452
- f.current.querySelectorAll(".selected-cell").forEach((s) => s.classList.remove("selected-cell"));
488
+ p.current.querySelectorAll(".selected-cell").forEach((s) => s.classList.remove("selected-cell"));
453
489
  } catch {
454
490
  }
455
- Ht(E.current, d, t), E.current = d;
491
+ zt(M.current, d, t), M.current = d;
456
492
  return;
457
493
  }
458
494
  try {
459
- f.current.querySelectorAll(".selected-cell").forEach((s) => s.classList.remove("selected-cell"));
495
+ p.current.querySelectorAll(".selected-cell").forEach((s) => s.classList.remove("selected-cell"));
460
496
  } catch {
461
497
  }
462
- d.classList.add("selected-cell"), E.current = d;
498
+ d.classList.add("selected-cell"), M.current = d;
463
499
  }
464
- }, r = (o) => {
500
+ }, o = (a) => {
465
501
  try {
466
- f.current?.querySelectorAll(".editable-table-wrap")?.forEach((c) => c.classList.remove("selected"));
502
+ p.current?.querySelectorAll(".editable-table-wrap")?.forEach((c) => c.classList.remove("selected"));
467
503
  } catch {
468
504
  }
469
- n.classList.add("selected"), l(o);
505
+ n.classList.add("selected"), l(a);
470
506
  };
471
- t.addEventListener("click", r);
507
+ t.addEventListener("click", o);
472
508
  try {
473
509
  t.querySelectorAll("td,th").forEach((d) => d.addEventListener("click", l));
474
510
  } catch {
475
511
  }
476
- const a = document.createElement("div");
477
- a.className = "table-controls";
478
- const h = (o, d, c) => {
512
+ const r = document.createElement("div");
513
+ r.className = "table-controls";
514
+ const h = (a, d, c) => {
479
515
  const s = document.createElement("button");
480
- return s.type = "button", s.className = "table-control-btn", s.title = o, s.innerHTML = d, s.addEventListener("click", (m) => {
516
+ return s.type = "button", s.className = "table-control-btn", s.title = a, s.innerHTML = d, s.addEventListener("click", (m) => {
481
517
  m.stopPropagation(), c(t);
482
518
  }), s;
483
519
  };
484
- a.appendChild(h("Add Row Below", "+R", (o) => He(o))), a.appendChild(h("Add Column Right", "+C", (o) => Ie(o))), a.appendChild(h("Delete Row", "-R", (o) => vt(o))), a.appendChild(h("Delete Column", "-C", (o) => yt(o))), a.appendChild(h("Delete Table", "×", (o) => Be(o)));
520
+ r.appendChild(h("Add Row Below", "+R", (a) => qe(a))), r.appendChild(h("Add Column Right", "+C", (a) => Ue(a))), r.appendChild(h("Delete Row", "-R", (a) => St(a))), r.appendChild(h("Delete Column", "-C", (a) => Tt(a))), r.appendChild(h("Delete Table", "×", (a) => $e(a)));
485
521
  const u = document.createElement("input");
486
- u.type = "color", u.style.display = "none", u.addEventListener("input", (o) => {
522
+ u.type = "color", u.style.display = "none", u.addEventListener("input", (a) => {
487
523
  try {
488
- const d = o.target.value;
489
- E.current && (E.current.style.background = d);
524
+ const d = a.target.value;
525
+ M.current && (M.current.style.background = d);
490
526
  } catch {
491
527
  }
492
528
  });
493
529
  const x = document.createElement("input");
494
- x.type = "color", x.style.display = "none", x.addEventListener("input", (o) => {
530
+ x.type = "color", x.style.display = "none", x.addEventListener("input", (a) => {
495
531
  try {
496
- const d = o.target.value;
532
+ const d = a.target.value;
497
533
  let c = [];
498
534
  const s = t.querySelector("thead");
499
535
  s ? c = Array.from(s.querySelectorAll("th")) : t.rows && t.rows[0] && (c = Array.from(t.rows[0].cells)), c.forEach((m) => {
500
- m.style.background = d, m.style.color = R(d);
536
+ m.style.background = d, m.style.color = E(d);
501
537
  });
502
538
  } catch {
503
539
  }
504
540
  });
505
- const S = () => {
541
+ const L = () => {
506
542
  try {
507
- const o = t.querySelector("thead");
508
- (o ? Array.from(o.querySelectorAll("th")) : t.rows[0] ? Array.from(t.rows[0].cells) : []).forEach((c) => {
543
+ const a = t.querySelector("thead");
544
+ (a ? Array.from(a.querySelectorAll("th")) : t.rows[0] ? Array.from(t.rows[0].cells) : []).forEach((c) => {
509
545
  c.style.background = "", c.style.color = "";
510
546
  });
511
547
  } catch {
512
548
  }
513
- }, R = (o) => {
514
- if (!o) return "#000";
515
- const d = o.replace("#", ""), c = parseInt(d.substr(0, 2), 16), s = parseInt(d.substr(2, 2), 16), m = parseInt(d.substr(4, 2), 16);
549
+ }, E = (a) => {
550
+ if (!a) return "#000";
551
+ const d = a.replace("#", ""), c = parseInt(d.substr(0, 2), 16), s = parseInt(d.substr(2, 2), 16), m = parseInt(d.substr(4, 2), 16);
516
552
  return (c * 299 + s * 587 + m * 114) / 1e3 >= 128 ? "#000" : "#fff";
517
- }, U = (o) => {
553
+ }, q = (a) => {
518
554
  const d = [];
519
- for (let c = 0; c < o.rows.length; c++) {
520
- const s = o.rows[c];
555
+ for (let c = 0; c < a.rows.length; c++) {
556
+ const s = a.rows[c];
521
557
  d[c] = d[c] || [];
522
558
  let m = 0;
523
- for (let p = 0; p < s.cells.length; p++) {
524
- const g = s.cells[p];
559
+ for (let f = 0; f < s.cells.length; f++) {
560
+ const g = s.cells[f];
525
561
  for (; d[c][m]; ) m++;
526
- const w = parseInt(g.getAttribute("rowspan") || g.rowSpan || 1, 10), y = parseInt(g.getAttribute("colspan") || g.colSpan || 1, 10);
562
+ const w = parseInt(g.getAttribute("rowspan") || g.rowSpan || 1, 10), b = parseInt(g.getAttribute("colspan") || g.colSpan || 1, 10);
527
563
  for (let k = 0; k < w; k++)
528
- for (let C = 0; C < y; C++)
564
+ for (let C = 0; C < b; C++)
529
565
  d[c + k] = d[c + k] || [], d[c + k][m + C] = g;
530
- m += y;
566
+ m += b;
531
567
  }
532
568
  }
533
569
  return d;
534
- }, A = (o, d) => {
535
- const c = U(o);
570
+ }, A = (a, d) => {
571
+ const c = q(a);
536
572
  for (let s = 0; s < c.length; s++) {
537
573
  const m = c[s] || [];
538
- for (let p = 0; p < m.length; p++)
539
- if (m[p] === d) return { r: s, c: p, matrix: c };
574
+ for (let f = 0; f < m.length; f++)
575
+ if (m[f] === d) return { r: s, c: f, matrix: c };
540
576
  }
541
577
  return null;
542
- }, K = (o, d) => {
543
- const c = U(o);
544
- let s = 1 / 0, m = 1 / 0, p = -1 / 0, g = -1 / 0;
578
+ }, G = (a, d) => {
579
+ const c = q(a);
580
+ let s = 1 / 0, m = 1 / 0, f = -1 / 0, g = -1 / 0;
545
581
  const w = new Set(d);
546
- for (let M = 0; M < c.length; M++)
547
- for (let H = 0; H < (c[M] || []).length; H++) {
548
- const $ = c[M][H];
549
- !$ || !w.has($) || (s = Math.min(s, M), m = Math.min(m, H), p = Math.max(p, M), g = Math.max(g, H));
582
+ for (let T = 0; T < c.length; T++)
583
+ for (let H = 0; H < (c[T] || []).length; H++) {
584
+ const $ = c[T][H];
585
+ !$ || !w.has($) || (s = Math.min(s, T), m = Math.min(m, H), f = Math.max(f, T), g = Math.max(g, H));
550
586
  }
551
587
  if (s === 1 / 0) return;
552
- const y = c[s][m], k = /* @__PURE__ */ new Set();
588
+ const b = c[s][m], k = /* @__PURE__ */ new Set();
553
589
  let C = "";
554
- for (let M = s; M <= p; M++)
590
+ for (let T = s; T <= f; T++)
555
591
  for (let H = m; H <= g; H++) {
556
- const $ = c[M][H];
557
- $ && ($ !== y && k.add($), C.includes($.innerHTML) || (C += (C ? "<br/>" : "") + $.innerHTML));
592
+ const $ = c[T][H];
593
+ $ && ($ !== b && k.add($), C.includes($.innerHTML) || (C += (C ? "<br/>" : "") + $.innerHTML));
558
594
  }
559
- const T = p - s + 1, W = g - m + 1;
595
+ const S = f - s + 1, W = g - m + 1;
560
596
  try {
561
- y.rowSpan = T, y.colSpan = W, y.innerHTML = C;
597
+ b.rowSpan = S, b.colSpan = W, b.innerHTML = C;
562
598
  } catch {
563
599
  }
564
- k.forEach((M) => {
600
+ k.forEach((T) => {
565
601
  try {
566
- M.remove();
602
+ T.remove();
567
603
  } catch {
568
604
  }
569
605
  });
570
606
  try {
571
- y.classList.add("selected-cell"), E.current = y;
607
+ b.classList.add("selected-cell"), M.current = b;
572
608
  } catch {
573
609
  }
574
- }, I = (o, d, c) => {
575
- const s = A(c, o);
610
+ }, I = (a, d, c) => {
611
+ const s = A(c, a);
576
612
  if (!s) return;
577
- const { r: m, c: p, matrix: g } = s, w = parseInt(o.getAttribute("rowspan") || o.rowSpan || 1, 10), y = parseInt(o.getAttribute("colspan") || o.colSpan || 1, 10);
578
- let k = m, C = p;
579
- if (d === "right" && (C = p + y), d === "left" && (C = p - 1), d === "down" && (k = m + w), d === "up" && (k = m - 1), !g[k] || typeof g[k][C] > "u") return;
580
- const T = g[k][C];
581
- if (!T || T === o) return;
582
- const W = Math.min(m, k), M = Math.max(m, k + (parseInt(T.getAttribute("rowspan") || T.rowSpan || 1, 10) - 1)), H = Math.min(p, C), $ = Math.max(p + (y - 1), C + (parseInt(T.getAttribute("colspan") || T.colSpan || 1, 10) - 1)), Pe = /* @__PURE__ */ new Set();
583
- for (let de = W; de <= M; de++)
584
- for (let ve = H; ve <= $; ve++) {
585
- const $e = g[de] && g[de][ve];
586
- $e && Pe.add($e);
613
+ const { r: m, c: f, matrix: g } = s, w = parseInt(a.getAttribute("rowspan") || a.rowSpan || 1, 10), b = parseInt(a.getAttribute("colspan") || a.colSpan || 1, 10);
614
+ let k = m, C = f;
615
+ if (d === "right" && (C = f + b), d === "left" && (C = f - 1), d === "down" && (k = m + w), d === "up" && (k = m - 1), !g[k] || typeof g[k][C] > "u") return;
616
+ const S = g[k][C];
617
+ if (!S || S === a) return;
618
+ const W = Math.min(m, k), T = Math.max(m, k + (parseInt(S.getAttribute("rowspan") || S.rowSpan || 1, 10) - 1)), H = Math.min(f, C), $ = Math.max(f + (b - 1), C + (parseInt(S.getAttribute("colspan") || S.colSpan || 1, 10) - 1)), Ve = /* @__PURE__ */ new Set();
619
+ for (let ue = W; ue <= T; ue++)
620
+ for (let Ce = H; Ce <= $; Ce++) {
621
+ const je = g[ue] && g[ue][Ce];
622
+ je && Ve.add(je);
587
623
  }
588
- K(c, Pe);
589
- }, We = (o, d, c) => {
624
+ G(c, Ve);
625
+ }, Pe = (a, d, c) => {
590
626
  try {
591
627
  if (d === "vertical") {
592
- const s = parseInt(o.getAttribute("rowspan") || o.rowSpan || 1, 10);
628
+ const s = parseInt(a.getAttribute("rowspan") || a.rowSpan || 1, 10);
593
629
  if (s <= 1) return;
594
- const m = A(c, o);
630
+ const m = A(c, a);
595
631
  if (!m) return;
596
- const { r: p, c: g } = m;
597
- o.rowSpan = 1;
632
+ const { r: f, c: g } = m;
633
+ a.rowSpan = 1;
598
634
  for (let w = 1; w < s; w++) {
599
- const y = c.rows[p + w];
600
- if (y) {
635
+ const b = c.rows[f + w];
636
+ if (b) {
601
637
  const k = (() => {
602
- let T = 0;
603
- for (let W = 0; W < y.cells.length; W++) {
604
- const M = y.cells[W], H = parseInt(M.getAttribute("colspan") || M.colSpan || 1, 10);
605
- if (T >= g) return W;
606
- T += H;
638
+ let S = 0;
639
+ for (let W = 0; W < b.cells.length; W++) {
640
+ const T = b.cells[W], H = parseInt(T.getAttribute("colspan") || T.colSpan || 1, 10);
641
+ if (S >= g) return W;
642
+ S += H;
607
643
  }
608
- return y.cells.length;
609
- })(), C = y.insertCell(k);
644
+ return b.cells.length;
645
+ })(), C = b.insertCell(k);
610
646
  C.innerHTML = "";
611
647
  }
612
648
  }
613
649
  } else if (d === "horizontal") {
614
- const s = parseInt(o.getAttribute("colspan") || o.colSpan || 1, 10);
650
+ const s = parseInt(a.getAttribute("colspan") || a.colSpan || 1, 10);
615
651
  if (s <= 1) return;
616
- const m = o.parentElement, p = Array.prototype.indexOf.call(m.children, o);
617
- o.colSpan = 1;
652
+ const m = a.parentElement, f = Array.prototype.indexOf.call(m.children, a);
653
+ a.colSpan = 1;
618
654
  for (let g = 1; g < s; g++) {
619
- const w = m.insertCell(p + g);
655
+ const w = m.insertCell(f + g);
620
656
  w.innerHTML = "";
621
657
  }
622
658
  }
623
659
  } catch {
624
660
  }
625
- }, Et = (o, d) => {
626
- const c = A(d, o);
661
+ }, Ut = (a, d) => {
662
+ const c = A(d, a);
627
663
  if (!c) return;
628
664
  const { r: s, matrix: m } = c;
629
665
  try {
630
- f.current.querySelectorAll(".selected-cell").forEach((g) => g.classList.remove("selected-cell"));
666
+ p.current.querySelectorAll(".selected-cell").forEach((g) => g.classList.remove("selected-cell"));
631
667
  } catch {
632
668
  }
633
- for (let p = 0; p < (m[s] || []).length; p++) {
634
- const g = m[s][p];
669
+ for (let f = 0; f < (m[s] || []).length; f++) {
670
+ const g = m[s][f];
635
671
  g && g.classList.add("selected-cell");
636
672
  }
637
- }, Rt = (o, d) => {
638
- const c = A(d, o);
673
+ }, $t = (a, d) => {
674
+ const c = A(d, a);
639
675
  if (!c) return;
640
676
  const { c: s, matrix: m } = c;
641
677
  try {
642
- f.current.querySelectorAll(".selected-cell").forEach((g) => g.classList.remove("selected-cell"));
678
+ p.current.querySelectorAll(".selected-cell").forEach((g) => g.classList.remove("selected-cell"));
643
679
  } catch {
644
680
  }
645
- for (let p = 0; p < m.length; p++) {
646
- const g = m[p] && m[p][s];
681
+ for (let f = 0; f < m.length; f++) {
682
+ const g = m[f] && m[f][s];
647
683
  g && g.classList.add("selected-cell");
648
684
  }
649
- }, At = (o) => {
685
+ }, Pt = (a) => {
650
686
  try {
651
- f.current.querySelectorAll(".selected-cell").forEach((c) => c.classList.remove("selected-cell"));
687
+ p.current.querySelectorAll(".selected-cell").forEach((c) => c.classList.remove("selected-cell"));
652
688
  } catch {
653
689
  }
654
690
  try {
655
- o.querySelectorAll("td,th").forEach((c) => c.classList.add("selected-cell"));
691
+ a.querySelectorAll("td,th").forEach((c) => c.classList.add("selected-cell"));
656
692
  } catch {
657
693
  }
658
- }, Ht = (o, d, c) => {
659
- const s = A(c, o), m = A(c, d);
694
+ }, zt = (a, d, c) => {
695
+ const s = A(c, a), m = A(c, d);
660
696
  if (!s || !m) return;
661
- const p = Math.min(s.r, m.r), g = Math.max(s.r, m.r), w = Math.min(s.c, m.c), y = Math.max(s.c, m.c);
697
+ const f = Math.min(s.r, m.r), g = Math.max(s.r, m.r), w = Math.min(s.c, m.c), b = Math.max(s.c, m.c);
662
698
  try {
663
- f.current.querySelectorAll(".selected-cell").forEach((T) => T.classList.remove("selected-cell"));
699
+ p.current.querySelectorAll(".selected-cell").forEach((S) => S.classList.remove("selected-cell"));
664
700
  } catch {
665
701
  }
666
702
  const k = s.matrix;
667
- for (let C = p; C <= g; C++)
668
- for (let T = w; T <= y; T++) {
669
- const W = k[C] && k[C][T];
703
+ for (let C = f; C <= g; C++)
704
+ for (let S = w; S <= b; S++) {
705
+ const W = k[C] && k[C][S];
670
706
  W && W.classList.add("selected-cell");
671
707
  }
672
708
  };
673
- a.appendChild(u), a.appendChild(h("Cell Color", "■", () => {
674
- if (!E.current) {
709
+ r.appendChild(u), r.appendChild(h("Cell Color", "■", () => {
710
+ if (!M.current) {
675
711
  alert("Select a table cell first");
676
712
  return;
677
713
  }
678
714
  u.click();
679
- })), a.appendChild(x), a.appendChild(h("Header Color", "🎨", () => {
715
+ })), r.appendChild(x), r.appendChild(h("Header Color", "🎨", () => {
680
716
  try {
681
- const o = t.rows[0];
682
- if (!o) return alert("Table has no rows");
683
- if (!(o.cells[0] && o.cells[0].tagName.toLowerCase() === "th")) {
717
+ const a = t.rows[0];
718
+ if (!a) return alert("Table has no rows");
719
+ if (!(a.cells[0] && a.cells[0].tagName.toLowerCase() === "th")) {
684
720
  const c = document.createElement("thead"), s = t.rows[0], m = document.createElement("tr");
685
- for (let p = 0; p < s.cells.length; p++) {
721
+ for (let f = 0; f < s.cells.length; f++) {
686
722
  const g = document.createElement("th");
687
- g.innerHTML = s.cells[p].innerHTML, m.appendChild(g);
723
+ g.innerHTML = s.cells[f].innerHTML, m.appendChild(g);
688
724
  }
689
725
  c.appendChild(m), t.deleteRow(0), t.insertBefore(c, t.firstChild);
690
726
  }
691
727
  } catch {
692
728
  }
693
729
  x.click();
694
- })), a.appendChild(h("Clear Header Color", "✖", () => {
695
- S();
696
- })), a.appendChild(h("Toggle Header", "H", () => {
730
+ })), r.appendChild(h("Clear Header Color", "✖", () => {
731
+ L();
732
+ })), r.appendChild(h("Toggle Header", "H", () => {
697
733
  try {
698
- const o = t.rows[0];
699
- if (!o) return;
700
- if (o.cells[0] && o.cells[0].tagName.toLowerCase() === "th") {
734
+ const a = t.rows[0];
735
+ if (!a) return;
736
+ if (a.cells[0] && a.cells[0].tagName.toLowerCase() === "th") {
701
737
  const c = document.createElement("tbody");
702
738
  for (let s = 0; s < t.rows.length; s++) {
703
- const m = t.rows[0], p = document.createElement("tr"), g = m.cells;
739
+ const m = t.rows[0], f = document.createElement("tr"), g = m.cells;
704
740
  for (let w = 0; w < g.length; w++) {
705
- const y = document.createElement("td");
706
- y.innerHTML = g[w].innerHTML, y.style.cssText = g[w].style.cssText, p.appendChild(y);
741
+ const b = document.createElement("td");
742
+ b.innerHTML = g[w].innerHTML, b.style.cssText = g[w].style.cssText, f.appendChild(b);
707
743
  }
708
- c.appendChild(p), t.deleteRow(0);
744
+ c.appendChild(f), t.deleteRow(0);
709
745
  }
710
746
  t.appendChild(c);
711
747
  } else {
712
- const c = document.createElement("thead"), s = t.rows[0], m = document.createElement("tr"), p = s.cells;
713
- for (let g = 0; g < p.length; g++) {
748
+ const c = document.createElement("thead"), s = t.rows[0], m = document.createElement("tr"), f = s.cells;
749
+ for (let g = 0; g < f.length; g++) {
714
750
  const w = document.createElement("th");
715
- w.innerHTML = p[g].innerHTML, w.style.cssText = p[g].style.cssText, m.appendChild(w);
751
+ w.innerHTML = f[g].innerHTML, w.style.cssText = f[g].style.cssText, m.appendChild(w);
716
752
  }
717
753
  c.appendChild(m), t.deleteRow(0), t.insertBefore(c, t.firstChild);
718
754
  }
719
755
  } catch {
720
756
  }
721
- })), n.appendChild(a), ["nw", "ne", "sw", "se"].forEach((o) => {
757
+ })), n.appendChild(r), ["nw", "ne", "sw", "se"].forEach((a) => {
722
758
  const d = document.createElement("div");
723
- d.className = `table-resize-handle ${o}`, d.addEventListener("mousedown", (c) => {
724
- c.preventDefault(), c.stopPropagation(), gt(c, n, t, o);
759
+ d.className = `table-resize-handle ${a}`, d.addEventListener("mousedown", (c) => {
760
+ c.preventDefault(), c.stopPropagation(), Lt(c, n, t, a);
725
761
  }), n.appendChild(d);
726
762
  });
727
- const ce = document.createElement("div");
728
- ce.className = "table-drag-handle", ce.title = "Drag to move table", n.appendChild(ce);
729
- const P = document.createElement("div");
730
- P.className = "table-context-menu", P.innerHTML = `
763
+ const se = document.createElement("div");
764
+ se.className = "table-drag-handle", se.title = "Drag to move table", n.appendChild(se);
765
+ const U = document.createElement("div");
766
+ U.className = "table-context-menu", U.innerHTML = `
731
767
  <button type="button" data-action="select-row">Select row</button>
732
768
  <button type="button" data-action="select-column">Select column</button>
733
769
  <button type="button" data-action="select-table">Select table</button>
@@ -743,134 +779,134 @@ const It = ({ isOpen: J, onClose: z, onInsert: _, onRemove: re, isEditing: he =
743
779
  <button type="button" data-action="add-row">Add row below</button>
744
780
  <button type="button" data-action="add-col">Add column right</button>
745
781
  <button type="button" data-action="delete-table">Delete table</button>
746
- `, P.style.display = "none", n.appendChild(P);
747
- const ie = (o, d, c) => {
748
- o ? (P.style.display = "block", P.style.left = typeof d == "number" ? d + "px" : "8px", P.style.top = typeof c == "number" ? c + "px" : "36px") : P.style.display = "none";
782
+ `, U.style.display = "none", n.appendChild(U);
783
+ const de = (a, d, c) => {
784
+ a ? (U.style.display = "block", U.style.left = typeof d == "number" ? d + "px" : "8px", U.style.top = typeof c == "number" ? c + "px" : "36px") : U.style.display = "none";
749
785
  };
750
- P.addEventListener("click", (o) => {
751
- o.stopPropagation();
752
- const d = o.target.closest("button[data-action]");
786
+ U.addEventListener("click", (a) => {
787
+ a.stopPropagation();
788
+ const d = a.target.closest("button[data-action]");
753
789
  if (!d) return;
754
790
  const c = d.getAttribute("data-action");
755
791
  try {
756
- const s = E.current || t.rows[0].cells[0];
792
+ const s = M.current || t.rows[0].cells[0];
757
793
  if (!s) return;
758
- c === "select-row" && Et(s, t), c === "select-column" && Rt(s, t), c === "select-table" && At(t), c === "merge-right" && I(s, "right", t), c === "merge-left" && I(s, "left", t), c === "merge-up" && I(s, "up", t), c === "merge-down" && I(s, "down", t), c === "split-vertical" && We(s, "vertical", t), c === "split-horizontal" && We(s, "horizontal", t), c === "add-row" && He(t), c === "add-col" && Ie(t), c === "delete-table" && Be(t);
794
+ c === "select-row" && Ut(s, t), c === "select-column" && $t(s, t), c === "select-table" && Pt(t), c === "merge-right" && I(s, "right", t), c === "merge-left" && I(s, "left", t), c === "merge-up" && I(s, "up", t), c === "merge-down" && I(s, "down", t), c === "split-vertical" && Pe(s, "vertical", t), c === "split-horizontal" && Pe(s, "horizontal", t), c === "add-row" && qe(t), c === "add-col" && Ue(t), c === "delete-table" && $e(t);
759
795
  } catch {
760
796
  }
761
- ie(!1);
797
+ de(!1);
762
798
  });
763
- const Fe = h("Table Menu", "&#8942;", () => {
764
- ie(P.style.display !== "block");
799
+ const ze = h("Table Menu", "&#8942;", () => {
800
+ de(U.style.display !== "block");
765
801
  });
766
- Fe.className += " table-menu-btn", a.appendChild(Fe), n.addEventListener("contextmenu", (o) => {
767
- o.preventDefault(), q.current = null, E.current = o.target.closest("td,th") || E.current;
802
+ ze.className += " table-menu-btn", r.appendChild(ze), n.addEventListener("contextmenu", (a) => {
803
+ a.preventDefault(), F.current = null, M.current = a.target.closest("td,th") || M.current;
768
804
  const d = n.getBoundingClientRect();
769
- ie(!0, o.clientX - d.left, o.clientY - d.top);
770
- }), document.addEventListener("click", (o) => {
771
- n.contains(o.target) || ie(!1);
805
+ de(!0, a.clientX - d.left, a.clientY - d.top);
806
+ }), document.addEventListener("click", (a) => {
807
+ n.contains(a.target) || de(!1);
772
808
  });
773
- let se = !1, le = null;
774
- const qe = (o) => {
775
- if (!se) return;
776
- const d = o.clientX - le.x, c = o.clientY - le.y;
809
+ let he = !1, le = null;
810
+ const De = (a) => {
811
+ if (!he) return;
812
+ const d = a.clientX - le.x, c = a.clientY - le.y;
777
813
  n.style.transform = `translate(${le.tx + d}px, ${le.ty + c}px)`;
778
- }, Ue = () => {
779
- if (!se) return;
780
- se = !1, document.removeEventListener("mousemove", qe), document.removeEventListener("mouseup", Ue);
781
- const o = n.style.transform.match(/translate\((-?\d+)px,\s*(-?\d+)px\)/);
782
- if (o) {
783
- const d = parseInt(o[1], 10), c = parseInt(o[2], 10);
814
+ }, Oe = () => {
815
+ if (!he) return;
816
+ he = !1, document.removeEventListener("mousemove", De), document.removeEventListener("mouseup", Oe);
817
+ const a = n.style.transform.match(/translate\((-?\d+)px,\s*(-?\d+)px\)/);
818
+ if (a) {
819
+ const d = parseInt(a[1], 10), c = parseInt(a[2], 10);
784
820
  n.style.left = n.offsetLeft + d + "px", n.style.top = n.offsetTop + c + "px", n.style.transform = "", n.style.position = "absolute";
785
821
  }
786
822
  };
787
- ce.addEventListener("mousedown", (o) => {
788
- o.preventDefault(), o.stopPropagation(), se = !0, le = { x: o.clientX, y: o.clientY, tx: 0, ty: 0 }, document.addEventListener("mousemove", qe), document.addEventListener("mouseup", Ue);
823
+ se.addEventListener("mousedown", (a) => {
824
+ a.preventDefault(), a.stopPropagation(), he = !0, le = { x: a.clientX, y: a.clientY, tx: 0, ty: 0 }, document.addEventListener("mousemove", De), document.addEventListener("mouseup", Oe);
789
825
  }), t.dataset.enhanced = "1";
790
- }, gt = (t, n, l, r) => {
791
- const a = t.clientX, h = t.clientY, u = l.offsetWidth, x = l.offsetHeight, S = (U) => {
792
- const A = U.clientX - a, K = U.clientY - h;
793
- if (r.includes("e")) {
826
+ }, Lt = (t, n, l, o) => {
827
+ const r = t.clientX, h = t.clientY, u = l.offsetWidth, x = l.offsetHeight, L = (q) => {
828
+ const A = q.clientX - r, G = q.clientY - h;
829
+ if (o.includes("e")) {
794
830
  const I = Math.max(200, u + A);
795
831
  l.style.width = I + "px";
796
- } else if (r.includes("w")) {
832
+ } else if (o.includes("w")) {
797
833
  const I = Math.max(200, u - A);
798
834
  l.style.width = I + "px";
799
835
  }
800
- if (r.includes("s")) {
801
- const I = Math.max(100, x + K);
836
+ if (o.includes("s")) {
837
+ const I = Math.max(100, x + G);
802
838
  l.style.height = I + "px";
803
- } else if (r.includes("n")) {
804
- const I = Math.max(100, x - K);
839
+ } else if (o.includes("n")) {
840
+ const I = Math.max(100, x - G);
805
841
  l.style.height = I + "px";
806
842
  }
807
- }, R = () => {
808
- document.removeEventListener("mousemove", S), document.removeEventListener("mouseup", R), document.body.style.cursor = "";
843
+ }, E = () => {
844
+ document.removeEventListener("mousemove", L), document.removeEventListener("mouseup", E), document.body.style.cursor = "";
809
845
  };
810
- document.addEventListener("mousemove", S), document.addEventListener("mouseup", R);
811
- }, He = (t) => {
812
- const n = E.current;
846
+ document.addEventListener("mousemove", L), document.addEventListener("mouseup", E);
847
+ }, qe = (t) => {
848
+ const n = M.current;
813
849
  let l = -1;
814
850
  n && (l = n.parentElement.rowIndex);
815
- const r = t.rows[0] ? t.rows[0].cells.length : t.tBodies[0] && t.tBodies[0].rows[0] ? t.tBodies[0].rows[0].cells.length : 1, a = t.insertRow(l + 1);
816
- for (let h = 0; h < r; h++) {
817
- const u = a.insertCell(-1);
818
- u.innerHTML = `Cell ${a.rowIndex}-${h + 1}`;
851
+ const o = t.rows[0] ? t.rows[0].cells.length : t.tBodies[0] && t.tBodies[0].rows[0] ? t.tBodies[0].rows[0].cells.length : 1, r = t.insertRow(l + 1);
852
+ for (let h = 0; h < o; h++) {
853
+ const u = r.insertCell(-1);
854
+ u.innerHTML = `Cell ${r.rowIndex}-${h + 1}`;
819
855
  }
820
- }, Ie = (t) => {
821
- const n = E.current;
856
+ }, Ue = (t) => {
857
+ const n = M.current;
822
858
  let l = -1;
823
859
  n && (l = Array.prototype.indexOf.call(n.parentElement.children, n));
824
- for (let r = 0; r < t.rows.length; r++) {
825
- const a = t.rows[r], h = l + 1, u = a.insertCell(h);
860
+ for (let o = 0; o < t.rows.length; o++) {
861
+ const r = t.rows[o], h = l + 1, u = r.insertCell(h);
826
862
  u.innerHTML = "";
827
863
  }
828
- }, vt = (t) => {
864
+ }, St = (t) => {
829
865
  if (t.rows.length <= 1) return;
830
- const n = E.current;
866
+ const n = M.current;
831
867
  let l = n ? n.parentElement.rowIndex : t.rows.length - 1;
832
868
  t.deleteRow(l);
833
- }, yt = (t) => {
869
+ }, Tt = (t) => {
834
870
  const n = t.rows[0] ? t.rows[0].cells.length : 0;
835
871
  if (n <= 1) return;
836
- const l = E.current;
837
- let r = l ? Array.prototype.indexOf.call(l.parentElement.children, l) : n - 1;
838
- for (let a = 0; a < t.rows.length; a++) {
839
- const h = t.rows[a];
840
- h.cells[r] && h.deleteCell(r);
872
+ const l = M.current;
873
+ let o = l ? Array.prototype.indexOf.call(l.parentElement.children, l) : n - 1;
874
+ for (let r = 0; r < t.rows.length; r++) {
875
+ const h = t.rows[r];
876
+ h.cells[o] && h.deleteCell(o);
841
877
  }
842
- }, Be = (t) => {
878
+ }, $e = (t) => {
843
879
  const n = t.closest(".editable-table-wrap");
844
880
  n ? n.remove() : t.remove();
845
- }, bt = () => {
881
+ }, Mt = () => {
846
882
  try {
847
- const t = f.current;
883
+ const t = p.current;
848
884
  if (!t) return;
849
- t.querySelectorAll("table").forEach((l) => Ae(l));
885
+ t.querySelectorAll("table").forEach((l) => Fe(l));
850
886
  } catch {
851
887
  }
852
- }, Ct = () => {
888
+ }, Et = () => {
853
889
  try {
854
- const t = f.current;
890
+ const t = p.current;
855
891
  if (!t) return;
856
892
  t.querySelectorAll("img:not(.editable-image-wrap img)").forEach((l) => {
857
893
  if (!l.closest(".editable-image-wrap")) {
858
- const r = document.createElement("div");
859
- r.className = "editable-image-wrap", r.contentEditable = "false", l.parentNode.insertBefore(r, l), r.appendChild(l), Ee(r);
894
+ const o = document.createElement("div");
895
+ o.className = "editable-image-wrap", o.contentEditable = "false", l.parentNode.insertBefore(o, l), o.appendChild(l), Be(o);
860
896
  }
861
897
  });
862
898
  } catch {
863
899
  }
864
- }, xt = () => {
865
- re(!_);
866
- }, wt = () => {
867
- const t = f.current?.innerHTML || "", n = new Blob([t], { type: "text/html" }), l = URL.createObjectURL(n), r = document.createElement("a");
868
- r.href = l, r.download = "document.html", r.click(), URL.revokeObjectURL(l);
900
+ }, Rt = () => {
901
+ ee(!D);
902
+ }, At = () => {
903
+ const t = p.current?.innerHTML || "", n = new Blob([t], { type: "text/html" }), l = URL.createObjectURL(n), o = document.createElement("a");
904
+ o.href = l, o.download = "document.html", o.click(), URL.revokeObjectURL(l);
869
905
  };
870
906
  oe(() => {
871
907
  const t = () => {
872
- const n = f.current?.innerText || "", l = new Blob([n], { type: "text/plain" }), r = URL.createObjectURL(l), a = document.createElement("a");
873
- a.href = r, a.download = "document.txt", a.click(), URL.revokeObjectURL(r);
908
+ const n = p.current?.innerText || "", l = new Blob([n], { type: "text/plain" }), o = URL.createObjectURL(l), r = document.createElement("a");
909
+ r.href = o, r.download = "document.txt", r.click(), URL.revokeObjectURL(o);
874
910
  };
875
911
  try {
876
912
  window._exportAsText = t;
@@ -885,649 +921,667 @@ const It = ({ isOpen: J, onClose: z, onInsert: _, onRemove: re, isEditing: he =
885
921
  }, []), oe(() => {
886
922
  const t = (n) => {
887
923
  try {
888
- const l = n.target.closest(".editable-table-wrap"), r = n.target.closest(".editable-image-wrap");
889
- !l && f.current && f.current.querySelectorAll(".editable-table-wrap.selected").forEach((h) => h.classList.remove("selected")), !r && f.current && f.current.querySelectorAll(".editable-image-wrap.selected").forEach((h) => h.classList.remove("selected"));
924
+ const l = n.target.closest(".editable-table-wrap"), o = n.target.closest(".editable-image-wrap");
925
+ !l && p.current && p.current.querySelectorAll(".editable-table-wrap.selected").forEach((h) => h.classList.remove("selected")), !o && p.current && p.current.querySelectorAll(".editable-image-wrap.selected").forEach((h) => h.classList.remove("selected"));
890
926
  } catch {
891
927
  }
892
928
  };
893
929
  return document.addEventListener("click", t), () => document.removeEventListener("click", t);
894
930
  }, []);
895
- const kt = (t) => {
931
+ const Ht = (t) => {
896
932
  const n = t.target.files?.[0];
897
933
  if (n) {
898
934
  const l = new FileReader();
899
- l.onload = (r) => {
900
- const a = r.target?.result;
901
- f.current && (f.current.innerHTML = a, z(a), setTimeout(() => {
902
- bt(), Ct();
935
+ l.onload = (o) => {
936
+ const r = o.target?.result;
937
+ p.current && (p.current.innerHTML = r, z(r), setTimeout(() => {
938
+ Mt(), Et();
903
939
  }, 50));
904
940
  }, l.readAsText(n);
905
941
  }
906
- }, Nt = () => {
942
+ }, It = () => {
907
943
  O(!0);
908
- }, Lt = () => {
909
- const t = f.current?.innerHTML || "";
944
+ }, Bt = () => {
945
+ const t = p.current?.innerHTML || "";
910
946
  navigator.clipboard.writeText(t).then(() => {
911
947
  alert("HTML copied to clipboard!");
912
948
  });
913
- }, St = () => {
914
- confirm("Are you sure you want to clear all content?") && f.current && (v("selectAll"), v("delete"), z(""));
915
- }, Tt = () => {
949
+ }, Wt = () => {
950
+ confirm("Are you sure you want to clear all content?") && p.current && (y("selectAll"), y("delete"), z(""));
951
+ }, Ft = () => {
916
952
  const t = prompt("Enter your code:");
917
953
  if (t) {
918
954
  const n = `<pre><code>${t}</code></pre>`;
919
- v("insertHTML", n);
955
+ y("insertHTML", n);
920
956
  }
921
- }, Mt = () => {
922
- v("formatBlock", "blockquote");
957
+ }, qt = () => {
958
+ y("formatBlock", "blockquote");
923
959
  };
924
- return /* @__PURE__ */ i("div", { className: `editor-container ${_ ? "fullscreen" : ""}`, children: [
925
- /* @__PURE__ */ e(
926
- "input",
927
- {
928
- type: "file",
929
- ref: Te,
930
- onChange: kt,
931
- accept: ".html,.txt",
932
- style: { display: "none" }
933
- }
934
- ),
935
- /* @__PURE__ */ e("div", { className: "editor-content", children: /* @__PURE__ */ i("div", { className: `page-card size-${ke}`, children: [
936
- /* @__PURE__ */ i("div", { className: "editor-toolbar", children: [
937
- /* @__PURE__ */ i("div", { className: "toolbar-group", children: [
938
- /* @__PURE__ */ e(
939
- "button",
940
- {
941
- className: "toolbar-btn",
942
- onClick: () => v("undo"),
943
- title: "Undo",
944
- children: /* @__PURE__ */ i("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
945
- /* @__PURE__ */ e("path", { d: "M3 7v6h6" }),
946
- /* @__PURE__ */ e("path", { d: "M21 17a9 9 0 00-9-9 9 9 0 00-6 2.3L3 13" })
947
- ] })
948
- }
949
- ),
950
- /* @__PURE__ */ e(
951
- "button",
952
- {
953
- className: "toolbar-btn",
954
- onClick: () => v("redo"),
955
- title: "Redo",
956
- children: /* @__PURE__ */ i("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
957
- /* @__PURE__ */ e("path", { d: "M21 7v6h-6" }),
958
- /* @__PURE__ */ e("path", { d: "M3 17a9 9 0 019-9 9 9 0 016 2.3l3 2.7" })
959
- ] })
960
- }
961
- )
962
- ] }),
963
- /* @__PURE__ */ e("div", { className: "toolbar-divider" }),
964
- /* @__PURE__ */ i("div", { className: "toolbar-group", children: [
965
- /* @__PURE__ */ i(
966
- "select",
967
- {
968
- className: "toolbar-select",
969
- onChange: at,
970
- value: Ye,
971
- children: [
972
- /* @__PURE__ */ e("option", { value: "Arial", children: "Arial" }),
973
- /* @__PURE__ */ e("option", { value: "Helvetica", children: "Helvetica" }),
974
- /* @__PURE__ */ e("option", { value: "Segoe UI", children: "Segoe UI" }),
975
- /* @__PURE__ */ e("option", { value: "Roboto", children: "Roboto" }),
976
- /* @__PURE__ */ e("option", { value: "Open Sans", children: "Open Sans" }),
977
- /* @__PURE__ */ e("option", { value: "Lato", children: "Lato" }),
978
- /* @__PURE__ */ e("option", { value: "Montserrat", children: "Montserrat" }),
979
- /* @__PURE__ */ e("option", { value: "Source Sans Pro", children: "Source Sans Pro" }),
980
- /* @__PURE__ */ e("option", { value: "Tahoma", children: "Tahoma" }),
981
- /* @__PURE__ */ e("option", { value: "Verdana", children: "Verdana" }),
982
- /* @__PURE__ */ e("option", { value: "Trebuchet MS", children: "Trebuchet MS" }),
983
- /* @__PURE__ */ e("option", { value: "Georgia", children: "Georgia" }),
984
- /* @__PURE__ */ e("option", { value: "Times New Roman", children: "Times New Roman" }),
985
- /* @__PURE__ */ e("option", { value: "Palatino Linotype", children: "Palatino Linotype" }),
986
- /* @__PURE__ */ e("option", { value: "Garamond", children: "Garamond" }),
987
- /* @__PURE__ */ e("option", { value: "Courier New", children: "Courier New" }),
988
- /* @__PURE__ */ e("option", { value: "Brush Script MT", children: "Brush Script MT" }),
989
- /* @__PURE__ */ e("option", { value: "Impact", children: "Impact" }),
990
- /* @__PURE__ */ e("option", { value: "Comic Sans MS", children: "Comic Sans MS" }),
991
- /* @__PURE__ */ e("option", { value: "Candara", children: "Candara" }),
992
- /* @__PURE__ */ e("option", { value: "Cambria", children: "Cambria" }),
993
- /* @__PURE__ */ e("option", { value: "Calibri", children: "Calibri" }),
994
- /* @__PURE__ */ e("option", { value: "Merriweather", children: "Merriweather" }),
995
- /* @__PURE__ */ e("option", { value: "Noto Sans", children: "Noto Sans" }),
996
- /* @__PURE__ */ e("option", { value: "Palatino", children: "Palatino" }),
997
- /* @__PURE__ */ e("option", { value: "Bookman", children: "Bookman" }),
998
- /* @__PURE__ */ e("option", { value: "Lucida Sans", children: "Lucida Sans" }),
999
- /* @__PURE__ */ e("option", { value: "Righteous", children: "Righteous" }),
1000
- /* @__PURE__ */ e("option", { value: "Poppins", children: "Poppins" })
1001
- ]
1002
- }
1003
- ),
1004
- /* @__PURE__ */ i(
1005
- "select",
1006
- {
1007
- className: "toolbar-select",
1008
- onChange: rt,
1009
- value: Ge,
1010
- children: [
1011
- /* @__PURE__ */ e("option", { value: "1", children: "Small" }),
1012
- /* @__PURE__ */ e("option", { value: "3", children: "Normal" }),
1013
- /* @__PURE__ */ e("option", { value: "5", children: "Large" }),
1014
- /* @__PURE__ */ e("option", { value: "7", children: "Huge" })
1015
- ]
1016
- }
1017
- ),
1018
- /* @__PURE__ */ i(
1019
- "select",
1020
- {
1021
- className: "toolbar-select",
1022
- onChange: (t) => {
1023
- ht(t.target.value), fe(t.target.value);
1024
- },
1025
- value: Ke,
1026
- children: [
1027
- /* @__PURE__ */ e("option", { value: "p", children: "Paragraph" }),
1028
- /* @__PURE__ */ e("option", { value: "h1", children: "Heading 1" }),
1029
- /* @__PURE__ */ e("option", { value: "h2", children: "Heading 2" }),
1030
- /* @__PURE__ */ e("option", { value: "h3", children: "Heading 3" }),
1031
- /* @__PURE__ */ e("option", { value: "h4", children: "Heading 4" })
1032
- ]
1033
- }
1034
- )
1035
- ] }),
1036
- /* @__PURE__ */ e("div", { className: "toolbar-divider" }),
1037
- /* @__PURE__ */ i("div", { className: "toolbar-group", children: [
1038
- /* @__PURE__ */ e(
1039
- "button",
1040
- {
1041
- className: `toolbar-btn ${V.bold ? "active" : ""}`,
1042
- onClick: () => v("bold"),
1043
- title: "Bold",
1044
- children: /* @__PURE__ */ i("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", children: [
1045
- /* @__PURE__ */ e("path", { d: "M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z" }),
1046
- /* @__PURE__ */ e("path", { d: "M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z" })
1047
- ] })
1048
- }
1049
- ),
1050
- /* @__PURE__ */ e(
1051
- "button",
1052
- {
1053
- className: `toolbar-btn ${V.italic ? "active" : ""}`,
1054
- onClick: () => v("italic"),
1055
- title: "Italic",
1056
- children: /* @__PURE__ */ i("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1057
- /* @__PURE__ */ e("line", { x1: "19", y1: "4", x2: "10", y2: "4" }),
1058
- /* @__PURE__ */ e("line", { x1: "14", y1: "20", x2: "5", y2: "20" }),
1059
- /* @__PURE__ */ e("line", { x1: "15", y1: "4", x2: "9", y2: "20" })
1060
- ] })
1061
- }
1062
- ),
1063
- /* @__PURE__ */ e(
1064
- "button",
1065
- {
1066
- className: `toolbar-btn ${V.underline ? "active" : ""}`,
1067
- onClick: () => v("underline"),
1068
- title: "Underline",
1069
- children: /* @__PURE__ */ i("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1070
- /* @__PURE__ */ e("path", { d: "M6 3v7a6 6 0 0 0 6 6 6 6 0 0 0 6-6V3" }),
1071
- /* @__PURE__ */ e("line", { x1: "4", y1: "21", x2: "20", y2: "21" })
1072
- ] })
1073
- }
1074
- ),
1075
- /* @__PURE__ */ e(
1076
- "button",
1077
- {
1078
- className: `toolbar-btn ${V.strikeThrough ? "active" : ""}`,
1079
- onClick: () => v("strikeThrough"),
1080
- title: "Strikethrough",
1081
- children: /* @__PURE__ */ i("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1082
- /* @__PURE__ */ e("path", { d: "M16 4H9a3 3 0 0 0-2.83 4" }),
1083
- /* @__PURE__ */ e("path", { d: "M14 12a4 4 0 0 1 0 8H6" }),
1084
- /* @__PURE__ */ e("line", { x1: "4", y1: "12", x2: "20", y2: "12" })
1085
- ] })
1086
- }
1087
- )
1088
- ] }),
1089
- /* @__PURE__ */ e("div", { className: "toolbar-divider" }),
1090
- /* @__PURE__ */ i("div", { className: "toolbar-group", children: [
1091
- /* @__PURE__ */ i("div", { className: "color-picker-wrapper", "data-tooltip": "Text color", "aria-label": "Text color picker", children: [
960
+ return /* @__PURE__ */ i(
961
+ "div",
962
+ {
963
+ className: `editor-container ${D ? "fullscreen" : ""}`,
964
+ onDragOver: at,
965
+ onDragLeave: ct,
966
+ onDrop: it,
967
+ children: [
968
+ /* @__PURE__ */ e(
969
+ "input",
970
+ {
971
+ type: "file",
972
+ ref: Ie,
973
+ onChange: Ht,
974
+ accept: ".html,.txt",
975
+ style: { display: "none" }
976
+ }
977
+ ),
978
+ /* @__PURE__ */ e("div", { className: `editor-content ${re ? "full-bleed" : ""}`, children: /* @__PURE__ */ i(
979
+ "div",
980
+ {
981
+ className: `page-card size-${Ee} ${re ? "no-gutters" : ""}`,
982
+ style: { width: Q || void 0 },
983
+ children: [
984
+ /* @__PURE__ */ i("div", { className: "editor-toolbar", children: [
985
+ /* @__PURE__ */ i("div", { className: "toolbar-group", children: [
986
+ /* @__PURE__ */ e(
987
+ "button",
988
+ {
989
+ className: "toolbar-btn",
990
+ onClick: () => y("undo"),
991
+ title: "Undo",
992
+ children: /* @__PURE__ */ i("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
993
+ /* @__PURE__ */ e("path", { d: "M3 7v6h6" }),
994
+ /* @__PURE__ */ e("path", { d: "M21 17a9 9 0 00-9-9 9 9 0 00-6 2.3L3 13" })
995
+ ] })
996
+ }
997
+ ),
998
+ /* @__PURE__ */ e(
999
+ "button",
1000
+ {
1001
+ className: "toolbar-btn",
1002
+ onClick: () => y("redo"),
1003
+ title: "Redo",
1004
+ children: /* @__PURE__ */ i("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1005
+ /* @__PURE__ */ e("path", { d: "M21 7v6h-6" }),
1006
+ /* @__PURE__ */ e("path", { d: "M3 17a9 9 0 019-9 9 9 0 016 2.3l3 2.7" })
1007
+ ] })
1008
+ }
1009
+ )
1010
+ ] }),
1011
+ /* @__PURE__ */ e("div", { className: "toolbar-divider" }),
1012
+ /* @__PURE__ */ i("div", { className: "toolbar-group", children: [
1013
+ /* @__PURE__ */ i(
1014
+ "select",
1015
+ {
1016
+ className: "toolbar-select",
1017
+ onChange: ft,
1018
+ value: et,
1019
+ children: [
1020
+ /* @__PURE__ */ e("option", { value: "Arial", children: "Arial" }),
1021
+ /* @__PURE__ */ e("option", { value: "Helvetica", children: "Helvetica" }),
1022
+ /* @__PURE__ */ e("option", { value: "Segoe UI", children: "Segoe UI" }),
1023
+ /* @__PURE__ */ e("option", { value: "Roboto", children: "Roboto" }),
1024
+ /* @__PURE__ */ e("option", { value: "Open Sans", children: "Open Sans" }),
1025
+ /* @__PURE__ */ e("option", { value: "Lato", children: "Lato" }),
1026
+ /* @__PURE__ */ e("option", { value: "Montserrat", children: "Montserrat" }),
1027
+ /* @__PURE__ */ e("option", { value: "Source Sans Pro", children: "Source Sans Pro" }),
1028
+ /* @__PURE__ */ e("option", { value: "Tahoma", children: "Tahoma" }),
1029
+ /* @__PURE__ */ e("option", { value: "Verdana", children: "Verdana" }),
1030
+ /* @__PURE__ */ e("option", { value: "Trebuchet MS", children: "Trebuchet MS" }),
1031
+ /* @__PURE__ */ e("option", { value: "Georgia", children: "Georgia" }),
1032
+ /* @__PURE__ */ e("option", { value: "Times New Roman", children: "Times New Roman" }),
1033
+ /* @__PURE__ */ e("option", { value: "Palatino Linotype", children: "Palatino Linotype" }),
1034
+ /* @__PURE__ */ e("option", { value: "Garamond", children: "Garamond" }),
1035
+ /* @__PURE__ */ e("option", { value: "Courier New", children: "Courier New" }),
1036
+ /* @__PURE__ */ e("option", { value: "Brush Script MT", children: "Brush Script MT" }),
1037
+ /* @__PURE__ */ e("option", { value: "Impact", children: "Impact" }),
1038
+ /* @__PURE__ */ e("option", { value: "Comic Sans MS", children: "Comic Sans MS" }),
1039
+ /* @__PURE__ */ e("option", { value: "Candara", children: "Candara" }),
1040
+ /* @__PURE__ */ e("option", { value: "Cambria", children: "Cambria" }),
1041
+ /* @__PURE__ */ e("option", { value: "Calibri", children: "Calibri" }),
1042
+ /* @__PURE__ */ e("option", { value: "Merriweather", children: "Merriweather" }),
1043
+ /* @__PURE__ */ e("option", { value: "Noto Sans", children: "Noto Sans" }),
1044
+ /* @__PURE__ */ e("option", { value: "Palatino", children: "Palatino" }),
1045
+ /* @__PURE__ */ e("option", { value: "Bookman", children: "Bookman" }),
1046
+ /* @__PURE__ */ e("option", { value: "Lucida Sans", children: "Lucida Sans" }),
1047
+ /* @__PURE__ */ e("option", { value: "Righteous", children: "Righteous" }),
1048
+ /* @__PURE__ */ e("option", { value: "Poppins", children: "Poppins" })
1049
+ ]
1050
+ }
1051
+ ),
1052
+ /* @__PURE__ */ i(
1053
+ "select",
1054
+ {
1055
+ className: "toolbar-select",
1056
+ onChange: pt,
1057
+ value: tt,
1058
+ children: [
1059
+ /* @__PURE__ */ e("option", { value: "1", children: "Small" }),
1060
+ /* @__PURE__ */ e("option", { value: "3", children: "Normal" }),
1061
+ /* @__PURE__ */ e("option", { value: "5", children: "Large" }),
1062
+ /* @__PURE__ */ e("option", { value: "7", children: "Huge" })
1063
+ ]
1064
+ }
1065
+ ),
1066
+ /* @__PURE__ */ i(
1067
+ "select",
1068
+ {
1069
+ className: "toolbar-select",
1070
+ onChange: (t) => {
1071
+ Ct(t.target.value), ye(t.target.value);
1072
+ },
1073
+ value: nt,
1074
+ children: [
1075
+ /* @__PURE__ */ e("option", { value: "p", children: "Paragraph" }),
1076
+ /* @__PURE__ */ e("option", { value: "h1", children: "Heading 1" }),
1077
+ /* @__PURE__ */ e("option", { value: "h2", children: "Heading 2" }),
1078
+ /* @__PURE__ */ e("option", { value: "h3", children: "Heading 3" }),
1079
+ /* @__PURE__ */ e("option", { value: "h4", children: "Heading 4" })
1080
+ ]
1081
+ }
1082
+ )
1083
+ ] }),
1084
+ /* @__PURE__ */ e("div", { className: "toolbar-divider" }),
1085
+ /* @__PURE__ */ i("div", { className: "toolbar-group", children: [
1086
+ /* @__PURE__ */ e(
1087
+ "button",
1088
+ {
1089
+ className: `toolbar-btn ${P.bold ? "active" : ""}`,
1090
+ onClick: () => y("bold"),
1091
+ title: "Bold",
1092
+ children: /* @__PURE__ */ i("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", children: [
1093
+ /* @__PURE__ */ e("path", { d: "M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z" }),
1094
+ /* @__PURE__ */ e("path", { d: "M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z" })
1095
+ ] })
1096
+ }
1097
+ ),
1098
+ /* @__PURE__ */ e(
1099
+ "button",
1100
+ {
1101
+ className: `toolbar-btn ${P.italic ? "active" : ""}`,
1102
+ onClick: () => y("italic"),
1103
+ title: "Italic",
1104
+ children: /* @__PURE__ */ i("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1105
+ /* @__PURE__ */ e("line", { x1: "19", y1: "4", x2: "10", y2: "4" }),
1106
+ /* @__PURE__ */ e("line", { x1: "14", y1: "20", x2: "5", y2: "20" }),
1107
+ /* @__PURE__ */ e("line", { x1: "15", y1: "4", x2: "9", y2: "20" })
1108
+ ] })
1109
+ }
1110
+ ),
1111
+ /* @__PURE__ */ e(
1112
+ "button",
1113
+ {
1114
+ className: `toolbar-btn ${P.underline ? "active" : ""}`,
1115
+ onClick: () => y("underline"),
1116
+ title: "Underline",
1117
+ children: /* @__PURE__ */ i("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1118
+ /* @__PURE__ */ e("path", { d: "M6 3v7a6 6 0 0 0 6 6 6 6 0 0 0 6-6V3" }),
1119
+ /* @__PURE__ */ e("line", { x1: "4", y1: "21", x2: "20", y2: "21" })
1120
+ ] })
1121
+ }
1122
+ ),
1123
+ /* @__PURE__ */ e(
1124
+ "button",
1125
+ {
1126
+ className: `toolbar-btn ${P.strikeThrough ? "active" : ""}`,
1127
+ onClick: () => y("strikeThrough"),
1128
+ title: "Strikethrough",
1129
+ children: /* @__PURE__ */ i("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1130
+ /* @__PURE__ */ e("path", { d: "M16 4H9a3 3 0 0 0-2.83 4" }),
1131
+ /* @__PURE__ */ e("path", { d: "M14 12a4 4 0 0 1 0 8H6" }),
1132
+ /* @__PURE__ */ e("line", { x1: "4", y1: "12", x2: "20", y2: "12" })
1133
+ ] })
1134
+ }
1135
+ )
1136
+ ] }),
1137
+ /* @__PURE__ */ e("div", { className: "toolbar-divider" }),
1138
+ /* @__PURE__ */ i("div", { className: "toolbar-group", children: [
1139
+ /* @__PURE__ */ i("div", { className: "color-picker-wrapper", "data-tooltip": "Text color", "aria-label": "Text color picker", children: [
1140
+ /* @__PURE__ */ e(
1141
+ "input",
1142
+ {
1143
+ type: "color",
1144
+ onChange: ut,
1145
+ className: "color-picker",
1146
+ title: "Text Color",
1147
+ defaultValue: "#111827",
1148
+ "aria-label": "Text color"
1149
+ }
1150
+ ),
1151
+ /* @__PURE__ */ e("span", { className: "color-label", children: "A" }),
1152
+ /* @__PURE__ */ e("span", { className: "color-caption", children: "Text color" })
1153
+ ] }),
1154
+ /* @__PURE__ */ i("div", { className: "color-picker-wrapper", "data-tooltip": "Highlight / background color", "aria-label": "Background color picker", children: [
1155
+ /* @__PURE__ */ e(
1156
+ "input",
1157
+ {
1158
+ type: "color",
1159
+ onChange: mt,
1160
+ className: "color-picker",
1161
+ title: "Background Color",
1162
+ defaultValue: "#ffffff",
1163
+ "aria-label": "Background color"
1164
+ }
1165
+ ),
1166
+ /* @__PURE__ */ e("span", { className: "color-label", children: "◼" }),
1167
+ /* @__PURE__ */ e("span", { className: "color-caption", children: "Highlight" })
1168
+ ] })
1169
+ ] }),
1170
+ /* @__PURE__ */ e("div", { className: "toolbar-divider" }),
1171
+ /* @__PURE__ */ e("div", { className: "toolbar-group", children: /* @__PURE__ */ i("div", { style: { position: "relative", display: "inline-block" }, children: [
1172
+ /* @__PURE__ */ e(
1173
+ "button",
1174
+ {
1175
+ className: "toolbar-btn",
1176
+ onClick: () => j((t) => !t),
1177
+ title: "More formatting",
1178
+ children: /* @__PURE__ */ i("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1179
+ /* @__PURE__ */ e("circle", { cx: "5", cy: "6", r: "1.2" }),
1180
+ /* @__PURE__ */ e("circle", { cx: "5", cy: "12", r: "1.2" }),
1181
+ /* @__PURE__ */ e("circle", { cx: "5", cy: "18", r: "1.2" }),
1182
+ /* @__PURE__ */ e("line", { x1: "10", y1: "6", x2: "21", y2: "6" }),
1183
+ /* @__PURE__ */ e("line", { x1: "10", y1: "12", x2: "21", y2: "12" }),
1184
+ /* @__PURE__ */ e("line", { x1: "10", y1: "18", x2: "21", y2: "18" })
1185
+ ] })
1186
+ }
1187
+ ),
1188
+ Ye && /* @__PURE__ */ i("div", { className: "toolbar-dropdown-panel", onClick: (t) => t.stopPropagation(), children: [
1189
+ /* @__PURE__ */ i("div", { className: "toolbar-dropdown-row", children: [
1190
+ /* @__PURE__ */ e("button", { className: `toolbar-btn ${P.justifyLeft ? "active" : ""}`, onClick: () => {
1191
+ y("justifyLeft"), j(!1);
1192
+ }, title: "Align Left", children: /* @__PURE__ */ i("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1193
+ /* @__PURE__ */ e("line", { x1: "17", y1: "10", x2: "3", y2: "10" }),
1194
+ /* @__PURE__ */ e("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
1195
+ /* @__PURE__ */ e("line", { x1: "21", y1: "14", x2: "3", y2: "14" })
1196
+ ] }) }),
1197
+ /* @__PURE__ */ e("button", { className: `toolbar-btn ${P.justifyCenter ? "active" : ""}`, onClick: () => {
1198
+ y("justifyCenter"), j(!1);
1199
+ }, title: "Align Center", children: /* @__PURE__ */ i("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1200
+ /* @__PURE__ */ e("line", { x1: "18", y1: "10", x2: "6", y2: "10" }),
1201
+ /* @__PURE__ */ e("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
1202
+ /* @__PURE__ */ e("line", { x1: "21", y1: "14", x2: "3", y2: "14" })
1203
+ ] }) }),
1204
+ /* @__PURE__ */ e("button", { className: `toolbar-btn ${P.justifyRight ? "active" : ""}`, onClick: () => {
1205
+ y("justifyRight"), j(!1);
1206
+ }, title: "Align Right", children: /* @__PURE__ */ i("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1207
+ /* @__PURE__ */ e("line", { x1: "21", y1: "10", x2: "7", y2: "10" }),
1208
+ /* @__PURE__ */ e("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
1209
+ /* @__PURE__ */ e("line", { x1: "21", y1: "14", x2: "3", y2: "14" })
1210
+ ] }) })
1211
+ ] }),
1212
+ /* @__PURE__ */ e("div", { className: "toolbar-dropdown-sep" }),
1213
+ /* @__PURE__ */ i("div", { className: "toolbar-dropdown-row", children: [
1214
+ /* @__PURE__ */ e("button", { className: `toolbar-btn ${P.insertUnorderedList ? "active" : ""}`, onClick: () => {
1215
+ y("insertUnorderedList"), j(!1);
1216
+ }, title: "Bullet List", children: /* @__PURE__ */ i("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1217
+ /* @__PURE__ */ e("line", { x1: "8", y1: "6", x2: "21", y2: "6" }),
1218
+ /* @__PURE__ */ e("line", { x1: "8", y1: "12", x2: "21", y2: "12" }),
1219
+ /* @__PURE__ */ e("circle", { cx: "4", cy: "6", r: "1", fill: "currentColor" })
1220
+ ] }) }),
1221
+ /* @__PURE__ */ e("button", { className: `toolbar-btn ${P.insertOrderedList ? "active" : ""}`, onClick: () => {
1222
+ y("insertOrderedList"), j(!1);
1223
+ }, title: "Numbered List", children: /* @__PURE__ */ i("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1224
+ /* @__PURE__ */ e("line", { x1: "10", y1: "6", x2: "21", y2: "6" }),
1225
+ /* @__PURE__ */ e("line", { x1: "10", y1: "12", x2: "21", y2: "12" })
1226
+ ] }) }),
1227
+ /* @__PURE__ */ e("button", { className: "toolbar-btn", onClick: () => {
1228
+ y("indent"), j(!1);
1229
+ }, title: "Indent", children: /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ e("line", { x1: "21", y1: "4", x2: "9", y2: "4" }) }) }),
1230
+ /* @__PURE__ */ e("button", { className: "toolbar-btn", onClick: () => {
1231
+ y("outdent"), j(!1);
1232
+ }, title: "Outdent", children: /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ e("line", { x1: "21", y1: "4", x2: "9", y2: "4" }) }) })
1233
+ ] })
1234
+ ] })
1235
+ ] }) }),
1236
+ /* @__PURE__ */ e("div", { className: "toolbar-divider" }),
1237
+ /* @__PURE__ */ i("div", { className: "toolbar-group", children: [
1238
+ /* @__PURE__ */ e(
1239
+ "button",
1240
+ {
1241
+ className: "toolbar-btn",
1242
+ onClick: st,
1243
+ title: "Insert Link",
1244
+ children: /* @__PURE__ */ i("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1245
+ /* @__PURE__ */ e("path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }),
1246
+ /* @__PURE__ */ e("path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" })
1247
+ ] })
1248
+ }
1249
+ ),
1250
+ /* @__PURE__ */ e(
1251
+ "button",
1252
+ {
1253
+ className: "toolbar-btn",
1254
+ onClick: gt,
1255
+ title: "Insert Image",
1256
+ children: /* @__PURE__ */ i("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1257
+ /* @__PURE__ */ e("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
1258
+ /* @__PURE__ */ e("circle", { cx: "8.5", cy: "8.5", r: "1.5" }),
1259
+ /* @__PURE__ */ e("polyline", { points: "21 15 16 10 5 21" })
1260
+ ] })
1261
+ }
1262
+ ),
1263
+ /* @__PURE__ */ i("div", { style: { position: "relative", display: "inline-block" }, children: [
1264
+ /* @__PURE__ */ e(
1265
+ "button",
1266
+ {
1267
+ className: "toolbar-btn",
1268
+ onClick: () => ke(!we),
1269
+ title: "Insert Table",
1270
+ children: /* @__PURE__ */ i("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1271
+ /* @__PURE__ */ e("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
1272
+ /* @__PURE__ */ e("line", { x1: "3", y1: "9", x2: "21", y2: "9" }),
1273
+ /* @__PURE__ */ e("line", { x1: "3", y1: "15", x2: "21", y2: "15" }),
1274
+ /* @__PURE__ */ e("line", { x1: "9", y1: "3", x2: "9", y2: "21" }),
1275
+ /* @__PURE__ */ e("line", { x1: "15", y1: "3", x2: "15", y2: "21" })
1276
+ ] })
1277
+ }
1278
+ ),
1279
+ we && /* @__PURE__ */ i("div", { className: "table-size-picker show", children: [
1280
+ /* @__PURE__ */ e(
1281
+ "div",
1282
+ {
1283
+ className: "table-size-grid",
1284
+ style: { gridTemplateColumns: "repeat(10, 18px)" },
1285
+ children: Array.from(
1286
+ { length: 10 },
1287
+ (t, n) => Array.from({ length: 10 }, (l, o) => /* @__PURE__ */ e(
1288
+ "div",
1289
+ {
1290
+ className: `table-cell-preview ${n < ce.rows && o < ce.cols ? "hover" : ""}`,
1291
+ onMouseEnter: () => xt(n, o),
1292
+ onClick: () => wt(n, o)
1293
+ },
1294
+ `${n}-${o}`
1295
+ ))
1296
+ ).flat()
1297
+ }
1298
+ ),
1299
+ /* @__PURE__ */ i("div", { className: "table-size-label", children: [
1300
+ ce.rows,
1301
+ " × ",
1302
+ ce.cols
1303
+ ] })
1304
+ ] })
1305
+ ] }),
1306
+ /* @__PURE__ */ e(
1307
+ "button",
1308
+ {
1309
+ className: "toolbar-btn",
1310
+ onClick: () => fe(!0),
1311
+ title: "Find and Replace",
1312
+ children: /* @__PURE__ */ i("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1313
+ /* @__PURE__ */ e("circle", { cx: "11", cy: "11", r: "8" }),
1314
+ /* @__PURE__ */ e("path", { d: "m21 21-4.35-4.35" })
1315
+ ] })
1316
+ }
1317
+ ),
1318
+ /* @__PURE__ */ e(
1319
+ "button",
1320
+ {
1321
+ className: "toolbar-btn",
1322
+ onClick: () => y("insertHorizontalRule"),
1323
+ title: "Horizontal Rule",
1324
+ children: /* @__PURE__ */ e("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ e("line", { x1: "3", y1: "12", x2: "21", y2: "12" }) })
1325
+ }
1326
+ ),
1327
+ /* @__PURE__ */ e(
1328
+ "button",
1329
+ {
1330
+ className: "toolbar-btn",
1331
+ onClick: qt,
1332
+ title: "Insert Quote",
1333
+ children: /* @__PURE__ */ i("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1334
+ /* @__PURE__ */ e("path", { d: "M3 21c3 0 7-1 7-8V5c0-1.25-.756-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V20c0 1 0 1 1 1z" }),
1335
+ /* @__PURE__ */ e("path", { d: "M15 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v3c0 1 0 1 1 1z" })
1336
+ ] })
1337
+ }
1338
+ ),
1339
+ /* @__PURE__ */ e(
1340
+ "button",
1341
+ {
1342
+ className: "toolbar-btn",
1343
+ onClick: Ft,
1344
+ title: "Code Block",
1345
+ children: /* @__PURE__ */ i("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1346
+ /* @__PURE__ */ e("polyline", { points: "16 18 22 12 16 6" }),
1347
+ /* @__PURE__ */ e("polyline", { points: "8 6 2 12 8 18" })
1348
+ ] })
1349
+ }
1350
+ )
1351
+ ] }),
1352
+ /* @__PURE__ */ e("div", { className: "toolbar-divider" }),
1353
+ /* @__PURE__ */ i("div", { className: "toolbar-group", children: [
1354
+ /* @__PURE__ */ i(
1355
+ "select",
1356
+ {
1357
+ className: "toolbar-select",
1358
+ value: Ee,
1359
+ onChange: (t) => Je(t.target.value),
1360
+ title: "Page size",
1361
+ "aria-label": "Page size",
1362
+ children: [
1363
+ /* @__PURE__ */ e("option", { value: "a0", children: "A0" }),
1364
+ /* @__PURE__ */ e("option", { value: "a1", children: "A1" }),
1365
+ /* @__PURE__ */ e("option", { value: "a2", children: "A2" }),
1366
+ /* @__PURE__ */ e("option", { value: "a3", children: "A3" }),
1367
+ /* @__PURE__ */ e("option", { value: "a4", children: "A4" }),
1368
+ /* @__PURE__ */ e("option", { value: "a5", children: "A5" }),
1369
+ /* @__PURE__ */ e("option", { value: "a6", children: "A6" }),
1370
+ /* @__PURE__ */ e("option", { value: "b0", children: "B0" }),
1371
+ /* @__PURE__ */ e("option", { value: "b1", children: "B1" }),
1372
+ /* @__PURE__ */ e("option", { value: "b2", children: "B2" }),
1373
+ /* @__PURE__ */ e("option", { value: "b3", children: "B3" }),
1374
+ /* @__PURE__ */ e("option", { value: "b4", children: "B4" }),
1375
+ /* @__PURE__ */ e("option", { value: "b5", children: "B5" }),
1376
+ /* @__PURE__ */ e("option", { value: "letter", children: "Letter" }),
1377
+ /* @__PURE__ */ e("option", { value: "legal", children: "Legal" }),
1378
+ /* @__PURE__ */ e("option", { value: "ledger", children: "Ledger" }),
1379
+ /* @__PURE__ */ e("option", { value: "tabloid", children: "Tabloid" }),
1380
+ /* @__PURE__ */ e("option", { value: "executive", children: "Executive" }),
1381
+ /* @__PURE__ */ e("option", { value: "statement", children: "Statement" }),
1382
+ /* @__PURE__ */ e("option", { value: "folio", children: "Folio" }),
1383
+ /* @__PURE__ */ e("option", { value: "c4", children: "C4" }),
1384
+ /* @__PURE__ */ e("option", { value: "c5", children: "C5" }),
1385
+ /* @__PURE__ */ e("option", { value: "monarch", children: "Monarch" }),
1386
+ /* @__PURE__ */ e("option", { value: "dl-envelope", children: "Envelope DL" }),
1387
+ /* @__PURE__ */ e("option", { value: "c6-envelope", children: "Envelope C6" }),
1388
+ /* @__PURE__ */ e("option", { value: "custom", children: "Custom" })
1389
+ ]
1390
+ }
1391
+ ),
1392
+ /* @__PURE__ */ e("button", { className: "toolbar-btn", onClick: () => Ie.current?.click(), title: "Import", children: /* @__PURE__ */ i("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1393
+ /* @__PURE__ */ e("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
1394
+ /* @__PURE__ */ e("polyline", { points: "7 10 12 15 17 10" }),
1395
+ /* @__PURE__ */ e("line", { x1: "12", y1: "15", x2: "12", y2: "3" })
1396
+ ] }) }),
1397
+ /* @__PURE__ */ e("button", { className: "toolbar-btn", onClick: At, title: "Export HTML", children: /* @__PURE__ */ i("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1398
+ /* @__PURE__ */ e("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
1399
+ /* @__PURE__ */ e("polyline", { points: "17 8 12 3 7 8" }),
1400
+ /* @__PURE__ */ e("line", { x1: "12", y1: "3", x2: "12", y2: "15" })
1401
+ ] }) }),
1402
+ /* @__PURE__ */ e("button", { className: "toolbar-btn", onClick: It, title: "View HTML", children: /* @__PURE__ */ i("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1403
+ /* @__PURE__ */ e("polyline", { points: "16 18 22 12 16 6" }),
1404
+ /* @__PURE__ */ e("polyline", { points: "8 6 2 12 8 18" })
1405
+ ] }) }),
1406
+ /* @__PURE__ */ e("button", { className: "toolbar-btn", onClick: Wt, title: "Clear All", children: /* @__PURE__ */ i("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1407
+ /* @__PURE__ */ e("polyline", { points: "3 6 5 6 21 6" }),
1408
+ /* @__PURE__ */ e("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" })
1409
+ ] }) }),
1410
+ /* @__PURE__ */ e("button", { className: "toolbar-btn", onClick: Rt, title: D ? "Exit Fullscreen" : "Fullscreen", children: /* @__PURE__ */ e("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: D ? /* @__PURE__ */ e("path", { d: "M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3" }) : /* @__PURE__ */ e("path", { d: "M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7" }) }) })
1411
+ ] }),
1412
+ /* @__PURE__ */ e("div", { className: "toolbar-divider" }),
1413
+ /* @__PURE__ */ e("div", { className: "toolbar-group", children: /* @__PURE__ */ e(
1414
+ "button",
1415
+ {
1416
+ className: "toolbar-btn",
1417
+ onClick: () => y("removeFormat"),
1418
+ title: "Clear Formatting",
1419
+ children: /* @__PURE__ */ i("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1420
+ /* @__PURE__ */ e("path", { d: "M4 7h16M9 20h6M12 4v16" }),
1421
+ /* @__PURE__ */ e("line", { x1: "3", y1: "3", x2: "21", y2: "21", strokeWidth: "1.5" })
1422
+ ] })
1423
+ }
1424
+ ) })
1425
+ ] }),
1426
+ /* @__PURE__ */ e(
1427
+ "div",
1428
+ {
1429
+ ref: p,
1430
+ className: "page-body",
1431
+ contentEditable: !0,
1432
+ onInput: rt,
1433
+ suppressContentEditableWarning: !0,
1434
+ "data-placeholder": "Start typing your content here...",
1435
+ style: { minHeight: Y || void 0 }
1436
+ }
1437
+ )
1438
+ ]
1439
+ }
1440
+ ) }),
1441
+ me && /* @__PURE__ */ e("div", { className: "rte-drop-overlay", children: "Drop to insert into editor" }),
1442
+ Qe && /* @__PURE__ */ e("div", { className: "modal-overlay", onClick: () => ie(!1), children: /* @__PURE__ */ i("div", { className: "modal-content", onClick: (t) => t.stopPropagation(), children: [
1443
+ /* @__PURE__ */ i("div", { className: "modal-header", children: [
1444
+ /* @__PURE__ */ e("h3", { children: "Insert Table" }),
1445
+ /* @__PURE__ */ e("button", { className: "modal-close", onClick: () => ie(!1), children: "×" })
1446
+ ] }),
1447
+ /* @__PURE__ */ i("div", { className: "modal-body", children: [
1448
+ /* @__PURE__ */ i("div", { className: "form-group", children: [
1449
+ /* @__PURE__ */ e("label", { children: "Rows:" }),
1450
+ /* @__PURE__ */ e(
1451
+ "input",
1452
+ {
1453
+ type: "number",
1454
+ min: "1",
1455
+ max: "20",
1456
+ value: Le,
1457
+ onChange: (t) => Se(parseInt(t.target.value) || 1),
1458
+ className: "form-input"
1459
+ }
1460
+ )
1461
+ ] }),
1462
+ /* @__PURE__ */ i("div", { className: "form-group", children: [
1463
+ /* @__PURE__ */ e("label", { children: "Columns:" }),
1464
+ /* @__PURE__ */ e(
1465
+ "input",
1466
+ {
1467
+ type: "number",
1468
+ min: "1",
1469
+ max: "10",
1470
+ value: Te,
1471
+ onChange: (t) => Me(parseInt(t.target.value) || 1),
1472
+ className: "form-input"
1473
+ }
1474
+ )
1475
+ ] })
1476
+ ] }),
1477
+ /* @__PURE__ */ i("div", { className: "modal-footer", children: [
1478
+ /* @__PURE__ */ e("button", { className: "btn-secondary", onClick: () => ie(!1), children: "Cancel" }),
1479
+ /* @__PURE__ */ e("button", { className: "btn-primary", onClick: We, children: "Insert Table" })
1480
+ ] })
1481
+ ] }) }),
1482
+ ae && /* @__PURE__ */ e("div", { className: "modal-overlay", onClick: () => O(!1), children: /* @__PURE__ */ i("div", { className: "modal-content modal-large", onClick: (t) => t.stopPropagation(), children: [
1483
+ /* @__PURE__ */ i("div", { className: "modal-header", children: [
1484
+ /* @__PURE__ */ e("h3", { children: "HTML Source Code" }),
1485
+ /* @__PURE__ */ e("button", { className: "modal-close", onClick: () => O(!1), children: "×" })
1486
+ ] }),
1487
+ /* @__PURE__ */ e("div", { className: "modal-body", children: /* @__PURE__ */ e("pre", { className: "html-preview", children: Z || "" }) }),
1488
+ /* @__PURE__ */ i("div", { className: "modal-footer", children: [
1489
+ /* @__PURE__ */ e("button", { className: "btn-secondary", onClick: () => O(!1), children: "Close" }),
1490
+ /* @__PURE__ */ e("button", { className: "btn-primary", onClick: Bt, children: "Copy HTML" })
1491
+ ] })
1492
+ ] }) }),
1493
+ _e && /* @__PURE__ */ e("div", { className: "link-modal-overlay", onClick: () => fe(!1), children: /* @__PURE__ */ i("div", { className: "find-replace-modal", onClick: (t) => t.stopPropagation(), children: [
1494
+ /* @__PURE__ */ e("h3", { children: "Find and Replace" }),
1495
+ /* @__PURE__ */ i("div", { className: "find-replace-group", children: [
1496
+ /* @__PURE__ */ e("label", { children: "Find:" }),
1092
1497
  /* @__PURE__ */ e(
1093
1498
  "input",
1094
1499
  {
1095
- type: "color",
1096
- onChange: lt,
1097
- className: "color-picker",
1098
- title: "Text Color",
1099
- defaultValue: "#111827",
1100
- "aria-label": "Text color"
1500
+ type: "text",
1501
+ className: "find-replace-input",
1502
+ value: _,
1503
+ onChange: (t) => Ge(t.target.value),
1504
+ placeholder: "Enter text to find...",
1505
+ autoFocus: !0
1101
1506
  }
1102
- ),
1103
- /* @__PURE__ */ e("span", { className: "color-label", children: "A" }),
1104
- /* @__PURE__ */ e("span", { className: "color-caption", children: "Text color" })
1507
+ )
1105
1508
  ] }),
1106
- /* @__PURE__ */ i("div", { className: "color-picker-wrapper", "data-tooltip": "Highlight / background color", "aria-label": "Background color picker", children: [
1509
+ /* @__PURE__ */ i("div", { className: "find-replace-group", children: [
1510
+ /* @__PURE__ */ e("label", { children: "Replace with:" }),
1107
1511
  /* @__PURE__ */ e(
1108
1512
  "input",
1109
1513
  {
1110
- type: "color",
1111
- onChange: ot,
1112
- className: "color-picker",
1113
- title: "Background Color",
1114
- defaultValue: "#ffffff",
1115
- "aria-label": "Background color"
1514
+ type: "text",
1515
+ className: "find-replace-input",
1516
+ value: ge,
1517
+ onChange: (t) => Ke(t.target.value),
1518
+ placeholder: "Enter replacement text..."
1116
1519
  }
1117
- ),
1118
- /* @__PURE__ */ e("span", { className: "color-label", children: "◼" }),
1119
- /* @__PURE__ */ e("span", { className: "color-caption", children: "Highlight" })
1120
- ] })
1121
- ] }),
1122
- /* @__PURE__ */ e("div", { className: "toolbar-divider" }),
1123
- /* @__PURE__ */ e("div", { className: "toolbar-group", children: /* @__PURE__ */ i("div", { style: { position: "relative", display: "inline-block" }, children: [
1124
- /* @__PURE__ */ e(
1125
- "button",
1126
- {
1127
- className: "toolbar-btn",
1128
- onClick: () => j((t) => !t),
1129
- title: "More formatting",
1130
- children: /* @__PURE__ */ i("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1131
- /* @__PURE__ */ e("circle", { cx: "5", cy: "6", r: "1.2" }),
1132
- /* @__PURE__ */ e("circle", { cx: "5", cy: "12", r: "1.2" }),
1133
- /* @__PURE__ */ e("circle", { cx: "5", cy: "18", r: "1.2" }),
1134
- /* @__PURE__ */ e("line", { x1: "10", y1: "6", x2: "21", y2: "6" }),
1135
- /* @__PURE__ */ e("line", { x1: "10", y1: "12", x2: "21", y2: "12" }),
1136
- /* @__PURE__ */ e("line", { x1: "10", y1: "18", x2: "21", y2: "18" })
1137
- ] })
1138
- }
1139
- ),
1140
- Ve && /* @__PURE__ */ i("div", { className: "toolbar-dropdown-panel", onClick: (t) => t.stopPropagation(), children: [
1141
- /* @__PURE__ */ i("div", { className: "toolbar-dropdown-row", children: [
1142
- /* @__PURE__ */ e("button", { className: `toolbar-btn ${V.justifyLeft ? "active" : ""}`, onClick: () => {
1143
- v("justifyLeft"), j(!1);
1144
- }, title: "Align Left", children: /* @__PURE__ */ i("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1145
- /* @__PURE__ */ e("line", { x1: "17", y1: "10", x2: "3", y2: "10" }),
1146
- /* @__PURE__ */ e("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
1147
- /* @__PURE__ */ e("line", { x1: "21", y1: "14", x2: "3", y2: "14" })
1148
- ] }) }),
1149
- /* @__PURE__ */ e("button", { className: `toolbar-btn ${V.justifyCenter ? "active" : ""}`, onClick: () => {
1150
- v("justifyCenter"), j(!1);
1151
- }, title: "Align Center", children: /* @__PURE__ */ i("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1152
- /* @__PURE__ */ e("line", { x1: "18", y1: "10", x2: "6", y2: "10" }),
1153
- /* @__PURE__ */ e("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
1154
- /* @__PURE__ */ e("line", { x1: "21", y1: "14", x2: "3", y2: "14" })
1155
- ] }) }),
1156
- /* @__PURE__ */ e("button", { className: `toolbar-btn ${V.justifyRight ? "active" : ""}`, onClick: () => {
1157
- v("justifyRight"), j(!1);
1158
- }, title: "Align Right", children: /* @__PURE__ */ i("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1159
- /* @__PURE__ */ e("line", { x1: "21", y1: "10", x2: "7", y2: "10" }),
1160
- /* @__PURE__ */ e("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
1161
- /* @__PURE__ */ e("line", { x1: "21", y1: "14", x2: "3", y2: "14" })
1162
- ] }) })
1163
- ] }),
1164
- /* @__PURE__ */ e("div", { className: "toolbar-dropdown-sep" }),
1165
- /* @__PURE__ */ i("div", { className: "toolbar-dropdown-row", children: [
1166
- /* @__PURE__ */ e("button", { className: `toolbar-btn ${V.insertUnorderedList ? "active" : ""}`, onClick: () => {
1167
- v("insertUnorderedList"), j(!1);
1168
- }, title: "Bullet List", children: /* @__PURE__ */ i("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1169
- /* @__PURE__ */ e("line", { x1: "8", y1: "6", x2: "21", y2: "6" }),
1170
- /* @__PURE__ */ e("line", { x1: "8", y1: "12", x2: "21", y2: "12" }),
1171
- /* @__PURE__ */ e("circle", { cx: "4", cy: "6", r: "1", fill: "currentColor" })
1172
- ] }) }),
1173
- /* @__PURE__ */ e("button", { className: `toolbar-btn ${V.insertOrderedList ? "active" : ""}`, onClick: () => {
1174
- v("insertOrderedList"), j(!1);
1175
- }, title: "Numbered List", children: /* @__PURE__ */ i("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1176
- /* @__PURE__ */ e("line", { x1: "10", y1: "6", x2: "21", y2: "6" }),
1177
- /* @__PURE__ */ e("line", { x1: "10", y1: "12", x2: "21", y2: "12" })
1178
- ] }) }),
1179
- /* @__PURE__ */ e("button", { className: "toolbar-btn", onClick: () => {
1180
- v("indent"), j(!1);
1181
- }, title: "Indent", children: /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ e("line", { x1: "21", y1: "4", x2: "9", y2: "4" }) }) }),
1182
- /* @__PURE__ */ e("button", { className: "toolbar-btn", onClick: () => {
1183
- v("outdent"), j(!1);
1184
- }, title: "Outdent", children: /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ e("line", { x1: "21", y1: "4", x2: "9", y2: "4" }) }) })
1185
- ] })
1520
+ )
1521
+ ] }),
1522
+ Ne && /* @__PURE__ */ e("div", { className: "find-replace-status", children: Ne }),
1523
+ /* @__PURE__ */ i("div", { className: "find-replace-buttons", children: [
1524
+ /* @__PURE__ */ e("button", { className: "find-replace-btn primary", onClick: be, children: "Find Next" }),
1525
+ /* @__PURE__ */ e("button", { className: "find-replace-btn", onClick: kt, children: "Replace" }),
1526
+ /* @__PURE__ */ e("button", { className: "find-replace-btn", onClick: Nt, children: "Replace All" }),
1527
+ /* @__PURE__ */ e("button", { className: "find-replace-btn", onClick: () => fe(!1), children: "Close" })
1186
1528
  ] })
1187
1529
  ] }) }),
1188
- /* @__PURE__ */ e("div", { className: "toolbar-divider" }),
1189
- /* @__PURE__ */ i("div", { className: "toolbar-group", children: [
1190
- /* @__PURE__ */ e(
1191
- "button",
1192
- {
1193
- className: "toolbar-btn",
1194
- onClick: et,
1195
- title: "Insert Link",
1196
- children: /* @__PURE__ */ i("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1197
- /* @__PURE__ */ e("path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }),
1198
- /* @__PURE__ */ e("path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" })
1199
- ] })
1200
- }
1201
- ),
1202
- /* @__PURE__ */ e(
1203
- "button",
1204
- {
1205
- className: "toolbar-btn",
1206
- onClick: ct,
1207
- title: "Insert Image",
1208
- children: /* @__PURE__ */ i("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1209
- /* @__PURE__ */ e("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
1210
- /* @__PURE__ */ e("circle", { cx: "8.5", cy: "8.5", r: "1.5" }),
1211
- /* @__PURE__ */ e("polyline", { points: "21 15 16 10 5 21" })
1212
- ] })
1213
- }
1214
- ),
1215
- /* @__PURE__ */ i("div", { style: { position: "relative", display: "inline-block" }, children: [
1216
- /* @__PURE__ */ e(
1217
- "button",
1218
- {
1219
- className: "toolbar-btn",
1220
- onClick: () => G(!ee),
1221
- title: "Insert Table",
1222
- children: /* @__PURE__ */ i("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1223
- /* @__PURE__ */ e("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
1224
- /* @__PURE__ */ e("line", { x1: "3", y1: "9", x2: "21", y2: "9" }),
1225
- /* @__PURE__ */ e("line", { x1: "3", y1: "15", x2: "21", y2: "15" }),
1226
- /* @__PURE__ */ e("line", { x1: "9", y1: "3", x2: "9", y2: "21" }),
1227
- /* @__PURE__ */ e("line", { x1: "15", y1: "3", x2: "15", y2: "21" })
1228
- ] })
1229
- }
1230
- ),
1231
- ee && /* @__PURE__ */ i("div", { className: "table-size-picker show", children: [
1530
+ R && /* @__PURE__ */ e("div", { className: "modal-overlay", onClick: () => V(!1), children: /* @__PURE__ */ i("div", { className: "modal-content", onClick: (t) => t.stopPropagation(), children: [
1531
+ /* @__PURE__ */ i("div", { className: "modal-header", children: [
1532
+ /* @__PURE__ */ e("h3", { children: "Insert Image" }),
1533
+ /* @__PURE__ */ e("button", { className: "modal-close", onClick: () => V(!1), children: "×" })
1534
+ ] }),
1535
+ /* @__PURE__ */ i("div", { className: "modal-body", children: [
1536
+ /* @__PURE__ */ i("div", { className: "form-group", children: [
1537
+ /* @__PURE__ */ e("label", { children: "Image URL:" }),
1232
1538
  /* @__PURE__ */ e(
1233
- "div",
1539
+ "input",
1234
1540
  {
1235
- className: "table-size-grid",
1236
- style: { gridTemplateColumns: "repeat(10, 18px)" },
1237
- children: Array.from(
1238
- { length: 10 },
1239
- (t, n) => Array.from({ length: 10 }, (l, r) => /* @__PURE__ */ e(
1240
- "div",
1241
- {
1242
- className: `table-cell-preview ${n < L.rows && r < L.cols ? "hover" : ""}`,
1243
- onMouseEnter: () => ut(n, r),
1244
- onClick: () => mt(n, r)
1245
- },
1246
- `${n}-${r}`
1247
- ))
1248
- ).flat()
1541
+ type: "text",
1542
+ placeholder: "https://example.com/image.jpg",
1543
+ value: pe,
1544
+ onChange: (t) => xe(t.target.value),
1545
+ className: "form-input"
1249
1546
  }
1250
1547
  ),
1251
- /* @__PURE__ */ i("div", { className: "table-size-label", children: [
1252
- L.rows,
1253
- " × ",
1254
- L.cols
1255
- ] })
1548
+ /* @__PURE__ */ e("button", { className: "btn-primary", onClick: yt, style: { marginTop: "10px", width: "100%" }, children: "Insert from URL" })
1549
+ ] }),
1550
+ /* @__PURE__ */ i("div", { className: "form-group", style: { marginTop: "20px" }, children: [
1551
+ /* @__PURE__ */ e("label", { children: "Or upload from your device:" }),
1552
+ /* @__PURE__ */ e(
1553
+ "input",
1554
+ {
1555
+ type: "file",
1556
+ ref: ot,
1557
+ onChange: vt,
1558
+ accept: "image/*",
1559
+ className: "form-input",
1560
+ style: { padding: "8px" }
1561
+ }
1562
+ )
1256
1563
  ] })
1257
1564
  ] }),
1258
- /* @__PURE__ */ e(
1259
- "button",
1260
- {
1261
- className: "toolbar-btn",
1262
- onClick: () => me(!0),
1263
- title: "Find and Replace",
1264
- children: /* @__PURE__ */ i("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1265
- /* @__PURE__ */ e("circle", { cx: "11", cy: "11", r: "8" }),
1266
- /* @__PURE__ */ e("path", { d: "m21 21-4.35-4.35" })
1267
- ] })
1268
- }
1269
- ),
1270
- /* @__PURE__ */ e(
1271
- "button",
1272
- {
1273
- className: "toolbar-btn",
1274
- onClick: () => v("insertHorizontalRule"),
1275
- title: "Horizontal Rule",
1276
- children: /* @__PURE__ */ e("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ e("line", { x1: "3", y1: "12", x2: "21", y2: "12" }) })
1277
- }
1278
- ),
1279
- /* @__PURE__ */ e(
1280
- "button",
1281
- {
1282
- className: "toolbar-btn",
1283
- onClick: Mt,
1284
- title: "Insert Quote",
1285
- children: /* @__PURE__ */ i("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1286
- /* @__PURE__ */ e("path", { d: "M3 21c3 0 7-1 7-8V5c0-1.25-.756-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V20c0 1 0 1 1 1z" }),
1287
- /* @__PURE__ */ e("path", { d: "M15 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v3c0 1 0 1 1 1z" })
1288
- ] })
1289
- }
1290
- ),
1291
- /* @__PURE__ */ e(
1292
- "button",
1293
- {
1294
- className: "toolbar-btn",
1295
- onClick: Tt,
1296
- title: "Code Block",
1297
- children: /* @__PURE__ */ i("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1298
- /* @__PURE__ */ e("polyline", { points: "16 18 22 12 16 6" }),
1299
- /* @__PURE__ */ e("polyline", { points: "8 6 2 12 8 18" })
1300
- ] })
1301
- }
1302
- )
1303
- ] }),
1304
- /* @__PURE__ */ e("div", { className: "toolbar-divider" }),
1305
- /* @__PURE__ */ i("div", { className: "toolbar-group", children: [
1306
- /* @__PURE__ */ i(
1307
- "select",
1308
- {
1309
- className: "toolbar-select",
1310
- value: ke,
1311
- onChange: (t) => Xe(t.target.value),
1312
- title: "Page size",
1313
- "aria-label": "Page size",
1314
- children: [
1315
- /* @__PURE__ */ e("option", { value: "a0", children: "A0" }),
1316
- /* @__PURE__ */ e("option", { value: "a1", children: "A1" }),
1317
- /* @__PURE__ */ e("option", { value: "a2", children: "A2" }),
1318
- /* @__PURE__ */ e("option", { value: "a3", children: "A3" }),
1319
- /* @__PURE__ */ e("option", { value: "a4", children: "A4" }),
1320
- /* @__PURE__ */ e("option", { value: "a5", children: "A5" }),
1321
- /* @__PURE__ */ e("option", { value: "a6", children: "A6" }),
1322
- /* @__PURE__ */ e("option", { value: "b0", children: "B0" }),
1323
- /* @__PURE__ */ e("option", { value: "b1", children: "B1" }),
1324
- /* @__PURE__ */ e("option", { value: "b2", children: "B2" }),
1325
- /* @__PURE__ */ e("option", { value: "b3", children: "B3" }),
1326
- /* @__PURE__ */ e("option", { value: "b4", children: "B4" }),
1327
- /* @__PURE__ */ e("option", { value: "b5", children: "B5" }),
1328
- /* @__PURE__ */ e("option", { value: "letter", children: "Letter" }),
1329
- /* @__PURE__ */ e("option", { value: "legal", children: "Legal" }),
1330
- /* @__PURE__ */ e("option", { value: "ledger", children: "Ledger" }),
1331
- /* @__PURE__ */ e("option", { value: "tabloid", children: "Tabloid" }),
1332
- /* @__PURE__ */ e("option", { value: "executive", children: "Executive" }),
1333
- /* @__PURE__ */ e("option", { value: "statement", children: "Statement" }),
1334
- /* @__PURE__ */ e("option", { value: "folio", children: "Folio" }),
1335
- /* @__PURE__ */ e("option", { value: "c4", children: "C4" }),
1336
- /* @__PURE__ */ e("option", { value: "c5", children: "C5" }),
1337
- /* @__PURE__ */ e("option", { value: "monarch", children: "Monarch" }),
1338
- /* @__PURE__ */ e("option", { value: "dl-envelope", children: "Envelope DL" }),
1339
- /* @__PURE__ */ e("option", { value: "c6-envelope", children: "Envelope C6" }),
1340
- /* @__PURE__ */ e("option", { value: "custom", children: "Custom" })
1341
- ]
1342
- }
1343
- ),
1344
- /* @__PURE__ */ e("button", { className: "toolbar-btn", onClick: () => Te.current?.click(), title: "Import", children: /* @__PURE__ */ i("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1345
- /* @__PURE__ */ e("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
1346
- /* @__PURE__ */ e("polyline", { points: "7 10 12 15 17 10" }),
1347
- /* @__PURE__ */ e("line", { x1: "12", y1: "15", x2: "12", y2: "3" })
1348
- ] }) }),
1349
- /* @__PURE__ */ e("button", { className: "toolbar-btn", onClick: wt, title: "Export HTML", children: /* @__PURE__ */ i("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1350
- /* @__PURE__ */ e("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
1351
- /* @__PURE__ */ e("polyline", { points: "17 8 12 3 7 8" }),
1352
- /* @__PURE__ */ e("line", { x1: "12", y1: "3", x2: "12", y2: "15" })
1353
- ] }) }),
1354
- /* @__PURE__ */ e("button", { className: "toolbar-btn", onClick: Nt, title: "View HTML", children: /* @__PURE__ */ i("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1355
- /* @__PURE__ */ e("polyline", { points: "16 18 22 12 16 6" }),
1356
- /* @__PURE__ */ e("polyline", { points: "8 6 2 12 8 18" })
1357
- ] }) }),
1358
- /* @__PURE__ */ e("button", { className: "toolbar-btn", onClick: St, title: "Clear All", children: /* @__PURE__ */ i("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1359
- /* @__PURE__ */ e("polyline", { points: "3 6 5 6 21 6" }),
1360
- /* @__PURE__ */ e("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" })
1361
- ] }) }),
1362
- /* @__PURE__ */ e("button", { className: "toolbar-btn", onClick: xt, title: _ ? "Exit Fullscreen" : "Fullscreen", children: /* @__PURE__ */ e("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: _ ? /* @__PURE__ */ e("path", { d: "M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3" }) : /* @__PURE__ */ e("path", { d: "M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7" }) }) })
1363
- ] }),
1364
- /* @__PURE__ */ e("div", { className: "toolbar-divider" }),
1365
- /* @__PURE__ */ e("div", { className: "toolbar-group", children: /* @__PURE__ */ e(
1366
- "button",
1367
- {
1368
- className: "toolbar-btn",
1369
- onClick: () => v("removeFormat"),
1370
- title: "Clear Formatting",
1371
- children: /* @__PURE__ */ i("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1372
- /* @__PURE__ */ e("path", { d: "M4 7h16M9 20h6M12 4v16" }),
1373
- /* @__PURE__ */ e("line", { x1: "3", y1: "3", x2: "21", y2: "21", strokeWidth: "1.5" })
1374
- ] })
1375
- }
1376
- ) })
1377
- ] }),
1378
- /* @__PURE__ */ e(
1379
- "div",
1380
- {
1381
- ref: f,
1382
- className: "page-body",
1383
- contentEditable: !0,
1384
- onInput: Ze,
1385
- suppressContentEditableWarning: !0,
1386
- "data-placeholder": "Start typing your content here..."
1387
- }
1388
- )
1389
- ] }) }),
1390
- De && /* @__PURE__ */ e("div", { className: "modal-overlay", onClick: () => ae(!1), children: /* @__PURE__ */ i("div", { className: "modal-content", onClick: (t) => t.stopPropagation(), children: [
1391
- /* @__PURE__ */ i("div", { className: "modal-header", children: [
1392
- /* @__PURE__ */ e("h3", { children: "Insert Table" }),
1393
- /* @__PURE__ */ e("button", { className: "modal-close", onClick: () => ae(!1), children: "×" })
1394
- ] }),
1395
- /* @__PURE__ */ i("div", { className: "modal-body", children: [
1396
- /* @__PURE__ */ i("div", { className: "form-group", children: [
1397
- /* @__PURE__ */ e("label", { children: "Rows:" }),
1398
- /* @__PURE__ */ e(
1399
- "input",
1400
- {
1401
- type: "number",
1402
- min: "1",
1403
- max: "20",
1404
- value: be,
1405
- onChange: (t) => Ce(parseInt(t.target.value) || 1),
1406
- className: "form-input"
1407
- }
1408
- )
1409
- ] }),
1410
- /* @__PURE__ */ i("div", { className: "form-group", children: [
1411
- /* @__PURE__ */ e("label", { children: "Columns:" }),
1412
- /* @__PURE__ */ e(
1413
- "input",
1414
- {
1415
- type: "number",
1416
- min: "1",
1417
- max: "10",
1418
- value: xe,
1419
- onChange: (t) => we(parseInt(t.target.value) || 1),
1420
- className: "form-input"
1421
- }
1422
- )
1423
- ] })
1424
- ] }),
1425
- /* @__PURE__ */ i("div", { className: "modal-footer", children: [
1426
- /* @__PURE__ */ e("button", { className: "btn-secondary", onClick: () => ae(!1), children: "Cancel" }),
1427
- /* @__PURE__ */ e("button", { className: "btn-primary", onClick: Re, children: "Insert Table" })
1428
- ] })
1429
- ] }) }),
1430
- he && /* @__PURE__ */ e("div", { className: "modal-overlay", onClick: () => O(!1), children: /* @__PURE__ */ i("div", { className: "modal-content modal-large", onClick: (t) => t.stopPropagation(), children: [
1431
- /* @__PURE__ */ i("div", { className: "modal-header", children: [
1432
- /* @__PURE__ */ e("h3", { children: "HTML Source Code" }),
1433
- /* @__PURE__ */ e("button", { className: "modal-close", onClick: () => O(!1), children: "×" })
1434
- ] }),
1435
- /* @__PURE__ */ e("div", { className: "modal-body", children: /* @__PURE__ */ e("pre", { className: "html-preview", children: J || "" }) }),
1436
- /* @__PURE__ */ i("div", { className: "modal-footer", children: [
1437
- /* @__PURE__ */ e("button", { className: "btn-secondary", onClick: () => O(!1), children: "Close" }),
1438
- /* @__PURE__ */ e("button", { className: "btn-primary", onClick: Lt, children: "Copy HTML" })
1439
- ] })
1440
- ] }) }),
1441
- ze && /* @__PURE__ */ e("div", { className: "link-modal-overlay", onClick: () => me(!1), children: /* @__PURE__ */ i("div", { className: "find-replace-modal", onClick: (t) => t.stopPropagation(), children: [
1442
- /* @__PURE__ */ e("h3", { children: "Find and Replace" }),
1443
- /* @__PURE__ */ i("div", { className: "find-replace-group", children: [
1444
- /* @__PURE__ */ e("label", { children: "Find:" }),
1445
- /* @__PURE__ */ e(
1446
- "input",
1447
- {
1448
- type: "text",
1449
- className: "find-replace-input",
1450
- value: X,
1451
- onChange: (t) => Oe(t.target.value),
1452
- placeholder: "Enter text to find...",
1453
- autoFocus: !0
1454
- }
1455
- )
1456
- ] }),
1457
- /* @__PURE__ */ i("div", { className: "find-replace-group", children: [
1458
- /* @__PURE__ */ e("label", { children: "Replace with:" }),
1565
+ /* @__PURE__ */ e("div", { className: "modal-footer", children: /* @__PURE__ */ e("button", { className: "btn-secondary", onClick: () => V(!1), children: "Cancel" }) })
1566
+ ] }) }),
1459
1567
  /* @__PURE__ */ e(
1460
- "input",
1568
+ Dt,
1461
1569
  {
1462
- type: "text",
1463
- className: "find-replace-input",
1464
- value: pe,
1465
- onChange: (t) => je(t.target.value),
1466
- placeholder: "Enter replacement text..."
1570
+ isOpen: te.open,
1571
+ onClose: () => ne((t) => ({ ...t, open: !1 })),
1572
+ onInsert: dt,
1573
+ onRemove: ht,
1574
+ isEditing: !!te.isEditing,
1575
+ initialUrl: te.initialUrl,
1576
+ initialText: te.initialText,
1577
+ existingLinks: te.existingLinks
1467
1578
  }
1468
1579
  )
1469
- ] }),
1470
- ye && /* @__PURE__ */ e("div", { className: "find-replace-status", children: ye }),
1471
- /* @__PURE__ */ i("div", { className: "find-replace-buttons", children: [
1472
- /* @__PURE__ */ e("button", { className: "find-replace-btn primary", onClick: ge, children: "Find Next" }),
1473
- /* @__PURE__ */ e("button", { className: "find-replace-btn", onClick: pt, children: "Replace" }),
1474
- /* @__PURE__ */ e("button", { className: "find-replace-btn", onClick: ft, children: "Replace All" }),
1475
- /* @__PURE__ */ e("button", { className: "find-replace-btn", onClick: () => me(!1), children: "Close" })
1476
- ] })
1477
- ] }) }),
1478
- Z && /* @__PURE__ */ e("div", { className: "modal-overlay", onClick: () => F(!1), children: /* @__PURE__ */ i("div", { className: "modal-content", onClick: (t) => t.stopPropagation(), children: [
1479
- /* @__PURE__ */ i("div", { className: "modal-header", children: [
1480
- /* @__PURE__ */ e("h3", { children: "Insert Image" }),
1481
- /* @__PURE__ */ e("button", { className: "modal-close", onClick: () => F(!1), children: "×" })
1482
- ] }),
1483
- /* @__PURE__ */ i("div", { className: "modal-body", children: [
1484
- /* @__PURE__ */ i("div", { className: "form-group", children: [
1485
- /* @__PURE__ */ e("label", { children: "Image URL:" }),
1486
- /* @__PURE__ */ e(
1487
- "input",
1488
- {
1489
- type: "text",
1490
- placeholder: "https://example.com/image.jpg",
1491
- value: D,
1492
- onChange: (t) => Y(t.target.value),
1493
- className: "form-input"
1494
- }
1495
- ),
1496
- /* @__PURE__ */ e("button", { className: "btn-primary", onClick: it, style: { marginTop: "10px", width: "100%" }, children: "Insert from URL" })
1497
- ] }),
1498
- /* @__PURE__ */ i("div", { className: "form-group", style: { marginTop: "20px" }, children: [
1499
- /* @__PURE__ */ e("label", { children: "Or upload from your device:" }),
1500
- /* @__PURE__ */ e(
1501
- "input",
1502
- {
1503
- type: "file",
1504
- ref: Je,
1505
- onChange: st,
1506
- accept: "image/*",
1507
- className: "form-input",
1508
- style: { padding: "8px" }
1509
- }
1510
- )
1511
- ] })
1512
- ] }),
1513
- /* @__PURE__ */ e("div", { className: "modal-footer", children: /* @__PURE__ */ e("button", { className: "btn-secondary", onClick: () => F(!1), children: "Cancel" }) })
1514
- ] }) }),
1515
- /* @__PURE__ */ e(
1516
- It,
1517
- {
1518
- isOpen: te.open,
1519
- onClose: () => ne((t) => ({ ...t, open: !1 })),
1520
- onInsert: tt,
1521
- onRemove: nt,
1522
- isEditing: !!te.isEditing,
1523
- initialUrl: te.initialUrl,
1524
- initialText: te.initialText,
1525
- existingLinks: te.existingLinks
1526
- }
1527
- )
1528
- ] });
1580
+ ]
1581
+ }
1582
+ );
1529
1583
  };
1530
1584
  export {
1531
- It as LinkModal,
1532
- qt as RichTextEditor
1585
+ Dt as LinkModal,
1586
+ Xt as RichTextEditor
1533
1587
  };