@softistx/material 3.249.0 → 3.250.0
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/CHANGELOG.md +10 -0
- package/README.md +2 -2
- package/dist/capture-toolbar.css +1 -1
- package/dist/{components-BbAylWQW.js → components-DUvKQIBi.js} +3 -1
- package/dist/components.js +1 -1
- package/dist/embed-chunks/{dist-C-lAK_LC.js → dist-BVPJSDov.js} +1 -1
- package/dist/embed-chunks/{emoji-picker-BWDQFdQu.js → emoji-picker-CrIXB9pF.js} +22 -22
- package/dist/embed-chunks/{mention-list-CdUr0h3X.js → mention-list-9hwOYNND.js} +1 -1
- package/dist/embed-chunks/{nxgt-theme-provider-DdDsiEPj.js → nxgt-theme-provider-Cjl7Eb8v.js} +703 -592
- package/dist/embed-chunks/switch-control-BrwJRN_V.js +207 -0
- package/dist/embed-chunks/{tabs-root-MF9lEHbq.js → tabs-root-BvPc1aaV.js} +5 -5
- package/dist/embed-chunks/{useLatest-RGIW0nya.js → useLatest-CbcU5ozz.js} +322 -322
- package/dist/embed.css +2 -2
- package/dist/embed.js +1266 -740
- package/dist/image-editor.css +1 -1
- package/dist/image-editor.js +902 -1017
- package/dist/lib/components/ui/layout/account-frame/account-frame.d.ts +2 -2
- package/dist/lib/embed/index.d.ts +4 -1
- package/dist/main.js +1 -1
- package/docs/components/navigation-and-layout.md +2 -2
- package/docs/guides/embed.md +44 -0
- package/package.json +1 -1
- package/dist/embed-chunks/bubble-input-yXAeW84_.js +0 -29
- package/dist/embed-chunks/switch-control-B95ZWvna.js +0 -181
package/dist/image-editor.js
CHANGED
|
@@ -1,36 +1,35 @@
|
|
|
1
|
-
import { _ as e, b as t, c as n, f as r, i, m as a, n as o, p as s,
|
|
2
|
-
import { V as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { n as
|
|
1
|
+
import { _ as e, b as t, c as n, f as r, i, m as a, n as o, p as s, u as c } from "./embed-chunks/use-shape-morph-D1MOoQ4T.js";
|
|
2
|
+
import { V as l, W as u, p as d, r as f, t as p } from "./embed-chunks/useLatest-CbcU5ozz.js";
|
|
3
|
+
import { D as m, a as h, b as g, c as _, d as v, f as y, g as b, i as x, j as ee, k as te, l as S, m as ne, n as re, o as C, p as ie, r as ae, s as oe, t as se, u as ce, y as le } from "./embed-chunks/nxgt-theme-provider-Cjl7Eb8v.js";
|
|
4
|
+
import { r as w } from "./embed-chunks/switch-control-BrwJRN_V.js";
|
|
5
|
+
import { n as ue, t as de } from "./embed-chunks/dist-BVPJSDov.js";
|
|
6
6
|
import { n as T } from "./embed-chunks/is-production-Cx8oURag.js";
|
|
7
|
-
import { n as ge } from "./embed-chunks/bubble-input-yXAeW84_.js";
|
|
8
7
|
import * as E from "react";
|
|
9
|
-
import { Fragment as
|
|
8
|
+
import { Fragment as fe, createContext as pe, useCallback as D, useContext as me, useEffect as O, useId as k, useLayoutEffect as he, useMemo as A, useReducer as ge, useRef as j, useState as M, useSyncExternalStore as _e } from "react";
|
|
10
9
|
import { Fragment as N, jsx as P, jsxs as F } from "react/jsx-runtime";
|
|
11
|
-
import { ArrowUpRight as
|
|
12
|
-
import { createSlice as
|
|
13
|
-
import { tickValues as
|
|
10
|
+
import { ArrowUpRight as ve, BringToFront as ye, Check as be, ChevronsLeftRight as xe, Circle as Se, Columns2 as Ce, Copy as we, Crop as Te, Download as Ee, Eraser as De, Eye as Oe, FlipHorizontal2 as ke, FlipVertical2 as Ae, Highlighter as je, ImageOff as Me, Keyboard as Ne, MousePointer2 as Pe, Pen as Fe, PencilLine as Ie, Pin as Le, Plus as Re, Redo2 as ze, RotateCcw as Be, RotateCw as Ve, Settings2 as He, Slash as Ue, SlidersHorizontal as We, Sparkles as Ge, Square as Ke, SquareAsterisk as qe, Trash2 as Je, Type as Ye, Undo2 as Xe, WandSparkles as Ze, X as Qe, ZoomIn as $e, ZoomOut as et } from "lucide-react";
|
|
11
|
+
import { createSlice as tt, current as nt, isDraft as rt } from "@reduxjs/toolkit";
|
|
12
|
+
import { tickValues as it } from "@softistx/material-core/slider-ticks";
|
|
14
13
|
//#region ../../node_modules/@radix-ui/react-use-previous/dist/index.mjs
|
|
15
|
-
var
|
|
14
|
+
var at = Object.defineProperty, ot = (e, t) => at(e, "name", {
|
|
16
15
|
value: t,
|
|
17
16
|
configurable: !0
|
|
18
17
|
});
|
|
19
|
-
function
|
|
18
|
+
function st(e) {
|
|
20
19
|
let t = E.useRef({
|
|
21
20
|
value: e,
|
|
22
21
|
previous: e
|
|
23
22
|
});
|
|
24
23
|
return E.useMemo(() => (t.current.value !== e && (t.current.previous = t.current.value, t.current.value = e), t.current.previous), [e]);
|
|
25
24
|
}
|
|
26
|
-
|
|
25
|
+
ot(st, "usePrevious");
|
|
27
26
|
//#endregion
|
|
28
27
|
//#region ../../node_modules/@radix-ui/react-separator/dist/index.mjs
|
|
29
|
-
var
|
|
28
|
+
var ct = Object.defineProperty, lt = (e, t) => ct(e, "name", {
|
|
30
29
|
value: t,
|
|
31
30
|
configurable: !0
|
|
32
|
-
}),
|
|
33
|
-
let { decorative: n, orientation: r =
|
|
31
|
+
}), ut = "horizontal", dt = ["horizontal", "vertical"], ft = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ lt(function(e, t) {
|
|
32
|
+
let { decorative: n, orientation: r = ut, ...i } = e, o = pt(r) ? r : ut, s = n ? { role: "none" } : {
|
|
34
33
|
"aria-orientation": o === "vertical" ? o : void 0,
|
|
35
34
|
role: "separator"
|
|
36
35
|
};
|
|
@@ -41,19 +40,19 @@ var pt = Object.defineProperty, mt = (e, t) => pt(e, "name", {
|
|
|
41
40
|
ref: t
|
|
42
41
|
});
|
|
43
42
|
}, "Separator"));
|
|
44
|
-
function
|
|
45
|
-
return
|
|
43
|
+
function pt(e) {
|
|
44
|
+
return dt.includes(e);
|
|
46
45
|
}
|
|
47
|
-
|
|
48
|
-
var
|
|
46
|
+
lt(pt, "isValidOrientation");
|
|
47
|
+
var mt = ft, ht = Object.defineProperty, I = (e, t) => ht(e, "name", {
|
|
49
48
|
value: t,
|
|
50
49
|
configurable: !0
|
|
51
|
-
}),
|
|
50
|
+
}), gt = ["PageUp", "PageDown"], _t = [
|
|
52
51
|
"ArrowUp",
|
|
53
52
|
"ArrowDown",
|
|
54
53
|
"ArrowLeft",
|
|
55
54
|
"ArrowRight"
|
|
56
|
-
],
|
|
55
|
+
], vt = {
|
|
57
56
|
"from-left": [
|
|
58
57
|
"Home",
|
|
59
58
|
"PageDown",
|
|
@@ -78,34 +77,34 @@ var yt = _t, bt = Object.defineProperty, I = (e, t) => bt(e, "name", {
|
|
|
78
77
|
"ArrowUp",
|
|
79
78
|
"ArrowLeft"
|
|
80
79
|
]
|
|
81
|
-
},
|
|
82
|
-
let { name: i, min: a = 0, max: o = 100, step: s = 1, orientation:
|
|
80
|
+
}, yt = "Slider", [bt, xt, St] = u(yt), [Ct, wt] = s(yt, [St]), [Tt, Et] = Ct(yt), Dt = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ I(function(e, n) {
|
|
81
|
+
let { name: i, min: a = 0, max: o = 100, step: s = 1, orientation: l = "horizontal", disabled: u = !1, minStepsBetweenThumbs: d = 0, defaultValue: f = [a], value: p, onValueChange: m = /* @__PURE__ */ I(() => {}, "onValueChange"), onValueCommit: h = /* @__PURE__ */ I(() => {}, "onValueCommit"), inverted: g = !1, form: _, ...v } = e, y = E.useRef(/* @__PURE__ */ new Set()), b = E.useRef(0), x = E.useRef(!1), te = l === "horizontal" ? At : jt, [S, ne] = E.useState(null), re = t(n, ne), [C = [], ie] = c({
|
|
83
82
|
prop: p,
|
|
84
83
|
defaultProp: f,
|
|
85
84
|
onChange: /* @__PURE__ */ I((e) => {
|
|
86
|
-
[...
|
|
85
|
+
[...y.current][b.current]?.focus({
|
|
87
86
|
preventScroll: !0,
|
|
88
|
-
focusVisible:
|
|
89
|
-
}),
|
|
87
|
+
focusVisible: x.current
|
|
88
|
+
}), x.current = !1, m(e);
|
|
90
89
|
}, "onChange")
|
|
91
90
|
}), ae = E.useRef(C), oe = E.useRef(C);
|
|
92
91
|
E.useEffect(() => {
|
|
93
|
-
let e = _ ?
|
|
92
|
+
let e = _ ? S?.ownerDocument.getElementById(_) : S?.closest("form");
|
|
94
93
|
if (e instanceof HTMLFormElement) {
|
|
95
94
|
let t = /* @__PURE__ */ I(() => ie(oe.current), "reset");
|
|
96
95
|
return e.addEventListener("reset", t), () => e.removeEventListener("reset", t);
|
|
97
96
|
}
|
|
98
97
|
}, [
|
|
99
|
-
|
|
98
|
+
S,
|
|
100
99
|
_,
|
|
101
100
|
ie
|
|
102
101
|
]);
|
|
103
102
|
function se(e) {
|
|
104
|
-
w(e,
|
|
103
|
+
w(e, Yt(C, e));
|
|
105
104
|
}
|
|
106
105
|
I(se, "handleSlideStart");
|
|
107
106
|
function ce(e) {
|
|
108
|
-
w(e,
|
|
107
|
+
w(e, b.current);
|
|
109
108
|
}
|
|
110
109
|
I(ce, "handleSlideMove");
|
|
111
110
|
function le() {
|
|
@@ -113,38 +112,38 @@ var yt = _t, bt = Object.defineProperty, I = (e, t) => bt(e, "name", {
|
|
|
113
112
|
}
|
|
114
113
|
I(le, "handleSlideEnd");
|
|
115
114
|
function w(e, t, { commit: n } = { commit: !1 }) {
|
|
116
|
-
let r =
|
|
115
|
+
let r = en(s), i = ee(L(Math.round((e - a) / s) * s + a, r), [a, o]);
|
|
117
116
|
ie((e = []) => {
|
|
118
|
-
let r =
|
|
119
|
-
if (
|
|
120
|
-
|
|
117
|
+
let r = Kt(e, i, t);
|
|
118
|
+
if (Qt(r, d * s)) {
|
|
119
|
+
b.current = r.indexOf(i);
|
|
121
120
|
let t = String(r) !== String(e);
|
|
122
121
|
return t && n && h(r), t ? r : e;
|
|
123
122
|
} else return e;
|
|
124
123
|
});
|
|
125
124
|
}
|
|
126
|
-
return I(w, "updateValues"), /* @__PURE__ */ P(
|
|
125
|
+
return I(w, "updateValues"), /* @__PURE__ */ P(Tt, {
|
|
127
126
|
scope: e.__scopeSlider,
|
|
128
127
|
name: i,
|
|
129
128
|
disabled: u,
|
|
130
129
|
min: a,
|
|
131
130
|
max: o,
|
|
132
|
-
valueIndexToChangeRef:
|
|
133
|
-
thumbs:
|
|
131
|
+
valueIndexToChangeRef: b,
|
|
132
|
+
thumbs: y.current,
|
|
134
133
|
values: C,
|
|
135
|
-
orientation:
|
|
134
|
+
orientation: l,
|
|
136
135
|
form: _,
|
|
137
|
-
children: /* @__PURE__ */ P(
|
|
136
|
+
children: /* @__PURE__ */ P(bt.Provider, {
|
|
138
137
|
scope: e.__scopeSlider,
|
|
139
|
-
children: /* @__PURE__ */ P(
|
|
138
|
+
children: /* @__PURE__ */ P(bt.Slot, {
|
|
140
139
|
scope: e.__scopeSlider,
|
|
141
|
-
children: /* @__PURE__ */ P(
|
|
140
|
+
children: /* @__PURE__ */ P(te, {
|
|
142
141
|
"aria-disabled": u,
|
|
143
142
|
"data-disabled": u ? "" : void 0,
|
|
144
|
-
...
|
|
143
|
+
...v,
|
|
145
144
|
ref: re,
|
|
146
|
-
onPointerDown: r(
|
|
147
|
-
u || (ae.current = C,
|
|
145
|
+
onPointerDown: r(v.onPointerDown, () => {
|
|
146
|
+
u || (ae.current = C, x.current = !1);
|
|
148
147
|
}),
|
|
149
148
|
min: a,
|
|
150
149
|
max: o,
|
|
@@ -153,16 +152,16 @@ var yt = _t, bt = Object.defineProperty, I = (e, t) => bt(e, "name", {
|
|
|
153
152
|
onSlideMove: u ? void 0 : ce,
|
|
154
153
|
onSlideEnd: u ? void 0 : le,
|
|
155
154
|
onHomeKeyDown: () => {
|
|
156
|
-
u || (
|
|
155
|
+
u || (x.current = !0, w(a, 0, { commit: !0 }));
|
|
157
156
|
},
|
|
158
157
|
onEndKeyDown: () => {
|
|
159
|
-
u || (
|
|
158
|
+
u || (x.current = !0, w(o, C.length - 1, { commit: !0 }));
|
|
160
159
|
},
|
|
161
160
|
onStepKeyDown: ({ event: e, direction: t }) => {
|
|
162
161
|
if (!u) {
|
|
163
|
-
|
|
164
|
-
let n =
|
|
165
|
-
w(
|
|
162
|
+
x.current = !0;
|
|
163
|
+
let n = gt.includes(e.key) || e.shiftKey && _t.includes(e.key) ? 10 : 1, r = b.current, i = C[r];
|
|
164
|
+
w(tn(i, {
|
|
166
165
|
min: a,
|
|
167
166
|
step: s,
|
|
168
167
|
direction: t,
|
|
@@ -174,24 +173,24 @@ var yt = _t, bt = Object.defineProperty, I = (e, t) => bt(e, "name", {
|
|
|
174
173
|
})
|
|
175
174
|
})
|
|
176
175
|
});
|
|
177
|
-
}, "Slider")), [
|
|
176
|
+
}, "Slider")), [Ot, kt] = Ct(yt, {
|
|
178
177
|
startEdge: "left",
|
|
179
178
|
endEdge: "right",
|
|
180
179
|
size: "width",
|
|
181
180
|
direction: 1
|
|
182
|
-
}),
|
|
183
|
-
let { min: r, max: i, dir: a, inverted: o, onSlideStart: s, onSlideMove: c, onSlideEnd:
|
|
181
|
+
}), At = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ I(function(e, n) {
|
|
182
|
+
let { min: r, max: i, dir: a, inverted: o, onSlideStart: s, onSlideMove: c, onSlideEnd: u, onStepKeyDown: d, ...f } = e, [p, m] = E.useState(null), h = t(n, m), g = E.useRef(void 0), _ = l(a), v = _ === "ltr", y = v && !o || !v && o;
|
|
184
183
|
function b(e) {
|
|
185
|
-
let t = g.current || p.getBoundingClientRect(), n =
|
|
184
|
+
let t = g.current || p.getBoundingClientRect(), n = $t([0, t.width], y ? [r, i] : [i, r]);
|
|
186
185
|
return g.current = t, n(e - t.left);
|
|
187
186
|
}
|
|
188
|
-
return I(b, "getValueFromPointer"), /* @__PURE__ */ P(
|
|
187
|
+
return I(b, "getValueFromPointer"), /* @__PURE__ */ P(Ot, {
|
|
189
188
|
scope: e.__scopeSlider,
|
|
190
189
|
startEdge: y ? "left" : "right",
|
|
191
190
|
endEdge: y ? "right" : "left",
|
|
192
191
|
direction: y ? 1 : -1,
|
|
193
192
|
size: "width",
|
|
194
|
-
children: /* @__PURE__ */ P(
|
|
193
|
+
children: /* @__PURE__ */ P(Mt, {
|
|
195
194
|
dir: _,
|
|
196
195
|
"data-orientation": "horizontal",
|
|
197
196
|
...f,
|
|
@@ -209,10 +208,10 @@ var yt = _t, bt = Object.defineProperty, I = (e, t) => bt(e, "name", {
|
|
|
209
208
|
c?.(t);
|
|
210
209
|
},
|
|
211
210
|
onSlideEnd: () => {
|
|
212
|
-
g.current = void 0,
|
|
211
|
+
g.current = void 0, u?.();
|
|
213
212
|
},
|
|
214
213
|
onStepKeyDown: (e) => {
|
|
215
|
-
let t =
|
|
214
|
+
let t = vt[y ? "from-left" : "from-right"].includes(e.key);
|
|
216
215
|
d?.({
|
|
217
216
|
event: e,
|
|
218
217
|
direction: t ? -1 : 1
|
|
@@ -220,19 +219,19 @@ var yt = _t, bt = Object.defineProperty, I = (e, t) => bt(e, "name", {
|
|
|
220
219
|
}
|
|
221
220
|
})
|
|
222
221
|
});
|
|
223
|
-
}, "SliderHorizontal")),
|
|
222
|
+
}, "SliderHorizontal")), jt = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ I(function(e, n) {
|
|
224
223
|
let { min: r, max: i, inverted: a, onSlideStart: o, onSlideMove: s, onSlideEnd: c, onStepKeyDown: l, ...u } = e, d = E.useRef(null), f = t(n, d), p = E.useRef(void 0), m = !a;
|
|
225
224
|
function h(e) {
|
|
226
|
-
let t = p.current || d.current.getBoundingClientRect(), n =
|
|
225
|
+
let t = p.current || d.current.getBoundingClientRect(), n = $t([0, t.height], m ? [i, r] : [r, i]);
|
|
227
226
|
return p.current = t, n(e - t.top);
|
|
228
227
|
}
|
|
229
|
-
return I(h, "getValueFromPointer"), /* @__PURE__ */ P(
|
|
228
|
+
return I(h, "getValueFromPointer"), /* @__PURE__ */ P(Ot, {
|
|
230
229
|
scope: e.__scopeSlider,
|
|
231
230
|
startEdge: m ? "bottom" : "top",
|
|
232
231
|
endEdge: m ? "top" : "bottom",
|
|
233
232
|
size: "height",
|
|
234
233
|
direction: m ? 1 : -1,
|
|
235
|
-
children: /* @__PURE__ */ P(
|
|
234
|
+
children: /* @__PURE__ */ P(Mt, {
|
|
236
235
|
"data-orientation": "vertical",
|
|
237
236
|
...u,
|
|
238
237
|
ref: f,
|
|
@@ -252,7 +251,7 @@ var yt = _t, bt = Object.defineProperty, I = (e, t) => bt(e, "name", {
|
|
|
252
251
|
p.current = void 0, c?.();
|
|
253
252
|
},
|
|
254
253
|
onStepKeyDown: (e) => {
|
|
255
|
-
let t =
|
|
254
|
+
let t = vt[m ? "from-bottom" : "from-top"].includes(e.key);
|
|
256
255
|
l?.({
|
|
257
256
|
event: e,
|
|
258
257
|
direction: t ? -1 : 1
|
|
@@ -260,13 +259,13 @@ var yt = _t, bt = Object.defineProperty, I = (e, t) => bt(e, "name", {
|
|
|
260
259
|
}
|
|
261
260
|
})
|
|
262
261
|
});
|
|
263
|
-
}, "SliderVertical")),
|
|
264
|
-
let { __scopeSlider: n, onSlideStart: i, onSlideMove: o, onSlideEnd: s, onHomeKeyDown: c, onEndKeyDown: l, onStepKeyDown: u, ...d } = e, f =
|
|
262
|
+
}, "SliderVertical")), Mt = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ I(function(e, t) {
|
|
263
|
+
let { __scopeSlider: n, onSlideStart: i, onSlideMove: o, onSlideEnd: s, onHomeKeyDown: c, onEndKeyDown: l, onStepKeyDown: u, ...d } = e, f = Et(yt, n);
|
|
265
264
|
return /* @__PURE__ */ P(a.span, {
|
|
266
265
|
...d,
|
|
267
266
|
ref: t,
|
|
268
267
|
onKeyDown: r(e.onKeyDown, (e) => {
|
|
269
|
-
e.key === "Home" ? (c(e), e.preventDefault()) : e.key === "End" ? (l(e), e.preventDefault()) :
|
|
268
|
+
e.key === "Home" ? (c(e), e.preventDefault()) : e.key === "End" ? (l(e), e.preventDefault()) : gt.concat(_t).includes(e.key) && (u(e), e.preventDefault());
|
|
270
269
|
}),
|
|
271
270
|
onPointerDown: r(e.onPointerDown, (e) => {
|
|
272
271
|
let t = e.target;
|
|
@@ -283,16 +282,16 @@ var yt = _t, bt = Object.defineProperty, I = (e, t) => bt(e, "name", {
|
|
|
283
282
|
t.hasPointerCapture(e.pointerId) && (t.releasePointerCapture(e.pointerId), s(e));
|
|
284
283
|
})
|
|
285
284
|
});
|
|
286
|
-
}, "SliderImpl")),
|
|
287
|
-
let { __scopeSlider: n, ...r } = e, i =
|
|
285
|
+
}, "SliderImpl")), Nt = "SliderTrack", Pt = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ I(function(e, t) {
|
|
286
|
+
let { __scopeSlider: n, ...r } = e, i = Et(Nt, n);
|
|
288
287
|
return /* @__PURE__ */ P(a.span, {
|
|
289
288
|
"data-disabled": i.disabled ? "" : void 0,
|
|
290
289
|
"data-orientation": i.orientation,
|
|
291
290
|
...r,
|
|
292
291
|
ref: t
|
|
293
292
|
});
|
|
294
|
-
}, "SliderTrack")),
|
|
295
|
-
let { __scopeSlider: r, ...i } = e, o =
|
|
293
|
+
}, "SliderTrack")), Ft = "SliderRange", It = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ I(function(e, n) {
|
|
294
|
+
let { __scopeSlider: r, ...i } = e, o = Et(Ft, r), s = kt(Ft, r), c = t(n, E.useRef(null)), l = o.values.length, u = o.values.map((e) => qt(e, o.min, o.max)), d = l > 1 ? Math.min(...u) : 0, f = 100 - Math.max(...u);
|
|
296
295
|
return /* @__PURE__ */ P(a.span, {
|
|
297
296
|
"data-orientation": o.orientation,
|
|
298
297
|
"data-disabled": o.disabled ? "" : void 0,
|
|
@@ -304,9 +303,9 @@ var yt = _t, bt = Object.defineProperty, I = (e, t) => bt(e, "name", {
|
|
|
304
303
|
[s.endEdge]: f + "%"
|
|
305
304
|
}
|
|
306
305
|
});
|
|
307
|
-
}, "SliderRange")), [
|
|
308
|
-
function
|
|
309
|
-
let { __scopeSlider: t, name: r, children: i, internal_do_not_use_render: a } = e, o =
|
|
306
|
+
}, "SliderRange")), [Lt, Rt] = Ct("SliderThumb"), zt = "SliderThumbProvider";
|
|
307
|
+
function Bt(e) {
|
|
308
|
+
let { __scopeSlider: t, name: r, children: i, internal_do_not_use_render: a } = e, o = Et(zt, t), s = xt(t), [c, l] = E.useState(null), u = E.useMemo(() => c ? s().findIndex((e) => e.ref.current === c) : -1, [s, c]), d = n(c), f = !c || !!o.form || !!c.closest("form"), p = o.values[u], m = r ?? (o.name ? o.name + (o.values.length > 1 ? "[]" : "") : void 0), h = p === void 0 ? 0 : qt(p, o.min, o.max);
|
|
310
309
|
E.useEffect(() => {
|
|
311
310
|
if (c) return o.thumbs.add(c), () => {
|
|
312
311
|
o.thumbs.delete(c);
|
|
@@ -323,22 +322,22 @@ function Gt(e) {
|
|
|
323
322
|
percent: h,
|
|
324
323
|
size: d
|
|
325
324
|
};
|
|
326
|
-
return /* @__PURE__ */ P(
|
|
325
|
+
return /* @__PURE__ */ P(Lt, {
|
|
327
326
|
scope: t,
|
|
328
327
|
...g,
|
|
329
|
-
children:
|
|
328
|
+
children: nn(a) ? a(g) : i
|
|
330
329
|
});
|
|
331
330
|
}
|
|
332
|
-
I(
|
|
333
|
-
var
|
|
334
|
-
let { __scopeSlider: i, ...o } = e, s =
|
|
331
|
+
I(Bt, "SliderThumbProvider");
|
|
332
|
+
var Vt = "SliderThumbTrigger", Ht = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ I(function(e, n) {
|
|
333
|
+
let { __scopeSlider: i, ...o } = e, s = Et(Vt, i), c = kt(Vt, i), { index: l, value: u, percent: d, size: f, onThumbChange: p } = Rt(Vt, i), m = t(n, p), h = Jt(l, s.values.length), g = f?.[c.size], _ = g ? Xt(g, d, c.direction) : 0;
|
|
335
334
|
return /* @__PURE__ */ P("span", {
|
|
336
335
|
style: {
|
|
337
336
|
transform: "var(--radix-slider-thumb-transform)",
|
|
338
337
|
position: "absolute",
|
|
339
338
|
[c.startEdge]: `calc(${d}% + ${_}px)`
|
|
340
339
|
},
|
|
341
|
-
children: /* @__PURE__ */ P(
|
|
340
|
+
children: /* @__PURE__ */ P(bt.ItemSlot, {
|
|
342
341
|
scope: i,
|
|
343
342
|
children: /* @__PURE__ */ P(a.span, {
|
|
344
343
|
role: "slider",
|
|
@@ -359,19 +358,19 @@ var Kt = "SliderThumbTrigger", qt = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */
|
|
|
359
358
|
})
|
|
360
359
|
})
|
|
361
360
|
});
|
|
362
|
-
}, "SliderThumbTrigger")),
|
|
361
|
+
}, "SliderThumbTrigger")), Ut = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ I(function(e, t) {
|
|
363
362
|
let { __scopeSlider: n, name: r, ...i } = e;
|
|
364
|
-
return /* @__PURE__ */ P(
|
|
363
|
+
return /* @__PURE__ */ P(Bt, {
|
|
365
364
|
__scopeSlider: n,
|
|
366
365
|
name: r,
|
|
367
|
-
internal_do_not_use_render: ({ index: e, isFormControl: r }) => /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(
|
|
366
|
+
internal_do_not_use_render: ({ index: e, isFormControl: r }) => /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(Ht, {
|
|
368
367
|
...i,
|
|
369
368
|
ref: t,
|
|
370
369
|
__scopeSlider: n
|
|
371
|
-
}), r ? /* @__PURE__ */ P(
|
|
370
|
+
}), r ? /* @__PURE__ */ P(Gt, { __scopeSlider: n }, e) : null] })
|
|
372
371
|
});
|
|
373
|
-
}, "SliderThumb")),
|
|
374
|
-
let { value: i, name: o, form: s } =
|
|
372
|
+
}, "SliderThumb")), Wt = "SliderBubbleInput", Gt = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ I(function({ __scopeSlider: e, ...n }, r) {
|
|
373
|
+
let { value: i, name: o, form: s } = Rt(Wt, e), c = E.useRef(null), l = t(c, r), u = st(i);
|
|
375
374
|
return E.useEffect(() => {
|
|
376
375
|
let e = c.current;
|
|
377
376
|
if (!e) return;
|
|
@@ -389,52 +388,52 @@ var Kt = "SliderThumbTrigger", qt = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */
|
|
|
389
388
|
defaultValue: i
|
|
390
389
|
});
|
|
391
390
|
}, "SliderBubbleInput"));
|
|
392
|
-
function
|
|
391
|
+
function Kt(e = [], t, n) {
|
|
393
392
|
let r = [...e];
|
|
394
393
|
return r[n] = t, r.sort((e, t) => e - t);
|
|
395
394
|
}
|
|
396
|
-
I(
|
|
397
|
-
function
|
|
398
|
-
return
|
|
395
|
+
I(Kt, "getNextSortedValues");
|
|
396
|
+
function qt(e, t, n) {
|
|
397
|
+
return ee(100 / (n - t) * (e - t), [0, 100]);
|
|
399
398
|
}
|
|
400
|
-
I(
|
|
401
|
-
function
|
|
399
|
+
I(qt, "convertValueToPercentage");
|
|
400
|
+
function Jt(e, t) {
|
|
402
401
|
if (t > 2) return `Value ${e + 1} of ${t}`;
|
|
403
402
|
if (t === 2) return ["Minimum", "Maximum"][e];
|
|
404
403
|
}
|
|
405
|
-
I(
|
|
406
|
-
function
|
|
404
|
+
I(Jt, "getLabel");
|
|
405
|
+
function Yt(e, t) {
|
|
407
406
|
if (e.length === 1) return 0;
|
|
408
407
|
let n = e.map((e) => Math.abs(e - t)), r = Math.min(...n);
|
|
409
408
|
return n.indexOf(r);
|
|
410
409
|
}
|
|
411
|
-
I(
|
|
412
|
-
function
|
|
410
|
+
I(Yt, "getClosestValueIndex");
|
|
411
|
+
function Xt(e, t, n) {
|
|
413
412
|
let r = e / 2;
|
|
414
|
-
return (r -
|
|
413
|
+
return (r - $t([0, 50], [0, r])(t) * n) * n;
|
|
415
414
|
}
|
|
416
|
-
I(
|
|
417
|
-
function
|
|
415
|
+
I(Xt, "getThumbInBoundsOffset");
|
|
416
|
+
function Zt(e) {
|
|
418
417
|
return e.slice(0, -1).map((t, n) => e[n + 1] - t);
|
|
419
418
|
}
|
|
420
|
-
I(
|
|
421
|
-
function
|
|
419
|
+
I(Zt, "getStepsBetweenValues");
|
|
420
|
+
function Qt(e, t) {
|
|
422
421
|
if (t > 0) {
|
|
423
|
-
let n =
|
|
422
|
+
let n = Zt(e);
|
|
424
423
|
return Math.min(...n) >= t;
|
|
425
424
|
}
|
|
426
425
|
return !0;
|
|
427
426
|
}
|
|
428
|
-
I(
|
|
429
|
-
function
|
|
427
|
+
I(Qt, "hasMinStepsBetweenValues");
|
|
428
|
+
function $t(e, t) {
|
|
430
429
|
return (n) => {
|
|
431
430
|
if (e[0] === e[1] || t[0] === t[1]) return t[0];
|
|
432
431
|
let r = (t[1] - t[0]) / (e[1] - e[0]);
|
|
433
432
|
return t[0] + r * (n - e[0]);
|
|
434
433
|
};
|
|
435
434
|
}
|
|
436
|
-
I(
|
|
437
|
-
function
|
|
435
|
+
I($t, "linearScale");
|
|
436
|
+
function en(e) {
|
|
438
437
|
if (!Number.isFinite(e)) return 0;
|
|
439
438
|
let t = e.toString();
|
|
440
439
|
if (t.includes("e")) {
|
|
@@ -444,64 +443,64 @@ function on(e) {
|
|
|
444
443
|
let n = t.split(".")[1];
|
|
445
444
|
return n ? n.length : 0;
|
|
446
445
|
}
|
|
447
|
-
I(
|
|
448
|
-
function
|
|
446
|
+
I(en, "getDecimalCount");
|
|
447
|
+
function L(e, t) {
|
|
449
448
|
let n = 10 ** t;
|
|
450
449
|
return Math.round(e * n) / n;
|
|
451
450
|
}
|
|
452
|
-
I(
|
|
453
|
-
function
|
|
454
|
-
let a =
|
|
455
|
-
return l = c ? s + i * r : r > 0 ? Math.ceil(o) : Math.floor(o),
|
|
451
|
+
I(L, "roundValue");
|
|
452
|
+
function tn(e, { min: t, step: n, direction: r, multiplier: i }) {
|
|
453
|
+
let a = en(n), o = (e - t) / n, s = Math.round(o), c = L(s * n + t, a) === L(e, a), l;
|
|
454
|
+
return l = c ? s + i * r : r > 0 ? Math.ceil(o) : Math.floor(o), L(l * n + t, a);
|
|
456
455
|
}
|
|
457
|
-
I(
|
|
458
|
-
function
|
|
456
|
+
I(tn, "getNextStepValue");
|
|
457
|
+
function nn(e) {
|
|
459
458
|
return typeof e == "function";
|
|
460
459
|
}
|
|
461
|
-
I(
|
|
460
|
+
I(nn, "isFunction");
|
|
462
461
|
//#endregion
|
|
463
462
|
//#region ../../node_modules/react-use/esm/useFirstMountState.js
|
|
464
|
-
function
|
|
463
|
+
function rn() {
|
|
465
464
|
var e = j(!0);
|
|
466
465
|
return e.current ? (e.current = !1, !0) : e.current;
|
|
467
466
|
}
|
|
468
467
|
//#endregion
|
|
469
468
|
//#region ../../node_modules/react-use/esm/useUpdateEffect.js
|
|
470
|
-
var
|
|
471
|
-
var n =
|
|
469
|
+
var an = function(e, t) {
|
|
470
|
+
var n = rn();
|
|
472
471
|
O(function() {
|
|
473
472
|
if (!n) return e();
|
|
474
473
|
}, t);
|
|
475
|
-
},
|
|
476
|
-
function
|
|
477
|
-
return /* @__PURE__ */ P(
|
|
474
|
+
}, on = pe(null);
|
|
475
|
+
function sn({ value: e, children: t }) {
|
|
476
|
+
return /* @__PURE__ */ P(on.Provider, {
|
|
478
477
|
value: e,
|
|
479
478
|
children: t
|
|
480
479
|
});
|
|
481
480
|
}
|
|
482
|
-
function
|
|
483
|
-
let e =
|
|
481
|
+
function R() {
|
|
482
|
+
let e = me(on);
|
|
484
483
|
if (!e) throw Error("ImageEditor parts must be used inside <ImageEditor>");
|
|
485
484
|
return e;
|
|
486
485
|
}
|
|
487
|
-
var
|
|
488
|
-
function
|
|
486
|
+
var cn = (e, t, n) => .2126 * e + .7152 * t + .0722 * n;
|
|
487
|
+
function ln(e, t = 64) {
|
|
489
488
|
let n = Array(t).fill(0), { data: r } = e;
|
|
490
489
|
for (let e = 0; e < r.length; e += 4) {
|
|
491
490
|
if ((r[e + 3] ?? 0) < 8) continue;
|
|
492
|
-
let i =
|
|
491
|
+
let i = cn(r[e] ?? 0, r[e + 1] ?? 0, r[e + 2] ?? 0), a = Math.min(t - 1, Math.floor(i / 256 * t));
|
|
493
492
|
n[a] = (n[a] ?? 0) + 1;
|
|
494
493
|
}
|
|
495
494
|
return n;
|
|
496
495
|
}
|
|
497
|
-
function
|
|
496
|
+
function un(e, t) {
|
|
498
497
|
let n = e.reduce((e, t) => e + t, 0);
|
|
499
498
|
if (n === 0) return .5;
|
|
500
499
|
let r = 0;
|
|
501
500
|
for (let i = 0; i < e.length; i++) if (r += e[i] ?? 0, r / n >= t) return (i + .5) / e.length;
|
|
502
501
|
return 1;
|
|
503
502
|
}
|
|
504
|
-
function
|
|
503
|
+
function dn(e) {
|
|
505
504
|
let { data: t } = e, n = 0, r = 0;
|
|
506
505
|
for (let e = 0; e < t.length; e += 4) {
|
|
507
506
|
let i = t[e] ?? 0, a = t[e + 1] ?? 0, o = t[e + 2] ?? 0, s = Math.max(i, a, o);
|
|
@@ -509,23 +508,23 @@ function _n(e) {
|
|
|
509
508
|
}
|
|
510
509
|
return r ? n / r : 0;
|
|
511
510
|
}
|
|
512
|
-
var
|
|
513
|
-
function
|
|
514
|
-
let t =
|
|
511
|
+
var z = (e, t, n) => Math.round(Math.min(n, Math.max(t, e)));
|
|
512
|
+
function fn(e) {
|
|
513
|
+
let t = ln(e, 128), n = un(t, .02), r = un(t, .98), i = un(t, .5), a = {}, o = z((.5 - i) * 110, -40, 40);
|
|
515
514
|
Math.abs(o) >= 4 && (a.exposure = o);
|
|
516
515
|
let s = r - n;
|
|
517
|
-
s < .88 && (a.contrast =
|
|
518
|
-
let c =
|
|
519
|
-
return c < .35 && (a.vibrance =
|
|
516
|
+
s < .88 && (a.contrast = z((.92 - s) * 90, 0, 35)), r > .97 && (a.highlights = -z((r - .94) * 500, 0, 30)), n < .03 && (a.shadows = z((.06 - n) * 400, 0, 30));
|
|
517
|
+
let c = dn(e);
|
|
518
|
+
return c < .35 && (a.vibrance = z((.4 - c) * 90, 0, 35)), a;
|
|
520
519
|
}
|
|
521
520
|
//#endregion
|
|
522
521
|
//#region lib/components/ui/media/image-editor/image-editor.consts.ts
|
|
523
|
-
var
|
|
522
|
+
var pn = [
|
|
524
523
|
"adjust",
|
|
525
524
|
"filters",
|
|
526
525
|
"crop",
|
|
527
526
|
"markup"
|
|
528
|
-
],
|
|
527
|
+
], B = {
|
|
529
528
|
exposure: 0,
|
|
530
529
|
brightness: 0,
|
|
531
530
|
contrast: 0,
|
|
@@ -541,36 +540,36 @@ var bn = [
|
|
|
541
540
|
vignette: 0,
|
|
542
541
|
grain: 0,
|
|
543
542
|
blur: 0
|
|
544
|
-
},
|
|
543
|
+
}, V = (e, t) => ({
|
|
545
544
|
key: e,
|
|
546
545
|
min: -100,
|
|
547
546
|
max: 100,
|
|
548
547
|
label: t
|
|
549
|
-
}),
|
|
548
|
+
}), mn = (e, t) => ({
|
|
550
549
|
key: e,
|
|
551
550
|
min: 0,
|
|
552
551
|
max: 100,
|
|
553
552
|
label: t
|
|
554
|
-
}),
|
|
553
|
+
}), hn = [
|
|
555
554
|
{
|
|
556
555
|
id: "light",
|
|
557
556
|
label: "Light",
|
|
558
557
|
items: [
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
558
|
+
V("exposure", "Exposure"),
|
|
559
|
+
V("brightness", "Brightness"),
|
|
560
|
+
V("contrast", "Contrast"),
|
|
561
|
+
V("highlights", "Highlights"),
|
|
562
|
+
V("shadows", "Shadows")
|
|
564
563
|
]
|
|
565
564
|
},
|
|
566
565
|
{
|
|
567
566
|
id: "color",
|
|
568
567
|
label: "Colour",
|
|
569
568
|
items: [
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
569
|
+
V("saturation", "Saturation"),
|
|
570
|
+
V("vibrance", "Vibrance"),
|
|
571
|
+
V("warmth", "Warmth"),
|
|
572
|
+
V("tint", "Tint"),
|
|
574
573
|
{
|
|
575
574
|
key: "hue",
|
|
576
575
|
min: -180,
|
|
@@ -583,22 +582,22 @@ var bn = [
|
|
|
583
582
|
id: "effects",
|
|
584
583
|
label: "Effects",
|
|
585
584
|
items: [
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
585
|
+
mn("fade", "Fade"),
|
|
586
|
+
mn("sepia", "Sepia"),
|
|
587
|
+
mn("vignette", "Vignette"),
|
|
588
|
+
mn("grain", "Grain"),
|
|
589
|
+
mn("blur", "Blur")
|
|
591
590
|
]
|
|
592
591
|
}
|
|
593
592
|
];
|
|
594
|
-
|
|
595
|
-
var
|
|
593
|
+
hn.flatMap((e) => e.items);
|
|
594
|
+
var H = {
|
|
596
595
|
x: 0,
|
|
597
596
|
y: 0,
|
|
598
597
|
w: 1,
|
|
599
598
|
h: 1
|
|
600
|
-
},
|
|
601
|
-
adjustments:
|
|
599
|
+
}, U = {
|
|
600
|
+
adjustments: B,
|
|
602
601
|
filter: "none",
|
|
603
602
|
filterIntensity: 100,
|
|
604
603
|
transform: {
|
|
@@ -607,9 +606,9 @@ var V = {
|
|
|
607
606
|
flipY: !1,
|
|
608
607
|
straighten: 0
|
|
609
608
|
},
|
|
610
|
-
crop:
|
|
609
|
+
crop: H,
|
|
611
610
|
annotations: []
|
|
612
|
-
},
|
|
611
|
+
}, gn = [
|
|
613
612
|
{
|
|
614
613
|
id: "free",
|
|
615
614
|
label: "Free",
|
|
@@ -650,7 +649,7 @@ var V = {
|
|
|
650
649
|
label: "9:16",
|
|
651
650
|
value: 9 / 16
|
|
652
651
|
}
|
|
653
|
-
],
|
|
652
|
+
], _n = [
|
|
654
653
|
"#ffffff",
|
|
655
654
|
"#111827",
|
|
656
655
|
"#ef4444",
|
|
@@ -661,17 +660,17 @@ var V = {
|
|
|
661
660
|
"#3b82f6",
|
|
662
661
|
"#8b5cf6",
|
|
663
662
|
"#ec4899"
|
|
664
|
-
],
|
|
663
|
+
], vn = {
|
|
665
664
|
color: "#ef4444",
|
|
666
665
|
size: .012,
|
|
667
666
|
fill: !1,
|
|
668
667
|
background: !0,
|
|
669
668
|
redactMode: "solid"
|
|
670
|
-
},
|
|
669
|
+
}, yn = .002, bn = .06, xn = {
|
|
671
670
|
format: "image/png",
|
|
672
671
|
quality: .92,
|
|
673
672
|
scale: 1
|
|
674
|
-
},
|
|
673
|
+
}, Sn = .1, Cn = [
|
|
675
674
|
.1,
|
|
676
675
|
.25,
|
|
677
676
|
.5,
|
|
@@ -683,24 +682,24 @@ var V = {
|
|
|
683
682
|
4,
|
|
684
683
|
6,
|
|
685
684
|
8
|
|
686
|
-
],
|
|
687
|
-
function
|
|
688
|
-
(t === null || t !== e.historyGroup) && (e.past.push(
|
|
685
|
+
], wn = 1600, W = .04, Tn = (e) => rt(e) ? nt(e) : e;
|
|
686
|
+
function G(e, t, n) {
|
|
687
|
+
(t === null || t !== e.historyGroup) && (e.past.push(Tn(e.edits)), e.past.length > 60 && e.past.shift(), e.future = []), e.historyGroup = t, n(e.edits);
|
|
689
688
|
}
|
|
690
|
-
function
|
|
689
|
+
function En(e) {
|
|
691
690
|
e.selectedId && !e.edits.annotations.some((t) => t.id === e.selectedId) && (e.selectedId = null);
|
|
692
691
|
}
|
|
693
|
-
function
|
|
692
|
+
function Dn(e) {
|
|
694
693
|
let t = e.past.pop();
|
|
695
|
-
t && (e.future.unshift(
|
|
694
|
+
t && (e.future.unshift(Tn(e.edits)), e.edits = t, e.historyGroup = null, En(e));
|
|
696
695
|
}
|
|
697
|
-
function
|
|
696
|
+
function On(e) {
|
|
698
697
|
let t = e.future.shift();
|
|
699
|
-
t && (e.past.push(
|
|
698
|
+
t && (e.past.push(Tn(e.edits)), e.edits = t, e.historyGroup = null, En(e));
|
|
700
699
|
}
|
|
701
700
|
//#endregion
|
|
702
701
|
//#region lib/components/ui/media/image-editor/image-editor.geometry.ts
|
|
703
|
-
function
|
|
702
|
+
function K(e, t) {
|
|
704
703
|
return t % 2 == 0 ? {
|
|
705
704
|
width: e.width,
|
|
706
705
|
height: e.height
|
|
@@ -709,18 +708,18 @@ function G(e, t) {
|
|
|
709
708
|
height: e.width
|
|
710
709
|
};
|
|
711
710
|
}
|
|
712
|
-
function
|
|
711
|
+
function kn(e, t, n) {
|
|
713
712
|
let r = Math.abs(n * Math.PI / 180), i = Math.cos(r), a = Math.sin(r);
|
|
714
713
|
return Math.max((e * i + t * a) / e, (e * a + t * i) / t);
|
|
715
714
|
}
|
|
716
|
-
function
|
|
715
|
+
function An(e, t, n) {
|
|
717
716
|
return n === 1 ? [1 - t, e] : [t, 1 - e];
|
|
718
717
|
}
|
|
719
|
-
function
|
|
720
|
-
let [n, r] =
|
|
721
|
-
return
|
|
718
|
+
function jn(e, t) {
|
|
719
|
+
let [n, r] = An(e.x, e.y, t), [i, a] = An(e.x + e.w, e.y + e.h, t);
|
|
720
|
+
return Nn(n, r, i, a);
|
|
722
721
|
}
|
|
723
|
-
function
|
|
722
|
+
function Mn(e, t) {
|
|
724
723
|
return t === "x" ? {
|
|
725
724
|
...e,
|
|
726
725
|
x: 1 - e.x - e.w
|
|
@@ -729,7 +728,7 @@ function Rn(e, t) {
|
|
|
729
728
|
y: 1 - e.y - e.h
|
|
730
729
|
};
|
|
731
730
|
}
|
|
732
|
-
function
|
|
731
|
+
function Nn(e, t, n, r) {
|
|
733
732
|
return {
|
|
734
733
|
x: Math.min(e, n),
|
|
735
734
|
y: Math.min(t, r),
|
|
@@ -737,64 +736,64 @@ function zn(e, t, n, r) {
|
|
|
737
736
|
h: Math.abs(r - t)
|
|
738
737
|
};
|
|
739
738
|
}
|
|
740
|
-
var
|
|
741
|
-
function
|
|
742
|
-
let t =
|
|
739
|
+
var q = (e, t, n) => Math.min(n, Math.max(t, e));
|
|
740
|
+
function Pn(e) {
|
|
741
|
+
let t = q(e.w, W, 1), n = q(e.h, W, 1);
|
|
743
742
|
return {
|
|
744
|
-
x:
|
|
745
|
-
y:
|
|
743
|
+
x: q(e.x, 0, 1 - t),
|
|
744
|
+
y: q(e.y, 0, 1 - n),
|
|
746
745
|
w: t,
|
|
747
746
|
h: n
|
|
748
747
|
};
|
|
749
748
|
}
|
|
750
|
-
function
|
|
751
|
-
let r = t / (n.width / n.height), i = Math.max(e.w,
|
|
749
|
+
function Fn(e, t, n) {
|
|
750
|
+
let r = t / (n.width / n.height), i = Math.max(e.w, W), a = i / r;
|
|
752
751
|
a > 1 && (a = 1, i = a * r), i > 1 && (i = 1, a = i / r);
|
|
753
752
|
let o = e.x + e.w / 2, s = e.y + e.h / 2;
|
|
754
753
|
return {
|
|
755
|
-
x:
|
|
756
|
-
y:
|
|
754
|
+
x: q(o - i / 2, 0, 1 - i),
|
|
755
|
+
y: q(s - a / 2, 0, 1 - a),
|
|
757
756
|
w: i,
|
|
758
757
|
h: a
|
|
759
758
|
};
|
|
760
759
|
}
|
|
761
|
-
function
|
|
760
|
+
function In(e, t, n) {
|
|
762
761
|
return {
|
|
763
762
|
...e,
|
|
764
|
-
x:
|
|
765
|
-
y:
|
|
763
|
+
x: q(e.x + t, 0, 1 - e.w),
|
|
764
|
+
y: q(e.y + n, 0, 1 - e.h)
|
|
766
765
|
};
|
|
767
766
|
}
|
|
768
|
-
function
|
|
769
|
-
if (t === "move") return
|
|
767
|
+
function Ln(e, t, n, r, i, a) {
|
|
768
|
+
if (t === "move") return In(e, n, r);
|
|
770
769
|
let o = e.x, s = e.y, c = e.x + e.w, l = e.y + e.h;
|
|
771
|
-
t.includes("w") && (o =
|
|
770
|
+
t.includes("w") && (o = q(o + n, 0, c - W)), t.includes("e") && (c = q(c + n, o + W, 1)), t.includes("n") && (s = q(s + r, 0, l - W)), t.includes("s") && (l = q(l + r, s + W, 1));
|
|
772
771
|
let u = {
|
|
773
772
|
x: o,
|
|
774
773
|
y: s,
|
|
775
774
|
w: c - o,
|
|
776
775
|
h: l - s
|
|
777
776
|
};
|
|
778
|
-
return i ?
|
|
777
|
+
return i ? Rn(u, t, i, a) : u;
|
|
779
778
|
}
|
|
780
|
-
function
|
|
779
|
+
function Rn(e, t, n, r) {
|
|
781
780
|
let i = n / (r.width / r.height), a = t === "n" || t === "s", o = a ? e.h * i : e.w, s = a ? e.h : e.w / i, c = e.x + e.w, l = e.y + e.h, u = t.includes("w") ? c : 1 - e.x, d = t.includes("n") ? l : 1 - e.y, f = Math.min(1, u / o, d / s);
|
|
782
781
|
o *= f, s *= f;
|
|
783
782
|
let p = t.includes("w") ? c - o : a ? e.x + (e.w - o) / 2 : e.x, m = t.includes("n") ? l - s : e.y;
|
|
784
783
|
return {
|
|
785
|
-
x:
|
|
786
|
-
y:
|
|
784
|
+
x: q(p, 0, 1 - o),
|
|
785
|
+
y: q(m, 0, 1 - s),
|
|
787
786
|
w: o,
|
|
788
787
|
h: s
|
|
789
788
|
};
|
|
790
789
|
}
|
|
791
|
-
function
|
|
790
|
+
function zn(e) {
|
|
792
791
|
return e.quarterTurns === 0 && !e.flipX && !e.flipY && e.straighten === 0;
|
|
793
792
|
}
|
|
794
793
|
//#endregion
|
|
795
794
|
//#region lib/components/ui/media/image-editor/image-editor.steps.ts
|
|
796
|
-
var
|
|
797
|
-
function
|
|
795
|
+
var Bn = (e, t) => Math.max(22, t.stepFloor ?? 0, e * Math.min(t.width, t.height) * 5);
|
|
796
|
+
function Vn(e) {
|
|
798
797
|
let t = e.flatMap((e) => e.kind === "step" ? [e] : []);
|
|
799
798
|
t.sort((e, t) => e.n - t.n), t.forEach((e, t) => {
|
|
800
799
|
e.n = t + 1;
|
|
@@ -802,7 +801,7 @@ function qn(e) {
|
|
|
802
801
|
}
|
|
803
802
|
//#endregion
|
|
804
803
|
//#region lib/components/ui/media/image-editor/image-editor.annotations.ts
|
|
805
|
-
function
|
|
804
|
+
function J(e, t) {
|
|
806
805
|
switch (e.kind) {
|
|
807
806
|
case "pen":
|
|
808
807
|
case "highlighter": {
|
|
@@ -837,26 +836,26 @@ function q(e, t) {
|
|
|
837
836
|
let [n, r] = t(e.x, e.y), [i, a] = t(e.x + e.w, e.y + e.h);
|
|
838
837
|
return {
|
|
839
838
|
...e,
|
|
840
|
-
...
|
|
839
|
+
...Nn(n, r, i, a)
|
|
841
840
|
};
|
|
842
841
|
}
|
|
843
842
|
}
|
|
844
843
|
}
|
|
845
|
-
function
|
|
846
|
-
return
|
|
844
|
+
function Hn(e, t, n) {
|
|
845
|
+
return J(e, (e, r) => [e + t, r + n]);
|
|
847
846
|
}
|
|
848
|
-
var
|
|
849
|
-
function
|
|
847
|
+
var Un = (e, t) => Math.max(8, e * Math.min(t.width, t.height) * 3.2);
|
|
848
|
+
function Wn(e, t) {
|
|
850
849
|
switch (e.kind) {
|
|
851
850
|
case "pen":
|
|
852
851
|
case "highlighter": {
|
|
853
852
|
let t = e.points.filter((e, t) => t % 2 == 0), n = e.points.filter((e, t) => t % 2 == 1);
|
|
854
|
-
return
|
|
853
|
+
return Nn(Math.min(...t), Math.min(...n), Math.max(...t), Math.max(...n));
|
|
855
854
|
}
|
|
856
855
|
case "line":
|
|
857
|
-
case "arrow": return
|
|
856
|
+
case "arrow": return Nn(e.x1, e.y1, e.x2, e.y2);
|
|
858
857
|
case "step": {
|
|
859
|
-
let n =
|
|
858
|
+
let n = Bn(e.size, t), r = n / t.width, i = n / t.height;
|
|
860
859
|
return {
|
|
861
860
|
x: e.x - r / 2,
|
|
862
861
|
y: e.y - i / 2,
|
|
@@ -865,7 +864,7 @@ function Xn(e, t) {
|
|
|
865
864
|
};
|
|
866
865
|
}
|
|
867
866
|
case "text": {
|
|
868
|
-
let n =
|
|
867
|
+
let n = Un(e.size, t), r = e.text.split("\n"), i = (Math.max(...r.map((e) => e.length), 1) * n * .56 + n * .8) / t.width, a = (r.length * n * 1.25 + n * .4) / t.height;
|
|
869
868
|
return {
|
|
870
869
|
x: e.x,
|
|
871
870
|
y: e.y,
|
|
@@ -881,95 +880,95 @@ function Xn(e, t) {
|
|
|
881
880
|
};
|
|
882
881
|
}
|
|
883
882
|
}
|
|
884
|
-
function
|
|
883
|
+
function Gn(e, t, n, r, i, a) {
|
|
885
884
|
let o = i - n, s = a - r, c = o * o + s * s, l = c === 0 ? 0 : Math.max(0, Math.min(1, ((e - n) * o + (t - r) * s) / c));
|
|
886
885
|
return Math.hypot(e - (n + l * o), t - (r + l * s));
|
|
887
886
|
}
|
|
888
|
-
function
|
|
887
|
+
function Kn(e, t, n, r, i = 6) {
|
|
889
888
|
let a = t * r.width, o = n * r.height, s = e.size * Math.min(r.width, r.height) / 2 + i, c = (e, t) => [e * r.width, t * r.height];
|
|
890
889
|
if (e.kind === "pen" || e.kind === "highlighter") {
|
|
891
890
|
let t = Math.floor(e.points.length / 2);
|
|
892
891
|
for (let n = 0; n < Math.max(1, t - 1); n++) {
|
|
893
892
|
let r = Math.min(n + 1, t - 1), [i, l] = c(e.points[n * 2] ?? 0, e.points[n * 2 + 1] ?? 0), [u, d] = c(e.points[r * 2] ?? 0, e.points[r * 2 + 1] ?? 0);
|
|
894
|
-
if (
|
|
893
|
+
if (Gn(a, o, i, l, u, d) <= s) return !0;
|
|
895
894
|
}
|
|
896
895
|
return !1;
|
|
897
896
|
}
|
|
898
897
|
if (e.kind === "line" || e.kind === "arrow") {
|
|
899
898
|
let [t, n] = c(e.x1, e.y1), [r, i] = c(e.x2, e.y2);
|
|
900
|
-
return
|
|
899
|
+
return Gn(a, o, t, n, r, i) <= s;
|
|
901
900
|
}
|
|
902
901
|
if (e.kind === "step") {
|
|
903
|
-
let t =
|
|
902
|
+
let t = Bn(e.size, r) / 2 + i;
|
|
904
903
|
return Math.hypot(a - e.x * r.width, o - e.y * r.height) <= t;
|
|
905
904
|
}
|
|
906
|
-
let l =
|
|
905
|
+
let l = Wn(e, r), u = i / Math.min(r.width, r.height);
|
|
907
906
|
return t >= l.x - u && t <= l.x + l.w + u && n >= l.y - u && n <= l.y + l.h + u;
|
|
908
907
|
}
|
|
909
|
-
function
|
|
908
|
+
function Y(e, t, n, r) {
|
|
910
909
|
for (let i = e.length - 1; i >= 0; i--) {
|
|
911
910
|
let a = e[i];
|
|
912
|
-
if (a &&
|
|
911
|
+
if (a && Kn(a, t, n, r)) return a;
|
|
913
912
|
}
|
|
914
913
|
}
|
|
915
|
-
var
|
|
916
|
-
function
|
|
917
|
-
return
|
|
914
|
+
var qn = 0;
|
|
915
|
+
function Jn() {
|
|
916
|
+
return qn += 1, `mark-${Date.now().toString(36)}-${qn.toString(36)}`;
|
|
918
917
|
}
|
|
919
|
-
function
|
|
918
|
+
function Yn(e, t) {
|
|
920
919
|
return t ? e.filter((e) => e.id !== t) : e;
|
|
921
920
|
}
|
|
922
921
|
//#endregion
|
|
923
922
|
//#region lib/components/ui/media/image-editor/image-editor.markup-reducers.ts
|
|
924
|
-
var
|
|
925
|
-
function
|
|
923
|
+
var X = (e, t) => e.edits.annotations.findIndex((e) => e.id === t);
|
|
924
|
+
function Xn(e, t) {
|
|
926
925
|
t.color !== void 0 && (e.color = t.color), t.size !== void 0 && (e.size = t.size), t.fill !== void 0 && (e.kind === "rect" || e.kind === "ellipse") && (e.fill = t.fill), t.redactMode !== void 0 && e.kind === "redact" && (e.mode = t.redactMode), t.background !== void 0 && e.kind === "text" && (e.background = t.background);
|
|
927
926
|
}
|
|
928
|
-
var
|
|
927
|
+
var Zn = {
|
|
929
928
|
addAnnotation: (e, t) => {
|
|
930
929
|
let n = { ...t.payload };
|
|
931
|
-
|
|
930
|
+
G(e, null, (t) => {
|
|
932
931
|
n.kind === "step" && (n.n = t.annotations.filter((e) => e.kind === "step").length + 1, e.selectedId = n.id), t.annotations.push(n);
|
|
933
932
|
});
|
|
934
933
|
},
|
|
935
934
|
updateAnnotation: (e, t) => {
|
|
936
|
-
let n =
|
|
937
|
-
n < 0 ||
|
|
935
|
+
let n = X(e, t.payload.annotation.id);
|
|
936
|
+
n < 0 || G(e, t.payload.gesture ?? null, (e) => {
|
|
938
937
|
e.annotations[n] = t.payload.annotation;
|
|
939
938
|
});
|
|
940
939
|
},
|
|
941
940
|
moveAnnotation: (e, t) => {
|
|
942
|
-
let { id: n, dx: r, dy: i, gesture: a } = t.payload, o =
|
|
943
|
-
s &&
|
|
944
|
-
e.annotations[o] =
|
|
941
|
+
let { id: n, dx: r, dy: i, gesture: a } = t.payload, o = X(e, n), s = e.edits.annotations[o];
|
|
942
|
+
s && G(e, a, (e) => {
|
|
943
|
+
e.annotations[o] = Hn(s, r, i);
|
|
945
944
|
});
|
|
946
945
|
},
|
|
947
946
|
removeAnnotation: (e, t) => {
|
|
948
|
-
let n =
|
|
949
|
-
n < 0 || (
|
|
950
|
-
e.annotations.splice(n, 1),
|
|
947
|
+
let n = X(e, t.payload);
|
|
948
|
+
n < 0 || (G(e, null, (e) => {
|
|
949
|
+
e.annotations.splice(n, 1), Vn(e.annotations);
|
|
951
950
|
}), e.selectedId === t.payload && (e.selectedId = null));
|
|
952
951
|
},
|
|
953
952
|
duplicateAnnotation: (e, t) => {
|
|
954
|
-
let n = e.edits.annotations[
|
|
953
|
+
let n = e.edits.annotations[X(e, t.payload)];
|
|
955
954
|
if (!n) return;
|
|
956
955
|
let r = {
|
|
957
|
-
...
|
|
958
|
-
id:
|
|
956
|
+
...Hn(n, .03, .03),
|
|
957
|
+
id: Jn()
|
|
959
958
|
};
|
|
960
|
-
|
|
959
|
+
G(e, null, (e) => {
|
|
961
960
|
r.kind === "step" && (r.n = e.annotations.filter((e) => e.kind === "step").length + 1), e.annotations.push(r);
|
|
962
961
|
}), e.selectedId = r.id;
|
|
963
962
|
},
|
|
964
963
|
bringToFront: (e, t) => {
|
|
965
|
-
let n =
|
|
966
|
-
n < 0 || n === e.edits.annotations.length - 1 ||
|
|
964
|
+
let n = X(e, t.payload);
|
|
965
|
+
n < 0 || n === e.edits.annotations.length - 1 || G(e, null, (e) => {
|
|
967
966
|
let [t] = e.annotations.splice(n, 1);
|
|
968
967
|
t && e.annotations.push(t);
|
|
969
968
|
});
|
|
970
969
|
},
|
|
971
970
|
clearAnnotations: (e) => {
|
|
972
|
-
e.edits.annotations.length !== 0 && (
|
|
971
|
+
e.edits.annotations.length !== 0 && (G(e, null, (e) => {
|
|
973
972
|
e.annotations = [];
|
|
974
973
|
}), e.selectedId = null);
|
|
975
974
|
},
|
|
@@ -978,88 +977,88 @@ var rr = {
|
|
|
978
977
|
},
|
|
979
978
|
setBrush: (e, t) => {
|
|
980
979
|
Object.assign(e.brush, t.payload);
|
|
981
|
-
let n = e.selectedId ?
|
|
982
|
-
n < 0 ||
|
|
980
|
+
let n = e.selectedId ? X(e, e.selectedId) : -1;
|
|
981
|
+
n < 0 || G(e, `style:${e.selectedId}`, (e) => {
|
|
983
982
|
let r = e.annotations[n];
|
|
984
|
-
r &&
|
|
983
|
+
r && Xn(r, t.payload);
|
|
985
984
|
});
|
|
986
985
|
}
|
|
987
|
-
},
|
|
986
|
+
}, Qn = {
|
|
988
987
|
turn: (e, t) => {
|
|
989
988
|
let n = t.payload;
|
|
990
|
-
|
|
989
|
+
G(e, null, (e) => {
|
|
991
990
|
let { transform: t } = e, r = t.flipX === t.flipY ? n : -n;
|
|
992
|
-
t.quarterTurns = ((t.quarterTurns + r) % 4 + 4) % 4, e.crop =
|
|
991
|
+
t.quarterTurns = ((t.quarterTurns + r) % 4 + 4) % 4, e.crop = jn(e.crop, n), e.annotations = e.annotations.map((e) => J(e, (e, t) => An(e, t, n)));
|
|
993
992
|
}), e.aspect !== null && e.aspect !== "original" && (e.aspect = 1 / e.aspect);
|
|
994
993
|
},
|
|
995
994
|
flip: (e, t) => {
|
|
996
995
|
let n = t.payload;
|
|
997
|
-
|
|
998
|
-
n === "x" ? e.transform.flipX = !e.transform.flipX : e.transform.flipY = !e.transform.flipY, e.crop =
|
|
996
|
+
G(e, null, (e) => {
|
|
997
|
+
n === "x" ? e.transform.flipX = !e.transform.flipX : e.transform.flipY = !e.transform.flipY, e.crop = Mn(e.crop, n), e.annotations = e.annotations.map((e) => J(e, (e, t) => n === "x" ? [1 - e, t] : [e, 1 - t]));
|
|
999
998
|
});
|
|
1000
999
|
},
|
|
1001
1000
|
setStraighten: (e, t) => {
|
|
1002
1001
|
let n = Math.min(45, Math.max(-45, t.payload));
|
|
1003
|
-
e.edits.transform.straighten !== n &&
|
|
1002
|
+
e.edits.transform.straighten !== n && G(e, "straighten", (e) => {
|
|
1004
1003
|
e.transform.straighten = n;
|
|
1005
1004
|
});
|
|
1006
1005
|
},
|
|
1007
1006
|
setCrop: (e, t) => {
|
|
1008
|
-
let n =
|
|
1009
|
-
|
|
1007
|
+
let n = Pn(t.payload.rect);
|
|
1008
|
+
G(e, t.payload.gesture ?? null, (e) => {
|
|
1010
1009
|
e.crop = n;
|
|
1011
1010
|
});
|
|
1012
1011
|
},
|
|
1013
1012
|
resetTransform: (e) => {
|
|
1014
1013
|
let { transform: t } = e.edits, n = t.quarterTurns === 0 && !t.flipX && !t.flipY && t.straighten === 0, r = e.edits.crop;
|
|
1015
|
-
n && r.x === 0 && r.y === 0 && r.w === 1 && r.h === 1 || (
|
|
1016
|
-
e.annotations = e.annotations.map((t) =>
|
|
1014
|
+
n && r.x === 0 && r.y === 0 && r.w === 1 && r.h === 1 || (G(e, null, (e) => {
|
|
1015
|
+
e.annotations = e.annotations.map((t) => $n(t, e.transform)), e.transform = U.transform, e.crop = U.crop;
|
|
1017
1016
|
}), e.aspect = null);
|
|
1018
1017
|
}
|
|
1019
1018
|
};
|
|
1020
|
-
function
|
|
1019
|
+
function $n(e, t) {
|
|
1021
1020
|
let n = e;
|
|
1022
|
-
t.flipX && (n =
|
|
1023
|
-
for (let e = 0; e < t.quarterTurns; e++) n =
|
|
1021
|
+
t.flipX && (n = J(n, (e, t) => [1 - e, t])), t.flipY && (n = J(n, (e, t) => [e, 1 - t]));
|
|
1022
|
+
for (let e = 0; e < t.quarterTurns; e++) n = J(n, (e, t) => An(e, t, -1));
|
|
1024
1023
|
return n;
|
|
1025
1024
|
}
|
|
1026
1025
|
//#endregion
|
|
1027
1026
|
//#region lib/components/ui/media/image-editor/image-editor.slice.ts
|
|
1028
|
-
function
|
|
1027
|
+
function er(e) {
|
|
1029
1028
|
return {
|
|
1030
|
-
...
|
|
1029
|
+
...U,
|
|
1031
1030
|
...e,
|
|
1032
1031
|
adjustments: {
|
|
1033
|
-
...
|
|
1032
|
+
...B,
|
|
1034
1033
|
...e?.adjustments
|
|
1035
1034
|
},
|
|
1036
1035
|
transform: {
|
|
1037
|
-
...
|
|
1036
|
+
...U.transform,
|
|
1038
1037
|
...e?.transform
|
|
1039
1038
|
},
|
|
1040
1039
|
crop: {
|
|
1041
|
-
...
|
|
1040
|
+
...U.crop,
|
|
1042
1041
|
...e?.crop
|
|
1043
1042
|
},
|
|
1044
1043
|
annotations: e?.annotations ?? []
|
|
1045
1044
|
};
|
|
1046
1045
|
}
|
|
1047
|
-
var
|
|
1046
|
+
var tr = tt({
|
|
1048
1047
|
name: "imageEditor",
|
|
1049
1048
|
initialState: ((e) => ({
|
|
1050
|
-
edits:
|
|
1049
|
+
edits: U,
|
|
1051
1050
|
past: [],
|
|
1052
1051
|
future: [],
|
|
1053
1052
|
historyGroup: null,
|
|
1054
1053
|
tool: "adjust",
|
|
1055
1054
|
markupTool: "pen",
|
|
1056
|
-
brush:
|
|
1055
|
+
brush: vn,
|
|
1057
1056
|
selectedId: null,
|
|
1058
1057
|
zoom: null,
|
|
1059
1058
|
comparing: !1,
|
|
1060
1059
|
split: !1,
|
|
1061
1060
|
aspect: null,
|
|
1062
|
-
exportOptions:
|
|
1061
|
+
exportOptions: xn,
|
|
1063
1062
|
editingId: null,
|
|
1064
1063
|
shortcutsOpen: !1,
|
|
1065
1064
|
...e
|
|
@@ -1073,48 +1072,48 @@ var sr = ot({
|
|
|
1073
1072
|
},
|
|
1074
1073
|
setAdjustment: (e, t) => {
|
|
1075
1074
|
let { key: n, value: r } = t.payload;
|
|
1076
|
-
e.edits.adjustments[n] !== r &&
|
|
1075
|
+
e.edits.adjustments[n] !== r && G(e, `adjust:${n}`, (e) => {
|
|
1077
1076
|
e.adjustments[n] = r;
|
|
1078
1077
|
});
|
|
1079
1078
|
},
|
|
1080
1079
|
applyAdjustments: (e, t) => {
|
|
1081
|
-
|
|
1080
|
+
G(e, null, (e) => {
|
|
1082
1081
|
Object.assign(e.adjustments, t.payload);
|
|
1083
1082
|
});
|
|
1084
1083
|
},
|
|
1085
1084
|
resetAdjustments: (e) => {
|
|
1086
|
-
|
|
1087
|
-
e.adjustments =
|
|
1085
|
+
G(e, null, (e) => {
|
|
1086
|
+
e.adjustments = B;
|
|
1088
1087
|
});
|
|
1089
1088
|
},
|
|
1090
1089
|
setFilter: (e, t) => {
|
|
1091
|
-
e.edits.filter !== t.payload &&
|
|
1090
|
+
e.edits.filter !== t.payload && G(e, null, (e) => {
|
|
1092
1091
|
e.filter = t.payload, e.filterIntensity = 100;
|
|
1093
1092
|
});
|
|
1094
1093
|
},
|
|
1095
1094
|
setFilterIntensity: (e, t) => {
|
|
1096
|
-
e.edits.filterIntensity !== t.payload &&
|
|
1095
|
+
e.edits.filterIntensity !== t.payload && G(e, "filter-intensity", (e) => {
|
|
1097
1096
|
e.filterIntensity = t.payload;
|
|
1098
1097
|
});
|
|
1099
1098
|
},
|
|
1100
1099
|
setAspect: (e, t) => {
|
|
1101
1100
|
e.aspect = t.payload;
|
|
1102
1101
|
},
|
|
1103
|
-
...
|
|
1104
|
-
...
|
|
1102
|
+
...Qn,
|
|
1103
|
+
...Zn,
|
|
1105
1104
|
resetAll: (e) => {
|
|
1106
|
-
|
|
1105
|
+
G(e, null, (e) => Object.assign(e, U)), e.selectedId = null;
|
|
1107
1106
|
},
|
|
1108
1107
|
endGesture: (e) => {
|
|
1109
1108
|
e.historyGroup = null;
|
|
1110
1109
|
},
|
|
1111
|
-
undo:
|
|
1112
|
-
redo:
|
|
1110
|
+
undo: Dn,
|
|
1111
|
+
redo: On,
|
|
1113
1112
|
clearHistory: (e) => {
|
|
1114
1113
|
e.past = [], e.future = [], e.historyGroup = null;
|
|
1115
1114
|
},
|
|
1116
1115
|
setZoom: (e, t) => {
|
|
1117
|
-
e.zoom = t.payload === null ? null : Math.min(8, Math.max(
|
|
1116
|
+
e.zoom = t.payload === null ? null : Math.min(8, Math.max(Sn, t.payload));
|
|
1118
1117
|
},
|
|
1119
1118
|
setComparing: (e, t) => {
|
|
1120
1119
|
e.comparing = t.payload;
|
|
@@ -1133,36 +1132,36 @@ var sr = ot({
|
|
|
1133
1132
|
}
|
|
1134
1133
|
}
|
|
1135
1134
|
});
|
|
1136
|
-
|
|
1137
|
-
var
|
|
1135
|
+
tr.actions;
|
|
1136
|
+
var nr = {
|
|
1138
1137
|
selectCanUndo: (e) => e.past.length > 0,
|
|
1139
1138
|
selectCanRedo: (e) => e.future.length > 0,
|
|
1140
1139
|
selectSelected: (e) => e.edits.annotations.find((t) => t.id === e.selectedId),
|
|
1141
1140
|
selectIsDirty: (e) => e.past.length > 0,
|
|
1142
1141
|
selectAdjustedCount: (e) => Object.values(e.edits.adjustments).filter((e) => e !== 0).length
|
|
1143
|
-
},
|
|
1144
|
-
function
|
|
1145
|
-
let t =
|
|
1146
|
-
return t.length ? t :
|
|
1142
|
+
}, rr = ["solid", "pixelate"];
|
|
1143
|
+
function ir(e) {
|
|
1144
|
+
let t = rr.filter((t) => e?.includes(t));
|
|
1145
|
+
return t.length ? t : rr;
|
|
1147
1146
|
}
|
|
1148
|
-
function
|
|
1149
|
-
let n =
|
|
1147
|
+
function ar(e, t) {
|
|
1148
|
+
let n = ir(e);
|
|
1150
1149
|
return t && n.includes(t) ? t : n.includes("solid") ? "solid" : n[0] ?? "solid";
|
|
1151
1150
|
}
|
|
1152
|
-
function
|
|
1153
|
-
let n =
|
|
1151
|
+
function or(e, t) {
|
|
1152
|
+
let n = ir(t), r = (e) => e.kind === "redact" && !n.includes(e.mode ?? "solid");
|
|
1154
1153
|
return e.annotations.some(r) ? {
|
|
1155
1154
|
...e,
|
|
1156
1155
|
annotations: e.annotations.map((e) => e.kind === "redact" && r(e) ? {
|
|
1157
1156
|
...e,
|
|
1158
|
-
mode:
|
|
1157
|
+
mode: ar(n, e.mode)
|
|
1159
1158
|
} : e)
|
|
1160
1159
|
} : e;
|
|
1161
1160
|
}
|
|
1162
|
-
function
|
|
1161
|
+
function sr(e) {
|
|
1163
1162
|
return /^#[0-9a-f]{6}$/i.test(e) || /^#[0-9a-f]{3}$/i.test(e) ? e : "#000000";
|
|
1164
1163
|
}
|
|
1165
|
-
function
|
|
1164
|
+
function cr(e, t, n) {
|
|
1166
1165
|
let r = e.getTransform(), i = r.transformPoint({
|
|
1167
1166
|
x: t.x * n.width,
|
|
1168
1167
|
y: t.y * n.height
|
|
@@ -1172,7 +1171,7 @@ function mr(e, t, n) {
|
|
|
1172
1171
|
}), o = Math.min(i.x, a.x), s = Math.min(i.y, a.y), c = Math.max(i.x, a.x), l = Math.max(i.y, a.y), u = t.mode !== "pixelate", [d, f] = u ? [Math.floor, Math.ceil] : [Math.round, Math.round], p = d(o), m = d(s), h = f(c) - p, g = f(l) - m;
|
|
1173
1172
|
if (h < 1 || g < 1) return;
|
|
1174
1173
|
if (u) {
|
|
1175
|
-
e.save(), e.setTransform(1, 0, 0, 1, 0, 0), e.globalAlpha = 1, e.globalCompositeOperation = "source-over", e.fillStyle =
|
|
1174
|
+
e.save(), e.setTransform(1, 0, 0, 1, 0, 0), e.globalAlpha = 1, e.globalCompositeOperation = "source-over", e.fillStyle = sr(t.color), e.fillRect(p, m, h, g), e.restore();
|
|
1176
1175
|
return;
|
|
1177
1176
|
}
|
|
1178
1177
|
let _ = Math.max(6, Math.round(Math.min(e.canvas.width, e.canvas.height) / 48)), v = document.createElement("canvas");
|
|
@@ -1180,14 +1179,14 @@ function mr(e, t, n) {
|
|
|
1180
1179
|
}
|
|
1181
1180
|
//#endregion
|
|
1182
1181
|
//#region lib/components/ui/media/image-editor/image-editor.draw.ts
|
|
1183
|
-
var
|
|
1184
|
-
function
|
|
1182
|
+
var lr = "600 {size}px Inter, \"Segoe UI\", system-ui, sans-serif";
|
|
1183
|
+
function ur(e) {
|
|
1185
1184
|
let t = e.replace("#", ""), n = t.length === 3 ? t.replace(/./g, (e) => e + e) : t, r = Number.parseInt(n.slice(0, 6), 16);
|
|
1186
1185
|
if (Number.isNaN(r)) return !1;
|
|
1187
1186
|
let i = r >> 16 & 255, a = r >> 8 & 255, o = r & 255;
|
|
1188
1187
|
return .299 * i + .587 * a + .114 * o > 160;
|
|
1189
1188
|
}
|
|
1190
|
-
function
|
|
1189
|
+
function dr(e, t, n) {
|
|
1191
1190
|
let r = (e) => [(t[e * 2] ?? 0) * n.width, (t[e * 2 + 1] ?? 0) * n.height], i = Math.floor(t.length / 2), [a, o] = r(0);
|
|
1192
1191
|
e.beginPath(), e.moveTo(a, o), i === 1 && e.lineTo(a + .01, o);
|
|
1193
1192
|
for (let t = 1; t < i - 1; t++) {
|
|
@@ -1196,28 +1195,28 @@ function _r(e, t, n) {
|
|
|
1196
1195
|
}
|
|
1197
1196
|
i > 1 && e.lineTo(...r(i - 1)), e.stroke();
|
|
1198
1197
|
}
|
|
1199
|
-
function
|
|
1198
|
+
function fr(e, t, n, r, i, a) {
|
|
1200
1199
|
let o = Math.atan2(i - n, r - t), s = Math.max(a * 3.6, 12);
|
|
1201
1200
|
e.beginPath(), e.moveTo(r, i), e.lineTo(r - s * Math.cos(o - .45), i - s * Math.sin(o - .45)), e.lineTo(r - s * Math.cos(o + .45), i - s * Math.sin(o + .45)), e.closePath(), e.fill();
|
|
1202
1201
|
}
|
|
1203
|
-
function
|
|
1204
|
-
let r =
|
|
1205
|
-
e.font =
|
|
1202
|
+
function pr(e, t, n) {
|
|
1203
|
+
let r = Un(t.size, n), i = Wn(t, n), a = t.x * n.width, o = t.y * n.height;
|
|
1204
|
+
e.font = lr.replace("{size}", String(r)), e.textBaseline = "top", t.background && (e.fillStyle = ur(t.color) ? "rgba(17,24,39,0.82)" : "rgba(255,255,255,0.9)", e.beginPath(), e.roundRect(a, o, i.w * n.width, i.h * n.height, r * .3), e.fill()), e.fillStyle = t.color, t.text.split("\n").forEach((t, n) => {
|
|
1206
1205
|
e.fillText(t, a + r * .4, o + r * .2 + n * r * 1.25);
|
|
1207
1206
|
});
|
|
1208
1207
|
}
|
|
1209
|
-
function
|
|
1210
|
-
let r =
|
|
1211
|
-
e.beginPath(), e.arc(a, o, r / 2, 0, Math.PI * 2), e.fillStyle = t.color, e.fill(), e.lineWidth = Math.max(1.5, r * .07), e.strokeStyle = i ? "rgba(17,24,39,0.85)" : "rgba(255,255,255,0.95)", e.stroke(), e.font =
|
|
1208
|
+
function mr(e, t, n) {
|
|
1209
|
+
let r = Bn(t.size, n), i = ur(t.color), a = t.x * n.width, o = t.y * n.height;
|
|
1210
|
+
e.beginPath(), e.arc(a, o, r / 2, 0, Math.PI * 2), e.fillStyle = t.color, e.fill(), e.lineWidth = Math.max(1.5, r * .07), e.strokeStyle = i ? "rgba(17,24,39,0.85)" : "rgba(255,255,255,0.95)", e.stroke(), e.font = lr.replace("{size}", String(r * (t.n > 9 ? .45 : .55))), e.textAlign = "center", e.textBaseline = "middle", e.fillStyle = i ? "#111827" : "#ffffff", e.fillText(String(t.n), a, o + r * .03);
|
|
1212
1211
|
}
|
|
1213
|
-
function
|
|
1212
|
+
function hr(e, t, n) {
|
|
1214
1213
|
let r = t.size * Math.min(n.width, n.height);
|
|
1215
1214
|
switch (e.save(), e.lineCap = "round", e.lineJoin = "round", e.strokeStyle = t.color, e.fillStyle = t.color, e.lineWidth = r, t.kind) {
|
|
1216
1215
|
case "pen":
|
|
1217
|
-
|
|
1216
|
+
dr(e, t.points, n);
|
|
1218
1217
|
break;
|
|
1219
1218
|
case "highlighter":
|
|
1220
|
-
e.globalAlpha = .42, e.lineCap = "square", e.lineWidth = r * 2.6,
|
|
1219
|
+
e.globalAlpha = .42, e.lineCap = "square", e.lineWidth = r * 2.6, dr(e, t.points, n);
|
|
1221
1220
|
break;
|
|
1222
1221
|
case "line":
|
|
1223
1222
|
case "arrow": {
|
|
@@ -1227,7 +1226,7 @@ function xr(e, t, n) {
|
|
|
1227
1226
|
t.x2 * n.width,
|
|
1228
1227
|
t.y2 * n.height
|
|
1229
1228
|
];
|
|
1230
|
-
e.beginPath(), e.moveTo(i, a), e.lineTo(o, s), e.stroke(), t.kind === "arrow" &&
|
|
1229
|
+
e.beginPath(), e.moveTo(i, a), e.lineTo(o, s), e.stroke(), t.kind === "arrow" && fr(e, i, a, o, s, r);
|
|
1231
1230
|
break;
|
|
1232
1231
|
}
|
|
1233
1232
|
case "rect":
|
|
@@ -1242,20 +1241,20 @@ function xr(e, t, n) {
|
|
|
1242
1241
|
break;
|
|
1243
1242
|
}
|
|
1244
1243
|
case "text":
|
|
1245
|
-
|
|
1244
|
+
pr(e, t, n);
|
|
1246
1245
|
break;
|
|
1247
1246
|
case "step":
|
|
1248
|
-
|
|
1247
|
+
mr(e, t, n);
|
|
1249
1248
|
break;
|
|
1250
1249
|
case "redact":
|
|
1251
|
-
|
|
1250
|
+
cr(e, t, n);
|
|
1252
1251
|
break;
|
|
1253
1252
|
}
|
|
1254
1253
|
e.restore();
|
|
1255
1254
|
}
|
|
1256
1255
|
//#endregion
|
|
1257
1256
|
//#region lib/components/ui/media/image-editor/image-editor.filters.ts
|
|
1258
|
-
var
|
|
1257
|
+
var gr = [
|
|
1259
1258
|
{
|
|
1260
1259
|
id: "none",
|
|
1261
1260
|
label: "Original",
|
|
@@ -1386,7 +1385,7 @@ var Sr = [
|
|
|
1386
1385
|
highlights: 10
|
|
1387
1386
|
}
|
|
1388
1387
|
}
|
|
1389
|
-
],
|
|
1388
|
+
], _r = {
|
|
1390
1389
|
hue: [-180, 180],
|
|
1391
1390
|
fade: [0, 100],
|
|
1392
1391
|
sepia: [0, 100],
|
|
@@ -1394,33 +1393,33 @@ var Sr = [
|
|
|
1394
1393
|
grain: [0, 100],
|
|
1395
1394
|
blur: [0, 100]
|
|
1396
1395
|
};
|
|
1397
|
-
function
|
|
1398
|
-
let [n, r] =
|
|
1396
|
+
function vr(e, t) {
|
|
1397
|
+
let [n, r] = _r[e] ?? [-100, 100];
|
|
1399
1398
|
return Math.min(r, Math.max(n, t));
|
|
1400
1399
|
}
|
|
1401
|
-
function
|
|
1402
|
-
return
|
|
1400
|
+
function yr(e) {
|
|
1401
|
+
return gr.find((t) => t.id === e);
|
|
1403
1402
|
}
|
|
1404
|
-
function
|
|
1405
|
-
let n =
|
|
1406
|
-
for (let t of Object.keys(i)) i[t] =
|
|
1403
|
+
function br(e, t = e.filter) {
|
|
1404
|
+
let n = yr(t)?.adjustments ?? {}, r = Math.min(1, Math.max(0, e.filterIntensity / 100)), i = { ...B };
|
|
1405
|
+
for (let t of Object.keys(i)) i[t] = vr(t, e.adjustments[t] + (n[t] ?? 0) * r);
|
|
1407
1406
|
return i;
|
|
1408
1407
|
}
|
|
1409
|
-
function
|
|
1408
|
+
function xr(e) {
|
|
1410
1409
|
return Object.values(e).every((e) => e === 0);
|
|
1411
1410
|
}
|
|
1412
1411
|
//#endregion
|
|
1413
1412
|
//#region lib/components/ui/media/image-editor/image-editor.pixels.ts
|
|
1414
|
-
var
|
|
1415
|
-
function
|
|
1413
|
+
var Sr = (e) => e < 0 ? 0 : e > 255 ? 255 : e;
|
|
1414
|
+
function Cr(e) {
|
|
1416
1415
|
let t = /* @__PURE__ */ new Uint8ClampedArray(256), n = 2 ** (e.exposure / 100), r = e.brightness / 100 * 96, i = e.contrast * 2.55, a = 259 * (i + 255) / (255 * (259 - i)), o = e.fade / 100 * .32;
|
|
1417
1416
|
for (let e = 0; e < 256; e++) {
|
|
1418
1417
|
let i = e * n + r;
|
|
1419
|
-
i = a * (i - 128) + 128, i = i * (1 - o) + 255 * o * .42, t[e] =
|
|
1418
|
+
i = a * (i - 128) + 128, i = i * (1 - o) + 255 * o * .42, t[e] = Sr(i);
|
|
1420
1419
|
}
|
|
1421
1420
|
return t;
|
|
1422
1421
|
}
|
|
1423
|
-
function
|
|
1422
|
+
function wr(e) {
|
|
1424
1423
|
let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
|
|
1425
1424
|
return [
|
|
1426
1425
|
.213 + n * .787 - r * .213,
|
|
@@ -1434,103 +1433,103 @@ function Ar(e) {
|
|
|
1434
1433
|
.072 + n * .928 + r * .072
|
|
1435
1434
|
];
|
|
1436
1435
|
}
|
|
1437
|
-
function
|
|
1436
|
+
function Tr(e) {
|
|
1438
1437
|
let t = e + 2654435769 | 0;
|
|
1439
1438
|
return t = Math.imul(t ^ t >>> 16, 2246822507), t = Math.imul(t ^ t >>> 13, 3266489909), t ^= t >>> 16, (t >>> 0) / 4294967296 - .5;
|
|
1440
1439
|
}
|
|
1441
|
-
var
|
|
1442
|
-
function
|
|
1440
|
+
var Er = (e, t, n) => .2126 * e + .7152 * t + .0722 * n;
|
|
1441
|
+
function Dr(e, t, n) {
|
|
1443
1442
|
if (t === 0 && n === 0) return;
|
|
1444
|
-
let r =
|
|
1443
|
+
let r = Er(e[0], e[1], e[2]) / 255, i = n / 100 * 110 * (1 - r) ** 2 + t / 100 * 110 * r ** 2;
|
|
1445
1444
|
e[0] += i, e[1] += i, e[2] += i;
|
|
1446
1445
|
}
|
|
1447
|
-
function
|
|
1446
|
+
function Or(e, t, n) {
|
|
1448
1447
|
if (t.warmth !== 0 && (e[0] += t.warmth / 100 * 38, e[1] += t.warmth / 100 * 8, e[2] -= t.warmth / 100 * 38), t.tint !== 0 && (e[0] += t.tint / 100 * 18, e[1] -= t.tint / 100 * 32, e[2] += t.tint / 100 * 18), n) {
|
|
1449
1448
|
let [t, r, i] = e;
|
|
1450
1449
|
e[0] = n[0] * t + n[1] * r + n[2] * i, e[1] = n[3] * t + n[4] * r + n[5] * i, e[2] = n[6] * t + n[7] * r + n[8] * i;
|
|
1451
1450
|
}
|
|
1452
1451
|
}
|
|
1453
|
-
function
|
|
1452
|
+
function kr(e, t) {
|
|
1454
1453
|
if (t.saturation === 0 && t.vibrance === 0) return;
|
|
1455
|
-
let n =
|
|
1454
|
+
let n = Er(e[0], e[1], e[2]), r = Math.max(e[0], e[1], e[2]), i = Math.min(e[0], e[1], e[2]), a = r <= 0 ? 0 : (r - i) / Math.max(r, 1), o = t.vibrance / 100 * (1 - a) * 1.4, s = Math.max(0, 1 + t.saturation / 100 + o);
|
|
1456
1455
|
e[0] = n + (e[0] - n) * s, e[1] = n + (e[1] - n) * s, e[2] = n + (e[2] - n) * s;
|
|
1457
1456
|
}
|
|
1458
|
-
function
|
|
1457
|
+
function Ar(e, t) {
|
|
1459
1458
|
if (t === 0) return;
|
|
1460
1459
|
let n = t / 100, [r, i, a] = e;
|
|
1461
1460
|
e[0] = r * (1 - n) + n * (.393 * r + .769 * i + .189 * a), e[1] = i * (1 - n) + n * (.349 * r + .686 * i + .168 * a), e[2] = a * (1 - n) + n * (.272 * r + .534 * i + .131 * a);
|
|
1462
1461
|
}
|
|
1463
|
-
function
|
|
1462
|
+
function jr(e, t, n, r, i) {
|
|
1464
1463
|
let a = ((e + .5) / n - .5) * 2, o = ((t + .5) / r - .5) * 2, s = Math.sqrt(a * a + o * o) / Math.SQRT2, c = Math.min(1, Math.max(0, (s - .3) / .75));
|
|
1465
1464
|
return 1 - i / 100 * .85 * c * c * (3 - 2 * c);
|
|
1466
1465
|
}
|
|
1467
|
-
function
|
|
1468
|
-
let { data: n, width: r, height: i } = e, a =
|
|
1466
|
+
function Mr(e, t) {
|
|
1467
|
+
let { data: n, width: r, height: i } = e, a = Cr(t), o = t.hue === 0 ? null : wr(t.hue), s = t.grain / 100 * 70, c = [
|
|
1469
1468
|
0,
|
|
1470
1469
|
0,
|
|
1471
1470
|
0
|
|
1472
1471
|
];
|
|
1473
1472
|
for (let e = 0, l = 0; l < n.length; l += 4, e++) {
|
|
1474
|
-
c[0] = a[n[l] ?? 0] ?? 0, c[1] = a[n[l + 1] ?? 0] ?? 0, c[2] = a[n[l + 2] ?? 0] ?? 0,
|
|
1473
|
+
c[0] = a[n[l] ?? 0] ?? 0, c[1] = a[n[l + 1] ?? 0] ?? 0, c[2] = a[n[l + 2] ?? 0] ?? 0, Dr(c, t.highlights, t.shadows), Or(c, t, o), kr(c, t), Ar(c, t.sepia);
|
|
1475
1474
|
let u = 1;
|
|
1476
|
-
t.vignette > 0 && (u =
|
|
1477
|
-
let d = s > 0 ?
|
|
1478
|
-
n[l] =
|
|
1475
|
+
t.vignette > 0 && (u = jr(e % r, Math.floor(e / r), r, i, t.vignette));
|
|
1476
|
+
let d = s > 0 ? Tr(e) * s : 0;
|
|
1477
|
+
n[l] = Sr(c[0] * u + d), n[l + 1] = Sr(c[1] * u + d), n[l + 2] = Sr(c[2] * u + d);
|
|
1479
1478
|
}
|
|
1480
1479
|
}
|
|
1481
1480
|
//#endregion
|
|
1482
1481
|
//#region lib/components/ui/media/image-editor/image-editor.render.ts
|
|
1483
|
-
function
|
|
1484
|
-
let r =
|
|
1482
|
+
function Nr(e, t, n) {
|
|
1483
|
+
let r = K(t, n.quarterTurns), i = kn(r.width, r.height, n.straighten);
|
|
1485
1484
|
e.translate(r.width / 2, r.height / 2), e.rotate(n.straighten * Math.PI / 180), e.scale(i * (n.flipX ? -1 : 1), i * (n.flipY ? -1 : 1)), e.rotate(n.quarterTurns * Math.PI / 2), e.drawImage(t.image, -t.width / 2, -t.height / 2, t.width, t.height);
|
|
1486
1485
|
}
|
|
1487
|
-
var
|
|
1486
|
+
var Pr = {
|
|
1488
1487
|
x: 0,
|
|
1489
1488
|
y: 0,
|
|
1490
1489
|
w: 1,
|
|
1491
1490
|
h: 1
|
|
1492
1491
|
};
|
|
1493
|
-
function
|
|
1494
|
-
let r =
|
|
1492
|
+
function Fr(e, t, n) {
|
|
1493
|
+
let r = K(e, t.transform.quarterTurns), i = n.region === "crop" ? t.crop : Pr;
|
|
1495
1494
|
return {
|
|
1496
1495
|
width: Math.max(1, Math.round(i.w * r.width * n.scale)),
|
|
1497
1496
|
height: Math.max(1, Math.round(i.h * r.height * n.scale))
|
|
1498
1497
|
};
|
|
1499
1498
|
}
|
|
1500
|
-
function
|
|
1499
|
+
function Ir(e, t) {
|
|
1501
1500
|
let { width: n, height: r } = e.canvas, i = e.getImageData(0, 0, n, r);
|
|
1502
|
-
|
|
1501
|
+
Mr(i, t), e.putImageData(i, 0, 0);
|
|
1503
1502
|
}
|
|
1504
|
-
function
|
|
1505
|
-
let i =
|
|
1503
|
+
function Lr(e, t, n, r) {
|
|
1504
|
+
let i = K(t, n.transform.quarterTurns), a = r.region === "crop" ? n.crop : Pr;
|
|
1506
1505
|
return e.setTransform(r.scale, 0, 0, r.scale, 0, 0), e.translate(-a.x * i.width, -a.y * i.height), i;
|
|
1507
1506
|
}
|
|
1508
|
-
function
|
|
1507
|
+
function Rr(e, t, n, r) {
|
|
1509
1508
|
if (n.annotations.length === 0) return;
|
|
1510
1509
|
e.save();
|
|
1511
1510
|
let i = {
|
|
1512
|
-
...
|
|
1511
|
+
...Lr(e, t, n, r),
|
|
1513
1512
|
stepFloor: r.stepFloor
|
|
1514
1513
|
};
|
|
1515
|
-
for (let t of n.annotations)
|
|
1514
|
+
for (let t of n.annotations) hr(e, t, i);
|
|
1516
1515
|
e.restore();
|
|
1517
1516
|
}
|
|
1518
|
-
function
|
|
1519
|
-
let r = n.edited ?? !0, i =
|
|
1517
|
+
function zr(e, t, n) {
|
|
1518
|
+
let r = n.edited ?? !0, i = Fr(e, t, n), a = n.target ?? document.createElement("canvas");
|
|
1520
1519
|
a.width = i.width, a.height = i.height;
|
|
1521
1520
|
let o = a.getContext("2d", { willReadFrequently: !0 });
|
|
1522
1521
|
if (!o) return a;
|
|
1523
|
-
let s =
|
|
1524
|
-
if (o.save(), o.imageSmoothingQuality = "high",
|
|
1522
|
+
let s = br(t, n.filter);
|
|
1523
|
+
if (o.save(), o.imageSmoothingQuality = "high", Lr(o, e, t, n), r && s.blur > 0 && "filter" in o) {
|
|
1525
1524
|
let e = Math.min(i.width, i.height);
|
|
1526
1525
|
o.filter = `blur(${(s.blur / 100 * .012 * e).toFixed(2)}px)`;
|
|
1527
1526
|
}
|
|
1528
|
-
return
|
|
1527
|
+
return Nr(o, e, t.transform), o.restore(), r && !xr({
|
|
1529
1528
|
...s,
|
|
1530
1529
|
blur: 0
|
|
1531
|
-
}) &&
|
|
1530
|
+
}) && Ir(o, s), r && (n.marks ?? !0) && Rr(o, e, t, n), a;
|
|
1532
1531
|
}
|
|
1533
|
-
function
|
|
1532
|
+
function Br(e, t) {
|
|
1534
1533
|
let n = Math.min(1, t / Math.max(e.width, e.height));
|
|
1535
1534
|
if (n === 1) return e;
|
|
1536
1535
|
let r = document.createElement("canvas");
|
|
@@ -1542,7 +1541,7 @@ function Kr(e, t) {
|
|
|
1542
1541
|
height: r.height
|
|
1543
1542
|
};
|
|
1544
1543
|
}
|
|
1545
|
-
function
|
|
1544
|
+
function Vr(e) {
|
|
1546
1545
|
try {
|
|
1547
1546
|
let t = document.createElement("canvas");
|
|
1548
1547
|
t.width = 1, t.height = 1;
|
|
@@ -1554,12 +1553,12 @@ function qr(e) {
|
|
|
1554
1553
|
}
|
|
1555
1554
|
//#endregion
|
|
1556
1555
|
//#region lib/components/ui/media/image-editor/use-sample-pixels.ts
|
|
1557
|
-
var
|
|
1558
|
-
function
|
|
1559
|
-
return A(() => e ?
|
|
1556
|
+
var Hr = 200;
|
|
1557
|
+
function Ur(e) {
|
|
1558
|
+
return A(() => e ? Br(e, Hr) : null, [e]);
|
|
1560
1559
|
}
|
|
1561
|
-
function
|
|
1562
|
-
let r =
|
|
1560
|
+
function Wr(e, t, n = !0) {
|
|
1561
|
+
let r = zr(e, t, {
|
|
1563
1562
|
scale: 1,
|
|
1564
1563
|
region: "crop",
|
|
1565
1564
|
edited: n,
|
|
@@ -1567,35 +1566,35 @@ function Xr(e, t, n = !0) {
|
|
|
1567
1566
|
}), i = r.getContext("2d", { willReadFrequently: !0 });
|
|
1568
1567
|
return i ? i.getImageData(0, 0, r.width, r.height) : null;
|
|
1569
1568
|
}
|
|
1570
|
-
function
|
|
1569
|
+
function Gr(e, t) {
|
|
1571
1570
|
let [n, r] = M(null);
|
|
1572
1571
|
return O(() => {
|
|
1573
1572
|
if (!e) return;
|
|
1574
|
-
let n = requestAnimationFrame(() => r(
|
|
1573
|
+
let n = requestAnimationFrame(() => r(Wr(e, t)));
|
|
1575
1574
|
return () => cancelAnimationFrame(n);
|
|
1576
1575
|
}, [e, t]), n;
|
|
1577
1576
|
}
|
|
1578
1577
|
//#endregion
|
|
1579
1578
|
//#region lib/components/ui/media/image-editor/partials/adjust-tracks.ts
|
|
1580
|
-
var
|
|
1581
|
-
exposure: `bg-linear-to-r from-zinc-900 via-zinc-500 to-zinc-50 ${
|
|
1582
|
-
brightness: `bg-linear-to-r from-zinc-800 via-zinc-500 to-zinc-100 ${
|
|
1583
|
-
warmth: `bg-linear-to-r from-sky-500 via-zinc-300 to-amber-400 ${
|
|
1584
|
-
tint: `bg-linear-to-r from-green-500 via-zinc-300 to-fuchsia-500 ${
|
|
1585
|
-
saturation: `bg-linear-to-r from-zinc-400 via-rose-300 to-rose-600 ${
|
|
1586
|
-
vibrance: `bg-linear-to-r from-zinc-400 via-violet-300 to-violet-600 ${
|
|
1587
|
-
hue: `bg-[linear-gradient(to_right,#06b6d4,#3b82f6,#a855f7,#ef4444,#f59e0b,#84cc16,#06b6d4)] ${
|
|
1579
|
+
var Z = "[&>[data-slot=slider-range]]:hidden", Kr = {
|
|
1580
|
+
exposure: `bg-linear-to-r from-zinc-900 via-zinc-500 to-zinc-50 ${Z}`,
|
|
1581
|
+
brightness: `bg-linear-to-r from-zinc-800 via-zinc-500 to-zinc-100 ${Z}`,
|
|
1582
|
+
warmth: `bg-linear-to-r from-sky-500 via-zinc-300 to-amber-400 ${Z}`,
|
|
1583
|
+
tint: `bg-linear-to-r from-green-500 via-zinc-300 to-fuchsia-500 ${Z}`,
|
|
1584
|
+
saturation: `bg-linear-to-r from-zinc-400 via-rose-300 to-rose-600 ${Z}`,
|
|
1585
|
+
vibrance: `bg-linear-to-r from-zinc-400 via-violet-300 to-violet-600 ${Z}`,
|
|
1586
|
+
hue: `bg-[linear-gradient(to_right,#06b6d4,#3b82f6,#a855f7,#ef4444,#f59e0b,#84cc16,#06b6d4)] ${Z}`
|
|
1588
1587
|
};
|
|
1589
1588
|
//#endregion
|
|
1590
1589
|
//#region lib/components/ui/fields/slider/slider-math.ts
|
|
1591
|
-
function
|
|
1590
|
+
function qr(e, t, n) {
|
|
1592
1591
|
let r = n - t || 1;
|
|
1593
1592
|
return Math.min(100, Math.max(0, (e - t) / r * 100));
|
|
1594
1593
|
}
|
|
1595
|
-
function
|
|
1594
|
+
function Jr(e, t) {
|
|
1596
1595
|
return Array.isArray(e) ? e : [t];
|
|
1597
1596
|
}
|
|
1598
|
-
function
|
|
1597
|
+
function Yr({ thumbs: e, min: t, origin: n, vertical: r }) {
|
|
1599
1598
|
let i = e[0] ?? t, a = e[e.length - 1] ?? t, o = n !== void 0 && e.length === 1 && !r, [s, c] = o ? [Math.min(n, i), Math.max(n, i)] : [e.length > 1 ? i : t, a];
|
|
1600
1599
|
return {
|
|
1601
1600
|
fromOrigin: o,
|
|
@@ -1603,13 +1602,13 @@ function ti({ thumbs: e, min: t, origin: n, vertical: r }) {
|
|
|
1603
1602
|
to: c
|
|
1604
1603
|
};
|
|
1605
1604
|
}
|
|
1606
|
-
function
|
|
1605
|
+
function Xr(e, t) {
|
|
1607
1606
|
return t ? 100 - e : e;
|
|
1608
1607
|
}
|
|
1609
1608
|
//#endregion
|
|
1610
1609
|
//#region lib/components/ui/fields/slider/slider-thumb.tsx
|
|
1611
|
-
function
|
|
1612
|
-
return /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(
|
|
1610
|
+
function Zr({ index: e, bubble: t, ...n }) {
|
|
1611
|
+
return /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(Ut, {
|
|
1613
1612
|
"data-slot": "slider-thumb",
|
|
1614
1613
|
"data-index": e,
|
|
1615
1614
|
"data-nxgt-state-layer": "",
|
|
@@ -1623,12 +1622,12 @@ function ri({ index: e, bubble: t, ...n }) {
|
|
|
1623
1622
|
}
|
|
1624
1623
|
//#endregion
|
|
1625
1624
|
//#region lib/components/ui/fields/slider/slider-thumbs.tsx
|
|
1626
|
-
var
|
|
1627
|
-
function
|
|
1628
|
-
return e.map((p, m) => /* @__PURE__ */ P(
|
|
1625
|
+
var Qr = "block shrink-0 cursor-pointer forced-colors:focus-visible:outline-solid forced-colors:focus-visible:outline-2 forced-colors:focus-visible:outline-offset-2 forced-colors:focus-visible:outline-[Highlight]";
|
|
1626
|
+
function $r({ thumbs: e, min: t, max: n, inverted: r, shown: i, valueBubble: a, formatValue: o, thumbId: s, nameIds: c, name: l, required: u, invalid: d, describedBy: f }) {
|
|
1627
|
+
return e.map((p, m) => /* @__PURE__ */ P(Zr, {
|
|
1629
1628
|
index: m,
|
|
1630
1629
|
bubble: a && i === m ? {
|
|
1631
|
-
at:
|
|
1630
|
+
at: Xr(qr(p, t, n), r),
|
|
1632
1631
|
text: o(p)
|
|
1633
1632
|
} : null,
|
|
1634
1633
|
id: `${s}-${m}`,
|
|
@@ -1637,12 +1636,12 @@ function ai({ thumbs: e, min: t, max: n, inverted: r, shown: i, valueBubble: a,
|
|
|
1637
1636
|
"aria-invalid": d || void 0,
|
|
1638
1637
|
"aria-describedby": f,
|
|
1639
1638
|
"data-pw": l ? `${l}-thumb-${m}` : "slider-thumb",
|
|
1640
|
-
className:
|
|
1639
|
+
className: Qr
|
|
1641
1640
|
}, `item-${m.toString()}`));
|
|
1642
1641
|
}
|
|
1643
1642
|
//#endregion
|
|
1644
1643
|
//#region lib/components/ui/fields/slider/slider-icon.tsx
|
|
1645
|
-
function
|
|
1644
|
+
function ei({ children: e }) {
|
|
1646
1645
|
return /* @__PURE__ */ P("span", {
|
|
1647
1646
|
"data-slot": "slider-icon-area",
|
|
1648
1647
|
"aria-hidden": "true",
|
|
@@ -1654,8 +1653,8 @@ function oi({ children: e }) {
|
|
|
1654
1653
|
}
|
|
1655
1654
|
//#endregion
|
|
1656
1655
|
//#region lib/components/ui/fields/slider/slider-origin-range.tsx
|
|
1657
|
-
function
|
|
1658
|
-
return /* @__PURE__ */ P(
|
|
1656
|
+
function ti({ from: e, to: t }) {
|
|
1657
|
+
return /* @__PURE__ */ P(w, {
|
|
1659
1658
|
reason: "The origin range is placed by an inline style",
|
|
1660
1659
|
children: /* @__PURE__ */ P("span", {
|
|
1661
1660
|
"data-slot": "slider-range",
|
|
@@ -1670,7 +1669,7 @@ function si({ from: e, to: t }) {
|
|
|
1670
1669
|
}
|
|
1671
1670
|
//#endregion
|
|
1672
1671
|
//#region lib/components/ui/fields/slider/slider-stops.tsx
|
|
1673
|
-
function
|
|
1672
|
+
function ni({ marks: e, isOn: t }) {
|
|
1674
1673
|
return /* @__PURE__ */ P("span", {
|
|
1675
1674
|
"data-slot": "slider-stops",
|
|
1676
1675
|
"aria-hidden": "true",
|
|
@@ -1682,22 +1681,22 @@ function ci({ marks: e, isOn: t }) {
|
|
|
1682
1681
|
}
|
|
1683
1682
|
//#endregion
|
|
1684
1683
|
//#region lib/components/ui/fields/slider/slider-track.tsx
|
|
1685
|
-
function
|
|
1684
|
+
function ri({ className: e, min: t, max: n, fill: r, marks: i, icon: a }) {
|
|
1686
1685
|
let { fromOrigin: o, from: s, to: c } = r;
|
|
1687
|
-
return /* @__PURE__ */ F(
|
|
1686
|
+
return /* @__PURE__ */ F(Pt, {
|
|
1688
1687
|
"data-slot": "slider-track",
|
|
1689
1688
|
className: T("relative grow cursor-pointer", e),
|
|
1690
1689
|
children: [
|
|
1691
|
-
/* @__PURE__ */ P(
|
|
1690
|
+
/* @__PURE__ */ P(It, {
|
|
1692
1691
|
"data-slot": "slider-range",
|
|
1693
1692
|
className: T("absolute", o && "hidden")
|
|
1694
1693
|
}),
|
|
1695
|
-
o && /* @__PURE__ */ P(
|
|
1696
|
-
from:
|
|
1697
|
-
to:
|
|
1694
|
+
o && /* @__PURE__ */ P(ti, {
|
|
1695
|
+
from: qr(s, t, n),
|
|
1696
|
+
to: qr(c, t, n)
|
|
1698
1697
|
}),
|
|
1699
|
-
a != null && /* @__PURE__ */ P(
|
|
1700
|
-
i.length > 0 && /* @__PURE__ */ P(
|
|
1698
|
+
a != null && /* @__PURE__ */ P(ei, { children: a }),
|
|
1699
|
+
i.length > 0 && /* @__PURE__ */ P(ni, {
|
|
1701
1700
|
marks: i,
|
|
1702
1701
|
isOn: (e) => e >= s && e <= c
|
|
1703
1702
|
})
|
|
@@ -1706,7 +1705,7 @@ function li({ className: e, min: t, max: n, fill: r, marks: i, icon: a }) {
|
|
|
1706
1705
|
}
|
|
1707
1706
|
//#endregion
|
|
1708
1707
|
//#region lib/components/ui/fields/slider/slider-thumb-names.ts
|
|
1709
|
-
function
|
|
1708
|
+
function ii({ thumbId: e, labelId: t, ariaLabel: n, ariaLabelledBy: r, hiddenLabel: i }) {
|
|
1710
1709
|
let a = r ? void 0 : n || i, o = a ? `${e}-name` : void 0;
|
|
1711
1710
|
return {
|
|
1712
1711
|
nameIds: r || o || t,
|
|
@@ -1716,7 +1715,7 @@ function ui({ thumbId: e, labelId: t, ariaLabel: n, ariaLabelledBy: r, hiddenLab
|
|
|
1716
1715
|
}
|
|
1717
1716
|
//#endregion
|
|
1718
1717
|
//#region lib/components/ui/fields/slider/split-slider-props.ts
|
|
1719
|
-
function
|
|
1718
|
+
function ai({ defaultValue: e, value: t, min: n = 0, max: r = 100, step: i, ticks: a = !1, required: o, labelId: s, hiddenLabel: c, origin: l, trackClassName: u, formatValue: d = String, valueBubble: f = !0, size: p = "default", icon: m, inverted: h = !1, onValueChange: g, className: _, "aria-label": v, "aria-labelledby": y, "aria-invalid": b, "aria-describedby": x, onPointerDown: ee, onFocus: te, onBlur: S, ...ne }) {
|
|
1720
1719
|
return {
|
|
1721
1720
|
own: {
|
|
1722
1721
|
defaultValue: e,
|
|
@@ -1745,18 +1744,18 @@ function di({ defaultValue: e, value: t, min: n = 0, max: r = 100, step: i, tick
|
|
|
1745
1744
|
describedBy: x
|
|
1746
1745
|
},
|
|
1747
1746
|
handlers: {
|
|
1748
|
-
onPointerDown:
|
|
1749
|
-
onFocus:
|
|
1750
|
-
onBlur:
|
|
1747
|
+
onPointerDown: ee,
|
|
1748
|
+
onFocus: te,
|
|
1749
|
+
onBlur: S
|
|
1751
1750
|
},
|
|
1752
1751
|
rest: ne
|
|
1753
1752
|
};
|
|
1754
1753
|
}
|
|
1755
1754
|
//#endregion
|
|
1756
1755
|
//#region lib/components/ui/fields/slider/use-slider-chrome.ts
|
|
1757
|
-
function
|
|
1756
|
+
function oi({ percents: e, disabled: t, handlers: n }) {
|
|
1758
1757
|
let r = j(null), [i, a] = M(!1), [o, s] = M(null), c = e.join(",");
|
|
1759
|
-
|
|
1758
|
+
he(() => {
|
|
1760
1759
|
let e = r.current;
|
|
1761
1760
|
if (!e) return;
|
|
1762
1761
|
let t = c.split(",").map(Number), n = (t, n) => n === void 0 ? e.style.removeProperty(t) : e.style.setProperty(t, String(n));
|
|
@@ -1793,17 +1792,17 @@ function fi({ percents: e, disabled: t, handlers: n }) {
|
|
|
1793
1792
|
}
|
|
1794
1793
|
//#endregion
|
|
1795
1794
|
//#region lib/components/ui/fields/slider/use-slider-model.ts
|
|
1796
|
-
function
|
|
1797
|
-
let [d, f] = M(() =>
|
|
1795
|
+
function si({ defaultValue: e, value: t, min: n, max: r, step: i, ticks: a, origin: o, vertical: s, disabled: c, handlers: l, onValueChange: u }) {
|
|
1796
|
+
let [d, f] = M(() => Jr(e, n)), p = Array.isArray(t) ? t : d;
|
|
1798
1797
|
return {
|
|
1799
1798
|
thumbs: p,
|
|
1800
|
-
chrome:
|
|
1801
|
-
percents: p.map((e) =>
|
|
1799
|
+
chrome: oi({
|
|
1800
|
+
percents: p.map((e) => qr(e, n, r)),
|
|
1802
1801
|
disabled: c,
|
|
1803
1802
|
handlers: l
|
|
1804
1803
|
}),
|
|
1805
|
-
marks:
|
|
1806
|
-
fill:
|
|
1804
|
+
marks: it(n, r, a, i),
|
|
1805
|
+
fill: Yr({
|
|
1807
1806
|
thumbs: p,
|
|
1808
1807
|
min: n,
|
|
1809
1808
|
origin: o,
|
|
@@ -1816,14 +1815,14 @@ function pi({ defaultValue: e, value: t, min: n, max: r, step: i, ticks: a, orig
|
|
|
1816
1815
|
}
|
|
1817
1816
|
//#endregion
|
|
1818
1817
|
//#region lib/components/ui/fields/slider/use-slider-control.ts
|
|
1819
|
-
function
|
|
1820
|
-
let { own: t, aria: n, handlers: r, rest: i } =
|
|
1818
|
+
function ci(e) {
|
|
1819
|
+
let { own: t, aria: n, handlers: r, rest: i } = ai(e), { min: a, max: o, inverted: s } = t, c = k(), l = ii({
|
|
1821
1820
|
thumbId: c,
|
|
1822
1821
|
labelId: t.labelId,
|
|
1823
1822
|
ariaLabel: n.label,
|
|
1824
1823
|
ariaLabelledBy: n.labelledBy,
|
|
1825
1824
|
hiddenLabel: t.hiddenLabel
|
|
1826
|
-
}), u =
|
|
1825
|
+
}), u = si({
|
|
1827
1826
|
...t,
|
|
1828
1827
|
step: typeof t.step == "number" ? t.step : void 0,
|
|
1829
1828
|
vertical: i.orientation === "vertical",
|
|
@@ -1877,18 +1876,18 @@ function mi(e) {
|
|
|
1877
1876
|
}
|
|
1878
1877
|
//#endregion
|
|
1879
1878
|
//#region lib/components/ui/fields/slider/slider-control.tsx
|
|
1880
|
-
var
|
|
1881
|
-
function
|
|
1882
|
-
let { wrap: t, nameText: n, nameTextId: r, rootProps: i, trackProps: a, thumbsProps: o } =
|
|
1879
|
+
var li = "relative flex w-full touch-none select-none items-center data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col";
|
|
1880
|
+
function ui(e) {
|
|
1881
|
+
let { wrap: t, nameText: n, nameTextId: r, rootProps: i, trackProps: a, thumbsProps: o } = ci(e), { className: s, ...c } = i;
|
|
1883
1882
|
return /* @__PURE__ */ F("div", {
|
|
1884
1883
|
ref: t,
|
|
1885
1884
|
className: "grid w-full gap-1",
|
|
1886
1885
|
"data-slot": "slider-wrap",
|
|
1887
|
-
children: [/* @__PURE__ */ F(
|
|
1886
|
+
children: [/* @__PURE__ */ F(Dt, {
|
|
1888
1887
|
"data-slot": "slider",
|
|
1889
|
-
className: T(
|
|
1888
|
+
className: T(li, s),
|
|
1890
1889
|
...c,
|
|
1891
|
-
children: [/* @__PURE__ */ P(
|
|
1890
|
+
children: [/* @__PURE__ */ P(ri, { ...a }), /* @__PURE__ */ P($r, { ...o })]
|
|
1892
1891
|
}), n && /* @__PURE__ */ P("span", {
|
|
1893
1892
|
id: r,
|
|
1894
1893
|
hidden: !0,
|
|
@@ -1898,7 +1897,7 @@ function gi(e) {
|
|
|
1898
1897
|
}
|
|
1899
1898
|
//#endregion
|
|
1900
1899
|
//#region lib/components/ui/media/image-editor/partials/editor-slider.tsx
|
|
1901
|
-
function
|
|
1900
|
+
function di({ label: e, value: t, min: n, max: r, step: i = 1, origin: a = n, format: o = String, trackClassName: s, onChange: c, onCommit: l, onReset: u, ...d }) {
|
|
1902
1901
|
let f = k(), p = t !== a;
|
|
1903
1902
|
return /* @__PURE__ */ F("div", {
|
|
1904
1903
|
"data-slot": d["data-slot"] ?? "image-editor-slider",
|
|
@@ -1916,7 +1915,7 @@ function _i({ label: e, value: t, min: n, max: r, step: i = 1, origin: a = n, fo
|
|
|
1916
1915
|
className: T("min-w-9 rounded-full px-2 py-0.5 text-right text-xs tabular-nums transition-colors", p ? "bg-primary/15 font-semibold text-primary-text" : "text-muted-foreground"),
|
|
1917
1916
|
children: o(t)
|
|
1918
1917
|
})]
|
|
1919
|
-
}), /* @__PURE__ */ P(
|
|
1918
|
+
}), /* @__PURE__ */ P(ui, {
|
|
1920
1919
|
labelId: f,
|
|
1921
1920
|
min: n,
|
|
1922
1921
|
max: r,
|
|
@@ -1929,20 +1928,20 @@ function _i({ label: e, value: t, min: n, max: r, step: i = 1, origin: a = n, fo
|
|
|
1929
1928
|
})]
|
|
1930
1929
|
});
|
|
1931
1930
|
}
|
|
1932
|
-
var
|
|
1931
|
+
var fi = (e) => e > 0 ? `+${e}` : String(e);
|
|
1933
1932
|
//#endregion
|
|
1934
1933
|
//#region lib/components/ui/media/image-editor/partials/editor-adjust-row.tsx
|
|
1935
|
-
function
|
|
1936
|
-
let { state: t, actions: n } =
|
|
1937
|
-
return /* @__PURE__ */ P(
|
|
1934
|
+
function pi({ spec: e }) {
|
|
1935
|
+
let { state: t, actions: n } = R(), { t: r } = i(), a = e.min < 0 ? 0 : e.min;
|
|
1936
|
+
return /* @__PURE__ */ P(di, {
|
|
1938
1937
|
"data-slot": "image-editor-adjust-row",
|
|
1939
1938
|
label: r(`material.image-editor.adjust.${e.key}`, e.label),
|
|
1940
1939
|
value: t.edits.adjustments[e.key],
|
|
1941
1940
|
min: e.min,
|
|
1942
1941
|
max: e.max,
|
|
1943
1942
|
origin: a,
|
|
1944
|
-
format:
|
|
1945
|
-
trackClassName:
|
|
1943
|
+
format: fi,
|
|
1944
|
+
trackClassName: Kr[e.key],
|
|
1946
1945
|
onChange: (t) => n.setAdjustment({
|
|
1947
1946
|
key: e.key,
|
|
1948
1947
|
value: t
|
|
@@ -1958,23 +1957,23 @@ function yi({ spec: e }) {
|
|
|
1958
1957
|
}
|
|
1959
1958
|
//#endregion
|
|
1960
1959
|
//#region lib/components/ui/media/image-editor/partials/editor-histogram.tsx
|
|
1961
|
-
var
|
|
1962
|
-
function
|
|
1963
|
-
let t = Math.sqrt(Math.max(1, ...e)), n =
|
|
1964
|
-
return `M0,${
|
|
1965
|
-
let i =
|
|
1960
|
+
var mi = 256, Q = 64;
|
|
1961
|
+
function hi(e) {
|
|
1962
|
+
let t = Math.sqrt(Math.max(1, ...e)), n = mi / Math.max(1, e.length - 1);
|
|
1963
|
+
return `M0,${Q} L${e.map((e, r) => {
|
|
1964
|
+
let i = Q - Math.sqrt(e) / t * (Q - 4);
|
|
1966
1965
|
return `${(r * n).toFixed(1)},${i.toFixed(1)}`;
|
|
1967
|
-
}).join(" L")} L${
|
|
1966
|
+
}).join(" L")} L${mi},${Q} Z`;
|
|
1968
1967
|
}
|
|
1969
|
-
function
|
|
1970
|
-
let { t } = i(), n = k(), r = A(() => e ?
|
|
1968
|
+
function gi({ pixels: e }) {
|
|
1969
|
+
let { t } = i(), n = k(), r = A(() => e ? hi(ln(e)) : null, [e]);
|
|
1971
1970
|
return /* @__PURE__ */ P("div", {
|
|
1972
1971
|
"data-slot": "image-editor-histogram",
|
|
1973
1972
|
className: "relative overflow-hidden rounded-xl border bg-linear-to-b from-muted/40 to-muted/10 p-2",
|
|
1974
1973
|
children: /* @__PURE__ */ F("svg", {
|
|
1975
1974
|
role: "img",
|
|
1976
1975
|
"aria-label": t("material.image-editor.adjust.histogram", "Histogram"),
|
|
1977
|
-
viewBox: `0 0 ${
|
|
1976
|
+
viewBox: `0 0 ${mi} ${Q}`,
|
|
1978
1977
|
preserveAspectRatio: "none",
|
|
1979
1978
|
className: "block h-16 w-full",
|
|
1980
1979
|
children: [
|
|
@@ -1999,10 +1998,10 @@ function Si({ pixels: e }) {
|
|
|
1999
1998
|
.5,
|
|
2000
1999
|
.75
|
|
2001
2000
|
].map((e) => /* @__PURE__ */ P("line", {
|
|
2002
|
-
x1: e *
|
|
2003
|
-
x2: e *
|
|
2001
|
+
x1: e * mi,
|
|
2002
|
+
x2: e * mi,
|
|
2004
2003
|
y1: 0,
|
|
2005
|
-
y2:
|
|
2004
|
+
y2: Q,
|
|
2006
2005
|
stroke: "currentColor",
|
|
2007
2006
|
strokeOpacity: "0.08"
|
|
2008
2007
|
}, e)),
|
|
@@ -2020,13 +2019,13 @@ function Si({ pixels: e }) {
|
|
|
2020
2019
|
}
|
|
2021
2020
|
//#endregion
|
|
2022
2021
|
//#region lib/components/ui/media/image-editor/partials/editor-adjust-panel.tsx
|
|
2023
|
-
function
|
|
2024
|
-
let { state: e, actions: t, source: n } =
|
|
2022
|
+
function _i() {
|
|
2023
|
+
let { state: e, actions: t, source: n } = R(), { t: r } = i(), a = Ur(n.status === "ready" ? n.preview : null), o = Gr(a, e.edits), s = nr.selectAdjustedCount(e) > 0;
|
|
2025
2024
|
return /* @__PURE__ */ F(N, { children: [
|
|
2026
|
-
/* @__PURE__ */ P(
|
|
2025
|
+
/* @__PURE__ */ P(gi, { pixels: o }),
|
|
2027
2026
|
/* @__PURE__ */ F("div", {
|
|
2028
2027
|
className: "flex gap-2",
|
|
2029
|
-
children: [/* @__PURE__ */ F(
|
|
2028
|
+
children: [/* @__PURE__ */ F(m, {
|
|
2030
2029
|
variant: "tonal",
|
|
2031
2030
|
color: "primary",
|
|
2032
2031
|
size: "sm",
|
|
@@ -2034,39 +2033,39 @@ function Ci() {
|
|
|
2034
2033
|
disabled: !a,
|
|
2035
2034
|
onClick: () => {
|
|
2036
2035
|
if (!a) return;
|
|
2037
|
-
let n =
|
|
2036
|
+
let n = Wr(a, e.edits, !1);
|
|
2038
2037
|
n && (t.endGesture(), t.applyAdjustments({
|
|
2039
2038
|
exposure: 0,
|
|
2040
2039
|
contrast: 0,
|
|
2041
2040
|
highlights: 0,
|
|
2042
2041
|
shadows: 0,
|
|
2043
2042
|
vibrance: 0,
|
|
2044
|
-
...
|
|
2043
|
+
...fn(n)
|
|
2045
2044
|
}));
|
|
2046
2045
|
},
|
|
2047
|
-
children: [/* @__PURE__ */ P(
|
|
2048
|
-
}), /* @__PURE__ */ F(
|
|
2046
|
+
children: [/* @__PURE__ */ P(Ze, { "aria-hidden": "true" }), r("material.image-editor.adjust.auto", "Auto")]
|
|
2047
|
+
}), /* @__PURE__ */ F(m, {
|
|
2049
2048
|
variant: "ghost",
|
|
2050
2049
|
color: "default",
|
|
2051
2050
|
size: "sm",
|
|
2052
2051
|
disabled: !s,
|
|
2053
2052
|
onClick: () => t.resetAdjustments(),
|
|
2054
|
-
children: [/* @__PURE__ */ P(
|
|
2053
|
+
children: [/* @__PURE__ */ P(Be, { "aria-hidden": "true" }), r("material.image-editor.adjust.reset", "Reset")]
|
|
2055
2054
|
})]
|
|
2056
2055
|
}),
|
|
2057
|
-
|
|
2056
|
+
hn.map((e) => /* @__PURE__ */ P(Zi, {
|
|
2058
2057
|
title: r(`material.image-editor.adjust.group.${e.id}`, e.label),
|
|
2059
2058
|
children: /* @__PURE__ */ P("div", {
|
|
2060
2059
|
className: "grid gap-1",
|
|
2061
|
-
children: e.items.map((e) => /* @__PURE__ */ P(
|
|
2060
|
+
children: e.items.map((e) => /* @__PURE__ */ P(pi, { spec: e }, e.key))
|
|
2062
2061
|
})
|
|
2063
2062
|
}, e.id))
|
|
2064
2063
|
] });
|
|
2065
2064
|
}
|
|
2066
2065
|
//#endregion
|
|
2067
2066
|
//#region lib/components/ui/primitives/separator/separator.tsx
|
|
2068
|
-
function
|
|
2069
|
-
return /* @__PURE__ */ P(
|
|
2067
|
+
function vi({ className: e, orientation: t = "horizontal", decorative: n = !0, ...r }) {
|
|
2068
|
+
return /* @__PURE__ */ P(mt, {
|
|
2070
2069
|
"data-slot": "separator",
|
|
2071
2070
|
decorative: n,
|
|
2072
2071
|
orientation: t,
|
|
@@ -2076,20 +2075,20 @@ function wi({ className: e, orientation: t = "horizontal", decorative: n = !0, .
|
|
|
2076
2075
|
}
|
|
2077
2076
|
//#endregion
|
|
2078
2077
|
//#region lib/components/ui/primitives/toggle-group/toggle-group.variants.ts
|
|
2079
|
-
function
|
|
2078
|
+
function yi(e) {
|
|
2080
2079
|
return e === "outlined" ? "separate" : e === "segmented" || e === "separate" ? e : "connected";
|
|
2081
2080
|
}
|
|
2082
|
-
function
|
|
2081
|
+
function bi(e) {
|
|
2083
2082
|
return e === "sm" || e === "lg" ? e : "md";
|
|
2084
2083
|
}
|
|
2085
2084
|
//#endregion
|
|
2086
2085
|
//#region lib/components/ui/primitives/toggle-group/toggle-group.tsx
|
|
2087
|
-
function
|
|
2088
|
-
let o =
|
|
2089
|
-
return /* @__PURE__ */ F(
|
|
2086
|
+
function xi({ className: e, variant: t, size: n, orientation: r, children: i, ...a }) {
|
|
2087
|
+
let o = yi(t);
|
|
2088
|
+
return /* @__PURE__ */ F(de, {
|
|
2090
2089
|
"data-slot": "toggle-group",
|
|
2091
2090
|
"data-variant": o,
|
|
2092
|
-
"data-size":
|
|
2091
|
+
"data-size": bi(n),
|
|
2093
2092
|
"data-orientation": r ?? "horizontal",
|
|
2094
2093
|
"data-type": a.type,
|
|
2095
2094
|
"data-pw": "toggle-group",
|
|
@@ -2102,9 +2101,9 @@ function Di({ className: e, variant: t, size: n, orientation: r, children: i, ..
|
|
|
2102
2101
|
}) : null]
|
|
2103
2102
|
});
|
|
2104
2103
|
}
|
|
2105
|
-
function
|
|
2106
|
-
let o = !
|
|
2107
|
-
return /* @__PURE__ */ F(
|
|
2104
|
+
function Si({ className: t, children: n, variant: r, size: i, ...a }) {
|
|
2105
|
+
let o = !te(n) && !!(a["aria-label"] || a["aria-labelledby"]);
|
|
2106
|
+
return /* @__PURE__ */ F(ue, {
|
|
2108
2107
|
"data-slot": "toggle-group-item",
|
|
2109
2108
|
"data-pw": a.value ? `toggle-group-item-${a.value}` : "toggle-group-item",
|
|
2110
2109
|
"data-icon-only": o ? "" : void 0,
|
|
@@ -2113,15 +2112,15 @@ function Oi({ className: t, children: n, variant: r, size: i, ...a }) {
|
|
|
2113
2112
|
children: [/* @__PURE__ */ P("span", {
|
|
2114
2113
|
"data-slot": "toggle-group-check",
|
|
2115
2114
|
"aria-hidden": "true",
|
|
2116
|
-
children: /* @__PURE__ */ P(
|
|
2115
|
+
children: /* @__PURE__ */ P(be, { strokeWidth: 2.75 })
|
|
2117
2116
|
}), /* @__PURE__ */ P(e, { children: n })]
|
|
2118
2117
|
});
|
|
2119
2118
|
}
|
|
2120
2119
|
//#endregion
|
|
2121
2120
|
//#region lib/components/ui/media/image-editor/partials/aspect-glyph.tsx
|
|
2122
|
-
var
|
|
2123
|
-
function
|
|
2124
|
-
let n = e === null, r = n ? 1 : e, i = r >= 1 ?
|
|
2121
|
+
var Ci = 14;
|
|
2122
|
+
function wi({ ratio: e, className: t }) {
|
|
2123
|
+
let n = e === null, r = n ? 1 : e, i = r >= 1 ? Ci : Ci * r, a = r >= 1 ? Ci / r : Ci;
|
|
2125
2124
|
return /* @__PURE__ */ P("span", {
|
|
2126
2125
|
"aria-hidden": "true",
|
|
2127
2126
|
"data-slot": "image-editor-aspect-glyph",
|
|
@@ -2134,76 +2133,76 @@ function Ai({ ratio: e, className: t }) {
|
|
|
2134
2133
|
}
|
|
2135
2134
|
//#endregion
|
|
2136
2135
|
//#region lib/components/ui/media/image-editor/partials/markup-tools.ts
|
|
2137
|
-
var
|
|
2136
|
+
var Ti = [
|
|
2138
2137
|
{
|
|
2139
2138
|
tool: "select",
|
|
2140
|
-
icon:
|
|
2139
|
+
icon: Pe,
|
|
2141
2140
|
label: "Select"
|
|
2142
2141
|
},
|
|
2143
2142
|
{
|
|
2144
2143
|
tool: "pen",
|
|
2145
|
-
icon:
|
|
2144
|
+
icon: Fe,
|
|
2146
2145
|
label: "Pen"
|
|
2147
2146
|
},
|
|
2148
2147
|
{
|
|
2149
2148
|
tool: "highlighter",
|
|
2150
|
-
icon:
|
|
2149
|
+
icon: je,
|
|
2151
2150
|
label: "Highlighter"
|
|
2152
2151
|
},
|
|
2153
2152
|
{
|
|
2154
2153
|
tool: "eraser",
|
|
2155
|
-
icon:
|
|
2154
|
+
icon: De,
|
|
2156
2155
|
label: "Eraser"
|
|
2157
2156
|
},
|
|
2158
2157
|
{
|
|
2159
2158
|
tool: "text",
|
|
2160
|
-
icon:
|
|
2159
|
+
icon: Ye,
|
|
2161
2160
|
label: "Text"
|
|
2162
2161
|
},
|
|
2163
2162
|
{
|
|
2164
2163
|
tool: "step",
|
|
2165
|
-
icon:
|
|
2164
|
+
icon: Le,
|
|
2166
2165
|
label: "Step marker"
|
|
2167
2166
|
},
|
|
2168
2167
|
{
|
|
2169
2168
|
tool: "line",
|
|
2170
|
-
icon:
|
|
2169
|
+
icon: Ue,
|
|
2171
2170
|
label: "Line"
|
|
2172
2171
|
},
|
|
2173
2172
|
{
|
|
2174
2173
|
tool: "arrow",
|
|
2175
|
-
icon:
|
|
2174
|
+
icon: ve,
|
|
2176
2175
|
label: "Arrow"
|
|
2177
2176
|
},
|
|
2178
2177
|
{
|
|
2179
2178
|
tool: "rect",
|
|
2180
|
-
icon:
|
|
2179
|
+
icon: Ke,
|
|
2181
2180
|
label: "Rectangle"
|
|
2182
2181
|
},
|
|
2183
2182
|
{
|
|
2184
2183
|
tool: "ellipse",
|
|
2185
|
-
icon:
|
|
2184
|
+
icon: Se,
|
|
2186
2185
|
label: "Ellipse"
|
|
2187
2186
|
},
|
|
2188
2187
|
{
|
|
2189
2188
|
tool: "redact",
|
|
2190
|
-
icon:
|
|
2189
|
+
icon: qe,
|
|
2191
2190
|
label: "Redact"
|
|
2192
2191
|
}
|
|
2193
|
-
],
|
|
2192
|
+
], Ei = "before:hidden data-[state=on]:bg-primary data-[state=on]:text-primary-foreground data-[state=on]:hover:bg-primary/90";
|
|
2194
2193
|
//#endregion
|
|
2195
2194
|
//#region lib/components/ui/media/image-editor/partials/crop-aspect-picker.tsx
|
|
2196
|
-
function
|
|
2197
|
-
let { state: t, actions: n, base: r, aspectPresets: a, lockedAspect: o } =
|
|
2195
|
+
function Di({ compact: e = !1 }) {
|
|
2196
|
+
let { state: t, actions: n, base: r, aspectPresets: a, lockedAspect: o } = R(), { t: s } = i(), c = t.edits.crop, l = a.find((e) => e.value === t.aspect)?.id ?? "", u = (e) => {
|
|
2198
2197
|
let t = a.find((t) => t.id === e);
|
|
2199
2198
|
if (!t || !r) return;
|
|
2200
2199
|
let i = t.value;
|
|
2201
2200
|
n.setAspect(i);
|
|
2202
2201
|
let o = i === "original" ? r.width / r.height : i;
|
|
2203
|
-
o && n.setCrop({ rect:
|
|
2202
|
+
o && n.setCrop({ rect: Fn(c, o, r) });
|
|
2204
2203
|
};
|
|
2205
2204
|
if (o !== void 0 || a.length === 0) return null;
|
|
2206
|
-
let d = /* @__PURE__ */ P(
|
|
2205
|
+
let d = /* @__PURE__ */ P(xi, {
|
|
2207
2206
|
type: "single",
|
|
2208
2207
|
variant: "separate",
|
|
2209
2208
|
size: "sm",
|
|
@@ -2211,21 +2210,21 @@ function Ni({ compact: e = !1 }) {
|
|
|
2211
2210
|
onValueChange: (e) => e && u(e),
|
|
2212
2211
|
"aria-label": s("material.image-editor.crop.aspect", "Aspect ratio"),
|
|
2213
2212
|
className: T("justify-start", e ? "flex-nowrap overflow-x-auto" : "flex-wrap"),
|
|
2214
|
-
children: a.map((e) => /* @__PURE__ */ F(
|
|
2213
|
+
children: a.map((e) => /* @__PURE__ */ F(Si, {
|
|
2215
2214
|
value: e.id,
|
|
2216
|
-
className: T(
|
|
2217
|
-
children: [/* @__PURE__ */ P(
|
|
2215
|
+
className: T(Ei, "gap-1.5"),
|
|
2216
|
+
children: [/* @__PURE__ */ P(wi, { ratio: e.value === "original" ? r ? r.width / r.height : 4 / 3 : e.value }), e.id === "free" || e.id === "original" ? s(`material.image-editor.crop.aspect-${e.id}`, e.label) : e.label]
|
|
2218
2217
|
}, e.id))
|
|
2219
2218
|
});
|
|
2220
|
-
return e ? d : /* @__PURE__ */ P(
|
|
2219
|
+
return e ? d : /* @__PURE__ */ P(Zi, {
|
|
2221
2220
|
title: s("material.image-editor.crop.aspect", "Aspect ratio"),
|
|
2222
2221
|
children: d
|
|
2223
2222
|
});
|
|
2224
2223
|
}
|
|
2225
2224
|
//#endregion
|
|
2226
2225
|
//#region lib/components/ui/media/image-editor/partials/crop-orientation.tsx
|
|
2227
|
-
function
|
|
2228
|
-
return /* @__PURE__ */ P(
|
|
2226
|
+
function Oi(e, t, n) {
|
|
2227
|
+
return /* @__PURE__ */ P(f, {
|
|
2229
2228
|
variant: "tonal",
|
|
2230
2229
|
color: "default",
|
|
2231
2230
|
tooltip: e,
|
|
@@ -2233,16 +2232,16 @@ function Pi(e, t, n) {
|
|
|
2233
2232
|
children: t
|
|
2234
2233
|
});
|
|
2235
2234
|
}
|
|
2236
|
-
function
|
|
2237
|
-
let { state: t, actions: n } =
|
|
2235
|
+
function ki({ compact: e = !1 }) {
|
|
2236
|
+
let { state: t, actions: n } = R(), { t: r } = i(), { transform: a } = t.edits, o = /* @__PURE__ */ F("div", {
|
|
2238
2237
|
className: "flex flex-wrap gap-2",
|
|
2239
2238
|
children: [
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2239
|
+
Oi(r("material.image-editor.crop.rotate-left", "Rotate left"), /* @__PURE__ */ P(Be, {}), () => n.turn(-1)),
|
|
2240
|
+
Oi(r("material.image-editor.crop.rotate-right", "Rotate right"), /* @__PURE__ */ P(Ve, {}), () => n.turn(1)),
|
|
2241
|
+
Oi(r("material.image-editor.crop.flip-horizontal", "Flip horizontally"), /* @__PURE__ */ P(ke, {}), () => n.flip("x")),
|
|
2242
|
+
Oi(r("material.image-editor.crop.flip-vertical", "Flip vertically"), /* @__PURE__ */ P(Ae, {}), () => n.flip("y"))
|
|
2244
2243
|
]
|
|
2245
|
-
}), s = /* @__PURE__ */ P(
|
|
2244
|
+
}), s = /* @__PURE__ */ P(di, {
|
|
2246
2245
|
label: r("material.image-editor.crop.straighten", "Straighten"),
|
|
2247
2246
|
min: -45,
|
|
2248
2247
|
max: 45,
|
|
@@ -2259,19 +2258,19 @@ function Fi({ compact: e = !1 }) {
|
|
|
2259
2258
|
return e ? /* @__PURE__ */ F(N, { children: [o, /* @__PURE__ */ P("div", {
|
|
2260
2259
|
className: "min-w-40 flex-1",
|
|
2261
2260
|
children: s
|
|
2262
|
-
})] }) : /* @__PURE__ */ F(
|
|
2261
|
+
})] }) : /* @__PURE__ */ F(Zi, {
|
|
2263
2262
|
title: r("material.image-editor.crop.orientation", "Rotate & flip"),
|
|
2264
2263
|
children: [o, s]
|
|
2265
2264
|
});
|
|
2266
2265
|
}
|
|
2267
2266
|
//#endregion
|
|
2268
2267
|
//#region lib/components/ui/media/image-editor/partials/editor-crop-panel.tsx
|
|
2269
|
-
function
|
|
2270
|
-
let { state: e, actions: t } =
|
|
2268
|
+
function Ai() {
|
|
2269
|
+
let { state: e, actions: t } = R(), { t: n } = i(), { transform: r, crop: a } = e.edits, o = a.x === H.x && a.y === H.y && a.w === H.w && a.h === H.h, s = zn(r) && o;
|
|
2271
2270
|
return /* @__PURE__ */ F(N, { children: [
|
|
2272
|
-
/* @__PURE__ */ P(
|
|
2273
|
-
/* @__PURE__ */ P(
|
|
2274
|
-
/* @__PURE__ */ P(
|
|
2271
|
+
/* @__PURE__ */ P(ki, {}),
|
|
2272
|
+
/* @__PURE__ */ P(Di, {}),
|
|
2273
|
+
/* @__PURE__ */ P(m, {
|
|
2275
2274
|
variant: "tonal",
|
|
2276
2275
|
color: "default",
|
|
2277
2276
|
size: "sm",
|
|
@@ -2284,8 +2283,8 @@ function Ii() {
|
|
|
2284
2283
|
}
|
|
2285
2284
|
//#endregion
|
|
2286
2285
|
//#region lib/components/ui/media/image-editor/partials/editor-filters-panel.tsx
|
|
2287
|
-
function
|
|
2288
|
-
let { state: e, actions: t, source: n } =
|
|
2286
|
+
function ji() {
|
|
2287
|
+
let { state: e, actions: t, source: n } = R(), { t: r } = i(), a = n.status === "ready" ? n.preview : null, o = A(() => a ? Br(a, 224) : null, [a]), { filter: s, filterIntensity: c } = e.edits, l = A(() => ({
|
|
2289
2288
|
...e.edits,
|
|
2290
2289
|
filterIntensity: 100,
|
|
2291
2290
|
annotations: []
|
|
@@ -2294,7 +2293,7 @@ function Li() {
|
|
|
2294
2293
|
role: "group",
|
|
2295
2294
|
"aria-label": r("material.image-editor.panel.filters", "Filters"),
|
|
2296
2295
|
className: "-mx-4 flex snap-x gap-2 overflow-x-auto px-4 pb-1 [scrollbar-width:none] @3xl/image-editor:mx-0 @3xl/image-editor:grid @3xl/image-editor:grid-cols-2 @3xl/image-editor:overflow-visible @3xl/image-editor:px-0",
|
|
2297
|
-
children:
|
|
2296
|
+
children: gr.map((e) => /* @__PURE__ */ P(Mi, {
|
|
2298
2297
|
preset: e,
|
|
2299
2298
|
source: o,
|
|
2300
2299
|
edits: l,
|
|
@@ -2302,7 +2301,7 @@ function Li() {
|
|
|
2302
2301
|
label: r(`material.image-editor.filter.${e.id}`, e.label),
|
|
2303
2302
|
onSelect: () => t.setFilter(e.id)
|
|
2304
2303
|
}, e.id))
|
|
2305
|
-
}), s !== "none" && /* @__PURE__ */ P(
|
|
2304
|
+
}), s !== "none" && /* @__PURE__ */ P(di, {
|
|
2306
2305
|
label: r("material.image-editor.filter-intensity", "Intensity"),
|
|
2307
2306
|
min: 0,
|
|
2308
2307
|
max: 100,
|
|
@@ -2314,13 +2313,13 @@ function Li() {
|
|
|
2314
2313
|
onReset: () => t.setFilterIntensity(100)
|
|
2315
2314
|
})] });
|
|
2316
2315
|
}
|
|
2317
|
-
function
|
|
2316
|
+
function Mi({ preset: e, source: t, edits: n, checked: r, label: i, onSelect: a }) {
|
|
2318
2317
|
let o = j(null);
|
|
2319
2318
|
return O(() => {
|
|
2320
2319
|
let r = o.current;
|
|
2321
2320
|
if (!t || !r) return;
|
|
2322
2321
|
let i = requestAnimationFrame(() => {
|
|
2323
|
-
|
|
2322
|
+
zr(t, n, {
|
|
2324
2323
|
scale: 1,
|
|
2325
2324
|
region: "crop",
|
|
2326
2325
|
filter: e.id,
|
|
@@ -2352,206 +2351,92 @@ function Ri({ preset: e, source: t, edits: n, checked: r, label: i, onSelect: a
|
|
|
2352
2351
|
}
|
|
2353
2352
|
//#endregion
|
|
2354
2353
|
//#region lib/components/ui/media/image-editor/partials/editor-markup-selection.tsx
|
|
2355
|
-
function
|
|
2356
|
-
let { selected: e, actions: t } =
|
|
2354
|
+
function Ni() {
|
|
2355
|
+
let { selected: e, actions: t } = R(), { t: n } = i();
|
|
2357
2356
|
if (!e) return null;
|
|
2358
2357
|
let r = e.id;
|
|
2359
|
-
return /* @__PURE__ */ P(
|
|
2358
|
+
return /* @__PURE__ */ P(Zi, {
|
|
2360
2359
|
title: n("material.image-editor.markup.selection", "Selected mark"),
|
|
2361
2360
|
children: /* @__PURE__ */ F("div", {
|
|
2362
2361
|
className: "flex gap-2",
|
|
2363
2362
|
children: [
|
|
2364
|
-
/* @__PURE__ */ P(
|
|
2363
|
+
/* @__PURE__ */ P(f, {
|
|
2365
2364
|
variant: "tonal",
|
|
2366
2365
|
color: "default",
|
|
2367
2366
|
tooltip: n("material.image-editor.markup.duplicate", "Duplicate"),
|
|
2368
2367
|
onClick: () => t.duplicateAnnotation(r),
|
|
2369
|
-
children: /* @__PURE__ */ P(
|
|
2368
|
+
children: /* @__PURE__ */ P(we, {})
|
|
2370
2369
|
}),
|
|
2371
|
-
/* @__PURE__ */ P(
|
|
2370
|
+
/* @__PURE__ */ P(f, {
|
|
2372
2371
|
variant: "tonal",
|
|
2373
2372
|
color: "default",
|
|
2374
2373
|
tooltip: n("material.image-editor.markup.to-front", "Bring to front"),
|
|
2375
2374
|
onClick: () => t.bringToFront(r),
|
|
2376
|
-
children: /* @__PURE__ */ P(
|
|
2375
|
+
children: /* @__PURE__ */ P(ye, {})
|
|
2377
2376
|
}),
|
|
2378
|
-
/* @__PURE__ */ P(
|
|
2377
|
+
/* @__PURE__ */ P(f, {
|
|
2379
2378
|
variant: "tonal",
|
|
2380
2379
|
color: "error",
|
|
2381
2380
|
tooltip: n("material.image-editor.markup.delete", "Delete"),
|
|
2382
2381
|
onClick: () => t.removeAnnotation(r),
|
|
2383
|
-
children: /* @__PURE__ */ P(
|
|
2382
|
+
children: /* @__PURE__ */ P(Je, {})
|
|
2384
2383
|
})
|
|
2385
2384
|
]
|
|
2386
2385
|
})
|
|
2387
2386
|
});
|
|
2388
2387
|
}
|
|
2389
2388
|
//#endregion
|
|
2390
|
-
//#region lib/components/ui/fields/switch/partials/switch-row.tsx
|
|
2391
|
-
function Bi({ id: e, rowTextId: t, text: n, isChecked: r, error: i, variant: a = "box", className: o, readOnly: s, children: l }) {
|
|
2392
|
-
return /* @__PURE__ */ F("div", {
|
|
2393
|
-
"data-checked": r,
|
|
2394
|
-
"data-filled": r,
|
|
2395
|
-
"data-invalid": i || void 0,
|
|
2396
|
-
className: T(a === "plain" ? "flex w-full min-w-0 items-start gap-2 min-h-11 py-[5px]" : b, a !== "plain" && "h-auto min-h-11 items-start py-[5px]", o),
|
|
2397
|
-
children: [/* @__PURE__ */ P("label", {
|
|
2398
|
-
id: t,
|
|
2399
|
-
htmlFor: e,
|
|
2400
|
-
className: T(c(), "my-1.5 min-w-0 flex-1 break-words", s ? "cursor-default" : "cursor-pointer", "pointer-coarse:py-3 pointer-coarse:-my-1.5", { "text-primary-text": r }),
|
|
2401
|
-
children: n
|
|
2402
|
-
}), l]
|
|
2403
|
-
});
|
|
2404
|
-
}
|
|
2405
|
-
//#endregion
|
|
2406
|
-
//#region lib/components/ui/fields/switch/switch.utils.ts
|
|
2407
|
-
function Vi({ id: e, label: t, placeholder: n, helperText: r, props: i }) {
|
|
2408
|
-
let a = `${e}-label`, o = r ? `${e}-helper` : void 0, s = !!(t && n), c = s ? `${e}-text` : void 0, l = [
|
|
2409
|
-
c,
|
|
2410
|
-
o,
|
|
2411
|
-
i["aria-describedby"]
|
|
2412
|
-
].filter(Boolean).join(" ") || void 0, u = !!(i["aria-label"] || i["aria-labelledby"]);
|
|
2413
|
-
return {
|
|
2414
|
-
labelId: a,
|
|
2415
|
-
rowTextId: c,
|
|
2416
|
-
helperId: o,
|
|
2417
|
-
nameProps: {
|
|
2418
|
-
...s && !u ? { "aria-labelledby": a } : {},
|
|
2419
|
-
...l ? { "aria-describedby": l } : {}
|
|
2420
|
-
}
|
|
2421
|
-
};
|
|
2422
|
-
}
|
|
2423
|
-
//#endregion
|
|
2424
|
-
//#region lib/components/ui/fields/switch/use-switch-checked.ts
|
|
2425
|
-
function Hi(e) {
|
|
2426
|
-
let [t, n] = M(e.defaultChecked ?? !1);
|
|
2427
|
-
return {
|
|
2428
|
-
isChecked: e.checked ?? t,
|
|
2429
|
-
onCheckedChange: (t) => {
|
|
2430
|
-
e.checked === void 0 && n(t), e.onCheckedChange?.(t);
|
|
2431
|
-
}
|
|
2432
|
-
};
|
|
2433
|
-
}
|
|
2434
|
-
//#endregion
|
|
2435
|
-
//#region lib/components/ui/fields/switch/use-switch-state.ts
|
|
2436
|
-
function Ui({ label: e, placeholder: t, helperText: n, props: r }) {
|
|
2437
|
-
let i = de(), a = !!(t || e), o = k(), s = r.id ?? o, c = Vi({
|
|
2438
|
-
id: s,
|
|
2439
|
-
label: e,
|
|
2440
|
-
placeholder: t,
|
|
2441
|
-
helperText: n,
|
|
2442
|
-
props: r
|
|
2443
|
-
}), { isChecked: l, onCheckedChange: u } = Hi(r);
|
|
2444
|
-
return {
|
|
2445
|
-
blurRoot: i,
|
|
2446
|
-
hasRow: a,
|
|
2447
|
-
id: s,
|
|
2448
|
-
...c,
|
|
2449
|
-
isChecked: l,
|
|
2450
|
-
onCheckedChange: u
|
|
2451
|
-
};
|
|
2452
|
-
}
|
|
2453
|
-
//#endregion
|
|
2454
|
-
//#region lib/components/ui/fields/switch/switch.tsx
|
|
2455
|
-
function Wi({ error: e, helperText: t, label: n, placeholder: r, variant: i = "box", className: a, ...o }) {
|
|
2456
|
-
let s = Ui({
|
|
2457
|
-
label: n,
|
|
2458
|
-
placeholder: r,
|
|
2459
|
-
helperText: t,
|
|
2460
|
-
props: o
|
|
2461
|
-
}), { id: c } = s, l = !(r || t), u = l ? a : void 0, d = s.hasRow && l && i === "box", p = {
|
|
2462
|
-
"aria-invalid": e || void 0,
|
|
2463
|
-
...o,
|
|
2464
|
-
...s.nameProps,
|
|
2465
|
-
id: c,
|
|
2466
|
-
onCheckedChange: s.onCheckedChange
|
|
2467
|
-
}, h = s.hasRow ? /* @__PURE__ */ P(Bi, {
|
|
2468
|
-
className: T(d && "self-end", u),
|
|
2469
|
-
id: c,
|
|
2470
|
-
rowTextId: s.rowTextId,
|
|
2471
|
-
text: r || n,
|
|
2472
|
-
isChecked: s.isChecked,
|
|
2473
|
-
error: e,
|
|
2474
|
-
variant: i,
|
|
2475
|
-
readOnly: o.readOnly,
|
|
2476
|
-
children: /* @__PURE__ */ P(pe, {
|
|
2477
|
-
...p,
|
|
2478
|
-
className: "cursor-pointer"
|
|
2479
|
-
})
|
|
2480
|
-
}) : /* @__PURE__ */ P(pe, {
|
|
2481
|
-
...p,
|
|
2482
|
-
className: T("cursor-pointer", u)
|
|
2483
|
-
});
|
|
2484
|
-
return /* @__PURE__ */ F("div", {
|
|
2485
|
-
ref: s.blurRoot,
|
|
2486
|
-
"data-slot": "switch-field",
|
|
2487
|
-
className: l ? "contents" : T("grid min-w-0 content-start gap-1.5", s.hasRow && "w-full", a),
|
|
2488
|
-
children: [n && r && /* @__PURE__ */ P(m, {
|
|
2489
|
-
id: s.labelId,
|
|
2490
|
-
htmlFor: c,
|
|
2491
|
-
withAsterisk: o.required,
|
|
2492
|
-
children: n
|
|
2493
|
-
}), /* @__PURE__ */ F("div", {
|
|
2494
|
-
className: l ? "contents" : "flex min-w-0 flex-col gap-0.5",
|
|
2495
|
-
children: [h, t ? /* @__PURE__ */ P(f, {
|
|
2496
|
-
id: s.helperId,
|
|
2497
|
-
error: e,
|
|
2498
|
-
children: t
|
|
2499
|
-
}) : null]
|
|
2500
|
-
})]
|
|
2501
|
-
});
|
|
2502
|
-
}
|
|
2503
|
-
//#endregion
|
|
2504
2389
|
//#region lib/components/ui/selection/color-swatches/color-swatches.utils.ts
|
|
2505
|
-
function
|
|
2390
|
+
function Pi(e) {
|
|
2506
2391
|
let t = e.trim().replace("#", ""), n = t.length === 3 ? t.replace(/./g, (e) => e + e) : t;
|
|
2507
2392
|
if (!/^[0-9a-f]{6}/i.test(n)) return !1;
|
|
2508
2393
|
let r = Number.parseInt(n.slice(0, 6), 16), i = r >> 16 & 255, a = r >> 8 & 255, o = r & 255;
|
|
2509
2394
|
return .299 * i + .587 * a + .114 * o > 160;
|
|
2510
2395
|
}
|
|
2511
|
-
function
|
|
2396
|
+
function Fi(e) {
|
|
2512
2397
|
return e.label ?? e.value;
|
|
2513
2398
|
}
|
|
2514
|
-
function
|
|
2399
|
+
function Ii(e, t) {
|
|
2515
2400
|
return !!(e && t && e.toLowerCase() === t.toLowerCase());
|
|
2516
2401
|
}
|
|
2517
|
-
function
|
|
2402
|
+
function Li(e) {
|
|
2518
2403
|
return e && /^#[0-9a-f]{6}$/i.test(e) ? e : "#000000";
|
|
2519
2404
|
}
|
|
2520
2405
|
//#endregion
|
|
2521
2406
|
//#region lib/components/ui/selection/color-swatches/partials/color-swatch-styles.ts
|
|
2522
|
-
var
|
|
2407
|
+
var Ri = {
|
|
2523
2408
|
xs: "size-5 [&_svg]:size-3",
|
|
2524
2409
|
sm: "size-7 [&_svg]:size-3.5",
|
|
2525
2410
|
md: "size-9 [&_svg]:size-4",
|
|
2526
2411
|
lg: "size-11 [&_svg]:size-5"
|
|
2527
|
-
},
|
|
2412
|
+
}, zi = "relative inline-flex shrink-0 cursor-pointer items-center justify-center rounded-full border border-foreground/15 bg-(--swatch) shadow-xs outline-none transition-[box-shadow,transform] duration-200 hover:scale-110 focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 motion-reduce:transition-none motion-reduce:hover:scale-100";
|
|
2528
2413
|
//#endregion
|
|
2529
2414
|
//#region lib/components/ui/selection/color-swatches/partials/color-swatch-button.tsx
|
|
2530
|
-
function
|
|
2415
|
+
function Bi({ item: e, size: t, pressed: n, onChoose: r }) {
|
|
2531
2416
|
return /* @__PURE__ */ P("button", {
|
|
2532
2417
|
type: "button",
|
|
2533
2418
|
"aria-pressed": n,
|
|
2534
|
-
"aria-label":
|
|
2535
|
-
title:
|
|
2419
|
+
"aria-label": Fi(e),
|
|
2420
|
+
title: Fi(e),
|
|
2536
2421
|
"data-color": e.value,
|
|
2537
2422
|
ref: (t) => t?.style.setProperty("--swatch", e.value),
|
|
2538
2423
|
onClick: () => r(e.value),
|
|
2539
|
-
className: T(
|
|
2540
|
-
children: n && /* @__PURE__ */ P(
|
|
2424
|
+
className: T(zi, Ri[t], n && "ring-2 ring-foreground/80 ring-offset-2 ring-offset-background"),
|
|
2425
|
+
children: n && /* @__PURE__ */ P(be, {
|
|
2541
2426
|
"aria-hidden": "true",
|
|
2542
2427
|
strokeWidth: 3,
|
|
2543
|
-
className:
|
|
2428
|
+
className: Pi(e.value) ? "text-black/80" : "text-white"
|
|
2544
2429
|
})
|
|
2545
2430
|
});
|
|
2546
2431
|
}
|
|
2547
2432
|
//#endregion
|
|
2548
2433
|
//#region lib/components/ui/selection/color-swatches/partials/custom-color-swatch.tsx
|
|
2549
|
-
function
|
|
2434
|
+
function Vi({ size: e, current: t, listed: n, onChoose: r }) {
|
|
2550
2435
|
let { t: a } = i();
|
|
2551
2436
|
return /* @__PURE__ */ F("label", {
|
|
2552
2437
|
title: a("material.color-swatches.custom", "Custom colour"),
|
|
2553
|
-
className: T(
|
|
2554
|
-
children: [/* @__PURE__ */ P(
|
|
2438
|
+
className: T(zi, Ri[e], "bg-[conic-gradient(from_90deg,#ef4444,#facc15,#22c55e,#06b6d4,#3b82f6,#8b5cf6,#ec4899,#ef4444)] has-focus-visible:ring-[3px] has-focus-visible:ring-ring/50", t && !n && "ring-2 ring-foreground/80 ring-offset-2 ring-offset-background"),
|
|
2439
|
+
children: [/* @__PURE__ */ P(Re, {
|
|
2555
2440
|
"aria-hidden": "true",
|
|
2556
2441
|
strokeWidth: 3,
|
|
2557
2442
|
className: "text-white drop-shadow"
|
|
@@ -2559,17 +2444,17 @@ function Qi({ size: e, current: t, listed: n, onChoose: r }) {
|
|
|
2559
2444
|
type: "color",
|
|
2560
2445
|
className: "sr-only",
|
|
2561
2446
|
"aria-label": a("material.color-swatches.custom", "Custom colour"),
|
|
2562
|
-
value:
|
|
2447
|
+
value: Li(t),
|
|
2563
2448
|
onChange: (e) => r(e.target.value)
|
|
2564
2449
|
})]
|
|
2565
2450
|
});
|
|
2566
2451
|
}
|
|
2567
2452
|
//#endregion
|
|
2568
2453
|
//#region lib/components/ui/selection/color-swatches/color-swatches.tsx
|
|
2569
|
-
function
|
|
2454
|
+
function Hi({ colors: e, value: t, defaultValue: n, onChange: r, label: a, showLabel: o = !1, size: s = "md", custom: c = !1, disabled: l, className: u }) {
|
|
2570
2455
|
let { t: d } = i(), [f, p] = M(n), m = t ?? f, h = (e) => {
|
|
2571
2456
|
t === void 0 && p(e), r?.(e);
|
|
2572
|
-
}, g = e.map((e) => typeof e == "string" ? { value: e } : e), _ = g.some((e) =>
|
|
2457
|
+
}, g = e.map((e) => typeof e == "string" ? { value: e } : e), _ = g.some((e) => Ii(e.value, m));
|
|
2573
2458
|
return /* @__PURE__ */ F("fieldset", {
|
|
2574
2459
|
"data-slot": "color-swatches",
|
|
2575
2460
|
"data-size": s,
|
|
@@ -2580,12 +2465,12 @@ function $i({ colors: e, value: t, defaultValue: n, onChange: r, label: a, showL
|
|
|
2580
2465
|
children: a ?? d("material.color-swatches.label", "Colour")
|
|
2581
2466
|
}), /* @__PURE__ */ F("div", {
|
|
2582
2467
|
className: "flex flex-wrap gap-2",
|
|
2583
|
-
children: [g.map((e) => /* @__PURE__ */ P(
|
|
2468
|
+
children: [g.map((e) => /* @__PURE__ */ P(Bi, {
|
|
2584
2469
|
item: e,
|
|
2585
2470
|
size: s,
|
|
2586
|
-
pressed:
|
|
2471
|
+
pressed: Ii(e.value, m),
|
|
2587
2472
|
onChoose: h
|
|
2588
|
-
}, e.value)), c && /* @__PURE__ */ P(
|
|
2473
|
+
}, e.value)), c && /* @__PURE__ */ P(Vi, {
|
|
2589
2474
|
size: s,
|
|
2590
2475
|
current: m,
|
|
2591
2476
|
listed: _,
|
|
@@ -2596,13 +2481,13 @@ function $i({ colors: e, value: t, defaultValue: n, onChange: r, label: a, showL
|
|
|
2596
2481
|
}
|
|
2597
2482
|
//#endregion
|
|
2598
2483
|
//#region lib/components/ui/media/image-editor/partials/markup-brush-section.tsx
|
|
2599
|
-
var
|
|
2600
|
-
function
|
|
2601
|
-
let { state: e, actions: t, colors: n, selected: r, redactModes: a } =
|
|
2602
|
-
return /* @__PURE__ */ F(
|
|
2484
|
+
var Ui = (e) => Math.round((e - yn) / (bn - yn) * 99 + 1), Wi = (e) => yn + (e - 1) / 99 * (bn - yn);
|
|
2485
|
+
function Gi() {
|
|
2486
|
+
let { state: e, actions: t, colors: n, selected: r, redactModes: a } = R(), { t: o } = i(), { brush: s, markupTool: c } = e, l = r?.kind ?? c, u = l === "rect" || l === "ellipse";
|
|
2487
|
+
return /* @__PURE__ */ F(Zi, {
|
|
2603
2488
|
title: o("material.image-editor.markup.color", "Colour"),
|
|
2604
2489
|
children: [
|
|
2605
|
-
/* @__PURE__ */ P(
|
|
2490
|
+
/* @__PURE__ */ P(Hi, {
|
|
2606
2491
|
colors: n,
|
|
2607
2492
|
size: "sm",
|
|
2608
2493
|
custom: !0,
|
|
@@ -2610,25 +2495,25 @@ function na() {
|
|
|
2610
2495
|
value: s.color,
|
|
2611
2496
|
onChange: (e) => t.setBrush({ color: e })
|
|
2612
2497
|
}),
|
|
2613
|
-
/* @__PURE__ */ P(
|
|
2498
|
+
/* @__PURE__ */ P(di, {
|
|
2614
2499
|
label: o("material.image-editor.markup.size", "Size"),
|
|
2615
2500
|
min: 1,
|
|
2616
2501
|
max: 100,
|
|
2617
|
-
value:
|
|
2618
|
-
onChange: (e) => t.setBrush({ size:
|
|
2502
|
+
value: Ui(s.size),
|
|
2503
|
+
onChange: (e) => t.setBrush({ size: Wi(e) }),
|
|
2619
2504
|
onCommit: () => t.endGesture()
|
|
2620
2505
|
}),
|
|
2621
|
-
u && /* @__PURE__ */ P(
|
|
2506
|
+
u && /* @__PURE__ */ P(g, {
|
|
2622
2507
|
label: o("material.image-editor.markup.fill", "Filled"),
|
|
2623
2508
|
checked: s.fill,
|
|
2624
2509
|
onCheckedChange: (e) => t.setBrush({ fill: e })
|
|
2625
2510
|
}),
|
|
2626
|
-
l === "redact" && a.length > 1 && /* @__PURE__ */ P(
|
|
2511
|
+
l === "redact" && a.length > 1 && /* @__PURE__ */ P(g, {
|
|
2627
2512
|
label: o("material.image-editor.markup.pixelate", "Pixelate (less safe)"),
|
|
2628
2513
|
checked: s.redactMode === "pixelate",
|
|
2629
2514
|
onCheckedChange: (e) => t.setBrush({ redactMode: e ? "pixelate" : "solid" })
|
|
2630
2515
|
}),
|
|
2631
|
-
l === "text" && /* @__PURE__ */ P(
|
|
2516
|
+
l === "text" && /* @__PURE__ */ P(g, {
|
|
2632
2517
|
label: o("material.image-editor.markup.background", "Background"),
|
|
2633
2518
|
checked: s.background,
|
|
2634
2519
|
onCheckedChange: (e) => t.setBrush({ background: e })
|
|
@@ -2638,33 +2523,33 @@ function na() {
|
|
|
2638
2523
|
}
|
|
2639
2524
|
//#endregion
|
|
2640
2525
|
//#region lib/components/ui/media/image-editor/partials/markup-tool-picker.tsx
|
|
2641
|
-
function
|
|
2642
|
-
let { state: e, actions: t, markupTools: n } =
|
|
2643
|
-
return /* @__PURE__ */ P(
|
|
2526
|
+
function Ki() {
|
|
2527
|
+
let { state: e, actions: t, markupTools: n } = R(), { t: r } = i(), { markupTool: a } = e, o = (e, t) => r(`material.image-editor.markup.tool.${e}`, t), s = n ? n.flatMap((e) => Ti.filter((t) => t.tool === e)) : Ti;
|
|
2528
|
+
return /* @__PURE__ */ P(xi, {
|
|
2644
2529
|
type: "single",
|
|
2645
2530
|
variant: "separate",
|
|
2646
2531
|
"aria-label": r("material.image-editor.markup.tools", "Drawing tools"),
|
|
2647
2532
|
value: a,
|
|
2648
2533
|
onValueChange: (e) => e && t.setMarkupTool(e),
|
|
2649
2534
|
className: "grid grid-cols-5 gap-1",
|
|
2650
|
-
children: s.map(({ tool: e, icon: t, label: n }) => /* @__PURE__ */ P(
|
|
2535
|
+
children: s.map(({ tool: e, icon: t, label: n }) => /* @__PURE__ */ P(Si, {
|
|
2651
2536
|
value: e,
|
|
2652
2537
|
"aria-label": o(e, n),
|
|
2653
2538
|
title: o(e, n),
|
|
2654
|
-
className:
|
|
2539
|
+
className: Ei,
|
|
2655
2540
|
children: /* @__PURE__ */ P(t, { "aria-hidden": "true" })
|
|
2656
2541
|
}, e))
|
|
2657
2542
|
});
|
|
2658
2543
|
}
|
|
2659
2544
|
//#endregion
|
|
2660
2545
|
//#region lib/components/ui/media/image-editor/partials/editor-markup-panel.tsx
|
|
2661
|
-
function
|
|
2662
|
-
let { state: e, actions: t } =
|
|
2546
|
+
function qi() {
|
|
2547
|
+
let { state: e, actions: t } = R(), { t: n } = i();
|
|
2663
2548
|
return /* @__PURE__ */ F(N, { children: [
|
|
2664
|
-
/* @__PURE__ */ P(
|
|
2665
|
-
/* @__PURE__ */ P(
|
|
2666
|
-
/* @__PURE__ */ P(
|
|
2667
|
-
/* @__PURE__ */ P(
|
|
2549
|
+
/* @__PURE__ */ P(Ki, {}),
|
|
2550
|
+
/* @__PURE__ */ P(Gi, {}),
|
|
2551
|
+
/* @__PURE__ */ P(Ni, {}),
|
|
2552
|
+
/* @__PURE__ */ P(m, {
|
|
2668
2553
|
variant: "tonal",
|
|
2669
2554
|
color: "error",
|
|
2670
2555
|
size: "sm",
|
|
@@ -2677,21 +2562,21 @@ function ia() {
|
|
|
2677
2562
|
}
|
|
2678
2563
|
//#endregion
|
|
2679
2564
|
//#region lib/components/ui/media/image-editor/partials/editor-panel.tsx
|
|
2680
|
-
var
|
|
2565
|
+
var Ji = {
|
|
2681
2566
|
adjust: "Adjust",
|
|
2682
2567
|
filters: "Filters",
|
|
2683
2568
|
crop: "Crop & rotate",
|
|
2684
2569
|
markup: "Markup"
|
|
2685
|
-
},
|
|
2686
|
-
adjust:
|
|
2687
|
-
filters:
|
|
2688
|
-
crop:
|
|
2689
|
-
markup:
|
|
2570
|
+
}, Yi = {
|
|
2571
|
+
adjust: _i,
|
|
2572
|
+
filters: ji,
|
|
2573
|
+
crop: Ai,
|
|
2574
|
+
markup: qi
|
|
2690
2575
|
};
|
|
2691
|
-
function
|
|
2692
|
-
let { state: e, source: t } =
|
|
2576
|
+
function Xi() {
|
|
2577
|
+
let { state: e, source: t } = R(), { t: n } = i(), r = k();
|
|
2693
2578
|
if (t.status !== "ready") return null;
|
|
2694
|
-
let a =
|
|
2579
|
+
let a = Yi[e.tool];
|
|
2695
2580
|
return /* @__PURE__ */ F("section", {
|
|
2696
2581
|
"aria-labelledby": r,
|
|
2697
2582
|
"data-slot": "image-editor-panel",
|
|
@@ -2701,14 +2586,14 @@ function sa() {
|
|
|
2701
2586
|
id: r,
|
|
2702
2587
|
variant: "title-small",
|
|
2703
2588
|
className: "sticky top-0 z-10 bg-card px-4 pt-3 pb-2",
|
|
2704
|
-
children: n(`material.image-editor.panel.${e.tool}`,
|
|
2589
|
+
children: n(`material.image-editor.panel.${e.tool}`, Ji[e.tool])
|
|
2705
2590
|
}), /* @__PURE__ */ P("div", {
|
|
2706
2591
|
className: "flex flex-col gap-5 px-4 pb-4",
|
|
2707
2592
|
children: /* @__PURE__ */ P(a, {})
|
|
2708
2593
|
})]
|
|
2709
2594
|
});
|
|
2710
2595
|
}
|
|
2711
|
-
function
|
|
2596
|
+
function Zi({ title: e, action: t, children: n }) {
|
|
2712
2597
|
let r = k();
|
|
2713
2598
|
return /* @__PURE__ */ F("section", {
|
|
2714
2599
|
"aria-labelledby": r,
|
|
@@ -2726,7 +2611,7 @@ function ca({ title: e, action: t, children: n }) {
|
|
|
2726
2611
|
}
|
|
2727
2612
|
//#endregion
|
|
2728
2613
|
//#region lib/components/ui/media/compare-slider/partials/compare-slider-handle.tsx
|
|
2729
|
-
function
|
|
2614
|
+
function Qi({ current: e, onKeyDown: t }) {
|
|
2730
2615
|
let { t: n } = i();
|
|
2731
2616
|
return /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P("div", {
|
|
2732
2617
|
"aria-hidden": "true",
|
|
@@ -2743,7 +2628,7 @@ function la({ current: e, onKeyDown: t }) {
|
|
|
2743
2628
|
"data-slot": "compare-slider-handle",
|
|
2744
2629
|
onKeyDown: t,
|
|
2745
2630
|
className: "absolute top-1/2 left-(--compare-at) flex size-10 -translate-x-1/2 -translate-y-1/2 cursor-ew-resize items-center justify-center rounded-full border border-white/70 bg-white/85 text-black shadow-lg outline-none backdrop-blur-md transition-transform hover:scale-110 focus-visible:ring-[3px] focus-visible:ring-ring/70 motion-reduce:transition-none",
|
|
2746
|
-
children: /* @__PURE__ */ P(
|
|
2631
|
+
children: /* @__PURE__ */ P(xe, {
|
|
2747
2632
|
className: "size-5",
|
|
2748
2633
|
"aria-hidden": "true"
|
|
2749
2634
|
})
|
|
@@ -2751,18 +2636,18 @@ function la({ current: e, onKeyDown: t }) {
|
|
|
2751
2636
|
}
|
|
2752
2637
|
//#endregion
|
|
2753
2638
|
//#region lib/components/ui/media/compare-slider/compare-slider.utils.ts
|
|
2754
|
-
function
|
|
2639
|
+
function $(e) {
|
|
2755
2640
|
return Number.isNaN(e) ? 50 : Math.min(100, Math.max(0, e));
|
|
2756
2641
|
}
|
|
2757
|
-
function
|
|
2642
|
+
function $i(e, t, n) {
|
|
2758
2643
|
let r = n ? 10 : 1;
|
|
2759
2644
|
switch (e) {
|
|
2760
2645
|
case "ArrowLeft":
|
|
2761
|
-
case "ArrowDown": return
|
|
2646
|
+
case "ArrowDown": return $(t - r);
|
|
2762
2647
|
case "ArrowRight":
|
|
2763
|
-
case "ArrowUp": return
|
|
2764
|
-
case "PageDown": return
|
|
2765
|
-
case "PageUp": return
|
|
2648
|
+
case "ArrowUp": return $(t + r);
|
|
2649
|
+
case "PageDown": return $(t - 10);
|
|
2650
|
+
case "PageUp": return $(t + 10);
|
|
2766
2651
|
case "Home": return 0;
|
|
2767
2652
|
case "End": return 100;
|
|
2768
2653
|
default: return null;
|
|
@@ -2770,13 +2655,13 @@ function ua(e, t, n) {
|
|
|
2770
2655
|
}
|
|
2771
2656
|
//#endregion
|
|
2772
2657
|
//#region lib/components/ui/media/compare-slider/use-compare-slider.ts
|
|
2773
|
-
function
|
|
2774
|
-
let r = j(null), i = j(!1), [a, o] = M(t), s =
|
|
2775
|
-
|
|
2658
|
+
function ea({ position: e, defaultPosition: t, onPositionChange: n }) {
|
|
2659
|
+
let r = j(null), i = j(!1), [a, o] = M(t), s = $(e ?? a);
|
|
2660
|
+
he(() => {
|
|
2776
2661
|
r.current?.style.setProperty("--compare-at", `${s}%`);
|
|
2777
2662
|
}, [s]);
|
|
2778
2663
|
let c = (t) => {
|
|
2779
|
-
let r =
|
|
2664
|
+
let r = $(t);
|
|
2780
2665
|
e === void 0 && o(r), n?.(r);
|
|
2781
2666
|
}, l = (e) => {
|
|
2782
2667
|
let t = r.current?.getBoundingClientRect();
|
|
@@ -2786,7 +2671,7 @@ function da({ position: e, defaultPosition: t, onPositionChange: n }) {
|
|
|
2786
2671
|
rootRef: r,
|
|
2787
2672
|
current: s,
|
|
2788
2673
|
onKeyDown: (e) => {
|
|
2789
|
-
let t =
|
|
2674
|
+
let t = $i(e.key, s, e.shiftKey);
|
|
2790
2675
|
t !== null && (e.preventDefault(), c(t));
|
|
2791
2676
|
},
|
|
2792
2677
|
rootHandlers: {
|
|
@@ -2807,9 +2692,9 @@ function da({ position: e, defaultPosition: t, onPositionChange: n }) {
|
|
|
2807
2692
|
}
|
|
2808
2693
|
//#endregion
|
|
2809
2694
|
//#region lib/components/ui/media/compare-slider/compare-slider.tsx
|
|
2810
|
-
var
|
|
2811
|
-
function
|
|
2812
|
-
let { t: u } = i(), { rootRef: d, current: f, onKeyDown: p, rootHandlers: m } =
|
|
2695
|
+
var ta = "pointer-events-none absolute top-3 rounded-full bg-black/55 px-2.5 py-1 font-medium text-white text-xs backdrop-blur-md";
|
|
2696
|
+
function na({ before: e, after: t, position: n, defaultPosition: r = 50, onPositionChange: a, beforeLabel: o, afterLabel: s, showLabels: c = !0, className: l }) {
|
|
2697
|
+
let { t: u } = i(), { rootRef: d, current: f, onKeyDown: p, rootHandlers: m } = ea({
|
|
2813
2698
|
position: n,
|
|
2814
2699
|
defaultPosition: r,
|
|
2815
2700
|
onPositionChange: a
|
|
@@ -2831,13 +2716,13 @@ function pa({ before: e, after: t, position: n, defaultPosition: r = 50, onPosit
|
|
|
2831
2716
|
children: e
|
|
2832
2717
|
}),
|
|
2833
2718
|
c && /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P("span", {
|
|
2834
|
-
className: T(
|
|
2719
|
+
className: T(ta, "left-3"),
|
|
2835
2720
|
children: o ?? u("material.compare-slider.before", "Before")
|
|
2836
2721
|
}), /* @__PURE__ */ P("span", {
|
|
2837
|
-
className: T(
|
|
2722
|
+
className: T(ta, "right-3"),
|
|
2838
2723
|
children: s ?? u("material.compare-slider.after", "After")
|
|
2839
2724
|
})] }),
|
|
2840
|
-
/* @__PURE__ */ P(
|
|
2725
|
+
/* @__PURE__ */ P(Qi, {
|
|
2841
2726
|
current: f,
|
|
2842
2727
|
onKeyDown: p
|
|
2843
2728
|
})
|
|
@@ -2846,30 +2731,30 @@ function pa({ before: e, after: t, position: n, defaultPosition: r = 50, onPosit
|
|
|
2846
2731
|
}
|
|
2847
2732
|
//#endregion
|
|
2848
2733
|
//#region lib/components/ui/media/image-editor/use-stage-fit.ts
|
|
2849
|
-
var
|
|
2734
|
+
var ra = (e) => e === "crop" ? "full" : "crop", ia = {
|
|
2850
2735
|
x: 0,
|
|
2851
2736
|
y: 0,
|
|
2852
2737
|
w: 1,
|
|
2853
2738
|
h: 1
|
|
2854
|
-
},
|
|
2855
|
-
function
|
|
2739
|
+
}, aa = (e, t) => ra(e) === "crop" ? t : ia, oa = 24, sa = 80, ca = 216, la = 2;
|
|
2740
|
+
function ua(e, t, n, r, i = !1) {
|
|
2856
2741
|
let [a, o] = M(null);
|
|
2857
2742
|
O(() => {
|
|
2858
2743
|
let t = e.current;
|
|
2859
2744
|
if (!t) return;
|
|
2860
|
-
let n = i ?
|
|
2745
|
+
let n = i ? ca : sa;
|
|
2861
2746
|
t.style.setProperty("--stage-dock", `${n}px`);
|
|
2862
2747
|
let r = () => o({
|
|
2863
|
-
width: Math.max(1, t.clientWidth -
|
|
2864
|
-
height: Math.max(1, t.clientHeight -
|
|
2748
|
+
width: Math.max(1, t.clientWidth - oa * 2),
|
|
2749
|
+
height: Math.max(1, t.clientHeight - oa - n)
|
|
2865
2750
|
});
|
|
2866
2751
|
r();
|
|
2867
2752
|
let a = new ResizeObserver(r);
|
|
2868
2753
|
return a.observe(t), () => a.disconnect();
|
|
2869
2754
|
}, [e, i]);
|
|
2870
|
-
let s = a && t && t.width > 0 && t.height > 0 ? Math.min(
|
|
2755
|
+
let s = a && t && t.width > 0 && t.height > 0 ? Math.min(la, a.width / t.width, a.height / t.height) : 1;
|
|
2871
2756
|
r.fitRef.current = s;
|
|
2872
|
-
let c =
|
|
2757
|
+
let c = p(r.zoomBy);
|
|
2873
2758
|
return O(() => {
|
|
2874
2759
|
let t = e.current;
|
|
2875
2760
|
if (!t) return;
|
|
@@ -2881,28 +2766,28 @@ function xa(e, t, n, r, i = !1) {
|
|
|
2881
2766
|
}
|
|
2882
2767
|
//#endregion
|
|
2883
2768
|
//#region lib/components/ui/media/image-editor/image-editor.stage-paint.ts
|
|
2884
|
-
var
|
|
2885
|
-
function
|
|
2886
|
-
let i =
|
|
2769
|
+
var da = 4096;
|
|
2770
|
+
function fa(e, t, n, r) {
|
|
2771
|
+
let i = K(e, t.transform.quarterTurns), a = n === "crop" ? t.crop : {
|
|
2887
2772
|
w: 1,
|
|
2888
2773
|
h: 1
|
|
2889
2774
|
}, o = a.w * i.width, s = Math.max(o, a.h * i.height), c = r * (typeof window > "u" ? 1 : window.devicePixelRatio || 1) / o;
|
|
2890
|
-
return Math.max(.01, Math.min(1, c,
|
|
2775
|
+
return Math.max(.01, Math.min(1, c, da / s));
|
|
2891
2776
|
}
|
|
2892
|
-
function
|
|
2777
|
+
function pa(e, t, n, r) {
|
|
2893
2778
|
if (r <= 0) return 0;
|
|
2894
|
-
let i =
|
|
2779
|
+
let i = K(e, t.transform.quarterTurns);
|
|
2895
2780
|
return 24 * ((n === "crop" ? t.crop.w : 1) * i.width) / r;
|
|
2896
2781
|
}
|
|
2897
|
-
function
|
|
2898
|
-
let r =
|
|
2782
|
+
function ma(e, t, n) {
|
|
2783
|
+
let r = Wn(t, n), i = 6 / e.getTransform().a;
|
|
2899
2784
|
e.save(), e.lineWidth = 1.5 / e.getTransform().a, e.setLineDash([6 / e.getTransform().a, 4 / e.getTransform().a]), e.strokeStyle = "#ffffff", e.shadowColor = "rgba(0,0,0,0.6)", e.shadowBlur = 3, e.strokeRect(r.x * n.width - i, r.y * n.height - i, r.w * n.width + i * 2, r.h * n.height + i * 2), e.restore();
|
|
2900
2785
|
}
|
|
2901
|
-
function
|
|
2786
|
+
function ha(e, t, n, r, i) {
|
|
2902
2787
|
let { source: a, edits: o, region: s, scale: c, comparing: l, hiddenId: u, selectedId: d, stepFloor: f } = r;
|
|
2903
2788
|
if (e.width !== t.width && (e.width = t.width), e.height !== t.height && (e.height = t.height), n.setTransform(1, 0, 0, 1, 0, 0), n.clearRect(0, 0, e.width, e.height), n.drawImage(t, 0, 0), l) return;
|
|
2904
|
-
let p =
|
|
2905
|
-
|
|
2789
|
+
let p = Yn(o.annotations, u), m = i ? [...p.filter((e) => e.id !== i.id), i] : p;
|
|
2790
|
+
Rr(n, a, {
|
|
2906
2791
|
...o,
|
|
2907
2792
|
annotations: m
|
|
2908
2793
|
}, {
|
|
@@ -2913,17 +2798,17 @@ function Ea(e, t, n, r, i) {
|
|
|
2913
2798
|
let h = p.find((e) => e.id === d);
|
|
2914
2799
|
if (!h) return;
|
|
2915
2800
|
let g = {
|
|
2916
|
-
...
|
|
2801
|
+
...K(a, o.transform.quarterTurns),
|
|
2917
2802
|
stepFloor: f
|
|
2918
2803
|
}, _ = s === "crop" ? o.crop : {
|
|
2919
2804
|
x: 0,
|
|
2920
2805
|
y: 0
|
|
2921
2806
|
};
|
|
2922
|
-
n.setTransform(c, 0, 0, c, -_.x * g.width * c, -_.y * g.height * c),
|
|
2807
|
+
n.setTransform(c, 0, 0, c, -_.x * g.width * c, -_.y * g.height * c), ma(n, h, g);
|
|
2923
2808
|
}
|
|
2924
2809
|
//#endregion
|
|
2925
2810
|
//#region lib/components/ui/media/image-editor/use-stage-layer-key.ts
|
|
2926
|
-
function
|
|
2811
|
+
function ga(e, t, n, r) {
|
|
2927
2812
|
let { adjustments: i, filter: a, filterIntensity: o, transform: s, crop: c } = e;
|
|
2928
2813
|
return A(() => JSON.stringify([
|
|
2929
2814
|
i,
|
|
@@ -2947,10 +2832,10 @@ function Da(e, t, n, r) {
|
|
|
2947
2832
|
}
|
|
2948
2833
|
//#endregion
|
|
2949
2834
|
//#region lib/components/ui/media/image-editor/use-stage-render.ts
|
|
2950
|
-
function
|
|
2951
|
-
let u = j(null), d = j(0), f =
|
|
2835
|
+
function _a({ canvasRef: e, source: t, edits: n, region: r, displayWidth: i, comparing: a, selectedId: o, hiddenId: s = null, active: c = !0, mountKey: l }) {
|
|
2836
|
+
let u = j(null), d = j(0), f = fa(t, n, r, i), p = pa(t, n, r, i), m = ga(n, r, f, a), h = D((i) => {
|
|
2952
2837
|
let c = e.current, l = u.current, d = c?.getContext("2d");
|
|
2953
|
-
!c || !l || !d ||
|
|
2838
|
+
!c || !l || !d || ha(c, l, d, {
|
|
2954
2839
|
source: t,
|
|
2955
2840
|
edits: n,
|
|
2956
2841
|
region: r,
|
|
@@ -2973,7 +2858,7 @@ function Oa({ canvasRef: e, source: t, edits: n, region: r, displayWidth: i, com
|
|
|
2973
2858
|
]);
|
|
2974
2859
|
return O(() => {
|
|
2975
2860
|
if (cancelAnimationFrame(d.current), c) return d.current = requestAnimationFrame(() => {
|
|
2976
|
-
u.current =
|
|
2861
|
+
u.current = zr(t, n, {
|
|
2977
2862
|
scale: f,
|
|
2978
2863
|
region: r,
|
|
2979
2864
|
edited: !a,
|
|
@@ -2998,7 +2883,7 @@ function Oa({ canvasRef: e, source: t, edits: n, region: r, displayWidth: i, com
|
|
|
2998
2883
|
}
|
|
2999
2884
|
//#endregion
|
|
3000
2885
|
//#region lib/components/ui/media/image-editor/use-crop-frame.ts
|
|
3001
|
-
function
|
|
2886
|
+
function va({ crop: e, base: t, ratio: n, actions: r }) {
|
|
3002
2887
|
let i = j(null), a = j(null), [o, s] = M(!1), [c, l] = M(!1), u = j(void 0);
|
|
3003
2888
|
return O(() => () => clearTimeout(u.current), []), {
|
|
3004
2889
|
layerRef: i,
|
|
@@ -3017,7 +2902,7 @@ function ka({ crop: e, base: t, ratio: n, actions: r }) {
|
|
|
3017
2902
|
onPointerMove: (e) => {
|
|
3018
2903
|
let o = a.current, s = i.current?.getBoundingClientRect();
|
|
3019
2904
|
if (!o || !s) return;
|
|
3020
|
-
let c = (e.clientX - o.x) / Math.max(1, s.width), l = (e.clientY - o.y) / Math.max(1, s.height), u =
|
|
2905
|
+
let c = (e.clientX - o.x) / Math.max(1, s.width), l = (e.clientY - o.y) / Math.max(1, s.height), u = Ln(o.crop, o.handle, c, l, n, t);
|
|
3021
2906
|
r.setCrop({
|
|
3022
2907
|
rect: u,
|
|
3023
2908
|
gesture: o.gesture
|
|
@@ -3035,7 +2920,7 @@ function ka({ crop: e, base: t, ratio: n, actions: r }) {
|
|
|
3035
2920
|
}[i.key];
|
|
3036
2921
|
if (!o) return;
|
|
3037
2922
|
i.preventDefault(), l(!0), clearTimeout(u.current), u.current = setTimeout(() => l(!1), 800);
|
|
3038
|
-
let s = i.shiftKey ? "se" : "move", c =
|
|
2923
|
+
let s = i.shiftKey ? "se" : "move", c = Ln(e, s, o[0], o[1], n, t);
|
|
3039
2924
|
r.setCrop({
|
|
3040
2925
|
rect: c,
|
|
3041
2926
|
gesture: `crop-key:${s}`
|
|
@@ -3045,7 +2930,7 @@ function ka({ crop: e, base: t, ratio: n, actions: r }) {
|
|
|
3045
2930
|
}
|
|
3046
2931
|
//#endregion
|
|
3047
2932
|
//#region lib/components/ui/media/image-editor/partials/crop-handles.ts
|
|
3048
|
-
var
|
|
2933
|
+
var ya = [
|
|
3049
2934
|
{
|
|
3050
2935
|
handle: "nw",
|
|
3051
2936
|
className: "top-0 left-0 cursor-nwse-resize rounded-tl-[3px] border-t-[3px] border-l-[3px]"
|
|
@@ -3081,7 +2966,7 @@ var Aa = [
|
|
|
3081
2966
|
];
|
|
3082
2967
|
//#endregion
|
|
3083
2968
|
//#region lib/components/ui/media/image-editor/partials/crop-readout.tsx
|
|
3084
|
-
function
|
|
2969
|
+
function ba({ crop: e, base: t, polite: n }) {
|
|
3085
2970
|
return /* @__PURE__ */ F("output", {
|
|
3086
2971
|
"data-slot": "image-editor-crop-readout",
|
|
3087
2972
|
"aria-live": n ? "polite" : "off",
|
|
@@ -3095,13 +2980,13 @@ function ja({ crop: e, base: t, polite: n }) {
|
|
|
3095
2980
|
}
|
|
3096
2981
|
//#endregion
|
|
3097
2982
|
//#region lib/components/ui/media/image-editor/partials/editor-crop-overlay.tsx
|
|
3098
|
-
var
|
|
3099
|
-
function
|
|
3100
|
-
let { base: e } =
|
|
3101
|
-
return e ? /* @__PURE__ */ P(
|
|
2983
|
+
var xa = (e) => `${e * 100}%`;
|
|
2984
|
+
function Sa() {
|
|
2985
|
+
let { base: e } = R();
|
|
2986
|
+
return e ? /* @__PURE__ */ P(Ca, { base: e }) : null;
|
|
3102
2987
|
}
|
|
3103
|
-
function
|
|
3104
|
-
let { state: t, actions: n, lockedAspect: r } =
|
|
2988
|
+
function Ca({ base: e }) {
|
|
2989
|
+
let { state: t, actions: n, lockedAspect: r } = R(), { t: a } = i(), o = k(), s = t.edits.crop, c = r ?? t.aspect, { layerRef: l, dragging: u, keying: d, setKeying: f, begin: p, onPointerMove: m, end: h, onKeyDown: g } = va({
|
|
3105
2990
|
crop: s,
|
|
3106
2991
|
base: e,
|
|
3107
2992
|
ratio: c === "original" ? e.width / e.height : c ?? null,
|
|
@@ -3123,10 +3008,10 @@ function Pa({ base: e }) {
|
|
|
3123
3008
|
"data-dragging": u || void 0,
|
|
3124
3009
|
className: "nxgt-image-editor-crop absolute cursor-move outline-offset-2 focus-visible:outline-[3px] focus-visible:outline-ring/60",
|
|
3125
3010
|
style: {
|
|
3126
|
-
left:
|
|
3127
|
-
top:
|
|
3128
|
-
width:
|
|
3129
|
-
height:
|
|
3011
|
+
left: xa(s.x),
|
|
3012
|
+
top: xa(s.y),
|
|
3013
|
+
width: xa(s.w),
|
|
3014
|
+
height: xa(s.h)
|
|
3130
3015
|
},
|
|
3131
3016
|
onPointerDown: p("move"),
|
|
3132
3017
|
onKeyDown: g,
|
|
@@ -3141,12 +3026,12 @@ function Pa({ base: e }) {
|
|
|
3141
3026
|
children: a("material.image-editor.crop.frame-hint", "Arrows move it, Shift + arrows resize it")
|
|
3142
3027
|
}),
|
|
3143
3028
|
/* @__PURE__ */ P("div", { className: "nxgt-image-editor-crop-grid pointer-events-none absolute inset-0" }),
|
|
3144
|
-
(u || d) && /* @__PURE__ */ P(
|
|
3029
|
+
(u || d) && /* @__PURE__ */ P(ba, {
|
|
3145
3030
|
crop: s,
|
|
3146
3031
|
base: e,
|
|
3147
3032
|
polite: d && !u
|
|
3148
3033
|
}),
|
|
3149
|
-
|
|
3034
|
+
ya.map(({ handle: e, className: t }) => /* @__PURE__ */ P("span", {
|
|
3150
3035
|
"aria-hidden": "true",
|
|
3151
3036
|
"data-handle": e,
|
|
3152
3037
|
onPointerDown: p(e),
|
|
@@ -3158,31 +3043,31 @@ function Pa({ base: e }) {
|
|
|
3158
3043
|
}
|
|
3159
3044
|
//#endregion
|
|
3160
3045
|
//#region lib/components/ui/media/image-editor/partials/editor-crop-strip.tsx
|
|
3161
|
-
function
|
|
3162
|
-
let { state: e, actions: t, lockedAspect: n, aspectPresets: r } =
|
|
3046
|
+
function wa() {
|
|
3047
|
+
let { state: e, actions: t, lockedAspect: n, aspectPresets: r } = R(), { t: a } = i(), { transform: o, crop: s } = e.edits, c = s.x === H.x && s.y === H.y && s.w === H.w && s.h === H.h, l = n === void 0 && r.length > 0;
|
|
3163
3048
|
return /* @__PURE__ */ F("section", {
|
|
3164
3049
|
"aria-label": a("material.image-editor.panel.crop", "Crop & rotate"),
|
|
3165
3050
|
"data-slot": "image-editor-crop-card",
|
|
3166
3051
|
className: "pointer-events-auto flex w-full max-w-3xl flex-col gap-2 rounded-2xl border bg-card p-2 shadow-lg",
|
|
3167
3052
|
children: [/* @__PURE__ */ F("div", {
|
|
3168
3053
|
className: "flex flex-wrap items-center gap-x-3 gap-y-1",
|
|
3169
|
-
children: [/* @__PURE__ */ P(
|
|
3054
|
+
children: [/* @__PURE__ */ P(ki, { compact: !0 }), /* @__PURE__ */ P(f, {
|
|
3170
3055
|
variant: "tonal",
|
|
3171
3056
|
color: "default",
|
|
3172
3057
|
tooltip: a("material.image-editor.crop.reset", "Reset crop & rotation"),
|
|
3173
|
-
disabled:
|
|
3058
|
+
disabled: zn(o) && c,
|
|
3174
3059
|
onClick: () => t.resetTransform(),
|
|
3175
|
-
children: /* @__PURE__ */ P(
|
|
3060
|
+
children: /* @__PURE__ */ P(Be, {})
|
|
3176
3061
|
})]
|
|
3177
3062
|
}), l && /* @__PURE__ */ P("div", {
|
|
3178
3063
|
className: "hidden @md:block",
|
|
3179
|
-
children: /* @__PURE__ */ P(
|
|
3064
|
+
children: /* @__PURE__ */ P(Di, { compact: !0 })
|
|
3180
3065
|
})]
|
|
3181
3066
|
});
|
|
3182
3067
|
}
|
|
3183
3068
|
//#endregion
|
|
3184
3069
|
//#region lib/components/ui/media/image-editor/partials/use-scroll-edges.ts
|
|
3185
|
-
function
|
|
3070
|
+
function Ta(e) {
|
|
3186
3071
|
let [t, n] = M({
|
|
3187
3072
|
start: !1,
|
|
3188
3073
|
end: !1
|
|
@@ -3206,7 +3091,7 @@ function Ia(e) {
|
|
|
3206
3091
|
};
|
|
3207
3092
|
}, [e]), t;
|
|
3208
3093
|
}
|
|
3209
|
-
function
|
|
3094
|
+
function Ea({ start: e, end: t }) {
|
|
3210
3095
|
if (!e && !t) return;
|
|
3211
3096
|
let n = `linear-gradient(to right, ${e ? "transparent" : "#000"}, #000 28px, #000 calc(100% - 28px), ${t ? "transparent" : "#000"})`;
|
|
3212
3097
|
return {
|
|
@@ -3216,7 +3101,7 @@ function La({ start: e, end: t }) {
|
|
|
3216
3101
|
}
|
|
3217
3102
|
//#endregion
|
|
3218
3103
|
//#region lib/components/ui/media/image-editor/partials/editor-floating-toolbar.tsx
|
|
3219
|
-
function
|
|
3104
|
+
function Da({ label: e, icon: t, showLabel: n, className: r, ...i }) {
|
|
3220
3105
|
return /* @__PURE__ */ F("button", {
|
|
3221
3106
|
type: "button",
|
|
3222
3107
|
"aria-label": e,
|
|
@@ -3230,21 +3115,21 @@ function $({ label: e, icon: t, showLabel: n, className: r, ...i }) {
|
|
|
3230
3115
|
})]
|
|
3231
3116
|
});
|
|
3232
3117
|
}
|
|
3233
|
-
var
|
|
3118
|
+
var Oa = () => /* @__PURE__ */ P("span", {
|
|
3234
3119
|
"aria-hidden": "true",
|
|
3235
3120
|
className: "mx-1 h-5 w-px shrink-0 bg-white/15"
|
|
3236
3121
|
});
|
|
3237
|
-
function
|
|
3238
|
-
let { state: e, actions: t, tools: n, markupTools: r } =
|
|
3239
|
-
return /* @__PURE__ */ F(N, { children: [n.includes("crop") && /* @__PURE__ */ P(
|
|
3122
|
+
function ka() {
|
|
3123
|
+
let { state: e, actions: t, tools: n, markupTools: r } = R(), { t: a } = i(), o = r ? r.flatMap((e) => Ti.filter((t) => t.tool === e)) : Ti;
|
|
3124
|
+
return /* @__PURE__ */ F(N, { children: [n.includes("crop") && /* @__PURE__ */ P(Da, {
|
|
3240
3125
|
label: a("material.image-editor.tool.crop", "Crop"),
|
|
3241
|
-
icon: /* @__PURE__ */ P(
|
|
3126
|
+
icon: /* @__PURE__ */ P(Te, { "aria-hidden": "true" }),
|
|
3242
3127
|
showLabel: e.tool === "crop",
|
|
3243
3128
|
"aria-pressed": e.tool === "crop",
|
|
3244
3129
|
onClick: () => t.setTool("crop")
|
|
3245
3130
|
}), n.includes("markup") && o.map(({ tool: n, icon: r, label: i }) => {
|
|
3246
3131
|
let o = e.tool === "markup" && e.markupTool === n;
|
|
3247
|
-
return /* @__PURE__ */ P(
|
|
3132
|
+
return /* @__PURE__ */ P(Da, {
|
|
3248
3133
|
label: a(`material.image-editor.markup.tool.${n}`, i),
|
|
3249
3134
|
icon: /* @__PURE__ */ P(r, { "aria-hidden": "true" }),
|
|
3250
3135
|
showLabel: o,
|
|
@@ -3255,44 +3140,44 @@ function za() {
|
|
|
3255
3140
|
}, n);
|
|
3256
3141
|
})] });
|
|
3257
3142
|
}
|
|
3258
|
-
function
|
|
3259
|
-
let { actions: e, selected: t, canUndo: n, canRedo: r } =
|
|
3143
|
+
function Aa() {
|
|
3144
|
+
let { actions: e, selected: t, canUndo: n, canRedo: r } = R(), { t: a } = i();
|
|
3260
3145
|
return /* @__PURE__ */ F(N, { children: [
|
|
3261
|
-
t && /* @__PURE__ */ P(
|
|
3146
|
+
t && /* @__PURE__ */ P(Da, {
|
|
3262
3147
|
label: a("material.image-editor.markup.delete", "Delete"),
|
|
3263
|
-
icon: /* @__PURE__ */ P(
|
|
3148
|
+
icon: /* @__PURE__ */ P(Je, { "aria-hidden": "true" }),
|
|
3264
3149
|
onClick: () => e.removeAnnotation(t.id)
|
|
3265
3150
|
}),
|
|
3266
|
-
/* @__PURE__ */ P(
|
|
3151
|
+
/* @__PURE__ */ P(Da, {
|
|
3267
3152
|
label: a("material.image-editor.undo", "Undo"),
|
|
3268
|
-
icon: /* @__PURE__ */ P(
|
|
3153
|
+
icon: /* @__PURE__ */ P(Xe, { "aria-hidden": "true" }),
|
|
3269
3154
|
disabled: !n,
|
|
3270
3155
|
onClick: () => e.undo()
|
|
3271
3156
|
}),
|
|
3272
|
-
/* @__PURE__ */ P(
|
|
3157
|
+
/* @__PURE__ */ P(Da, {
|
|
3273
3158
|
label: a("material.image-editor.redo", "Redo"),
|
|
3274
|
-
icon: /* @__PURE__ */ P(
|
|
3159
|
+
icon: /* @__PURE__ */ P(ze, { "aria-hidden": "true" }),
|
|
3275
3160
|
disabled: !r,
|
|
3276
3161
|
onClick: () => e.redo()
|
|
3277
3162
|
})
|
|
3278
3163
|
] });
|
|
3279
3164
|
}
|
|
3280
|
-
function
|
|
3281
|
-
let { source: e } =
|
|
3282
|
-
return e.status === "ready" ? /* @__PURE__ */ P(
|
|
3165
|
+
function ja() {
|
|
3166
|
+
let { source: e } = R();
|
|
3167
|
+
return e.status === "ready" ? /* @__PURE__ */ P(Ma, {}) : null;
|
|
3283
3168
|
}
|
|
3284
|
-
function
|
|
3285
|
-
let { state: e, actions: t, tools: n, colors: r } =
|
|
3169
|
+
function Ma() {
|
|
3170
|
+
let { state: e, actions: t, tools: n, colors: r } = R(), { t: a } = i(), o = j(null), s = Ta(o);
|
|
3286
3171
|
return /* @__PURE__ */ F("div", {
|
|
3287
3172
|
ref: o,
|
|
3288
3173
|
role: "toolbar",
|
|
3289
3174
|
"aria-label": a("material.image-editor.floating-tools", "Editing tools"),
|
|
3290
|
-
style:
|
|
3175
|
+
style: Ea(s),
|
|
3291
3176
|
"data-slot": "image-editor-floating-toolbar",
|
|
3292
3177
|
className: "nxgt-image-editor-glass dark pointer-events-auto flex max-w-full items-center gap-1 overflow-x-auto rounded-full p-1.5",
|
|
3293
3178
|
children: [
|
|
3294
|
-
/* @__PURE__ */ P(
|
|
3295
|
-
n.includes("markup") && /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(
|
|
3179
|
+
/* @__PURE__ */ P(ka, {}),
|
|
3180
|
+
n.includes("markup") && /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(Oa, {}), /* @__PURE__ */ P(Hi, {
|
|
3296
3181
|
colors: r.slice(0, 5),
|
|
3297
3182
|
size: "xs",
|
|
3298
3183
|
custom: !0,
|
|
@@ -3301,15 +3186,15 @@ function Ha() {
|
|
|
3301
3186
|
value: e.brush.color,
|
|
3302
3187
|
onChange: (e) => t.setBrush({ color: e })
|
|
3303
3188
|
})] }),
|
|
3304
|
-
/* @__PURE__ */ P(
|
|
3305
|
-
/* @__PURE__ */ P(
|
|
3189
|
+
/* @__PURE__ */ P(Oa, {}),
|
|
3190
|
+
/* @__PURE__ */ P(Aa, {})
|
|
3306
3191
|
]
|
|
3307
3192
|
});
|
|
3308
3193
|
}
|
|
3309
3194
|
//#endregion
|
|
3310
3195
|
//#region lib/components/ui/media/image-editor/use-markup-text.ts
|
|
3311
|
-
function
|
|
3312
|
-
let { state: e, actions: t } =
|
|
3196
|
+
function Na() {
|
|
3197
|
+
let { state: e, actions: t } = R(), [n, r] = M(null), { brush: i, edits: a } = e, o = n?.id ?? null, { setEditingId: s } = t;
|
|
3313
3198
|
return O(() => (s(o), () => s(null)), [o, s]), {
|
|
3314
3199
|
draft: n,
|
|
3315
3200
|
setDraft: r,
|
|
@@ -3321,7 +3206,7 @@ function Ua() {
|
|
|
3321
3206
|
...s,
|
|
3322
3207
|
text: e
|
|
3323
3208
|
} }) : t.addAnnotation({
|
|
3324
|
-
id:
|
|
3209
|
+
id: Jn(),
|
|
3325
3210
|
kind: "text",
|
|
3326
3211
|
x: o.x,
|
|
3327
3212
|
y: o.y,
|
|
@@ -3335,9 +3220,9 @@ function Ua() {
|
|
|
3335
3220
|
}
|
|
3336
3221
|
//#endregion
|
|
3337
3222
|
//#region lib/components/ui/media/image-editor/image-editor.stage-gestures.ts
|
|
3338
|
-
function
|
|
3223
|
+
function Pa(e, t, n) {
|
|
3339
3224
|
let r = {
|
|
3340
|
-
id:
|
|
3225
|
+
id: Jn(),
|
|
3341
3226
|
color: n.color,
|
|
3342
3227
|
size: n.size
|
|
3343
3228
|
};
|
|
@@ -3371,9 +3256,9 @@ function Wa(e, t, n) {
|
|
|
3371
3256
|
h: 0
|
|
3372
3257
|
} : null;
|
|
3373
3258
|
}
|
|
3374
|
-
function
|
|
3259
|
+
function Fa(e, t) {
|
|
3375
3260
|
return {
|
|
3376
|
-
id:
|
|
3261
|
+
id: Jn(),
|
|
3377
3262
|
kind: "step",
|
|
3378
3263
|
color: t.color,
|
|
3379
3264
|
size: t.size,
|
|
@@ -3382,7 +3267,7 @@ function Ga(e, t) {
|
|
|
3382
3267
|
n: 0
|
|
3383
3268
|
};
|
|
3384
3269
|
}
|
|
3385
|
-
function
|
|
3270
|
+
function Ia(e, t, n) {
|
|
3386
3271
|
switch (e.kind) {
|
|
3387
3272
|
case "pen":
|
|
3388
3273
|
case "highlighter": return {
|
|
@@ -3403,17 +3288,17 @@ function Ka(e, t, n) {
|
|
|
3403
3288
|
case "ellipse":
|
|
3404
3289
|
case "redact": return {
|
|
3405
3290
|
...e,
|
|
3406
|
-
...
|
|
3291
|
+
...Nn(t.x, t.y, n.x, n.y)
|
|
3407
3292
|
};
|
|
3408
3293
|
default: return e;
|
|
3409
3294
|
}
|
|
3410
3295
|
}
|
|
3411
|
-
function
|
|
3296
|
+
function La(e) {
|
|
3412
3297
|
return e.kind === "line" || e.kind === "arrow" ? Math.hypot(e.x2 - e.x1, e.y2 - e.y1) > .005 : e.kind === "rect" || e.kind === "ellipse" || e.kind === "redact" ? e.w > .005 && e.h > .005 : !0;
|
|
3413
3298
|
}
|
|
3414
|
-
function
|
|
3299
|
+
function Ra(e, t) {
|
|
3415
3300
|
if (e.tool === "select") {
|
|
3416
|
-
let n =
|
|
3301
|
+
let n = Y(e.annotations, t.x, t.y, e.base);
|
|
3417
3302
|
return e.select(n?.id ?? null), n ? {
|
|
3418
3303
|
kind: "move",
|
|
3419
3304
|
id: n.id,
|
|
@@ -3422,11 +3307,11 @@ function Ja(e, t) {
|
|
|
3422
3307
|
} : null;
|
|
3423
3308
|
}
|
|
3424
3309
|
if (e.tool === "eraser") {
|
|
3425
|
-
let n =
|
|
3310
|
+
let n = Y(e.annotations, t.x, t.y, e.base);
|
|
3426
3311
|
return n && e.remove(n.id), { kind: "erase" };
|
|
3427
3312
|
}
|
|
3428
3313
|
if (e.tool === "text") {
|
|
3429
|
-
let n =
|
|
3314
|
+
let n = Y(e.annotations, t.x, t.y, e.base);
|
|
3430
3315
|
return {
|
|
3431
3316
|
kind: "text",
|
|
3432
3317
|
at: t,
|
|
@@ -3434,15 +3319,15 @@ function Ja(e, t) {
|
|
|
3434
3319
|
};
|
|
3435
3320
|
}
|
|
3436
3321
|
if (e.tool === "step") {
|
|
3437
|
-
let n =
|
|
3322
|
+
let n = Y(e.annotations, t.x, t.y, e.base);
|
|
3438
3323
|
return n?.kind === "step" ? (e.select(n.id), {
|
|
3439
3324
|
kind: "move",
|
|
3440
3325
|
id: n.id,
|
|
3441
3326
|
last: t,
|
|
3442
3327
|
gesture: `move:${n.id}:${Date.now()}`
|
|
3443
|
-
}) : (e.add(
|
|
3328
|
+
}) : (e.add(Fa(t, e.brush)), { kind: "place" });
|
|
3444
3329
|
}
|
|
3445
|
-
let n =
|
|
3330
|
+
let n = Pa(e.tool, t, e.brush);
|
|
3446
3331
|
return n ? {
|
|
3447
3332
|
kind: "draw",
|
|
3448
3333
|
mark: n,
|
|
@@ -3451,7 +3336,7 @@ function Ja(e, t) {
|
|
|
3451
3336
|
}
|
|
3452
3337
|
//#endregion
|
|
3453
3338
|
//#region lib/components/ui/media/image-editor/use-stage-pointer.ts
|
|
3454
|
-
function
|
|
3339
|
+
function za(e) {
|
|
3455
3340
|
let t = j(null), n = e, r = (e) => {
|
|
3456
3341
|
let t = e.currentTarget.getBoundingClientRect(), r = (e.clientX - t.left) / Math.max(1, t.width), i = (e.clientY - t.top) / Math.max(1, t.height);
|
|
3457
3342
|
return {
|
|
@@ -3459,20 +3344,20 @@ function Ya(e) {
|
|
|
3459
3344
|
y: n.view.y + i * n.view.h
|
|
3460
3345
|
};
|
|
3461
3346
|
}, i = (e) => {
|
|
3462
|
-
let t =
|
|
3347
|
+
let t = Y(n.annotations, e.x, e.y, n.base);
|
|
3463
3348
|
t && n.remove(t.id);
|
|
3464
3349
|
}, a = (e) => {
|
|
3465
3350
|
if (e.button !== 0) return;
|
|
3466
3351
|
let i = r(e);
|
|
3467
|
-
e.currentTarget.setPointerCapture?.(e.pointerId), t.current =
|
|
3352
|
+
e.currentTarget.setPointerCapture?.(e.pointerId), t.current = Ra(n, i);
|
|
3468
3353
|
}, o = (e) => {
|
|
3469
3354
|
let a = t.current;
|
|
3470
3355
|
if (!a || a.kind === "text" || a.kind === "place") return;
|
|
3471
3356
|
let o = r(e);
|
|
3472
|
-
a.kind === "erase" ? i(o) : a.kind === "move" ? (n.move(a.id, o.x - a.last.x, o.y - a.last.y, a.gesture), a.last = o) : (a.mark =
|
|
3357
|
+
a.kind === "erase" ? i(o) : a.kind === "move" ? (n.move(a.id, o.x - a.last.x, o.y - a.last.y, a.gesture), a.last = o) : (a.mark = Ia(a.mark, a.start, o), n.paint(a.mark));
|
|
3473
3358
|
}, s = (e) => {
|
|
3474
3359
|
let r = t.current;
|
|
3475
|
-
t.current = null, r?.kind === "text" && e.type === "pointerup" && n.editText(r.at, r.mark), r?.kind === "draw" &&
|
|
3360
|
+
t.current = null, r?.kind === "text" && e.type === "pointerup" && n.editText(r.at, r.mark), r?.kind === "draw" && La(r.mark) ? n.add(r.mark) : r?.kind === "draw" && n.paint(), r?.kind === "move" && n.endGesture();
|
|
3476
3361
|
};
|
|
3477
3362
|
return {
|
|
3478
3363
|
onPointerDown: a,
|
|
@@ -3481,7 +3366,7 @@ function Ya(e) {
|
|
|
3481
3366
|
onPointerCancel: s,
|
|
3482
3367
|
onDoubleClick: (e) => {
|
|
3483
3368
|
if (n.tool !== "select") return;
|
|
3484
|
-
let t = r(e), i =
|
|
3369
|
+
let t = r(e), i = Y(n.annotations, t.x, t.y, n.base);
|
|
3485
3370
|
i?.kind === "text" && n.editText({
|
|
3486
3371
|
x: i.x,
|
|
3487
3372
|
y: i.y
|
|
@@ -3491,9 +3376,9 @@ function Ya(e) {
|
|
|
3491
3376
|
}
|
|
3492
3377
|
//#endregion
|
|
3493
3378
|
//#region lib/components/ui/media/image-editor/partials/editor-text-box.tsx
|
|
3494
|
-
var
|
|
3495
|
-
function
|
|
3496
|
-
let { t: s } = i(), [c, l] = M(e.text), u = j(null), d = j(!1), f =
|
|
3379
|
+
var Ba = (e) => `${e * 100}%`;
|
|
3380
|
+
function Va({ draft: e, view: t, base: n, scale: r, onCommit: a, onCancel: o }) {
|
|
3381
|
+
let { t: s } = i(), [c, l] = M(e.text), u = j(null), d = j(!1), f = Un(e.size, n) * r, p = c.split("\n");
|
|
3497
3382
|
O(() => {
|
|
3498
3383
|
u.current?.focus();
|
|
3499
3384
|
}, []);
|
|
@@ -3513,10 +3398,10 @@ function Za({ draft: e, view: t, base: n, scale: r, onCommit: a, onCancel: o })
|
|
|
3513
3398
|
onKeyDown: (e) => {
|
|
3514
3399
|
e.stopPropagation(), e.key === "Escape" ? (d.current = !0, o()) : e.key === "Enter" && !e.shiftKey && (e.preventDefault(), m());
|
|
3515
3400
|
},
|
|
3516
|
-
className: T("absolute z-10 resize-none overflow-hidden rounded-sm border border-white/80 border-dashed p-0 font-semibold leading-tight outline-none ring-2 ring-black/40",
|
|
3401
|
+
className: T("absolute z-10 resize-none overflow-hidden rounded-sm border border-white/80 border-dashed p-0 font-semibold leading-tight outline-none ring-2 ring-black/40", ur(e.color) ? "bg-black/55" : "bg-white/85"),
|
|
3517
3402
|
style: {
|
|
3518
|
-
left:
|
|
3519
|
-
top:
|
|
3403
|
+
left: Ba((e.x - t.x) / t.w),
|
|
3404
|
+
top: Ba((e.y - t.y) / t.h),
|
|
3520
3405
|
color: e.color,
|
|
3521
3406
|
fontSize: f,
|
|
3522
3407
|
fontFamily: "Inter, \"Segoe UI\", system-ui, sans-serif"
|
|
@@ -3525,7 +3410,7 @@ function Za({ draft: e, view: t, base: n, scale: r, onCommit: a, onCancel: o })
|
|
|
3525
3410
|
}
|
|
3526
3411
|
//#endregion
|
|
3527
3412
|
//#region lib/components/ui/media/image-editor/partials/editor-markup-layer.tsx
|
|
3528
|
-
var
|
|
3413
|
+
var Ha = {
|
|
3529
3414
|
select: "cursor-default",
|
|
3530
3415
|
pen: "cursor-crosshair",
|
|
3531
3416
|
highlighter: "cursor-crosshair",
|
|
@@ -3537,9 +3422,9 @@ var Qa = {
|
|
|
3537
3422
|
text: "cursor-text",
|
|
3538
3423
|
step: "cursor-crosshair",
|
|
3539
3424
|
redact: "cursor-crosshair"
|
|
3540
|
-
},
|
|
3541
|
-
function
|
|
3542
|
-
let { state: t, actions: n, base: r, view: i, scale: a } =
|
|
3425
|
+
}, Ua = "[data-slot=\"image-editor-text-box\"]";
|
|
3426
|
+
function Wa({ paint: e }) {
|
|
3427
|
+
let { state: t, actions: n, base: r, view: i, scale: a } = R(), { draft: o, setDraft: s, commitText: c } = Na(), l = j(null), { brush: u, markupTool: d, edits: f } = t, p = za({
|
|
3543
3428
|
tool: d,
|
|
3544
3429
|
brush: u,
|
|
3545
3430
|
base: {
|
|
@@ -3576,15 +3461,15 @@ function eo({ paint: e }) {
|
|
|
3576
3461
|
ref: l,
|
|
3577
3462
|
"data-slot": "image-editor-markup-layer",
|
|
3578
3463
|
"data-tool": d,
|
|
3579
|
-
className: T("absolute inset-0 touch-none",
|
|
3464
|
+
className: T("absolute inset-0 touch-none", Ha[d]),
|
|
3580
3465
|
...p,
|
|
3581
3466
|
onPointerDown: (e) => {
|
|
3582
|
-
o && e.target === e.currentTarget && l.current?.querySelector(
|
|
3467
|
+
o && e.target === e.currentTarget && l.current?.querySelector(Ua)?.blur(), p.onPointerDown(e);
|
|
3583
3468
|
},
|
|
3584
3469
|
onMouseDown: (e) => {
|
|
3585
3470
|
d === "text" && e.target === e.currentTarget && e.preventDefault();
|
|
3586
3471
|
},
|
|
3587
|
-
children: o && /* @__PURE__ */ P(
|
|
3472
|
+
children: o && /* @__PURE__ */ P(Va, {
|
|
3588
3473
|
draft: o,
|
|
3589
3474
|
view: i,
|
|
3590
3475
|
base: r,
|
|
@@ -3596,7 +3481,7 @@ function eo({ paint: e }) {
|
|
|
3596
3481
|
}
|
|
3597
3482
|
//#endregion
|
|
3598
3483
|
//#region lib/components/ui/media/image-editor/partials/editor-stage-dock.tsx
|
|
3599
|
-
function
|
|
3484
|
+
function Ga({ label: e, children: t, className: n, ...r }) {
|
|
3600
3485
|
return /* @__PURE__ */ P("button", {
|
|
3601
3486
|
type: "button",
|
|
3602
3487
|
"aria-label": e,
|
|
@@ -3606,8 +3491,8 @@ function to({ label: e, children: t, className: n, ...r }) {
|
|
|
3606
3491
|
children: t
|
|
3607
3492
|
});
|
|
3608
3493
|
}
|
|
3609
|
-
function
|
|
3610
|
-
let { state: e, actions: t, zoom: n, scale: r, source: a, canUndo: o } =
|
|
3494
|
+
function Ka() {
|
|
3495
|
+
let { state: e, actions: t, zoom: n, scale: r, source: a, canUndo: o } = R(), { t: s } = i();
|
|
3611
3496
|
if (a.status !== "ready") return null;
|
|
3612
3497
|
let c = Math.round(r * 100), l = e.zoom === null, u = () => t.setComparing(!1);
|
|
3613
3498
|
return /* @__PURE__ */ F("div", {
|
|
@@ -3616,11 +3501,11 @@ function no() {
|
|
|
3616
3501
|
"data-slot": "image-editor-dock",
|
|
3617
3502
|
className: "nxgt-image-editor-glass pointer-events-auto flex items-center gap-0.5 rounded-full p-1",
|
|
3618
3503
|
children: [
|
|
3619
|
-
/* @__PURE__ */ P(
|
|
3504
|
+
/* @__PURE__ */ P(Ga, {
|
|
3620
3505
|
label: s("material.image-editor.zoom-out", "Zoom out"),
|
|
3621
|
-
disabled: r <=
|
|
3506
|
+
disabled: r <= Sn,
|
|
3622
3507
|
onClick: () => n.zoomOut(),
|
|
3623
|
-
children: /* @__PURE__ */ P(
|
|
3508
|
+
children: /* @__PURE__ */ P(et, { "aria-hidden": "true" })
|
|
3624
3509
|
}),
|
|
3625
3510
|
/* @__PURE__ */ P("button", {
|
|
3626
3511
|
type: "button",
|
|
@@ -3632,24 +3517,24 @@ function no() {
|
|
|
3632
3517
|
children: [c, "%"]
|
|
3633
3518
|
})
|
|
3634
3519
|
}),
|
|
3635
|
-
/* @__PURE__ */ P(
|
|
3520
|
+
/* @__PURE__ */ P(Ga, {
|
|
3636
3521
|
label: s("material.image-editor.zoom-in", "Zoom in"),
|
|
3637
3522
|
disabled: r >= 8,
|
|
3638
3523
|
onClick: () => n.zoomIn(),
|
|
3639
|
-
children: /* @__PURE__ */ P(
|
|
3524
|
+
children: /* @__PURE__ */ P($e, { "aria-hidden": "true" })
|
|
3640
3525
|
}),
|
|
3641
3526
|
/* @__PURE__ */ P("span", {
|
|
3642
3527
|
"aria-hidden": "true",
|
|
3643
3528
|
className: "mx-1 h-5 w-px bg-white/15"
|
|
3644
3529
|
}),
|
|
3645
|
-
/* @__PURE__ */ P(
|
|
3530
|
+
/* @__PURE__ */ P(Ga, {
|
|
3646
3531
|
label: s("material.image-editor.split", "Before and after"),
|
|
3647
3532
|
"aria-pressed": e.split,
|
|
3648
3533
|
disabled: !o && !e.split,
|
|
3649
3534
|
onClick: () => t.setSplit(!e.split),
|
|
3650
|
-
children: /* @__PURE__ */ P(
|
|
3535
|
+
children: /* @__PURE__ */ P(Ce, { "aria-hidden": "true" })
|
|
3651
3536
|
}),
|
|
3652
|
-
/* @__PURE__ */ P(
|
|
3537
|
+
/* @__PURE__ */ P(Ga, {
|
|
3653
3538
|
label: s("material.image-editor.compare", "Hold to compare"),
|
|
3654
3539
|
"aria-pressed": e.comparing,
|
|
3655
3540
|
disabled: !o || e.split,
|
|
@@ -3661,15 +3546,15 @@ function no() {
|
|
|
3661
3546
|
},
|
|
3662
3547
|
onKeyUp: u,
|
|
3663
3548
|
onBlur: u,
|
|
3664
|
-
children: /* @__PURE__ */ P(
|
|
3549
|
+
children: /* @__PURE__ */ P(Oe, { "aria-hidden": "true" })
|
|
3665
3550
|
})
|
|
3666
3551
|
]
|
|
3667
3552
|
});
|
|
3668
3553
|
}
|
|
3669
3554
|
//#endregion
|
|
3670
3555
|
//#region lib/components/ui/media/image-editor/partials/editor-stage.tsx
|
|
3671
|
-
function
|
|
3672
|
-
let { source: e, stageRef: t, state: n, toolbar: r } =
|
|
3556
|
+
function qa() {
|
|
3557
|
+
let { source: e, stageRef: t, state: n, toolbar: r } = R(), a = r === "floating", { t: o } = i();
|
|
3673
3558
|
return /* @__PURE__ */ F("div", {
|
|
3674
3559
|
className: "relative flex min-h-48 min-w-0 flex-1 flex-col",
|
|
3675
3560
|
children: [/* @__PURE__ */ P("section", {
|
|
@@ -3680,12 +3565,12 @@ function ro() {
|
|
|
3680
3565
|
"data-slot": "image-editor-stage",
|
|
3681
3566
|
"data-tool": n.tool,
|
|
3682
3567
|
className: "nxgt-image-editor-stage relative min-h-0 flex-1 overflow-auto outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:ring-inset",
|
|
3683
|
-
children: e.status === "ready" ? /* @__PURE__ */ P(
|
|
3568
|
+
children: e.status === "ready" ? /* @__PURE__ */ P(Ja, { preview: e.preview }) : /* @__PURE__ */ P("div", {
|
|
3684
3569
|
className: "absolute inset-0 flex flex-col items-center justify-center gap-3 p-6 text-center text-sm text-white/70",
|
|
3685
|
-
children: e.status === "loading" ? /* @__PURE__ */ P(
|
|
3570
|
+
children: e.status === "loading" ? /* @__PURE__ */ P(d, { "aria-label": o("material.image-editor.loading", "Loading the image") }) : /* @__PURE__ */ F("div", {
|
|
3686
3571
|
role: "alert",
|
|
3687
3572
|
className: "flex max-w-sm flex-col items-center gap-2",
|
|
3688
|
-
children: [/* @__PURE__ */ P(
|
|
3573
|
+
children: [/* @__PURE__ */ P(Me, {
|
|
3689
3574
|
className: "size-8",
|
|
3690
3575
|
"aria-hidden": "true"
|
|
3691
3576
|
}), o("material.image-editor.error", "This image cannot be edited. It may be missing, or served from another site without CORS.")]
|
|
@@ -3693,17 +3578,17 @@ function ro() {
|
|
|
3693
3578
|
})
|
|
3694
3579
|
}), /* @__PURE__ */ F("div", {
|
|
3695
3580
|
className: "@container pointer-events-none absolute inset-x-0 bottom-3 flex flex-col items-center gap-2 px-3",
|
|
3696
|
-
children: [a && n.tool === "crop" && e.status === "ready" && /* @__PURE__ */ P(
|
|
3581
|
+
children: [a && n.tool === "crop" && e.status === "ready" && /* @__PURE__ */ P(wa, {}), P(a ? ja : Ka, {})]
|
|
3697
3582
|
})]
|
|
3698
3583
|
});
|
|
3699
3584
|
}
|
|
3700
|
-
function
|
|
3701
|
-
let { state: t, base: n, view: r, scale: a } =
|
|
3585
|
+
function Ja({ preview: e }) {
|
|
3586
|
+
let { state: t, base: n, view: r, scale: a } = R(), { t: o } = i(), s = j(null), c = j(null), { tool: l, edits: u, comparing: d, selectedId: f, split: p } = t, m = n ? r.w * n.width * a : 0, h = n ? r.h * n.height * a : 0, g = {
|
|
3702
3587
|
source: e,
|
|
3703
3588
|
edits: u,
|
|
3704
|
-
region:
|
|
3589
|
+
region: ra(l),
|
|
3705
3590
|
displayWidth: m
|
|
3706
|
-
}, { paint: _ } =
|
|
3591
|
+
}, { paint: _ } = _a({
|
|
3707
3592
|
...g,
|
|
3708
3593
|
canvasRef: s,
|
|
3709
3594
|
comparing: d,
|
|
@@ -3711,7 +3596,7 @@ function io({ preview: e }) {
|
|
|
3711
3596
|
hiddenId: t.editingId,
|
|
3712
3597
|
mountKey: p
|
|
3713
3598
|
});
|
|
3714
|
-
|
|
3599
|
+
_a({
|
|
3715
3600
|
...g,
|
|
3716
3601
|
canvasRef: c,
|
|
3717
3602
|
comparing: !0,
|
|
@@ -3735,57 +3620,57 @@ function io({ preview: e }) {
|
|
|
3735
3620
|
height: h
|
|
3736
3621
|
},
|
|
3737
3622
|
children: [
|
|
3738
|
-
p ? /* @__PURE__ */ P(
|
|
3623
|
+
p ? /* @__PURE__ */ P(na, {
|
|
3739
3624
|
className: "size-full",
|
|
3740
3625
|
before: v(c),
|
|
3741
3626
|
after: v(s),
|
|
3742
3627
|
beforeLabel: o("material.image-editor.before", "Original"),
|
|
3743
3628
|
afterLabel: o("material.image-editor.after", "Edited")
|
|
3744
3629
|
}) : v(s),
|
|
3745
|
-
l === "crop" && !p && /* @__PURE__ */ P(
|
|
3746
|
-
l === "markup" && !d && !p && /* @__PURE__ */ P(
|
|
3630
|
+
l === "crop" && !p && /* @__PURE__ */ P(Sa, {}),
|
|
3631
|
+
l === "markup" && !d && !p && /* @__PURE__ */ P(Wa, { paint: _ })
|
|
3747
3632
|
]
|
|
3748
3633
|
})
|
|
3749
3634
|
});
|
|
3750
3635
|
}
|
|
3751
3636
|
//#endregion
|
|
3752
3637
|
//#region lib/components/ui/media/image-editor/image-editor.changes.ts
|
|
3753
|
-
function
|
|
3638
|
+
function Ya(e) {
|
|
3754
3639
|
let t = /* @__PURE__ */ new Set(), { adjustments: n, crop: r } = e;
|
|
3755
|
-
return Object.keys(
|
|
3640
|
+
return Object.keys(B).some((e) => n[e] !== B[e]) && t.add("adjust"), e.filter !== "none" && t.add("filters"), (!(r.x === H.x && r.y === H.y && r.w === H.w && r.h === H.h) || !zn(e.transform)) && t.add("crop"), e.annotations.length > 0 && t.add("markup"), t;
|
|
3756
3641
|
}
|
|
3757
3642
|
//#endregion
|
|
3758
3643
|
//#region lib/components/ui/media/image-editor/partials/editor-tool-rail.tsx
|
|
3759
|
-
var
|
|
3644
|
+
var Xa = {
|
|
3760
3645
|
adjust: {
|
|
3761
|
-
icon:
|
|
3646
|
+
icon: We,
|
|
3762
3647
|
label: "Adjust"
|
|
3763
3648
|
},
|
|
3764
3649
|
filters: {
|
|
3765
|
-
icon:
|
|
3650
|
+
icon: Ge,
|
|
3766
3651
|
label: "Filters"
|
|
3767
3652
|
},
|
|
3768
3653
|
crop: {
|
|
3769
|
-
icon:
|
|
3654
|
+
icon: Te,
|
|
3770
3655
|
label: "Crop"
|
|
3771
3656
|
},
|
|
3772
3657
|
markup: {
|
|
3773
|
-
icon:
|
|
3658
|
+
icon: Ie,
|
|
3774
3659
|
label: "Markup"
|
|
3775
3660
|
}
|
|
3776
3661
|
};
|
|
3777
|
-
function
|
|
3778
|
-
let { tools: e, state: t, actions: n, source: r } =
|
|
3662
|
+
function Za() {
|
|
3663
|
+
let { tools: e, state: t, actions: n, source: r } = R(), { t: a } = i(), o = k();
|
|
3779
3664
|
if (e.length < 2) return null;
|
|
3780
|
-
let s =
|
|
3665
|
+
let s = Ya(t.edits);
|
|
3781
3666
|
return /* @__PURE__ */ P("div", {
|
|
3782
3667
|
role: "toolbar",
|
|
3783
3668
|
"aria-label": a("material.image-editor.tools", "Tools"),
|
|
3784
3669
|
"data-slot": "image-editor-tool-rail",
|
|
3785
3670
|
className: "flex shrink-0 justify-around gap-1 border-t bg-card px-2 py-1.5 @3xl/image-editor:order-first @3xl/image-editor:flex-col @3xl/image-editor:justify-start @3xl/image-editor:gap-2 @3xl/image-editor:border-t-0 @3xl/image-editor:border-r @3xl/image-editor:px-1.5 @3xl/image-editor:py-3",
|
|
3786
3671
|
children: e.map((e) => {
|
|
3787
|
-
let { icon: i, label: c } =
|
|
3788
|
-
return /* @__PURE__ */ F(
|
|
3672
|
+
let { icon: i, label: c } = Xa[e], l = t.tool === e, u = s.has(e);
|
|
3673
|
+
return /* @__PURE__ */ F(fe, { children: [/* @__PURE__ */ F("button", {
|
|
3789
3674
|
type: "button",
|
|
3790
3675
|
"aria-pressed": l,
|
|
3791
3676
|
disabled: r.status !== "ready",
|
|
@@ -3818,7 +3703,7 @@ function so() {
|
|
|
3818
3703
|
}
|
|
3819
3704
|
//#endregion
|
|
3820
3705
|
//#region lib/components/ui/media/image-editor/partials/editor-export-options.tsx
|
|
3821
|
-
var
|
|
3706
|
+
var Qa = [
|
|
3822
3707
|
{
|
|
3823
3708
|
value: "image/png",
|
|
3824
3709
|
label: "PNG"
|
|
@@ -3831,7 +3716,7 @@ var co = [
|
|
|
3831
3716
|
value: "image/webp",
|
|
3832
3717
|
label: "WebP"
|
|
3833
3718
|
}
|
|
3834
|
-
],
|
|
3719
|
+
], $a = [
|
|
3835
3720
|
{
|
|
3836
3721
|
value: .92,
|
|
3837
3722
|
id: "high",
|
|
@@ -3847,42 +3732,42 @@ var co = [
|
|
|
3847
3732
|
id: "low",
|
|
3848
3733
|
label: "Low"
|
|
3849
3734
|
}
|
|
3850
|
-
],
|
|
3735
|
+
], eo = [
|
|
3851
3736
|
1,
|
|
3852
3737
|
.75,
|
|
3853
3738
|
.5,
|
|
3854
3739
|
.25
|
|
3855
3740
|
];
|
|
3856
|
-
function
|
|
3857
|
-
let { state: e, actions: t } =
|
|
3741
|
+
function to() {
|
|
3742
|
+
let { state: e, actions: t } = R(), { t: n } = i(), r = e.exportOptions, a = r.format !== "image/png";
|
|
3858
3743
|
return /* @__PURE__ */ F(N, { children: [
|
|
3859
|
-
/* @__PURE__ */ P(
|
|
3860
|
-
/* @__PURE__ */ P(
|
|
3744
|
+
/* @__PURE__ */ P(h, { children: n("material.image-editor.export.format", "Format") }),
|
|
3745
|
+
/* @__PURE__ */ P(S, {
|
|
3861
3746
|
value: r.format,
|
|
3862
3747
|
onValueChange: (e) => t.setExportOptions({ format: e }),
|
|
3863
|
-
children:
|
|
3748
|
+
children: Qa.map((e) => /* @__PURE__ */ P(ce, {
|
|
3864
3749
|
value: e.value,
|
|
3865
3750
|
children: e.label
|
|
3866
3751
|
}, e.value))
|
|
3867
3752
|
}),
|
|
3868
3753
|
a && /* @__PURE__ */ F(N, { children: [
|
|
3869
|
-
/* @__PURE__ */ P(
|
|
3870
|
-
/* @__PURE__ */ P(
|
|
3871
|
-
/* @__PURE__ */ P(
|
|
3754
|
+
/* @__PURE__ */ P(C, {}),
|
|
3755
|
+
/* @__PURE__ */ P(h, { children: n("material.image-editor.export.quality", "Quality") }),
|
|
3756
|
+
/* @__PURE__ */ P(S, {
|
|
3872
3757
|
value: String(r.quality),
|
|
3873
3758
|
onValueChange: (e) => t.setExportOptions({ quality: Number(e) }),
|
|
3874
|
-
children:
|
|
3759
|
+
children: $a.map((e) => /* @__PURE__ */ P(ce, {
|
|
3875
3760
|
value: String(e.value),
|
|
3876
3761
|
children: n(`material.image-editor.export.quality-${e.id}`, e.label)
|
|
3877
3762
|
}, e.id))
|
|
3878
3763
|
})
|
|
3879
3764
|
] }),
|
|
3880
|
-
/* @__PURE__ */ P(
|
|
3881
|
-
/* @__PURE__ */ P(
|
|
3882
|
-
/* @__PURE__ */ P(
|
|
3765
|
+
/* @__PURE__ */ P(C, {}),
|
|
3766
|
+
/* @__PURE__ */ P(h, { children: n("material.image-editor.export.size", "Size") }),
|
|
3767
|
+
/* @__PURE__ */ P(S, {
|
|
3883
3768
|
value: String(r.scale),
|
|
3884
3769
|
onValueChange: (e) => t.setExportOptions({ scale: Number(e) }),
|
|
3885
|
-
children:
|
|
3770
|
+
children: eo.map((e) => /* @__PURE__ */ P(ce, {
|
|
3886
3771
|
value: String(e),
|
|
3887
3772
|
children: `${e * 100}%`
|
|
3888
3773
|
}, e))
|
|
@@ -3891,31 +3776,31 @@ function fo() {
|
|
|
3891
3776
|
}
|
|
3892
3777
|
//#endregion
|
|
3893
3778
|
//#region lib/components/ui/media/image-editor/partials/editor-export-menu.tsx
|
|
3894
|
-
function
|
|
3895
|
-
let { source: e, exporting: t, hideDownload: n, onSave: r } =
|
|
3896
|
-
return n && !r ? null : /* @__PURE__ */ F(
|
|
3779
|
+
function no() {
|
|
3780
|
+
let { source: e, exporting: t, hideDownload: n, onSave: r } = R(), { t: a } = i();
|
|
3781
|
+
return n && !r ? null : /* @__PURE__ */ F(ae, { children: [/* @__PURE__ */ P(oe, {
|
|
3897
3782
|
asChild: !0,
|
|
3898
|
-
children: /* @__PURE__ */ P(
|
|
3783
|
+
children: /* @__PURE__ */ P(f, {
|
|
3899
3784
|
variant: "ghost",
|
|
3900
3785
|
color: "default",
|
|
3901
3786
|
"aria-label": a("material.image-editor.export.label", "Export"),
|
|
3902
3787
|
disabled: e.status !== "ready" || t.busy !== null,
|
|
3903
3788
|
"data-slot": "image-editor-export",
|
|
3904
|
-
children: P(n ?
|
|
3789
|
+
children: P(n ? He : Ee, {})
|
|
3905
3790
|
})
|
|
3906
|
-
}), /* @__PURE__ */ F(
|
|
3791
|
+
}), /* @__PURE__ */ F(x, {
|
|
3907
3792
|
align: "end",
|
|
3908
3793
|
className: "min-w-52",
|
|
3909
|
-
children: [/* @__PURE__ */ P(
|
|
3794
|
+
children: [/* @__PURE__ */ P(to, {}), !n && /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(C, {}), /* @__PURE__ */ F(_, {
|
|
3910
3795
|
onSelect: () => void t.download(),
|
|
3911
|
-
children: [/* @__PURE__ */ P(
|
|
3796
|
+
children: [/* @__PURE__ */ P(Ee, { "aria-hidden": "true" }), a("material.image-editor.export.download", "Download")]
|
|
3912
3797
|
})] })]
|
|
3913
3798
|
})] });
|
|
3914
3799
|
}
|
|
3915
3800
|
//#endregion
|
|
3916
3801
|
//#region lib/components/ui/media/image-editor/partials/editor-file-info.tsx
|
|
3917
|
-
function
|
|
3918
|
-
let { source: e, fileName: t } =
|
|
3802
|
+
function ro() {
|
|
3803
|
+
let { source: e, fileName: t } = R(), { t: n } = i();
|
|
3919
3804
|
return /* @__PURE__ */ P("div", {
|
|
3920
3805
|
className: "flex min-w-0 flex-1 justify-center",
|
|
3921
3806
|
children: e.status === "ready" && /* @__PURE__ */ F("span", {
|
|
@@ -3941,62 +3826,62 @@ function mo() {
|
|
|
3941
3826
|
}
|
|
3942
3827
|
//#endregion
|
|
3943
3828
|
//#region lib/components/ui/media/image-editor/partials/editor-history-buttons.tsx
|
|
3944
|
-
function
|
|
3945
|
-
let { actions: e, canUndo: t, canRedo: n } =
|
|
3829
|
+
function io() {
|
|
3830
|
+
let { actions: e, canUndo: t, canRedo: n } = R(), { t: r } = i();
|
|
3946
3831
|
return /* @__PURE__ */ F(N, { children: [
|
|
3947
|
-
/* @__PURE__ */ P(
|
|
3832
|
+
/* @__PURE__ */ P(f, {
|
|
3948
3833
|
variant: "ghost",
|
|
3949
3834
|
color: "default",
|
|
3950
3835
|
tooltip: r("material.image-editor.undo", "Undo"),
|
|
3951
3836
|
disabled: !t,
|
|
3952
3837
|
onClick: () => e.undo(),
|
|
3953
|
-
children: /* @__PURE__ */ P(
|
|
3838
|
+
children: /* @__PURE__ */ P(Xe, {})
|
|
3954
3839
|
}),
|
|
3955
|
-
/* @__PURE__ */ P(
|
|
3840
|
+
/* @__PURE__ */ P(f, {
|
|
3956
3841
|
variant: "ghost",
|
|
3957
3842
|
color: "default",
|
|
3958
3843
|
tooltip: r("material.image-editor.redo", "Redo"),
|
|
3959
3844
|
disabled: !n,
|
|
3960
3845
|
onClick: () => e.redo(),
|
|
3961
|
-
children: /* @__PURE__ */ P(
|
|
3846
|
+
children: /* @__PURE__ */ P(ze, {})
|
|
3962
3847
|
}),
|
|
3963
|
-
/* @__PURE__ */ P(
|
|
3848
|
+
/* @__PURE__ */ P(f, {
|
|
3964
3849
|
variant: "ghost",
|
|
3965
3850
|
color: "default",
|
|
3966
3851
|
tooltip: r("material.image-editor.reset", "Reset all"),
|
|
3967
3852
|
disabled: !t,
|
|
3968
3853
|
onClick: () => e.resetAll(),
|
|
3969
|
-
children: /* @__PURE__ */ P(
|
|
3854
|
+
children: /* @__PURE__ */ P(Be, {})
|
|
3970
3855
|
})
|
|
3971
3856
|
] });
|
|
3972
3857
|
}
|
|
3973
3858
|
//#endregion
|
|
3974
3859
|
//#region lib/components/ui/media/image-editor/image-editor.shortcuts.ts
|
|
3975
|
-
var
|
|
3860
|
+
var ao = {
|
|
3976
3861
|
ctrl: "Ctrl/⌘",
|
|
3977
3862
|
shift: "Shift",
|
|
3978
3863
|
delete: "Delete",
|
|
3979
3864
|
esc: "Esc",
|
|
3980
3865
|
enter: "Enter"
|
|
3981
|
-
},
|
|
3866
|
+
}, oo = "ctrl", so = [
|
|
3982
3867
|
"←",
|
|
3983
3868
|
"↑",
|
|
3984
3869
|
"→",
|
|
3985
3870
|
"↓"
|
|
3986
|
-
],
|
|
3871
|
+
], co = [
|
|
3987
3872
|
{
|
|
3988
3873
|
id: "general",
|
|
3989
3874
|
label: "Editing",
|
|
3990
3875
|
items: [
|
|
3991
3876
|
{
|
|
3992
3877
|
id: "undo",
|
|
3993
|
-
keys: [
|
|
3878
|
+
keys: [oo, "Z"],
|
|
3994
3879
|
label: "Undo"
|
|
3995
3880
|
},
|
|
3996
3881
|
{
|
|
3997
3882
|
id: "redo",
|
|
3998
3883
|
keys: [
|
|
3999
|
-
|
|
3884
|
+
oo,
|
|
4000
3885
|
"shift",
|
|
4001
3886
|
"Z"
|
|
4002
3887
|
],
|
|
@@ -4046,17 +3931,17 @@ var go = {
|
|
|
4046
3931
|
},
|
|
4047
3932
|
{
|
|
4048
3933
|
id: "mark-duplicate",
|
|
4049
|
-
keys: [
|
|
3934
|
+
keys: [oo, "D"],
|
|
4050
3935
|
label: "Duplicate the mark"
|
|
4051
3936
|
},
|
|
4052
3937
|
{
|
|
4053
3938
|
id: "mark-nudge",
|
|
4054
|
-
keys:
|
|
3939
|
+
keys: so,
|
|
4055
3940
|
label: "Nudge the mark"
|
|
4056
3941
|
},
|
|
4057
3942
|
{
|
|
4058
3943
|
id: "mark-move",
|
|
4059
|
-
keys: ["shift", ...
|
|
3944
|
+
keys: ["shift", ...so],
|
|
4060
3945
|
label: "Nudge it further"
|
|
4061
3946
|
},
|
|
4062
3947
|
{
|
|
@@ -4076,40 +3961,40 @@ var go = {
|
|
|
4076
3961
|
label: "Crop frame",
|
|
4077
3962
|
items: [{
|
|
4078
3963
|
id: "crop-move",
|
|
4079
|
-
keys:
|
|
3964
|
+
keys: so,
|
|
4080
3965
|
label: "Move the frame"
|
|
4081
3966
|
}, {
|
|
4082
3967
|
id: "crop-resize",
|
|
4083
|
-
keys: ["shift", ...
|
|
3968
|
+
keys: ["shift", ...so],
|
|
4084
3969
|
label: "Resize the frame"
|
|
4085
3970
|
}]
|
|
4086
3971
|
}
|
|
4087
3972
|
];
|
|
4088
3973
|
//#endregion
|
|
4089
3974
|
//#region lib/components/ui/media/image-editor/partials/editor-shortcuts.tsx
|
|
4090
|
-
function
|
|
4091
|
-
let { state: e, actions: t } =
|
|
4092
|
-
return /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(
|
|
3975
|
+
function lo() {
|
|
3976
|
+
let { state: e, actions: t } = R(), { t: n } = i(), r = n("material.image-editor.shortcuts.title", "Keyboard shortcuts");
|
|
3977
|
+
return /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(f, {
|
|
4093
3978
|
variant: "ghost",
|
|
4094
3979
|
color: "default",
|
|
4095
3980
|
tooltip: r,
|
|
4096
3981
|
"aria-keyshortcuts": "?",
|
|
4097
3982
|
onClick: () => t.setShortcutsOpen(!0),
|
|
4098
|
-
children: /* @__PURE__ */ P(
|
|
4099
|
-
}), /* @__PURE__ */ P(
|
|
3983
|
+
children: /* @__PURE__ */ P(Ne, {})
|
|
3984
|
+
}), /* @__PURE__ */ P(y, {
|
|
4100
3985
|
open: e.shortcutsOpen,
|
|
4101
3986
|
onOpenChange: t.setShortcutsOpen,
|
|
4102
|
-
children: /* @__PURE__ */ F(
|
|
3987
|
+
children: /* @__PURE__ */ F(ne, {
|
|
4103
3988
|
"data-slot": "image-editor-shortcuts",
|
|
4104
3989
|
className: "max-h-[calc(100dvh-2rem)] gap-4 overflow-y-auto sm:max-w-md",
|
|
4105
3990
|
children: [
|
|
4106
|
-
/* @__PURE__ */ P(
|
|
4107
|
-
/* @__PURE__ */ P(
|
|
3991
|
+
/* @__PURE__ */ P(ie, {}),
|
|
3992
|
+
/* @__PURE__ */ P(le, {
|
|
4108
3993
|
className: "text-lg/6",
|
|
4109
3994
|
children: r
|
|
4110
3995
|
}),
|
|
4111
|
-
/* @__PURE__ */ P(
|
|
4112
|
-
|
|
3996
|
+
/* @__PURE__ */ P(b, { children: n("material.image-editor.shortcuts.description", "Keys work while the image or a panel has focus.") }),
|
|
3997
|
+
co.map((e) => /* @__PURE__ */ F("section", {
|
|
4113
3998
|
className: "flex flex-col gap-1.5",
|
|
4114
3999
|
children: [/* @__PURE__ */ P("h3", {
|
|
4115
4000
|
className: "font-medium text-muted-foreground text-xs uppercase tracking-wide",
|
|
@@ -4125,7 +4010,7 @@ function bo() {
|
|
|
4125
4010
|
className: "flex shrink-0 gap-1",
|
|
4126
4011
|
children: e.keys.map((e) => /* @__PURE__ */ P("kbd", {
|
|
4127
4012
|
className: "min-w-6 rounded-md border bg-muted/60 px-1.5 py-0.5 text-center font-sans font-medium text-muted-foreground text-xs",
|
|
4128
|
-
children:
|
|
4013
|
+
children: ao[e] ? n(`material.image-editor.shortcuts.key.${e}`, ao[e]) : e
|
|
4129
4014
|
}, e))
|
|
4130
4015
|
})]
|
|
4131
4016
|
}, e.id))
|
|
@@ -4137,13 +4022,13 @@ function bo() {
|
|
|
4137
4022
|
}
|
|
4138
4023
|
//#endregion
|
|
4139
4024
|
//#region lib/components/ui/media/image-editor/partials/editor-top-bar.tsx
|
|
4140
|
-
function
|
|
4141
|
-
let e =
|
|
4025
|
+
function uo() {
|
|
4026
|
+
let e = R(), { source: t, exporting: n } = e, { t: r } = i(), a = t.status === "ready", o = e.toolbar === "floating";
|
|
4142
4027
|
return /* @__PURE__ */ F("div", {
|
|
4143
4028
|
"data-slot": "image-editor-top-bar",
|
|
4144
4029
|
className: "flex shrink-0 items-center gap-1 border-b bg-card px-2 py-1.5 sm:gap-2 sm:px-3",
|
|
4145
4030
|
children: [
|
|
4146
|
-
o && e.onCancel && /* @__PURE__ */ P(
|
|
4031
|
+
o && e.onCancel && /* @__PURE__ */ P(m, {
|
|
4147
4032
|
variant: "tonal",
|
|
4148
4033
|
color: "default",
|
|
4149
4034
|
size: "sm",
|
|
@@ -4151,21 +4036,21 @@ function xo() {
|
|
|
4151
4036
|
onClick: e.onCancel,
|
|
4152
4037
|
children: r("material.image-editor.cancel", "Cancel")
|
|
4153
4038
|
}),
|
|
4154
|
-
!o && e.onCancel && /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(
|
|
4039
|
+
!o && e.onCancel && /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(f, {
|
|
4155
4040
|
variant: "ghost",
|
|
4156
4041
|
color: "default",
|
|
4157
4042
|
tooltip: r("material.image-editor.cancel", "Cancel"),
|
|
4158
4043
|
onClick: e.onCancel,
|
|
4159
|
-
children: /* @__PURE__ */ P(
|
|
4160
|
-
}), /* @__PURE__ */ P(
|
|
4044
|
+
children: /* @__PURE__ */ P(Qe, {})
|
|
4045
|
+
}), /* @__PURE__ */ P(vi, {
|
|
4161
4046
|
orientation: "vertical",
|
|
4162
4047
|
className: "h-6!"
|
|
4163
4048
|
})] }),
|
|
4164
|
-
!o && /* @__PURE__ */ P(
|
|
4165
|
-
/* @__PURE__ */ P(
|
|
4166
|
-
/* @__PURE__ */ P(
|
|
4167
|
-
/* @__PURE__ */ P(
|
|
4168
|
-
e.onSave && /* @__PURE__ */ P(
|
|
4049
|
+
!o && /* @__PURE__ */ P(io, {}),
|
|
4050
|
+
/* @__PURE__ */ P(ro, {}),
|
|
4051
|
+
/* @__PURE__ */ P(lo, {}),
|
|
4052
|
+
/* @__PURE__ */ P(no, {}),
|
|
4053
|
+
e.onSave && /* @__PURE__ */ P(m, {
|
|
4169
4054
|
variant: "filled",
|
|
4170
4055
|
color: "primary",
|
|
4171
4056
|
size: "sm",
|
|
@@ -4180,7 +4065,7 @@ function xo() {
|
|
|
4180
4065
|
}
|
|
4181
4066
|
//#endregion
|
|
4182
4067
|
//#region lib/lib/redux/bind-slice-actions.ts
|
|
4183
|
-
function
|
|
4068
|
+
function fo(e, t) {
|
|
4184
4069
|
let n = {};
|
|
4185
4070
|
for (let r of Object.keys(e)) {
|
|
4186
4071
|
let i = e[r];
|
|
@@ -4190,56 +4075,56 @@ function So(e, t) {
|
|
|
4190
4075
|
}
|
|
4191
4076
|
//#endregion
|
|
4192
4077
|
//#region lib/lib/redux/slice-server-state.ts
|
|
4193
|
-
var
|
|
4194
|
-
function
|
|
4195
|
-
return
|
|
4078
|
+
var po = /* @__PURE__ */ new WeakMap();
|
|
4079
|
+
function mo(e) {
|
|
4080
|
+
return po.get(e);
|
|
4196
4081
|
}
|
|
4197
4082
|
//#endregion
|
|
4198
4083
|
//#region lib/lib/redux/use-slice-reducer.ts
|
|
4199
|
-
function
|
|
4084
|
+
function ho(e, t) {
|
|
4200
4085
|
return t ? {
|
|
4201
4086
|
...e,
|
|
4202
4087
|
...t
|
|
4203
4088
|
} : e;
|
|
4204
4089
|
}
|
|
4205
|
-
var
|
|
4206
|
-
function
|
|
4207
|
-
return (t, n) => n.type ===
|
|
4090
|
+
var go = "nxgt/useSliceReducer/restore", _o = () => () => {}, vo = () => !1;
|
|
4091
|
+
function yo(e) {
|
|
4092
|
+
return (t, n) => n.type === go ? n.payload : e(t, n);
|
|
4208
4093
|
}
|
|
4209
|
-
function
|
|
4210
|
-
let n =
|
|
4094
|
+
function bo(e, t) {
|
|
4095
|
+
let n = mo(e), r = _e(_o, vo, () => n !== void 0), [i] = M(r), [a, o] = ge(A(() => yo(e.reducer), [e.reducer]), t, (t) => ho(r && n ? n() : e.getInitialState(), t));
|
|
4211
4096
|
return O(() => {
|
|
4212
4097
|
i && o({
|
|
4213
|
-
type:
|
|
4214
|
-
payload:
|
|
4098
|
+
type: go,
|
|
4099
|
+
payload: ho(e.getInitialState(), t)
|
|
4215
4100
|
});
|
|
4216
|
-
}, []), [a, A(() =>
|
|
4101
|
+
}, []), [a, A(() => fo(e.actions, o), [e.actions])];
|
|
4217
4102
|
}
|
|
4218
4103
|
//#endregion
|
|
4219
4104
|
//#region lib/components/ui/media/image-editor/image-editor.export.ts
|
|
4220
|
-
var
|
|
4105
|
+
var xo = {
|
|
4221
4106
|
"image/png": "png",
|
|
4222
4107
|
"image/jpeg": "jpg",
|
|
4223
4108
|
"image/webp": "webp"
|
|
4224
4109
|
};
|
|
4225
|
-
function
|
|
4226
|
-
return `${e.replace(/\.(png|jpe?g|webp|gif|avif|bmp)$/i, "").replace(/[/\\?%*:|"<>]/g, "-").trim() || "image"}.${
|
|
4110
|
+
function So(e, t) {
|
|
4111
|
+
return `${e.replace(/\.(png|jpe?g|webp|gif|avif|bmp)$/i, "").replace(/[/\\?%*:|"<>]/g, "-").trim() || "image"}.${xo[t]}`;
|
|
4227
4112
|
}
|
|
4228
|
-
function
|
|
4229
|
-
let i =
|
|
4113
|
+
function Co(e, t, n, r) {
|
|
4114
|
+
let i = Fr(e, t, {
|
|
4230
4115
|
scale: n.scale,
|
|
4231
4116
|
region: "crop"
|
|
4232
4117
|
}), a = Math.max(i.width, i.height), o = r && a > r ? r / a : 1;
|
|
4233
4118
|
return n.scale * o;
|
|
4234
4119
|
}
|
|
4235
|
-
function
|
|
4120
|
+
function wo(e, t, n) {
|
|
4236
4121
|
return new Promise((r, i) => {
|
|
4237
4122
|
e.toBlob((e) => e ? r(e) : i(/* @__PURE__ */ Error("Could not encode the image")), t, n);
|
|
4238
4123
|
});
|
|
4239
4124
|
}
|
|
4240
|
-
async function
|
|
4241
|
-
let a =
|
|
4242
|
-
scale:
|
|
4125
|
+
async function To(e, t, n, { fileName: r, maxSize: i }) {
|
|
4126
|
+
let a = zr(e, t, {
|
|
4127
|
+
scale: Co(e, t, n, i),
|
|
4243
4128
|
region: "crop"
|
|
4244
4129
|
});
|
|
4245
4130
|
if (n.format === "image/jpeg") {
|
|
@@ -4248,27 +4133,27 @@ async function Fo(e, t, n, { fileName: r, maxSize: i }) {
|
|
|
4248
4133
|
let t = e.getContext("2d");
|
|
4249
4134
|
t && (t.fillStyle = "#ffffff", t.fillRect(0, 0, e.width, e.height), t.drawImage(a, 0, 0), a = e);
|
|
4250
4135
|
}
|
|
4251
|
-
let o = await
|
|
4136
|
+
let o = await wo(a, n.format, n.quality);
|
|
4252
4137
|
return {
|
|
4253
4138
|
blob: o,
|
|
4254
|
-
file: new File([o],
|
|
4139
|
+
file: new File([o], So(r, n.format), { type: o.type || n.format }),
|
|
4255
4140
|
width: a.width,
|
|
4256
4141
|
height: a.height,
|
|
4257
4142
|
edits: t
|
|
4258
4143
|
};
|
|
4259
4144
|
}
|
|
4260
|
-
function
|
|
4145
|
+
function Eo(e) {
|
|
4261
4146
|
let t = URL.createObjectURL(e), n = document.createElement("a");
|
|
4262
4147
|
n.href = t, n.download = e.name, n.rel = "noopener", n.click(), setTimeout(() => URL.revokeObjectURL(t), 1e3);
|
|
4263
4148
|
}
|
|
4264
4149
|
//#endregion
|
|
4265
4150
|
//#region lib/components/ui/media/image-editor/use-image-editor-export.ts
|
|
4266
|
-
function
|
|
4151
|
+
function Do({ source: e, edits: t, options: n, fileName: r, maxSize: i, onSave: a }) {
|
|
4267
4152
|
let [o, s] = M(null), [c, l] = M(!1), u = D(async (a, o) => {
|
|
4268
4153
|
if (e.status === "ready") {
|
|
4269
4154
|
s(a), l(!1);
|
|
4270
4155
|
try {
|
|
4271
|
-
await new Promise((e) => setTimeout(e, 16)), await o(await
|
|
4156
|
+
await new Promise((e) => setTimeout(e, 16)), await o(await To(e.original, t, n, {
|
|
4272
4157
|
fileName: r,
|
|
4273
4158
|
maxSize: i
|
|
4274
4159
|
}));
|
|
@@ -4289,51 +4174,51 @@ function Lo({ source: e, edits: t, options: n, fileName: r, maxSize: i, onSave:
|
|
|
4289
4174
|
busy: o,
|
|
4290
4175
|
failed: c,
|
|
4291
4176
|
save: D(() => u("save", (e) => a?.(e)), [a, u]),
|
|
4292
|
-
download: D(() => u("download", (e) =>
|
|
4177
|
+
download: D(() => u("download", (e) => Eo(e.file)), [u])
|
|
4293
4178
|
};
|
|
4294
4179
|
}
|
|
4295
4180
|
//#endregion
|
|
4296
4181
|
//#region lib/components/ui/media/image-editor/use-image-editor-init.ts
|
|
4297
|
-
function
|
|
4182
|
+
function Oo(e, t, n) {
|
|
4298
4183
|
return {
|
|
4299
4184
|
brush: {
|
|
4300
|
-
...
|
|
4301
|
-
redactMode:
|
|
4185
|
+
...vn,
|
|
4186
|
+
redactMode: ar(n, vn.redactMode)
|
|
4302
4187
|
},
|
|
4303
4188
|
markupTool: e.markupTools?.[0] ?? "pen",
|
|
4304
4189
|
tool: e.defaultTool && t.includes(e.defaultTool) ? e.defaultTool : t[0],
|
|
4305
|
-
edits:
|
|
4190
|
+
edits: or(er(e.defaultEdits), n),
|
|
4306
4191
|
aspect: e.aspect ?? null,
|
|
4307
4192
|
exportOptions: {
|
|
4308
|
-
...
|
|
4193
|
+
...xn,
|
|
4309
4194
|
...e.defaultExportOptions
|
|
4310
4195
|
}
|
|
4311
4196
|
};
|
|
4312
4197
|
}
|
|
4313
|
-
function
|
|
4314
|
-
let t = e.tools?.length ? e.tools :
|
|
4198
|
+
function ko(e) {
|
|
4199
|
+
let t = e.tools?.length ? e.tools : pn;
|
|
4315
4200
|
if (e.toolbar !== "floating") return t;
|
|
4316
4201
|
let n = t.filter((e) => e === "markup" || e === "crop");
|
|
4317
4202
|
return n.length ? n : ["markup"];
|
|
4318
4203
|
}
|
|
4319
4204
|
//#endregion
|
|
4320
4205
|
//#region lib/components/ui/media/image-editor/image-editor.keyboard.ts
|
|
4321
|
-
function
|
|
4206
|
+
function Ao(e, t) {
|
|
4322
4207
|
let n = e;
|
|
4323
4208
|
return typeof n?.closest == "function" && !!n.closest(t);
|
|
4324
4209
|
}
|
|
4325
|
-
var
|
|
4210
|
+
var jo = "input, textarea, select, [contenteditable=\"true\"], [role=\"slider\"], [role=\"radio\"], [role=\"menuitem\"], [role=\"option\"]", Mo = {
|
|
4326
4211
|
ArrowLeft: [-1, 0],
|
|
4327
4212
|
ArrowRight: [1, 0],
|
|
4328
4213
|
ArrowUp: [0, -1],
|
|
4329
4214
|
ArrowDown: [0, 1]
|
|
4330
4215
|
};
|
|
4331
|
-
function
|
|
4216
|
+
function No(e, t) {
|
|
4332
4217
|
let n = t.selection;
|
|
4333
|
-
if (!
|
|
4218
|
+
if (!Ao(e.target, "[data-slot=\"image-editor-stage\"]")) return !1;
|
|
4334
4219
|
if (e.key === "Enter" && t.placeStep) return t.placeStep(), !0;
|
|
4335
4220
|
if (!n) return !1;
|
|
4336
|
-
let r = e.ctrlKey || e.metaKey, i =
|
|
4221
|
+
let r = e.ctrlKey || e.metaKey, i = Mo[e.key];
|
|
4337
4222
|
if (e.key === "Delete" || e.key === "Backspace") n.remove();
|
|
4338
4223
|
else if (e.key === "Escape") n.deselect();
|
|
4339
4224
|
else if (r && e.key.toLowerCase() === "d") n.duplicate();
|
|
@@ -4343,7 +4228,7 @@ function Uo(e, t) {
|
|
|
4343
4228
|
} else return !1;
|
|
4344
4229
|
return !0;
|
|
4345
4230
|
}
|
|
4346
|
-
function
|
|
4231
|
+
function Po(e, t) {
|
|
4347
4232
|
let n = e.ctrlKey || e.metaKey, r = e.key.toLowerCase();
|
|
4348
4233
|
if (n && r === "z") (e.shiftKey ? t.redo : t.undo)();
|
|
4349
4234
|
else if (n && r === "y") t.redo();
|
|
@@ -4356,17 +4241,17 @@ function Wo(e, t) {
|
|
|
4356
4241
|
else return !1;
|
|
4357
4242
|
return !0;
|
|
4358
4243
|
}
|
|
4359
|
-
function
|
|
4360
|
-
if (
|
|
4361
|
-
let n =
|
|
4244
|
+
function Fo(e, t) {
|
|
4245
|
+
if (Ao(e.target, `${jo}, [data-slot="image-editor-shortcuts"]`)) return !1;
|
|
4246
|
+
let n = No(e, t) || Po(e, t);
|
|
4362
4247
|
return n && e.preventDefault(), n;
|
|
4363
4248
|
}
|
|
4364
4249
|
//#endregion
|
|
4365
4250
|
//#region lib/components/ui/media/image-editor/use-image-editor-keys.ts
|
|
4366
|
-
function
|
|
4251
|
+
function Io(e, t, n, r) {
|
|
4367
4252
|
return D((i) => {
|
|
4368
4253
|
let a = t?.id;
|
|
4369
|
-
|
|
4254
|
+
Fo(i, {
|
|
4370
4255
|
undo: e.undo,
|
|
4371
4256
|
redo: e.redo,
|
|
4372
4257
|
...n,
|
|
@@ -4393,19 +4278,19 @@ function Ko(e, t, n, r) {
|
|
|
4393
4278
|
}
|
|
4394
4279
|
//#endregion
|
|
4395
4280
|
//#region lib/components/ui/media/image-editor/use-image-editor-zoom.ts
|
|
4396
|
-
function
|
|
4397
|
-
let n = t === 1 ?
|
|
4281
|
+
function Lo(e, t) {
|
|
4282
|
+
let n = t === 1 ? Cn : [...Cn].reverse();
|
|
4398
4283
|
return n.find((n) => t === 1 ? n > e * 1.01 : n < e * .99) ?? n[n.length - 1];
|
|
4399
4284
|
}
|
|
4400
|
-
function
|
|
4285
|
+
function Ro(e, t) {
|
|
4401
4286
|
let n = j(1), r = D((e) => e ?? n.current, []);
|
|
4402
4287
|
return A(() => {
|
|
4403
4288
|
let i = () => e ?? n.current;
|
|
4404
4289
|
return {
|
|
4405
4290
|
fitRef: n,
|
|
4406
4291
|
scaleOf: r,
|
|
4407
|
-
zoomIn: () => t(
|
|
4408
|
-
zoomOut: () => t(
|
|
4292
|
+
zoomIn: () => t(Lo(i(), 1)),
|
|
4293
|
+
zoomOut: () => t(Lo(i(), -1)),
|
|
4409
4294
|
zoomToFit: () => t(null),
|
|
4410
4295
|
zoomToActual: () => t(1),
|
|
4411
4296
|
zoomBy: (e) => t(i() * e)
|
|
@@ -4418,7 +4303,7 @@ function Jo(e, t) {
|
|
|
4418
4303
|
}
|
|
4419
4304
|
//#endregion
|
|
4420
4305
|
//#region lib/components/ui/media/image-cropper/crop-image.ts
|
|
4421
|
-
function
|
|
4306
|
+
function zo(e) {
|
|
4422
4307
|
return new Promise((t, n) => {
|
|
4423
4308
|
let r = new Image();
|
|
4424
4309
|
r.addEventListener("load", () => t(r)), r.addEventListener("error", () => n(/* @__PURE__ */ Error("Could not load image"))), r.crossOrigin = "anonymous", r.src = e;
|
|
@@ -4426,7 +4311,7 @@ function Yo(e) {
|
|
|
4426
4311
|
}
|
|
4427
4312
|
//#endregion
|
|
4428
4313
|
//#region lib/components/ui/media/upload/network-upload-field/use-image-preview.ts
|
|
4429
|
-
function
|
|
4314
|
+
function Bo(e) {
|
|
4430
4315
|
let [t, n] = M();
|
|
4431
4316
|
return O(() => {
|
|
4432
4317
|
if (!e) return;
|
|
@@ -4441,7 +4326,7 @@ function Xo(e) {
|
|
|
4441
4326
|
}
|
|
4442
4327
|
//#endregion
|
|
4443
4328
|
//#region lib/components/ui/media/image-editor/use-image-source.ts
|
|
4444
|
-
async function
|
|
4329
|
+
async function Vo(e) {
|
|
4445
4330
|
let t = e;
|
|
4446
4331
|
if (typeof e == "string") {
|
|
4447
4332
|
let n = await fetch(e);
|
|
@@ -4450,46 +4335,46 @@ async function Zo(e) {
|
|
|
4450
4335
|
}
|
|
4451
4336
|
return createImageBitmap(t);
|
|
4452
4337
|
}
|
|
4453
|
-
function
|
|
4338
|
+
function Ho(e) {
|
|
4454
4339
|
e && "close" in e && e.close();
|
|
4455
4340
|
}
|
|
4456
|
-
function
|
|
4457
|
-
let n = t === "bitmap", r =
|
|
4341
|
+
function Uo(e, t = "image") {
|
|
4342
|
+
let n = t === "bitmap", r = Bo(typeof e == "string" || n ? void 0 : e), i = typeof e == "string" ? e : r, [a, o] = M({ status: "loading" }), s = n ? e : i;
|
|
4458
4343
|
return O(() => {
|
|
4459
4344
|
if (!s) return;
|
|
4460
4345
|
let e = !0, t;
|
|
4461
|
-
return o({ status: "loading" }), (n ?
|
|
4462
|
-
if (t = n, !e) return
|
|
4346
|
+
return o({ status: "loading" }), (n ? Vo(s) : zo(s)).then((n) => {
|
|
4347
|
+
if (t = n, !e) return Ho(t);
|
|
4463
4348
|
let r = {
|
|
4464
4349
|
image: n,
|
|
4465
4350
|
width: "naturalWidth" in n ? n.naturalWidth : n.width,
|
|
4466
4351
|
height: "naturalHeight" in n ? n.naturalHeight : n.height
|
|
4467
4352
|
};
|
|
4468
|
-
if (!(r.width > 0 && r.height > 0) || !
|
|
4353
|
+
if (!(r.width > 0 && r.height > 0) || !Vr(r)) throw Error("The image cannot be edited");
|
|
4469
4354
|
o({
|
|
4470
4355
|
status: "ready",
|
|
4471
4356
|
original: r,
|
|
4472
|
-
preview:
|
|
4357
|
+
preview: Br(r, wn)
|
|
4473
4358
|
});
|
|
4474
4359
|
}).catch(() => {
|
|
4475
4360
|
e && o({ status: "error" });
|
|
4476
4361
|
}), () => {
|
|
4477
|
-
e = !1,
|
|
4362
|
+
e = !1, Ho(t);
|
|
4478
4363
|
};
|
|
4479
4364
|
}, [s, n]), a;
|
|
4480
4365
|
}
|
|
4481
4366
|
//#endregion
|
|
4482
4367
|
//#region lib/components/ui/media/image-editor/use-place-step.ts
|
|
4483
|
-
var
|
|
4484
|
-
function
|
|
4368
|
+
var Wo = (e, t, n) => Math.min(n, Math.max(t, e));
|
|
4369
|
+
function Go(e, t) {
|
|
4485
4370
|
let n = t % 6 * .03;
|
|
4486
4371
|
return {
|
|
4487
|
-
x:
|
|
4488
|
-
y:
|
|
4372
|
+
x: Wo(e.x + e.w / 2 + n, Math.max(0, e.x), Math.min(1, e.x + e.w)),
|
|
4373
|
+
y: Wo(e.y + e.h / 2 + n, Math.max(0, e.y), Math.min(1, e.y + e.h))
|
|
4489
4374
|
};
|
|
4490
4375
|
}
|
|
4491
|
-
function
|
|
4492
|
-
let i = e.tool === "markup" && e.markupTool === "step" && r !== null, a = e.edits.annotations.filter((e) => e.kind === "step").length, o = e.brush, { addAnnotation: s } = t, c = D(() => s(
|
|
4376
|
+
function Ko(e, t, n, r) {
|
|
4377
|
+
let i = e.tool === "markup" && e.markupTool === "step" && r !== null, a = e.edits.annotations.filter((e) => e.kind === "step").length, o = e.brush, { addAnnotation: s } = t, c = D(() => s(Fa(Go(n, a), o)), [
|
|
4493
4378
|
s,
|
|
4494
4379
|
n,
|
|
4495
4380
|
a,
|
|
@@ -4499,12 +4384,12 @@ function ns(e, t, n, r) {
|
|
|
4499
4384
|
}
|
|
4500
4385
|
//#endregion
|
|
4501
4386
|
//#region lib/components/ui/media/image-editor/use-redact-modes.ts
|
|
4502
|
-
function
|
|
4503
|
-
return A(() =>
|
|
4387
|
+
function qo(e) {
|
|
4388
|
+
return A(() => ir(e), [ir(e).join()]);
|
|
4504
4389
|
}
|
|
4505
|
-
function
|
|
4390
|
+
function Jo(e, t) {
|
|
4506
4391
|
return A(() => {
|
|
4507
|
-
let n = (e) =>
|
|
4392
|
+
let n = (e) => ar(t, e), r = (e) => e.kind === "redact" ? {
|
|
4508
4393
|
...e,
|
|
4509
4394
|
mode: n(e.mode ?? "solid")
|
|
4510
4395
|
} : e;
|
|
@@ -4524,42 +4409,42 @@ function is(e, t) {
|
|
|
4524
4409
|
}
|
|
4525
4410
|
//#endregion
|
|
4526
4411
|
//#region lib/components/ui/media/image-editor/use-image-editor.ts
|
|
4527
|
-
var
|
|
4528
|
-
function
|
|
4529
|
-
let t =
|
|
4530
|
-
|
|
4412
|
+
var Yo = (e) => bo(tr, e);
|
|
4413
|
+
function Xo(e) {
|
|
4414
|
+
let t = ko(e), n = qo(e.redactModes), [r, i] = Yo(Oo(e, t, n)), a = Jo(i, n), o = Uo(e.src, e.decode), s = o.status === "ready" ? K(o.original, r.edits.transform.quarterTurns) : null, c = p(e.onEditsChange);
|
|
4415
|
+
an(() => {
|
|
4531
4416
|
c.current?.(r.edits);
|
|
4532
|
-
}, [r.edits]),
|
|
4533
|
-
let l =
|
|
4417
|
+
}, [r.edits]), Zo(e.defaultEdits?.crop ? void 0 : e.aspect, o.status === "ready" ? o.original : null, e.defaultEdits?.transform?.quarterTurns ?? 0, a);
|
|
4418
|
+
let l = Ro(r.zoom, a.setZoom), u = j(null), d = aa(r.tool, r.edits.crop), f = ua(u, s && {
|
|
4534
4419
|
width: d.w * s.width,
|
|
4535
4420
|
height: d.h * s.height
|
|
4536
|
-
}, r.zoom, l, e.toolbar === "floating" && r.tool === "crop"),
|
|
4421
|
+
}, r.zoom, l, e.toolbar === "floating" && r.tool === "crop"), m = Do({
|
|
4537
4422
|
source: o,
|
|
4538
4423
|
edits: r.edits,
|
|
4539
4424
|
options: r.exportOptions,
|
|
4540
4425
|
fileName: e.fileName ?? "image",
|
|
4541
4426
|
maxSize: e.maxExportSize,
|
|
4542
4427
|
onSave: e.onSave
|
|
4543
|
-
}),
|
|
4428
|
+
}), h = nr.selectSelected(r), g = Io(a, h, l, Ko(r, a, d, s));
|
|
4544
4429
|
return {
|
|
4545
4430
|
state: r,
|
|
4546
4431
|
actions: a,
|
|
4547
4432
|
source: o,
|
|
4548
4433
|
base: s,
|
|
4549
4434
|
tools: t,
|
|
4550
|
-
colors: e.colors?.length ? e.colors :
|
|
4435
|
+
colors: e.colors?.length ? e.colors : _n,
|
|
4551
4436
|
markupTools: e.markupTools?.length ? e.markupTools : void 0,
|
|
4552
4437
|
redactModes: n,
|
|
4553
|
-
aspectPresets: e.aspectPresets ??
|
|
4438
|
+
aspectPresets: e.aspectPresets ?? gn,
|
|
4554
4439
|
lockedAspect: e.aspect,
|
|
4555
|
-
canUndo:
|
|
4556
|
-
canRedo:
|
|
4557
|
-
selected:
|
|
4440
|
+
canUndo: nr.selectCanUndo(r),
|
|
4441
|
+
canRedo: nr.selectCanRedo(r),
|
|
4442
|
+
selected: h,
|
|
4558
4443
|
zoom: l,
|
|
4559
4444
|
stageRef: u,
|
|
4560
4445
|
view: d,
|
|
4561
4446
|
scale: f,
|
|
4562
|
-
exporting:
|
|
4447
|
+
exporting: m,
|
|
4563
4448
|
onSave: e.onSave,
|
|
4564
4449
|
onCancel: e.onCancel,
|
|
4565
4450
|
saveLabel: e.saveLabel,
|
|
@@ -4569,12 +4454,12 @@ function os(e) {
|
|
|
4569
4454
|
onKeyDown: g
|
|
4570
4455
|
};
|
|
4571
4456
|
}
|
|
4572
|
-
function
|
|
4573
|
-
let i =
|
|
4457
|
+
function Zo(e, t, n, r) {
|
|
4458
|
+
let i = p(n);
|
|
4574
4459
|
O(() => {
|
|
4575
4460
|
if (!e || !t) return;
|
|
4576
|
-
let n =
|
|
4577
|
-
r.setCrop({ rect:
|
|
4461
|
+
let n = K(t, i.current);
|
|
4462
|
+
r.setCrop({ rect: Fn({
|
|
4578
4463
|
x: 0,
|
|
4579
4464
|
y: 0,
|
|
4580
4465
|
w: 1,
|
|
@@ -4589,16 +4474,16 @@ function ss(e, t, n, r) {
|
|
|
4589
4474
|
}
|
|
4590
4475
|
//#endregion
|
|
4591
4476
|
//#region lib/components/ui/media/image-editor/image-editor.tsx
|
|
4592
|
-
function
|
|
4593
|
-
let t =
|
|
4594
|
-
return /* @__PURE__ */ P(
|
|
4477
|
+
function Qo(e) {
|
|
4478
|
+
let t = Xo(e), { t: n } = i();
|
|
4479
|
+
return /* @__PURE__ */ P(sn, {
|
|
4595
4480
|
value: t,
|
|
4596
4481
|
children: /* @__PURE__ */ F("div", {
|
|
4597
4482
|
"data-slot": "image-editor",
|
|
4598
4483
|
className: T("@container/image-editor flex h-[600px] min-h-0 flex-col overflow-hidden rounded-xl border bg-background text-foreground", e.className),
|
|
4599
4484
|
onKeyDown: t.onKeyDown,
|
|
4600
4485
|
children: [
|
|
4601
|
-
/* @__PURE__ */ P(
|
|
4486
|
+
/* @__PURE__ */ P(uo, {}),
|
|
4602
4487
|
t.exporting.failed && /* @__PURE__ */ P("div", {
|
|
4603
4488
|
role: "alert",
|
|
4604
4489
|
className: "shrink-0 bg-error/10 px-4 py-2 text-error-text text-sm",
|
|
@@ -4606,7 +4491,7 @@ function cs(e) {
|
|
|
4606
4491
|
}),
|
|
4607
4492
|
/* @__PURE__ */ F("div", {
|
|
4608
4493
|
className: "flex min-h-0 flex-1 flex-col @3xl/image-editor:flex-row",
|
|
4609
|
-
children: [/* @__PURE__ */ P(
|
|
4494
|
+
children: [/* @__PURE__ */ P(qa, {}), t.toolbar === "panel" && /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(Xi, {}), /* @__PURE__ */ P(Za, {})] })]
|
|
4610
4495
|
})
|
|
4611
4496
|
]
|
|
4612
4497
|
})
|
|
@@ -4614,7 +4499,7 @@ function cs(e) {
|
|
|
4614
4499
|
}
|
|
4615
4500
|
//#endregion
|
|
4616
4501
|
//#region lib/components/ui/media/image-editor/image-markup-editor.tsx
|
|
4617
|
-
var
|
|
4502
|
+
var $o = [
|
|
4618
4503
|
"pen",
|
|
4619
4504
|
"highlighter",
|
|
4620
4505
|
"arrow",
|
|
@@ -4623,8 +4508,8 @@ var ls = [
|
|
|
4623
4508
|
"step",
|
|
4624
4509
|
"redact"
|
|
4625
4510
|
];
|
|
4626
|
-
function
|
|
4627
|
-
return /* @__PURE__ */ P(
|
|
4511
|
+
function es({ markupTools: e = $o, decode: t = "bitmap", crop: n = !1, ...r }) {
|
|
4512
|
+
return /* @__PURE__ */ P(Qo, {
|
|
4628
4513
|
...r,
|
|
4629
4514
|
tools: n ? ["markup", "crop"] : ["markup"],
|
|
4630
4515
|
defaultTool: "markup",
|
|
@@ -4634,4 +4519,4 @@ function us({ markupTools: e = ls, decode: t = "bitmap", crop: n = !1, ...r }) {
|
|
|
4634
4519
|
});
|
|
4635
4520
|
}
|
|
4636
4521
|
//#endregion
|
|
4637
|
-
export {
|
|
4522
|
+
export { $o as EMBED_MARKUP_TOOLS, Qo as ImageEditor, es as ImageMarkupEditor, se as NxgtThemeProvider, v as PortalContainerProvider, re as adoptStyles };
|