geoiq-frontend-ui-kit 2.0.2 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/organisms/image-editor/components/line-session-bar.d.ts +20 -0
- package/dist/components/organisms/image-editor/components/line-session-bar.d.ts.map +1 -0
- package/dist/components/organisms/image-editor/components/panel-insert.d.ts.map +1 -1
- package/dist/components/organisms/image-editor/components/panel-selected.d.ts.map +1 -1
- package/dist/components/organisms/image-editor/components/panel.d.ts.map +1 -1
- package/dist/components/organisms/image-editor/components/saved-layers-list.d.ts +9 -0
- package/dist/components/organisms/image-editor/components/saved-layers-list.d.ts.map +1 -0
- package/dist/components/organisms/image-editor/image-editor-modal.d.ts.map +1 -1
- package/dist/components/organisms/image-editor/image-editor.types.d.ts +73 -0
- package/dist/components/organisms/image-editor/image-editor.types.d.ts.map +1 -1
- package/dist/components/organisms/image-editor/use-image-editor.d.ts.map +1 -1
- package/dist/components/ui/request-credits-view/component/request-credit-dialog.d.ts.map +1 -1
- package/dist/index.es100.js +147 -120
- package/dist/index.es100.js.map +1 -1
- package/dist/index.es101.js +16 -11
- package/dist/index.es101.js.map +1 -1
- package/dist/index.es102.js +7 -41
- package/dist/index.es102.js.map +1 -1
- package/dist/index.es103.js +21 -10
- package/dist/index.es103.js.map +1 -1
- package/dist/index.es104.js +7 -74
- package/dist/index.es104.js.map +1 -1
- package/dist/index.es105.js +177 -30
- package/dist/index.es105.js.map +1 -1
- package/dist/index.es106.js +45 -16
- package/dist/index.es106.js.map +1 -1
- package/dist/index.es107.js +42 -20
- package/dist/index.es107.js.map +1 -1
- package/dist/index.es108.js +22 -12
- package/dist/index.es108.js.map +1 -1
- package/dist/index.es109.js +122 -98
- package/dist/index.es109.js.map +1 -1
- package/dist/index.es11.js +1 -1
- package/dist/index.es110.js +33 -62
- package/dist/index.es110.js.map +1 -1
- package/dist/index.es111.js +60 -52
- package/dist/index.es111.js.map +1 -1
- package/dist/index.es112.js +10 -41
- package/dist/index.es112.js.map +1 -1
- package/dist/index.es113.js +21 -11
- package/dist/index.es113.js.map +1 -1
- package/dist/index.es114.js +42 -92
- package/dist/index.es114.js.map +1 -1
- package/dist/index.es115.js +37 -16
- package/dist/index.es115.js.map +1 -1
- package/dist/index.es116.js +12 -99
- package/dist/index.es116.js.map +1 -1
- package/dist/index.es117.js +92 -13
- package/dist/index.es117.js.map +1 -1
- package/dist/index.es118.js +13 -101
- package/dist/index.es118.js.map +1 -1
- package/dist/index.es119.js +71 -20
- package/dist/index.es119.js.map +1 -1
- package/dist/index.es12.js +1 -1
- package/dist/index.es120.js +34 -25
- package/dist/index.es120.js.map +1 -1
- package/dist/index.es121.js +20 -22
- package/dist/index.es121.js.map +1 -1
- package/dist/index.es122.js +16 -45
- package/dist/index.es122.js.map +1 -1
- package/dist/index.es123.js +11 -34
- package/dist/index.es123.js.map +1 -1
- package/dist/index.es124.js +96 -61
- package/dist/index.es124.js.map +1 -1
- package/dist/index.es125.js +57 -174
- package/dist/index.es125.js.map +1 -1
- package/dist/index.es126.js +50 -17
- package/dist/index.es126.js.map +1 -1
- package/dist/index.es127.js +2 -2
- package/dist/index.es128.js +2 -2
- package/dist/index.es129.js +1 -1
- package/dist/index.es130.js +1 -1
- package/dist/index.es131.js +2 -2
- package/dist/index.es132.js +35 -38
- package/dist/index.es132.js.map +1 -1
- package/dist/index.es133.js +41 -7
- package/dist/index.es133.js.map +1 -1
- package/dist/index.es134.js +88 -7
- package/dist/index.es134.js.map +1 -1
- package/dist/index.es135.js +14 -34
- package/dist/index.es135.js.map +1 -1
- package/dist/index.es136.js +269 -35
- package/dist/index.es136.js.map +1 -1
- package/dist/index.es137.js +7 -2
- package/dist/index.es137.js.map +1 -1
- package/dist/index.es138.js +23 -25
- package/dist/index.es138.js.map +1 -1
- package/dist/index.es139.js +169 -15
- package/dist/index.es139.js.map +1 -1
- package/dist/index.es140.js +82 -7
- package/dist/index.es140.js.map +1 -1
- package/dist/index.es141.js +73 -21
- package/dist/index.es141.js.map +1 -1
- package/dist/index.es142.js +3 -168
- package/dist/index.es142.js.map +1 -1
- package/dist/index.es143.js +56 -82
- package/dist/index.es143.js.map +1 -1
- package/dist/index.es144.js +119 -4
- package/dist/index.es144.js.map +1 -1
- package/dist/index.es145.js +405 -56
- package/dist/index.es145.js.map +1 -1
- package/dist/index.es146.js +25 -110
- package/dist/index.es146.js.map +1 -1
- package/dist/index.es147.js +60 -314
- package/dist/index.es147.js.map +1 -1
- package/dist/index.es148.js +29 -24
- package/dist/index.es148.js.map +1 -1
- package/dist/index.es149.js +21 -64
- package/dist/index.es149.js.map +1 -1
- package/dist/index.es150.js +36 -30
- package/dist/index.es150.js.map +1 -1
- package/dist/index.es151.js +211 -24
- package/dist/index.es151.js.map +1 -1
- package/dist/index.es152.js +141 -35
- package/dist/index.es152.js.map +1 -1
- package/dist/index.es153.js +141 -140
- package/dist/index.es153.js.map +1 -1
- package/dist/index.es154.js +45 -142
- package/dist/index.es154.js.map +1 -1
- package/dist/index.es155.js +353 -45
- package/dist/index.es155.js.map +1 -1
- package/dist/index.es156.js +14 -10
- package/dist/index.es156.js.map +1 -1
- package/dist/index.es157.js +10 -42
- package/dist/index.es157.js.map +1 -1
- package/dist/index.es158.js +44 -5
- package/dist/index.es158.js.map +1 -1
- package/dist/index.es159.js +5 -11
- package/dist/index.es159.js.map +1 -1
- package/dist/index.es16.js +1 -1
- package/dist/index.es160.js +10 -10
- package/dist/index.es160.js.map +1 -1
- package/dist/index.es161.js +11 -2
- package/dist/index.es161.js.map +1 -1
- package/dist/index.es162.js +2 -91
- package/dist/index.es162.js.map +1 -1
- package/dist/index.es163.js +2 -213
- package/dist/index.es163.js.map +1 -1
- package/dist/index.es164.js +23 -52
- package/dist/index.es164.js.map +1 -1
- package/dist/index.es165.js +88 -33
- package/dist/index.es165.js.map +1 -1
- package/dist/index.es166.js +52 -31
- package/dist/index.es166.js.map +1 -1
- package/dist/index.es167.js +32 -29
- package/dist/index.es167.js.map +1 -1
- package/dist/index.es168.js +26 -84
- package/dist/index.es168.js.map +1 -1
- package/dist/index.es169.js +27 -111
- package/dist/index.es169.js.map +1 -1
- package/dist/index.es170.js +97 -285
- package/dist/index.es170.js.map +1 -1
- package/dist/index.es171.js +251 -30
- package/dist/index.es171.js.map +1 -1
- package/dist/index.es172.js +63 -11
- package/dist/index.es172.js.map +1 -1
- package/dist/index.es173.js +284 -82
- package/dist/index.es173.js.map +1 -1
- package/dist/index.es174.js +29 -70
- package/dist/index.es174.js.map +1 -1
- package/dist/index.es175.js +10 -114
- package/dist/index.es175.js.map +1 -1
- package/dist/index.es176.js +23 -106
- package/dist/index.es176.js.map +1 -1
- package/dist/index.es177.js +19 -82
- package/dist/index.es177.js.map +1 -1
- package/dist/index.es178.js +63 -109
- package/dist/index.es178.js.map +1 -1
- package/dist/index.es179.js +63 -117
- package/dist/index.es179.js.map +1 -1
- package/dist/index.es180.js +112 -23
- package/dist/index.es180.js.map +1 -1
- package/dist/index.es181.js +103 -18
- package/dist/index.es181.js.map +1 -1
- package/dist/index.es182.js +86 -5
- package/dist/index.es182.js.map +1 -1
- package/dist/index.es183.js +133 -0
- package/dist/index.es183.js.map +1 -0
- package/dist/index.es184.js +133 -0
- package/dist/index.es184.js.map +1 -0
- package/dist/index.es185.js +9 -0
- package/dist/index.es185.js.map +1 -0
- package/dist/index.es19.js +1 -1
- package/dist/index.es2.js +21 -21
- package/dist/index.es2.js.map +1 -1
- package/dist/index.es20.js +1 -1
- package/dist/index.es21.js +3 -3
- package/dist/index.es22.js +1 -1
- package/dist/index.es25.js +1 -1
- package/dist/index.es27.js +1 -1
- package/dist/index.es28.js +2 -2
- package/dist/index.es30.js +1 -1
- package/dist/index.es32.js +1 -1
- package/dist/index.es33.js +1 -1
- package/dist/index.es45.js +48 -46
- package/dist/index.es45.js.map +1 -1
- package/dist/index.es46.js +2 -2
- package/dist/index.es47.js +1 -1
- package/dist/index.es48.js +1 -1
- package/dist/index.es53.js +1 -1
- package/dist/index.es54.js +1 -1
- package/dist/index.es57.js +1 -1
- package/dist/index.es59.js +1 -1
- package/dist/index.es67.js +2 -2
- package/dist/index.es68.js +1 -1
- package/dist/index.es71.js +1 -1
- package/dist/index.es72.js +7 -7
- package/dist/index.es73.js +2 -2
- package/dist/index.es85.js +1 -1
- package/dist/index.es97.js +16 -11
- package/dist/index.es97.js.map +1 -1
- package/dist/index.es98.js +89 -262
- package/dist/index.es98.js.map +1 -1
- package/dist/index.es99.js +13 -87
- package/dist/index.es99.js.map +1 -1
- package/dist/styles.css +55 -0
- package/package.json +2 -1
package/dist/index.es145.js
CHANGED
|
@@ -1,59 +1,408 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
{
|
|
5
|
-
{
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
{
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
1
|
+
import { supportsContextFilter as H } from "./index.es165.js";
|
|
2
|
+
import { FILTER_CSS as _ } from "./index.es143.js";
|
|
3
|
+
function O(t) {
|
|
4
|
+
const { adj: e } = t;
|
|
5
|
+
let n = `brightness(${e.brightness}%) contrast(${e.contrast}%) saturate(${e.saturate}%) sepia(${e.sepia}%) blur(${e.blur}px) hue-rotate(${e.hue}deg)`;
|
|
6
|
+
return e.filter !== "none" && (n += " " + _[e.filter]), n.trim();
|
|
7
|
+
}
|
|
8
|
+
const W = 0.25, $ = 4, E = 1.25;
|
|
9
|
+
function I(t) {
|
|
10
|
+
const n = Math.min(
|
|
11
|
+
(t.stageEl.clientWidth - 48) / t.sourceCanvas.width,
|
|
12
|
+
(t.stageEl.clientHeight - 48) / t.sourceCanvas.height,
|
|
13
|
+
1
|
|
14
|
+
);
|
|
15
|
+
t.fitScale = n;
|
|
16
|
+
const o = n * t.zoom;
|
|
17
|
+
t.viewScale = o;
|
|
18
|
+
const r = Math.round(t.sourceCanvas.width * o), a = Math.round(t.sourceCanvas.height * o);
|
|
19
|
+
t.canvasEl.style.width = t.overlayEl.style.width = r + "px", t.canvasEl.style.height = t.overlayEl.style.height = a + "px";
|
|
20
|
+
}
|
|
21
|
+
function g(t, e) {
|
|
22
|
+
if (t.zoom = Math.min($, Math.max(W, e)), !t.mounted || !t.sourceCanvas.width) {
|
|
23
|
+
t.notify();
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
I(t), C(t), t.notify();
|
|
27
|
+
}
|
|
28
|
+
function oe(t) {
|
|
29
|
+
g(t, t.zoom * E);
|
|
30
|
+
}
|
|
31
|
+
function ie(t) {
|
|
32
|
+
g(t, t.zoom / E);
|
|
33
|
+
}
|
|
34
|
+
function ae(t) {
|
|
35
|
+
g(t, 1);
|
|
36
|
+
}
|
|
37
|
+
function le(t) {
|
|
38
|
+
t.canvasEl.width = t.overlayEl.width = t.sourceCanvas.width, t.canvasEl.height = t.overlayEl.height = t.sourceCanvas.height, I(t);
|
|
39
|
+
}
|
|
40
|
+
function B(t) {
|
|
41
|
+
const { ctx: e, canvasEl: n, sourceCanvas: o } = t;
|
|
42
|
+
e.clearRect(0, 0, n.width, n.height);
|
|
43
|
+
const r = O(t);
|
|
44
|
+
if (H()) {
|
|
45
|
+
n.style.filter = "", e.filter = r, e.drawImage(o, 0, 0), e.filter = "none";
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
n.style.filter = r, e.drawImage(o, 0, 0);
|
|
49
|
+
}
|
|
50
|
+
function re(t) {
|
|
51
|
+
!t.mounted || !t.sourceCanvas.width || (B(t), C(t));
|
|
52
|
+
}
|
|
53
|
+
const m = 1.1;
|
|
54
|
+
function P(t, e) {
|
|
55
|
+
t.octx.font = `${e.size}px ${e.font}`;
|
|
56
|
+
const n = Math.max(e.boxWidth, 1), o = [];
|
|
57
|
+
return e.text.split(`
|
|
58
|
+
`).forEach((r) => {
|
|
59
|
+
const a = r.split(" ");
|
|
60
|
+
let i = "";
|
|
61
|
+
a.forEach((l) => {
|
|
62
|
+
const s = i ? i + " " + l : l;
|
|
63
|
+
i && t.octx.measureText(s).width > n ? (o.push(i), i = l) : i = s;
|
|
64
|
+
}), o.push(i);
|
|
65
|
+
}), o;
|
|
66
|
+
}
|
|
67
|
+
function y(t, e) {
|
|
68
|
+
if (e.type === "text") {
|
|
69
|
+
const n = P(t, e);
|
|
70
|
+
return {
|
|
71
|
+
x: e.x,
|
|
72
|
+
y: e.y,
|
|
73
|
+
w: e.boxWidth,
|
|
74
|
+
h: n.length * e.size * m
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
if (e.type === "shape" && G(e)) {
|
|
78
|
+
let n = 1 / 0, o = 1 / 0, r = -1 / 0, a = -1 / 0;
|
|
79
|
+
e.points.forEach((l) => {
|
|
80
|
+
n = Math.min(n, l.x), o = Math.min(o, l.y), r = Math.max(r, l.x), a = Math.max(a, l.y);
|
|
81
|
+
});
|
|
82
|
+
const i = (e.width || 6) / 2;
|
|
83
|
+
return { x: n - i, y: o - i, w: r - n + i * 2, h: a - o + i * 2 };
|
|
84
|
+
}
|
|
85
|
+
if (e.type === "shape" || e.type === "sticker")
|
|
86
|
+
return {
|
|
87
|
+
x: Math.min(e.x, e.x + e.w),
|
|
88
|
+
y: Math.min(e.y, e.y + e.h),
|
|
89
|
+
w: Math.abs(e.w),
|
|
90
|
+
h: Math.abs(e.h)
|
|
91
|
+
};
|
|
92
|
+
if (e.type === "stroke") {
|
|
93
|
+
let n = 1 / 0, o = 1 / 0, r = -1 / 0, a = -1 / 0;
|
|
94
|
+
e.points.forEach((l) => {
|
|
95
|
+
n = Math.min(n, l.x), o = Math.min(o, l.y), r = Math.max(r, l.x), a = Math.max(a, l.y);
|
|
96
|
+
});
|
|
97
|
+
const i = e.width / 2;
|
|
98
|
+
return { x: n - i, y: o - i, w: r - n + i * 2, h: a - o + i * 2 };
|
|
99
|
+
}
|
|
100
|
+
return { x: 0, y: 0, w: 0, h: 0 };
|
|
101
|
+
}
|
|
102
|
+
function se(t, e) {
|
|
103
|
+
if (e.type !== "text") return;
|
|
104
|
+
const n = t.sourceCanvas.height - e.y;
|
|
105
|
+
for (; e.size > 10 && y(t, e).h > n && n > 0; )
|
|
106
|
+
e.size -= 1;
|
|
107
|
+
}
|
|
108
|
+
function he(t, e) {
|
|
109
|
+
if (e.type !== "text") return;
|
|
110
|
+
const n = t.sourceCanvas.width - e.x;
|
|
111
|
+
e.boxWidth = Math.round(Math.max(20, Math.min(e.boxWidth, n)));
|
|
112
|
+
}
|
|
113
|
+
function A(t) {
|
|
114
|
+
return [
|
|
115
|
+
{ corner: "tl", x: t.x, y: t.y },
|
|
116
|
+
{ corner: "tr", x: t.x + t.w, y: t.y },
|
|
117
|
+
{ corner: "bl", x: t.x, y: t.y + t.h },
|
|
118
|
+
{ corner: "br", x: t.x + t.w, y: t.y + t.h }
|
|
119
|
+
];
|
|
120
|
+
}
|
|
121
|
+
const b = [
|
|
122
|
+
"line",
|
|
123
|
+
"dashedLine",
|
|
124
|
+
"arrow",
|
|
125
|
+
"dashedArrow",
|
|
126
|
+
"doubleArrow",
|
|
127
|
+
"dashedDoubleArrow"
|
|
128
|
+
], N = ["dashedLine", "dashedArrow", "dashedDoubleArrow"], fe = ["line", "dashedLine"], F = {
|
|
129
|
+
arrow: ["end"],
|
|
130
|
+
dashedArrow: ["end"],
|
|
131
|
+
doubleArrow: ["end", "start"],
|
|
132
|
+
dashedDoubleArrow: ["end", "start"]
|
|
133
|
+
}, U = 10, T = 42;
|
|
134
|
+
function Z(t) {
|
|
135
|
+
return t.points && t.points.length >= 2 ? t.points : [
|
|
136
|
+
{ x: t.x, y: t.y },
|
|
137
|
+
{ x: t.x + t.w, y: t.y + t.h }
|
|
138
|
+
];
|
|
139
|
+
}
|
|
140
|
+
function G(t) {
|
|
141
|
+
return !!(t.points && t.points.length >= 2);
|
|
142
|
+
}
|
|
143
|
+
function q(t, e, n) {
|
|
144
|
+
const o = e && t.length > 2 ? t.concat([t[0]]) : t;
|
|
145
|
+
let r = 0;
|
|
146
|
+
const a = [];
|
|
147
|
+
for (let l = 0; l < o.length - 1; l++) {
|
|
148
|
+
const s = Math.hypot(o[l + 1].x - o[l].x, o[l + 1].y - o[l].y);
|
|
149
|
+
a.push(s), r += s;
|
|
150
|
+
}
|
|
151
|
+
if (!r) return { x: o[0].x, y: o[0].y, angle: 0 };
|
|
152
|
+
let i = r * Math.min(Math.max(n, 0), 1);
|
|
153
|
+
for (let l = 0; l < a.length; l++) {
|
|
154
|
+
if (i <= a[l] || l === a.length - 1) {
|
|
155
|
+
const s = a[l] ? i / a[l] : 0;
|
|
156
|
+
return {
|
|
157
|
+
x: o[l].x + (o[l + 1].x - o[l].x) * s,
|
|
158
|
+
y: o[l].y + (o[l + 1].y - o[l].y) * s,
|
|
159
|
+
angle: Math.atan2(o[l + 1].y - o[l].y, o[l + 1].x - o[l].x)
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
i -= a[l];
|
|
163
|
+
}
|
|
164
|
+
return { x: o[0].x, y: o[0].y, angle: 0 };
|
|
165
|
+
}
|
|
166
|
+
function J(t, e, n) {
|
|
167
|
+
if (!e.label) return;
|
|
168
|
+
const o = e.labelSize || T, r = q(n, e.closed, e.labelPos ?? 0.5), a = e.labelRotate !== !1, i = e.labelSide === "below" ? -1 : 1, l = e.labelOffset ?? U, s = (e.width || 6) / 2 + l;
|
|
169
|
+
let h = a ? r.angle : 0, c = !1;
|
|
170
|
+
a && (h > Math.PI / 2 || h < -Math.PI / 2) && (h += Math.PI, c = !0);
|
|
171
|
+
const f = i * (c ? -1 : 1), d = Math.sin(r.angle) * s * f, u = -Math.cos(r.angle) * s * f;
|
|
172
|
+
t.save(), t.translate(r.x + d, r.y + u), t.rotate(h), t.font = `${o}px ${e.labelFont || "Avenir Next, Segoe UI, sans-serif"}`, t.fillStyle = e.labelColor || e.color, t.textAlign = "center", t.textBaseline = i === 1 ? "bottom" : "top", t.setLineDash([]), t.shadowColor = "rgba(0,0,0,.25)", t.shadowBlur = o * 0.08, t.fillText(e.label, 0, 0), t.restore();
|
|
173
|
+
}
|
|
174
|
+
function V(t) {
|
|
175
|
+
const e = Math.max(1, t || 1);
|
|
176
|
+
return [Math.max(6, e * 2.5), Math.max(4, e * 1.75)];
|
|
177
|
+
}
|
|
178
|
+
function v(t, e, n, o, r) {
|
|
179
|
+
t.beginPath(), t.moveTo(e, n), t.lineTo(
|
|
180
|
+
e - r * Math.cos(o - Math.PI / 6),
|
|
181
|
+
n - r * Math.sin(o - Math.PI / 6)
|
|
182
|
+
), t.moveTo(e, n), t.lineTo(
|
|
183
|
+
e - r * Math.cos(o + Math.PI / 6),
|
|
184
|
+
n - r * Math.sin(o + Math.PI / 6)
|
|
185
|
+
), t.stroke();
|
|
186
|
+
}
|
|
187
|
+
function p(t, e, n) {
|
|
188
|
+
if (!e.label) return;
|
|
189
|
+
const o = e.labelSize || T;
|
|
190
|
+
t.save(), t.font = `${o}px ${e.labelFont || "Avenir Next, Segoe UI, sans-serif"}`, t.fillStyle = e.labelColor || j(e), t.textAlign = "center", t.textBaseline = "middle", t.setLineDash([]);
|
|
191
|
+
const r = Math.max(20, Math.abs(n.w) - o * 0.6), a = [];
|
|
192
|
+
let i = "";
|
|
193
|
+
e.label.split(/\s+/).forEach((c) => {
|
|
194
|
+
const f = i ? i + " " + c : c;
|
|
195
|
+
t.measureText(f).width > r && i ? (a.push(i), i = c) : i = f;
|
|
196
|
+
}), i && a.push(i);
|
|
197
|
+
const l = o * m, s = n.x + n.w / 2 + (e.labelDx || 0), h = n.y + n.h / 2 + (e.labelDy || 0) - (a.length - 1) * l / 2;
|
|
198
|
+
a.forEach((c, f) => t.fillText(c, s, h + f * l)), t.restore();
|
|
199
|
+
}
|
|
200
|
+
function j(t) {
|
|
201
|
+
if (t.fill !== "fill") return t.color;
|
|
202
|
+
const e = (t.color || "#111111").replace("#", "");
|
|
203
|
+
if (e.length < 6) return "#ffffff";
|
|
204
|
+
const n = parseInt(e.slice(0, 2), 16), o = parseInt(e.slice(2, 4), 16), r = parseInt(e.slice(4, 6), 16);
|
|
205
|
+
return 0.299 * n + 0.587 * o + 0.114 * r > 150 ? "#111111" : "#ffffff";
|
|
206
|
+
}
|
|
207
|
+
const K = 26, Q = 6;
|
|
208
|
+
function x(t, e) {
|
|
209
|
+
const n = y(t, e);
|
|
210
|
+
return { x: n.x + n.w / 2, y: n.y + n.h / 2 };
|
|
211
|
+
}
|
|
212
|
+
function M(t, e, n) {
|
|
213
|
+
if (!n) return { x: t.x, y: t.y };
|
|
214
|
+
const o = n * Math.PI / 180, r = Math.cos(o), a = Math.sin(o), i = t.x - e.x, l = t.y - e.y;
|
|
215
|
+
return { x: e.x + i * r - l * a, y: e.y + i * a + l * r };
|
|
216
|
+
}
|
|
217
|
+
function ce(t, e, n, o) {
|
|
218
|
+
const r = e.rotation || 0;
|
|
219
|
+
if (!r) {
|
|
220
|
+
o();
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
const a = M(n, x(t, e), r);
|
|
224
|
+
o();
|
|
225
|
+
const i = M(n, x(t, e), r);
|
|
226
|
+
e.x += a.x - i.x, e.y += a.y - i.y;
|
|
227
|
+
}
|
|
228
|
+
function X(t, e, n) {
|
|
229
|
+
return M(n, x(t, e), -(e.rotation || 0));
|
|
230
|
+
}
|
|
231
|
+
function k(t, e) {
|
|
232
|
+
const n = y(t, e);
|
|
233
|
+
return {
|
|
234
|
+
x: n.x + n.w / 2,
|
|
235
|
+
y: n.y + n.h + K / t.viewScale
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
function Y(t, e) {
|
|
239
|
+
const n = k(t, e);
|
|
240
|
+
return M(n, x(t, e), e.rotation || 0);
|
|
241
|
+
}
|
|
242
|
+
function ye(t, e, n) {
|
|
243
|
+
const o = Y(t, n);
|
|
244
|
+
return Math.hypot(e.x - o.x, e.y - o.y) <= 14 / t.viewScale;
|
|
245
|
+
}
|
|
246
|
+
function xe(t, e, n) {
|
|
247
|
+
if (n.type === "stroke") return null;
|
|
248
|
+
const o = 12 / t.viewScale, r = X(t, n, e);
|
|
249
|
+
if (n.type === "shape" && b.includes(n.shape)) {
|
|
250
|
+
const s = [
|
|
251
|
+
{ corner: "start", x: n.x, y: n.y },
|
|
252
|
+
{ corner: "end", x: n.x + n.w, y: n.y + n.h }
|
|
253
|
+
].find(
|
|
254
|
+
(h) => Math.abs(r.x - h.x) < o && Math.abs(r.y - h.y) < o
|
|
255
|
+
);
|
|
256
|
+
return s ? s.corner : null;
|
|
257
|
+
}
|
|
258
|
+
const a = y(t, n), i = A(a).find(
|
|
259
|
+
(l) => Math.abs(r.x - l.x) < o && Math.abs(r.y - l.y) < o
|
|
260
|
+
);
|
|
261
|
+
return i ? i.corner : null;
|
|
262
|
+
}
|
|
263
|
+
function S(t, e, n) {
|
|
264
|
+
if (!n._editing) {
|
|
265
|
+
if (e.save(), n.type !== "stroke" || n.rotation) {
|
|
266
|
+
const o = y(t, n), r = o.x + o.w / 2, a = o.y + o.h / 2;
|
|
267
|
+
e.translate(r, a), n.rotation && e.rotate(n.rotation * Math.PI / 180), (n.flipH || n.flipV) && e.scale(n.flipH ? -1 : 1, n.flipV ? -1 : 1), e.translate(-r, -a);
|
|
268
|
+
}
|
|
269
|
+
if (n.type === "text") {
|
|
270
|
+
e.font = `${n.size}px ${n.font}`, e.fillStyle = n.color, e.textBaseline = "top", e.shadowColor = "rgba(0,0,0,.22)", e.shadowBlur = n.size * 0.05, e.shadowOffsetY = n.size * 0.02;
|
|
271
|
+
const o = n.size * m;
|
|
272
|
+
P(t, n).forEach((r, a) => {
|
|
273
|
+
e.fillText(r, n.x, n.y + a * o);
|
|
274
|
+
});
|
|
275
|
+
} else if (n.type === "shape") {
|
|
276
|
+
e.strokeStyle = n.color, e.fillStyle = n.color, e.lineWidth = n.width, e.lineCap = "round", e.lineJoin = "round";
|
|
277
|
+
const o = n.x, r = n.y, a = n.w, i = n.h, l = { x: o, y: r, w: a, h: i };
|
|
278
|
+
if (n.shape === "rect")
|
|
279
|
+
n.fill === "fill" ? e.fillRect(o, r, a, i) : e.strokeRect(o, r, a, i), p(e, n, l);
|
|
280
|
+
else if (n.shape === "ellipse")
|
|
281
|
+
e.beginPath(), e.ellipse(
|
|
282
|
+
o + a / 2,
|
|
283
|
+
r + i / 2,
|
|
284
|
+
Math.abs(a / 2),
|
|
285
|
+
Math.abs(i / 2),
|
|
286
|
+
0,
|
|
287
|
+
0,
|
|
288
|
+
Math.PI * 2
|
|
289
|
+
), n.fill === "fill" ? e.fill() : e.stroke(), p(e, n, l);
|
|
290
|
+
else if (n.shape === "circle") {
|
|
291
|
+
const s = Math.min(Math.abs(a), Math.abs(i)) / 2;
|
|
292
|
+
e.beginPath(), e.arc(o + a / 2, r + i / 2, s, 0, Math.PI * 2), n.fill === "fill" ? e.fill() : e.stroke(), p(e, n, {
|
|
293
|
+
x: o + a / 2 - s,
|
|
294
|
+
y: r + i / 2 - s,
|
|
295
|
+
w: s * 2,
|
|
296
|
+
h: s * 2
|
|
297
|
+
});
|
|
298
|
+
} else if (b.includes(n.shape)) {
|
|
299
|
+
const s = Z(n), h = N.includes(n.shape);
|
|
300
|
+
if (h && (e.lineCap = "butt", e.setLineDash(V(n.width))), e.beginPath(), s.forEach(
|
|
301
|
+
(c, f) => f === 0 ? e.moveTo(c.x, c.y) : e.lineTo(c.x, c.y)
|
|
302
|
+
), n.closed && s.length > 2 && e.closePath(), n.closed && s.length > 2 && n.fill === "fill" && (e.setLineDash([]), e.fill()), e.stroke(), h && (e.setLineDash([]), e.lineCap = "round"), !n.closed) {
|
|
303
|
+
const c = Math.max(14, n.width * 3), f = s[0], d = s[1], u = s[s.length - 2], w = s[s.length - 1], R = Math.atan2(w.y - u.y, w.x - u.x), z = Math.atan2(f.y - d.y, f.x - d.x);
|
|
304
|
+
(F[n.shape] || []).forEach((D) => {
|
|
305
|
+
D === "end" ? v(e, w.x, w.y, R, c) : v(e, f.x, f.y, z, c);
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
n.closed && s.length > 2 ? p(e, n, y(t, n)) : J(e, n, s);
|
|
309
|
+
}
|
|
310
|
+
} else if (n.type === "stroke")
|
|
311
|
+
e.strokeStyle = n.color, e.lineWidth = n.width, e.lineCap = "round", e.lineJoin = "round", e.globalAlpha = n.style === "highlight" ? 0.35 : 1, e.beginPath(), n.points.forEach(
|
|
312
|
+
(o, r) => r === 0 ? e.moveTo(o.x, o.y) : e.lineTo(o.x, o.y)
|
|
313
|
+
), n.points.length === 1 && e.lineTo(n.points[0].x + 0.1, n.points[0].y + 0.1), e.stroke();
|
|
314
|
+
else if (n.type === "sticker") {
|
|
315
|
+
const o = t.stickerImageCache.get(n.src);
|
|
316
|
+
o && o.complete && o.naturalWidth && e.drawImage(o, n.x, n.y, n.w, n.h);
|
|
317
|
+
}
|
|
318
|
+
e.restore();
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
function L(t) {
|
|
322
|
+
return {
|
|
323
|
+
x: Math.min(t.x, t.x + t.w),
|
|
324
|
+
y: Math.min(t.y, t.y + t.h),
|
|
325
|
+
w: Math.abs(t.w),
|
|
326
|
+
h: Math.abs(t.h)
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
function ee(t) {
|
|
330
|
+
const { cropRect: e, overlayEl: n, octx: o, sourceCanvas: r } = t;
|
|
331
|
+
if (!e) return;
|
|
332
|
+
const a = L(e), i = n.width, l = n.height;
|
|
333
|
+
o.save(), o.fillStyle = "rgba(0,0,0,.45)", o.fillRect(0, 0, i, Math.max(0, a.y)), o.fillRect(0, Math.min(l, a.y + a.h), i, Math.max(0, l - (a.y + a.h))), o.fillRect(0, a.y, Math.max(0, a.x), a.h), o.fillRect(Math.min(i, a.x + a.w), a.y, Math.max(0, i - (a.x + a.w)), a.h), o.strokeStyle = "#fff", o.lineWidth = Math.max(1, r.width / 500), o.setLineDash([8, 6]), o.strokeRect(a.x, a.y, a.w, a.h), o.restore();
|
|
334
|
+
}
|
|
335
|
+
function C(t) {
|
|
336
|
+
const { octx: e, overlayEl: n, layers: o, mode: r, selectedId: a } = t;
|
|
337
|
+
if (e.clearRect(0, 0, n.width, n.height), o.forEach((i) => {
|
|
338
|
+
try {
|
|
339
|
+
S(t, e, i);
|
|
340
|
+
} catch (l) {
|
|
341
|
+
console.error("[image-editor] failed to paint layer", i.id, i.type, l);
|
|
342
|
+
}
|
|
343
|
+
}), r === "select" && a != null) {
|
|
344
|
+
const i = o.find((l) => l.id === a);
|
|
345
|
+
if (i) {
|
|
346
|
+
const l = y(t, i);
|
|
347
|
+
if (e.save(), i.rotation) {
|
|
348
|
+
const h = x(t, i);
|
|
349
|
+
e.translate(h.x, h.y), e.rotate(i.rotation * Math.PI / 180), e.translate(-h.x, -h.y);
|
|
350
|
+
}
|
|
351
|
+
if (e.strokeStyle = "#2f5fd2", e.lineWidth = Math.max(1.2, 1.5 / t.viewScale), e.setLineDash([6 / t.viewScale, 4 / t.viewScale]), e.strokeRect(l.x - 4, l.y - 4, l.w + 8, l.h + 8), e.setLineDash([]), i.type !== "stroke") {
|
|
352
|
+
const h = 9 / t.viewScale;
|
|
353
|
+
e.fillStyle = "#fff", e.strokeStyle = "#2f5fd2", (i.type === "shape" && b.includes(i.shape) ? [
|
|
354
|
+
{ x: i.x, y: i.y },
|
|
355
|
+
{ x: i.x + i.w, y: i.y + i.h }
|
|
356
|
+
] : A(l)).forEach((f) => {
|
|
357
|
+
e.fillRect(f.x - h / 2, f.y - h / 2, h, h), e.strokeRect(f.x - h / 2, f.y - h / 2, h, h);
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
const s = k(t, i);
|
|
361
|
+
e.strokeStyle = "#2f5fd2", e.fillStyle = "#fff", e.beginPath(), e.moveTo(s.x, l.y + l.h + 4), e.lineTo(s.x, s.y), e.stroke(), e.beginPath(), e.arc(
|
|
362
|
+
s.x,
|
|
363
|
+
s.y,
|
|
364
|
+
Q / t.viewScale,
|
|
365
|
+
0,
|
|
366
|
+
Math.PI * 2
|
|
367
|
+
), e.fill(), e.stroke(), e.restore();
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
t.pendingShape && S(t, e, t.pendingShape), r === "crop" && t.cropRect && ee(t);
|
|
371
|
+
}
|
|
50
372
|
export {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
373
|
+
T as DEFAULT_LABEL_SIZE,
|
|
374
|
+
b as DIRECTIONAL_SHAPES,
|
|
375
|
+
U as LABEL_GAP,
|
|
376
|
+
fe as MULTI_POINT_SHAPES,
|
|
377
|
+
m as TEXT_LINE_HEIGHT,
|
|
378
|
+
$ as ZOOM_MAX,
|
|
379
|
+
W as ZOOM_MIN,
|
|
380
|
+
g as applyZoom,
|
|
381
|
+
O as baseFilter,
|
|
382
|
+
he as clampBoxWidth,
|
|
383
|
+
se as clampTextSize,
|
|
384
|
+
A as cornerPoints,
|
|
385
|
+
Z as directionalPoints,
|
|
386
|
+
ee as drawCropOverlay,
|
|
387
|
+
I as fitStage,
|
|
388
|
+
G as isMultiPoint,
|
|
389
|
+
ce as keepingFixed,
|
|
390
|
+
y as layerBounds,
|
|
391
|
+
x as layerCenter,
|
|
392
|
+
L as normRect,
|
|
393
|
+
xe as onResizeHandle,
|
|
394
|
+
ye as onRotateHandle,
|
|
395
|
+
S as paintLayer,
|
|
396
|
+
q as pathPointAt,
|
|
397
|
+
re as render,
|
|
398
|
+
B as renderBase,
|
|
399
|
+
C as renderOverlay,
|
|
400
|
+
M as rotatePoint,
|
|
401
|
+
le as syncCanvasSize,
|
|
402
|
+
X as toLayerSpace,
|
|
403
|
+
P as wrapTextLines,
|
|
404
|
+
oe as zoomIn,
|
|
405
|
+
ie as zoomOut,
|
|
406
|
+
ae as zoomToFit
|
|
58
407
|
};
|
|
59
408
|
//# sourceMappingURL=index.es145.js.map
|
package/dist/index.es145.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es145.js","sources":["../src/components/organisms/image-editor/engine/constants.js"],"sourcesContent":["export const VERSION = '1.0.0'\n\nexport const FILTERS = [\n { id: 'none', name: 'Original' },\n { id: 'grayscale', name: 'B & W' },\n { id: 'vivid', name: 'Vivid' },\n { id: 'cool', name: 'Cool' },\n { id: 'warm', name: 'Warm' },\n { id: 'vintage', name: 'Vintage' },\n { id: 'fade', name: 'Fade' },\n { id: 'noir', name: 'Noir' },\n]\nexport const FILTER_CSS = {\n none: '',\n grayscale: 'grayscale(1) contrast(1.05)',\n vivid: 'saturate(1.7) contrast(1.15)',\n cool: 'hue-rotate(200deg) saturate(1.2)',\n warm: 'sepia(.35) saturate(1.3) brightness(1.05)',\n vintage: 'sepia(.5) contrast(.9) brightness(1.05) saturate(1.2)',\n fade: 'contrast(.82) brightness(1.12) saturate(.85)',\n noir: 'grayscale(1) contrast(1.4) brightness(.92)',\n}\nexport const SWATCHES = [\n '#d24b2f',\n '#2f5fd2',\n '#e8b423',\n '#2fa84f',\n '#111111',\n '#ffffff',\n '#8e44ad',\n '#ff5da2',\n]\nexport const SHAPES = [\n { id: 'rect', name: 'Rectangle' },\n { id: 'ellipse', name: 'Ellipse' },\n { id: 'circle', name: 'Circle' },\n { id: 'line', name: 'Line' },\n { id: 'dashedLine', name: 'Dashed line' },\n { id: 'arrow', name: 'Arrow' },\n { id: 'dashedArrow', name: 'Dashed arrow' },\n { id: 'doubleArrow', name: 'Double arrow' },\n { id: 'dashedDoubleArrow', name: 'Dashed double arrow' },\n]\nexport const FONTS = [\n { label: 'Serif', value: 'Iowan Old Style, Georgia, serif' },\n { label: 'Sans', value: 'Avenir Next, Segoe UI, sans-serif' },\n { label: 'Mono', value: 'Courier New, monospace' },\n { label: 'Impact', value: 'Impact, sans-serif' },\n]\nexport const CROP_RATIOS = [\n { label: 'Freeform', value: 'free' },\n { label: 'Square 1:1', value: '1' },\n { label: '4:3', value: '1.3333' },\n { label: '16:9', value: '1.7777' },\n { label: '3:4 portrait', value: '0.75' },\n]\n"],"names":["VERSION","FILTERS","FILTER_CSS","SWATCHES","SHAPES","FONTS","CROP_RATIOS"],"mappings":"AAAY,MAACA,IAAU,SAEVC,IAAU;AAAA,EACrB,EAAE,IAAI,QAAQ,MAAM,WAAU;AAAA,EAC9B,EAAE,IAAI,aAAa,MAAM,QAAO;AAAA,EAChC,EAAE,IAAI,SAAS,MAAM,QAAO;AAAA,EAC5B,EAAE,IAAI,QAAQ,MAAM,OAAM;AAAA,EAC1B,EAAE,IAAI,QAAQ,MAAM,OAAM;AAAA,EAC1B,EAAE,IAAI,WAAW,MAAM,UAAS;AAAA,EAChC,EAAE,IAAI,QAAQ,MAAM,OAAM;AAAA,EAC1B,EAAE,IAAI,QAAQ,MAAM,OAAM;AAC5B,GACaC,IAAa;AAAA,EACxB,MAAM;AAAA,EACN,WAAW;AAAA,EACX,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,SAAS;AAAA,EACT,MAAM;AAAA,EACN,MAAM;AACR,GACaC,IAAW;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GACaC,IAAS;AAAA,EACpB,EAAE,IAAI,QAAQ,MAAM,YAAW;AAAA,EAC/B,EAAE,IAAI,WAAW,MAAM,UAAS;AAAA,EAChC,EAAE,IAAI,UAAU,MAAM,SAAQ;AAAA,EAC9B,EAAE,IAAI,QAAQ,MAAM,OAAM;AAAA,EAC1B,EAAE,IAAI,cAAc,MAAM,cAAa;AAAA,EACvC,EAAE,IAAI,SAAS,MAAM,QAAO;AAAA,EAC5B,EAAE,IAAI,eAAe,MAAM,eAAc;AAAA,EACzC,EAAE,IAAI,eAAe,MAAM,eAAc;AAAA,EACzC,EAAE,IAAI,qBAAqB,MAAM,sBAAqB;AACxD,GACaC,IAAQ;AAAA,EACnB,EAAE,OAAO,SAAS,OAAO,kCAAiC;AAAA,EAC1D,EAAE,OAAO,QAAQ,OAAO,oCAAmC;AAAA,EAC3D,EAAE,OAAO,QAAQ,OAAO,yBAAwB;AAAA,EAChD,EAAE,OAAO,UAAU,OAAO,qBAAoB;AAChD,GACaC,IAAc;AAAA,EACzB,EAAE,OAAO,YAAY,OAAO,OAAM;AAAA,EAClC,EAAE,OAAO,cAAc,OAAO,IAAG;AAAA,EACjC,EAAE,OAAO,OAAO,OAAO,SAAQ;AAAA,EAC/B,EAAE,OAAO,QAAQ,OAAO,SAAQ;AAAA,EAChC,EAAE,OAAO,gBAAgB,OAAO,OAAM;AACxC;"}
|
|
1
|
+
{"version":3,"file":"index.es145.js","sources":["../src/components/organisms/image-editor/engine/rendering.js"],"sourcesContent":["import { supportsContextFilter } from './canvas-filter.js'\nimport { FILTER_CSS } from './constants.js'\n\nexport function baseFilter(state) {\n const { adj } = state\n let f = `brightness(${adj.brightness}%) contrast(${adj.contrast}%) saturate(${adj.saturate}%) sepia(${adj.sepia}%) blur(${adj.blur}px) hue-rotate(${adj.hue}deg)`\n if (adj.filter !== 'none') f += ' ' + FILTER_CSS[adj.filter]\n return f.trim()\n}\n\nexport const ZOOM_MIN = 0.25\nexport const ZOOM_MAX = 4\nconst ZOOM_STEP = 1.25\n\nexport function fitStage(state) {\n const pad = 48\n const fitScale = Math.min(\n (state.stageEl.clientWidth - pad) / state.sourceCanvas.width,\n (state.stageEl.clientHeight - pad) / state.sourceCanvas.height,\n 1\n )\n state.fitScale = fitScale\n const scale = fitScale * state.zoom\n state.viewScale = scale\n const w = Math.round(state.sourceCanvas.width * scale),\n h = Math.round(state.sourceCanvas.height * scale)\n state.canvasEl.style.width = state.overlayEl.style.width = w + 'px'\n state.canvasEl.style.height = state.overlayEl.style.height = h + 'px'\n}\n\nexport function applyZoom(state, zoom) {\n state.zoom = Math.min(ZOOM_MAX, Math.max(ZOOM_MIN, zoom))\n if (!state.mounted || !state.sourceCanvas.width) {\n state.notify()\n return\n }\n fitStage(state)\n renderOverlay(state)\n state.notify()\n}\n\nexport function zoomIn(state) {\n applyZoom(state, state.zoom * ZOOM_STEP)\n}\n\nexport function zoomOut(state) {\n applyZoom(state, state.zoom / ZOOM_STEP)\n}\n\nexport function zoomToFit(state) {\n applyZoom(state, 1)\n}\n\nexport function syncCanvasSize(state) {\n state.canvasEl.width = state.overlayEl.width = state.sourceCanvas.width\n state.canvasEl.height = state.overlayEl.height = state.sourceCanvas.height\n fitStage(state)\n}\n\nexport function renderBase(state) {\n const { ctx, canvasEl, sourceCanvas } = state\n ctx.clearRect(0, 0, canvasEl.width, canvasEl.height)\n const filter = baseFilter(state)\n\n if (supportsContextFilter()) {\n canvasEl.style.filter = ''\n ctx.filter = filter\n ctx.drawImage(sourceCanvas, 0, 0)\n ctx.filter = 'none'\n return\n }\n\n canvasEl.style.filter = filter\n ctx.drawImage(sourceCanvas, 0, 0)\n}\n\nexport function render(state) {\n if (!state.mounted || !state.sourceCanvas.width) return\n renderBase(state)\n renderOverlay(state)\n}\n\nexport const TEXT_LINE_HEIGHT = 1.1\n\nexport function wrapTextLines(state, L) {\n state.octx.font = `${L.size}px ${L.font}`\n const maxWidth = Math.max(L.boxWidth, 1)\n const lines = []\n // Split on hard breaks first, then word-wrap each paragraph in the box.\n L.text.split('\\n').forEach((paragraph) => {\n const words = paragraph.split(' ')\n let current = ''\n words.forEach((word) => {\n const test = current ? current + ' ' + word : word\n if (current && state.octx.measureText(test).width > maxWidth) {\n lines.push(current)\n current = word\n } else {\n current = test\n }\n })\n lines.push(current)\n })\n return lines\n}\n\nexport function layerBounds(state, L) {\n if (L.type === 'text') {\n const lines = wrapTextLines(state, L)\n return {\n x: L.x,\n y: L.y,\n w: L.boxWidth,\n h: lines.length * L.size * TEXT_LINE_HEIGHT,\n }\n }\n if (L.type === 'shape' && isMultiPoint(L)) {\n // Bounds come from the points themselves, padded for stroke width so the\n // selection box doesn't clip a thick line.\n let a = Infinity,\n b = Infinity,\n cc = -Infinity,\n d = -Infinity\n L.points.forEach((pt) => {\n a = Math.min(a, pt.x)\n b = Math.min(b, pt.y)\n cc = Math.max(cc, pt.x)\n d = Math.max(d, pt.y)\n })\n const pad = (L.width || 6) / 2\n return { x: a - pad, y: b - pad, w: cc - a + pad * 2, h: d - b + pad * 2 }\n }\n if (L.type === 'shape' || L.type === 'sticker') {\n return {\n x: Math.min(L.x, L.x + L.w),\n y: Math.min(L.y, L.y + L.h),\n w: Math.abs(L.w),\n h: Math.abs(L.h),\n }\n }\n if (L.type === 'stroke') {\n let a = Infinity,\n b = Infinity,\n cc = -Infinity,\n d = -Infinity\n L.points.forEach((p) => {\n a = Math.min(a, p.x)\n b = Math.min(b, p.y)\n cc = Math.max(cc, p.x)\n d = Math.max(d, p.y)\n })\n const pad = L.width / 2\n return { x: a - pad, y: b - pad, w: cc - a + pad * 2, h: d - b + pad * 2 }\n }\n return { x: 0, y: 0, w: 0, h: 0 }\n}\n\nexport function clampTextSize(state, L) {\n if (L.type !== 'text') return\n const availH = state.sourceCanvas.height - L.y\n while (L.size > 10 && layerBounds(state, L).h > availH && availH > 0) {\n L.size -= 1\n }\n}\n\nexport function clampBoxWidth(state, L) {\n if (L.type !== 'text') return\n const availW = state.sourceCanvas.width - L.x\n L.boxWidth = Math.round(Math.max(20, Math.min(L.boxWidth, availW)))\n}\n\nexport function cornerPoints(b) {\n return [\n { corner: 'tl', x: b.x, y: b.y },\n { corner: 'tr', x: b.x + b.w, y: b.y },\n { corner: 'bl', x: b.x, y: b.y + b.h },\n { corner: 'br', x: b.x + b.w, y: b.y + b.h },\n ]\n}\n\nexport const DIRECTIONAL_SHAPES = [\n 'line',\n 'dashedLine',\n 'arrow',\n 'dashedArrow',\n 'doubleArrow',\n 'dashedDoubleArrow',\n]\n\nconst DASHED_SHAPES = ['dashedLine', 'dashedArrow', 'dashedDoubleArrow']\n\n// Only plain shafts can be chained into a multi-point path. Arrow variants are\n// excluded on purpose: a head belongs at the end of a direction, and a path\n// that turns corners has no single direction to point along.\nexport const MULTI_POINT_SHAPES = ['line', 'dashedLine']\n\n// Which ends of the shaft get an arrow head.\nconst ARROW_HEAD_ENDS = {\n arrow: ['end'],\n dashedArrow: ['end'],\n doubleArrow: ['end', 'start'],\n dashedDoubleArrow: ['end', 'start'],\n}\n\n// Label geometry: gap above the shaft, and how far text sits off the line.\nexport const LABEL_GAP = 10\nexport const DEFAULT_LABEL_SIZE = 42\n\n/**\n * Directional shapes are stored one of two ways:\n * - legacy / single segment: x, y, w, h (start -> start + w/h)\n * - multi-point: an absolute `points` array\n * Everything downstream reads through here so both shapes render, hit-test,\n * move and resize identically.\n */\nexport function directionalPoints(L) {\n if (L.points && L.points.length >= 2) return L.points\n return [\n { x: L.x, y: L.y },\n { x: L.x + L.w, y: L.y + L.h },\n ]\n}\n\nexport function isMultiPoint(L) {\n return !!(L.points && L.points.length >= 2)\n}\n\n// A point at fraction `t` (0..1) along the path by arc length, plus the angle\n// of the segment it lands on -- so a label can sit anywhere from start to end.\nexport function pathPointAt(pts, closed, t) {\n const seq = closed && pts.length > 2 ? pts.concat([pts[0]]) : pts\n let total = 0\n const segs = []\n for (let i = 0; i < seq.length - 1; i++) {\n const len = Math.hypot(seq[i + 1].x - seq[i].x, seq[i + 1].y - seq[i].y)\n segs.push(len)\n total += len\n }\n if (!total) return { x: seq[0].x, y: seq[0].y, angle: 0 }\n let want = total * Math.min(Math.max(t, 0), 1)\n for (let i = 0; i < segs.length; i++) {\n if (want <= segs[i] || i === segs.length - 1) {\n const f = segs[i] ? want / segs[i] : 0\n return {\n x: seq[i].x + (seq[i + 1].x - seq[i].x) * f,\n y: seq[i].y + (seq[i + 1].y - seq[i].y) * f,\n angle: Math.atan2(seq[i + 1].y - seq[i].y, seq[i + 1].x - seq[i].x),\n }\n }\n want -= segs[i]\n }\n return { x: seq[0].x, y: seq[0].y, angle: 0 }\n}\n\nexport function pathMidpoint(pts, closed) {\n return pathPointAt(pts, closed, 0.5)\n}\n\n/**\n * Draws a shape's label relative to its shaft.\n * labelSide 'above' | 'below' -- which side of the line\n * labelOffset px clear of the shaft\n * labelPos 0..1 along the path (0 = start, 1 = end)\n * labelRotate follow the line angle, or stay horizontal\n * When following the line, text past +/-90 degrees is flipped so it never\n * reads mirrored, and the perpendicular offset flips with it to match.\n */\nfunction drawShapeLabel(c, L, pts) {\n if (!L.label) return\n const size = L.labelSize || DEFAULT_LABEL_SIZE\n const at = pathPointAt(pts, L.closed, L.labelPos ?? 0.5)\n const follow = L.labelRotate !== false\n const side = L.labelSide === 'below' ? -1 : 1\n const gap = L.labelOffset ?? LABEL_GAP\n const off = (L.width || 6) / 2 + gap\n\n let ang = follow ? at.angle : 0\n let flip = false\n if (follow && (ang > Math.PI / 2 || ang < -Math.PI / 2)) {\n ang += Math.PI\n flip = true\n }\n // Perpendicular to the shaft, pushed to the requested side.\n const dir = side * (flip ? -1 : 1)\n const nx = Math.sin(at.angle) * off * dir\n const ny = -Math.cos(at.angle) * off * dir\n\n c.save()\n c.translate(at.x + nx, at.y + ny)\n c.rotate(ang)\n c.font = `${size}px ${L.labelFont || 'Avenir Next, Segoe UI, sans-serif'}`\n c.fillStyle = L.labelColor || L.color\n c.textAlign = 'center'\n // 'below' hangs the text under the line, so its top edge is the anchor.\n c.textBaseline = side === 1 ? 'bottom' : 'top'\n c.setLineDash([])\n c.shadowColor = 'rgba(0,0,0,.25)'\n c.shadowBlur = size * 0.08\n c.fillText(L.label, 0, 0)\n c.restore()\n}\n\n// Dash and gap scale with stroke width; the floors keep hairlines visible.\nfunction dashedLineDash(width) {\n const w = Math.max(1, width || 1)\n return [Math.max(6, w * 2.5), Math.max(4, w * 1.75)]\n}\n\nfunction drawArrowHead(c, tipX, tipY, ang, head) {\n c.beginPath()\n c.moveTo(tipX, tipY)\n c.lineTo(\n tipX - head * Math.cos(ang - Math.PI / 6),\n tipY - head * Math.sin(ang - Math.PI / 6)\n )\n c.moveTo(tipX, tipY)\n c.lineTo(\n tipX - head * Math.cos(ang + Math.PI / 6),\n tipY - head * Math.sin(ang + Math.PI / 6)\n )\n c.stroke()\n}\n\n/**\n * Draws a label centred inside a closed shape (rect / ellipse / circle, or a\n * closed multi-point path). Wraps on spaces to stay within the shape's width.\n * Shares the same `label` field as line labels, so one control drives both.\n */\nfunction drawCenteredLabel(c, L, b) {\n if (!L.label) return\n const size = L.labelSize || DEFAULT_LABEL_SIZE\n c.save()\n c.font = `${size}px ${L.labelFont || 'Avenir Next, Segoe UI, sans-serif'}`\n c.fillStyle = L.labelColor || pickReadableInk(L)\n c.textAlign = 'center'\n c.textBaseline = 'middle'\n c.setLineDash([])\n const maxW = Math.max(20, Math.abs(b.w) - size * 0.6)\n const lines = []\n let line = ''\n L.label.split(/\\s+/).forEach((word) => {\n const next = line ? line + ' ' + word : word\n if (c.measureText(next).width > maxW && line) {\n lines.push(line)\n line = word\n } else line = next\n })\n if (line) lines.push(line)\n const lh = size * TEXT_LINE_HEIGHT\n // labelDx / labelDy nudge the block off-centre inside the shape.\n const cx = b.x + b.w / 2 + (L.labelDx || 0)\n const cy = b.y + b.h / 2 + (L.labelDy || 0) - ((lines.length - 1) * lh) / 2\n lines.forEach((ln, i) => c.fillText(ln, cx, cy + i * lh))\n c.restore()\n}\n\n// On a solid-filled shape the shape colour is the background, so default the\n// label to white or near-black depending on how dark that fill is.\nfunction pickReadableInk(L) {\n if (L.fill !== 'fill') return L.color\n const hex = (L.color || '#111111').replace('#', '')\n if (hex.length < 6) return '#ffffff'\n const r = parseInt(hex.slice(0, 2), 16),\n g = parseInt(hex.slice(2, 4), 16),\n b = parseInt(hex.slice(4, 6), 16)\n // Rec. 601 luma: matches how bright the fill actually looks.\n return 0.299 * r + 0.587 * g + 0.114 * b > 150 ? '#111111' : '#ffffff'\n}\n\nconst ROTATE_HANDLE_GAP = 26\nconst ROTATE_HANDLE_RADIUS = 6\n\nexport function layerCenter(state, L) {\n const b = layerBounds(state, L)\n return { x: b.x + b.w / 2, y: b.y + b.h / 2 }\n}\n\n// Canvas convention: y grows downward, so a positive angle turns clockwise.\nexport function rotatePoint(p, c, deg) {\n if (!deg) return { x: p.x, y: p.y }\n const rad = (deg * Math.PI) / 180\n const cos = Math.cos(rad),\n sin = Math.sin(rad)\n const dx = p.x - c.x,\n dy = p.y - c.y\n return { x: c.x + dx * cos - dy * sin, y: c.y + dx * sin + dy * cos }\n}\n\n// Resize without swinging a rotated layer: `local` stays put on screen.\nexport function keepingFixed(state, L, local, mutate) {\n const rot = L.rotation || 0\n if (!rot) {\n mutate()\n return\n }\n const before = rotatePoint(local, layerCenter(state, L), rot)\n mutate()\n const after = rotatePoint(local, layerCenter(state, L), rot)\n L.x += before.x - after.x\n L.y += before.y - after.y\n}\n\n// A pointer in the layer's own unrotated frame, where x/y/w/h are stored.\nexport function toLayerSpace(state, L, p) {\n return rotatePoint(p, layerCenter(state, L), -(L.rotation || 0))\n}\n\n// Local frame; the overlay's transform is what makes the grip orbit.\nfunction rotateHandleLocalPoint(state, L) {\n const b = layerBounds(state, L)\n return {\n x: b.x + b.w / 2,\n y: b.y + b.h + ROTATE_HANDLE_GAP / state.viewScale,\n }\n}\n\nfunction rotateHandlePoint(state, L) {\n const local = rotateHandleLocalPoint(state, L)\n return rotatePoint(local, layerCenter(state, L), L.rotation || 0)\n}\n\nexport function onRotateHandle(state, p, L) {\n const rp = rotateHandlePoint(state, L)\n return Math.hypot(p.x - rp.x, p.y - rp.y) <= 14 / state.viewScale\n}\n\nexport function onResizeHandle(state, p, L) {\n if (L.type === 'stroke') return null\n const hs = 12 / state.viewScale\n const q = toLayerSpace(state, L, p)\n if (L.type === 'shape' && DIRECTIONAL_SHAPES.includes(L.shape)) {\n const ends = [\n { corner: 'start', x: L.x, y: L.y },\n { corner: 'end', x: L.x + L.w, y: L.y + L.h },\n ]\n const hit = ends.find(\n (ep) => Math.abs(q.x - ep.x) < hs && Math.abs(q.y - ep.y) < hs\n )\n return hit ? hit.corner : null\n }\n const b = layerBounds(state, L)\n const hit = cornerPoints(b).find(\n (cp) => Math.abs(q.x - cp.x) < hs && Math.abs(q.y - cp.y) < hs\n )\n return hit ? hit.corner : null\n}\n\nexport function paintLayer(state, c, L) {\n if (L._editing) return\n c.save()\n // Strokes only need the transform once they carry a rotation.\n if (L.type !== 'stroke' || L.rotation) {\n const b = layerBounds(state, L)\n const cx = b.x + b.w / 2,\n cy = b.y + b.h / 2\n c.translate(cx, cy)\n if (L.rotation) c.rotate((L.rotation * Math.PI) / 180)\n if (L.flipH || L.flipV) c.scale(L.flipH ? -1 : 1, L.flipV ? -1 : 1)\n c.translate(-cx, -cy)\n }\n if (L.type === 'text') {\n c.font = `${L.size}px ${L.font}`\n c.fillStyle = L.color\n c.textBaseline = 'top'\n c.shadowColor = 'rgba(0,0,0,.22)'\n c.shadowBlur = L.size * 0.05\n c.shadowOffsetY = L.size * 0.02\n const lineHeight = L.size * TEXT_LINE_HEIGHT\n wrapTextLines(state, L).forEach((line, i) => {\n c.fillText(line, L.x, L.y + i * lineHeight)\n })\n } else if (L.type === 'shape') {\n c.strokeStyle = L.color\n c.fillStyle = L.color\n c.lineWidth = L.width\n c.lineCap = 'round'\n c.lineJoin = 'round'\n const x = L.x,\n y = L.y,\n w = L.w,\n h = L.h\n const closedBox = { x, y, w, h }\n if (L.shape === 'rect') {\n L.fill === 'fill' ? c.fillRect(x, y, w, h) : c.strokeRect(x, y, w, h)\n drawCenteredLabel(c, L, closedBox)\n } else if (L.shape === 'ellipse') {\n c.beginPath()\n c.ellipse(\n x + w / 2,\n y + h / 2,\n Math.abs(w / 2),\n Math.abs(h / 2),\n 0,\n 0,\n Math.PI * 2\n )\n L.fill === 'fill' ? c.fill() : c.stroke()\n drawCenteredLabel(c, L, closedBox)\n } else if (L.shape === 'circle') {\n const r = Math.min(Math.abs(w), Math.abs(h)) / 2\n c.beginPath()\n c.arc(x + w / 2, y + h / 2, r, 0, Math.PI * 2)\n L.fill === 'fill' ? c.fill() : c.stroke()\n drawCenteredLabel(c, L, {\n x: x + w / 2 - r,\n y: y + h / 2 - r,\n w: r * 2,\n h: r * 2,\n })\n } else if (DIRECTIONAL_SHAPES.includes(L.shape)) {\n const pts = directionalPoints(L)\n const dashed = DASHED_SHAPES.includes(L.shape)\n if (dashed) {\n // Butt caps keep dashes crisp; round caps bleed into the gaps.\n c.lineCap = 'butt'\n c.setLineDash(dashedLineDash(L.width))\n }\n c.beginPath()\n pts.forEach((pt, i) =>\n i === 0 ? c.moveTo(pt.x, pt.y) : c.lineTo(pt.x, pt.y)\n )\n if (L.closed && pts.length > 2) c.closePath()\n // A closed multi-point path can be filled like any other shape.\n if (L.closed && pts.length > 2 && L.fill === 'fill') {\n c.setLineDash([])\n c.fill()\n }\n c.stroke()\n if (dashed) {\n // Heads draw solid: a dash pattern would fragment them into stubs.\n c.setLineDash([])\n c.lineCap = 'round'\n }\n // Heads sit on the outermost segments so they point the way the path goes.\n if (!L.closed) {\n const head = Math.max(14, L.width * 3)\n const a = pts[0],\n b2 = pts[1],\n y2 = pts[pts.length - 2],\n z = pts[pts.length - 1]\n const endAng = Math.atan2(z.y - y2.y, z.x - y2.x)\n const startAng = Math.atan2(a.y - b2.y, a.x - b2.x)\n ;(ARROW_HEAD_ENDS[L.shape] || []).forEach((which) => {\n if (which === 'end') drawArrowHead(c, z.x, z.y, endAng, head)\n else drawArrowHead(c, a.x, a.y, startAng, head)\n })\n }\n if (L.closed && pts.length > 2) {\n drawCenteredLabel(c, L, layerBounds(state, L))\n } else {\n drawShapeLabel(c, L, pts)\n }\n }\n } else if (L.type === 'stroke') {\n c.strokeStyle = L.color\n c.lineWidth = L.width\n c.lineCap = 'round'\n c.lineJoin = 'round'\n c.globalAlpha = L.style === 'highlight' ? 0.35 : 1\n c.beginPath()\n L.points.forEach((pt, i) =>\n i === 0 ? c.moveTo(pt.x, pt.y) : c.lineTo(pt.x, pt.y)\n )\n if (L.points.length === 1)\n c.lineTo(L.points[0].x + 0.1, L.points[0].y + 0.1)\n c.stroke()\n } else if (L.type === 'sticker') {\n const img = state.stickerImageCache.get(L.src)\n if (img && img.complete && img.naturalWidth)\n c.drawImage(img, L.x, L.y, L.w, L.h)\n }\n c.restore()\n}\n\nexport function normRect(r) {\n return {\n x: Math.min(r.x, r.x + r.w),\n y: Math.min(r.y, r.y + r.h),\n w: Math.abs(r.w),\n h: Math.abs(r.h),\n }\n}\n\nexport function drawCropOverlay(state) {\n const { cropRect, overlayEl, octx, sourceCanvas } = state\n if (!cropRect) return\n const r = normRect(cropRect)\n const W = overlayEl.width,\n H = overlayEl.height\n octx.save()\n octx.fillStyle = 'rgba(0,0,0,.45)'\n octx.fillRect(0, 0, W, Math.max(0, r.y))\n octx.fillRect(0, Math.min(H, r.y + r.h), W, Math.max(0, H - (r.y + r.h)))\n octx.fillRect(0, r.y, Math.max(0, r.x), r.h)\n octx.fillRect(Math.min(W, r.x + r.w), r.y, Math.max(0, W - (r.x + r.w)), r.h)\n octx.strokeStyle = '#fff'\n octx.lineWidth = Math.max(1, sourceCanvas.width / 500)\n octx.setLineDash([8, 6])\n octx.strokeRect(r.x, r.y, r.w, r.h)\n octx.restore()\n}\n\nexport function renderOverlay(state) {\n const { octx, overlayEl, layers, mode, selectedId } = state\n octx.clearRect(0, 0, overlayEl.width, overlayEl.height)\n layers.forEach((L) => {\n try {\n paintLayer(state, octx, L)\n } catch (err) {\n // eslint-disable-next-line no-console\n console.error('[image-editor] failed to paint layer', L.id, L.type, err)\n }\n })\n if (mode === 'select' && selectedId != null) {\n const L = layers.find((l) => l.id === selectedId)\n if (L) {\n const b = layerBounds(state, L)\n octx.save()\n // The layer's frame, so box, handles and grip all tilt with it.\n if (L.rotation) {\n const c = layerCenter(state, L)\n octx.translate(c.x, c.y)\n octx.rotate((L.rotation * Math.PI) / 180)\n octx.translate(-c.x, -c.y)\n }\n octx.strokeStyle = '#2f5fd2'\n octx.lineWidth = Math.max(1.2, 1.5 / state.viewScale)\n octx.setLineDash([6 / state.viewScale, 4 / state.viewScale])\n octx.strokeRect(b.x - 4, b.y - 4, b.w + 8, b.h + 8)\n octx.setLineDash([])\n if (L.type !== 'stroke') {\n const hs = 9 / state.viewScale\n octx.fillStyle = '#fff'\n octx.strokeStyle = '#2f5fd2'\n const handlePoints =\n L.type === 'shape' && DIRECTIONAL_SHAPES.includes(L.shape)\n ? [\n { x: L.x, y: L.y },\n { x: L.x + L.w, y: L.y + L.h },\n ]\n : cornerPoints(b)\n handlePoints.forEach((cp) => {\n octx.fillRect(cp.x - hs / 2, cp.y - hs / 2, hs, hs)\n octx.strokeRect(cp.x - hs / 2, cp.y - hs / 2, hs, hs)\n })\n }\n // Rotate grip: every layer type gets one, strokes included.\n const rp = rotateHandleLocalPoint(state, L)\n octx.strokeStyle = '#2f5fd2'\n octx.fillStyle = '#fff'\n octx.beginPath()\n octx.moveTo(rp.x, b.y + b.h + 4)\n octx.lineTo(rp.x, rp.y)\n octx.stroke()\n octx.beginPath()\n octx.arc(\n rp.x,\n rp.y,\n ROTATE_HANDLE_RADIUS / state.viewScale,\n 0,\n Math.PI * 2\n )\n octx.fill()\n octx.stroke()\n octx.restore()\n }\n }\n if (state.pendingShape) paintLayer(state, octx, state.pendingShape)\n if (mode === 'crop' && state.cropRect) drawCropOverlay(state)\n}\n"],"names":["baseFilter","state","adj","f","FILTER_CSS","ZOOM_MIN","ZOOM_MAX","ZOOM_STEP","fitStage","fitScale","scale","w","h","applyZoom","zoom","renderOverlay","zoomIn","zoomOut","zoomToFit","syncCanvasSize","renderBase","ctx","canvasEl","sourceCanvas","filter","supportsContextFilter","render","TEXT_LINE_HEIGHT","wrapTextLines","L","maxWidth","lines","paragraph","words","current","word","test","layerBounds","isMultiPoint","a","b","cc","d","pt","pad","p","clampTextSize","availH","clampBoxWidth","availW","cornerPoints","DIRECTIONAL_SHAPES","DASHED_SHAPES","MULTI_POINT_SHAPES","ARROW_HEAD_ENDS","LABEL_GAP","DEFAULT_LABEL_SIZE","directionalPoints","pathPointAt","pts","closed","t","seq","total","segs","i","len","want","drawShapeLabel","c","size","at","follow","side","gap","off","ang","flip","dir","nx","ny","dashedLineDash","width","drawArrowHead","tipX","tipY","head","drawCenteredLabel","pickReadableInk","maxW","line","next","lh","cx","cy","ln","hex","r","g","ROTATE_HANDLE_GAP","ROTATE_HANDLE_RADIUS","layerCenter","rotatePoint","deg","rad","cos","sin","dx","dy","keepingFixed","local","mutate","rot","before","after","toLayerSpace","rotateHandleLocalPoint","rotateHandlePoint","onRotateHandle","rp","onResizeHandle","hs","q","hit","ep","cp","paintLayer","lineHeight","x","y","closedBox","dashed","b2","y2","z","endAng","startAng","which","img","normRect","drawCropOverlay","cropRect","overlayEl","octx","W","H","layers","mode","selectedId","err"],"mappings":";;AAGO,SAASA,EAAWC,GAAO;AAChC,QAAM,EAAE,KAAAC,EAAG,IAAKD;AAChB,MAAIE,IAAI,cAAcD,EAAI,UAAU,eAAeA,EAAI,QAAQ,eAAeA,EAAI,QAAQ,YAAYA,EAAI,KAAK,WAAWA,EAAI,IAAI,kBAAkBA,EAAI,GAAG;AAC3J,SAAIA,EAAI,WAAW,WAAQC,KAAK,MAAMC,EAAWF,EAAI,MAAM,IACpDC,EAAE,KAAI;AACf;AAEY,MAACE,IAAW,MACXC,IAAW,GAClBC,IAAY;AAEX,SAASC,EAASP,GAAO;AAE9B,QAAMQ,IAAW,KAAK;AAAA,KACnBR,EAAM,QAAQ,cAAc,MAAOA,EAAM,aAAa;AAAA,KACtDA,EAAM,QAAQ,eAAe,MAAOA,EAAM,aAAa;AAAA,IACxD;A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