eddyter 1.3.70 → 1.3.71

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,74 +1,74 @@
1
- import { jsx as t, jsxs as n, Fragment as ot } from "react/jsx-runtime";
2
- import { I as it } from "./ImageResizer-CbtUYHip.js";
1
+ import { jsx as t, jsxs as s, Fragment as it } from "react/jsx-runtime";
2
+ import { I as nt } from "./ImageResizer-FrE13F54.js";
3
3
  import { CodeNode as xe } from "@lexical/code";
4
4
  import { LinkNode as Ce } from "@lexical/link";
5
- import { AutoFocusPlugin as nt } from "@lexical/react/LexicalAutoFocusPlugin";
6
- import { useCollaborationContext as ct } from "@lexical/react/LexicalCollaborationContext";
7
- import { useLexicalComposerContext as at } from "@lexical/react/LexicalComposerContext";
8
- import { ContentEditable as ye } from "@lexical/react/LexicalContentEditable";
9
- import { LexicalErrorBoundary as Ne } from "@lexical/react/LexicalErrorBoundary";
10
- import { HistoryPlugin as we } from "@lexical/react/LexicalHistoryPlugin";
11
- import { LexicalNestedComposer as ve } from "@lexical/react/LexicalNestedComposer";
12
- import { OnChangePlugin as Ee } from "@lexical/react/LexicalOnChangePlugin";
13
- import { RichTextPlugin as ke } from "@lexical/react/LexicalRichTextPlugin";
5
+ import { AutoFocusPlugin as ct } from "@lexical/react/LexicalAutoFocusPlugin";
6
+ import { useCollaborationContext as at } from "@lexical/react/LexicalCollaborationContext";
7
+ import { useLexicalComposerContext as st } from "@lexical/react/LexicalComposerContext";
8
+ import { ContentEditable as Ne } from "@lexical/react/LexicalContentEditable";
9
+ import { LexicalErrorBoundary as we } from "@lexical/react/LexicalErrorBoundary";
10
+ import { HistoryPlugin as ve } from "@lexical/react/LexicalHistoryPlugin";
11
+ import { LexicalNestedComposer as Ee } from "@lexical/react/LexicalNestedComposer";
12
+ import { OnChangePlugin as ke } from "@lexical/react/LexicalOnChangePlugin";
13
+ import { RichTextPlugin as Ie } from "@lexical/react/LexicalRichTextPlugin";
14
14
  import { useLexicalEditable as dt } from "@lexical/react/useLexicalEditable";
15
- import { useLexicalNodeSelection as st } from "@lexical/react/useLexicalNodeSelection";
16
- import { mergeRegister as lt } from "@lexical/utils";
17
- import { RootNode as Ie, TextNode as Re, LineBreakNode as Pe, ParagraphNode as Se, $getSelection as _, $isNodeSelection as L, $isParagraphNode as pe, $setSelection as Q, $isRangeSelection as mt, SELECTION_CHANGE_COMMAND as ut, COMMAND_PRIORITY_LOW as w, CLICK_COMMAND as gt, DRAGSTART_COMMAND as ft, KEY_DELETE_COMMAND as pt, KEY_BACKSPACE_COMMAND as ht, KEY_ENTER_COMMAND as bt, KEY_ESCAPE_COMMAND as xt, createCommand as Ct, $getNodeByKey as $ } from "lexical";
18
- import { useRef as G, useState as f, useEffect as U, useCallback as C, Suspense as yt } from "react";
19
- import { a as Nt, D as wt, b as vt, d as Et, e as kt, f as It, h as Rt, B as he, L as De, i as Ae, u as Pt, $ as M, W as St, j as Dt, A as At, k as Lt, l as Mt, T as Ot, m as _t, S as $t, E as zt, n as Wt, t as v, o as jt, p as Kt, C as Tt } from "./index-DJEsPHep.js";
20
- const Bt = Nt("Link2", [
15
+ import { useLexicalNodeSelection as lt } from "@lexical/react/useLexicalNodeSelection";
16
+ import { mergeRegister as mt } from "@lexical/utils";
17
+ import { RootNode as Re, TextNode as Pe, LineBreakNode as De, ParagraphNode as Se, $getSelection as O, $isNodeSelection as L, $isParagraphNode as Z, $setSelection as ee, $isRangeSelection as ut, SELECTION_CHANGE_COMMAND as gt, COMMAND_PRIORITY_LOW as v, CLICK_COMMAND as ft, DRAGSTART_COMMAND as pt, KEY_DELETE_COMMAND as ht, KEY_BACKSPACE_COMMAND as bt, KEY_ENTER_COMMAND as yt, KEY_ESCAPE_COMMAND as xt, createCommand as Ct, $getNodeByKey as _ } from "lexical";
18
+ import { useRef as z, useState as p, useEffect as te, useLayoutEffect as Nt, useCallback as x, Suspense as wt } from "react";
19
+ import { a as vt, D as Et, b as kt, d as It, e as Rt, f as Pt, h as Dt, B as be, L as Ae, i as Le, u as St, $ as M, W as At, j as Lt, A as Mt, k as $t, l as Ot, T as _t, m as zt, S as Wt, E as jt, n as Kt, t as E, o as Bt, p as Tt, C as Ft } from "./index-BgjRNNca.js";
20
+ const Gt = vt("Link2", [
21
21
  ["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }],
22
22
  ["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }],
23
23
  ["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }]
24
- ]), Gt = ({
25
- open: l,
26
- onOpenChange: c,
27
- oldImageUrl: u,
28
- newImageUrl: b,
29
- onReplace: y,
24
+ ]), Yt = ({
25
+ open: u,
26
+ onOpenChange: d,
27
+ oldImageUrl: g,
28
+ newImageUrl: f,
29
+ onReplace: C,
30
30
  onCancel: N
31
- }) => /* @__PURE__ */ t(wt, { open: l, onOpenChange: c, children: /* @__PURE__ */ n(vt, { className: "sm:max-w-[800px] max-h-[90vh] overflow-y-auto", children: [
32
- /* @__PURE__ */ n(Et, { children: [
33
- /* @__PURE__ */ n(kt, { className: "flex items-center gap-2 text-xl", children: [
31
+ }) => /* @__PURE__ */ t(Et, { open: u, onOpenChange: d, children: /* @__PURE__ */ s(kt, { className: "sm:max-w-[800px] max-h-[90vh] overflow-y-auto", children: [
32
+ /* @__PURE__ */ s(It, { children: [
33
+ /* @__PURE__ */ s(Rt, { className: "flex items-center gap-2 text-xl", children: [
34
34
  /* @__PURE__ */ t("span", { className: "text-2xl", children: "🔄" }),
35
35
  "Compare Images"
36
36
  ] }),
37
- /* @__PURE__ */ t(It, { className: "text-sm pt-1", children: "Choose whether to replace the original image with the refined version." })
37
+ /* @__PURE__ */ t(Pt, { className: "text-sm pt-1", children: "Choose whether to replace the original image with the refined version." })
38
38
  ] }),
39
- /* @__PURE__ */ n("div", { className: "space-y-4 py-4", children: [
40
- /* @__PURE__ */ t("div", { className: "grid grid-cols-2 gap-4", children: /* @__PURE__ */ n("div", { className: "space-y-2", children: [
41
- /* @__PURE__ */ n("div", { className: "flex items-center justify-between", children: [
39
+ /* @__PURE__ */ s("div", { className: "space-y-4 py-4", children: [
40
+ /* @__PURE__ */ t("div", { className: "grid grid-cols-2 gap-4", children: /* @__PURE__ */ s("div", { className: "space-y-2", children: [
41
+ /* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
42
42
  /* @__PURE__ */ t("span", { className: "text-sm font-semibold text-gray-700 dark:text-gray-300", children: "Refined Image" }),
43
43
  /* @__PURE__ */ t("span", { className: "text-xs px-2 py-1 rounded-full bg-blue-100 dark:bg-blue-950/30 text-blue-600 dark:text-blue-400", children: "New" })
44
44
  ] }),
45
45
  /* @__PURE__ */ t("div", { className: "relative aspect-square rounded-lg overflow-hidden bg-gray-100 dark:bg-gray-800 border-2 border-blue-500 dark:border-blue-600", children: /* @__PURE__ */ t(
46
46
  "img",
47
47
  {
48
- src: b,
48
+ src: f,
49
49
  alt: "Refined",
50
50
  className: "w-full h-full object-contain"
51
51
  }
52
52
  ) })
53
53
  ] }) }),
54
- /* @__PURE__ */ t("div", { className: "p-3 rounded-lg bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800", children: /* @__PURE__ */ n("p", { className: "text-sm text-blue-800 dark:text-blue-200", children: [
54
+ /* @__PURE__ */ t("div", { className: "p-3 rounded-lg bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800", children: /* @__PURE__ */ s("p", { className: "text-sm text-blue-800 dark:text-blue-200", children: [
55
55
  /* @__PURE__ */ t("span", { className: "font-semibold", children: "Note:" }),
56
56
  ' Clicking "Replace" will update the image in your document. This action cannot be undone.'
57
57
  ] }) })
58
58
  ] }),
59
- /* @__PURE__ */ n(Rt, { className: "gap-2", children: [
59
+ /* @__PURE__ */ s(Dt, { className: "gap-2", children: [
60
60
  /* @__PURE__ */ t(
61
- he,
61
+ be,
62
62
  {
63
63
  variant: "outline",
64
64
  onClick: N,
65
65
  children: "Keep Original"
66
66
  }
67
67
  ),
68
- /* @__PURE__ */ n(
69
- he,
68
+ /* @__PURE__ */ s(
69
+ be,
70
70
  {
71
- onClick: y,
71
+ onClick: C,
72
72
  className: "bg-blue-500 hover:bg-blue-600 text-white",
73
73
  children: [
74
74
  /* @__PURE__ */ t("span", { className: "mr-2", children: "✓" }),
@@ -78,27 +78,27 @@ const Bt = Nt("Link2", [
78
78
  )
79
79
  ] })
80
80
  ] }) });
81
- function Yt({
82
- caption: l
81
+ function Ht({
82
+ caption: u
83
83
  }) {
84
- return /* @__PURE__ */ t("div", { className: "signature-caption-container", children: /* @__PURE__ */ n(
85
- ve,
84
+ return /* @__PURE__ */ t("div", { className: "signature-caption-container", children: /* @__PURE__ */ s(
85
+ Ee,
86
86
  {
87
- initialEditor: l,
87
+ initialEditor: u,
88
88
  initialNodes: [
89
- Ie,
90
89
  Re,
91
90
  Pe,
91
+ De,
92
92
  Se,
93
93
  Ce,
94
94
  xe
95
95
  ],
96
96
  children: [
97
97
  /* @__PURE__ */ t(
98
- ke,
98
+ Ie,
99
99
  {
100
100
  contentEditable: /* @__PURE__ */ t(
101
- ye,
101
+ Ne,
102
102
  {
103
103
  "aria-placeholder": "Enter signature name...",
104
104
  placeholder: /* @__PURE__ */ t("div", { style: {
@@ -114,54 +114,60 @@ function Yt({
114
114
  className: "signature-caption-editable"
115
115
  }
116
116
  ),
117
- ErrorBoundary: Ne
117
+ ErrorBoundary: we
118
118
  }
119
119
  ),
120
- /* @__PURE__ */ t(Ee, { onChange: () => {
120
+ /* @__PURE__ */ t(ke, { onChange: () => {
121
121
  } }),
122
- /* @__PURE__ */ t(we, {}),
123
- /* @__PURE__ */ t(De, { namespace: Ae.namespace })
122
+ /* @__PURE__ */ t(ve, {}),
123
+ /* @__PURE__ */ t(Ae, { namespace: Le.namespace })
124
124
  ]
125
125
  }
126
126
  ) });
127
127
  }
128
- const Z = /* @__PURE__ */ new Set(), be = Ct("RIGHT_CLICK_IMAGE_COMMAND");
129
- function Ft(l) {
130
- if (!Z.has(l))
131
- throw new Promise((c) => {
132
- const u = new Image();
133
- u.src = l, u.onload = () => {
134
- Z.add(l), c(null);
135
- }, u.onerror = () => {
136
- Z.add(l);
128
+ const re = /* @__PURE__ */ new Set(), ye = Ct("RIGHT_CLICK_IMAGE_COMMAND");
129
+ function qt(u) {
130
+ if (!re.has(u))
131
+ throw new Promise((d) => {
132
+ const g = new Image();
133
+ g.src = u, g.onload = () => {
134
+ re.add(u), d(null);
135
+ }, g.onerror = () => {
136
+ re.add(u);
137
137
  };
138
138
  });
139
139
  }
140
- function Ht({
141
- altText: l,
142
- className: c,
143
- imageRef: u,
144
- src: b,
145
- width: y,
140
+ function Xt({
141
+ altText: u,
142
+ className: d,
143
+ imageRef: g,
144
+ src: f,
145
+ width: C,
146
146
  height: N,
147
- maxWidth: ee,
147
+ maxWidth: oe,
148
148
  onError: I
149
149
  }) {
150
- return Ft(b), /* @__PURE__ */ t(
150
+ qt(f);
151
+ const w = typeof C == "number" && typeof N == "number", W = typeof C == "number" ? C : "auto";
152
+ return /* @__PURE__ */ t(
151
153
  "img",
152
154
  {
153
- className: c || void 0,
154
- src: b,
155
- alt: l,
156
- ref: u,
157
- style: typeof y == "number" && typeof N == "number" ? {
158
- // User has set a numeric size or original dimensions are provided
159
- width: typeof y == "number" ? y : "auto",
160
- height: typeof N == "number" ? N : "auto",
155
+ className: d || void 0,
156
+ src: f,
157
+ alt: u,
158
+ ref: g,
159
+ style: w ? {
160
+ width: W,
161
+ // Use height: auto + aspect-ratio so the image scales
162
+ // proportionally when max-width constrains on small screens.
163
+ // The useLayoutEffect in ImageComponent widens the container
164
+ // to fit the explicit width on desktop.
165
+ height: "auto",
166
+ aspectRatio: `${W} / ${typeof N == "number" ? N : "auto"}`,
161
167
  maxWidth: "100%"
162
168
  } : {
163
- // No dimensions specified - use original image size
164
- maxWidth: "100%",
169
+ // No dimensions specified - use original image size.
170
+ // max-width from CSS rule prevents overflow.
165
171
  height: "auto"
166
172
  },
167
173
  onError: I,
@@ -169,7 +175,7 @@ function Ht({
169
175
  }
170
176
  );
171
177
  }
172
- function qt() {
178
+ function Vt() {
173
179
  return /* @__PURE__ */ t(
174
180
  "img",
175
181
  {
@@ -183,171 +189,181 @@ function qt() {
183
189
  }
184
190
  );
185
191
  }
186
- function Cr({
187
- src: l,
188
- altText: c,
189
- nodeKey: u,
190
- width: b,
191
- height: y,
192
+ function Nr({
193
+ src: u,
194
+ altText: d,
195
+ nodeKey: g,
196
+ width: f,
197
+ height: C,
192
198
  maxWidth: N,
193
- resizable: ee,
199
+ resizable: oe,
194
200
  showCaption: I,
195
- caption: E,
196
- captionsEnabled: te,
201
+ caption: w,
202
+ captionsEnabled: W,
197
203
  originalPrompt: R,
198
- position: a = "none",
199
- linkUrl: p
204
+ position: c = "none",
205
+ linkUrl: h
200
206
  }) {
201
- const g = G(null), Y = G(null), [s, x, O] = st(u), [k, re] = f(!1), { isCollabActive: Xt } = ct(), [o] = at(), [z, Le] = f(null), oe = G(null), [W, Me] = f(!1), Oe = dt(), [ie, j] = f(!1), [P, K] = f(""), [S, ne] = f(!1), [_e, T] = f(!1), [ce, F] = f(""), [$e, H] = f(""), [ze, ae] = f(!1), D = G(null), [de, We] = f(0), je = Pt()?.apiKey, Ke = de > 0 && de < 350;
202
- U(() => {
203
- if (g.current) {
207
+ const l = z(null), Y = z(null), [m, y, $] = lt(g), [k, ie] = p(!1), H = z(!1), { isCollabActive: Jt } = at(), [i] = st(), [j, Me] = p(null), ne = z(null), [K, $e] = p(!1), Oe = dt(), [ce, B] = p(!1), [P, T] = p(""), [D, ae] = p(!1), [_e, F] = p(!1), [se, q] = p(""), [ze, X] = p(""), [We, de] = p(!1), S = z(null), [le, je] = p(0), Ke = St()?.apiKey, Be = le > 0 && le < 350;
208
+ te(() => {
209
+ if (l.current) {
204
210
  const e = () => {
205
- g.current && We(g.current.offsetWidth);
211
+ H.current || l.current && je(l.current.offsetWidth);
206
212
  };
207
213
  e();
208
214
  const r = new ResizeObserver(e);
209
- return r.observe(g.current), () => r.disconnect();
215
+ return r.observe(l.current), () => r.disconnect();
210
216
  }
211
- }, [b, y, s]);
212
- const q = C(
217
+ }, [f, C, m]), Nt(() => {
218
+ if ((c === "left" || c === "right") && typeof f == "number" && l.current) {
219
+ const e = l.current.closest(".editor-image"), r = e?.parentElement, o = i.getRootElement(), n = o ? o.getBoundingClientRect().width : f + 32, a = `${Math.min(f + 32, n)}px`;
220
+ return e && (e.style.removeProperty("display"), e.style.setProperty("max-width", a, "important")), r && r.style.setProperty("max-width", a, "important"), () => {
221
+ e && (e.style.removeProperty("max-width"), e.style.removeProperty("display")), r && r.style.removeProperty("max-width");
222
+ };
223
+ }
224
+ }, [c, f, i]);
225
+ const V = x(
213
226
  (e) => {
214
- const r = _();
215
- return s && L(r) && (e.preventDefault(), o.update(() => {
216
- r.getNodes().forEach((d) => {
217
- if (M(d)) {
218
- const m = d.getParent();
219
- d.remove(), m && pe(m) && m.getChildrenSize() === 0 && m.setFormat("left");
227
+ const r = O();
228
+ return m && L(r) && (e.preventDefault(), i.update(() => {
229
+ r.getNodes().forEach((n) => {
230
+ if (M(n)) {
231
+ const a = n.getParent();
232
+ n.remove(), a && Z(a) && a.getChildrenSize() === 0 && a.setFormat("left");
220
233
  }
221
234
  });
222
235
  })), !1;
223
236
  },
224
- [o, s]
225
- ), se = C(
237
+ [i, m]
238
+ ), me = x(
226
239
  (e) => {
227
- const r = _(), i = Y.current;
228
- if (s && L(r) && r.getNodes().length === 1) {
240
+ const r = O(), o = Y.current;
241
+ if (m && L(r) && r.getNodes().length === 1) {
229
242
  if (I)
230
- return Q(null), e.preventDefault(), E.focus(), !0;
231
- if (i !== null && i !== document.activeElement)
232
- return e.preventDefault(), i.focus(), !0;
243
+ return ee(null), e.preventDefault(), w.focus(), !0;
244
+ if (o !== null && o !== document.activeElement)
245
+ return e.preventDefault(), o.focus(), !0;
233
246
  }
234
247
  return !1;
235
248
  },
236
- [E, s, I]
237
- ), le = C(
238
- (e) => oe.current === E || Y.current === e.target ? (Q(null), o.update(() => {
239
- x(!0);
240
- const r = o.getRootElement();
249
+ [w, m, I]
250
+ ), ue = x(
251
+ (e) => ne.current === w || Y.current === e.target ? (ee(null), i.update(() => {
252
+ y(!0);
253
+ const r = i.getRootElement();
241
254
  r !== null && r.focus();
242
255
  }), !0) : !1,
243
- [E, o, x]
244
- ), X = C(
256
+ [w, i, y]
257
+ ), J = x(
245
258
  (e) => {
246
259
  const r = e;
247
260
  if (k)
248
261
  return !0;
249
- const d = r.target === g.current;
250
- let m = !1;
251
- if (!d && g.current) {
252
- const h = g.current.getBoundingClientRect();
253
- m = r.clientX >= h.left && r.clientX <= h.right && r.clientY >= h.top && r.clientY <= h.bottom;
262
+ const o = r.target;
263
+ if (o.closest("button") && l.current && o.closest(".editor-image") === l.current.closest(".editor-image"))
264
+ return !0;
265
+ const n = o === l.current;
266
+ let a = !1;
267
+ if (!n && l.current) {
268
+ const b = l.current.getBoundingClientRect();
269
+ a = r.clientX >= b.left && r.clientX <= b.right && r.clientY >= b.top && r.clientY <= b.bottom;
254
270
  }
255
- return d || m ? (r.shiftKey ? x(!s) : (O(), x(!0)), !0) : !1;
271
+ return n || a ? (r.shiftKey ? y(!m) : ($(), y(!0)), !0) : !1;
256
272
  },
257
- [k, s, x, O]
258
- ), V = C(
273
+ [k, m, y, $]
274
+ ), Q = x(
259
275
  (e) => {
260
- o.getEditorState().read(() => {
261
- const r = _();
262
- e.target.tagName === "IMG" && mt(r) && r.getNodes().length === 1 && o.dispatchCommand(
263
- be,
276
+ i.getEditorState().read(() => {
277
+ const r = O();
278
+ e.target.tagName === "IMG" && ut(r) && r.getNodes().length === 1 && i.dispatchCommand(
279
+ ye,
264
280
  e
265
281
  );
266
282
  });
267
283
  },
268
- [o]
284
+ [i]
269
285
  );
270
- U(() => {
286
+ te(() => {
271
287
  let e = !0;
272
- const r = o.getRootElement(), i = lt(
273
- o.registerUpdateListener(({ editorState: d }) => {
274
- e && Le(d.read(() => _()));
288
+ const r = i.getRootElement(), o = mt(
289
+ i.registerUpdateListener(({ editorState: n }) => {
290
+ e && Me(n.read(() => O()));
275
291
  }),
276
- o.registerCommand(
277
- ut,
278
- (d, m) => (oe.current = m, !1),
279
- w
280
- ),
281
- o.registerCommand(
292
+ i.registerCommand(
282
293
  gt,
283
- X,
284
- w
294
+ (n, a) => (ne.current = a, !1),
295
+ v
285
296
  ),
286
- o.registerCommand(
287
- be,
288
- X,
289
- w
290
- ),
291
- o.registerCommand(
297
+ i.registerCommand(
292
298
  ft,
293
- (d) => d.target === g.current ? (d.preventDefault(), !0) : !1,
294
- w
299
+ J,
300
+ v
301
+ ),
302
+ i.registerCommand(
303
+ ye,
304
+ J,
305
+ v
295
306
  ),
296
- o.registerCommand(
307
+ i.registerCommand(
297
308
  pt,
298
- q,
299
- w
309
+ (n) => n.target === l.current ? (n.preventDefault(), !0) : !1,
310
+ v
300
311
  ),
301
- o.registerCommand(
312
+ i.registerCommand(
302
313
  ht,
303
- q,
304
- w
314
+ V,
315
+ v
305
316
  ),
306
- o.registerCommand(bt, se, w),
307
- o.registerCommand(
317
+ i.registerCommand(
318
+ bt,
319
+ V,
320
+ v
321
+ ),
322
+ i.registerCommand(yt, me, v),
323
+ i.registerCommand(
308
324
  xt,
309
- le,
310
- w
325
+ ue,
326
+ v
311
327
  )
312
328
  );
313
- return r?.addEventListener("contextmenu", V), () => {
314
- e = !1, i(), r?.removeEventListener("contextmenu", V);
329
+ return r?.addEventListener("contextmenu", Q), () => {
330
+ e = !1, o(), r?.removeEventListener("contextmenu", Q);
315
331
  };
316
332
  }, [
317
- O,
318
- o,
333
+ $,
334
+ i,
319
335
  k,
320
- s,
321
- u,
322
- q,
323
- se,
324
- le,
325
- X,
336
+ m,
337
+ g,
326
338
  V,
327
- x
339
+ me,
340
+ ue,
341
+ J,
342
+ Q,
343
+ y
328
344
  ]);
329
345
  const Te = () => {
330
- o.update(() => {
331
- const e = $(u);
346
+ i.update(() => {
347
+ const e = _(g);
332
348
  M(e) && e.setShowCaption(!0);
333
349
  });
334
- }, Be = (e, r) => {
335
- setTimeout(() => {
336
- re(!1);
337
- }, 200), o.update(() => {
338
- const i = $(u);
339
- M(i) && i.setWidthAndHeight(e, r);
350
+ }, Fe = (e, r) => {
351
+ H.current = !1, setTimeout(() => {
352
+ ie(!1);
353
+ }, 200), i.update(() => {
354
+ const o = _(g);
355
+ M(o) && o.setWidthAndHeight(e, r);
340
356
  });
341
357
  }, Ge = () => {
342
- re(!0);
358
+ H.current = !0, ie(!0);
343
359
  }, Ye = (e) => {
344
- if (e.preventDefault(), e.stopPropagation(), l.startsWith("data:")) {
360
+ if (e.preventDefault(), e.stopPropagation(), u.startsWith("data:")) {
345
361
  const r = window.open("", "_blank");
346
362
  r && (r.document.write(`
347
363
  <!DOCTYPE html>
348
364
  <html>
349
365
  <head>
350
- <title>${c || "Image"}</title>
366
+ <title>${d || "Image"}</title>
351
367
  <style>
352
368
  body {
353
369
  margin: 0;
@@ -365,50 +381,54 @@ function Cr({
365
381
  </style>
366
382
  </head>
367
383
  <body>
368
- <img src="${l}" alt="${c || "Image"}" />
384
+ <img src="${u}" alt="${d || "Image"}" />
369
385
  </body>
370
386
  </html>
371
387
  `), r.document.close());
372
388
  } else
373
- window.open(l, "_blank");
374
- }, Fe = (e) => {
375
- e.preventDefault(), e.stopPropagation(), o.update(() => {
376
- const r = $(u);
389
+ window.open(u, "_blank");
390
+ }, He = (e) => {
391
+ e.preventDefault(), e.stopPropagation(), i.update(() => {
392
+ const r = _(g);
377
393
  if (M(r)) {
378
- const i = r.getParent();
379
- r.remove(), i && pe(i) && i.getChildrenSize() === 0 && i.setFormat("left");
394
+ const o = r.getParent();
395
+ r.remove(), o && Z(o) && o.getChildrenSize() === 0 && o.setFormat("left");
380
396
  }
381
397
  });
382
398
  }, A = (e, r) => {
383
- e.preventDefault(), e.stopPropagation(), o.update(() => {
384
- const i = $(u);
385
- M(i) && i.setPosition(r);
399
+ e.preventDefault(), e.stopPropagation(), i.update(() => {
400
+ const o = _(g);
401
+ if (M(o)) {
402
+ o.setPosition(r);
403
+ const n = o.getParent();
404
+ n && Z(n) && (r === "left" ? n.setFormat("left") : r === "right" ? n.setFormat("right") : n.setFormat(""));
405
+ }
386
406
  });
387
- }, He = (e) => {
388
- e.preventDefault(), e.stopPropagation(), j(!ie);
389
- }, qe = C(() => {
390
- p && !s && (D.current = setTimeout(() => {
391
- ae(!0);
407
+ }, qe = (e) => {
408
+ e.preventDefault(), e.stopPropagation(), B(!ce);
409
+ }, Xe = x(() => {
410
+ h && !m && (S.current = setTimeout(() => {
411
+ de(!0);
392
412
  }, 300));
393
- }, [p, s]), Xe = C(() => {
394
- D.current && (clearTimeout(D.current), D.current = null), ae(!1);
395
- }, []), me = C((e) => {
396
- e.preventDefault(), e.stopPropagation(), p && window.open(p, "_blank", "noopener,noreferrer");
397
- }, [p]);
398
- U(() => () => {
399
- D.current && clearTimeout(D.current);
413
+ }, [h, m]), Ve = x(() => {
414
+ S.current && (clearTimeout(S.current), S.current = null), de(!1);
415
+ }, []), ge = x((e) => {
416
+ e.preventDefault(), e.stopPropagation(), h && window.open(h, "_blank", "noopener,noreferrer");
417
+ }, [h]);
418
+ te(() => () => {
419
+ S.current && clearTimeout(S.current);
400
420
  }, []);
401
- const ue = async () => {
402
- if (!P.trim() || S)
421
+ const fe = async () => {
422
+ if (!P.trim() || D)
403
423
  return;
404
- ne(!0);
405
- const e = v.loading("Refining image...", {
424
+ ae(!0);
425
+ const e = E.loading("Refining image...", {
406
426
  description: "This may take 10-30 seconds. Please wait."
407
427
  });
408
428
  try {
409
429
  let r = P.trim();
410
- const d = P.trim().replace(/^(add|also add|include|with|and)\s+(some|a|an)\s+/gi, "").replace(/^(add|also add|include|with|and)\s+/gi, "").trim(), m = (B) => {
411
- const tt = B.toLowerCase();
430
+ const n = P.trim().replace(/^(add|also add|include|with|and)\s+(some|a|an)\s+/gi, "").replace(/^(add|also add|include|with|and)\s+/gi, "").trim(), a = (G) => {
431
+ const rt = G.toLowerCase();
412
432
  return [
413
433
  "article",
414
434
  "write",
@@ -425,123 +445,123 @@ function Cr({
425
445
  "add some images",
426
446
  "include images",
427
447
  "include pictures"
428
- ].some((rt) => tt.includes(rt));
448
+ ].some((ot) => rt.includes(ot));
429
449
  };
430
- let h = "";
450
+ let b = "";
431
451
  if (R && R.trim()) {
432
- const B = R.trim();
433
- m(B) && c && c !== "Generated image" && c.trim() ? h = c.trim() : h = B;
452
+ const G = R.trim();
453
+ a(G) && d && d !== "Generated image" && d.trim() ? b = d.trim() : b = G;
434
454
  } else
435
- c && c !== "Generated image" && c.trim() && (h = c.trim());
436
- h ? r = `${h} with ${d}` : r = d;
437
- const fe = (await jt({
455
+ d && d !== "Generated image" && d.trim() && (b = d.trim());
456
+ b ? r = `${b} with ${n}` : r = n;
457
+ const he = (await Bt({
438
458
  content: `Generate Image: ${r}`,
439
- apiKey: je || void 0
459
+ apiKey: Ke || void 0
440
460
  }))?.data;
441
- if (!fe)
461
+ if (!he)
442
462
  throw new Error("Failed to generate image - empty response");
443
- const J = new DOMParser().parseFromString(fe, "text/html").querySelector("img");
444
- if (!J || !J.src)
463
+ const U = new DOMParser().parseFromString(he, "text/html").querySelector("img");
464
+ if (!U || !U.src)
445
465
  throw new Error("No image found in response");
446
- const et = J.src;
447
- v.dismiss(e), v.success("Image refined successfully!", {
466
+ const tt = U.src;
467
+ E.dismiss(e), E.success("Image refined successfully!", {
448
468
  description: "Compare the images and choose which to keep."
449
- }), F(et), H(r), T(!0), K(""), j(!1);
469
+ }), q(tt), X(r), F(!0), T(""), B(!1);
450
470
  } catch (r) {
451
- if (v.dismiss(e), r instanceof Kt) {
452
- const i = r.code === "API_KEYS_DISABLED" ? "API Keys Disabled" : "API Key Required";
453
- v.error(i, {
471
+ if (E.dismiss(e), r instanceof Tt) {
472
+ const o = r.code === "API_KEYS_DISABLED" ? "API Keys Disabled" : "API Key Required";
473
+ E.error(o, {
454
474
  description: r.message,
455
475
  duration: 8e3
456
476
  });
457
477
  } else
458
- r instanceof Tt ? v.error("Credits Issue", {
478
+ r instanceof Ft ? E.error("Credits Issue", {
459
479
  description: r.message,
460
480
  duration: 8e3
461
- }) : v.error("Failed to refine image", {
481
+ }) : E.error("Failed to refine image", {
462
482
  description: r instanceof Error ? r.message : "Unknown error. Please try again."
463
483
  });
464
484
  } finally {
465
- ne(!1);
485
+ ae(!1);
466
486
  }
467
- }, Ve = () => {
468
- o.update(() => {
469
- const e = $(u);
487
+ }, Je = () => {
488
+ i.update(() => {
489
+ const e = _(g);
470
490
  if (M(e)) {
471
- e.setSrc(ce), e.setOriginalPrompt($e);
472
- const r = _();
473
- r && Q(r.clone());
491
+ e.setSrc(se), e.setOriginalPrompt(ze);
492
+ const r = O();
493
+ r && ee(r.clone());
474
494
  }
475
- }), T(!1), F(""), H(""), v.success("Image replaced successfully!", {
495
+ }), F(!1), q(""), X(""), E.success("Image replaced successfully!", {
476
496
  description: "The image has been updated with the refined version."
477
497
  });
478
- }, Je = () => {
479
- T(!1), F(""), H("");
480
- }, Qe = s && L(z) && !k, ge = (s || k) && Oe, Ue = () => a === "left" || a === "right" ? {
498
+ }, Qe = () => {
499
+ F(!1), q(""), X("");
500
+ }, Ue = m && L(j) && !k, pe = (m || k) && Oe, Ze = () => c === "left" || c === "right" ? {
481
501
  position: "relative",
482
502
  display: "block",
483
503
  width: "100%"
484
504
  // Fill the floated container
485
- } : a === "full" ? {
505
+ } : c === "full" ? {
486
506
  position: "relative",
487
507
  display: "inline-block"
488
508
  // Use inline-block to respect text-align: center from parent
489
- } : a === "inline-left" || a === "inline-center" || a === "inline-right" ? {
509
+ } : c === "inline-left" || c === "inline-center" || c === "inline-right" ? {
490
510
  position: "relative",
491
511
  display: "inline-block"
492
512
  // Use inline-block to respect text-align from parent
493
513
  } : {
494
514
  position: "relative",
495
515
  display: "inline-block"
496
- }, Ze = C(
516
+ }, et = x(
497
517
  (e) => {
498
518
  if (k || e.target.closest("button"))
499
519
  return;
500
- const i = e.target === g.current;
501
- let d = !1;
502
- if (!i && g.current) {
503
- const m = g.current.getBoundingClientRect();
504
- d = e.clientX >= m.left && e.clientX <= m.right && e.clientY >= m.top && e.clientY <= m.bottom;
520
+ const o = e.target === l.current;
521
+ let n = !1;
522
+ if (!o && l.current) {
523
+ const a = l.current.getBoundingClientRect();
524
+ n = e.clientX >= a.left && e.clientX <= a.right && e.clientY >= a.top && e.clientY <= a.bottom;
505
525
  }
506
- !i && !d || (e.stopPropagation(), e.shiftKey ? x(!s) : (O(), x(!0)));
526
+ !o && !n || (e.stopPropagation(), e.shiftKey ? y(!m) : ($(), y(!0)));
507
527
  },
508
- [k, s, x, O]
528
+ [k, m, y, $]
509
529
  );
510
- return /* @__PURE__ */ t(yt, { fallback: null, children: /* @__PURE__ */ n(ot, { children: [
511
- /* @__PURE__ */ n(
530
+ return /* @__PURE__ */ t(wt, { fallback: null, children: /* @__PURE__ */ s(it, { children: [
531
+ /* @__PURE__ */ s(
512
532
  "div",
513
533
  {
514
- draggable: Qe,
515
- style: Ue(),
516
- onClick: Ze,
517
- onMouseEnter: qe,
518
- onMouseLeave: Xe,
534
+ draggable: Ue,
535
+ style: Ze(),
536
+ onClick: et,
537
+ onMouseEnter: Xe,
538
+ onMouseLeave: Ve,
519
539
  children: [
520
- W ? /* @__PURE__ */ t(qt, {}) : /* @__PURE__ */ t(
521
- Ht,
540
+ K ? /* @__PURE__ */ t(Vt, {}) : /* @__PURE__ */ t(
541
+ Xt,
522
542
  {
523
- className: ge ? `focused ${L(z) ? "draggable" : ""}` : p ? "cteditor-cursor-pointer" : null,
524
- src: l,
525
- altText: c,
526
- imageRef: g,
527
- width: b,
528
- height: y,
543
+ className: pe ? `focused ${L(j) ? "draggable" : ""}` : h ? "cteditor-cursor-pointer" : null,
544
+ src: u,
545
+ altText: d,
546
+ imageRef: l,
547
+ width: f,
548
+ height: C,
529
549
  maxWidth: N,
530
- onError: () => Me(!0)
550
+ onError: () => $e(!0)
531
551
  }
532
552
  ),
533
- ze && p && !s && /* @__PURE__ */ n(
553
+ We && h && !m && /* @__PURE__ */ s(
534
554
  "div",
535
555
  {
536
556
  className: "cteditor-absolute cteditor-bottom-2 cteditor-left-2 cteditor-right-2 cteditor-bg-background cteditor-rounded-lg cteditor-shadow-lg cteditor-border cteditor-border-border cteditor-p-2 cteditor-flex cteditor-items-center cteditor-gap-2",
537
557
  style: { zIndex: 10 },
538
558
  children: [
539
- /* @__PURE__ */ t(Bt, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-muted-foreground cteditor-flex-shrink-0" }),
540
- /* @__PURE__ */ t("span", { className: "cteditor-text-sm cteditor-text-foreground cteditor-truncate cteditor-flex-1", children: p }),
559
+ /* @__PURE__ */ t(Gt, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-muted-foreground cteditor-flex-shrink-0" }),
560
+ /* @__PURE__ */ t("span", { className: "cteditor-text-sm cteditor-text-foreground cteditor-truncate cteditor-flex-1", children: h }),
541
561
  /* @__PURE__ */ t(
542
562
  "button",
543
563
  {
544
- onClick: me,
564
+ onClick: ge,
545
565
  className: "cteditor-px-2 cteditor-py-1.5 cteditor-text-xs cteditor-rounded cteditor-bg-primary cteditor-text-primary-foreground hover:cteditor-bg-primary/90 cteditor-transition-colors cteditor-flex-shrink-0",
546
566
  children: "Open"
547
567
  }
@@ -549,30 +569,30 @@ function Cr({
549
569
  ]
550
570
  }
551
571
  ),
552
- s && L(z) && !W && /* @__PURE__ */ n(
572
+ m && L(j) && !K && /* @__PURE__ */ s(
553
573
  "div",
554
574
  {
555
- className: `cteditor-absolute cteditor-flex cteditor-gap-1 z-10 ${Ke ? "cteditor-left-1/2 cteditor--translate-x-1/2 cteditor-bottom-0 cteditor-translate-y-full cteditor-mt-1" : "cteditor-top-2 cteditor-right-2"}`,
575
+ className: `cteditor-absolute cteditor-flex cteditor-gap-1 z-10 ${Be ? "cteditor-left-1/2 cteditor--translate-x-1/2 cteditor-bottom-0 cteditor-translate-y-full cteditor-mt-1" : "cteditor-top-2 cteditor-right-2"}`,
556
576
  children: [
557
- /* @__PURE__ */ n("div", { className: "cteditor-flex cteditor-items-center cteditor-gap-0.5 cteditor-bg-background/80 cteditor-rounded-md cteditor-shadow-md cteditor-border cteditor-border-border cteditor-p-0.5", children: [
577
+ /* @__PURE__ */ s("div", { className: "cteditor-flex cteditor-items-center cteditor-gap-0.5 cteditor-bg-background/80 cteditor-rounded-md cteditor-shadow-md cteditor-border cteditor-border-border cteditor-p-0.5", children: [
558
578
  /* @__PURE__ */ t(
559
579
  "button",
560
580
  {
561
581
  onClick: (e) => A(e, "left"),
562
- className: ` cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${a === "left" ? "cteditor-bg-accent" : ""}`,
582
+ className: ` cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${c === "left" ? "cteditor-bg-accent" : ""}`,
563
583
  "aria-label": "Wrap text left",
564
584
  title: "Wrap text left",
565
- children: /* @__PURE__ */ t(St, {})
585
+ children: /* @__PURE__ */ t(At, {})
566
586
  }
567
587
  ),
568
588
  /* @__PURE__ */ t(
569
589
  "button",
570
590
  {
571
591
  onClick: (e) => A(e, "right"),
572
- className: ` cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${a === "right" ? "cteditor-bg-accent" : ""}`,
592
+ className: ` cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${c === "right" ? "cteditor-bg-accent" : ""}`,
573
593
  "aria-label": "Wrap text right",
574
594
  title: "Wrap text right",
575
- children: /* @__PURE__ */ t(Dt, {})
595
+ children: /* @__PURE__ */ t(Lt, {})
576
596
  }
577
597
  ),
578
598
  /* @__PURE__ */ t("div", { className: "cteditor-w-px cteditor-h-5 cteditor-bg-border cteditor-mx-0.5" }),
@@ -580,30 +600,30 @@ function Cr({
580
600
  "button",
581
601
  {
582
602
  onClick: (e) => A(e, "inline-left"),
583
- className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${a === "inline-left" ? "cteditor-bg-accent" : ""}`,
603
+ className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${c === "inline-left" ? "cteditor-bg-accent" : ""}`,
584
604
  "aria-label": "Align left",
585
605
  title: "Align left (no text wrap)",
586
- children: /* @__PURE__ */ t(At, {})
606
+ children: /* @__PURE__ */ t(Mt, {})
587
607
  }
588
608
  ),
589
609
  /* @__PURE__ */ t(
590
610
  "button",
591
611
  {
592
612
  onClick: (e) => A(e, "inline-center"),
593
- className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${a === "inline-center" || a === "full" ? "cteditor-bg-accent" : ""}`,
613
+ className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${c === "inline-center" || c === "full" ? "cteditor-bg-accent" : ""}`,
594
614
  "aria-label": "Align center",
595
615
  title: "Align center (no text wrap)",
596
- children: /* @__PURE__ */ t(Lt, {})
616
+ children: /* @__PURE__ */ t($t, {})
597
617
  }
598
618
  ),
599
619
  /* @__PURE__ */ t(
600
620
  "button",
601
621
  {
602
622
  onClick: (e) => A(e, "inline-right"),
603
- className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${a === "inline-right" ? "cteditor-bg-accent" : ""}`,
623
+ className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${c === "inline-right" ? "cteditor-bg-accent" : ""}`,
604
624
  "aria-label": "Align right",
605
625
  title: "Align right (no text wrap)",
606
- children: /* @__PURE__ */ t(Mt, {})
626
+ children: /* @__PURE__ */ t(Ot, {})
607
627
  }
608
628
  ),
609
629
  /* @__PURE__ */ t("div", { className: "cteditor-w-px cteditor-h-5 cteditor-bg-border cteditor-mx-0.5" }),
@@ -611,33 +631,33 @@ function Cr({
611
631
  "button",
612
632
  {
613
633
  onClick: (e) => A(e, "none"),
614
- className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${a === "none" ? "cteditor-bg-accent" : ""}`,
634
+ className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${c === "none" ? "cteditor-bg-accent" : ""}`,
615
635
  "aria-label": "Inline",
616
636
  title: "Inline with text",
617
- children: /* @__PURE__ */ t(Ot, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-foreground" })
637
+ children: /* @__PURE__ */ t(_t, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-foreground" })
618
638
  }
619
639
  )
620
640
  ] }),
621
- p && /* @__PURE__ */ t(
641
+ h && /* @__PURE__ */ t(
622
642
  "button",
623
643
  {
624
- onClick: me,
644
+ onClick: ge,
625
645
  className: " cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded-md cteditor-bg-background/80 hover:cteditor-bg-accent cteditor-transition-colors cteditor-shadow-md cteditor-border cteditor-border-border",
626
646
  "aria-label": "Visit link",
627
- title: `Visit: ${p}`,
628
- children: /* @__PURE__ */ t(_t, {})
647
+ title: `Visit: ${h}`,
648
+ children: /* @__PURE__ */ t(zt, {})
629
649
  }
630
650
  ),
631
651
  R && /* @__PURE__ */ t(
632
652
  "button",
633
653
  {
634
654
  onClick: (e) => {
635
- e.stopPropagation(), He(e);
655
+ e.stopPropagation(), qe(e);
636
656
  },
637
657
  className: " cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded-md cteditor-bg-background/80 hover:cteditor-bg-accent cteditor-transition-colors cteditor-shadow-md cteditor-border cteditor-border-border",
638
658
  "aria-label": "Refine image",
639
659
  title: "Refine image",
640
- children: /* @__PURE__ */ t($t, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-foreground" })
660
+ children: /* @__PURE__ */ t(Wt, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-foreground" })
641
661
  }
642
662
  ),
643
663
  /* @__PURE__ */ t(
@@ -649,25 +669,25 @@ function Cr({
649
669
  className: " cteditor-size-8 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded-md cteditor-bg-background/80 hover:cteditor-bg-accent cteditor-transition-colors cteditor-shadow-md cteditor-border cteditor-border-border",
650
670
  "aria-label": "Open image in new tab",
651
671
  title: "Open in new tab",
652
- children: /* @__PURE__ */ t(zt, {})
672
+ children: /* @__PURE__ */ t(jt, {})
653
673
  }
654
674
  ),
655
675
  /* @__PURE__ */ t(
656
676
  "button",
657
677
  {
658
678
  onClick: (e) => {
659
- e.stopPropagation(), Fe(e);
679
+ e.stopPropagation(), He(e);
660
680
  },
661
681
  className: " cteditor-size-8 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded-md cteditor-bg-background/80 hover:cteditor-bg-destructive hover:cteditor-text-destructive-foreground cteditor-transition-colors cteditor-shadow-md cteditor-border cteditor-border-border",
662
682
  "aria-label": "Delete image",
663
683
  title: "Delete image",
664
- children: /* @__PURE__ */ t(Wt, {})
684
+ children: /* @__PURE__ */ t(Kt, {})
665
685
  }
666
686
  )
667
687
  ]
668
688
  }
669
689
  ),
670
- ie && s && !W && R && /* @__PURE__ */ t(
690
+ ce && m && !K && R && /* @__PURE__ */ t(
671
691
  "div",
672
692
  {
673
693
  className: "cteditor-absolute cteditor-bottom-2 cteditor-left-2 cteditor-right-2 cteditor-bg-background cteditor-rounded-lg cteditor-shadow-xl cteditor-border cteditor-border-border cteditor-p-3",
@@ -675,16 +695,16 @@ function Cr({
675
695
  onClick: (e) => e.stopPropagation(),
676
696
  onKeyDown: (e) => e.stopPropagation(),
677
697
  onKeyUp: (e) => e.stopPropagation(),
678
- children: /* @__PURE__ */ n("div", { className: "cteditor-flex cteditor-flex-col cteditor-gap-2", children: [
698
+ children: /* @__PURE__ */ s("div", { className: "cteditor-flex cteditor-flex-col cteditor-gap-2", children: [
679
699
  /* @__PURE__ */ t("label", { className: "cteditor-text-xs cteditor-font-medium cteditor-text-foreground", children: "What else do you want in this scene?" }),
680
700
  /* @__PURE__ */ t(
681
701
  "input",
682
702
  {
683
703
  type: "text",
684
704
  value: P,
685
- onChange: (e) => K(e.target.value),
705
+ onChange: (e) => T(e.target.value),
686
706
  onKeyDown: (e) => {
687
- e.stopPropagation(), e.key === "Enter" && P.trim() && !S && ue(), e.key === "Escape" && (j(!1), K(""));
707
+ e.stopPropagation(), e.key === "Enter" && P.trim() && !D && fe(), e.key === "Escape" && (B(!1), T(""));
688
708
  },
689
709
  onKeyUp: (e) => {
690
710
  e.stopPropagation();
@@ -694,20 +714,20 @@ function Cr({
694
714
  },
695
715
  placeholder: "e.g., flying birds, golden sunset, stormy clouds...",
696
716
  className: "cteditor-w-full cteditor-px-3 cteditor-py-2 cteditor-text-sm cteditor-border cteditor-border-border cteditor-rounded-md cteditor-bg-background cteditor-text-foreground focus:cteditor-outline-none focus:cteditor-ring-2 focus:cteditor-ring-blue-500",
697
- disabled: S,
717
+ disabled: D,
698
718
  autoFocus: !0
699
719
  }
700
720
  ),
701
- /* @__PURE__ */ n("div", { className: "cteditor-flex cteditor-gap-2", children: [
721
+ /* @__PURE__ */ s("div", { className: "cteditor-flex cteditor-gap-2", children: [
702
722
  /* @__PURE__ */ t(
703
723
  "button",
704
724
  {
705
725
  onClick: (e) => {
706
- e.stopPropagation(), ue();
726
+ e.stopPropagation(), fe();
707
727
  },
708
- disabled: S || !P.trim(),
728
+ disabled: D || !P.trim(),
709
729
  className: "cteditor-flex-1 cteditor-px-3 cteditor-py-2 cteditor-text-sm cteditor-rounded-md cteditor-bg-blue-500 cteditor-text-white hover:cteditor-bg-blue-600 disabled:cteditor-opacity-50 disabled:cteditor-cursor-not-allowed cteditor-transition-colors",
710
- children: S ? /* @__PURE__ */ n("span", { className: "cteditor-flex cteditor-items-center cteditor-justify-center cteditor-gap-2", children: [
730
+ children: D ? /* @__PURE__ */ s("span", { className: "cteditor-flex cteditor-items-center cteditor-justify-center cteditor-gap-2", children: [
711
731
  /* @__PURE__ */ t("span", { className: "cteditor-inline-block cteditor-w-4 cteditor-h-4 cteditor-border-2 cteditor-border-white cteditor-border-t-transparent cteditor-rounded-full cteditor-animate-spin" }),
712
732
  "Refining..."
713
733
  ] }) : "Refine Image"
@@ -717,9 +737,9 @@ function Cr({
717
737
  "button",
718
738
  {
719
739
  onClick: (e) => {
720
- e.stopPropagation(), j(!1), K("");
740
+ e.stopPropagation(), B(!1), T("");
721
741
  },
722
- disabled: S,
742
+ disabled: D,
723
743
  className: "cteditor-px-3 cteditor-py-2 cteditor-text-sm cteditor-rounded-md cteditor-bg-background cteditor-border cteditor-border-border cteditor-text-foreground hover:cteditor-bg-accent disabled:cteditor-opacity-50 disabled:cteditor-cursor-not-allowed cteditor-transition-colors",
724
744
  children: "Cancel"
725
745
  }
@@ -728,89 +748,89 @@ function Cr({
728
748
  ] })
729
749
  }
730
750
  ),
731
- ee && L(z) && ge && /* @__PURE__ */ t(
732
- it,
751
+ oe && L(j) && pe && /* @__PURE__ */ t(
752
+ nt,
733
753
  {
734
754
  showCaption: I,
735
755
  setShowCaption: Te,
736
- editor: o,
756
+ editor: i,
737
757
  buttonRef: Y,
738
- imageRef: g,
758
+ imageRef: l,
739
759
  maxWidth: N,
740
760
  onResizeStart: Ge,
741
- onResizeEnd: Be,
742
- captionsEnabled: !W && te
761
+ onResizeEnd: Fe,
762
+ captionsEnabled: !K && W
743
763
  }
744
764
  )
745
765
  ]
746
766
  }
747
767
  ),
748
- I && (c.startsWith("Signature by") ? /* @__PURE__ */ t(Yt, { caption: E }) : /* @__PURE__ */ t(
768
+ I && (d.startsWith("Signature by") ? /* @__PURE__ */ t(Ht, { caption: w }) : /* @__PURE__ */ t(
749
769
  "div",
750
770
  {
751
771
  className: "image-caption-container",
752
772
  style: {
753
- width: typeof b == "number" ? `${b}px` : "100%",
773
+ width: typeof f == "number" ? `${f}px` : "100%",
754
774
  maxWidth: "100%",
755
775
  // Match the image's alignment
756
- ...a === "inline-center" || a === "full" ? { margin: "0 auto" } : a === "inline-right" ? { marginLeft: "auto" } : a === "left" ? { float: "left", clear: "left" } : a === "right" ? { float: "right", clear: "right" } : {}
776
+ ...c === "inline-center" || c === "full" ? { margin: "0 auto" } : c === "inline-right" ? { marginLeft: "auto" } : c === "left" ? { float: "left", clear: "left" } : c === "right" ? { float: "right", clear: "right" } : {}
757
777
  },
758
- children: /* @__PURE__ */ n(
759
- ve,
778
+ children: /* @__PURE__ */ s(
779
+ Ee,
760
780
  {
761
- initialEditor: E,
781
+ initialEditor: w,
762
782
  initialNodes: [
763
- Ie,
764
783
  Re,
765
784
  Pe,
785
+ De,
766
786
  Se,
767
787
  Ce,
768
788
  xe
769
789
  ],
770
790
  children: [
771
- /* @__PURE__ */ t(nt, {}),
791
+ /* @__PURE__ */ t(ct, {}),
772
792
  /* @__PURE__ */ t(
773
- ke,
793
+ Ie,
774
794
  {
775
795
  contentEditable: /* @__PURE__ */ t(
776
- ye,
796
+ Ne,
777
797
  {
778
798
  "aria-placeholder": "Enter a caption...",
779
799
  placeholder: () => /* @__PURE__ */ t("span", { className: "cteditor-text-xs", children: "Enter a caption..." }),
780
800
  className: "ImageNode__contentEditable"
781
801
  }
782
802
  ),
783
- ErrorBoundary: Ne
803
+ ErrorBoundary: we
784
804
  }
785
805
  ),
786
806
  /* @__PURE__ */ t(
787
- Ee,
807
+ ke,
788
808
  {
789
809
  onChange: () => {
790
810
  }
791
811
  }
792
812
  ),
793
- /* @__PURE__ */ t(we, {}),
794
- /* @__PURE__ */ t(De, { namespace: Ae.namespace })
813
+ /* @__PURE__ */ t(ve, {}),
814
+ /* @__PURE__ */ t(Ae, { namespace: Le.namespace })
795
815
  ]
796
816
  }
797
817
  )
798
818
  }
799
819
  )),
800
820
  /* @__PURE__ */ t(
801
- Gt,
821
+ Yt,
802
822
  {
803
823
  open: _e,
804
- onOpenChange: T,
805
- oldImageUrl: l,
806
- newImageUrl: ce,
807
- onReplace: Ve,
808
- onCancel: Je
824
+ onOpenChange: F,
825
+ oldImageUrl: u,
826
+ newImageUrl: se,
827
+ onReplace: Je,
828
+ onCancel: Qe
809
829
  }
810
830
  )
811
831
  ] }) });
812
832
  }
813
833
  export {
814
- be as RIGHT_CLICK_IMAGE_COMMAND,
815
- Cr as default
834
+ ye as RIGHT_CLICK_IMAGE_COMMAND,
835
+ Nr as default
816
836
  };