eddyter 1.3.80 → 1.3.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ImageResizer-o0eMm1Mg.js → ImageResizer-Bt7kgv0a.js} +1 -1
- package/dist/assets/style.css +1 -1
- package/dist/components/FileView/index.d.ts +2 -0
- package/dist/editorConfig.d.ts +1 -0
- package/dist/{generateDocxThumbnail-CuC4oE4q.js → generateDocxThumbnail-DCh0DpQm.js} +1 -1
- package/dist/{generatePdfThumbnail-Be9_gTd2.js → generatePdfThumbnail-D8k_mO4q.js} +1 -1
- package/dist/{generateXlsxThumbnail-BHmQkbG6.js → generateXlsxThumbnail-Db5nhXLN.js} +1 -1
- package/dist/{html2pdf.bundle.min-__2qz-Dv.js → html2pdf.bundle.min-CYrTiP9i.js} +1 -1
- package/dist/{index-BiGNE0nG.js → index-20I04v1t.js} +11512 -11122
- package/dist/{index-BjjpBGeH.js → index-Bgccl9jH.js} +154 -154
- package/dist/{index-0dB2NNlO.js → index-CQWxSXxG.js} +2 -2
- package/dist/index-DYduXrLZ.js +157 -0
- package/dist/index.js +1 -1
- package/dist/nodes/FileNode.d.ts +8 -2
- package/dist/plugins/FloatingFileMenuPlugin.d.ts +3 -0
- package/dist/plugins/WordCountPlugin.d.ts +4 -1
- package/dist/types.d.ts +2 -0
- package/package.json +1 -1
- package/dist/index-BTnX5edL.js +0 -131
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as r, jsxs as f, Fragment as Se } from "react/jsx-runtime";
|
|
2
|
-
import { I as Me } from "./ImageResizer-
|
|
2
|
+
import { I as Me } from "./ImageResizer-Bt7kgv0a.js";
|
|
3
3
|
import { CodeNode as Ot } from "@lexical/code";
|
|
4
4
|
import { LinkNode as Ht } from "@lexical/link";
|
|
5
5
|
import { AutoFocusPlugin as ze } from "@lexical/react/LexicalAutoFocusPlugin";
|
|
@@ -13,10 +13,10 @@ import { OnChangePlugin as Ut } from "@lexical/react/LexicalOnChangePlugin";
|
|
|
13
13
|
import { RichTextPlugin as Gt } from "@lexical/react/LexicalRichTextPlugin";
|
|
14
14
|
import { useLexicalEditable as Le } from "@lexical/react/useLexicalEditable";
|
|
15
15
|
import { useLexicalNodeSelection as $e } from "@lexical/react/useLexicalNodeSelection";
|
|
16
|
-
import { mergeRegister as
|
|
17
|
-
import { RootNode as qt, TextNode as Vt, LineBreakNode as Jt, ParagraphNode as Qt, $getSelection as st, $isNodeSelection as dt, $isParagraphNode as Et, $setSelection as bt, $isRangeSelection as
|
|
16
|
+
import { mergeRegister as Te } from "@lexical/utils";
|
|
17
|
+
import { RootNode as qt, TextNode as Vt, LineBreakNode as Jt, ParagraphNode as Qt, $getSelection as st, $isNodeSelection as dt, $isParagraphNode as Et, $setSelection as bt, $isRangeSelection as We, SELECTION_CHANGE_COMMAND as _e, COMMAND_PRIORITY_LOW as U, CLICK_COMMAND as Ye, DRAGSTART_COMMAND as je, KEY_DELETE_COMMAND as Oe, KEY_BACKSPACE_COMMAND as He, KEY_ENTER_COMMAND as Fe, KEY_ESCAPE_COMMAND as Xe, $getNodeByKey as ct, createCommand as Be } from "lexical";
|
|
18
18
|
import mt, { useState as P, useRef as G, useMemo as $t, useCallback as S, useEffect as q, useLayoutEffect as Ke, Suspense as Ue } from "react";
|
|
19
|
-
import { a as gt, D as Zt, b as te, d as ee, e as re, f as oe, h as
|
|
19
|
+
import { a as gt, D as Zt, b as te, d as ee, e as re, f as oe, h as ie, B as Tt, L as ae, i as ne, C as yt, I as Ge, u as qe, $ as tt, t as z, j as Ve, k as Je, W as Qe, l as Ze, A as tr, m as er, n as rr, T as or, o as ir, S as ar, E as nr, p as sr, q as dr, r as cr, s as lr } from "./index-20I04v1t.js";
|
|
20
20
|
import "react-dom";
|
|
21
21
|
const se = gt("Crop", [
|
|
22
22
|
["path", { d: "M6 2v14a2 2 0 0 0 2 2h14", key: "ron5a4" }],
|
|
@@ -27,22 +27,22 @@ const ur = gt("Link2", [
|
|
|
27
27
|
["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }],
|
|
28
28
|
["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }]
|
|
29
29
|
]);
|
|
30
|
-
const
|
|
30
|
+
const Wt = gt("RectangleHorizontal", [
|
|
31
31
|
["rect", { width: "20", height: "12", x: "2", y: "6", rx: "2", key: "9lu3g6" }]
|
|
32
32
|
]);
|
|
33
|
-
const
|
|
33
|
+
const _t = gt("RectangleVertical", [
|
|
34
34
|
["rect", { width: "12", height: "20", x: "6", y: "2", rx: "2", key: "1oxtiu" }]
|
|
35
35
|
]);
|
|
36
36
|
const mr = gt("Square", [
|
|
37
37
|
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }]
|
|
38
38
|
]), gr = ({
|
|
39
|
-
open:
|
|
39
|
+
open: i,
|
|
40
40
|
onOpenChange: o,
|
|
41
41
|
oldImageUrl: e,
|
|
42
42
|
newImageUrl: d,
|
|
43
43
|
onReplace: R,
|
|
44
44
|
onCancel: y
|
|
45
|
-
}) => /* @__PURE__ */ r(Zt, { open:
|
|
45
|
+
}) => /* @__PURE__ */ r(Zt, { open: i, onOpenChange: o, children: /* @__PURE__ */ f(te, { className: "sm:max-w-[800px] max-h-[90vh] overflow-y-auto", children: [
|
|
46
46
|
/* @__PURE__ */ f(ee, { children: [
|
|
47
47
|
/* @__PURE__ */ f(re, { className: "flex items-center gap-2 text-xl", children: [
|
|
48
48
|
/* @__PURE__ */ r("span", { className: "text-2xl", children: "🔄" }),
|
|
@@ -70,9 +70,9 @@ const mr = gt("Square", [
|
|
|
70
70
|
' Clicking "Replace" will update the image in your document. This action cannot be undone.'
|
|
71
71
|
] }) })
|
|
72
72
|
] }),
|
|
73
|
-
/* @__PURE__ */ f(
|
|
73
|
+
/* @__PURE__ */ f(ie, { className: "gap-2", children: [
|
|
74
74
|
/* @__PURE__ */ r(
|
|
75
|
-
|
|
75
|
+
Tt,
|
|
76
76
|
{
|
|
77
77
|
variant: "outline",
|
|
78
78
|
onClick: y,
|
|
@@ -80,7 +80,7 @@ const mr = gt("Square", [
|
|
|
80
80
|
}
|
|
81
81
|
),
|
|
82
82
|
/* @__PURE__ */ f(
|
|
83
|
-
|
|
83
|
+
Tt,
|
|
84
84
|
{
|
|
85
85
|
onClick: R,
|
|
86
86
|
className: "bg-blue-500 hover:bg-blue-600 text-white",
|
|
@@ -93,12 +93,12 @@ const mr = gt("Square", [
|
|
|
93
93
|
] })
|
|
94
94
|
] }) });
|
|
95
95
|
function hr({
|
|
96
|
-
caption:
|
|
96
|
+
caption: i
|
|
97
97
|
}) {
|
|
98
98
|
return /* @__PURE__ */ r("div", { className: "signature-caption-container", children: /* @__PURE__ */ f(
|
|
99
99
|
Kt,
|
|
100
100
|
{
|
|
101
|
-
initialEditor:
|
|
101
|
+
initialEditor: i,
|
|
102
102
|
initialNodes: [
|
|
103
103
|
qt,
|
|
104
104
|
Vt,
|
|
@@ -134,62 +134,62 @@ function hr({
|
|
|
134
134
|
/* @__PURE__ */ r(Ut, { onChange: () => {
|
|
135
135
|
} }),
|
|
136
136
|
/* @__PURE__ */ r(Bt, {}),
|
|
137
|
-
/* @__PURE__ */ r(
|
|
137
|
+
/* @__PURE__ */ r(ae, { namespace: ne.namespace })
|
|
138
138
|
]
|
|
139
139
|
}
|
|
140
140
|
) });
|
|
141
141
|
}
|
|
142
142
|
const fr = "/transform-image/";
|
|
143
|
-
function ht(
|
|
144
|
-
if (!yt ||
|
|
143
|
+
function ht(i) {
|
|
144
|
+
if (!yt || i.startsWith("data:") || i.toLowerCase().endsWith(".svg"))
|
|
145
145
|
return !1;
|
|
146
146
|
try {
|
|
147
|
-
const o = new URL(
|
|
147
|
+
const o = new URL(i).origin, e = new URL(yt).origin;
|
|
148
148
|
return o === e;
|
|
149
149
|
} catch {
|
|
150
150
|
return !1;
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
|
-
function de(
|
|
154
|
-
if (!ht(
|
|
153
|
+
function de(i) {
|
|
154
|
+
if (!ht(i))
|
|
155
155
|
return null;
|
|
156
156
|
try {
|
|
157
|
-
const e = new URL(
|
|
157
|
+
const e = new URL(i).pathname.replace(/^\//, ""), d = "transform-image/";
|
|
158
158
|
return e.startsWith(d) ? e.slice(d.length) || null : e || null;
|
|
159
159
|
} catch {
|
|
160
160
|
return null;
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
|
-
function pr(
|
|
164
|
-
if (!ht(
|
|
165
|
-
return
|
|
166
|
-
const e = de(
|
|
163
|
+
function pr(i, o) {
|
|
164
|
+
if (!ht(i))
|
|
165
|
+
return i;
|
|
166
|
+
const e = de(i);
|
|
167
167
|
if (!e)
|
|
168
|
-
return
|
|
168
|
+
return i;
|
|
169
169
|
const d = `${o.x},${o.y},${o.width},${o.height}`;
|
|
170
170
|
return `${yt.replace(/\/$/, "")}${fr}${e}?crop=${d}`;
|
|
171
171
|
}
|
|
172
|
-
function Yt(
|
|
173
|
-
if (!ht(
|
|
174
|
-
return
|
|
172
|
+
function Yt(i) {
|
|
173
|
+
if (!ht(i))
|
|
174
|
+
return i;
|
|
175
175
|
try {
|
|
176
|
-
const o = new URL(
|
|
176
|
+
const o = new URL(i);
|
|
177
177
|
return o.searchParams.delete("crop"), o.toString();
|
|
178
178
|
} catch {
|
|
179
|
-
return
|
|
179
|
+
return i;
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
|
-
function ce(
|
|
183
|
-
if (!ht(
|
|
184
|
-
return Yt(
|
|
185
|
-
const o = de(
|
|
186
|
-
return o ? `${yt.replace(/\/$/, "")}/${o}` : Yt(
|
|
182
|
+
function ce(i) {
|
|
183
|
+
if (!ht(i))
|
|
184
|
+
return Yt(i);
|
|
185
|
+
const o = de(i);
|
|
186
|
+
return o ? `${yt.replace(/\/$/, "")}/${o}` : Yt(i);
|
|
187
187
|
}
|
|
188
|
-
function br(
|
|
188
|
+
function br(i) {
|
|
189
189
|
if (typeof document > "u")
|
|
190
190
|
return;
|
|
191
191
|
let o = document.head || document.getElementsByTagName("head")[0], e = document.createElement("style");
|
|
192
|
-
e.type = "text/css", o.appendChild(e), e.styleSheet ? e.styleSheet.cssText =
|
|
192
|
+
e.type = "text/css", o.appendChild(e), e.styleSheet ? e.styleSheet.cssText = i : e.appendChild(document.createTextNode(i));
|
|
193
193
|
}
|
|
194
194
|
Array(12).fill(0);
|
|
195
195
|
let It = 1;
|
|
@@ -347,30 +347,30 @@ class yr {
|
|
|
347
347
|
}, this.getActiveToasts = () => this.toasts.filter((o) => !this.dismissedToasts.has(o.id)), this.subscribers = [], this.toasts = [], this.dismissedToasts = /* @__PURE__ */ new Set();
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
|
-
const
|
|
350
|
+
const T = new yr(), xr = (i, o) => {
|
|
351
351
|
const e = o?.id || It++;
|
|
352
|
-
return
|
|
353
|
-
title:
|
|
352
|
+
return T.addToast({
|
|
353
|
+
title: i,
|
|
354
354
|
...o,
|
|
355
355
|
id: e
|
|
356
356
|
}), e;
|
|
357
|
-
}, vr = (
|
|
358
|
-
success:
|
|
359
|
-
info:
|
|
360
|
-
warning:
|
|
361
|
-
error:
|
|
362
|
-
custom:
|
|
363
|
-
message:
|
|
364
|
-
promise:
|
|
365
|
-
dismiss:
|
|
366
|
-
loading:
|
|
357
|
+
}, vr = (i) => i && typeof i == "object" && "ok" in i && typeof i.ok == "boolean" && "status" in i && typeof i.status == "number", wr = xr, Cr = () => T.toasts, kr = () => T.getActiveToasts(), Nr = Object.assign(wr, {
|
|
358
|
+
success: T.success,
|
|
359
|
+
info: T.info,
|
|
360
|
+
warning: T.warning,
|
|
361
|
+
error: T.error,
|
|
362
|
+
custom: T.custom,
|
|
363
|
+
message: T.message,
|
|
364
|
+
promise: T.promise,
|
|
365
|
+
dismiss: T.dismiss,
|
|
366
|
+
loading: T.loading
|
|
367
367
|
}, {
|
|
368
368
|
getHistory: Cr,
|
|
369
369
|
getToasts: kr
|
|
370
370
|
});
|
|
371
371
|
br("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");
|
|
372
372
|
function Er({
|
|
373
|
-
open:
|
|
373
|
+
open: i,
|
|
374
374
|
onOpenChange: o,
|
|
375
375
|
src: e,
|
|
376
376
|
altText: d,
|
|
@@ -481,9 +481,9 @@ function Er({
|
|
|
481
481
|
l.width = Math.min(l.width, s.naturalWidth - l.x), l.height = Math.min(l.height, s.naturalHeight - l.y), await Promise.resolve(D(l)), o(!1);
|
|
482
482
|
}, [n, N, D, o]);
|
|
483
483
|
return q(() => {
|
|
484
|
-
|
|
485
|
-
}, [
|
|
486
|
-
if (!
|
|
484
|
+
i && ($({ x: 0, y: 0, width: 0, height: 0 }), L({ x: 0, y: 0, width: 0, height: 0 }), k(!1), E(ce(e)));
|
|
485
|
+
}, [i, e]), q(() => {
|
|
486
|
+
if (!i)
|
|
487
487
|
return;
|
|
488
488
|
const s = x.current;
|
|
489
489
|
if (!s)
|
|
@@ -498,30 +498,30 @@ function Er({
|
|
|
498
498
|
return window.addEventListener("resize", l), () => {
|
|
499
499
|
g.disconnect(), window.removeEventListener("resize", l);
|
|
500
500
|
};
|
|
501
|
-
}, [
|
|
502
|
-
if (!
|
|
501
|
+
}, [i, J]), q(() => {
|
|
502
|
+
if (!i)
|
|
503
503
|
return;
|
|
504
504
|
const s = (p) => {
|
|
505
505
|
const l = V.current;
|
|
506
506
|
if (!l)
|
|
507
507
|
return;
|
|
508
508
|
p.preventDefault();
|
|
509
|
-
const b = p.clientX - l.startX, j = p.clientY - l.startY, ot = n.width,
|
|
509
|
+
const b = p.clientX - l.startX, j = p.clientY - l.startY, ot = n.width, it = n.height, K = lt ?? null, { x: X, y: Q, width: W, height: B } = l.initialRect;
|
|
510
510
|
if (l.mode === "move") {
|
|
511
|
-
const
|
|
511
|
+
const at = Math.max(0, ot - W), Pt = Math.max(0, it - B);
|
|
512
512
|
L(
|
|
513
513
|
Y({
|
|
514
|
-
x: Math.max(0, Math.min(
|
|
514
|
+
x: Math.max(0, Math.min(at, X + b)),
|
|
515
515
|
y: Math.max(0, Math.min(Pt, Q + j)),
|
|
516
|
-
width:
|
|
516
|
+
width: W,
|
|
517
517
|
height: B
|
|
518
518
|
})
|
|
519
519
|
);
|
|
520
520
|
return;
|
|
521
521
|
}
|
|
522
522
|
const M = l.mode;
|
|
523
|
-
let
|
|
524
|
-
M.includes("e") && (O =
|
|
523
|
+
let _ = X, Z = Q, O = W, H = B;
|
|
524
|
+
M.includes("e") && (O = W + b), M.includes("w") && (_ = X + b, O = W - b), M.includes("s") && (H = B + j), M.includes("n") && (Z = Q + j, H = B - j), K != null && K > 0 && (M === "e" || M === "w" ? (H = O / K, M.includes("n") && (Z = Q + B - H)) : M === "n" || M === "s" ? (O = H * K, M.includes("w") && (_ = X + W - O)) : (H = O / K, M.includes("n") && (Z = Q + B - H), M.includes("w") && (_ = X + W - O))), L(Y({ x: _, y: Z, width: O, height: H }));
|
|
525
525
|
}, g = () => {
|
|
526
526
|
V.current = null;
|
|
527
527
|
};
|
|
@@ -529,14 +529,14 @@ function Er({
|
|
|
529
529
|
window.removeEventListener("pointermove", s), window.removeEventListener("pointerup", g);
|
|
530
530
|
};
|
|
531
531
|
}, [
|
|
532
|
-
|
|
532
|
+
i,
|
|
533
533
|
n.width,
|
|
534
534
|
n.height,
|
|
535
535
|
lt,
|
|
536
536
|
Y
|
|
537
537
|
]), q(() => {
|
|
538
|
-
|
|
539
|
-
}, [
|
|
538
|
+
i && ut(lt);
|
|
539
|
+
}, [i, lt, n, ut]), /* @__PURE__ */ r(Zt, { open: i, onOpenChange: o, children: /* @__PURE__ */ r(
|
|
540
540
|
te,
|
|
541
541
|
{
|
|
542
542
|
className: "sm:cteditor-max-w-[860px] cteditor-max-w-[calc(100%-2rem)] cteditor-rounded-xl cteditor-overflow-hidden cteditor-p-0",
|
|
@@ -634,10 +634,10 @@ function Er({
|
|
|
634
634
|
{ id: "freeform", label: "Freeform", icon: se },
|
|
635
635
|
{ id: "original", label: "Original", icon: Ge },
|
|
636
636
|
{ id: "1:1", label: "1:1", icon: mr },
|
|
637
|
-
{ id: "4:3", label: "4:3", icon:
|
|
638
|
-
{ id: "16:9", label: "16:9", icon:
|
|
639
|
-
{ id: "3:4", label: "3:4", icon:
|
|
640
|
-
{ id: "9:16", label: "9:16", icon:
|
|
637
|
+
{ id: "4:3", label: "4:3", icon: Wt },
|
|
638
|
+
{ id: "16:9", label: "16:9", icon: Wt },
|
|
639
|
+
{ id: "3:4", label: "3:4", icon: _t },
|
|
640
|
+
{ id: "9:16", label: "9:16", icon: _t }
|
|
641
641
|
].map((s) => {
|
|
642
642
|
const g = s.icon, p = I === s.id;
|
|
643
643
|
return /* @__PURE__ */ f(
|
|
@@ -673,7 +673,7 @@ function Er({
|
|
|
673
673
|
] })
|
|
674
674
|
] })
|
|
675
675
|
] }),
|
|
676
|
-
/* @__PURE__ */ f(
|
|
676
|
+
/* @__PURE__ */ f(ie, { className: "cteditor-gap-2 cteditor-mt-4", children: [
|
|
677
677
|
/* @__PURE__ */ r(
|
|
678
678
|
"button",
|
|
679
679
|
{
|
|
@@ -710,19 +710,19 @@ function Er({
|
|
|
710
710
|
) });
|
|
711
711
|
}
|
|
712
712
|
const Rt = /* @__PURE__ */ new Set(), jt = Be("RIGHT_CLICK_IMAGE_COMMAND");
|
|
713
|
-
function Rr(
|
|
714
|
-
if (!Rt.has(
|
|
713
|
+
function Rr(i) {
|
|
714
|
+
if (!Rt.has(i))
|
|
715
715
|
throw new Promise((o) => {
|
|
716
716
|
const e = new Image();
|
|
717
|
-
e.src =
|
|
718
|
-
Rt.add(
|
|
717
|
+
e.src = i, e.onload = () => {
|
|
718
|
+
Rt.add(i), o(null);
|
|
719
719
|
}, e.onerror = () => {
|
|
720
|
-
Rt.add(
|
|
720
|
+
Rt.add(i);
|
|
721
721
|
};
|
|
722
722
|
});
|
|
723
723
|
}
|
|
724
724
|
function Ir({
|
|
725
|
-
altText:
|
|
725
|
+
altText: i,
|
|
726
726
|
className: o,
|
|
727
727
|
imageRef: e,
|
|
728
728
|
src: d,
|
|
@@ -739,7 +739,7 @@ function Ir({
|
|
|
739
739
|
{
|
|
740
740
|
className: o || void 0,
|
|
741
741
|
src: d,
|
|
742
|
-
alt:
|
|
742
|
+
alt: i,
|
|
743
743
|
ref: e,
|
|
744
744
|
style: v ? {
|
|
745
745
|
width: E,
|
|
@@ -776,7 +776,7 @@ function Pr() {
|
|
|
776
776
|
);
|
|
777
777
|
}
|
|
778
778
|
function Zr({
|
|
779
|
-
src:
|
|
779
|
+
src: i,
|
|
780
780
|
altText: o,
|
|
781
781
|
nodeKey: e,
|
|
782
782
|
width: d,
|
|
@@ -790,29 +790,29 @@ function Zr({
|
|
|
790
790
|
position: c = "none",
|
|
791
791
|
linkUrl: k
|
|
792
792
|
}) {
|
|
793
|
-
const x = G(null), A = G(null), [n, $, N] = $e(e), [L, V] = P(!1), et = G(!1), { isCollabActive: lt } = Ae(), [m] = De(), [Y, ut] = P(null), J = G(null), [rt, xt] = P(!1), vt = Le(), [s, g] = P(!1), [p, l] = P(""), [b, j] = P(!1), [ot,
|
|
793
|
+
const x = G(null), A = G(null), [n, $, N] = $e(e), [L, V] = P(!1), et = G(!1), { isCollabActive: lt } = Ae(), [m] = De(), [Y, ut] = P(null), J = G(null), [rt, xt] = P(!1), vt = Le(), [s, g] = P(!1), [p, l] = P(""), [b, j] = P(!1), [ot, it] = P(!1), [K, X] = P(""), [Q, W] = P(""), [B, M] = P(!1), _ = G(null), [Z, O] = P(0), [H, at] = P(!1), ft = qe()?.apiKey, le = Z > 0 && Z < 350;
|
|
794
794
|
q(() => {
|
|
795
795
|
if (x.current) {
|
|
796
796
|
const t = () => {
|
|
797
797
|
et.current || x.current && O(x.current.offsetWidth);
|
|
798
798
|
};
|
|
799
799
|
t();
|
|
800
|
-
const
|
|
801
|
-
return
|
|
800
|
+
const a = new ResizeObserver(t);
|
|
801
|
+
return a.observe(x.current), () => a.disconnect();
|
|
802
802
|
}
|
|
803
803
|
}, [d, R, n]), Ke(() => {
|
|
804
804
|
if ((c === "left" || c === "right") && typeof d == "number" && x.current) {
|
|
805
|
-
const t = x.current.closest(".editor-image"),
|
|
806
|
-
return t && (t.style.removeProperty("display"), t.style.setProperty("max-width", w, "important")),
|
|
807
|
-
t && (t.style.removeProperty("max-width"), t.style.removeProperty("display")),
|
|
805
|
+
const t = x.current.closest(".editor-image"), a = t?.parentElement, u = m.getRootElement(), h = u ? u.getBoundingClientRect().width : d + 32, w = `${Math.min(d + 32, h)}px`;
|
|
806
|
+
return t && (t.style.removeProperty("display"), t.style.setProperty("max-width", w, "important")), a && a.style.setProperty("max-width", w, "important"), () => {
|
|
807
|
+
t && (t.style.removeProperty("max-width"), t.style.removeProperty("display")), a && a.style.removeProperty("max-width");
|
|
808
808
|
};
|
|
809
809
|
}
|
|
810
810
|
}, [c, d, m]);
|
|
811
811
|
const wt = S(
|
|
812
812
|
(t) => {
|
|
813
|
-
const
|
|
814
|
-
return n && dt(
|
|
815
|
-
|
|
813
|
+
const a = st();
|
|
814
|
+
return n && dt(a) && (t.preventDefault(), m.update(() => {
|
|
815
|
+
a.getNodes().forEach((h) => {
|
|
816
816
|
if (tt(h)) {
|
|
817
817
|
const w = h.getParent();
|
|
818
818
|
h.remove(), w && Et(w) && w.getChildrenSize() === 0 && w.setFormat("left");
|
|
@@ -823,8 +823,8 @@ function Zr({
|
|
|
823
823
|
[m, n]
|
|
824
824
|
), St = S(
|
|
825
825
|
(t) => {
|
|
826
|
-
const
|
|
827
|
-
if (n && dt(
|
|
826
|
+
const a = st(), u = A.current;
|
|
827
|
+
if (n && dt(a) && a.getNodes().length === 1) {
|
|
828
828
|
if (I)
|
|
829
829
|
return bt(null), t.preventDefault(), C.focus(), !0;
|
|
830
830
|
if (u !== null && u !== document.activeElement)
|
|
@@ -836,32 +836,32 @@ function Zr({
|
|
|
836
836
|
), Mt = S(
|
|
837
837
|
(t) => J.current === C || A.current === t.target ? (bt(null), m.update(() => {
|
|
838
838
|
$(!0);
|
|
839
|
-
const
|
|
840
|
-
|
|
839
|
+
const a = m.getRootElement();
|
|
840
|
+
a !== null && a.focus();
|
|
841
841
|
}), !0) : !1,
|
|
842
842
|
[C, m, $]
|
|
843
843
|
), Ct = S(
|
|
844
844
|
(t) => {
|
|
845
|
-
const
|
|
845
|
+
const a = t;
|
|
846
846
|
if (L)
|
|
847
847
|
return !0;
|
|
848
|
-
const u =
|
|
848
|
+
const u = a.target;
|
|
849
849
|
if (u.closest("button") && x.current && u.closest(".editor-image") === x.current.closest(".editor-image"))
|
|
850
850
|
return !0;
|
|
851
851
|
const h = u === x.current;
|
|
852
852
|
let w = !1;
|
|
853
853
|
if (!h && x.current) {
|
|
854
854
|
const F = x.current.getBoundingClientRect();
|
|
855
|
-
w =
|
|
855
|
+
w = a.clientX >= F.left && a.clientX <= F.right && a.clientY >= F.top && a.clientY <= F.bottom;
|
|
856
856
|
}
|
|
857
|
-
return h || w ? (
|
|
857
|
+
return h || w ? (a.shiftKey ? $(!n) : (N(), $(!0)), !0) : !1;
|
|
858
858
|
},
|
|
859
859
|
[L, n, $, N]
|
|
860
860
|
), kt = S(
|
|
861
861
|
(t) => {
|
|
862
862
|
m.getEditorState().read(() => {
|
|
863
|
-
const
|
|
864
|
-
t.target.tagName === "IMG" &&
|
|
863
|
+
const a = st();
|
|
864
|
+
t.target.tagName === "IMG" && We(a) && a.getNodes().length === 1 && m.dispatchCommand(
|
|
865
865
|
jt,
|
|
866
866
|
t
|
|
867
867
|
);
|
|
@@ -871,12 +871,12 @@ function Zr({
|
|
|
871
871
|
);
|
|
872
872
|
q(() => {
|
|
873
873
|
let t = !0;
|
|
874
|
-
const
|
|
874
|
+
const a = m.getRootElement(), u = Te(
|
|
875
875
|
m.registerUpdateListener(({ editorState: h }) => {
|
|
876
876
|
t && ut(h.read(() => st()));
|
|
877
877
|
}),
|
|
878
878
|
m.registerCommand(
|
|
879
|
-
|
|
879
|
+
_e,
|
|
880
880
|
(h, w) => (J.current = w, !1),
|
|
881
881
|
U
|
|
882
882
|
),
|
|
@@ -912,8 +912,8 @@ function Zr({
|
|
|
912
912
|
U
|
|
913
913
|
)
|
|
914
914
|
);
|
|
915
|
-
return
|
|
916
|
-
t = !1, u(),
|
|
915
|
+
return a?.addEventListener("contextmenu", kt), () => {
|
|
916
|
+
t = !1, u(), a?.removeEventListener("contextmenu", kt);
|
|
917
917
|
};
|
|
918
918
|
}, [
|
|
919
919
|
N,
|
|
@@ -933,19 +933,19 @@ function Zr({
|
|
|
933
933
|
const t = ct(e);
|
|
934
934
|
tt(t) && t.setShowCaption(!0);
|
|
935
935
|
});
|
|
936
|
-
}, me = (t,
|
|
936
|
+
}, me = (t, a) => {
|
|
937
937
|
et.current = !1, setTimeout(() => {
|
|
938
938
|
V(!1);
|
|
939
939
|
}, 200), m.update(() => {
|
|
940
940
|
const u = ct(e);
|
|
941
|
-
tt(u) && u.setWidthAndHeight(t,
|
|
941
|
+
tt(u) && u.setWidthAndHeight(t, a);
|
|
942
942
|
});
|
|
943
943
|
}, ge = () => {
|
|
944
944
|
et.current = !0, V(!0);
|
|
945
945
|
}, he = (t) => {
|
|
946
|
-
if (t.preventDefault(), t.stopPropagation(),
|
|
947
|
-
const
|
|
948
|
-
|
|
946
|
+
if (t.preventDefault(), t.stopPropagation(), i.startsWith("data:")) {
|
|
947
|
+
const a = window.open("", "_blank");
|
|
948
|
+
a && (a.document.write(`
|
|
949
949
|
<!DOCTYPE html>
|
|
950
950
|
<html>
|
|
951
951
|
<head>
|
|
@@ -967,38 +967,38 @@ function Zr({
|
|
|
967
967
|
</style>
|
|
968
968
|
</head>
|
|
969
969
|
<body>
|
|
970
|
-
<img src="${
|
|
970
|
+
<img src="${i}" alt="${o || "Image"}" />
|
|
971
971
|
</body>
|
|
972
972
|
</html>
|
|
973
|
-
`),
|
|
973
|
+
`), a.document.close());
|
|
974
974
|
} else
|
|
975
|
-
window.open(
|
|
975
|
+
window.open(i, "_blank");
|
|
976
976
|
}, fe = (t) => {
|
|
977
977
|
t.preventDefault(), t.stopPropagation(), m.update(() => {
|
|
978
|
-
const
|
|
979
|
-
if (tt(
|
|
980
|
-
const u =
|
|
981
|
-
|
|
978
|
+
const a = ct(e);
|
|
979
|
+
if (tt(a)) {
|
|
980
|
+
const u = a.getParent();
|
|
981
|
+
a.remove(), u && Et(u) && u.getChildrenSize() === 0 && u.setFormat("left");
|
|
982
982
|
}
|
|
983
983
|
});
|
|
984
|
-
}, nt = (t,
|
|
984
|
+
}, nt = (t, a) => {
|
|
985
985
|
t.preventDefault(), t.stopPropagation(), m.update(() => {
|
|
986
986
|
const u = ct(e);
|
|
987
987
|
if (tt(u)) {
|
|
988
|
-
u.setPosition(
|
|
988
|
+
u.setPosition(a);
|
|
989
989
|
const h = u.getParent();
|
|
990
|
-
h && Et(h) && (
|
|
990
|
+
h && Et(h) && (a === "left" ? h.setFormat("left") : a === "right" ? h.setFormat("right") : h.setFormat(""));
|
|
991
991
|
}
|
|
992
992
|
});
|
|
993
993
|
}, pe = (t) => {
|
|
994
994
|
t.preventDefault(), t.stopPropagation(), g(!s);
|
|
995
995
|
}, be = S((t) => {
|
|
996
|
-
t.preventDefault(), t.stopPropagation(),
|
|
996
|
+
t.preventDefault(), t.stopPropagation(), at(!0);
|
|
997
997
|
}, []), ye = S(
|
|
998
998
|
async (t) => {
|
|
999
|
-
let
|
|
1000
|
-
if (ht(
|
|
1001
|
-
|
|
999
|
+
let a = i;
|
|
1000
|
+
if (ht(i))
|
|
1001
|
+
a = ce(i);
|
|
1002
1002
|
else {
|
|
1003
1003
|
if (!ft) {
|
|
1004
1004
|
z.error("API key is required to upload and crop external images.");
|
|
@@ -1006,9 +1006,9 @@ function Zr({
|
|
|
1006
1006
|
}
|
|
1007
1007
|
const h = z.loading("Uploading image…");
|
|
1008
1008
|
try {
|
|
1009
|
-
|
|
1009
|
+
a = (await Ve.post(
|
|
1010
1010
|
Je.project.fileUploadFromUrl,
|
|
1011
|
-
{ url:
|
|
1011
|
+
{ url: i, prefix: "uploads" },
|
|
1012
1012
|
{ headers: { "x-api-key": ft } }
|
|
1013
1013
|
)).data.fileUrl, z.dismiss(h);
|
|
1014
1014
|
} catch {
|
|
@@ -1016,8 +1016,8 @@ function Zr({
|
|
|
1016
1016
|
return;
|
|
1017
1017
|
}
|
|
1018
1018
|
}
|
|
1019
|
-
const u = pr(
|
|
1020
|
-
if (u ===
|
|
1019
|
+
const u = pr(a, t);
|
|
1020
|
+
if (u === a) {
|
|
1021
1021
|
z.error("Cropping is only supported for images hosted on the CDN.");
|
|
1022
1022
|
return;
|
|
1023
1023
|
}
|
|
@@ -1030,20 +1030,20 @@ function Zr({
|
|
|
1030
1030
|
w && bt(w.clone());
|
|
1031
1031
|
}), z.success("Image cropped");
|
|
1032
1032
|
},
|
|
1033
|
-
[m, e,
|
|
1033
|
+
[m, e, i, ft]
|
|
1034
1034
|
), xe = S(() => {
|
|
1035
|
-
k && !n && (
|
|
1035
|
+
k && !n && (_.current = setTimeout(() => {
|
|
1036
1036
|
M(!0);
|
|
1037
1037
|
}, 300));
|
|
1038
1038
|
}, [k, n]), ve = S(() => {
|
|
1039
|
-
|
|
1039
|
+
_.current && (clearTimeout(_.current), _.current = null), M(!1);
|
|
1040
1040
|
}, []), zt = S((t) => {
|
|
1041
1041
|
t.preventDefault(), t.stopPropagation(), k && window.open(k, "_blank", "noopener,noreferrer");
|
|
1042
1042
|
}, [k]);
|
|
1043
1043
|
q(() => () => {
|
|
1044
|
-
|
|
1044
|
+
_.current && clearTimeout(_.current);
|
|
1045
1045
|
}, []), q(() => {
|
|
1046
|
-
n ||
|
|
1046
|
+
n || at(!1);
|
|
1047
1047
|
}, [n]);
|
|
1048
1048
|
const At = async () => {
|
|
1049
1049
|
if (!p.trim() || b)
|
|
@@ -1053,7 +1053,7 @@ function Zr({
|
|
|
1053
1053
|
description: "This may take 10-30 seconds. Please wait."
|
|
1054
1054
|
});
|
|
1055
1055
|
try {
|
|
1056
|
-
let
|
|
1056
|
+
let a = p.trim();
|
|
1057
1057
|
const h = p.trim().replace(/^(add|also add|include|with|and)\s+(some|a|an)\s+/gi, "").replace(/^(add|also add|include|with|and)\s+/gi, "").trim(), w = (pt) => {
|
|
1058
1058
|
const Ie = pt.toLowerCase();
|
|
1059
1059
|
return [
|
|
@@ -1080,9 +1080,9 @@ function Zr({
|
|
|
1080
1080
|
w(pt) && o && o !== "Generated image" && o.trim() ? F = o.trim() : F = pt;
|
|
1081
1081
|
} else
|
|
1082
1082
|
o && o !== "Generated image" && o.trim() && (F = o.trim());
|
|
1083
|
-
F ?
|
|
1083
|
+
F ? a = `${F} with ${h}` : a = h;
|
|
1084
1084
|
const Lt = (await dr({
|
|
1085
|
-
content: `Generate Image: ${
|
|
1085
|
+
content: `Generate Image: ${a}`,
|
|
1086
1086
|
apiKey: ft || void 0
|
|
1087
1087
|
}))?.data;
|
|
1088
1088
|
if (!Lt)
|
|
@@ -1093,20 +1093,20 @@ function Zr({
|
|
|
1093
1093
|
const Re = Nt.src;
|
|
1094
1094
|
z.dismiss(t), z.success("Image refined successfully!", {
|
|
1095
1095
|
description: "Compare the images and choose which to keep."
|
|
1096
|
-
}), X(Re),
|
|
1097
|
-
} catch (
|
|
1098
|
-
if (z.dismiss(t),
|
|
1099
|
-
const u =
|
|
1096
|
+
}), X(Re), W(a), it(!0), l(""), g(!1);
|
|
1097
|
+
} catch (a) {
|
|
1098
|
+
if (z.dismiss(t), a instanceof cr) {
|
|
1099
|
+
const u = a.code === "API_KEYS_DISABLED" ? "API Keys Disabled" : "API Key Required";
|
|
1100
1100
|
z.error(u, {
|
|
1101
|
-
description:
|
|
1101
|
+
description: a.message,
|
|
1102
1102
|
duration: 8e3
|
|
1103
1103
|
});
|
|
1104
1104
|
} else
|
|
1105
|
-
|
|
1106
|
-
description:
|
|
1105
|
+
a instanceof lr ? z.error("Credits Issue", {
|
|
1106
|
+
description: a.message,
|
|
1107
1107
|
duration: 8e3
|
|
1108
1108
|
}) : z.error("Failed to refine image", {
|
|
1109
|
-
description:
|
|
1109
|
+
description: a instanceof Error ? a.message : "Unknown error. Please try again."
|
|
1110
1110
|
});
|
|
1111
1111
|
} finally {
|
|
1112
1112
|
j(!1);
|
|
@@ -1116,14 +1116,14 @@ function Zr({
|
|
|
1116
1116
|
const t = ct(e);
|
|
1117
1117
|
if (tt(t)) {
|
|
1118
1118
|
t.setSrc(K), t.setOriginalPrompt(Q);
|
|
1119
|
-
const
|
|
1120
|
-
|
|
1119
|
+
const a = st();
|
|
1120
|
+
a && bt(a.clone());
|
|
1121
1121
|
}
|
|
1122
|
-
}),
|
|
1122
|
+
}), it(!1), X(""), W(""), z.success("Image replaced successfully!", {
|
|
1123
1123
|
description: "The image has been updated with the refined version."
|
|
1124
1124
|
});
|
|
1125
1125
|
}, Ce = () => {
|
|
1126
|
-
|
|
1126
|
+
it(!1), X(""), W("");
|
|
1127
1127
|
}, ke = n && dt(Y) && !L, Dt = (n || L) && vt, Ne = () => c === "left" || c === "right" ? {
|
|
1128
1128
|
position: "relative",
|
|
1129
1129
|
display: "block",
|
|
@@ -1180,7 +1180,7 @@ function Zr({
|
|
|
1180
1180
|
Ir,
|
|
1181
1181
|
{
|
|
1182
1182
|
className: Dt ? `focused ${dt(Y) ? "draggable" : ""}` : k ? "cteditor-cursor-pointer" : null,
|
|
1183
|
-
src:
|
|
1183
|
+
src: i,
|
|
1184
1184
|
altText: o,
|
|
1185
1185
|
imageRef: x,
|
|
1186
1186
|
width: d,
|
|
@@ -1277,7 +1277,7 @@ function Zr({
|
|
|
1277
1277
|
}
|
|
1278
1278
|
),
|
|
1279
1279
|
/* @__PURE__ */ r("div", { className: "cteditor-w-px cteditor-h-5 cteditor-bg-border cteditor-mx-0.5" }),
|
|
1280
|
-
!
|
|
1280
|
+
!i.startsWith("data:") && !i.toLowerCase().endsWith(".svg") && /* @__PURE__ */ r(
|
|
1281
1281
|
"button",
|
|
1282
1282
|
{
|
|
1283
1283
|
onClick: be,
|
|
@@ -1295,7 +1295,7 @@ function Zr({
|
|
|
1295
1295
|
className: " cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded-md cteditor-bg-background/80 hover:cteditor-bg-accent cteditor-transition-colors cteditor-shadow-md cteditor-border cteditor-border-border",
|
|
1296
1296
|
"aria-label": "Visit link",
|
|
1297
1297
|
title: `Visit: ${k}`,
|
|
1298
|
-
children: /* @__PURE__ */ r(
|
|
1298
|
+
children: /* @__PURE__ */ r(ir, {})
|
|
1299
1299
|
}
|
|
1300
1300
|
),
|
|
1301
1301
|
E && /* @__PURE__ */ r(
|
|
@@ -1307,7 +1307,7 @@ function Zr({
|
|
|
1307
1307
|
className: " cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded-md cteditor-bg-background/80 hover:cteditor-bg-accent cteditor-transition-colors cteditor-shadow-md cteditor-border cteditor-border-border",
|
|
1308
1308
|
"aria-label": "Refine image",
|
|
1309
1309
|
title: "Refine image",
|
|
1310
|
-
children: /* @__PURE__ */ r(
|
|
1310
|
+
children: /* @__PURE__ */ r(ar, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-foreground" })
|
|
1311
1311
|
}
|
|
1312
1312
|
),
|
|
1313
1313
|
/* @__PURE__ */ r(
|
|
@@ -1447,7 +1447,7 @@ function Zr({
|
|
|
1447
1447
|
{
|
|
1448
1448
|
"aria-placeholder": "Enter a caption...",
|
|
1449
1449
|
placeholder: () => /* @__PURE__ */ r("span", { className: "cteditor-text-xs", children: "Enter a caption..." }),
|
|
1450
|
-
className: "
|
|
1450
|
+
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"
|
|
1451
1451
|
}
|
|
1452
1452
|
),
|
|
1453
1453
|
ErrorBoundary: Xt
|
|
@@ -1461,7 +1461,7 @@ function Zr({
|
|
|
1461
1461
|
}
|
|
1462
1462
|
),
|
|
1463
1463
|
/* @__PURE__ */ r(Bt, {}),
|
|
1464
|
-
/* @__PURE__ */ r(
|
|
1464
|
+
/* @__PURE__ */ r(ae, { namespace: ne.namespace })
|
|
1465
1465
|
]
|
|
1466
1466
|
}
|
|
1467
1467
|
)
|
|
@@ -1471,8 +1471,8 @@ function Zr({
|
|
|
1471
1471
|
Er,
|
|
1472
1472
|
{
|
|
1473
1473
|
open: H,
|
|
1474
|
-
onOpenChange:
|
|
1475
|
-
src:
|
|
1474
|
+
onOpenChange: at,
|
|
1475
|
+
src: i,
|
|
1476
1476
|
altText: o,
|
|
1477
1477
|
width: d,
|
|
1478
1478
|
height: R,
|
|
@@ -1483,8 +1483,8 @@ function Zr({
|
|
|
1483
1483
|
gr,
|
|
1484
1484
|
{
|
|
1485
1485
|
open: ot,
|
|
1486
|
-
onOpenChange:
|
|
1487
|
-
oldImageUrl:
|
|
1486
|
+
onOpenChange: it,
|
|
1487
|
+
oldImageUrl: i,
|
|
1488
1488
|
newImageUrl: K,
|
|
1489
1489
|
onReplace: we,
|
|
1490
1490
|
onCancel: Ce
|