eddyter 1.4.3 → 1.4.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.
@@ -16,7 +16,7 @@ import { useLexicalNodeSelection as Xe } from "@lexical/react/useLexicalNodeSele
16
16
  import { mergeRegister as Be } from "@lexical/utils";
17
17
  import { RootNode as ae, TextNode as ne, LineBreakNode as se, ParagraphNode as de, $isNodeSelection as at, $getSelection as nt, $isParagraphNode as $t, $setSelection as bt, $isRangeSelection as Ue, SELECTION_CHANGE_COMMAND as Ke, COMMAND_PRIORITY_LOW as Q, CLICK_COMMAND as qe, DRAGSTART_COMMAND as Ge, KEY_DELETE_COMMAND as Ve, KEY_BACKSPACE_COMMAND as Je, KEY_ENTER_COMMAND as Qe, KEY_ESCAPE_COMMAND as Ze, $getNodeByKey as st, createCommand as tr } from "lexical";
18
18
  import yt, { useState as I, useRef as K, useMemo as Xt, useCallback as S, useEffect as tt, useLayoutEffect as Bt, Suspense as er } from "react";
19
- import { c as xt, D as ce, a as le, b as ue, d as me, e as ge, f as fe, B as Ut, L as he, i as pe, C as Et, I as rr, S as or, u as ir, $ as Z, t as M, g as ar, h as nr, j as sr, W as dr, k as cr, A as lr, l as ur, m as mr, T as gr, n as fr, o as hr, E as pr, p as br, X as yr, q as xr, r as vr, s as wr } from "./index-Bvb6NDBM.js";
19
+ import { c as xt, D as ce, a as le, b as ue, d as me, e as ge, f as fe, B as Ut, L as he, i as pe, C as Et, I as rr, S as or, u as ir, $ as Z, t as M, g as ar, h as nr, j as sr, W as dr, k as cr, A as lr, l as ur, m as mr, T as gr, n as fr, o as hr, E as pr, p as br, X as yr, q as xr, r as vr, s as wr } from "./index-CyxBhIG-.js";
20
20
  import "react-dom";
21
21
  const be = xt("Crop", [
22
22
  ["path", { d: "M6 2v14a2 2 0 0 0 2 2h14", key: "ron5a4" }],
@@ -41,8 +41,8 @@ const Nr = xt("RotateCcw", [
41
41
  onOpenChange: o,
42
42
  oldImageUrl: e,
43
43
  newImageUrl: d,
44
- onReplace: w,
45
- onCancel: x
44
+ onReplace: N,
45
+ onCancel: v
46
46
  }) => /* @__PURE__ */ r(ce, { open: i, onOpenChange: o, children: /* @__PURE__ */ h(le, { className: "sm:max-w-[800px] max-h-[90vh] overflow-y-auto", children: [
47
47
  /* @__PURE__ */ h(ue, { children: [
48
48
  /* @__PURE__ */ h(me, { className: "flex items-center gap-2 text-xl", children: [
@@ -76,14 +76,14 @@ const Nr = xt("RotateCcw", [
76
76
  Ut,
77
77
  {
78
78
  variant: "outline",
79
- onClick: x,
79
+ onClick: v,
80
80
  children: "Keep Original"
81
81
  }
82
82
  ),
83
83
  /* @__PURE__ */ h(
84
84
  Ut,
85
85
  {
86
- onClick: w,
86
+ onClick: N,
87
87
  className: "bg-blue-500 hover:bg-blue-600 text-white",
88
88
  children: [
89
89
  /* @__PURE__ */ r("span", { className: "mr-2", children: "✓" }),
@@ -193,7 +193,7 @@ function Pr(i) {
193
193
  e.type = "text/css", o.appendChild(e), e.styleSheet ? e.styleSheet.cssText = i : e.appendChild(document.createTextNode(i));
194
194
  }
195
195
  Array(12).fill(0);
196
- let Tt = 1;
196
+ let Wt = 1;
197
197
  class Sr {
198
198
  constructor() {
199
199
  this.subscribe = (o) => (this.subscribers.push(o), () => {
@@ -208,24 +208,24 @@ class Sr {
208
208
  ];
209
209
  }, this.create = (o) => {
210
210
  var e;
211
- const { message: d, ...w } = o, x = typeof o?.id == "number" || ((e = o.id) == null ? void 0 : e.length) > 0 ? o.id : Tt++, L = this.toasts.find((N) => N.id === x), P = o.dismissible === void 0 ? !0 : o.dismissible;
212
- return this.dismissedToasts.has(x) && this.dismissedToasts.delete(x), L ? this.toasts = this.toasts.map((N) => N.id === x ? (this.publish({
213
- ...N,
211
+ const { message: d, ...N } = o, v = typeof o?.id == "number" || ((e = o.id) == null ? void 0 : e.length) > 0 ? o.id : Wt++, L = this.toasts.find((k) => k.id === v), P = o.dismissible === void 0 ? !0 : o.dismissible;
212
+ return this.dismissedToasts.has(v) && this.dismissedToasts.delete(v), L ? this.toasts = this.toasts.map((k) => k.id === v ? (this.publish({
213
+ ...k,
214
214
  ...o,
215
- id: x,
215
+ id: v,
216
216
  title: d
217
217
  }), {
218
- ...N,
218
+ ...k,
219
219
  ...o,
220
- id: x,
220
+ id: v,
221
221
  dismissible: P,
222
222
  title: d
223
- }) : N) : this.addToast({
223
+ }) : k) : this.addToast({
224
224
  title: d,
225
- ...w,
225
+ ...N,
226
226
  dismissible: P,
227
- id: x
228
- }), x;
227
+ id: v
228
+ }), v;
229
229
  }, this.dismiss = (o) => (o ? (this.dismissedToasts.add(o), requestAnimationFrame(() => this.subscribers.forEach((e) => e({
230
230
  id: o,
231
231
  dismiss: !0
@@ -268,78 +268,78 @@ class Sr {
268
268
  message: e.loading,
269
269
  description: typeof e.description != "function" ? e.description : void 0
270
270
  }));
271
- const w = Promise.resolve(o instanceof Function ? o() : o);
272
- let x = d !== void 0, L;
273
- const P = w.then(async (C) => {
271
+ const N = Promise.resolve(o instanceof Function ? o() : o);
272
+ let v = d !== void 0, L;
273
+ const P = N.then(async (w) => {
274
274
  if (L = [
275
275
  "resolve",
276
- C
277
- ], yt.isValidElement(C))
278
- x = !1, this.create({
276
+ w
277
+ ], yt.isValidElement(w))
278
+ v = !1, this.create({
279
279
  id: d,
280
280
  type: "default",
281
- message: C
281
+ message: w
282
282
  });
283
- else if (Mr(C) && !C.ok) {
284
- x = !1;
285
- const c = typeof e.error == "function" ? await e.error(`HTTP error! status: ${C.status}`) : e.error, k = typeof e.description == "function" ? await e.description(`HTTP error! status: ${C.status}`) : e.description, D = typeof c == "object" && !yt.isValidElement(c) ? c : {
283
+ else if (Mr(w) && !w.ok) {
284
+ v = !1;
285
+ const c = typeof e.error == "function" ? await e.error(`HTTP error! status: ${w.status}`) : e.error, C = typeof e.description == "function" ? await e.description(`HTTP error! status: ${w.status}`) : e.description, D = typeof c == "object" && !yt.isValidElement(c) ? c : {
286
286
  message: c
287
287
  };
288
288
  this.create({
289
289
  id: d,
290
290
  type: "error",
291
- description: k,
291
+ description: C,
292
292
  ...D
293
293
  });
294
- } else if (C instanceof Error) {
295
- x = !1;
296
- const c = typeof e.error == "function" ? await e.error(C) : e.error, k = typeof e.description == "function" ? await e.description(C) : e.description, D = typeof c == "object" && !yt.isValidElement(c) ? c : {
294
+ } else if (w instanceof Error) {
295
+ v = !1;
296
+ const c = typeof e.error == "function" ? await e.error(w) : e.error, C = typeof e.description == "function" ? await e.description(w) : e.description, D = typeof c == "object" && !yt.isValidElement(c) ? c : {
297
297
  message: c
298
298
  };
299
299
  this.create({
300
300
  id: d,
301
301
  type: "error",
302
- description: k,
302
+ description: C,
303
303
  ...D
304
304
  });
305
305
  } else if (e.success !== void 0) {
306
- x = !1;
307
- const c = typeof e.success == "function" ? await e.success(C) : e.success, k = typeof e.description == "function" ? await e.description(C) : e.description, D = typeof c == "object" && !yt.isValidElement(c) ? c : {
306
+ v = !1;
307
+ const c = typeof e.success == "function" ? await e.success(w) : e.success, C = typeof e.description == "function" ? await e.description(w) : e.description, D = typeof c == "object" && !yt.isValidElement(c) ? c : {
308
308
  message: c
309
309
  };
310
310
  this.create({
311
311
  id: d,
312
312
  type: "success",
313
- description: k,
313
+ description: C,
314
314
  ...D
315
315
  });
316
316
  }
317
- }).catch(async (C) => {
317
+ }).catch(async (w) => {
318
318
  if (L = [
319
319
  "reject",
320
- C
320
+ w
321
321
  ], e.error !== void 0) {
322
- x = !1;
323
- const E = typeof e.error == "function" ? await e.error(C) : e.error, c = typeof e.description == "function" ? await e.description(C) : e.description, v = typeof E == "object" && !yt.isValidElement(E) ? E : {
322
+ v = !1;
323
+ const E = typeof e.error == "function" ? await e.error(w) : e.error, c = typeof e.description == "function" ? await e.description(w) : e.description, y = typeof E == "object" && !yt.isValidElement(E) ? E : {
324
324
  message: E
325
325
  };
326
326
  this.create({
327
327
  id: d,
328
328
  type: "error",
329
329
  description: c,
330
- ...v
330
+ ...y
331
331
  });
332
332
  }
333
333
  }).finally(() => {
334
- x && (this.dismiss(d), d = void 0), e.finally == null || e.finally.call(e);
335
- }), N = () => new Promise((C, E) => P.then(() => L[0] === "reject" ? E(L[1]) : C(L[1])).catch(E));
334
+ v && (this.dismiss(d), d = void 0), e.finally == null || e.finally.call(e);
335
+ }), k = () => new Promise((w, E) => P.then(() => L[0] === "reject" ? E(L[1]) : w(L[1])).catch(E));
336
336
  return typeof d != "string" && typeof d != "number" ? {
337
- unwrap: N
337
+ unwrap: k
338
338
  } : Object.assign(d, {
339
- unwrap: N
339
+ unwrap: k
340
340
  });
341
341
  }, this.custom = (o, e) => {
342
- const d = e?.id || Tt++;
342
+ const d = e?.id || Wt++;
343
343
  return this.create({
344
344
  jsx: o(d),
345
345
  id: d,
@@ -348,38 +348,38 @@ class Sr {
348
348
  }, this.getActiveToasts = () => this.toasts.filter((o) => !this.dismissedToasts.has(o.id)), this.subscribers = [], this.toasts = [], this.dismissedToasts = /* @__PURE__ */ new Set();
349
349
  }
350
350
  }
351
- const W = new Sr(), zr = (i, o) => {
352
- const e = o?.id || Tt++;
353
- return W.addToast({
351
+ const j = new Sr(), zr = (i, o) => {
352
+ const e = o?.id || Wt++;
353
+ return j.addToast({
354
354
  title: i,
355
355
  ...o,
356
356
  id: e
357
357
  }), e;
358
- }, Mr = (i) => i && typeof i == "object" && "ok" in i && typeof i.ok == "boolean" && "status" in i && typeof i.status == "number", Ar = zr, Dr = () => W.toasts, Lr = () => W.getActiveToasts(), $r = Object.assign(Ar, {
359
- success: W.success,
360
- info: W.info,
361
- warning: W.warning,
362
- error: W.error,
363
- custom: W.custom,
364
- message: W.message,
365
- promise: W.promise,
366
- dismiss: W.dismiss,
367
- loading: W.loading
358
+ }, Mr = (i) => i && typeof i == "object" && "ok" in i && typeof i.ok == "boolean" && "status" in i && typeof i.status == "number", Ar = zr, Dr = () => j.toasts, Lr = () => j.getActiveToasts(), $r = Object.assign(Ar, {
359
+ success: j.success,
360
+ info: j.info,
361
+ warning: j.warning,
362
+ error: j.error,
363
+ custom: j.custom,
364
+ message: j.message,
365
+ promise: j.promise,
366
+ dismiss: j.dismiss,
367
+ loading: j.loading
368
368
  }, {
369
369
  getHistory: Dr,
370
370
  getToasts: Lr
371
371
  });
372
372
  Pr("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");
373
- function Tr({
373
+ function Wr({
374
374
  open: i,
375
375
  onOpenChange: o,
376
376
  src: e,
377
377
  altText: d,
378
- width: w,
379
- height: x,
378
+ width: N,
379
+ height: v,
380
380
  onCropApply: L
381
381
  }) {
382
- const [P, N] = I("freeform"), [C, E] = I(e), [c, k] = I(!1), v = K(null), D = K(null), [n, T] = I({ x: 0, y: 0, width: 0, height: 0 }), [R, $] = I({ x: 0, y: 0, width: 0, height: 0 }), et = K(null), dt = Xt(() => typeof w == "number" && typeof x == "number" && x > 0 ? w / x : n.width > 0 && n.height > 0 ? n.width / n.height : null, [n.height, n.width, x, w]), ft = Xt(() => {
382
+ const [P, k] = I("freeform"), [w, E] = I(e), [c, C] = I(!1), y = K(null), D = K(null), [n, W] = I({ x: 0, y: 0, width: 0, height: 0 }), [R, $] = I({ x: 0, y: 0, width: 0, height: 0 }), et = K(null), dt = Xt(() => typeof N == "number" && typeof v == "number" && v > 0 ? N / v : n.width > 0 && n.height > 0 ? n.width / n.height : null, [n.height, n.width, v, N]), ft = Xt(() => {
383
383
  switch (P) {
384
384
  case "original":
385
385
  return dt;
@@ -396,11 +396,11 @@ function Tr({
396
396
  default:
397
397
  return null;
398
398
  }
399
- }, [dt, P]), m = 24, j = S(
399
+ }, [dt, P]), m = 24, T = S(
400
400
  (s) => {
401
- let { x: p, y: b, width: g, height: y } = s;
401
+ let { x: p, y: b, width: g, height: x } = s;
402
402
  const O = n.width, ct = n.height;
403
- return p = Math.max(0, Math.min(p, O - m)), b = Math.max(0, Math.min(b, ct - m)), g = Math.max(m, Math.min(g, O - p)), y = Math.max(m, Math.min(y, ct - b)), { x: p, y: b, width: g, height: y };
403
+ return p = Math.max(0, Math.min(p, O - m)), b = Math.max(0, Math.min(b, ct - m)), g = Math.max(m, Math.min(g, O - p)), x = Math.max(m, Math.min(x, ct - b)), { x: p, y: b, width: g, height: x };
404
404
  },
405
405
  [n.height, n.width]
406
406
  ), ht = S(
@@ -417,25 +417,25 @@ function Tr({
417
417
  return;
418
418
  }
419
419
  const p = n.width * 0.9, b = n.height * 0.9;
420
- let g = p, y = g / s;
421
- y > b && (y = b, g = y * s), $(
422
- j({
420
+ let g = p, x = g / s;
421
+ x > b && (x = b, g = x * s), $(
422
+ T({
423
423
  x: (n.width - g) / 2,
424
- y: (n.height - y) / 2,
424
+ y: (n.height - x) / 2,
425
425
  width: g,
426
- height: y
426
+ height: x
427
427
  })
428
428
  );
429
429
  },
430
- [n.height, n.width, j]
430
+ [n.height, n.width, T]
431
431
  ), rt = S(() => {
432
- const s = v.current, p = D.current;
432
+ const s = y.current, p = D.current;
433
433
  if (!s || !p)
434
434
  return;
435
- let b = 0, g = 0, y = p;
436
- for (; y && y !== s; )
437
- b += y.offsetLeft, g += y.offsetTop, y = y.offsetParent;
438
- T({
435
+ let b = 0, g = 0, x = p;
436
+ for (; x && x !== s; )
437
+ b += x.offsetLeft, g += x.offsetTop, x = x.offsetParent;
438
+ W({
439
439
  x: b,
440
440
  y: g,
441
441
  width: p.offsetWidth,
@@ -482,11 +482,11 @@ function Tr({
482
482
  g.width = Math.min(g.width, s.naturalWidth - g.x), g.height = Math.min(g.height, s.naturalHeight - g.y), await Promise.resolve(L(g)), o(!1);
483
483
  }, [n, R, L, o]);
484
484
  return tt(() => {
485
- i && (T({ x: 0, y: 0, width: 0, height: 0 }), $({ x: 0, y: 0, width: 0, height: 0 }), k(!1), E(kt(e)));
485
+ i && (W({ x: 0, y: 0, width: 0, height: 0 }), $({ x: 0, y: 0, width: 0, height: 0 }), C(!1), E(kt(e)));
486
486
  }, [i, e]), tt(() => {
487
487
  if (!i)
488
488
  return;
489
- const s = v.current;
489
+ const s = y.current;
490
490
  if (!s)
491
491
  return;
492
492
  const p = new ResizeObserver(() => {
@@ -507,12 +507,12 @@ function Tr({
507
507
  if (!g)
508
508
  return;
509
509
  b.preventDefault();
510
- const y = b.clientX - g.startX, O = b.clientY - g.startY, ct = n.width, lt = n.height, G = ft ?? null, { x: B, y: ot, width: Y, height: U } = g.initialRect;
510
+ const x = b.clientX - g.startX, O = b.clientY - g.startY, ct = n.width, lt = n.height, G = ft ?? null, { x: B, y: ot, width: Y, height: U } = g.initialRect;
511
511
  if (g.mode === "move") {
512
512
  const ut = Math.max(0, ct - Y), vt = Math.max(0, lt - U);
513
513
  $(
514
- j({
515
- x: Math.max(0, Math.min(ut, B + y)),
514
+ T({
515
+ x: Math.max(0, Math.min(ut, B + x)),
516
516
  y: Math.max(0, Math.min(vt, ot + O)),
517
517
  width: Y,
518
518
  height: U
@@ -522,7 +522,7 @@ function Tr({
522
522
  }
523
523
  const A = g.mode;
524
524
  let _ = B, V = ot, H = Y, F = U;
525
- A.includes("e") && (H = Y + y), A.includes("w") && (_ = B + y, H = Y - y), A.includes("s") && (F = U + O), A.includes("n") && (V = ot + O, F = U - O), G != null && G > 0 && (A === "e" || A === "w" ? (F = H / G, A.includes("n") && (V = ot + U - F)) : A === "n" || A === "s" ? (H = F * G, A.includes("w") && (_ = B + Y - H)) : (F = H / G, A.includes("n") && (V = ot + U - F), A.includes("w") && (_ = B + Y - H))), $(j({ x: _, y: V, width: H, height: F }));
525
+ A.includes("e") && (H = Y + x), A.includes("w") && (_ = B + x, H = Y - x), A.includes("s") && (F = U + O), A.includes("n") && (V = ot + O, F = U - O), G != null && G > 0 && (A === "e" || A === "w" ? (F = H / G, A.includes("n") && (V = ot + U - F)) : A === "n" || A === "s" ? (H = F * G, A.includes("w") && (_ = B + Y - H)) : (F = H / G, A.includes("n") && (V = ot + U - F), A.includes("w") && (_ = B + Y - H))), $(T({ x: _, y: V, width: H, height: F }));
526
526
  }, p = () => {
527
527
  et.current = null;
528
528
  };
@@ -534,7 +534,7 @@ function Tr({
534
534
  n.width,
535
535
  n.height,
536
536
  ft,
537
- j
537
+ T
538
538
  ]), tt(() => {
539
539
  i && ht(ft);
540
540
  }, [i, ft, n, ht]), /* @__PURE__ */ r(ce, { open: i, onOpenChange: o, children: /* @__PURE__ */ r(
@@ -547,22 +547,22 @@ function Tr({
547
547
  /* @__PURE__ */ r("div", { className: "cteditor-bg-muted/20 cteditor-p-4 md:cteditor-p-6", children: /* @__PURE__ */ h(
548
548
  "div",
549
549
  {
550
- ref: v,
550
+ ref: y,
551
551
  className: "cteditor-relative cteditor-min-h-[340px] cteditor-rounded-lg cteditor-bg-black/70 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-select-none cteditor-touch-none",
552
552
  children: [
553
553
  /* @__PURE__ */ r("div", { className: "cteditor-overflow-hidden cteditor-rounded-lg cteditor-flex cteditor-items-center cteditor-justify-center cteditor-w-full", children: c ? /* @__PURE__ */ r("div", { className: "cteditor-text-sm cteditor-text-muted-foreground", children: "Failed to load image preview" }) : /* @__PURE__ */ r(
554
554
  "img",
555
555
  {
556
556
  ref: D,
557
- src: C,
557
+ src: w,
558
558
  alt: d || "Crop preview",
559
559
  className: "cteditor-max-w-full cteditor-max-h-[460px] cteditor-w-auto cteditor-h-auto cteditor-select-none cteditor-block",
560
560
  draggable: !1,
561
561
  onLoad: () => {
562
- k(!1), rt();
562
+ C(!1), rt();
563
563
  },
564
564
  onError: () => {
565
- k(!0);
565
+ C(!0);
566
566
  }
567
567
  }
568
568
  ) }),
@@ -612,7 +612,7 @@ function Tr({
612
612
  "div",
613
613
  {
614
614
  className: `cteditor-absolute cteditor-border-2 cteditor-border-white cteditor-bg-blue-500 cteditor-rounded-sm cteditor-pointer-events-auto cteditor-shadow ${p} ${b} ${g}`,
615
- onPointerDown: (y) => It(y, s),
615
+ onPointerDown: (x) => It(x, s),
616
616
  "aria-label": `Resize ${s}`
617
617
  },
618
618
  s
@@ -646,7 +646,7 @@ function Tr({
646
646
  {
647
647
  type: "button",
648
648
  onClick: () => {
649
- N(s.id);
649
+ k(s.id);
650
650
  },
651
651
  className: `cteditor-h-20 cteditor-rounded-md cteditor-border cteditor-text-sm cteditor-transition-colors cteditor-flex cteditor-flex-col cteditor-items-center cteditor-justify-center cteditor-gap-1.5 ${b ? "cteditor-border-primary cteditor-bg-primary/10 cteditor-text-primary" : "cteditor-border-border hover:cteditor-bg-accent"}`,
652
652
  children: [
@@ -680,7 +680,7 @@ function Tr({
680
680
  {
681
681
  type: "button",
682
682
  onClick: () => {
683
- N("freeform"), ht(null);
683
+ k("freeform"), ht(null);
684
684
  },
685
685
  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 cteditor-transition-colors",
686
686
  children: "Reset"
@@ -711,7 +711,7 @@ function Tr({
711
711
  ) });
712
712
  }
713
713
  const Rt = /* @__PURE__ */ new Set(), Vt = tr("RIGHT_CLICK_IMAGE_COMMAND");
714
- function jr(i) {
714
+ function Tr(i) {
715
715
  if (!Rt.has(i))
716
716
  throw new Promise((o) => {
717
717
  const e = new Image();
@@ -722,19 +722,19 @@ function jr(i) {
722
722
  };
723
723
  });
724
724
  }
725
- function Wr({
725
+ function jr({
726
726
  altText: i,
727
727
  className: o,
728
728
  imageRef: e,
729
729
  src: d,
730
- width: w,
731
- height: x,
730
+ width: N,
731
+ height: v,
732
732
  maxWidth: L,
733
733
  onError: P,
734
- onLoad: N
734
+ onLoad: k
735
735
  }) {
736
- jr(d);
737
- const C = typeof w == "number" && typeof x == "number", E = typeof w == "number" ? w : "auto";
736
+ Tr(d);
737
+ const w = typeof N == "number", E = typeof v == "number", c = w && E, C = w ? N : "auto", y = E ? v : "auto";
738
738
  return /* @__PURE__ */ r(
739
739
  "img",
740
740
  {
@@ -742,22 +742,30 @@ function Wr({
742
742
  src: d,
743
743
  alt: i,
744
744
  ref: e,
745
- style: C ? {
746
- width: E,
745
+ style: c ? {
746
+ width: C,
747
747
  // Use height: auto + aspect-ratio so the image scales
748
748
  // proportionally when max-width constrains on small screens.
749
- // The useLayoutEffect in ImageComponent widens the container
750
- // to fit the explicit width on desktop.
751
749
  height: "auto",
752
- aspectRatio: `${E} / ${typeof x == "number" ? x : "auto"}`,
750
+ aspectRatio: `${C} / ${y}`,
751
+ maxWidth: "100%"
752
+ } : w ? {
753
+ // Only width known (e.g. bogus height stripped from source HTML):
754
+ // fix the width and let the browser compute height naturally.
755
+ width: C,
756
+ height: "auto",
757
+ maxWidth: "100%"
758
+ } : E ? {
759
+ // Only height known: fix height, let browser compute width.
760
+ width: "auto",
761
+ height: y,
753
762
  maxWidth: "100%"
754
763
  } : {
755
764
  // No dimensions specified - use original image size.
756
- // max-width from CSS rule prevents overflow.
757
765
  height: "auto"
758
766
  },
759
767
  onError: P,
760
- onLoad: N,
768
+ onLoad: k,
761
769
  draggable: "false"
762
770
  }
763
771
  );
@@ -781,19 +789,19 @@ function co({
781
789
  altText: o,
782
790
  nodeKey: e,
783
791
  width: d,
784
- height: w,
785
- maxWidth: x,
792
+ height: N,
793
+ maxWidth: v,
786
794
  resizable: L,
787
795
  showCaption: P,
788
- caption: N,
789
- captionsEnabled: C,
796
+ caption: k,
797
+ captionsEnabled: w,
790
798
  originalPrompt: E,
791
799
  position: c = "none",
792
- linkUrl: k
800
+ linkUrl: C
793
801
  }) {
794
- const v = K(null), D = K(null), [n, T, R] = Xe(e), [$, et] = I(!1), dt = K(!1), { isCollabActive: ft } = Oe(), [m] = He(), [j, ht] = I(null), rt = K(null), [q, It] = I(!1), Pt = Fe(), [s, p] = I(!1), [b, g] = I(""), [y, O] = I(!1), [ct, lt] = I(!1), [G, B] = I(""), [ot, Y] = I(""), [U, A] = I(!1), _ = K(null), [V, H] = I(0), [F, ut] = I(!1), vt = K(null), [xe, pt] = I(null), [St, zt] = I(!1), wt = ir()?.apiKey, Mt = V > 0 && V < 350;
802
+ const y = K(null), D = K(null), [n, W, R] = Xe(e), [$, et] = I(!1), dt = K(!1), { isCollabActive: ft } = Oe(), [m] = He(), [T, ht] = I(null), rt = K(null), [q, It] = I(!1), Pt = Fe(), [s, p] = I(!1), [b, g] = I(""), [x, O] = I(!1), [ct, lt] = I(!1), [G, B] = I(""), [ot, Y] = I(""), [U, A] = I(!1), _ = K(null), [V, H] = I(0), [F, ut] = I(!1), vt = K(null), [xe, pt] = I(null), [St, zt] = I(!1), wt = ir()?.apiKey, Mt = V > 0 && V < 350;
795
803
  Bt(() => {
796
- if (!n || !at(j) || q) {
804
+ if (!n || !at(T) || q) {
797
805
  pt(null);
798
806
  return;
799
807
  }
@@ -823,18 +831,18 @@ function co({
823
831
  right: "auto"
824
832
  });
825
833
  }
826
- }, [n, j, q, Mt, m, V]), tt(() => {
827
- if (v.current) {
834
+ }, [n, T, q, Mt, m, V]), tt(() => {
835
+ if (y.current) {
828
836
  const t = () => {
829
- dt.current || v.current && H(v.current.offsetWidth);
837
+ dt.current || y.current && H(y.current.offsetWidth);
830
838
  };
831
839
  t();
832
840
  const a = new ResizeObserver(t);
833
- return a.observe(v.current), () => a.disconnect();
841
+ return a.observe(y.current), () => a.disconnect();
834
842
  }
835
- }, [d, w, n]), Bt(() => {
836
- if ((c === "left" || c === "right") && typeof d == "number" && v.current) {
837
- const t = v.current.closest(".editor-image"), a = t?.parentElement, l = m.getRootElement(), u = l ? l.getBoundingClientRect().width : d + 32, f = `${Math.min(d + 32, u)}px`;
843
+ }, [d, N, n]), Bt(() => {
844
+ if ((c === "left" || c === "right") && typeof d == "number" && y.current) {
845
+ const t = y.current.closest(".editor-image"), a = t?.parentElement, l = m.getRootElement(), u = l ? l.getBoundingClientRect().width : d + 32, f = `${Math.min(d + 32, u)}px`;
838
846
  return t && (t.style.removeProperty("display"), t.style.setProperty("max-width", f, "important")), a && a.style.setProperty("max-width", f, "important"), () => {
839
847
  t && (t.style.removeProperty("max-width"), t.style.removeProperty("display")), a && a.style.removeProperty("max-width");
840
848
  };
@@ -853,42 +861,42 @@ function co({
853
861
  })), !1;
854
862
  },
855
863
  [m, n]
856
- ), jt = S(
864
+ ), Tt = S(
857
865
  (t) => {
858
866
  const a = nt(), l = D.current;
859
867
  if (n && at(a) && a.getNodes().length === 1) {
860
868
  if (P)
861
- return bt(null), t.preventDefault(), N.focus(), !0;
869
+ return bt(null), t.preventDefault(), k.focus(), !0;
862
870
  if (l !== null && l !== document.activeElement)
863
871
  return t.preventDefault(), l.focus(), !0;
864
872
  }
865
873
  return !1;
866
874
  },
867
- [N, n, P]
868
- ), Wt = S(
869
- (t) => rt.current === N || D.current === t.target ? (bt(null), m.update(() => {
870
- T(!0);
875
+ [k, n, P]
876
+ ), jt = S(
877
+ (t) => rt.current === k || D.current === t.target ? (bt(null), m.update(() => {
878
+ W(!0);
871
879
  const a = m.getRootElement();
872
880
  a !== null && a.focus();
873
881
  }), !0) : !1,
874
- [N, m, T]
882
+ [k, m, W]
875
883
  ), Dt = S(
876
884
  (t) => {
877
885
  const a = t;
878
886
  if ($)
879
887
  return !0;
880
888
  const l = a.target;
881
- if (l.closest("button") && v.current && l.closest(".editor-image") === v.current.closest(".editor-image"))
889
+ if (l.closest("button") && y.current && l.closest(".editor-image") === y.current.closest(".editor-image"))
882
890
  return !0;
883
- const u = l === v.current;
891
+ const u = l === y.current;
884
892
  let f = !1;
885
- if (!u && v.current) {
886
- const z = v.current.getBoundingClientRect();
893
+ if (!u && y.current) {
894
+ const z = y.current.getBoundingClientRect();
887
895
  f = a.clientX >= z.left && a.clientX <= z.right && a.clientY >= z.top && a.clientY <= z.bottom;
888
896
  }
889
- return u || f ? (a.shiftKey ? T(!n) : (R(), T(!0)), !0) : !1;
897
+ return u || f ? (a.shiftKey ? W(!n) : (R(), W(!0)), !0) : !1;
890
898
  },
891
- [$, n, T, R]
899
+ [$, n, W, R]
892
900
  ), Lt = S(
893
901
  (t) => {
894
902
  m.getEditorState().read(() => {
@@ -924,7 +932,7 @@ function co({
924
932
  ),
925
933
  m.registerCommand(
926
934
  Ge,
927
- (u) => u.target === v.current ? (u.preventDefault(), !0) : !1,
935
+ (u) => u.target === y.current ? (u.preventDefault(), !0) : !1,
928
936
  Q
929
937
  ),
930
938
  m.registerCommand(
@@ -937,10 +945,10 @@ function co({
937
945
  At,
938
946
  Q
939
947
  ),
940
- m.registerCommand(Qe, jt, Q),
948
+ m.registerCommand(Qe, Tt, Q),
941
949
  m.registerCommand(
942
950
  Ze,
943
- Wt,
951
+ jt,
944
952
  Q
945
953
  )
946
954
  );
@@ -954,11 +962,11 @@ function co({
954
962
  n,
955
963
  e,
956
964
  At,
965
+ Tt,
957
966
  jt,
958
- Wt,
959
967
  Dt,
960
968
  Lt,
961
- T
969
+ W
962
970
  ]);
963
971
  const ve = () => {
964
972
  m.update(() => {
@@ -1030,7 +1038,7 @@ function co({
1030
1038
  (t) => {
1031
1039
  t.preventDefault(), t.stopPropagation();
1032
1040
  const a = kt(i);
1033
- if (!(gt(i) && i !== a) && !(typeof d == "number" || typeof w == "number"))
1041
+ if (!(gt(i) && i !== a) && !(typeof d == "number" || typeof N == "number"))
1034
1042
  return;
1035
1043
  m.update(
1036
1044
  () => {
@@ -1043,12 +1051,12 @@ function co({
1043
1051
  },
1044
1052
  { tag: "image-reset" }
1045
1053
  );
1046
- const f = v.current;
1054
+ const f = y.current;
1047
1055
  f && requestAnimationFrame(() => {
1048
1056
  f.src = a, f.style.removeProperty("width"), f.style.removeProperty("height");
1049
1057
  }), M.success("Image reset to original size and crop");
1050
1058
  },
1051
- [m, e, i, d, w]
1059
+ [m, e, i, d, N]
1052
1060
  ), Pe = S(
1053
1061
  async (t) => {
1054
1062
  let a = i;
@@ -1087,21 +1095,21 @@ function co({
1087
1095
  },
1088
1096
  [m, e, i, wt]
1089
1097
  ), Se = S(() => {
1090
- k && !n && (_.current = setTimeout(() => {
1098
+ C && !n && (_.current = setTimeout(() => {
1091
1099
  A(!0);
1092
1100
  }, 300));
1093
- }, [k, n]), ze = S(() => {
1101
+ }, [C, n]), ze = S(() => {
1094
1102
  _.current && (clearTimeout(_.current), _.current = null), A(!1);
1095
1103
  }, []), Yt = S((t) => {
1096
- t.preventDefault(), t.stopPropagation(), k && window.open(k, "_blank", "noopener,noreferrer");
1097
- }, [k]);
1104
+ t.preventDefault(), t.stopPropagation(), C && window.open(C, "_blank", "noopener,noreferrer");
1105
+ }, [C]);
1098
1106
  tt(() => () => {
1099
1107
  _.current && clearTimeout(_.current);
1100
1108
  }, []), tt(() => {
1101
1109
  n || ut(!1);
1102
1110
  }, [n]);
1103
1111
  const _t = async () => {
1104
- if (!b.trim() || y)
1112
+ if (!b.trim() || x)
1105
1113
  return;
1106
1114
  O(!0);
1107
1115
  const t = M.loading("Refining image...", {
@@ -1110,7 +1118,7 @@ function co({
1110
1118
  try {
1111
1119
  let a = b.trim();
1112
1120
  const u = b.trim().replace(/^(add|also add|include|with|and)\s+(some|a|an)\s+/gi, "").replace(/^(add|also add|include|with|and)\s+/gi, "").trim(), f = (Nt) => {
1113
- const je = Nt.toLowerCase();
1121
+ const Te = Nt.toLowerCase();
1114
1122
  return [
1115
1123
  "article",
1116
1124
  "write",
@@ -1127,7 +1135,7 @@ function co({
1127
1135
  "add some images",
1128
1136
  "include images",
1129
1137
  "include pictures"
1130
- ].some((We) => je.includes(We));
1138
+ ].some((je) => Te.includes(je));
1131
1139
  };
1132
1140
  let z = "";
1133
1141
  if (E && E.trim()) {
@@ -1145,10 +1153,10 @@ function co({
1145
1153
  const it = new DOMParser().parseFromString(J, "text/html").querySelector("img");
1146
1154
  if (!it || !it.src)
1147
1155
  throw new Error("No image found in response");
1148
- const Te = it.src;
1156
+ const We = it.src;
1149
1157
  M.dismiss(t), M.success("Image refined successfully!", {
1150
1158
  description: "Compare the images and choose which to keep."
1151
- }), B(Te), Y(a), lt(!0), g(""), p(!1);
1159
+ }), B(We), Y(a), lt(!0), g(""), p(!1);
1152
1160
  } catch (a) {
1153
1161
  if (M.dismiss(t), a instanceof vr) {
1154
1162
  const l = a.code === "API_KEYS_DISABLED" ? "API Keys Disabled" : "API Key Required";
@@ -1179,7 +1187,7 @@ function co({
1179
1187
  });
1180
1188
  }, Ae = () => {
1181
1189
  lt(!1), B(""), Y("");
1182
- }, De = n && at(j) && !$, Ot = (n || $) && Pt, Le = () => c === "left" || c === "right" ? {
1190
+ }, De = n && at(T) && !$, Ot = (n || $) && Pt, Le = () => c === "left" || c === "right" ? {
1183
1191
  position: "relative",
1184
1192
  display: "block",
1185
1193
  width: "100%"
@@ -1211,15 +1219,15 @@ function co({
1211
1219
  (t) => {
1212
1220
  if ($ || t.target.closest("button"))
1213
1221
  return;
1214
- const l = t.target === v.current;
1222
+ const l = t.target === y.current;
1215
1223
  let u = !1;
1216
- if (!l && v.current) {
1217
- const f = v.current.getBoundingClientRect();
1224
+ if (!l && y.current) {
1225
+ const f = y.current.getBoundingClientRect();
1218
1226
  u = t.clientX >= f.left && t.clientX <= f.right && t.clientY >= f.top && t.clientY <= f.bottom;
1219
1227
  }
1220
- !l && !u || (t.stopPropagation(), t.shiftKey ? T(!n) : (R(), T(!0)));
1228
+ !l && !u || (t.stopPropagation(), t.shiftKey ? W(!n) : (R(), W(!0)));
1221
1229
  },
1222
- [$, n, T, R]
1230
+ [$, n, W, R]
1223
1231
  );
1224
1232
  return /* @__PURE__ */ r(er, { fallback: null, children: /* @__PURE__ */ h(Ft, { children: [
1225
1233
  /* @__PURE__ */ h(
@@ -1236,7 +1244,7 @@ function co({
1236
1244
  {
1237
1245
  className: "cteditor-relative cteditor-inline-block cteditor-my-2 cteditor-select-none cteditor-rounded-lg cteditor-overflow-hidden",
1238
1246
  style: {
1239
- ...typeof d == "number" && typeof w == "number" ? { width: d, height: w, aspectRatio: `${d} / ${w}`, maxWidth: "100%" } : { minWidth: 200, minHeight: 150 }
1247
+ ...typeof d == "number" && typeof N == "number" ? { width: d, height: N, aspectRatio: `${d} / ${N}`, maxWidth: "100%" } : { minWidth: 200, minHeight: 150 }
1240
1248
  },
1241
1249
  children: [
1242
1250
  /* @__PURE__ */ r(
@@ -1258,26 +1266,26 @@ function co({
1258
1266
  ]
1259
1267
  }
1260
1268
  ) : q ? /* @__PURE__ */ r(Yr, {}) : /* @__PURE__ */ r(
1261
- Wr,
1269
+ jr,
1262
1270
  {
1263
- className: Ot ? `focused ${at(j) ? "draggable" : ""}` : k ? "cteditor-cursor-pointer" : null,
1271
+ className: Ot ? `focused ${at(T) ? "draggable" : ""}` : C ? "cteditor-cursor-pointer" : null,
1264
1272
  src: i,
1265
1273
  altText: o,
1266
- imageRef: v,
1274
+ imageRef: y,
1267
1275
  width: d,
1268
- height: w,
1269
- maxWidth: x,
1276
+ height: N,
1277
+ maxWidth: v,
1270
1278
  onError: () => It(!0)
1271
1279
  }
1272
1280
  ),
1273
- U && k && !n && /* @__PURE__ */ h(
1281
+ U && C && !n && /* @__PURE__ */ h(
1274
1282
  "div",
1275
1283
  {
1276
1284
  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",
1277
1285
  style: { zIndex: 10 },
1278
1286
  children: [
1279
1287
  /* @__PURE__ */ r(Cr, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-muted-foreground cteditor-flex-shrink-0" }),
1280
- /* @__PURE__ */ r("span", { className: "cteditor-text-sm cteditor-text-foreground cteditor-truncate cteditor-flex-1", children: k }),
1288
+ /* @__PURE__ */ r("span", { className: "cteditor-text-sm cteditor-text-foreground cteditor-truncate cteditor-flex-1", children: C }),
1281
1289
  /* @__PURE__ */ r(
1282
1290
  "button",
1283
1291
  {
@@ -1289,7 +1297,7 @@ function co({
1289
1297
  ]
1290
1298
  }
1291
1299
  ),
1292
- n && at(j) && !q && !St && /* @__PURE__ */ h(
1300
+ n && at(T) && !q && !St && /* @__PURE__ */ h(
1293
1301
  "div",
1294
1302
  {
1295
1303
  ref: vt,
@@ -1371,7 +1379,7 @@ function co({
1371
1379
  children: /* @__PURE__ */ r(be, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-foreground" })
1372
1380
  }
1373
1381
  ),
1374
- (kt(i) !== i || typeof d == "number" || typeof w == "number") && /* @__PURE__ */ r(
1382
+ (kt(i) !== i || typeof d == "number" || typeof N == "number") && /* @__PURE__ */ r(
1375
1383
  "button",
1376
1384
  {
1377
1385
  onClick: Ie,
@@ -1383,13 +1391,13 @@ function co({
1383
1391
  )
1384
1392
  ] })
1385
1393
  ] }),
1386
- k && /* @__PURE__ */ r(
1394
+ C && /* @__PURE__ */ r(
1387
1395
  "button",
1388
1396
  {
1389
1397
  onClick: Yt,
1390
1398
  className: " cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded-md cteditor-bg-accent hover:cteditor-bg-accent/95 cteditor-transition-colors cteditor-shadow-md cteditor-border cteditor-border-foreground/20",
1391
1399
  "aria-label": "Visit link",
1392
- title: `Visit: ${k}`,
1400
+ title: `Visit: ${C}`,
1393
1401
  children: /* @__PURE__ */ r(fr, {})
1394
1402
  }
1395
1403
  ),
@@ -1449,7 +1457,7 @@ function co({
1449
1457
  value: b,
1450
1458
  onChange: (t) => g(t.target.value),
1451
1459
  onKeyDown: (t) => {
1452
- t.stopPropagation(), t.key === "Enter" && b.trim() && !y && _t(), t.key === "Escape" && (p(!1), g(""));
1460
+ t.stopPropagation(), t.key === "Enter" && b.trim() && !x && _t(), t.key === "Escape" && (p(!1), g(""));
1453
1461
  },
1454
1462
  onKeyUp: (t) => {
1455
1463
  t.stopPropagation();
@@ -1459,7 +1467,7 @@ function co({
1459
1467
  },
1460
1468
  placeholder: "e.g., flying birds, golden sunset, stormy clouds...",
1461
1469
  className: "cteditor-w-full cteditor-px-3 cteditor-py-2 cteditor-text-sm cteditor-border cteditor-border-foreground/10 focus:cteditor-border-foreground cteditor-rounded-md cteditor-bg-background cteditor-text-foreground ",
1462
- disabled: y,
1470
+ disabled: x,
1463
1471
  autoFocus: !0
1464
1472
  }
1465
1473
  ),
@@ -1470,9 +1478,9 @@ function co({
1470
1478
  onClick: (t) => {
1471
1479
  t.stopPropagation(), _t();
1472
1480
  },
1473
- disabled: y || !b.trim(),
1481
+ disabled: x || !b.trim(),
1474
1482
  className: " cteditor-px-5 cteditor-py-2 cteditor-text-sm cteditor-rounded-md cteditor-bg-foreground cteditor-text-background hover:cteditor-bg-foreground/95 disabled:cteditor-opacity-50 disabled:cteditor-cursor-not-allowed cteditor-transition-colors focus:cteditor-outline-none focus:cteditor-ring-2 focus:cteditor-ring-background",
1475
- children: y ? /* @__PURE__ */ h("span", { className: "cteditor-flex cteditor-items-center cteditor-justify-center cteditor-gap-2", children: [
1483
+ children: x ? /* @__PURE__ */ h("span", { className: "cteditor-flex cteditor-items-center cteditor-justify-center cteditor-gap-2", children: [
1476
1484
  /* @__PURE__ */ r("span", { className: "cteditor-inline-block cteditor-w-4 cteditor-h-4 cteditor-border-2 cteditor-border-t-transparent cteditor-rounded-full cteditor-animate-spin" }),
1477
1485
  "Refining..."
1478
1486
  ] }) : "Refine Image"
@@ -1484,7 +1492,7 @@ function co({
1484
1492
  onClick: (t) => {
1485
1493
  t.stopPropagation(), p(!1), g("");
1486
1494
  },
1487
- disabled: y,
1495
+ disabled: x,
1488
1496
  className: "cteditor-size-9 cteditor-flex cteditor-items-center cteditor-justify-center 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",
1489
1497
  children: /* @__PURE__ */ r(yr, { size: 16 })
1490
1498
  }
@@ -1493,24 +1501,24 @@ function co({
1493
1501
  ] })
1494
1502
  }
1495
1503
  ),
1496
- L && at(j) && Ot && !St && /* @__PURE__ */ r(
1504
+ L && at(T) && Ot && !St && /* @__PURE__ */ r(
1497
1505
  Ye,
1498
1506
  {
1499
1507
  showCaption: P,
1500
1508
  setShowCaption: ve,
1501
1509
  editor: m,
1502
1510
  buttonRef: D,
1503
- imageRef: v,
1504
- maxWidth: x,
1511
+ imageRef: y,
1512
+ maxWidth: v,
1505
1513
  onResizeStart: Ce,
1506
1514
  onResizeEnd: we,
1507
- captionsEnabled: !q && C
1515
+ captionsEnabled: !q && w
1508
1516
  }
1509
1517
  )
1510
1518
  ]
1511
1519
  }
1512
1520
  ),
1513
- P && (o.startsWith("Signature by") ? /* @__PURE__ */ r(Rr, { caption: N }) : /* @__PURE__ */ r(
1521
+ P && (o.startsWith("Signature by") ? /* @__PURE__ */ r(Rr, { caption: k }) : /* @__PURE__ */ r(
1514
1522
  "div",
1515
1523
  {
1516
1524
  className: "image-caption-container",
@@ -1523,7 +1531,7 @@ function co({
1523
1531
  children: /* @__PURE__ */ h(
1524
1532
  re,
1525
1533
  {
1526
- initialEditor: N,
1534
+ initialEditor: k,
1527
1535
  initialNodes: [
1528
1536
  ae,
1529
1537
  ne,
@@ -1541,8 +1549,8 @@ function co({
1541
1549
  Zt,
1542
1550
  {
1543
1551
  "aria-placeholder": "Enter a caption...",
1544
- placeholder: () => /* @__PURE__ */ r("span", { className: "cteditor-text-xs", children: "Enter a caption..." }),
1545
- className: " cteditor-outline-none !cteditor-shadow-none cteditor-bg-foreground/10 cteditor-border !cteditor-border-foreground/15 cteditor-py-1 cteditor-px-2 cteditor-rounded-sm cteditor-text-xs"
1552
+ placeholder: () => /* @__PURE__ */ r("span", { className: "cteditor-text-xs cteditor-absolute cteditor-left-2 cteditor-top-[7px]", children: "Enter a caption..." }),
1553
+ className: " cteditor-outline-none !cteditor-shadow-none cteditor-bg-foreground/10 cteditor-border !cteditor-border-foreground/15 cteditor-py-1 cteditor-px-2 cteditor-rounded-sm cteditor-text-xs cteditor-relative"
1546
1554
  }
1547
1555
  ),
1548
1556
  ErrorBoundary: te
@@ -1563,14 +1571,14 @@ function co({
1563
1571
  }
1564
1572
  )),
1565
1573
  /* @__PURE__ */ r(
1566
- Tr,
1574
+ Wr,
1567
1575
  {
1568
1576
  open: F,
1569
1577
  onOpenChange: ut,
1570
1578
  src: i,
1571
1579
  altText: o,
1572
1580
  width: d,
1573
- height: w,
1581
+ height: N,
1574
1582
  onCropApply: Pe
1575
1583
  }
1576
1584
  ),