eddyter 1.4.3 → 1.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/style.css +1 -1
- package/dist/components/ConfigurableEditorWithAuth.d.ts +8 -0
- package/dist/components/EditorErrorBoundary.d.ts +19 -0
- package/dist/components/ScopedEditor.d.ts +1 -0
- package/dist/context/VoiceRecordingContext.d.ts +1 -0
- package/dist/{generateDocxThumbnail-kvUzj-72.js → generateDocxThumbnail-CNLulV6U.js} +1 -1
- package/dist/{generatePdfThumbnail-n9mJQXLd.js → generatePdfThumbnail-BFSOSFAX.js} +1 -1
- package/dist/{generateXlsxThumbnail-Dmj571Qe.js → generateXlsxThumbnail-CfJuOgEl.js} +1 -1
- package/dist/hooks/useVoiceRecording.d.ts +1 -0
- package/dist/{html2pdf.bundle.min-DO9nUvFt.js → html2pdf.bundle.min-wRsYlGzo.js} +1 -1
- package/dist/{index-qeSJbu9B.js → index-BJ5KLQGQ.js} +1 -1
- package/dist/{index-BFVJDNlm.js → index-Ct824Y4n.js} +4 -4
- package/dist/{index-Bvb6NDBM.js → index-DMZDKMjN.js} +23733 -22334
- package/dist/{index-DdnH-eml.js → index-Dsv2sdJQ.js} +531 -485
- package/dist/index.js +1 -1
- package/dist/pages/ConfigurableEditor/ConfigurableEditor.d.ts +2 -0
- package/dist/plugins/CombinedAutocompletGrammarPlugin.d.ts +6 -0
- package/dist/plugins/CustomHorizontalRulePlugin/CustomHorizontalRuleNode.d.ts +8 -2
- package/dist/utils/errorReporter.d.ts +19 -0
- package/package.json +4 -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-Bt7kgv0a.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-DMZDKMjN.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
|
-
onReplace:
|
|
45
|
-
onCancel:
|
|
46
|
-
}) => /* @__PURE__ */ r(
|
|
47
|
-
/* @__PURE__ */ h(
|
|
48
|
-
/* @__PURE__ */ h(
|
|
44
|
+
onReplace: N,
|
|
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,19 +71,19 @@ 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
|
-
onClick:
|
|
86
|
+
onClick: N,
|
|
87
87
|
className: "bg-blue-500 hover:bg-blue-600 text-white",
|
|
88
88
|
children: [
|
|
89
89
|
/* @__PURE__ */ r("span", { className: "mr-2", children: "✓" }),
|
|
@@ -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, ...
|
|
212
|
-
return this.dismissedToasts.has(
|
|
213
|
-
...
|
|
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
|
+
...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
|
|
@@ -268,78 +268,78 @@ class Sr {
|
|
|
268
268
|
message: e.loading,
|
|
269
269
|
description: typeof e.description != "function" ? e.description : void 0
|
|
270
270
|
}));
|
|
271
|
-
const
|
|
272
|
-
let
|
|
273
|
-
const P =
|
|
271
|
+
const N = Promise.resolve(o instanceof Function ? o() : o);
|
|
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({
|
|
289
289
|
id: d,
|
|
290
290
|
type: "error",
|
|
291
|
-
description:
|
|
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({
|
|
300
300
|
id: d,
|
|
301
301
|
type: "error",
|
|
302
|
-
description:
|
|
302
|
+
description: C,
|
|
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({
|
|
311
311
|
id: d,
|
|
312
312
|
type: "success",
|
|
313
|
-
description:
|
|
313
|
+
description: C,
|
|
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({
|
|
327
327
|
id: d,
|
|
328
328
|
type: "error",
|
|
329
329
|
description: c,
|
|
330
|
-
...
|
|
330
|
+
...y
|
|
331
331
|
});
|
|
332
332
|
}
|
|
333
333
|
}).finally(() => {
|
|
334
|
-
|
|
335
|
-
}),
|
|
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
|
-
unwrap:
|
|
337
|
+
unwrap: k
|
|
338
338
|
} : Object.assign(d, {
|
|
339
|
-
unwrap:
|
|
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%)}");
|
|
373
|
-
function
|
|
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
|
+
function Wr({
|
|
374
374
|
open: i,
|
|
375
375
|
onOpenChange: o,
|
|
376
376
|
src: e,
|
|
377
377
|
altText: d,
|
|
378
|
-
width:
|
|
379
|
-
height:
|
|
378
|
+
width: N,
|
|
379
|
+
height: w,
|
|
380
380
|
onCropApply: L
|
|
381
381
|
}) {
|
|
382
|
-
const [P,
|
|
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 Tr({
|
|
|
396
396
|
default:
|
|
397
397
|
return null;
|
|
398
398
|
}
|
|
399
|
-
}, [
|
|
399
|
+
}, [lt, P]), m = 24, j = S(
|
|
400
400
|
(s) => {
|
|
401
|
-
let { x: p, y: b, width: g, height:
|
|
402
|
-
const
|
|
403
|
-
return p = Math.max(0, Math.min(p,
|
|
401
|
+
let { x: p, y: b, width: g, height: x } = s;
|
|
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;
|
|
@@ -417,33 +417,33 @@ function Tr({
|
|
|
417
417
|
return;
|
|
418
418
|
}
|
|
419
419
|
const p = n.width * 0.9, b = n.height * 0.9;
|
|
420
|
-
let g = p,
|
|
421
|
-
|
|
420
|
+
let g = p, x = g / s;
|
|
421
|
+
x > b && (x = b, g = x * s), $(
|
|
422
422
|
j({
|
|
423
423
|
x: (n.width - g) / 2,
|
|
424
|
-
y: (n.height -
|
|
424
|
+
y: (n.height - x) / 2,
|
|
425
425
|
width: g,
|
|
426
|
-
height:
|
|
426
|
+
height: x
|
|
427
427
|
})
|
|
428
428
|
);
|
|
429
429
|
},
|
|
430
430
|
[n.height, n.width, j]
|
|
431
|
-
),
|
|
432
|
-
const s =
|
|
431
|
+
), it = S(() => {
|
|
432
|
+
const s = y.current, p = D.current;
|
|
433
433
|
if (!s || !p)
|
|
434
434
|
return;
|
|
435
|
-
let b = 0, g = 0,
|
|
436
|
-
for (;
|
|
437
|
-
b +=
|
|
438
|
-
|
|
435
|
+
let b = 0, g = 0, x = p;
|
|
436
|
+
for (; x && x !== s; )
|
|
437
|
+
b += x.offsetLeft, g += x.offsetTop, x = x.offsetParent;
|
|
438
|
+
W({
|
|
439
439
|
x: b,
|
|
440
440
|
y: g,
|
|
441
441
|
width: p.offsetWidth,
|
|
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 Tr({
|
|
|
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 Tr({
|
|
|
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 Tr({
|
|
|
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 && (
|
|
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
|
-
const s =
|
|
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
|
|
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
514
|
j({
|
|
515
|
-
x: Math.max(0, Math.min(
|
|
516
|
-
y: Math.max(0, Math.min(
|
|
517
|
-
width:
|
|
518
|
-
height:
|
|
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 Tr({
|
|
|
533
533
|
i,
|
|
534
534
|
n.width,
|
|
535
535
|
n.height,
|
|
536
|
-
|
|
536
|
+
pt,
|
|
537
537
|
j
|
|
538
|
-
]),
|
|
539
|
-
i &&
|
|
540
|
-
}, [i,
|
|
541
|
-
|
|
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(),
|
|
@@ -547,22 +547,22 @@ function Tr({
|
|
|
547
547
|
/* @__PURE__ */ r("div", { className: "cteditor-bg-muted/20 cteditor-p-4 md:cteditor-p-6", children: /* @__PURE__ */ h(
|
|
548
548
|
"div",
|
|
549
549
|
{
|
|
550
|
-
ref:
|
|
550
|
+
ref: y,
|
|
551
551
|
className: "cteditor-relative cteditor-min-h-[340px] cteditor-rounded-lg cteditor-bg-black/70 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-select-none cteditor-touch-none",
|
|
552
552
|
children: [
|
|
553
553
|
/* @__PURE__ */ r("div", { className: "cteditor-overflow-hidden cteditor-rounded-lg cteditor-flex cteditor-items-center cteditor-justify-center cteditor-w-full", children: c ? /* @__PURE__ */ r("div", { className: "cteditor-text-sm cteditor-text-muted-foreground", children: "Failed to load image preview" }) : /* @__PURE__ */ r(
|
|
554
554
|
"img",
|
|
555
555
|
{
|
|
556
556
|
ref: D,
|
|
557
|
-
src:
|
|
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
|
-
|
|
562
|
+
C(!1), it();
|
|
563
563
|
},
|
|
564
564
|
onError: () => {
|
|
565
|
-
|
|
565
|
+
C(!0);
|
|
566
566
|
}
|
|
567
567
|
}
|
|
568
568
|
) }),
|
|
@@ -595,7 +595,7 @@ function Tr({
|
|
|
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 Tr({
|
|
|
612
612
|
"div",
|
|
613
613
|
{
|
|
614
614
|
className: `cteditor-absolute cteditor-border-2 cteditor-border-white cteditor-bg-blue-500 cteditor-rounded-sm cteditor-pointer-events-auto cteditor-shadow ${p} ${b} ${g}`,
|
|
615
|
-
onPointerDown: (
|
|
615
|
+
onPointerDown: (x) => Pt(x, s),
|
|
616
616
|
"aria-label": `Resize ${s}`
|
|
617
617
|
},
|
|
618
618
|
s
|
|
@@ -624,21 +624,21 @@ function Tr({
|
|
|
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(
|
|
@@ -646,7 +646,7 @@ function Tr({
|
|
|
646
646
|
{
|
|
647
647
|
type: "button",
|
|
648
648
|
onClick: () => {
|
|
649
|
-
|
|
649
|
+
k(s.id);
|
|
650
650
|
},
|
|
651
651
|
className: `cteditor-h-20 cteditor-rounded-md cteditor-border cteditor-text-sm cteditor-transition-colors cteditor-flex cteditor-flex-col cteditor-items-center cteditor-justify-center cteditor-gap-1.5 ${b ? "cteditor-border-primary cteditor-bg-primary/10 cteditor-text-primary" : "cteditor-border-border hover:cteditor-bg-accent"}`,
|
|
652
652
|
children: [
|
|
@@ -674,13 +674,13 @@ function Tr({
|
|
|
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
|
-
|
|
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 Tr({
|
|
|
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 Tr({
|
|
|
710
710
|
}
|
|
711
711
|
) });
|
|
712
712
|
}
|
|
713
|
-
const
|
|
713
|
+
const Et = /* @__PURE__ */ new Set(), te = er("RIGHT_CLICK_IMAGE_COMMAND");
|
|
714
714
|
function jr(i) {
|
|
715
|
-
if (!
|
|
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
|
-
width:
|
|
731
|
-
height:
|
|
730
|
+
width: N,
|
|
731
|
+
height: w,
|
|
732
732
|
maxWidth: L,
|
|
733
733
|
onError: P,
|
|
734
|
-
onLoad:
|
|
734
|
+
onLoad: k
|
|
735
735
|
}) {
|
|
736
736
|
jr(d);
|
|
737
|
-
const
|
|
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
|
{
|
|
@@ -742,27 +742,35 @@ function Wr({
|
|
|
742
742
|
src: d,
|
|
743
743
|
alt: i,
|
|
744
744
|
ref: e,
|
|
745
|
-
style:
|
|
746
|
-
width:
|
|
745
|
+
style: c ? {
|
|
746
|
+
width: C,
|
|
747
747
|
// Use height: auto + aspect-ratio so the image scales
|
|
748
748
|
// proportionally when max-width constrains on small screens.
|
|
749
|
-
// The useLayoutEffect in ImageComponent widens the container
|
|
750
|
-
// to fit the explicit width on desktop.
|
|
751
749
|
height: "auto",
|
|
752
|
-
aspectRatio: `${
|
|
750
|
+
aspectRatio: `${C} / ${y}`,
|
|
751
|
+
maxWidth: "100%"
|
|
752
|
+
} : v ? {
|
|
753
|
+
// Only width known (e.g. bogus height stripped from source HTML):
|
|
754
|
+
// fix the width and let the browser compute height naturally.
|
|
755
|
+
width: C,
|
|
756
|
+
height: "auto",
|
|
757
|
+
maxWidth: "100%"
|
|
758
|
+
} : E ? {
|
|
759
|
+
// Only height known: fix height, let browser compute width.
|
|
760
|
+
width: "auto",
|
|
761
|
+
height: y,
|
|
753
762
|
maxWidth: "100%"
|
|
754
763
|
} : {
|
|
755
764
|
// No dimensions specified - use original image size.
|
|
756
|
-
// max-width from CSS rule prevents overflow.
|
|
757
765
|
height: "auto"
|
|
758
766
|
},
|
|
759
767
|
onError: P,
|
|
760
|
-
onLoad:
|
|
768
|
+
onLoad: k,
|
|
761
769
|
draggable: "false"
|
|
762
770
|
}
|
|
763
771
|
);
|
|
764
772
|
}
|
|
765
|
-
function
|
|
773
|
+
function _r() {
|
|
766
774
|
return /* @__PURE__ */ r(
|
|
767
775
|
"img",
|
|
768
776
|
{
|
|
@@ -781,171 +789,171 @@ function co({
|
|
|
781
789
|
altText: o,
|
|
782
790
|
nodeKey: e,
|
|
783
791
|
width: d,
|
|
784
|
-
height:
|
|
785
|
-
maxWidth:
|
|
792
|
+
height: N,
|
|
793
|
+
maxWidth: w,
|
|
786
794
|
resizable: L,
|
|
787
795
|
showCaption: P,
|
|
788
|
-
caption:
|
|
789
|
-
captionsEnabled:
|
|
796
|
+
caption: k,
|
|
797
|
+
captionsEnabled: v,
|
|
790
798
|
originalPrompt: E,
|
|
791
799
|
position: c = "none",
|
|
792
|
-
linkUrl:
|
|
800
|
+
linkUrl: C
|
|
793
801
|
}) {
|
|
794
|
-
const
|
|
795
|
-
|
|
796
|
-
if (!n || !
|
|
797
|
-
|
|
802
|
+
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;
|
|
803
|
+
qt(() => {
|
|
804
|
+
if (!n || !st(j) || J) {
|
|
805
|
+
yt(null);
|
|
798
806
|
return;
|
|
799
807
|
}
|
|
800
|
-
const t =
|
|
808
|
+
const t = Ct.current, a = m.getRootElement(), l = t?.parentElement;
|
|
801
809
|
if (!t || !a || !l) {
|
|
802
|
-
|
|
810
|
+
yt(null);
|
|
803
811
|
return;
|
|
804
812
|
}
|
|
805
|
-
const u = a.getBoundingClientRect(), f = l.getBoundingClientRect(), z = t.getBoundingClientRect(),
|
|
806
|
-
if (
|
|
807
|
-
|
|
813
|
+
const u = a.getBoundingClientRect(), f = l.getBoundingClientRect(), z = t.getBoundingClientRect(), T = 8, H = z.width;
|
|
814
|
+
if (H <= 0) {
|
|
815
|
+
yt(null);
|
|
808
816
|
return;
|
|
809
817
|
}
|
|
810
|
-
if (
|
|
811
|
-
const
|
|
812
|
-
|
|
813
|
-
left:
|
|
818
|
+
if (At) {
|
|
819
|
+
const nt = f.left + f.width / 2 - H / 2, U = Math.max(u.left + T, Math.min(nt, u.right - T - H));
|
|
820
|
+
yt({
|
|
821
|
+
left: U - f.left,
|
|
814
822
|
bottom: 0,
|
|
815
823
|
right: "auto",
|
|
816
824
|
transform: "translateY(100%) translateY(4px)"
|
|
817
825
|
});
|
|
818
826
|
} else {
|
|
819
|
-
const
|
|
820
|
-
|
|
821
|
-
left:
|
|
822
|
-
top:
|
|
827
|
+
const nt = f.right - T - H, U = Math.max(u.left + T, Math.min(nt, u.right - T - H));
|
|
828
|
+
yt({
|
|
829
|
+
left: U - f.left,
|
|
830
|
+
top: T,
|
|
823
831
|
right: "auto"
|
|
824
832
|
});
|
|
825
833
|
}
|
|
826
|
-
}, [n, j,
|
|
827
|
-
if (
|
|
834
|
+
}, [n, j, J, At, m, Z]), rt(() => {
|
|
835
|
+
if (y.current) {
|
|
828
836
|
const t = () => {
|
|
829
|
-
|
|
837
|
+
lt.current || y.current && X(y.current.offsetWidth);
|
|
830
838
|
};
|
|
831
839
|
t();
|
|
832
840
|
const a = new ResizeObserver(t);
|
|
833
|
-
return a.observe(
|
|
841
|
+
return a.observe(y.current), () => a.disconnect();
|
|
834
842
|
}
|
|
835
|
-
}, [d,
|
|
836
|
-
if ((c === "left" || c === "right") && typeof d == "number" &&
|
|
837
|
-
const t =
|
|
843
|
+
}, [d, N, n]), qt(() => {
|
|
844
|
+
if ((c === "left" || c === "right") && typeof d == "number" && y.current) {
|
|
845
|
+
const t = y.current.closest(".editor-image"), a = t?.parentElement, l = m.getRootElement(), u = l ? l.getBoundingClientRect().width : d + 32, f = `${Math.min(d + 32, u)}px`;
|
|
838
846
|
return t && (t.style.removeProperty("display"), t.style.setProperty("max-width", f, "important")), a && a.style.setProperty("max-width", f, "important"), () => {
|
|
839
847
|
t && (t.style.removeProperty("max-width"), t.style.removeProperty("display")), a && a.style.removeProperty("max-width");
|
|
840
848
|
};
|
|
841
849
|
}
|
|
842
850
|
}, [c, d, m]);
|
|
843
|
-
const
|
|
851
|
+
const Dt = S(
|
|
844
852
|
(t) => {
|
|
845
|
-
const a =
|
|
846
|
-
return n &&
|
|
853
|
+
const a = dt();
|
|
854
|
+
return n && st(a) && (t.preventDefault(), m.update(() => {
|
|
847
855
|
a.getNodes().forEach((u) => {
|
|
848
|
-
if (
|
|
856
|
+
if (et(u)) {
|
|
849
857
|
const f = u.getParent();
|
|
850
|
-
u.remove(), f &&
|
|
858
|
+
u.remove(), f && Yt(f) && f.getChildrenSize() === 0 && f.setFormat("left");
|
|
851
859
|
}
|
|
852
860
|
});
|
|
853
861
|
})), !1;
|
|
854
862
|
},
|
|
855
863
|
[m, n]
|
|
856
|
-
),
|
|
864
|
+
), Ot = S(
|
|
857
865
|
(t) => {
|
|
858
|
-
const a =
|
|
859
|
-
if (n &&
|
|
866
|
+
const a = dt(), l = D.current;
|
|
867
|
+
if (n && st(a) && a.getNodes().length === 1) {
|
|
860
868
|
if (P)
|
|
861
|
-
return
|
|
869
|
+
return xt(null), t.preventDefault(), k.focus(), !0;
|
|
862
870
|
if (l !== null && l !== document.activeElement)
|
|
863
871
|
return t.preventDefault(), l.focus(), !0;
|
|
864
872
|
}
|
|
865
873
|
return !1;
|
|
866
874
|
},
|
|
867
|
-
[
|
|
868
|
-
),
|
|
869
|
-
(t) =>
|
|
870
|
-
|
|
875
|
+
[k, n, P]
|
|
876
|
+
), Ht = S(
|
|
877
|
+
(t) => it.current === k || D.current === t.target ? (xt(null), m.update(() => {
|
|
878
|
+
W(!0);
|
|
871
879
|
const a = m.getRootElement();
|
|
872
880
|
a !== null && a.focus();
|
|
873
881
|
}), !0) : !1,
|
|
874
|
-
[
|
|
875
|
-
),
|
|
882
|
+
[k, m, W]
|
|
883
|
+
), Lt = S(
|
|
876
884
|
(t) => {
|
|
877
885
|
const a = t;
|
|
878
886
|
if ($)
|
|
879
887
|
return !0;
|
|
880
888
|
const l = a.target;
|
|
881
|
-
if (l.closest("button") &&
|
|
889
|
+
if (l.closest("button") && y.current && l.closest(".editor-image") === y.current.closest(".editor-image"))
|
|
882
890
|
return !0;
|
|
883
|
-
const u = l ===
|
|
891
|
+
const u = l === y.current;
|
|
884
892
|
let f = !1;
|
|
885
|
-
if (!u &&
|
|
886
|
-
const z =
|
|
893
|
+
if (!u && y.current) {
|
|
894
|
+
const z = y.current.getBoundingClientRect();
|
|
887
895
|
f = a.clientX >= z.left && a.clientX <= z.right && a.clientY >= z.top && a.clientY <= z.bottom;
|
|
888
896
|
}
|
|
889
|
-
return u || f ? (a.shiftKey ?
|
|
897
|
+
return u || f ? (a.shiftKey ? W(!n) : (R(), W(!0)), !0) : !1;
|
|
890
898
|
},
|
|
891
|
-
[$, n,
|
|
892
|
-
),
|
|
899
|
+
[$, n, W, R]
|
|
900
|
+
), $t = S(
|
|
893
901
|
(t) => {
|
|
894
902
|
m.getEditorState().read(() => {
|
|
895
|
-
const a =
|
|
896
|
-
t.target.tagName === "IMG" &&
|
|
897
|
-
|
|
903
|
+
const a = dt();
|
|
904
|
+
t.target.tagName === "IMG" && Ke(a) && a.getNodes().length === 1 && m.dispatchCommand(
|
|
905
|
+
te,
|
|
898
906
|
t
|
|
899
907
|
);
|
|
900
908
|
});
|
|
901
909
|
},
|
|
902
910
|
[m]
|
|
903
911
|
);
|
|
904
|
-
|
|
912
|
+
rt(() => {
|
|
905
913
|
let t = !0;
|
|
906
|
-
const a = m.getRootElement(), l =
|
|
914
|
+
const a = m.getRootElement(), l = Ue(
|
|
907
915
|
m.registerUpdateListener(({ editorState: u }) => {
|
|
908
|
-
t &&
|
|
916
|
+
t && bt(u.read(() => dt()));
|
|
909
917
|
}),
|
|
910
918
|
m.registerCommand(
|
|
911
|
-
|
|
912
|
-
(u, f) => (
|
|
913
|
-
|
|
919
|
+
Ge,
|
|
920
|
+
(u, f) => (it.current = f, !1),
|
|
921
|
+
tt
|
|
914
922
|
),
|
|
915
923
|
m.registerCommand(
|
|
916
924
|
qe,
|
|
917
|
-
|
|
918
|
-
|
|
925
|
+
Lt,
|
|
926
|
+
tt
|
|
919
927
|
),
|
|
920
928
|
m.registerCommand(
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
),
|
|
925
|
-
m.registerCommand(
|
|
926
|
-
Ge,
|
|
927
|
-
(u) => u.target === v.current ? (u.preventDefault(), !0) : !1,
|
|
928
|
-
Q
|
|
929
|
+
te,
|
|
930
|
+
Lt,
|
|
931
|
+
tt
|
|
929
932
|
),
|
|
930
933
|
m.registerCommand(
|
|
931
934
|
Ve,
|
|
932
|
-
|
|
933
|
-
|
|
935
|
+
(u) => u.target === y.current ? (u.preventDefault(), !0) : !1,
|
|
936
|
+
tt
|
|
934
937
|
),
|
|
935
938
|
m.registerCommand(
|
|
936
939
|
Je,
|
|
937
|
-
|
|
938
|
-
|
|
940
|
+
Dt,
|
|
941
|
+
tt
|
|
939
942
|
),
|
|
940
|
-
m.registerCommand(Qe, jt, Q),
|
|
941
943
|
m.registerCommand(
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
944
|
+
Qe,
|
|
945
|
+
Dt,
|
|
946
|
+
tt
|
|
947
|
+
),
|
|
948
|
+
m.registerCommand(Ze, Ot, tt),
|
|
949
|
+
m.registerCommand(
|
|
950
|
+
tr,
|
|
951
|
+
Ht,
|
|
952
|
+
tt
|
|
945
953
|
)
|
|
946
954
|
);
|
|
947
|
-
return a?.addEventListener("contextmenu",
|
|
948
|
-
t = !1, l(), a?.removeEventListener("contextmenu",
|
|
955
|
+
return a?.addEventListener("contextmenu", $t), () => {
|
|
956
|
+
t = !1, l(), a?.removeEventListener("contextmenu", $t);
|
|
949
957
|
};
|
|
950
958
|
}, [
|
|
951
959
|
R,
|
|
@@ -953,28 +961,28 @@ function co({
|
|
|
953
961
|
$,
|
|
954
962
|
n,
|
|
955
963
|
e,
|
|
956
|
-
At,
|
|
957
|
-
jt,
|
|
958
|
-
Wt,
|
|
959
964
|
Dt,
|
|
965
|
+
Ot,
|
|
966
|
+
Ht,
|
|
960
967
|
Lt,
|
|
961
|
-
|
|
968
|
+
$t,
|
|
969
|
+
W
|
|
962
970
|
]);
|
|
963
|
-
const
|
|
971
|
+
const ke = () => {
|
|
964
972
|
m.update(() => {
|
|
965
|
-
const t =
|
|
966
|
-
|
|
973
|
+
const t = ct(e);
|
|
974
|
+
et(t) && t.setShowCaption(!0);
|
|
967
975
|
});
|
|
968
|
-
},
|
|
969
|
-
|
|
970
|
-
|
|
976
|
+
}, Re = (t, a) => {
|
|
977
|
+
lt.current = !1, setTimeout(() => {
|
|
978
|
+
ot(!1);
|
|
971
979
|
}, 200), m.update(() => {
|
|
972
|
-
const l =
|
|
973
|
-
|
|
980
|
+
const l = ct(e);
|
|
981
|
+
et(l) && l.setWidthAndHeight(t, a);
|
|
974
982
|
});
|
|
975
|
-
},
|
|
976
|
-
|
|
977
|
-
},
|
|
983
|
+
}, Ee = () => {
|
|
984
|
+
lt.current = !0, ot(!0);
|
|
985
|
+
}, Ie = (t) => {
|
|
978
986
|
if (t.preventDefault(), t.stopPropagation(), i.startsWith("data:")) {
|
|
979
987
|
const a = window.open("", "_blank");
|
|
980
988
|
a && (a.document.write(`
|
|
@@ -1005,112 +1013,112 @@ function co({
|
|
|
1005
1013
|
`), a.document.close());
|
|
1006
1014
|
} else
|
|
1007
1015
|
window.open(i, "_blank");
|
|
1008
|
-
},
|
|
1016
|
+
}, Pe = (t) => {
|
|
1009
1017
|
t.preventDefault(), t.stopPropagation(), m.update(() => {
|
|
1010
|
-
const a =
|
|
1011
|
-
if (
|
|
1018
|
+
const a = ct(e);
|
|
1019
|
+
if (et(a)) {
|
|
1012
1020
|
const l = a.getParent();
|
|
1013
|
-
a.remove(), l &&
|
|
1021
|
+
a.remove(), l && Yt(l) && l.getChildrenSize() === 0 && l.setFormat("left");
|
|
1014
1022
|
}
|
|
1015
1023
|
});
|
|
1016
|
-
},
|
|
1024
|
+
}, ft = (t, a) => {
|
|
1017
1025
|
t.preventDefault(), t.stopPropagation(), m.update(() => {
|
|
1018
|
-
const l =
|
|
1019
|
-
if (
|
|
1026
|
+
const l = ct(e);
|
|
1027
|
+
if (et(l)) {
|
|
1020
1028
|
l.setPosition(a);
|
|
1021
1029
|
const u = l.getParent();
|
|
1022
|
-
u &&
|
|
1030
|
+
u && Yt(u) && (a === "left" ? u.setFormat("left") : a === "right" ? u.setFormat("right") : u.setFormat(""));
|
|
1023
1031
|
}
|
|
1024
1032
|
});
|
|
1025
|
-
},
|
|
1033
|
+
}, Se = (t) => {
|
|
1026
1034
|
t.preventDefault(), t.stopPropagation(), p(!s);
|
|
1027
|
-
},
|
|
1028
|
-
t.preventDefault(), t.stopPropagation(),
|
|
1029
|
-
}, []),
|
|
1035
|
+
}, ze = S((t) => {
|
|
1036
|
+
t.preventDefault(), t.stopPropagation(), gt(!0);
|
|
1037
|
+
}, []), Me = S(
|
|
1030
1038
|
(t) => {
|
|
1031
1039
|
t.preventDefault(), t.stopPropagation();
|
|
1032
|
-
const a =
|
|
1033
|
-
if (!(
|
|
1040
|
+
const a = Rt(i);
|
|
1041
|
+
if (!(ht(i) && i !== a) && !(typeof d == "number" || typeof N == "number"))
|
|
1034
1042
|
return;
|
|
1035
1043
|
m.update(
|
|
1036
1044
|
() => {
|
|
1037
|
-
const z =
|
|
1038
|
-
if (!
|
|
1045
|
+
const z = ct(e);
|
|
1046
|
+
if (!et(z))
|
|
1039
1047
|
return;
|
|
1040
1048
|
z.setSrc(a), z.setWidthAndHeight("inherit", "inherit");
|
|
1041
|
-
const
|
|
1042
|
-
|
|
1049
|
+
const T = dt();
|
|
1050
|
+
T && xt(T.clone());
|
|
1043
1051
|
},
|
|
1044
1052
|
{ tag: "image-reset" }
|
|
1045
1053
|
);
|
|
1046
|
-
const f =
|
|
1054
|
+
const f = y.current;
|
|
1047
1055
|
f && requestAnimationFrame(() => {
|
|
1048
1056
|
f.src = a, f.style.removeProperty("width"), f.style.removeProperty("height");
|
|
1049
1057
|
}), M.success("Image reset to original size and crop");
|
|
1050
1058
|
},
|
|
1051
|
-
[m, e, i, d,
|
|
1052
|
-
),
|
|
1059
|
+
[m, e, i, d, N]
|
|
1060
|
+
), Ae = S(
|
|
1053
1061
|
async (t) => {
|
|
1054
1062
|
let a = i;
|
|
1055
|
-
if (
|
|
1056
|
-
a =
|
|
1063
|
+
if (ht(i))
|
|
1064
|
+
a = Rt(i);
|
|
1057
1065
|
else {
|
|
1058
|
-
if (!
|
|
1066
|
+
if (!Nt) {
|
|
1059
1067
|
M.error("API key is required to upload and crop external images.");
|
|
1060
1068
|
return;
|
|
1061
1069
|
}
|
|
1062
1070
|
const u = M.loading("Uploading image…");
|
|
1063
1071
|
try {
|
|
1064
|
-
a = (await
|
|
1065
|
-
|
|
1072
|
+
a = (await nr.post(
|
|
1073
|
+
sr.project.fileUploadFromUrl,
|
|
1066
1074
|
{ url: i, prefix: "uploads" },
|
|
1067
|
-
{ headers: { "x-api-key":
|
|
1075
|
+
{ headers: { "x-api-key": Nt } }
|
|
1068
1076
|
)).data.fileUrl, M.dismiss(u);
|
|
1069
1077
|
} catch {
|
|
1070
1078
|
M.dismiss(u), M.error("Failed to upload image. Try again.");
|
|
1071
1079
|
return;
|
|
1072
1080
|
}
|
|
1073
1081
|
}
|
|
1074
|
-
const l =
|
|
1082
|
+
const l = Pr(a, t);
|
|
1075
1083
|
if (l === a) {
|
|
1076
1084
|
M.error("Cropping is only supported for images hosted on the CDN.");
|
|
1077
1085
|
return;
|
|
1078
1086
|
}
|
|
1079
|
-
|
|
1080
|
-
const u =
|
|
1081
|
-
if (!
|
|
1087
|
+
Mt(!0), m.update(() => {
|
|
1088
|
+
const u = ct(e);
|
|
1089
|
+
if (!et(u))
|
|
1082
1090
|
return;
|
|
1083
1091
|
u.setSrc(l), u.setWidthAndHeight(t.width, t.height);
|
|
1084
|
-
const f =
|
|
1085
|
-
f &&
|
|
1092
|
+
const f = dt();
|
|
1093
|
+
f && xt(f.clone());
|
|
1086
1094
|
}), M.success("Image cropped");
|
|
1087
1095
|
},
|
|
1088
|
-
[m, e, i,
|
|
1089
|
-
),
|
|
1090
|
-
|
|
1096
|
+
[m, e, i, Nt]
|
|
1097
|
+
), De = S(() => {
|
|
1098
|
+
C && !n && (O.current = setTimeout(() => {
|
|
1091
1099
|
A(!0);
|
|
1092
1100
|
}, 300));
|
|
1093
|
-
}, [
|
|
1094
|
-
|
|
1095
|
-
}, []),
|
|
1096
|
-
t.preventDefault(), t.stopPropagation(),
|
|
1097
|
-
}, [
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
}, []),
|
|
1101
|
-
n ||
|
|
1101
|
+
}, [C, n]), Le = S(() => {
|
|
1102
|
+
O.current && (clearTimeout(O.current), O.current = null), A(!1);
|
|
1103
|
+
}, []), Ft = S((t) => {
|
|
1104
|
+
t.preventDefault(), t.stopPropagation(), C && window.open(C, "_blank", "noopener,noreferrer");
|
|
1105
|
+
}, [C]);
|
|
1106
|
+
rt(() => () => {
|
|
1107
|
+
O.current && clearTimeout(O.current);
|
|
1108
|
+
}, []), rt(() => {
|
|
1109
|
+
n || gt(!1);
|
|
1102
1110
|
}, [n]);
|
|
1103
|
-
const
|
|
1104
|
-
if (!b.trim() ||
|
|
1111
|
+
const Xt = async () => {
|
|
1112
|
+
if (!b.trim() || x)
|
|
1105
1113
|
return;
|
|
1106
|
-
|
|
1114
|
+
F(!0);
|
|
1107
1115
|
const t = M.loading("Refining image...", {
|
|
1108
1116
|
description: "This may take 10-30 seconds. Please wait."
|
|
1109
1117
|
});
|
|
1110
1118
|
try {
|
|
1111
1119
|
let a = b.trim();
|
|
1112
|
-
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 = (
|
|
1113
|
-
const
|
|
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 = (U) => {
|
|
1121
|
+
const Wt = U.toLowerCase();
|
|
1114
1122
|
return [
|
|
1115
1123
|
"article",
|
|
1116
1124
|
"write",
|
|
@@ -1127,28 +1135,66 @@ function co({
|
|
|
1127
1135
|
"add some images",
|
|
1128
1136
|
"include images",
|
|
1129
1137
|
"include pictures"
|
|
1130
|
-
].some((
|
|
1138
|
+
].some((kt) => Wt.includes(kt));
|
|
1131
1139
|
};
|
|
1132
1140
|
let z = "";
|
|
1133
1141
|
if (E && E.trim()) {
|
|
1134
|
-
const
|
|
1135
|
-
f(
|
|
1142
|
+
const U = E.trim();
|
|
1143
|
+
f(U) && o && o !== "Generated image" && o.trim() ? z = o.trim() : z = U;
|
|
1136
1144
|
} else
|
|
1137
1145
|
o && o !== "Generated image" && o.trim() && (z = o.trim());
|
|
1138
1146
|
z ? a = `${z} with ${u}` : a = u;
|
|
1139
|
-
const
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1147
|
+
const T = await fetch(`${wr}/agent/stream`, {
|
|
1148
|
+
method: "POST",
|
|
1149
|
+
headers: { "Content-Type": "application/json" },
|
|
1150
|
+
body: JSON.stringify({
|
|
1151
|
+
type: "general",
|
|
1152
|
+
query: `Generate Image: ${a}`,
|
|
1153
|
+
model: "openai",
|
|
1154
|
+
api_key: Nt || ""
|
|
1155
|
+
})
|
|
1156
|
+
});
|
|
1157
|
+
if (!T.ok)
|
|
1158
|
+
throw new Error(`Image service error: ${T.status}`);
|
|
1159
|
+
const H = T.body?.getReader(), Tt = new TextDecoder();
|
|
1160
|
+
if (!H)
|
|
1161
|
+
throw new Error("Stream reader not available");
|
|
1162
|
+
let nt = null;
|
|
1163
|
+
t:
|
|
1164
|
+
for (; ; ) {
|
|
1165
|
+
const { done: U, value: Wt } = await H.read();
|
|
1166
|
+
if (U)
|
|
1167
|
+
break;
|
|
1168
|
+
const Ut = Tt.decode(Wt, { stream: !0 }).split(`
|
|
1169
|
+
`);
|
|
1170
|
+
for (const kt of Ut) {
|
|
1171
|
+
if (!kt.startsWith("data: "))
|
|
1172
|
+
continue;
|
|
1173
|
+
const jt = kt.slice(6).trim();
|
|
1174
|
+
if (!(!jt || jt === "[DONE]"))
|
|
1175
|
+
try {
|
|
1176
|
+
const q = JSON.parse(jt);
|
|
1177
|
+
if (q.type === "image_ready") {
|
|
1178
|
+
nt = q.url, H.cancel();
|
|
1179
|
+
break t;
|
|
1180
|
+
} else {
|
|
1181
|
+
if (q.type === "image_failed")
|
|
1182
|
+
throw H.cancel(), new Error(q.error || "Image generation failed");
|
|
1183
|
+
if (q.type === "error")
|
|
1184
|
+
throw H.cancel(), new Error(q.message || "Image generation failed");
|
|
1185
|
+
}
|
|
1186
|
+
} catch (q) {
|
|
1187
|
+
if (q instanceof SyntaxError)
|
|
1188
|
+
continue;
|
|
1189
|
+
throw q;
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
if (!nt)
|
|
1194
|
+
throw new Error("Failed to generate image - no image received");
|
|
1149
1195
|
M.dismiss(t), M.success("Image refined successfully!", {
|
|
1150
1196
|
description: "Compare the images and choose which to keep."
|
|
1151
|
-
}),
|
|
1197
|
+
}), K(nt), _(a), mt(!0), g(""), p(!1);
|
|
1152
1198
|
} catch (a) {
|
|
1153
1199
|
if (M.dismiss(t), a instanceof vr) {
|
|
1154
1200
|
const l = a.code === "API_KEYS_DISABLED" ? "API Keys Disabled" : "API Key Required";
|
|
@@ -1157,29 +1203,29 @@ function co({
|
|
|
1157
1203
|
duration: 8e3
|
|
1158
1204
|
});
|
|
1159
1205
|
} else
|
|
1160
|
-
a instanceof
|
|
1206
|
+
a instanceof Cr ? M.error("Credits Issue", {
|
|
1161
1207
|
description: a.message,
|
|
1162
1208
|
duration: 8e3
|
|
1163
1209
|
}) : M.error("Failed to refine image", {
|
|
1164
1210
|
description: a instanceof Error ? a.message : "Unknown error. Please try again."
|
|
1165
1211
|
});
|
|
1166
1212
|
} finally {
|
|
1167
|
-
|
|
1213
|
+
F(!1);
|
|
1168
1214
|
}
|
|
1169
|
-
},
|
|
1215
|
+
}, $e = () => {
|
|
1170
1216
|
m.update(() => {
|
|
1171
|
-
const t =
|
|
1172
|
-
if (
|
|
1173
|
-
t.setSrc(
|
|
1174
|
-
const a =
|
|
1175
|
-
a &&
|
|
1217
|
+
const t = ct(e);
|
|
1218
|
+
if (et(t)) {
|
|
1219
|
+
t.setSrc(Q), t.setOriginalPrompt(at);
|
|
1220
|
+
const a = dt();
|
|
1221
|
+
a && xt(a.clone());
|
|
1176
1222
|
}
|
|
1177
|
-
}),
|
|
1223
|
+
}), mt(!1), K(""), _(""), M.success("Image replaced successfully!", {
|
|
1178
1224
|
description: "The image has been updated with the refined version."
|
|
1179
1225
|
});
|
|
1180
|
-
},
|
|
1181
|
-
|
|
1182
|
-
},
|
|
1226
|
+
}, Te = () => {
|
|
1227
|
+
mt(!1), K(""), _("");
|
|
1228
|
+
}, We = n && st(j) && !$, Bt = (n || $) && St, je = () => c === "left" || c === "right" ? {
|
|
1183
1229
|
position: "relative",
|
|
1184
1230
|
display: "block",
|
|
1185
1231
|
width: "100%"
|
|
@@ -1207,36 +1253,36 @@ function co({
|
|
|
1207
1253
|
} : {
|
|
1208
1254
|
position: "relative",
|
|
1209
1255
|
display: "inline-block"
|
|
1210
|
-
},
|
|
1256
|
+
}, Ye = S(
|
|
1211
1257
|
(t) => {
|
|
1212
1258
|
if ($ || t.target.closest("button"))
|
|
1213
1259
|
return;
|
|
1214
|
-
const l = t.target ===
|
|
1260
|
+
const l = t.target === y.current;
|
|
1215
1261
|
let u = !1;
|
|
1216
|
-
if (!l &&
|
|
1217
|
-
const f =
|
|
1262
|
+
if (!l && y.current) {
|
|
1263
|
+
const f = y.current.getBoundingClientRect();
|
|
1218
1264
|
u = t.clientX >= f.left && t.clientX <= f.right && t.clientY >= f.top && t.clientY <= f.bottom;
|
|
1219
1265
|
}
|
|
1220
|
-
!l && !u || (t.stopPropagation(), t.shiftKey ?
|
|
1266
|
+
!l && !u || (t.stopPropagation(), t.shiftKey ? W(!n) : (R(), W(!0)));
|
|
1221
1267
|
},
|
|
1222
|
-
[$, n,
|
|
1268
|
+
[$, n, W, R]
|
|
1223
1269
|
);
|
|
1224
|
-
return /* @__PURE__ */ r(
|
|
1270
|
+
return /* @__PURE__ */ r(rr, { fallback: null, children: /* @__PURE__ */ h(Kt, { children: [
|
|
1225
1271
|
/* @__PURE__ */ h(
|
|
1226
1272
|
"div",
|
|
1227
1273
|
{
|
|
1228
|
-
draggable:
|
|
1229
|
-
style:
|
|
1230
|
-
onClick:
|
|
1231
|
-
onMouseEnter:
|
|
1232
|
-
onMouseLeave:
|
|
1274
|
+
draggable: We,
|
|
1275
|
+
style: je(),
|
|
1276
|
+
onClick: Ye,
|
|
1277
|
+
onMouseEnter: De,
|
|
1278
|
+
onMouseLeave: Le,
|
|
1233
1279
|
children: [
|
|
1234
|
-
|
|
1280
|
+
zt ? /* @__PURE__ */ h(
|
|
1235
1281
|
"div",
|
|
1236
1282
|
{
|
|
1237
1283
|
className: "cteditor-relative cteditor-inline-block cteditor-my-2 cteditor-select-none cteditor-rounded-lg cteditor-overflow-hidden",
|
|
1238
1284
|
style: {
|
|
1239
|
-
...typeof d == "number" && typeof
|
|
1285
|
+
...typeof d == "number" && typeof N == "number" ? { width: d, height: N, aspectRatio: `${d} / ${N}`, maxWidth: "100%" } : { minWidth: 200, minHeight: 150 }
|
|
1240
1286
|
},
|
|
1241
1287
|
children: [
|
|
1242
1288
|
/* @__PURE__ */ r(
|
|
@@ -1246,42 +1292,42 @@ function co({
|
|
|
1246
1292
|
alt: "",
|
|
1247
1293
|
className: "cteditor-absolute cteditor-opacity-0 cteditor-pointer-events-none cteditor-w-full cteditor-h-full cteditor-object-cover",
|
|
1248
1294
|
onLoad: () => {
|
|
1249
|
-
|
|
1295
|
+
Et.add(i), Mt(!1);
|
|
1250
1296
|
},
|
|
1251
|
-
onError: () =>
|
|
1297
|
+
onError: () => Mt(!1)
|
|
1252
1298
|
}
|
|
1253
1299
|
),
|
|
1254
1300
|
/* @__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: [
|
|
1255
|
-
/* @__PURE__ */ r(
|
|
1301
|
+
/* @__PURE__ */ r(dr, { className: "cteditor-w-10 cteditor-h-10 cteditor-text-muted-foreground cteditor-animate-spin cteditor-mb-2", "aria-hidden": !0 }),
|
|
1256
1302
|
/* @__PURE__ */ r("span", { className: "cteditor-text-sm cteditor-font-medium cteditor-text-muted-foreground", children: "Applying crop…" })
|
|
1257
1303
|
] })
|
|
1258
1304
|
]
|
|
1259
1305
|
}
|
|
1260
|
-
) :
|
|
1261
|
-
|
|
1306
|
+
) : J ? /* @__PURE__ */ r(_r, {}) : /* @__PURE__ */ r(
|
|
1307
|
+
Yr,
|
|
1262
1308
|
{
|
|
1263
|
-
className:
|
|
1309
|
+
className: Bt ? `focused ${st(j) ? "draggable" : ""}` : C ? "cteditor-cursor-pointer" : null,
|
|
1264
1310
|
src: i,
|
|
1265
1311
|
altText: o,
|
|
1266
|
-
imageRef:
|
|
1312
|
+
imageRef: y,
|
|
1267
1313
|
width: d,
|
|
1268
|
-
height:
|
|
1269
|
-
maxWidth:
|
|
1270
|
-
onError: () =>
|
|
1314
|
+
height: N,
|
|
1315
|
+
maxWidth: w,
|
|
1316
|
+
onError: () => Pt(!0)
|
|
1271
1317
|
}
|
|
1272
1318
|
),
|
|
1273
|
-
|
|
1319
|
+
G && C && !n && /* @__PURE__ */ h(
|
|
1274
1320
|
"div",
|
|
1275
1321
|
{
|
|
1276
1322
|
className: "cteditor-absolute cteditor-bottom-2 cteditor-left-2 cteditor-right-2 cteditor-bg-background cteditor-rounded-lg cteditor-shadow-lg cteditor-border cteditor-border-border cteditor-p-2 cteditor-flex cteditor-items-center cteditor-gap-2",
|
|
1277
1323
|
style: { zIndex: 10 },
|
|
1278
1324
|
children: [
|
|
1279
|
-
/* @__PURE__ */ r(
|
|
1280
|
-
/* @__PURE__ */ r("span", { className: "cteditor-text-sm cteditor-text-foreground cteditor-truncate cteditor-flex-1", children:
|
|
1325
|
+
/* @__PURE__ */ r(Nr, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-muted-foreground cteditor-flex-shrink-0" }),
|
|
1326
|
+
/* @__PURE__ */ r("span", { className: "cteditor-text-sm cteditor-text-foreground cteditor-truncate cteditor-flex-1", children: C }),
|
|
1281
1327
|
/* @__PURE__ */ r(
|
|
1282
1328
|
"button",
|
|
1283
1329
|
{
|
|
1284
|
-
onClick:
|
|
1330
|
+
onClick: Ft,
|
|
1285
1331
|
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",
|
|
1286
1332
|
children: "Open"
|
|
1287
1333
|
}
|
|
@@ -1289,150 +1335,150 @@ function co({
|
|
|
1289
1335
|
]
|
|
1290
1336
|
}
|
|
1291
1337
|
),
|
|
1292
|
-
n &&
|
|
1338
|
+
n && st(j) && !J && !zt && /* @__PURE__ */ h(
|
|
1293
1339
|
"div",
|
|
1294
1340
|
{
|
|
1295
|
-
ref:
|
|
1341
|
+
ref: Ct,
|
|
1296
1342
|
className: "cteditor-absolute cteditor-flex cteditor-gap-1 z-10 cteditor-text-foreground",
|
|
1297
|
-
style:
|
|
1343
|
+
style: Ne ?? (At ? { left: "50%", transform: "translateX(-50%) translateY(100%) translateY(4px)", bottom: 0 } : { top: 8, right: 8 }),
|
|
1298
1344
|
children: [
|
|
1299
1345
|
/* @__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: [
|
|
1300
1346
|
/* @__PURE__ */ r(
|
|
1301
1347
|
"button",
|
|
1302
1348
|
{
|
|
1303
|
-
onClick: (t) =>
|
|
1349
|
+
onClick: (t) => ft(t, "left"),
|
|
1304
1350
|
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" : ""}`,
|
|
1305
1351
|
"aria-label": "Wrap text left",
|
|
1306
1352
|
title: "Wrap text left",
|
|
1307
|
-
children: /* @__PURE__ */ r(
|
|
1353
|
+
children: /* @__PURE__ */ r(cr, {})
|
|
1308
1354
|
}
|
|
1309
1355
|
),
|
|
1310
1356
|
/* @__PURE__ */ r(
|
|
1311
1357
|
"button",
|
|
1312
1358
|
{
|
|
1313
|
-
onClick: (t) =>
|
|
1359
|
+
onClick: (t) => ft(t, "right"),
|
|
1314
1360
|
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" : ""}`,
|
|
1315
1361
|
"aria-label": "Wrap text right",
|
|
1316
1362
|
title: "Wrap text right",
|
|
1317
|
-
children: /* @__PURE__ */ r(
|
|
1363
|
+
children: /* @__PURE__ */ r(lr, {})
|
|
1318
1364
|
}
|
|
1319
1365
|
),
|
|
1320
1366
|
/* @__PURE__ */ r("div", { className: "cteditor-w-px cteditor-h-5 cteditor-bg-foreground/10 cteditor-mx-0.5" }),
|
|
1321
1367
|
/* @__PURE__ */ r(
|
|
1322
1368
|
"button",
|
|
1323
1369
|
{
|
|
1324
|
-
onClick: (t) =>
|
|
1370
|
+
onClick: (t) => ft(t, "inline-left"),
|
|
1325
1371
|
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" : ""}`,
|
|
1326
1372
|
"aria-label": "Align left",
|
|
1327
1373
|
title: "Align left (no text wrap)",
|
|
1328
|
-
children: /* @__PURE__ */ r(
|
|
1374
|
+
children: /* @__PURE__ */ r(ur, {})
|
|
1329
1375
|
}
|
|
1330
1376
|
),
|
|
1331
1377
|
/* @__PURE__ */ r(
|
|
1332
1378
|
"button",
|
|
1333
1379
|
{
|
|
1334
|
-
onClick: (t) =>
|
|
1380
|
+
onClick: (t) => ft(t, "inline-center"),
|
|
1335
1381
|
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" : ""}`,
|
|
1336
1382
|
"aria-label": "Align center",
|
|
1337
1383
|
title: "Align center (no text wrap)",
|
|
1338
|
-
children: /* @__PURE__ */ r(
|
|
1384
|
+
children: /* @__PURE__ */ r(mr, {})
|
|
1339
1385
|
}
|
|
1340
1386
|
),
|
|
1341
1387
|
/* @__PURE__ */ r(
|
|
1342
1388
|
"button",
|
|
1343
1389
|
{
|
|
1344
|
-
onClick: (t) =>
|
|
1390
|
+
onClick: (t) => ft(t, "inline-right"),
|
|
1345
1391
|
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" : ""}`,
|
|
1346
1392
|
"aria-label": "Align right",
|
|
1347
1393
|
title: "Align right (no text wrap)",
|
|
1348
|
-
children: /* @__PURE__ */ r(
|
|
1394
|
+
children: /* @__PURE__ */ r(gr, {})
|
|
1349
1395
|
}
|
|
1350
1396
|
),
|
|
1351
1397
|
/* @__PURE__ */ r("div", { className: "cteditor-w-px cteditor-h-5 cteditor-bg-foreground/10 cteditor-mx-0.5" }),
|
|
1352
1398
|
/* @__PURE__ */ r(
|
|
1353
1399
|
"button",
|
|
1354
1400
|
{
|
|
1355
|
-
onClick: (t) =>
|
|
1401
|
+
onClick: (t) => ft(t, "none"),
|
|
1356
1402
|
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" : ""}`,
|
|
1357
1403
|
"aria-label": "Inline",
|
|
1358
1404
|
title: "Inline with text",
|
|
1359
|
-
children: /* @__PURE__ */ r(
|
|
1405
|
+
children: /* @__PURE__ */ r(fr, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-foreground" })
|
|
1360
1406
|
}
|
|
1361
1407
|
),
|
|
1362
1408
|
/* @__PURE__ */ r("div", { className: "cteditor-w-px cteditor-h-5 cteditor-bg-foreground/10 cteditor-mx-0.5" }),
|
|
1363
|
-
!i.startsWith("data:") && !i.toLowerCase().endsWith(".svg") && /* @__PURE__ */ h(
|
|
1409
|
+
!i.startsWith("data:") && !i.toLowerCase().endsWith(".svg") && /* @__PURE__ */ h(Kt, { children: [
|
|
1364
1410
|
/* @__PURE__ */ r(
|
|
1365
1411
|
"button",
|
|
1366
1412
|
{
|
|
1367
|
-
onClick:
|
|
1413
|
+
onClick: ze,
|
|
1368
1414
|
className: "cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-foreground/10 cteditor-transition-colors",
|
|
1369
1415
|
"aria-label": "Crop image",
|
|
1370
1416
|
title: "Crop image",
|
|
1371
|
-
children: /* @__PURE__ */ r(
|
|
1417
|
+
children: /* @__PURE__ */ r(ve, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-foreground" })
|
|
1372
1418
|
}
|
|
1373
1419
|
),
|
|
1374
|
-
(
|
|
1420
|
+
(Rt(i) !== i || typeof d == "number" || typeof N == "number") && /* @__PURE__ */ r(
|
|
1375
1421
|
"button",
|
|
1376
1422
|
{
|
|
1377
|
-
onClick:
|
|
1423
|
+
onClick: Me,
|
|
1378
1424
|
className: "cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-foreground/10 cteditor-transition-colors",
|
|
1379
1425
|
"aria-label": "Reset image to original size and crop",
|
|
1380
1426
|
title: "Reset to original size and crop",
|
|
1381
|
-
children: /* @__PURE__ */ r(
|
|
1427
|
+
children: /* @__PURE__ */ r(kr, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-foreground" })
|
|
1382
1428
|
}
|
|
1383
1429
|
)
|
|
1384
1430
|
] })
|
|
1385
1431
|
] }),
|
|
1386
|
-
|
|
1432
|
+
C && /* @__PURE__ */ r(
|
|
1387
1433
|
"button",
|
|
1388
1434
|
{
|
|
1389
|
-
onClick:
|
|
1435
|
+
onClick: Ft,
|
|
1390
1436
|
className: " cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded-md cteditor-bg-accent hover:cteditor-bg-accent/95 cteditor-transition-colors cteditor-shadow-md cteditor-border cteditor-border-foreground/20",
|
|
1391
1437
|
"aria-label": "Visit link",
|
|
1392
|
-
title: `Visit: ${
|
|
1393
|
-
children: /* @__PURE__ */ r(
|
|
1438
|
+
title: `Visit: ${C}`,
|
|
1439
|
+
children: /* @__PURE__ */ r(hr, {})
|
|
1394
1440
|
}
|
|
1395
1441
|
),
|
|
1396
1442
|
E && /* @__PURE__ */ r(
|
|
1397
1443
|
"button",
|
|
1398
1444
|
{
|
|
1399
1445
|
onClick: (t) => {
|
|
1400
|
-
t.stopPropagation(),
|
|
1446
|
+
t.stopPropagation(), Se(t);
|
|
1401
1447
|
},
|
|
1402
1448
|
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",
|
|
1403
1449
|
"aria-label": "Refine image",
|
|
1404
1450
|
title: "Refine image",
|
|
1405
|
-
children: /* @__PURE__ */ r(
|
|
1451
|
+
children: /* @__PURE__ */ r(pr, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-foreground" })
|
|
1406
1452
|
}
|
|
1407
1453
|
),
|
|
1408
1454
|
/* @__PURE__ */ r(
|
|
1409
1455
|
"button",
|
|
1410
1456
|
{
|
|
1411
1457
|
onClick: (t) => {
|
|
1412
|
-
t.stopPropagation(),
|
|
1458
|
+
t.stopPropagation(), Ie(t);
|
|
1413
1459
|
},
|
|
1414
1460
|
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",
|
|
1415
1461
|
"aria-label": "Open image in new tab",
|
|
1416
1462
|
title: "Open in new tab",
|
|
1417
|
-
children: /* @__PURE__ */ r(
|
|
1463
|
+
children: /* @__PURE__ */ r(br, {})
|
|
1418
1464
|
}
|
|
1419
1465
|
),
|
|
1420
1466
|
/* @__PURE__ */ r(
|
|
1421
1467
|
"button",
|
|
1422
1468
|
{
|
|
1423
1469
|
onClick: (t) => {
|
|
1424
|
-
t.stopPropagation(),
|
|
1470
|
+
t.stopPropagation(), Pe(t);
|
|
1425
1471
|
},
|
|
1426
1472
|
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",
|
|
1427
1473
|
"aria-label": "Delete image",
|
|
1428
1474
|
title: "Delete image",
|
|
1429
|
-
children: /* @__PURE__ */ r(
|
|
1475
|
+
children: /* @__PURE__ */ r(yr, {})
|
|
1430
1476
|
}
|
|
1431
1477
|
)
|
|
1432
1478
|
]
|
|
1433
1479
|
}
|
|
1434
1480
|
),
|
|
1435
|
-
s && n && !
|
|
1481
|
+
s && n && !J && E && /* @__PURE__ */ r(
|
|
1436
1482
|
"div",
|
|
1437
1483
|
{
|
|
1438
1484
|
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",
|
|
@@ -1449,7 +1495,7 @@ function co({
|
|
|
1449
1495
|
value: b,
|
|
1450
1496
|
onChange: (t) => g(t.target.value),
|
|
1451
1497
|
onKeyDown: (t) => {
|
|
1452
|
-
t.stopPropagation(), t.key === "Enter" && b.trim() && !
|
|
1498
|
+
t.stopPropagation(), t.key === "Enter" && b.trim() && !x && Xt(), t.key === "Escape" && (p(!1), g(""));
|
|
1453
1499
|
},
|
|
1454
1500
|
onKeyUp: (t) => {
|
|
1455
1501
|
t.stopPropagation();
|
|
@@ -1459,7 +1505,7 @@ function co({
|
|
|
1459
1505
|
},
|
|
1460
1506
|
placeholder: "e.g., flying birds, golden sunset, stormy clouds...",
|
|
1461
1507
|
className: "cteditor-w-full cteditor-px-3 cteditor-py-2 cteditor-text-sm cteditor-border cteditor-border-foreground/10 focus:cteditor-border-foreground cteditor-rounded-md cteditor-bg-background cteditor-text-foreground ",
|
|
1462
|
-
disabled:
|
|
1508
|
+
disabled: x,
|
|
1463
1509
|
autoFocus: !0
|
|
1464
1510
|
}
|
|
1465
1511
|
),
|
|
@@ -1468,11 +1514,11 @@ function co({
|
|
|
1468
1514
|
"button",
|
|
1469
1515
|
{
|
|
1470
1516
|
onClick: (t) => {
|
|
1471
|
-
t.stopPropagation(),
|
|
1517
|
+
t.stopPropagation(), Xt();
|
|
1472
1518
|
},
|
|
1473
|
-
disabled:
|
|
1519
|
+
disabled: x || !b.trim(),
|
|
1474
1520
|
className: " cteditor-px-5 cteditor-py-2 cteditor-text-sm cteditor-rounded-md cteditor-bg-foreground cteditor-text-background hover:cteditor-bg-foreground/95 disabled:cteditor-opacity-50 disabled:cteditor-cursor-not-allowed cteditor-transition-colors focus:cteditor-outline-none focus:cteditor-ring-2 focus:cteditor-ring-background",
|
|
1475
|
-
children:
|
|
1521
|
+
children: x ? /* @__PURE__ */ h("span", { className: "cteditor-flex cteditor-items-center cteditor-justify-center cteditor-gap-2", children: [
|
|
1476
1522
|
/* @__PURE__ */ r("span", { className: "cteditor-inline-block cteditor-w-4 cteditor-h-4 cteditor-border-2 cteditor-border-t-transparent cteditor-rounded-full cteditor-animate-spin" }),
|
|
1477
1523
|
"Refining..."
|
|
1478
1524
|
] }) : "Refine Image"
|
|
@@ -1484,33 +1530,33 @@ function co({
|
|
|
1484
1530
|
onClick: (t) => {
|
|
1485
1531
|
t.stopPropagation(), p(!1), g("");
|
|
1486
1532
|
},
|
|
1487
|
-
disabled:
|
|
1533
|
+
disabled: x,
|
|
1488
1534
|
className: "cteditor-size-9 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-text-sm cteditor-rounded-md cteditor-bg-background cteditor-border cteditor-border-border cteditor-text-foreground hover:cteditor-bg-accent disabled:cteditor-opacity-50 disabled:cteditor-cursor-not-allowed cteditor-transition-colors",
|
|
1489
|
-
children: /* @__PURE__ */ r(
|
|
1535
|
+
children: /* @__PURE__ */ r(xr, { size: 16 })
|
|
1490
1536
|
}
|
|
1491
1537
|
)
|
|
1492
1538
|
] })
|
|
1493
1539
|
] })
|
|
1494
1540
|
}
|
|
1495
1541
|
),
|
|
1496
|
-
L &&
|
|
1497
|
-
|
|
1542
|
+
L && st(j) && Bt && !zt && /* @__PURE__ */ r(
|
|
1543
|
+
_e,
|
|
1498
1544
|
{
|
|
1499
1545
|
showCaption: P,
|
|
1500
|
-
setShowCaption:
|
|
1546
|
+
setShowCaption: ke,
|
|
1501
1547
|
editor: m,
|
|
1502
1548
|
buttonRef: D,
|
|
1503
|
-
imageRef:
|
|
1504
|
-
maxWidth:
|
|
1505
|
-
onResizeStart:
|
|
1506
|
-
onResizeEnd:
|
|
1507
|
-
captionsEnabled: !
|
|
1549
|
+
imageRef: y,
|
|
1550
|
+
maxWidth: w,
|
|
1551
|
+
onResizeStart: Ee,
|
|
1552
|
+
onResizeEnd: Re,
|
|
1553
|
+
captionsEnabled: !J && v
|
|
1508
1554
|
}
|
|
1509
1555
|
)
|
|
1510
1556
|
]
|
|
1511
1557
|
}
|
|
1512
1558
|
),
|
|
1513
|
-
P && (o.startsWith("Signature by") ? /* @__PURE__ */ r(
|
|
1559
|
+
P && (o.startsWith("Signature by") ? /* @__PURE__ */ r(Er, { caption: k }) : /* @__PURE__ */ r(
|
|
1514
1560
|
"div",
|
|
1515
1561
|
{
|
|
1516
1562
|
className: "image-caption-container",
|
|
@@ -1521,73 +1567,73 @@ function co({
|
|
|
1521
1567
|
...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" } : {}
|
|
1522
1568
|
},
|
|
1523
1569
|
children: /* @__PURE__ */ h(
|
|
1524
|
-
|
|
1570
|
+
ne,
|
|
1525
1571
|
{
|
|
1526
|
-
initialEditor:
|
|
1572
|
+
initialEditor: k,
|
|
1527
1573
|
initialNodes: [
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1574
|
+
ce,
|
|
1575
|
+
le,
|
|
1576
|
+
ue,
|
|
1577
|
+
me,
|
|
1578
|
+
re,
|
|
1579
|
+
ee
|
|
1534
1580
|
],
|
|
1535
1581
|
children: [
|
|
1536
|
-
/* @__PURE__ */ r(
|
|
1582
|
+
/* @__PURE__ */ r(Oe, {}),
|
|
1537
1583
|
/* @__PURE__ */ r(
|
|
1538
|
-
|
|
1584
|
+
de,
|
|
1539
1585
|
{
|
|
1540
1586
|
contentEditable: /* @__PURE__ */ r(
|
|
1541
|
-
|
|
1587
|
+
oe,
|
|
1542
1588
|
{
|
|
1543
1589
|
"aria-placeholder": "Enter a caption...",
|
|
1544
|
-
placeholder: () => /* @__PURE__ */ r("span", { className: "cteditor-text-xs", children: "Enter a caption..." }),
|
|
1545
|
-
className: " cteditor-outline-none !cteditor-shadow-none cteditor-bg-foreground/10 cteditor-border !cteditor-border-foreground/15 cteditor-py-1 cteditor-px-2 cteditor-rounded-sm cteditor-text-xs"
|
|
1590
|
+
placeholder: () => /* @__PURE__ */ r("span", { className: "cteditor-text-xs cteditor-absolute cteditor-left-2 cteditor-top-[7px]", children: "Enter a caption..." }),
|
|
1591
|
+
className: " cteditor-outline-none !cteditor-shadow-none cteditor-bg-foreground/10 cteditor-border !cteditor-border-foreground/15 cteditor-py-1 cteditor-px-2 cteditor-rounded-sm cteditor-text-xs cteditor-relative"
|
|
1546
1592
|
}
|
|
1547
1593
|
),
|
|
1548
|
-
ErrorBoundary:
|
|
1594
|
+
ErrorBoundary: ie
|
|
1549
1595
|
}
|
|
1550
1596
|
),
|
|
1551
1597
|
/* @__PURE__ */ r(
|
|
1552
|
-
|
|
1598
|
+
se,
|
|
1553
1599
|
{
|
|
1554
1600
|
onChange: () => {
|
|
1555
1601
|
}
|
|
1556
1602
|
}
|
|
1557
1603
|
),
|
|
1558
|
-
/* @__PURE__ */ r(
|
|
1559
|
-
/* @__PURE__ */ r(
|
|
1604
|
+
/* @__PURE__ */ r(ae, {}),
|
|
1605
|
+
/* @__PURE__ */ r(xe, { namespace: we.namespace })
|
|
1560
1606
|
]
|
|
1561
1607
|
}
|
|
1562
1608
|
)
|
|
1563
1609
|
}
|
|
1564
1610
|
)),
|
|
1565
1611
|
/* @__PURE__ */ r(
|
|
1566
|
-
|
|
1612
|
+
Wr,
|
|
1567
1613
|
{
|
|
1568
|
-
open:
|
|
1569
|
-
onOpenChange:
|
|
1614
|
+
open: B,
|
|
1615
|
+
onOpenChange: gt,
|
|
1570
1616
|
src: i,
|
|
1571
1617
|
altText: o,
|
|
1572
1618
|
width: d,
|
|
1573
|
-
height:
|
|
1574
|
-
onCropApply:
|
|
1619
|
+
height: N,
|
|
1620
|
+
onCropApply: Ae
|
|
1575
1621
|
}
|
|
1576
1622
|
),
|
|
1577
1623
|
/* @__PURE__ */ r(
|
|
1578
|
-
|
|
1624
|
+
Rr,
|
|
1579
1625
|
{
|
|
1580
|
-
open:
|
|
1581
|
-
onOpenChange:
|
|
1626
|
+
open: ut,
|
|
1627
|
+
onOpenChange: mt,
|
|
1582
1628
|
oldImageUrl: i,
|
|
1583
|
-
newImageUrl:
|
|
1584
|
-
onReplace:
|
|
1585
|
-
onCancel:
|
|
1629
|
+
newImageUrl: Q,
|
|
1630
|
+
onReplace: $e,
|
|
1631
|
+
onCancel: Te
|
|
1586
1632
|
}
|
|
1587
1633
|
)
|
|
1588
1634
|
] }) });
|
|
1589
1635
|
}
|
|
1590
1636
|
export {
|
|
1591
|
-
|
|
1637
|
+
te as RIGHT_CLICK_IMAGE_COMMAND,
|
|
1592
1638
|
co as default
|
|
1593
1639
|
};
|