eddyter 1.4.4 → 1.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -6
- package/dist/{ImageResizer-Bt7kgv0a.js → ImageResizer-C5luyjPa.js} +68 -59
- package/dist/assets/style.css +1 -1
- package/dist/components/ConfigurableEditorWithAuth.d.ts +8 -6
- package/dist/components/LineHeightPicker/LineHeightControl.d.ts +3 -0
- package/dist/editor/components/FloatingToolbarManager.d.ts +3 -1
- package/dist/editor/hooks/useFloatingToolbar.d.ts +3 -2
- package/dist/{generateDocxThumbnail-Bgj-d-T6.js → generateDocxThumbnail-BgIdOWg3.js} +1 -1
- package/dist/{generatePdfThumbnail-Cpk4bD2y.js → generatePdfThumbnail-DZ8_E1lJ.js} +1 -1
- package/dist/{generateXlsxThumbnail-BtZOKJ-7.js → generateXlsxThumbnail-B_vFMM-q.js} +1 -1
- package/dist/hooks/useAutoExpandingHeight.d.ts +1 -1
- package/dist/{html2pdf.bundle.min-CSXFMSR9.js → html2pdf.bundle.min-CDLnol6o.js} +1 -1
- package/dist/{index-D6hSgxWh.js → index-B6FDh2NJ.js} +4 -4
- package/dist/{index-CyxBhIG-.js → index-CU78ju_h.js} +26143 -25318
- package/dist/{index-Bc2smzDZ.js → index-CVkebuOP.js} +2 -2
- package/dist/{index-S-p1WVeV.js → index-DtbCbxgA.js} +448 -412
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/pages/ConfigurableEditor/ConfigurableEditor.d.ts +2 -2
- package/dist/plugins/CustomHorizontalRulePlugin/CustomHorizontalRuleNode.d.ts +4 -1
- package/dist/plugins/CustomHorizontalRulePlugin/HorizontalRuleCustomizationDialog.d.ts +8 -1
- package/dist/types.d.ts +8 -0
- package/dist/utils/fileUploadValidation.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import { jsx as r, jsxs as h, Fragment as
|
|
2
|
-
import { I as
|
|
3
|
-
import { CodeNode as
|
|
4
|
-
import { LinkNode as
|
|
5
|
-
import { AutoFocusPlugin as
|
|
6
|
-
import { useCollaborationContext as
|
|
7
|
-
import { useLexicalComposerContext as
|
|
8
|
-
import { ContentEditable as
|
|
9
|
-
import { LexicalErrorBoundary as
|
|
10
|
-
import { HistoryPlugin as
|
|
11
|
-
import { LexicalNestedComposer as
|
|
12
|
-
import { OnChangePlugin as
|
|
13
|
-
import { RichTextPlugin as
|
|
14
|
-
import { useLexicalEditable as
|
|
15
|
-
import { useLexicalNodeSelection as
|
|
16
|
-
import { mergeRegister as
|
|
17
|
-
import { RootNode as
|
|
18
|
-
import
|
|
19
|
-
import { c as
|
|
1
|
+
import { jsx as r, jsxs as h, Fragment as Kt } from "react/jsx-runtime";
|
|
2
|
+
import { I as _e } from "./ImageResizer-C5luyjPa.js";
|
|
3
|
+
import { CodeNode as ee } from "@lexical/code";
|
|
4
|
+
import { LinkNode as re } from "@lexical/link";
|
|
5
|
+
import { AutoFocusPlugin as Oe } from "@lexical/react/LexicalAutoFocusPlugin";
|
|
6
|
+
import { useCollaborationContext as He } from "@lexical/react/LexicalCollaborationContext";
|
|
7
|
+
import { useLexicalComposerContext as Fe } from "@lexical/react/LexicalComposerContext";
|
|
8
|
+
import { ContentEditable as oe } from "@lexical/react/LexicalContentEditable";
|
|
9
|
+
import { LexicalErrorBoundary as ie } from "@lexical/react/LexicalErrorBoundary";
|
|
10
|
+
import { HistoryPlugin as ae } from "@lexical/react/LexicalHistoryPlugin";
|
|
11
|
+
import { LexicalNestedComposer as ne } from "@lexical/react/LexicalNestedComposer";
|
|
12
|
+
import { OnChangePlugin as se } from "@lexical/react/LexicalOnChangePlugin";
|
|
13
|
+
import { RichTextPlugin as de } from "@lexical/react/LexicalRichTextPlugin";
|
|
14
|
+
import { useLexicalEditable as Xe } from "@lexical/react/useLexicalEditable";
|
|
15
|
+
import { useLexicalNodeSelection as Be } from "@lexical/react/useLexicalNodeSelection";
|
|
16
|
+
import { mergeRegister as Ue } from "@lexical/utils";
|
|
17
|
+
import { RootNode as ce, TextNode as le, LineBreakNode as ue, ParagraphNode as me, $isNodeSelection as st, $getSelection as dt, $isParagraphNode as Yt, $setSelection as xt, $isRangeSelection as Ke, SELECTION_CHANGE_COMMAND as Ge, COMMAND_PRIORITY_LOW as tt, CLICK_COMMAND as qe, DRAGSTART_COMMAND as Ve, KEY_DELETE_COMMAND as Je, KEY_BACKSPACE_COMMAND as Qe, KEY_ENTER_COMMAND as Ze, KEY_ESCAPE_COMMAND as tr, $getNodeByKey as ct, createCommand as er } from "lexical";
|
|
18
|
+
import wt, { useState as I, useRef as V, useMemo as Gt, useCallback as S, useEffect as rt, useLayoutEffect as qt, Suspense as rr } from "react";
|
|
19
|
+
import { c as vt, D as ge, a as fe, b as he, d as pe, e as be, f as ye, B as Vt, L as xe, i as we, C as It, I as or, S as ir, u as ar, $ as et, t as M, g as nr, h as sr, j as dr, W as cr, k as lr, A as ur, l as mr, m as gr, T as fr, n as hr, o as pr, E as br, p as yr, X as xr, q as wr, r as vr, s as Cr } from "./index-CU78ju_h.js";
|
|
20
20
|
import "react-dom";
|
|
21
|
-
const
|
|
21
|
+
const ve = vt("Crop", [
|
|
22
22
|
["path", { d: "M6 2v14a2 2 0 0 0 2 2h14", key: "ron5a4" }],
|
|
23
23
|
["path", { d: "M18 22V8a2 2 0 0 0-2-2H2", key: "7s9ehn" }]
|
|
24
24
|
]);
|
|
25
|
-
const
|
|
25
|
+
const Nr = vt("Link2", [
|
|
26
26
|
["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }],
|
|
27
27
|
["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }],
|
|
28
28
|
["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }]
|
|
29
29
|
]);
|
|
30
|
-
const
|
|
30
|
+
const Jt = vt("RectangleHorizontal", [
|
|
31
31
|
["rect", { width: "20", height: "12", x: "2", y: "6", rx: "2", key: "9lu3g6" }]
|
|
32
32
|
]);
|
|
33
|
-
const
|
|
33
|
+
const Qt = vt("RectangleVertical", [
|
|
34
34
|
["rect", { width: "12", height: "20", x: "6", y: "2", rx: "2", key: "1oxtiu" }]
|
|
35
35
|
]);
|
|
36
|
-
const
|
|
36
|
+
const kr = vt("RotateCcw", [
|
|
37
37
|
["path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "1357e3" }],
|
|
38
38
|
["path", { d: "M3 3v5h5", key: "1xhq8a" }]
|
|
39
|
-
]),
|
|
39
|
+
]), Rr = ({
|
|
40
40
|
open: i,
|
|
41
41
|
onOpenChange: o,
|
|
42
42
|
oldImageUrl: e,
|
|
43
43
|
newImageUrl: d,
|
|
44
44
|
onReplace: N,
|
|
45
|
-
onCancel:
|
|
46
|
-
}) => /* @__PURE__ */ r(
|
|
47
|
-
/* @__PURE__ */ h(
|
|
48
|
-
/* @__PURE__ */ h(
|
|
45
|
+
onCancel: w
|
|
46
|
+
}) => /* @__PURE__ */ r(ge, { open: i, onOpenChange: o, children: /* @__PURE__ */ h(fe, { className: "sm:max-w-[800px] max-h-[90vh] overflow-y-auto", children: [
|
|
47
|
+
/* @__PURE__ */ h(he, { children: [
|
|
48
|
+
/* @__PURE__ */ h(pe, { className: "flex items-center gap-2 text-xl", children: [
|
|
49
49
|
/* @__PURE__ */ r("span", { className: "text-2xl", children: "🔄" }),
|
|
50
50
|
"Compare Images"
|
|
51
51
|
] }),
|
|
52
|
-
/* @__PURE__ */ r(
|
|
52
|
+
/* @__PURE__ */ r(be, { className: "text-sm pt-1", children: "Choose whether to replace the original image with the refined version." })
|
|
53
53
|
] }),
|
|
54
54
|
/* @__PURE__ */ h("div", { className: "space-y-4 py-4", children: [
|
|
55
55
|
/* @__PURE__ */ r("div", { className: "grid grid-cols-2 gap-4", children: /* @__PURE__ */ h("div", { className: "space-y-2", children: [
|
|
@@ -71,17 +71,17 @@ const Nr = xt("RotateCcw", [
|
|
|
71
71
|
' Clicking "Replace" will update the image in your document. This action cannot be undone.'
|
|
72
72
|
] }) })
|
|
73
73
|
] }),
|
|
74
|
-
/* @__PURE__ */ h(
|
|
74
|
+
/* @__PURE__ */ h(ye, { className: "gap-2", children: [
|
|
75
75
|
/* @__PURE__ */ r(
|
|
76
|
-
|
|
76
|
+
Vt,
|
|
77
77
|
{
|
|
78
78
|
variant: "outline",
|
|
79
|
-
onClick:
|
|
79
|
+
onClick: w,
|
|
80
80
|
children: "Keep Original"
|
|
81
81
|
}
|
|
82
82
|
),
|
|
83
83
|
/* @__PURE__ */ h(
|
|
84
|
-
|
|
84
|
+
Vt,
|
|
85
85
|
{
|
|
86
86
|
onClick: N,
|
|
87
87
|
className: "bg-blue-500 hover:bg-blue-600 text-white",
|
|
@@ -93,27 +93,27 @@ const Nr = xt("RotateCcw", [
|
|
|
93
93
|
)
|
|
94
94
|
] })
|
|
95
95
|
] }) });
|
|
96
|
-
function
|
|
96
|
+
function Er({
|
|
97
97
|
caption: i
|
|
98
98
|
}) {
|
|
99
99
|
return /* @__PURE__ */ r("div", { className: "signature-caption-container", children: /* @__PURE__ */ h(
|
|
100
|
-
|
|
100
|
+
ne,
|
|
101
101
|
{
|
|
102
102
|
initialEditor: i,
|
|
103
103
|
initialNodes: [
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
104
|
+
ce,
|
|
105
|
+
le,
|
|
106
|
+
ue,
|
|
107
|
+
me,
|
|
108
|
+
re,
|
|
109
|
+
ee
|
|
110
110
|
],
|
|
111
111
|
children: [
|
|
112
112
|
/* @__PURE__ */ r(
|
|
113
|
-
|
|
113
|
+
de,
|
|
114
114
|
{
|
|
115
115
|
contentEditable: /* @__PURE__ */ r(
|
|
116
|
-
|
|
116
|
+
oe,
|
|
117
117
|
{
|
|
118
118
|
"aria-placeholder": "Enter signature name...",
|
|
119
119
|
placeholder: /* @__PURE__ */ r("div", { style: {
|
|
@@ -129,30 +129,30 @@ function Rr({
|
|
|
129
129
|
className: "signature-caption-editable"
|
|
130
130
|
}
|
|
131
131
|
),
|
|
132
|
-
ErrorBoundary:
|
|
132
|
+
ErrorBoundary: ie
|
|
133
133
|
}
|
|
134
134
|
),
|
|
135
|
-
/* @__PURE__ */ r(
|
|
135
|
+
/* @__PURE__ */ r(se, { onChange: () => {
|
|
136
136
|
} }),
|
|
137
|
-
/* @__PURE__ */ r(
|
|
138
|
-
/* @__PURE__ */ r(
|
|
137
|
+
/* @__PURE__ */ r(ae, {}),
|
|
138
|
+
/* @__PURE__ */ r(xe, { namespace: we.namespace })
|
|
139
139
|
]
|
|
140
140
|
}
|
|
141
141
|
) });
|
|
142
142
|
}
|
|
143
|
-
const
|
|
144
|
-
function
|
|
145
|
-
if (!
|
|
143
|
+
const Ir = "/transform-image/";
|
|
144
|
+
function ht(i) {
|
|
145
|
+
if (!It || i.startsWith("data:") || i.toLowerCase().endsWith(".svg"))
|
|
146
146
|
return !1;
|
|
147
147
|
try {
|
|
148
|
-
const o = new URL(i).origin, e = new URL(
|
|
148
|
+
const o = new URL(i).origin, e = new URL(It).origin;
|
|
149
149
|
return o === e;
|
|
150
150
|
} catch {
|
|
151
151
|
return !1;
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
|
-
function
|
|
155
|
-
if (!
|
|
154
|
+
function Ce(i) {
|
|
155
|
+
if (!ht(i))
|
|
156
156
|
return null;
|
|
157
157
|
try {
|
|
158
158
|
const e = new URL(i).pathname.replace(/^\//, ""), d = "transform-image/";
|
|
@@ -161,17 +161,17 @@ function ye(i) {
|
|
|
161
161
|
return null;
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
-
function
|
|
165
|
-
if (!
|
|
164
|
+
function Pr(i, o) {
|
|
165
|
+
if (!ht(i))
|
|
166
166
|
return i;
|
|
167
|
-
const e =
|
|
167
|
+
const e = Ce(i);
|
|
168
168
|
if (!e)
|
|
169
169
|
return i;
|
|
170
170
|
const d = `${o.x},${o.y},${o.width},${o.height}`;
|
|
171
|
-
return `${
|
|
171
|
+
return `${It.replace(/\/$/, "")}${Ir}${e}?crop=${d}`;
|
|
172
172
|
}
|
|
173
|
-
function
|
|
174
|
-
if (!
|
|
173
|
+
function Zt(i) {
|
|
174
|
+
if (!ht(i))
|
|
175
175
|
return i;
|
|
176
176
|
try {
|
|
177
177
|
const o = new URL(i);
|
|
@@ -180,21 +180,21 @@ function Gt(i) {
|
|
|
180
180
|
return i;
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
|
-
function
|
|
184
|
-
if (!
|
|
185
|
-
return
|
|
186
|
-
const o =
|
|
187
|
-
return o ? `${
|
|
183
|
+
function Rt(i) {
|
|
184
|
+
if (!ht(i))
|
|
185
|
+
return Zt(i);
|
|
186
|
+
const o = Ce(i);
|
|
187
|
+
return o ? `${It.replace(/\/$/, "")}/${o}` : Zt(i);
|
|
188
188
|
}
|
|
189
|
-
function
|
|
189
|
+
function Sr(i) {
|
|
190
190
|
if (typeof document > "u")
|
|
191
191
|
return;
|
|
192
192
|
let o = document.head || document.getElementsByTagName("head")[0], e = document.createElement("style");
|
|
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
|
|
197
|
-
class
|
|
196
|
+
let _t = 1;
|
|
197
|
+
class zr {
|
|
198
198
|
constructor() {
|
|
199
199
|
this.subscribe = (o) => (this.subscribers.push(o), () => {
|
|
200
200
|
const e = this.subscribers.indexOf(o);
|
|
@@ -208,24 +208,24 @@ class Sr {
|
|
|
208
208
|
];
|
|
209
209
|
}, this.create = (o) => {
|
|
210
210
|
var e;
|
|
211
|
-
const { message: d, ...N } = o,
|
|
212
|
-
return this.dismissedToasts.has(
|
|
211
|
+
const { message: d, ...N } = o, w = typeof o?.id == "number" || ((e = o.id) == null ? void 0 : e.length) > 0 ? o.id : _t++, L = this.toasts.find((k) => k.id === w), P = o.dismissible === void 0 ? !0 : o.dismissible;
|
|
212
|
+
return this.dismissedToasts.has(w) && this.dismissedToasts.delete(w), L ? this.toasts = this.toasts.map((k) => k.id === w ? (this.publish({
|
|
213
213
|
...k,
|
|
214
214
|
...o,
|
|
215
|
-
id:
|
|
215
|
+
id: w,
|
|
216
216
|
title: d
|
|
217
217
|
}), {
|
|
218
218
|
...k,
|
|
219
219
|
...o,
|
|
220
|
-
id:
|
|
220
|
+
id: w,
|
|
221
221
|
dismissible: P,
|
|
222
222
|
title: d
|
|
223
223
|
}) : k) : this.addToast({
|
|
224
224
|
title: d,
|
|
225
225
|
...N,
|
|
226
226
|
dismissible: P,
|
|
227
|
-
id:
|
|
228
|
-
}),
|
|
227
|
+
id: w
|
|
228
|
+
}), w;
|
|
229
229
|
}, this.dismiss = (o) => (o ? (this.dismissedToasts.add(o), requestAnimationFrame(() => this.subscribers.forEach((e) => e({
|
|
230
230
|
id: o,
|
|
231
231
|
dismiss: !0
|
|
@@ -269,20 +269,20 @@ class Sr {
|
|
|
269
269
|
description: typeof e.description != "function" ? e.description : void 0
|
|
270
270
|
}));
|
|
271
271
|
const N = Promise.resolve(o instanceof Function ? o() : o);
|
|
272
|
-
let
|
|
273
|
-
const P = N.then(async (
|
|
272
|
+
let w = d !== void 0, L;
|
|
273
|
+
const P = N.then(async (v) => {
|
|
274
274
|
if (L = [
|
|
275
275
|
"resolve",
|
|
276
|
-
|
|
277
|
-
],
|
|
278
|
-
|
|
276
|
+
v
|
|
277
|
+
], wt.isValidElement(v))
|
|
278
|
+
w = !1, this.create({
|
|
279
279
|
id: d,
|
|
280
280
|
type: "default",
|
|
281
|
-
message:
|
|
281
|
+
message: v
|
|
282
282
|
});
|
|
283
|
-
else if (
|
|
284
|
-
|
|
285
|
-
const c = typeof e.error == "function" ? await e.error(`HTTP error! status: ${
|
|
283
|
+
else if (Ar(v) && !v.ok) {
|
|
284
|
+
w = !1;
|
|
285
|
+
const c = typeof e.error == "function" ? await e.error(`HTTP error! status: ${v.status}`) : e.error, C = typeof e.description == "function" ? await e.description(`HTTP error! status: ${v.status}`) : e.description, D = typeof c == "object" && !wt.isValidElement(c) ? c : {
|
|
286
286
|
message: c
|
|
287
287
|
};
|
|
288
288
|
this.create({
|
|
@@ -291,9 +291,9 @@ class Sr {
|
|
|
291
291
|
description: C,
|
|
292
292
|
...D
|
|
293
293
|
});
|
|
294
|
-
} else if (
|
|
295
|
-
|
|
296
|
-
const c = typeof e.error == "function" ? await e.error(
|
|
294
|
+
} else if (v instanceof Error) {
|
|
295
|
+
w = !1;
|
|
296
|
+
const c = typeof e.error == "function" ? await e.error(v) : e.error, C = typeof e.description == "function" ? await e.description(v) : e.description, D = typeof c == "object" && !wt.isValidElement(c) ? c : {
|
|
297
297
|
message: c
|
|
298
298
|
};
|
|
299
299
|
this.create({
|
|
@@ -303,8 +303,8 @@ class Sr {
|
|
|
303
303
|
...D
|
|
304
304
|
});
|
|
305
305
|
} else if (e.success !== void 0) {
|
|
306
|
-
|
|
307
|
-
const c = typeof e.success == "function" ? await e.success(
|
|
306
|
+
w = !1;
|
|
307
|
+
const c = typeof e.success == "function" ? await e.success(v) : e.success, C = typeof e.description == "function" ? await e.description(v) : e.description, D = typeof c == "object" && !wt.isValidElement(c) ? c : {
|
|
308
308
|
message: c
|
|
309
309
|
};
|
|
310
310
|
this.create({
|
|
@@ -314,13 +314,13 @@ class Sr {
|
|
|
314
314
|
...D
|
|
315
315
|
});
|
|
316
316
|
}
|
|
317
|
-
}).catch(async (
|
|
317
|
+
}).catch(async (v) => {
|
|
318
318
|
if (L = [
|
|
319
319
|
"reject",
|
|
320
|
-
|
|
320
|
+
v
|
|
321
321
|
], e.error !== void 0) {
|
|
322
|
-
|
|
323
|
-
const E = typeof e.error == "function" ? await e.error(
|
|
322
|
+
w = !1;
|
|
323
|
+
const E = typeof e.error == "function" ? await e.error(v) : e.error, c = typeof e.description == "function" ? await e.description(v) : e.description, y = typeof E == "object" && !wt.isValidElement(E) ? E : {
|
|
324
324
|
message: E
|
|
325
325
|
};
|
|
326
326
|
this.create({
|
|
@@ -331,15 +331,15 @@ class Sr {
|
|
|
331
331
|
});
|
|
332
332
|
}
|
|
333
333
|
}).finally(() => {
|
|
334
|
-
|
|
335
|
-
}), k = () => new Promise((
|
|
334
|
+
w && (this.dismiss(d), d = void 0), e.finally == null || e.finally.call(e);
|
|
335
|
+
}), k = () => new Promise((v, E) => P.then(() => L[0] === "reject" ? E(L[1]) : v(L[1])).catch(E));
|
|
336
336
|
return typeof d != "string" && typeof d != "number" ? {
|
|
337
337
|
unwrap: k
|
|
338
338
|
} : Object.assign(d, {
|
|
339
339
|
unwrap: k
|
|
340
340
|
});
|
|
341
341
|
}, this.custom = (o, e) => {
|
|
342
|
-
const d = e?.id ||
|
|
342
|
+
const d = e?.id || _t++;
|
|
343
343
|
return this.create({
|
|
344
344
|
jsx: o(d),
|
|
345
345
|
id: d,
|
|
@@ -348,41 +348,41 @@ 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
|
|
352
|
-
const e = o?.id ||
|
|
353
|
-
return
|
|
351
|
+
const Y = new zr(), Mr = (i, o) => {
|
|
352
|
+
const e = o?.id || _t++;
|
|
353
|
+
return Y.addToast({
|
|
354
354
|
title: i,
|
|
355
355
|
...o,
|
|
356
356
|
id: e
|
|
357
357
|
}), e;
|
|
358
|
-
},
|
|
359
|
-
success:
|
|
360
|
-
info:
|
|
361
|
-
warning:
|
|
362
|
-
error:
|
|
363
|
-
custom:
|
|
364
|
-
message:
|
|
365
|
-
promise:
|
|
366
|
-
dismiss:
|
|
367
|
-
loading:
|
|
358
|
+
}, Ar = (i) => i && typeof i == "object" && "ok" in i && typeof i.ok == "boolean" && "status" in i && typeof i.status == "number", Dr = Mr, Lr = () => Y.toasts, $r = () => Y.getActiveToasts(), Tr = Object.assign(Dr, {
|
|
359
|
+
success: Y.success,
|
|
360
|
+
info: Y.info,
|
|
361
|
+
warning: Y.warning,
|
|
362
|
+
error: Y.error,
|
|
363
|
+
custom: Y.custom,
|
|
364
|
+
message: Y.message,
|
|
365
|
+
promise: Y.promise,
|
|
366
|
+
dismiss: Y.dismiss,
|
|
367
|
+
loading: Y.loading
|
|
368
368
|
}, {
|
|
369
|
-
getHistory:
|
|
370
|
-
getToasts:
|
|
369
|
+
getHistory: Lr,
|
|
370
|
+
getToasts: $r
|
|
371
371
|
});
|
|
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%)}");
|
|
372
|
+
Sr("[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
373
|
function Wr({
|
|
374
374
|
open: i,
|
|
375
375
|
onOpenChange: o,
|
|
376
376
|
src: e,
|
|
377
377
|
altText: d,
|
|
378
378
|
width: N,
|
|
379
|
-
height:
|
|
379
|
+
height: w,
|
|
380
380
|
onCropApply: L
|
|
381
381
|
}) {
|
|
382
|
-
const [P, k] = I("freeform"), [
|
|
382
|
+
const [P, k] = I("freeform"), [v, E] = I(e), [c, C] = I(!1), y = V(null), D = V(null), [n, W] = I({ x: 0, y: 0, width: 0, height: 0 }), [R, $] = I({ x: 0, y: 0, width: 0, height: 0 }), ot = V(null), lt = Gt(() => typeof N == "number" && typeof w == "number" && w > 0 ? N / w : n.width > 0 && n.height > 0 ? n.width / n.height : null, [n.height, n.width, w, N]), pt = Gt(() => {
|
|
383
383
|
switch (P) {
|
|
384
384
|
case "original":
|
|
385
|
-
return
|
|
385
|
+
return lt;
|
|
386
386
|
case "1:1":
|
|
387
387
|
return 1;
|
|
388
388
|
case "4:3":
|
|
@@ -396,14 +396,14 @@ function Wr({
|
|
|
396
396
|
default:
|
|
397
397
|
return null;
|
|
398
398
|
}
|
|
399
|
-
}, [
|
|
399
|
+
}, [lt, P]), m = 24, j = S(
|
|
400
400
|
(s) => {
|
|
401
401
|
let { x: p, y: b, width: g, height: x } = s;
|
|
402
|
-
const
|
|
403
|
-
return p = Math.max(0, Math.min(p,
|
|
402
|
+
const F = n.width, ut = n.height;
|
|
403
|
+
return p = Math.max(0, Math.min(p, F - m)), b = Math.max(0, Math.min(b, ut - m)), g = Math.max(m, Math.min(g, F - p)), x = Math.max(m, Math.min(x, ut - b)), { x: p, y: b, width: g, height: x };
|
|
404
404
|
},
|
|
405
405
|
[n.height, n.width]
|
|
406
|
-
),
|
|
406
|
+
), bt = S(
|
|
407
407
|
(s) => {
|
|
408
408
|
if (n.width <= 0 || n.height <= 0)
|
|
409
409
|
return;
|
|
@@ -419,7 +419,7 @@ function Wr({
|
|
|
419
419
|
const p = n.width * 0.9, b = n.height * 0.9;
|
|
420
420
|
let g = p, x = g / s;
|
|
421
421
|
x > b && (x = b, g = x * s), $(
|
|
422
|
-
|
|
422
|
+
j({
|
|
423
423
|
x: (n.width - g) / 2,
|
|
424
424
|
y: (n.height - x) / 2,
|
|
425
425
|
width: g,
|
|
@@ -427,8 +427,8 @@ function Wr({
|
|
|
427
427
|
})
|
|
428
428
|
);
|
|
429
429
|
},
|
|
430
|
-
[n.height, n.width,
|
|
431
|
-
),
|
|
430
|
+
[n.height, n.width, j]
|
|
431
|
+
), it = S(() => {
|
|
432
432
|
const s = y.current, p = D.current;
|
|
433
433
|
if (!s || !p)
|
|
434
434
|
return;
|
|
@@ -441,9 +441,9 @@ function Wr({
|
|
|
441
441
|
width: p.offsetWidth,
|
|
442
442
|
height: p.offsetHeight
|
|
443
443
|
});
|
|
444
|
-
}, []),
|
|
444
|
+
}, []), J = S(
|
|
445
445
|
(s) => {
|
|
446
|
-
n.width <= 0 || n.height <= 0 || (s.preventDefault(), s.stopPropagation(), s.target.setPointerCapture?.(s.pointerId),
|
|
446
|
+
n.width <= 0 || n.height <= 0 || (s.preventDefault(), s.stopPropagation(), s.target.setPointerCapture?.(s.pointerId), ot.current = {
|
|
447
447
|
mode: "move",
|
|
448
448
|
startX: s.clientX,
|
|
449
449
|
startY: s.clientY,
|
|
@@ -451,9 +451,9 @@ function Wr({
|
|
|
451
451
|
});
|
|
452
452
|
},
|
|
453
453
|
[n.height, n.width, R]
|
|
454
|
-
),
|
|
454
|
+
), Pt = S(
|
|
455
455
|
(s, p) => {
|
|
456
|
-
n.width <= 0 || n.height <= 0 || (s.preventDefault(), s.stopPropagation(), s.target.setPointerCapture?.(s.pointerId),
|
|
456
|
+
n.width <= 0 || n.height <= 0 || (s.preventDefault(), s.stopPropagation(), s.target.setPointerCapture?.(s.pointerId), ot.current = {
|
|
457
457
|
mode: p,
|
|
458
458
|
startX: s.clientX,
|
|
459
459
|
startY: s.clientY,
|
|
@@ -461,14 +461,14 @@ function Wr({
|
|
|
461
461
|
});
|
|
462
462
|
},
|
|
463
463
|
[n.height, n.width, R]
|
|
464
|
-
),
|
|
464
|
+
), St = S(async () => {
|
|
465
465
|
if (n.width <= 0 || n.height <= 0) {
|
|
466
466
|
o(!1);
|
|
467
467
|
return;
|
|
468
468
|
}
|
|
469
469
|
const s = D.current;
|
|
470
470
|
if (!s || !s.naturalWidth || !s.naturalHeight) {
|
|
471
|
-
|
|
471
|
+
Tr.error("Could not read image dimensions");
|
|
472
472
|
return;
|
|
473
473
|
}
|
|
474
474
|
const p = s.naturalWidth / n.width, b = s.naturalHeight / n.height, g = {
|
|
@@ -481,50 +481,50 @@ function Wr({
|
|
|
481
481
|
};
|
|
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
|
-
return
|
|
485
|
-
i && (W({ x: 0, y: 0, width: 0, height: 0 }), $({ x: 0, y: 0, width: 0, height: 0 }), C(!1), E(
|
|
486
|
-
}, [i, e]),
|
|
484
|
+
return rt(() => {
|
|
485
|
+
i && (W({ x: 0, y: 0, width: 0, height: 0 }), $({ x: 0, y: 0, width: 0, height: 0 }), C(!1), E(Rt(e)));
|
|
486
|
+
}, [i, e]), rt(() => {
|
|
487
487
|
if (!i)
|
|
488
488
|
return;
|
|
489
489
|
const s = y.current;
|
|
490
490
|
if (!s)
|
|
491
491
|
return;
|
|
492
492
|
const p = new ResizeObserver(() => {
|
|
493
|
-
|
|
493
|
+
it();
|
|
494
494
|
});
|
|
495
495
|
p.observe(s);
|
|
496
496
|
const b = D.current;
|
|
497
497
|
b && p.observe(b);
|
|
498
|
-
const g = () =>
|
|
498
|
+
const g = () => it();
|
|
499
499
|
return window.addEventListener("resize", g), () => {
|
|
500
500
|
p.disconnect(), window.removeEventListener("resize", g);
|
|
501
501
|
};
|
|
502
|
-
}, [i,
|
|
502
|
+
}, [i, it]), rt(() => {
|
|
503
503
|
if (!i)
|
|
504
504
|
return;
|
|
505
505
|
const s = (b) => {
|
|
506
|
-
const g =
|
|
506
|
+
const g = ot.current;
|
|
507
507
|
if (!g)
|
|
508
508
|
return;
|
|
509
509
|
b.preventDefault();
|
|
510
|
-
const x = b.clientX - g.startX,
|
|
510
|
+
const x = b.clientX - g.startX, F = b.clientY - g.startY, ut = n.width, mt = n.height, Q = pt ?? null, { x: K, y: at, width: _, height: G } = g.initialRect;
|
|
511
511
|
if (g.mode === "move") {
|
|
512
|
-
const
|
|
512
|
+
const gt = Math.max(0, ut - _), Ct = Math.max(0, mt - G);
|
|
513
513
|
$(
|
|
514
|
-
|
|
515
|
-
x: Math.max(0, Math.min(
|
|
516
|
-
y: Math.max(0, Math.min(
|
|
517
|
-
width:
|
|
518
|
-
height:
|
|
514
|
+
j({
|
|
515
|
+
x: Math.max(0, Math.min(gt, K + x)),
|
|
516
|
+
y: Math.max(0, Math.min(Ct, at + F)),
|
|
517
|
+
width: _,
|
|
518
|
+
height: G
|
|
519
519
|
})
|
|
520
520
|
);
|
|
521
521
|
return;
|
|
522
522
|
}
|
|
523
523
|
const A = g.mode;
|
|
524
|
-
let
|
|
525
|
-
A.includes("e") && (
|
|
524
|
+
let O = K, Z = at, X = _, B = G;
|
|
525
|
+
A.includes("e") && (X = _ + x), A.includes("w") && (O = K + x, X = _ - x), A.includes("s") && (B = G + F), A.includes("n") && (Z = at + F, B = G - F), Q != null && Q > 0 && (A === "e" || A === "w" ? (B = X / Q, A.includes("n") && (Z = at + G - B)) : A === "n" || A === "s" ? (X = B * Q, A.includes("w") && (O = K + _ - X)) : (B = X / Q, A.includes("n") && (Z = at + G - B), A.includes("w") && (O = K + _ - X))), $(j({ x: O, y: Z, width: X, height: B }));
|
|
526
526
|
}, p = () => {
|
|
527
|
-
|
|
527
|
+
ot.current = null;
|
|
528
528
|
};
|
|
529
529
|
return window.addEventListener("pointermove", s), window.addEventListener("pointerup", p), () => {
|
|
530
530
|
window.removeEventListener("pointermove", s), window.removeEventListener("pointerup", p);
|
|
@@ -533,12 +533,12 @@ function Wr({
|
|
|
533
533
|
i,
|
|
534
534
|
n.width,
|
|
535
535
|
n.height,
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
]),
|
|
539
|
-
i &&
|
|
540
|
-
}, [i,
|
|
541
|
-
|
|
536
|
+
pt,
|
|
537
|
+
j
|
|
538
|
+
]), rt(() => {
|
|
539
|
+
i && bt(pt);
|
|
540
|
+
}, [i, pt, n, bt]), /* @__PURE__ */ r(ge, { open: i, onOpenChange: o, children: /* @__PURE__ */ r(
|
|
541
|
+
fe,
|
|
542
542
|
{
|
|
543
543
|
className: "sm:cteditor-max-w-[860px] cteditor-max-w-[calc(100%-2rem)] cteditor-rounded-xl cteditor-overflow-hidden cteditor-p-0",
|
|
544
544
|
onClick: (s) => s.stopPropagation(),
|
|
@@ -554,12 +554,12 @@ function Wr({
|
|
|
554
554
|
"img",
|
|
555
555
|
{
|
|
556
556
|
ref: D,
|
|
557
|
-
src:
|
|
557
|
+
src: v,
|
|
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
|
-
C(!1),
|
|
562
|
+
C(!1), it();
|
|
563
563
|
},
|
|
564
564
|
onError: () => {
|
|
565
565
|
C(!0);
|
|
@@ -595,7 +595,7 @@ function Wr({
|
|
|
595
595
|
"div",
|
|
596
596
|
{
|
|
597
597
|
className: "cteditor-absolute cteditor-inset-0 cteditor-pointer-events-auto",
|
|
598
|
-
onPointerDown:
|
|
598
|
+
onPointerDown: J,
|
|
599
599
|
"aria-label": "Move crop area"
|
|
600
600
|
}
|
|
601
601
|
),
|
|
@@ -612,7 +612,7 @@ function Wr({
|
|
|
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: (x) =>
|
|
615
|
+
onPointerDown: (x) => Pt(x, s),
|
|
616
616
|
"aria-label": `Resize ${s}`
|
|
617
617
|
},
|
|
618
618
|
s
|
|
@@ -624,21 +624,21 @@ function Wr({
|
|
|
624
624
|
}
|
|
625
625
|
) }),
|
|
626
626
|
/* @__PURE__ */ h("div", { className: "cteditor-p-4 md:cteditor-p-5 cteditor-border-l cteditor-border-border cteditor-bg-background", children: [
|
|
627
|
-
/* @__PURE__ */ h(
|
|
628
|
-
/* @__PURE__ */ r(
|
|
629
|
-
/* @__PURE__ */ r(
|
|
627
|
+
/* @__PURE__ */ h(he, { className: "cteditor-mb-4 cteditor-space-y-1", children: [
|
|
628
|
+
/* @__PURE__ */ r(pe, { children: "Crop" }),
|
|
629
|
+
/* @__PURE__ */ r(be, { children: "Choose an aspect ratio and adjust the crop area, then click Apply." })
|
|
630
630
|
] }),
|
|
631
631
|
/* @__PURE__ */ h("div", { className: "cteditor-space-y-4", children: [
|
|
632
632
|
/* @__PURE__ */ h("div", { children: [
|
|
633
633
|
/* @__PURE__ */ r("p", { className: "cteditor-text-sm cteditor-font-medium cteditor-mb-2", children: "Aspect ratio" }),
|
|
634
634
|
/* @__PURE__ */ r("div", { className: "cteditor-grid cteditor-grid-cols-3 cteditor-gap-2", children: [
|
|
635
|
-
{ id: "freeform", label: "Freeform", icon:
|
|
636
|
-
{ id: "original", label: "Original", icon:
|
|
637
|
-
{ id: "1:1", label: "1:1", icon:
|
|
638
|
-
{ id: "4:3", label: "4:3", icon:
|
|
639
|
-
{ id: "16:9", label: "16:9", icon:
|
|
640
|
-
{ id: "3:4", label: "3:4", icon:
|
|
641
|
-
{ id: "9:16", label: "9:16", icon:
|
|
635
|
+
{ id: "freeform", label: "Freeform", icon: ve },
|
|
636
|
+
{ id: "original", label: "Original", icon: or },
|
|
637
|
+
{ id: "1:1", label: "1:1", icon: ir },
|
|
638
|
+
{ id: "4:3", label: "4:3", icon: Jt },
|
|
639
|
+
{ id: "16:9", label: "16:9", icon: Jt },
|
|
640
|
+
{ id: "3:4", label: "3:4", icon: Qt },
|
|
641
|
+
{ id: "9:16", label: "9:16", icon: Qt }
|
|
642
642
|
].map((s) => {
|
|
643
643
|
const p = s.icon, b = P === s.id;
|
|
644
644
|
return /* @__PURE__ */ h(
|
|
@@ -674,13 +674,13 @@ function Wr({
|
|
|
674
674
|
] })
|
|
675
675
|
] })
|
|
676
676
|
] }),
|
|
677
|
-
/* @__PURE__ */ h(
|
|
677
|
+
/* @__PURE__ */ h(ye, { className: "cteditor-gap-2 cteditor-mt-4", children: [
|
|
678
678
|
/* @__PURE__ */ r(
|
|
679
679
|
"button",
|
|
680
680
|
{
|
|
681
681
|
type: "button",
|
|
682
682
|
onClick: () => {
|
|
683
|
-
k("freeform"),
|
|
683
|
+
k("freeform"), bt(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"
|
|
@@ -699,7 +699,7 @@ function Wr({
|
|
|
699
699
|
"button",
|
|
700
700
|
{
|
|
701
701
|
type: "button",
|
|
702
|
-
onClick:
|
|
702
|
+
onClick: St,
|
|
703
703
|
className: "cteditor-px-3 cteditor-py-2 cteditor-text-sm cteditor-rounded-md cteditor-bg-primary cteditor-text-primary-foreground hover:cteditor-bg-primary/90 cteditor-transition-colors",
|
|
704
704
|
children: "Apply"
|
|
705
705
|
}
|
|
@@ -710,31 +710,31 @@ function Wr({
|
|
|
710
710
|
}
|
|
711
711
|
) });
|
|
712
712
|
}
|
|
713
|
-
const
|
|
714
|
-
function
|
|
715
|
-
if (!
|
|
713
|
+
const Et = /* @__PURE__ */ new Set(), te = er("RIGHT_CLICK_IMAGE_COMMAND");
|
|
714
|
+
function jr(i) {
|
|
715
|
+
if (!Et.has(i))
|
|
716
716
|
throw new Promise((o) => {
|
|
717
717
|
const e = new Image();
|
|
718
718
|
e.src = i, e.onload = () => {
|
|
719
|
-
|
|
719
|
+
Et.add(i), o(null);
|
|
720
720
|
}, e.onerror = () => {
|
|
721
|
-
|
|
721
|
+
Et.add(i);
|
|
722
722
|
};
|
|
723
723
|
});
|
|
724
724
|
}
|
|
725
|
-
function
|
|
725
|
+
function Yr({
|
|
726
726
|
altText: i,
|
|
727
727
|
className: o,
|
|
728
728
|
imageRef: e,
|
|
729
729
|
src: d,
|
|
730
730
|
width: N,
|
|
731
|
-
height:
|
|
731
|
+
height: w,
|
|
732
732
|
maxWidth: L,
|
|
733
733
|
onError: P,
|
|
734
734
|
onLoad: k
|
|
735
735
|
}) {
|
|
736
|
-
|
|
737
|
-
const
|
|
736
|
+
jr(d);
|
|
737
|
+
const v = typeof N == "number", E = typeof w == "number", c = v && E, C = v ? N : "auto", y = E ? w : "auto";
|
|
738
738
|
return /* @__PURE__ */ r(
|
|
739
739
|
"img",
|
|
740
740
|
{
|
|
@@ -744,12 +744,10 @@ function jr({
|
|
|
744
744
|
ref: e,
|
|
745
745
|
style: c ? {
|
|
746
746
|
width: C,
|
|
747
|
-
// Use height: auto + aspect-ratio so the image scales
|
|
748
|
-
// proportionally when max-width constrains on small screens.
|
|
749
747
|
height: "auto",
|
|
750
748
|
aspectRatio: `${C} / ${y}`,
|
|
751
749
|
maxWidth: "100%"
|
|
752
|
-
} :
|
|
750
|
+
} : v ? {
|
|
753
751
|
// Only width known (e.g. bogus height stripped from source HTML):
|
|
754
752
|
// fix the width and let the browser compute height naturally.
|
|
755
753
|
width: C,
|
|
@@ -770,7 +768,7 @@ function jr({
|
|
|
770
768
|
}
|
|
771
769
|
);
|
|
772
770
|
}
|
|
773
|
-
function
|
|
771
|
+
function _r() {
|
|
774
772
|
return /* @__PURE__ */ r(
|
|
775
773
|
"img",
|
|
776
774
|
{
|
|
@@ -790,57 +788,57 @@ function co({
|
|
|
790
788
|
nodeKey: e,
|
|
791
789
|
width: d,
|
|
792
790
|
height: N,
|
|
793
|
-
maxWidth:
|
|
791
|
+
maxWidth: w,
|
|
794
792
|
resizable: L,
|
|
795
793
|
showCaption: P,
|
|
796
794
|
caption: k,
|
|
797
|
-
captionsEnabled:
|
|
795
|
+
captionsEnabled: v,
|
|
798
796
|
originalPrompt: E,
|
|
799
797
|
position: c = "none",
|
|
800
798
|
linkUrl: C
|
|
801
799
|
}) {
|
|
802
|
-
const y =
|
|
803
|
-
|
|
804
|
-
if (!n || !
|
|
805
|
-
|
|
800
|
+
const y = V(null), D = V(null), [n, W, R] = Be(e), [$, ot] = I(!1), lt = V(!1), { isCollabActive: pt } = He(), [m] = Fe(), [j, bt] = I(null), it = V(null), [J, Pt] = I(!1), St = Xe(), [s, p] = I(!1), [b, g] = I(""), [x, F] = I(!1), [ut, mt] = I(!1), [Q, K] = I(""), [at, _] = I(""), [G, A] = I(!1), O = V(null), [Z, X] = I(0), [B, gt] = I(!1), Ct = V(null), [Ne, yt] = I(null), [zt, Mt] = I(!1), Nt = ar()?.apiKey, At = Z > 0 && Z < 350;
|
|
801
|
+
qt(() => {
|
|
802
|
+
if (!n || !st(j) || J) {
|
|
803
|
+
yt(null);
|
|
806
804
|
return;
|
|
807
805
|
}
|
|
808
|
-
const t =
|
|
806
|
+
const t = Ct.current, a = m.getRootElement(), l = t?.parentElement;
|
|
809
807
|
if (!t || !a || !l) {
|
|
810
|
-
|
|
808
|
+
yt(null);
|
|
811
809
|
return;
|
|
812
810
|
}
|
|
813
|
-
const u = a.getBoundingClientRect(), f = l.getBoundingClientRect(), z = t.getBoundingClientRect(),
|
|
814
|
-
if (
|
|
815
|
-
|
|
811
|
+
const u = a.getBoundingClientRect(), f = l.getBoundingClientRect(), z = t.getBoundingClientRect(), T = 8, H = z.width;
|
|
812
|
+
if (H <= 0) {
|
|
813
|
+
yt(null);
|
|
816
814
|
return;
|
|
817
815
|
}
|
|
818
|
-
if (
|
|
819
|
-
const
|
|
820
|
-
|
|
821
|
-
left:
|
|
816
|
+
if (At) {
|
|
817
|
+
const nt = f.left + f.width / 2 - H / 2, U = Math.max(u.left + T, Math.min(nt, u.right - T - H));
|
|
818
|
+
yt({
|
|
819
|
+
left: U - f.left,
|
|
822
820
|
bottom: 0,
|
|
823
821
|
right: "auto",
|
|
824
822
|
transform: "translateY(100%) translateY(4px)"
|
|
825
823
|
});
|
|
826
824
|
} else {
|
|
827
|
-
const
|
|
828
|
-
|
|
829
|
-
left:
|
|
830
|
-
top:
|
|
825
|
+
const nt = f.right - T - H, U = Math.max(u.left + T, Math.min(nt, u.right - T - H));
|
|
826
|
+
yt({
|
|
827
|
+
left: U - f.left,
|
|
828
|
+
top: T,
|
|
831
829
|
right: "auto"
|
|
832
830
|
});
|
|
833
831
|
}
|
|
834
|
-
}, [n,
|
|
832
|
+
}, [n, j, J, At, m, Z]), rt(() => {
|
|
835
833
|
if (y.current) {
|
|
836
834
|
const t = () => {
|
|
837
|
-
|
|
835
|
+
lt.current || y.current && X(y.current.offsetWidth);
|
|
838
836
|
};
|
|
839
837
|
t();
|
|
840
838
|
const a = new ResizeObserver(t);
|
|
841
839
|
return a.observe(y.current), () => a.disconnect();
|
|
842
840
|
}
|
|
843
|
-
}, [d, N, n]),
|
|
841
|
+
}, [d, N, n]), qt(() => {
|
|
844
842
|
if ((c === "left" || c === "right") && typeof d == "number" && y.current) {
|
|
845
843
|
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`;
|
|
846
844
|
return t && (t.style.removeProperty("display"), t.style.setProperty("max-width", f, "important")), a && a.style.setProperty("max-width", f, "important"), () => {
|
|
@@ -848,39 +846,39 @@ function co({
|
|
|
848
846
|
};
|
|
849
847
|
}
|
|
850
848
|
}, [c, d, m]);
|
|
851
|
-
const
|
|
849
|
+
const Dt = S(
|
|
852
850
|
(t) => {
|
|
853
|
-
const a =
|
|
854
|
-
return n &&
|
|
851
|
+
const a = dt();
|
|
852
|
+
return n && st(a) && (t.preventDefault(), m.update(() => {
|
|
855
853
|
a.getNodes().forEach((u) => {
|
|
856
|
-
if (
|
|
854
|
+
if (et(u)) {
|
|
857
855
|
const f = u.getParent();
|
|
858
|
-
u.remove(), f &&
|
|
856
|
+
u.remove(), f && Yt(f) && f.getChildrenSize() === 0 && f.setFormat("left");
|
|
859
857
|
}
|
|
860
858
|
});
|
|
861
859
|
})), !1;
|
|
862
860
|
},
|
|
863
861
|
[m, n]
|
|
864
|
-
),
|
|
862
|
+
), Ot = S(
|
|
865
863
|
(t) => {
|
|
866
|
-
const a =
|
|
867
|
-
if (n &&
|
|
864
|
+
const a = dt(), l = D.current;
|
|
865
|
+
if (n && st(a) && a.getNodes().length === 1) {
|
|
868
866
|
if (P)
|
|
869
|
-
return
|
|
867
|
+
return xt(null), t.preventDefault(), k.focus(), !0;
|
|
870
868
|
if (l !== null && l !== document.activeElement)
|
|
871
869
|
return t.preventDefault(), l.focus(), !0;
|
|
872
870
|
}
|
|
873
871
|
return !1;
|
|
874
872
|
},
|
|
875
873
|
[k, n, P]
|
|
876
|
-
),
|
|
877
|
-
(t) =>
|
|
874
|
+
), Ht = S(
|
|
875
|
+
(t) => it.current === k || D.current === t.target ? (xt(null), m.update(() => {
|
|
878
876
|
W(!0);
|
|
879
877
|
const a = m.getRootElement();
|
|
880
878
|
a !== null && a.focus();
|
|
881
879
|
}), !0) : !1,
|
|
882
880
|
[k, m, W]
|
|
883
|
-
),
|
|
881
|
+
), Lt = S(
|
|
884
882
|
(t) => {
|
|
885
883
|
const a = t;
|
|
886
884
|
if ($)
|
|
@@ -897,63 +895,63 @@ function co({
|
|
|
897
895
|
return u || f ? (a.shiftKey ? W(!n) : (R(), W(!0)), !0) : !1;
|
|
898
896
|
},
|
|
899
897
|
[$, n, W, R]
|
|
900
|
-
),
|
|
898
|
+
), $t = S(
|
|
901
899
|
(t) => {
|
|
902
900
|
m.getEditorState().read(() => {
|
|
903
|
-
const a =
|
|
904
|
-
t.target.tagName === "IMG" &&
|
|
905
|
-
|
|
901
|
+
const a = dt();
|
|
902
|
+
t.target.tagName === "IMG" && Ke(a) && a.getNodes().length === 1 && m.dispatchCommand(
|
|
903
|
+
te,
|
|
906
904
|
t
|
|
907
905
|
);
|
|
908
906
|
});
|
|
909
907
|
},
|
|
910
908
|
[m]
|
|
911
909
|
);
|
|
912
|
-
|
|
910
|
+
rt(() => {
|
|
913
911
|
let t = !0;
|
|
914
|
-
const a = m.getRootElement(), l =
|
|
912
|
+
const a = m.getRootElement(), l = Ue(
|
|
915
913
|
m.registerUpdateListener(({ editorState: u }) => {
|
|
916
|
-
t &&
|
|
914
|
+
t && bt(u.read(() => dt()));
|
|
917
915
|
}),
|
|
918
916
|
m.registerCommand(
|
|
919
|
-
|
|
920
|
-
(u, f) => (
|
|
921
|
-
|
|
917
|
+
Ge,
|
|
918
|
+
(u, f) => (it.current = f, !1),
|
|
919
|
+
tt
|
|
922
920
|
),
|
|
923
921
|
m.registerCommand(
|
|
924
922
|
qe,
|
|
925
|
-
|
|
926
|
-
|
|
923
|
+
Lt,
|
|
924
|
+
tt
|
|
927
925
|
),
|
|
928
926
|
m.registerCommand(
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
927
|
+
te,
|
|
928
|
+
Lt,
|
|
929
|
+
tt
|
|
932
930
|
),
|
|
933
931
|
m.registerCommand(
|
|
934
|
-
|
|
932
|
+
Ve,
|
|
935
933
|
(u) => u.target === y.current ? (u.preventDefault(), !0) : !1,
|
|
936
|
-
|
|
934
|
+
tt
|
|
937
935
|
),
|
|
938
936
|
m.registerCommand(
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
937
|
+
Je,
|
|
938
|
+
Dt,
|
|
939
|
+
tt
|
|
942
940
|
),
|
|
943
941
|
m.registerCommand(
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
942
|
+
Qe,
|
|
943
|
+
Dt,
|
|
944
|
+
tt
|
|
947
945
|
),
|
|
948
|
-
m.registerCommand(
|
|
946
|
+
m.registerCommand(Ze, Ot, tt),
|
|
949
947
|
m.registerCommand(
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
948
|
+
tr,
|
|
949
|
+
Ht,
|
|
950
|
+
tt
|
|
953
951
|
)
|
|
954
952
|
);
|
|
955
|
-
return a?.addEventListener("contextmenu",
|
|
956
|
-
t = !1, l(), a?.removeEventListener("contextmenu",
|
|
953
|
+
return a?.addEventListener("contextmenu", $t), () => {
|
|
954
|
+
t = !1, l(), a?.removeEventListener("contextmenu", $t);
|
|
957
955
|
};
|
|
958
956
|
}, [
|
|
959
957
|
R,
|
|
@@ -961,28 +959,28 @@ function co({
|
|
|
961
959
|
$,
|
|
962
960
|
n,
|
|
963
961
|
e,
|
|
964
|
-
At,
|
|
965
|
-
Tt,
|
|
966
|
-
jt,
|
|
967
962
|
Dt,
|
|
963
|
+
Ot,
|
|
964
|
+
Ht,
|
|
968
965
|
Lt,
|
|
966
|
+
$t,
|
|
969
967
|
W
|
|
970
968
|
]);
|
|
971
|
-
const
|
|
969
|
+
const ke = () => {
|
|
972
970
|
m.update(() => {
|
|
973
|
-
const t =
|
|
974
|
-
|
|
971
|
+
const t = ct(e);
|
|
972
|
+
et(t) && t.setShowCaption(!0);
|
|
975
973
|
});
|
|
976
|
-
},
|
|
977
|
-
|
|
978
|
-
|
|
974
|
+
}, Re = (t, a) => {
|
|
975
|
+
lt.current = !1, setTimeout(() => {
|
|
976
|
+
ot(!1);
|
|
979
977
|
}, 200), m.update(() => {
|
|
980
|
-
const l =
|
|
981
|
-
|
|
978
|
+
const l = ct(e);
|
|
979
|
+
et(l) && l.setWidthAndHeight(t, a);
|
|
982
980
|
});
|
|
983
|
-
},
|
|
984
|
-
|
|
985
|
-
},
|
|
981
|
+
}, Ee = () => {
|
|
982
|
+
lt.current = !0, ot(!0);
|
|
983
|
+
}, Ie = (t) => {
|
|
986
984
|
if (t.preventDefault(), t.stopPropagation(), i.startsWith("data:")) {
|
|
987
985
|
const a = window.open("", "_blank");
|
|
988
986
|
a && (a.document.write(`
|
|
@@ -1013,41 +1011,41 @@ function co({
|
|
|
1013
1011
|
`), a.document.close());
|
|
1014
1012
|
} else
|
|
1015
1013
|
window.open(i, "_blank");
|
|
1016
|
-
},
|
|
1014
|
+
}, Pe = (t) => {
|
|
1017
1015
|
t.preventDefault(), t.stopPropagation(), m.update(() => {
|
|
1018
|
-
const a =
|
|
1019
|
-
if (
|
|
1016
|
+
const a = ct(e);
|
|
1017
|
+
if (et(a)) {
|
|
1020
1018
|
const l = a.getParent();
|
|
1021
|
-
a.remove(), l &&
|
|
1019
|
+
a.remove(), l && Yt(l) && l.getChildrenSize() === 0 && l.setFormat("left");
|
|
1022
1020
|
}
|
|
1023
1021
|
});
|
|
1024
|
-
},
|
|
1022
|
+
}, ft = (t, a) => {
|
|
1025
1023
|
t.preventDefault(), t.stopPropagation(), m.update(() => {
|
|
1026
|
-
const l =
|
|
1027
|
-
if (
|
|
1024
|
+
const l = ct(e);
|
|
1025
|
+
if (et(l)) {
|
|
1028
1026
|
l.setPosition(a);
|
|
1029
1027
|
const u = l.getParent();
|
|
1030
|
-
u &&
|
|
1028
|
+
u && Yt(u) && (a === "left" ? u.setFormat("left") : a === "right" ? u.setFormat("right") : u.setFormat(""));
|
|
1031
1029
|
}
|
|
1032
1030
|
});
|
|
1033
|
-
},
|
|
1031
|
+
}, Se = (t) => {
|
|
1034
1032
|
t.preventDefault(), t.stopPropagation(), p(!s);
|
|
1035
|
-
},
|
|
1036
|
-
t.preventDefault(), t.stopPropagation(),
|
|
1037
|
-
}, []),
|
|
1033
|
+
}, ze = S((t) => {
|
|
1034
|
+
t.preventDefault(), t.stopPropagation(), gt(!0);
|
|
1035
|
+
}, []), Me = S(
|
|
1038
1036
|
(t) => {
|
|
1039
1037
|
t.preventDefault(), t.stopPropagation();
|
|
1040
|
-
const a =
|
|
1041
|
-
if (!(
|
|
1038
|
+
const a = Rt(i);
|
|
1039
|
+
if (!(ht(i) && i !== a) && !(typeof d == "number" || typeof N == "number"))
|
|
1042
1040
|
return;
|
|
1043
1041
|
m.update(
|
|
1044
1042
|
() => {
|
|
1045
|
-
const z =
|
|
1046
|
-
if (!
|
|
1043
|
+
const z = ct(e);
|
|
1044
|
+
if (!et(z))
|
|
1047
1045
|
return;
|
|
1048
1046
|
z.setSrc(a), z.setWidthAndHeight("inherit", "inherit");
|
|
1049
|
-
const
|
|
1050
|
-
|
|
1047
|
+
const T = dt();
|
|
1048
|
+
T && xt(T.clone());
|
|
1051
1049
|
},
|
|
1052
1050
|
{ tag: "image-reset" }
|
|
1053
1051
|
);
|
|
@@ -1057,68 +1055,68 @@ function co({
|
|
|
1057
1055
|
}), M.success("Image reset to original size and crop");
|
|
1058
1056
|
},
|
|
1059
1057
|
[m, e, i, d, N]
|
|
1060
|
-
),
|
|
1058
|
+
), Ae = S(
|
|
1061
1059
|
async (t) => {
|
|
1062
1060
|
let a = i;
|
|
1063
|
-
if (
|
|
1064
|
-
a =
|
|
1061
|
+
if (ht(i))
|
|
1062
|
+
a = Rt(i);
|
|
1065
1063
|
else {
|
|
1066
|
-
if (!
|
|
1064
|
+
if (!Nt) {
|
|
1067
1065
|
M.error("API key is required to upload and crop external images.");
|
|
1068
1066
|
return;
|
|
1069
1067
|
}
|
|
1070
1068
|
const u = M.loading("Uploading image…");
|
|
1071
1069
|
try {
|
|
1072
|
-
a = (await
|
|
1073
|
-
|
|
1070
|
+
a = (await nr.post(
|
|
1071
|
+
sr.project.fileUploadFromUrl,
|
|
1074
1072
|
{ url: i, prefix: "uploads" },
|
|
1075
|
-
{ headers: { "x-api-key":
|
|
1073
|
+
{ headers: { "x-api-key": Nt } }
|
|
1076
1074
|
)).data.fileUrl, M.dismiss(u);
|
|
1077
1075
|
} catch {
|
|
1078
1076
|
M.dismiss(u), M.error("Failed to upload image. Try again.");
|
|
1079
1077
|
return;
|
|
1080
1078
|
}
|
|
1081
1079
|
}
|
|
1082
|
-
const l =
|
|
1080
|
+
const l = Pr(a, t);
|
|
1083
1081
|
if (l === a) {
|
|
1084
1082
|
M.error("Cropping is only supported for images hosted on the CDN.");
|
|
1085
1083
|
return;
|
|
1086
1084
|
}
|
|
1087
|
-
|
|
1088
|
-
const u =
|
|
1089
|
-
if (!
|
|
1085
|
+
Mt(!0), m.update(() => {
|
|
1086
|
+
const u = ct(e);
|
|
1087
|
+
if (!et(u))
|
|
1090
1088
|
return;
|
|
1091
1089
|
u.setSrc(l), u.setWidthAndHeight(t.width, t.height);
|
|
1092
|
-
const f =
|
|
1093
|
-
f &&
|
|
1090
|
+
const f = dt();
|
|
1091
|
+
f && xt(f.clone());
|
|
1094
1092
|
}), M.success("Image cropped");
|
|
1095
1093
|
},
|
|
1096
|
-
[m, e, i,
|
|
1097
|
-
),
|
|
1098
|
-
C && !n && (
|
|
1094
|
+
[m, e, i, Nt]
|
|
1095
|
+
), De = S(() => {
|
|
1096
|
+
C && !n && (O.current = setTimeout(() => {
|
|
1099
1097
|
A(!0);
|
|
1100
1098
|
}, 300));
|
|
1101
|
-
}, [C, n]),
|
|
1102
|
-
|
|
1103
|
-
}, []),
|
|
1099
|
+
}, [C, n]), Le = S(() => {
|
|
1100
|
+
O.current && (clearTimeout(O.current), O.current = null), A(!1);
|
|
1101
|
+
}, []), Ft = S((t) => {
|
|
1104
1102
|
t.preventDefault(), t.stopPropagation(), C && window.open(C, "_blank", "noopener,noreferrer");
|
|
1105
1103
|
}, [C]);
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
}, []),
|
|
1109
|
-
n ||
|
|
1104
|
+
rt(() => () => {
|
|
1105
|
+
O.current && clearTimeout(O.current);
|
|
1106
|
+
}, []), rt(() => {
|
|
1107
|
+
n || gt(!1);
|
|
1110
1108
|
}, [n]);
|
|
1111
|
-
const
|
|
1109
|
+
const Xt = async () => {
|
|
1112
1110
|
if (!b.trim() || x)
|
|
1113
1111
|
return;
|
|
1114
|
-
|
|
1112
|
+
F(!0);
|
|
1115
1113
|
const t = M.loading("Refining image...", {
|
|
1116
1114
|
description: "This may take 10-30 seconds. Please wait."
|
|
1117
1115
|
});
|
|
1118
1116
|
try {
|
|
1119
1117
|
let a = b.trim();
|
|
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 = (
|
|
1121
|
-
const
|
|
1118
|
+
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 = (U) => {
|
|
1119
|
+
const Wt = U.toLowerCase();
|
|
1122
1120
|
return [
|
|
1123
1121
|
"article",
|
|
1124
1122
|
"write",
|
|
@@ -1135,28 +1133,66 @@ function co({
|
|
|
1135
1133
|
"add some images",
|
|
1136
1134
|
"include images",
|
|
1137
1135
|
"include pictures"
|
|
1138
|
-
].some((
|
|
1136
|
+
].some((kt) => Wt.includes(kt));
|
|
1139
1137
|
};
|
|
1140
1138
|
let z = "";
|
|
1141
1139
|
if (E && E.trim()) {
|
|
1142
|
-
const
|
|
1143
|
-
f(
|
|
1140
|
+
const U = E.trim();
|
|
1141
|
+
f(U) && o && o !== "Generated image" && o.trim() ? z = o.trim() : z = U;
|
|
1144
1142
|
} else
|
|
1145
1143
|
o && o !== "Generated image" && o.trim() && (z = o.trim());
|
|
1146
1144
|
z ? a = `${z} with ${u}` : a = u;
|
|
1147
|
-
const
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1145
|
+
const T = await fetch(`${wr}/agent/stream`, {
|
|
1146
|
+
method: "POST",
|
|
1147
|
+
headers: { "Content-Type": "application/json" },
|
|
1148
|
+
body: JSON.stringify({
|
|
1149
|
+
type: "general",
|
|
1150
|
+
query: `Generate Image: ${a}`,
|
|
1151
|
+
model: "openai",
|
|
1152
|
+
api_key: Nt || ""
|
|
1153
|
+
})
|
|
1154
|
+
});
|
|
1155
|
+
if (!T.ok)
|
|
1156
|
+
throw new Error(`Image service error: ${T.status}`);
|
|
1157
|
+
const H = T.body?.getReader(), Tt = new TextDecoder();
|
|
1158
|
+
if (!H)
|
|
1159
|
+
throw new Error("Stream reader not available");
|
|
1160
|
+
let nt = null;
|
|
1161
|
+
t:
|
|
1162
|
+
for (; ; ) {
|
|
1163
|
+
const { done: U, value: Wt } = await H.read();
|
|
1164
|
+
if (U)
|
|
1165
|
+
break;
|
|
1166
|
+
const Ut = Tt.decode(Wt, { stream: !0 }).split(`
|
|
1167
|
+
`);
|
|
1168
|
+
for (const kt of Ut) {
|
|
1169
|
+
if (!kt.startsWith("data: "))
|
|
1170
|
+
continue;
|
|
1171
|
+
const jt = kt.slice(6).trim();
|
|
1172
|
+
if (!(!jt || jt === "[DONE]"))
|
|
1173
|
+
try {
|
|
1174
|
+
const q = JSON.parse(jt);
|
|
1175
|
+
if (q.type === "image_ready") {
|
|
1176
|
+
nt = q.url, H.cancel();
|
|
1177
|
+
break t;
|
|
1178
|
+
} else {
|
|
1179
|
+
if (q.type === "image_failed")
|
|
1180
|
+
throw H.cancel(), new Error(q.error || "Image generation failed");
|
|
1181
|
+
if (q.type === "error")
|
|
1182
|
+
throw H.cancel(), new Error(q.message || "Image generation failed");
|
|
1183
|
+
}
|
|
1184
|
+
} catch (q) {
|
|
1185
|
+
if (q instanceof SyntaxError)
|
|
1186
|
+
continue;
|
|
1187
|
+
throw q;
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
if (!nt)
|
|
1192
|
+
throw new Error("Failed to generate image - no image received");
|
|
1157
1193
|
M.dismiss(t), M.success("Image refined successfully!", {
|
|
1158
1194
|
description: "Compare the images and choose which to keep."
|
|
1159
|
-
}),
|
|
1195
|
+
}), K(nt), _(a), mt(!0), g(""), p(!1);
|
|
1160
1196
|
} catch (a) {
|
|
1161
1197
|
if (M.dismiss(t), a instanceof vr) {
|
|
1162
1198
|
const l = a.code === "API_KEYS_DISABLED" ? "API Keys Disabled" : "API Key Required";
|
|
@@ -1165,29 +1201,29 @@ function co({
|
|
|
1165
1201
|
duration: 8e3
|
|
1166
1202
|
});
|
|
1167
1203
|
} else
|
|
1168
|
-
a instanceof
|
|
1204
|
+
a instanceof Cr ? M.error("Credits Issue", {
|
|
1169
1205
|
description: a.message,
|
|
1170
1206
|
duration: 8e3
|
|
1171
1207
|
}) : M.error("Failed to refine image", {
|
|
1172
1208
|
description: a instanceof Error ? a.message : "Unknown error. Please try again."
|
|
1173
1209
|
});
|
|
1174
1210
|
} finally {
|
|
1175
|
-
|
|
1211
|
+
F(!1);
|
|
1176
1212
|
}
|
|
1177
|
-
},
|
|
1213
|
+
}, $e = () => {
|
|
1178
1214
|
m.update(() => {
|
|
1179
|
-
const t =
|
|
1180
|
-
if (
|
|
1181
|
-
t.setSrc(
|
|
1182
|
-
const a =
|
|
1183
|
-
a &&
|
|
1215
|
+
const t = ct(e);
|
|
1216
|
+
if (et(t)) {
|
|
1217
|
+
t.setSrc(Q), t.setOriginalPrompt(at);
|
|
1218
|
+
const a = dt();
|
|
1219
|
+
a && xt(a.clone());
|
|
1184
1220
|
}
|
|
1185
|
-
}),
|
|
1221
|
+
}), mt(!1), K(""), _(""), M.success("Image replaced successfully!", {
|
|
1186
1222
|
description: "The image has been updated with the refined version."
|
|
1187
1223
|
});
|
|
1188
|
-
},
|
|
1189
|
-
|
|
1190
|
-
},
|
|
1224
|
+
}, Te = () => {
|
|
1225
|
+
mt(!1), K(""), _("");
|
|
1226
|
+
}, We = n && st(j) && !$, Bt = (n || $) && St, je = () => c === "left" || c === "right" ? {
|
|
1191
1227
|
position: "relative",
|
|
1192
1228
|
display: "block",
|
|
1193
1229
|
width: "100%"
|
|
@@ -1215,7 +1251,7 @@ function co({
|
|
|
1215
1251
|
} : {
|
|
1216
1252
|
position: "relative",
|
|
1217
1253
|
display: "inline-block"
|
|
1218
|
-
},
|
|
1254
|
+
}, Ye = S(
|
|
1219
1255
|
(t) => {
|
|
1220
1256
|
if ($ || t.target.closest("button"))
|
|
1221
1257
|
return;
|
|
@@ -1229,17 +1265,17 @@ function co({
|
|
|
1229
1265
|
},
|
|
1230
1266
|
[$, n, W, R]
|
|
1231
1267
|
);
|
|
1232
|
-
return /* @__PURE__ */ r(
|
|
1268
|
+
return /* @__PURE__ */ r(rr, { fallback: null, children: /* @__PURE__ */ h(Kt, { children: [
|
|
1233
1269
|
/* @__PURE__ */ h(
|
|
1234
1270
|
"div",
|
|
1235
1271
|
{
|
|
1236
|
-
draggable:
|
|
1237
|
-
style:
|
|
1238
|
-
onClick:
|
|
1239
|
-
onMouseEnter:
|
|
1240
|
-
onMouseLeave:
|
|
1272
|
+
draggable: We,
|
|
1273
|
+
style: je(),
|
|
1274
|
+
onClick: Ye,
|
|
1275
|
+
onMouseEnter: De,
|
|
1276
|
+
onMouseLeave: Le,
|
|
1241
1277
|
children: [
|
|
1242
|
-
|
|
1278
|
+
zt ? /* @__PURE__ */ h(
|
|
1243
1279
|
"div",
|
|
1244
1280
|
{
|
|
1245
1281
|
className: "cteditor-relative cteditor-inline-block cteditor-my-2 cteditor-select-none cteditor-rounded-lg cteditor-overflow-hidden",
|
|
@@ -1254,42 +1290,42 @@ function co({
|
|
|
1254
1290
|
alt: "",
|
|
1255
1291
|
className: "cteditor-absolute cteditor-opacity-0 cteditor-pointer-events-none cteditor-w-full cteditor-h-full cteditor-object-cover",
|
|
1256
1292
|
onLoad: () => {
|
|
1257
|
-
|
|
1293
|
+
Et.add(i), Mt(!1);
|
|
1258
1294
|
},
|
|
1259
|
-
onError: () =>
|
|
1295
|
+
onError: () => Mt(!1)
|
|
1260
1296
|
}
|
|
1261
1297
|
),
|
|
1262
1298
|
/* @__PURE__ */ h("div", { className: "cteditor-absolute cteditor-inset-0 cteditor-flex cteditor-flex-col cteditor-items-center cteditor-justify-center cteditor-rounded-lg cteditor-bg-muted", children: [
|
|
1263
|
-
/* @__PURE__ */ r(
|
|
1299
|
+
/* @__PURE__ */ r(dr, { className: "cteditor-w-10 cteditor-h-10 cteditor-text-muted-foreground cteditor-animate-spin cteditor-mb-2", "aria-hidden": !0 }),
|
|
1264
1300
|
/* @__PURE__ */ r("span", { className: "cteditor-text-sm cteditor-font-medium cteditor-text-muted-foreground", children: "Applying crop…" })
|
|
1265
1301
|
] })
|
|
1266
1302
|
]
|
|
1267
1303
|
}
|
|
1268
|
-
) :
|
|
1269
|
-
|
|
1304
|
+
) : J ? /* @__PURE__ */ r(_r, {}) : /* @__PURE__ */ r(
|
|
1305
|
+
Yr,
|
|
1270
1306
|
{
|
|
1271
|
-
className:
|
|
1307
|
+
className: Bt ? `focused ${st(j) ? "draggable" : ""}` : C ? "cteditor-cursor-pointer" : null,
|
|
1272
1308
|
src: i,
|
|
1273
1309
|
altText: o,
|
|
1274
1310
|
imageRef: y,
|
|
1275
1311
|
width: d,
|
|
1276
1312
|
height: N,
|
|
1277
|
-
maxWidth:
|
|
1278
|
-
onError: () =>
|
|
1313
|
+
maxWidth: w,
|
|
1314
|
+
onError: () => Pt(!0)
|
|
1279
1315
|
}
|
|
1280
1316
|
),
|
|
1281
|
-
|
|
1317
|
+
G && C && !n && /* @__PURE__ */ h(
|
|
1282
1318
|
"div",
|
|
1283
1319
|
{
|
|
1284
1320
|
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",
|
|
1285
1321
|
style: { zIndex: 10 },
|
|
1286
1322
|
children: [
|
|
1287
|
-
/* @__PURE__ */ r(
|
|
1323
|
+
/* @__PURE__ */ r(Nr, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-muted-foreground cteditor-flex-shrink-0" }),
|
|
1288
1324
|
/* @__PURE__ */ r("span", { className: "cteditor-text-sm cteditor-text-foreground cteditor-truncate cteditor-flex-1", children: C }),
|
|
1289
1325
|
/* @__PURE__ */ r(
|
|
1290
1326
|
"button",
|
|
1291
1327
|
{
|
|
1292
|
-
onClick:
|
|
1328
|
+
onClick: Ft,
|
|
1293
1329
|
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",
|
|
1294
1330
|
children: "Open"
|
|
1295
1331
|
}
|
|
@@ -1297,96 +1333,96 @@ function co({
|
|
|
1297
1333
|
]
|
|
1298
1334
|
}
|
|
1299
1335
|
),
|
|
1300
|
-
n &&
|
|
1336
|
+
n && st(j) && !J && !zt && /* @__PURE__ */ h(
|
|
1301
1337
|
"div",
|
|
1302
1338
|
{
|
|
1303
|
-
ref:
|
|
1339
|
+
ref: Ct,
|
|
1304
1340
|
className: "cteditor-absolute cteditor-flex cteditor-gap-1 z-10 cteditor-text-foreground",
|
|
1305
|
-
style:
|
|
1341
|
+
style: Ne ?? (At ? { left: "50%", transform: "translateX(-50%) translateY(100%) translateY(4px)", bottom: 0 } : { top: 8, right: 8 }),
|
|
1306
1342
|
children: [
|
|
1307
1343
|
/* @__PURE__ */ h("div", { className: "cteditor-flex cteditor-items-center cteditor-gap-0.5 cteditor-bg-accent cteditor-border cteditor-border-foreground/10 cteditor-rounded-md cteditor-shadow-md cteditor-p-0.5", children: [
|
|
1308
1344
|
/* @__PURE__ */ r(
|
|
1309
1345
|
"button",
|
|
1310
1346
|
{
|
|
1311
|
-
onClick: (t) =>
|
|
1347
|
+
onClick: (t) => ft(t, "left"),
|
|
1312
1348
|
className: ` cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-foreground/10 cteditor-transition-colors ${c === "left" ? "cteditor-bg-foreground/10" : ""}`,
|
|
1313
1349
|
"aria-label": "Wrap text left",
|
|
1314
1350
|
title: "Wrap text left",
|
|
1315
|
-
children: /* @__PURE__ */ r(
|
|
1351
|
+
children: /* @__PURE__ */ r(cr, {})
|
|
1316
1352
|
}
|
|
1317
1353
|
),
|
|
1318
1354
|
/* @__PURE__ */ r(
|
|
1319
1355
|
"button",
|
|
1320
1356
|
{
|
|
1321
|
-
onClick: (t) =>
|
|
1357
|
+
onClick: (t) => ft(t, "right"),
|
|
1322
1358
|
className: ` cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-foreground/10 cteditor-transition-colors ${c === "right" ? "cteditor-bg-foreground/10" : ""}`,
|
|
1323
1359
|
"aria-label": "Wrap text right",
|
|
1324
1360
|
title: "Wrap text right",
|
|
1325
|
-
children: /* @__PURE__ */ r(
|
|
1361
|
+
children: /* @__PURE__ */ r(lr, {})
|
|
1326
1362
|
}
|
|
1327
1363
|
),
|
|
1328
1364
|
/* @__PURE__ */ r("div", { className: "cteditor-w-px cteditor-h-5 cteditor-bg-foreground/10 cteditor-mx-0.5" }),
|
|
1329
1365
|
/* @__PURE__ */ r(
|
|
1330
1366
|
"button",
|
|
1331
1367
|
{
|
|
1332
|
-
onClick: (t) =>
|
|
1368
|
+
onClick: (t) => ft(t, "inline-left"),
|
|
1333
1369
|
className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-foreground/10 cteditor-transition-colors ${c === "inline-left" ? "cteditor-bg-foreground/10" : ""}`,
|
|
1334
1370
|
"aria-label": "Align left",
|
|
1335
1371
|
title: "Align left (no text wrap)",
|
|
1336
|
-
children: /* @__PURE__ */ r(
|
|
1372
|
+
children: /* @__PURE__ */ r(ur, {})
|
|
1337
1373
|
}
|
|
1338
1374
|
),
|
|
1339
1375
|
/* @__PURE__ */ r(
|
|
1340
1376
|
"button",
|
|
1341
1377
|
{
|
|
1342
|
-
onClick: (t) =>
|
|
1378
|
+
onClick: (t) => ft(t, "inline-center"),
|
|
1343
1379
|
className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-foreground/10 cteditor-transition-colors ${c === "inline-center" || c === "full" ? "cteditor-bg-foreground/10" : ""}`,
|
|
1344
1380
|
"aria-label": "Align center",
|
|
1345
1381
|
title: "Align center (no text wrap)",
|
|
1346
|
-
children: /* @__PURE__ */ r(
|
|
1382
|
+
children: /* @__PURE__ */ r(mr, {})
|
|
1347
1383
|
}
|
|
1348
1384
|
),
|
|
1349
1385
|
/* @__PURE__ */ r(
|
|
1350
1386
|
"button",
|
|
1351
1387
|
{
|
|
1352
|
-
onClick: (t) =>
|
|
1388
|
+
onClick: (t) => ft(t, "inline-right"),
|
|
1353
1389
|
className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-foreground/10 cteditor-transition-colors ${c === "inline-right" ? "cteditor-bg-foreground/10" : ""}`,
|
|
1354
1390
|
"aria-label": "Align right",
|
|
1355
1391
|
title: "Align right (no text wrap)",
|
|
1356
|
-
children: /* @__PURE__ */ r(
|
|
1392
|
+
children: /* @__PURE__ */ r(gr, {})
|
|
1357
1393
|
}
|
|
1358
1394
|
),
|
|
1359
1395
|
/* @__PURE__ */ r("div", { className: "cteditor-w-px cteditor-h-5 cteditor-bg-foreground/10 cteditor-mx-0.5" }),
|
|
1360
1396
|
/* @__PURE__ */ r(
|
|
1361
1397
|
"button",
|
|
1362
1398
|
{
|
|
1363
|
-
onClick: (t) =>
|
|
1399
|
+
onClick: (t) => ft(t, "none"),
|
|
1364
1400
|
className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-foreground/10 cteditor-transition-colors ${c === "none" ? "cteditor-bg-foreground/10" : ""}`,
|
|
1365
1401
|
"aria-label": "Inline",
|
|
1366
1402
|
title: "Inline with text",
|
|
1367
|
-
children: /* @__PURE__ */ r(
|
|
1403
|
+
children: /* @__PURE__ */ r(fr, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-foreground" })
|
|
1368
1404
|
}
|
|
1369
1405
|
),
|
|
1370
1406
|
/* @__PURE__ */ r("div", { className: "cteditor-w-px cteditor-h-5 cteditor-bg-foreground/10 cteditor-mx-0.5" }),
|
|
1371
|
-
!i.startsWith("data:") && !i.toLowerCase().endsWith(".svg") && /* @__PURE__ */ h(
|
|
1407
|
+
!i.startsWith("data:") && !i.toLowerCase().endsWith(".svg") && /* @__PURE__ */ h(Kt, { children: [
|
|
1372
1408
|
/* @__PURE__ */ r(
|
|
1373
1409
|
"button",
|
|
1374
1410
|
{
|
|
1375
|
-
onClick:
|
|
1411
|
+
onClick: ze,
|
|
1376
1412
|
className: "cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-foreground/10 cteditor-transition-colors",
|
|
1377
1413
|
"aria-label": "Crop image",
|
|
1378
1414
|
title: "Crop image",
|
|
1379
|
-
children: /* @__PURE__ */ r(
|
|
1415
|
+
children: /* @__PURE__ */ r(ve, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-foreground" })
|
|
1380
1416
|
}
|
|
1381
1417
|
),
|
|
1382
|
-
(
|
|
1418
|
+
(Rt(i) !== i || typeof d == "number" || typeof N == "number") && /* @__PURE__ */ r(
|
|
1383
1419
|
"button",
|
|
1384
1420
|
{
|
|
1385
|
-
onClick:
|
|
1421
|
+
onClick: Me,
|
|
1386
1422
|
className: "cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-foreground/10 cteditor-transition-colors",
|
|
1387
1423
|
"aria-label": "Reset image to original size and crop",
|
|
1388
1424
|
title: "Reset to original size and crop",
|
|
1389
|
-
children: /* @__PURE__ */ r(
|
|
1425
|
+
children: /* @__PURE__ */ r(kr, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-foreground" })
|
|
1390
1426
|
}
|
|
1391
1427
|
)
|
|
1392
1428
|
] })
|
|
@@ -1394,53 +1430,53 @@ function co({
|
|
|
1394
1430
|
C && /* @__PURE__ */ r(
|
|
1395
1431
|
"button",
|
|
1396
1432
|
{
|
|
1397
|
-
onClick:
|
|
1433
|
+
onClick: Ft,
|
|
1398
1434
|
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",
|
|
1399
1435
|
"aria-label": "Visit link",
|
|
1400
1436
|
title: `Visit: ${C}`,
|
|
1401
|
-
children: /* @__PURE__ */ r(
|
|
1437
|
+
children: /* @__PURE__ */ r(hr, {})
|
|
1402
1438
|
}
|
|
1403
1439
|
),
|
|
1404
1440
|
E && /* @__PURE__ */ r(
|
|
1405
1441
|
"button",
|
|
1406
1442
|
{
|
|
1407
1443
|
onClick: (t) => {
|
|
1408
|
-
t.stopPropagation(),
|
|
1444
|
+
t.stopPropagation(), Se(t);
|
|
1409
1445
|
},
|
|
1410
1446
|
className: " cteditor-size-8 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded-md cteditor-bg-accent hover:cteditor-bg-accent/90 cteditor-transition-colors cteditor-shadow-md cteditor-border cteditor-border-foreground/20",
|
|
1411
1447
|
"aria-label": "Refine image",
|
|
1412
1448
|
title: "Refine image",
|
|
1413
|
-
children: /* @__PURE__ */ r(
|
|
1449
|
+
children: /* @__PURE__ */ r(pr, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-foreground" })
|
|
1414
1450
|
}
|
|
1415
1451
|
),
|
|
1416
1452
|
/* @__PURE__ */ r(
|
|
1417
1453
|
"button",
|
|
1418
1454
|
{
|
|
1419
1455
|
onClick: (t) => {
|
|
1420
|
-
t.stopPropagation(),
|
|
1456
|
+
t.stopPropagation(), Ie(t);
|
|
1421
1457
|
},
|
|
1422
1458
|
className: " cteditor-size-8 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded-md cteditor-bg-accent hover:cteditor-bg-accent/90 cteditor-transition-colors cteditor-shadow-md cteditor-border cteditor-border-foreground/20",
|
|
1423
1459
|
"aria-label": "Open image in new tab",
|
|
1424
1460
|
title: "Open in new tab",
|
|
1425
|
-
children: /* @__PURE__ */ r(
|
|
1461
|
+
children: /* @__PURE__ */ r(br, {})
|
|
1426
1462
|
}
|
|
1427
1463
|
),
|
|
1428
1464
|
/* @__PURE__ */ r(
|
|
1429
1465
|
"button",
|
|
1430
1466
|
{
|
|
1431
1467
|
onClick: (t) => {
|
|
1432
|
-
t.stopPropagation(),
|
|
1468
|
+
t.stopPropagation(), Pe(t);
|
|
1433
1469
|
},
|
|
1434
1470
|
className: " cteditor-size-8 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded-md cteditor-bg-accent hover:cteditor-bg-destructive hover:cteditor-text-destructive-foreground cteditor-transition-colors cteditor-shadow-md cteditor-border cteditor-border-foreground/20",
|
|
1435
1471
|
"aria-label": "Delete image",
|
|
1436
1472
|
title: "Delete image",
|
|
1437
|
-
children: /* @__PURE__ */ r(
|
|
1473
|
+
children: /* @__PURE__ */ r(yr, {})
|
|
1438
1474
|
}
|
|
1439
1475
|
)
|
|
1440
1476
|
]
|
|
1441
1477
|
}
|
|
1442
1478
|
),
|
|
1443
|
-
s && n && !
|
|
1479
|
+
s && n && !J && E && /* @__PURE__ */ r(
|
|
1444
1480
|
"div",
|
|
1445
1481
|
{
|
|
1446
1482
|
className: "cteditor-absolute cteditor-bottom-2 cteditor-left-2 cteditor-right-2 cteditor-bg-background/85 cteditor-rounded-lg cteditor-shadow-xl cteditor-border cteditor-border-foreground/20 cteditor-p-3 cteditor-backdrop-blur-lg md:cteditor-min-w-80",
|
|
@@ -1457,7 +1493,7 @@ function co({
|
|
|
1457
1493
|
value: b,
|
|
1458
1494
|
onChange: (t) => g(t.target.value),
|
|
1459
1495
|
onKeyDown: (t) => {
|
|
1460
|
-
t.stopPropagation(), t.key === "Enter" && b.trim() && !x &&
|
|
1496
|
+
t.stopPropagation(), t.key === "Enter" && b.trim() && !x && Xt(), t.key === "Escape" && (p(!1), g(""));
|
|
1461
1497
|
},
|
|
1462
1498
|
onKeyUp: (t) => {
|
|
1463
1499
|
t.stopPropagation();
|
|
@@ -1476,7 +1512,7 @@ function co({
|
|
|
1476
1512
|
"button",
|
|
1477
1513
|
{
|
|
1478
1514
|
onClick: (t) => {
|
|
1479
|
-
t.stopPropagation(),
|
|
1515
|
+
t.stopPropagation(), Xt();
|
|
1480
1516
|
},
|
|
1481
1517
|
disabled: x || !b.trim(),
|
|
1482
1518
|
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",
|
|
@@ -1494,31 +1530,31 @@ function co({
|
|
|
1494
1530
|
},
|
|
1495
1531
|
disabled: x,
|
|
1496
1532
|
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",
|
|
1497
|
-
children: /* @__PURE__ */ r(
|
|
1533
|
+
children: /* @__PURE__ */ r(xr, { size: 16 })
|
|
1498
1534
|
}
|
|
1499
1535
|
)
|
|
1500
1536
|
] })
|
|
1501
1537
|
] })
|
|
1502
1538
|
}
|
|
1503
1539
|
),
|
|
1504
|
-
L &&
|
|
1505
|
-
|
|
1540
|
+
L && st(j) && Bt && !zt && /* @__PURE__ */ r(
|
|
1541
|
+
_e,
|
|
1506
1542
|
{
|
|
1507
1543
|
showCaption: P,
|
|
1508
|
-
setShowCaption:
|
|
1544
|
+
setShowCaption: ke,
|
|
1509
1545
|
editor: m,
|
|
1510
1546
|
buttonRef: D,
|
|
1511
1547
|
imageRef: y,
|
|
1512
|
-
maxWidth:
|
|
1513
|
-
onResizeStart:
|
|
1514
|
-
onResizeEnd:
|
|
1515
|
-
captionsEnabled: !
|
|
1548
|
+
maxWidth: w,
|
|
1549
|
+
onResizeStart: Ee,
|
|
1550
|
+
onResizeEnd: Re,
|
|
1551
|
+
captionsEnabled: !J && v
|
|
1516
1552
|
}
|
|
1517
1553
|
)
|
|
1518
1554
|
]
|
|
1519
1555
|
}
|
|
1520
1556
|
),
|
|
1521
|
-
P && (o.startsWith("Signature by") ? /* @__PURE__ */ r(
|
|
1557
|
+
P && (o.startsWith("Signature by") ? /* @__PURE__ */ r(Er, { caption: k }) : /* @__PURE__ */ r(
|
|
1522
1558
|
"div",
|
|
1523
1559
|
{
|
|
1524
1560
|
className: "image-caption-container",
|
|
@@ -1529,42 +1565,42 @@ function co({
|
|
|
1529
1565
|
...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" } : {}
|
|
1530
1566
|
},
|
|
1531
1567
|
children: /* @__PURE__ */ h(
|
|
1532
|
-
|
|
1568
|
+
ne,
|
|
1533
1569
|
{
|
|
1534
1570
|
initialEditor: k,
|
|
1535
1571
|
initialNodes: [
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1572
|
+
ce,
|
|
1573
|
+
le,
|
|
1574
|
+
ue,
|
|
1575
|
+
me,
|
|
1576
|
+
re,
|
|
1577
|
+
ee
|
|
1542
1578
|
],
|
|
1543
1579
|
children: [
|
|
1544
|
-
/* @__PURE__ */ r(
|
|
1580
|
+
/* @__PURE__ */ r(Oe, {}),
|
|
1545
1581
|
/* @__PURE__ */ r(
|
|
1546
|
-
|
|
1582
|
+
de,
|
|
1547
1583
|
{
|
|
1548
1584
|
contentEditable: /* @__PURE__ */ r(
|
|
1549
|
-
|
|
1585
|
+
oe,
|
|
1550
1586
|
{
|
|
1551
1587
|
"aria-placeholder": "Enter a caption...",
|
|
1552
1588
|
placeholder: () => /* @__PURE__ */ r("span", { className: "cteditor-text-xs cteditor-absolute cteditor-left-2 cteditor-top-[7px]", children: "Enter a caption..." }),
|
|
1553
1589
|
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"
|
|
1554
1590
|
}
|
|
1555
1591
|
),
|
|
1556
|
-
ErrorBoundary:
|
|
1592
|
+
ErrorBoundary: ie
|
|
1557
1593
|
}
|
|
1558
1594
|
),
|
|
1559
1595
|
/* @__PURE__ */ r(
|
|
1560
|
-
|
|
1596
|
+
se,
|
|
1561
1597
|
{
|
|
1562
1598
|
onChange: () => {
|
|
1563
1599
|
}
|
|
1564
1600
|
}
|
|
1565
1601
|
),
|
|
1566
|
-
/* @__PURE__ */ r(
|
|
1567
|
-
/* @__PURE__ */ r(
|
|
1602
|
+
/* @__PURE__ */ r(ae, {}),
|
|
1603
|
+
/* @__PURE__ */ r(xe, { namespace: we.namespace })
|
|
1568
1604
|
]
|
|
1569
1605
|
}
|
|
1570
1606
|
)
|
|
@@ -1573,29 +1609,29 @@ function co({
|
|
|
1573
1609
|
/* @__PURE__ */ r(
|
|
1574
1610
|
Wr,
|
|
1575
1611
|
{
|
|
1576
|
-
open:
|
|
1577
|
-
onOpenChange:
|
|
1612
|
+
open: B,
|
|
1613
|
+
onOpenChange: gt,
|
|
1578
1614
|
src: i,
|
|
1579
1615
|
altText: o,
|
|
1580
1616
|
width: d,
|
|
1581
1617
|
height: N,
|
|
1582
|
-
onCropApply:
|
|
1618
|
+
onCropApply: Ae
|
|
1583
1619
|
}
|
|
1584
1620
|
),
|
|
1585
1621
|
/* @__PURE__ */ r(
|
|
1586
|
-
|
|
1622
|
+
Rr,
|
|
1587
1623
|
{
|
|
1588
|
-
open:
|
|
1589
|
-
onOpenChange:
|
|
1624
|
+
open: ut,
|
|
1625
|
+
onOpenChange: mt,
|
|
1590
1626
|
oldImageUrl: i,
|
|
1591
|
-
newImageUrl:
|
|
1592
|
-
onReplace:
|
|
1593
|
-
onCancel:
|
|
1627
|
+
newImageUrl: Q,
|
|
1628
|
+
onReplace: $e,
|
|
1629
|
+
onCancel: Te
|
|
1594
1630
|
}
|
|
1595
1631
|
)
|
|
1596
1632
|
] }) });
|
|
1597
1633
|
}
|
|
1598
1634
|
export {
|
|
1599
|
-
|
|
1635
|
+
te as RIGHT_CLICK_IMAGE_COMMAND,
|
|
1600
1636
|
co as default
|
|
1601
1637
|
};
|