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