@algorisys/yappydraw 0.8.295 → 0.8.297
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/chunks/anim-map-D7T1mIAM.js +111 -0
- package/chunks/{canva-ai-kg789_jz.js → canva-ai-cwK_LwEk.js} +1 -1
- package/chunks/{choice-dialog-state-ByeMPVwB.js → choice-dialog-state-CF9ddIAk.js} +1 -1
- package/chunks/{custgeom-CEAI2znd.js → custgeom-N1NlyQKZ.js} +1 -1
- package/chunks/{design-generator-zF-F-iCB.js → design-generator-DSEgwQ7i.js} +1 -1
- package/chunks/{drawing-engine-U5zBcwtj.js → drawing-engine-CPFaJPyz.js} +1 -1
- package/chunks/{drawings-store-CZSZCNqP.js → drawings-store-CxGNbTN7.js} +1 -1
- package/chunks/{ds-operations-_c-HiYjk.js → ds-operations-BTcGLr6X.js} +1 -1
- package/chunks/{export-game-CgMvNkoa.js → export-game-BVjxTYD1.js} +1 -1
- package/chunks/{from-yappy-Dd2p9P6N.js → from-yappy-kTebD-0Y.js} +271 -239
- package/chunks/{game-runtime-CH3yVPDc.js → game-runtime-Ch0y0mLm.js} +27 -27
- package/chunks/{import-C3P7glRz.js → import-eCGTFoVi.js} +711 -623
- package/chunks/{index-B_V19zDs.js → index-zg1eC33A.js} +23253 -23073
- package/chunks/{lucide-solid-DfQVDBtM.js → lucide-solid-DAmszm-d.js} +1 -1
- package/chunks/{markdown-to-slides-B5OASdqg.js → markdown-to-slides-CGvmGrK2.js} +1 -1
- package/chunks/{morph-animator-b1aFWI5O.js → morph-animator-BQPPQ08b.js} +1 -1
- package/chunks/{onboarding-tour-j-RhQYNM.js → onboarding-tour-CpRCV3Ub.js} +1 -1
- package/chunks/{pdf-vector-CzrRoyPR.js → pdf-vector-D65OC03c.js} +1 -1
- package/chunks/{search-B7AUhYCm.js → search-rp-eRNJ6.js} +2 -2
- package/chunks/{slide-generator-AO60zi1f.js → slide-generator-Ctxdc9Yn.js} +5 -5
- package/chunks/{turntable-ai-DddsPGTo.js → turntable-ai-ZhAGEjzz.js} +1 -1
- package/chunks/write-ZW6FSyj1.js +327 -0
- package/package.json +1 -1
- package/yappy.js +1 -1
- package/chunks/write-uweO04Cm.js +0 -265
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { a1 as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { a1 as rt, a2 as mt, a3 as xt, a4 as gt, a5 as yt, a6 as kt, a7 as bt, a8 as Mt, a9 as wt, aa as G, ab as vt, ac as St, ad as At, ae as $t, af as It, ag as Ct, ah as Tt, ai as Ft, aj as Pt, ak as zt, al as Lt, am as Et } from "./index-zg1eC33A.js";
|
|
2
|
+
import { t as Ot } from "./anim-map-D7T1mIAM.js";
|
|
3
|
+
import { d as z, g as j, t as C, h as Rt } from "./custgeom-N1NlyQKZ.js";
|
|
4
|
+
function Xt(t) {
|
|
5
|
+
const { l: n, c: e, h: r } = t, i = r * Math.PI / 180, o = e * Math.cos(i), l = e * Math.sin(i), f = n + 0.3963377774 * o + 0.2158037573 * l, a = n - 0.1055613458 * o - 0.0638541728 * l, s = n - 0.0894841775 * o - 1.291485548 * l, c = f * f * f, u = a * a * a, h = s * s * s, p = 1.2270138511 * c - 0.5577999807 * u + 0.2812561489 * h, d = -0.0405801784 * c + 1.1122568696 * u - 0.0716766787 * h, x = -0.0763812845 * c - 0.4214819787 * u + 1.5861632204 * h, g = 2.4039459 * p - 0.9898517 * d - 0.4141151 * x, k = -0.7797967 * p + 1.5445214 * d + 0.0352745 * x, m = 0.0384795 * p - 0.1141381 * d + 1.0756786 * x, y = (b) => {
|
|
5
6
|
const M = Math.abs(b), w = M > 31308e-7 ? 1.055 * Math.pow(M, 1 / 2.4) - 0.055 : 12.92 * M;
|
|
6
7
|
return b < 0 ? -w : w;
|
|
7
8
|
};
|
|
@@ -27,7 +28,7 @@ function V(t, n, e) {
|
|
|
27
28
|
b: R(-0.019637554590334 * r - 0.07863604555063188 * i + 1.0982736001409656 * o)
|
|
28
29
|
};
|
|
29
30
|
}
|
|
30
|
-
function
|
|
31
|
+
function Dt(t) {
|
|
31
32
|
return t.endsWith("%") ? parseFloat(t) / 100 : parseFloat(t);
|
|
32
33
|
}
|
|
33
34
|
function T(t) {
|
|
@@ -40,27 +41,27 @@ function T(t) {
|
|
|
40
41
|
}
|
|
41
42
|
const e = (o) => Math.round(Math.max(0, Math.min(1, o)) * 255), r = n.match(/^color\(\s*(display-p3|srgb)\s+([^/)]+?)\s*(?:\/[^)]*)?\)$/);
|
|
42
43
|
if (r) {
|
|
43
|
-
const o = r[2].split(/[\s,]+/).filter(Boolean).map(
|
|
44
|
+
const o = r[2].split(/[\s,]+/).filter(Boolean).map(Dt);
|
|
44
45
|
if (o.length < 3 || o.some((c) => !isFinite(c))) return null;
|
|
45
|
-
const [l, f,
|
|
46
|
-
if (r[1] === "srgb") return [e(l), e(f), e(
|
|
47
|
-
const
|
|
48
|
-
return [e(
|
|
46
|
+
const [l, f, a] = o;
|
|
47
|
+
if (r[1] === "srgb") return [e(l), e(f), e(a)];
|
|
48
|
+
const s = V(l, f, a);
|
|
49
|
+
return [e(s.r), e(s.g), e(s.b)];
|
|
49
50
|
}
|
|
50
51
|
const i = n.match(/^oklch\(\s*([^/)]+?)\s*(?:\/[^)]*)?\)$/);
|
|
51
52
|
if (i) {
|
|
52
53
|
const o = i[1].split(/[\s,]+/).filter(Boolean);
|
|
53
54
|
if (o.length < 3) return null;
|
|
54
|
-
const l = o[0].endsWith("%") ? parseFloat(o[0]) / 100 : parseFloat(o[0]), f = parseFloat(o[1]),
|
|
55
|
-
if (![l, f,
|
|
56
|
-
const
|
|
57
|
-
return [e(
|
|
55
|
+
const l = o[0].endsWith("%") ? parseFloat(o[0]) / 100 : parseFloat(o[0]), f = parseFloat(o[1]), a = parseFloat(o[2]);
|
|
56
|
+
if (![l, f, a].every(isFinite)) return null;
|
|
57
|
+
const s = V(...(({ r: c, g: u, b: h }) => [c, u, h])(Xt({ l, c: f, h: a })));
|
|
58
|
+
return [e(s.r), e(s.g), e(s.b)];
|
|
58
59
|
}
|
|
59
|
-
return
|
|
60
|
+
return Bt(n);
|
|
60
61
|
}
|
|
61
62
|
const F = /* @__PURE__ */ new Map();
|
|
62
63
|
let $;
|
|
63
|
-
function
|
|
64
|
+
function Bt(t) {
|
|
64
65
|
if (F.has(t)) return F.get(t);
|
|
65
66
|
let n = null;
|
|
66
67
|
try {
|
|
@@ -79,7 +80,7 @@ function Rt(t) {
|
|
|
79
80
|
return F.size < 512 && F.set(t, n), n;
|
|
80
81
|
}
|
|
81
82
|
const L = (t) => "#" + t.map((n) => n.toString(16).padStart(2, "0")).join("");
|
|
82
|
-
function
|
|
83
|
+
function Yt(t) {
|
|
83
84
|
const n = t.trim().toLowerCase(), e = n.match(/^#([0-9a-f]{8})$/);
|
|
84
85
|
if (e) return parseInt(e[1].slice(6), 16) / 255;
|
|
85
86
|
const r = n.match(/^#([0-9a-f]{4})$/);
|
|
@@ -100,10 +101,10 @@ function S(t, n = 1) {
|
|
|
100
101
|
if (!t) return null;
|
|
101
102
|
const e = T(t);
|
|
102
103
|
if (!e) return null;
|
|
103
|
-
const r =
|
|
104
|
+
const r = Yt(t) * n;
|
|
104
105
|
return r <= 0 ? null : r < 0.999 ? { hex: L(e), alpha: r } : { hex: L(e) };
|
|
105
106
|
}
|
|
106
|
-
const
|
|
107
|
+
const ot = (t) => mt(t).split(",")[0].trim().replace(/^['"]|['"]$/g, "") || "Calibri", Y = {
|
|
107
108
|
hachure: "ltUpDiag",
|
|
108
109
|
zigzag: "ltUpDiag",
|
|
109
110
|
"zigzag-line": "ltUpDiag",
|
|
@@ -111,7 +112,7 @@ const rt = (t) => pt(t).split(",")[0].trim().replace(/^['"]|['"]$/g, "") || "Cal
|
|
|
111
112
|
"cross-hatch": "diagCross",
|
|
112
113
|
dots: "pct20"
|
|
113
114
|
};
|
|
114
|
-
function
|
|
115
|
+
function Wt(t, n) {
|
|
115
116
|
const e = t.fillStyle || "solid";
|
|
116
117
|
if ((e === "linear" || e === "radial" || e === "conic") && (t.gradientStops?.length ?? 0) > 0) {
|
|
117
118
|
const i = t.gradientStops.map((o) => ({ pos: Math.max(0, Math.min(1, o.offset)), color: S(o.color, n) ?? { hex: "#000000", alpha: 0 } }));
|
|
@@ -120,7 +121,7 @@ function Bt(t, n) {
|
|
|
120
121
|
const r = S(t.backgroundColor, n);
|
|
121
122
|
return r ? Y[e] ? { kind: "pattern", preset: Y[e], color: r } : { kind: "solid", color: r } : { kind: "none" };
|
|
122
123
|
}
|
|
123
|
-
function
|
|
124
|
+
function it(t) {
|
|
124
125
|
if (t.strokeStyle === "dotted") return "sysDot";
|
|
125
126
|
if (t.strokeStyle === "dashed") return "dash";
|
|
126
127
|
if (Array.isArray(t.strokeDashArray) && t.strokeDashArray.length >= 2) {
|
|
@@ -135,7 +136,7 @@ function N(t, n, e = !1) {
|
|
|
135
136
|
return {
|
|
136
137
|
width: t.strokeWidth,
|
|
137
138
|
color: r,
|
|
138
|
-
dash:
|
|
139
|
+
dash: it(t),
|
|
139
140
|
cap: e ? i : void 0,
|
|
140
141
|
join: t.strokeLineJoin === "miter" ? "miter" : t.strokeLineJoin === "bevel" ? "bevel" : "round"
|
|
141
142
|
};
|
|
@@ -145,133 +146,133 @@ function J(t, n, e) {
|
|
|
145
146
|
const r = n / Math.max(e, 0.5), i = r <= 2.5 ? "sm" : r <= 4 ? "med" : "lg";
|
|
146
147
|
return { type: t === "triangle" ? "triangle" : t === "dot" || t === "circle" ? "oval" : t === "diamond" || t === "diamondFilled" ? "diamond" : "arrow", size: i };
|
|
147
148
|
}
|
|
148
|
-
const U = (t, n) => t === "center" ? "ctr" : t === "right" ? "r" : t === "left" ? "l" : n,
|
|
149
|
-
function
|
|
149
|
+
const U = (t, n) => t === "center" ? "ctr" : t === "right" ? "r" : t === "left" ? "l" : n, st = (t) => t === "top" ? "t" : t === "bottom" ? "b" : "ctr";
|
|
150
|
+
function at(t, n) {
|
|
150
151
|
return t.split(`
|
|
151
152
|
`).map((e) => ({ runs: e ? [{ text: e }] : [], align: n }));
|
|
152
153
|
}
|
|
153
|
-
function
|
|
154
|
+
function Ht(t) {
|
|
154
155
|
const n = { "lower-alpha": "alphaLc", "upper-alpha": "alphaUc", "lower-roman": "romanLc", "upper-roman": "romanUc" }[t.listNumberStyle ?? ""] ?? "arabic", e = { paren: "ParenR", parens: "ParenBoth", none: "Plain" }[t.listNumberSuffix ?? ""] ?? "Period";
|
|
155
156
|
return n + e;
|
|
156
157
|
}
|
|
157
158
|
let I;
|
|
158
|
-
function
|
|
159
|
+
function jt(t, n) {
|
|
159
160
|
if (I === void 0 && (I = typeof document < "u" ? document.createElement("canvas").getContext("2d") : null), I)
|
|
160
161
|
return I.font = n, I.measureText(t).width;
|
|
161
162
|
const e = Number(/(\d+(?:\.\d+)?)px/.exec(n)?.[1] ?? 16);
|
|
162
163
|
return t.length * e * 0.6;
|
|
163
164
|
}
|
|
164
|
-
function
|
|
165
|
+
function Nt(t, n, e, r) {
|
|
165
166
|
const i = t.listLevel || 0, o = { bullet: t.listType === "ordered" ? "num" : "char", level: i };
|
|
166
167
|
if (o.bullet === "num") {
|
|
167
|
-
const
|
|
168
|
-
|
|
168
|
+
const a = Ht(t);
|
|
169
|
+
a !== "arabicPeriod" && (o.numType = a), !(e && e.level === i && e.scheme === a && (t.listIndex || 1) === e.index + 1) && (t.listIndex || 1) > 1 && (o.startAt = t.listIndex);
|
|
169
170
|
} else t.listMarker && t.listMarker !== "•" && (o.bulletChar = t.listMarker);
|
|
170
171
|
if (t.listMarkerColor) {
|
|
171
|
-
const
|
|
172
|
-
|
|
172
|
+
const a = S(t.listMarkerColor, n);
|
|
173
|
+
a && (o.bulletColor = a);
|
|
173
174
|
}
|
|
174
175
|
t.listMarkerScale && t.listMarkerScale !== 1 && (o.bulletScale = t.listMarkerScale);
|
|
175
|
-
const l =
|
|
176
|
+
const l = Et(t), f = r(t);
|
|
176
177
|
return o.marL = f, o.indent = l - f, o;
|
|
177
178
|
}
|
|
178
|
-
function
|
|
179
|
+
function ct(t, n, e, r) {
|
|
179
180
|
const i = [];
|
|
180
181
|
let o = { runs: [], align: n }, l = !1, f = null;
|
|
181
|
-
const
|
|
182
|
+
const a = zt(jt, t, r), s = () => {
|
|
182
183
|
i.push(o), o = { runs: [], align: n }, l = !1;
|
|
183
184
|
};
|
|
184
185
|
for (const c of t)
|
|
185
186
|
String(c.text ?? "").split(`
|
|
186
|
-
`).forEach((
|
|
187
|
-
if (
|
|
188
|
-
l || (l = !0, c.paragraphSpaceBefore && (o.spaceBefore = c.paragraphSpaceBefore), c.paragraphAlign && (o.align = U(c.paragraphAlign, n ?? "l")), c.listType && c.listType !== "none" && Object.assign(o,
|
|
189
|
-
const
|
|
190
|
-
if (c.bold && (
|
|
187
|
+
`).forEach((h, p) => {
|
|
188
|
+
if (p > 0 && s(), c.fontSize && !l && (o.endSize = c.fontSize), !h) return;
|
|
189
|
+
l || (l = !0, c.paragraphSpaceBefore && (o.spaceBefore = c.paragraphSpaceBefore), c.paragraphAlign && (o.align = U(c.paragraphAlign, n ?? "l")), c.listType && c.listType !== "none" && Object.assign(o, Nt(c, e, f, a)), f = o.bullet === "num" ? { level: o.level ?? 0, scheme: o.numType ?? "arabicPeriod", index: c.listIndex || 1 } : null);
|
|
190
|
+
const d = { text: h };
|
|
191
|
+
if (c.bold && (d.bold = !0), c.italic && (d.italic = !0), c.underline && (d.underline = !0), c.strikethrough && (d.strike = !0), c.color) {
|
|
191
192
|
const x = S(c.color, e);
|
|
192
|
-
x && (
|
|
193
|
+
x && (d.color = x);
|
|
193
194
|
}
|
|
194
|
-
c.fontSize && (
|
|
195
|
+
c.fontSize && (d.size = c.fontSize), c.fontFamily && (d.font = ot(c.fontFamily)), o.runs.push(d);
|
|
195
196
|
});
|
|
196
|
-
return
|
|
197
|
+
return s(), i;
|
|
197
198
|
}
|
|
198
|
-
function
|
|
199
|
+
function lt(t, n, e) {
|
|
199
200
|
const r = S(t.textColor || t.strokeColor || "#000000", n) ?? void 0;
|
|
200
201
|
return {
|
|
201
202
|
size: e,
|
|
202
203
|
color: r,
|
|
203
|
-
font:
|
|
204
|
-
bold:
|
|
205
|
-
italic:
|
|
204
|
+
font: ot(t.fontFamily),
|
|
205
|
+
bold: Tt(t.fontWeight) >= 600 ? !0 : void 0,
|
|
206
|
+
italic: Ct(t.fontStyle) === "italic" ? !0 : void 0
|
|
206
207
|
};
|
|
207
208
|
}
|
|
208
|
-
const
|
|
209
|
-
function
|
|
209
|
+
const ft = (t) => Ft(t) / Pt;
|
|
210
|
+
function Ut(t, n) {
|
|
210
211
|
const e = t.richText && t.richText.length > 0, r = U(t.textAlign, e ? "ctr" : "l");
|
|
211
212
|
return {
|
|
212
|
-
paragraphs: e ?
|
|
213
|
-
anchor:
|
|
213
|
+
paragraphs: e ? ct(t.richText, r, n, { fontSize: t.fontSize || 20, fontFamily: t.fontFamily || "sans-serif" }) : at(t.text || "", r),
|
|
214
|
+
anchor: st(t.verticalAlign),
|
|
214
215
|
insets: { l: 4, t: 4, r: 4, b: 4 },
|
|
215
216
|
wrap: !t.autoResize,
|
|
216
|
-
lineSpacing:
|
|
217
|
-
defaults:
|
|
217
|
+
lineSpacing: ft(t),
|
|
218
|
+
defaults: lt(t, n, t.fontSize || 20)
|
|
218
219
|
};
|
|
219
220
|
}
|
|
220
|
-
function
|
|
221
|
+
function ut(t, n) {
|
|
221
222
|
const e = t.richContainerText && t.richContainerText.length > 0;
|
|
222
223
|
if (!e && !t.containerText) return;
|
|
223
224
|
const r = U(t.textAlign, "ctr");
|
|
224
225
|
return {
|
|
225
|
-
paragraphs: e ?
|
|
226
|
-
anchor:
|
|
226
|
+
paragraphs: e ? ct(t.richContainerText, r, n, { fontSize: t.fontSize || 28, fontFamily: t.fontFamily || "hand-drawn" }) : at(t.containerText, r),
|
|
227
|
+
anchor: st(t.verticalAlign),
|
|
227
228
|
insets: { l: 10, t: 4, r: 10, b: 4 },
|
|
228
229
|
wrap: !0,
|
|
229
|
-
lineSpacing:
|
|
230
|
-
defaults:
|
|
230
|
+
lineSpacing: ft(t),
|
|
231
|
+
defaults: lt(t, n, t.fontSize || 16)
|
|
231
232
|
};
|
|
232
233
|
}
|
|
233
|
-
function
|
|
234
|
-
const r = [], i = Math.abs(n) / 2, o = Math.abs(e) / 2, l = (
|
|
235
|
-
const u = C(z(
|
|
234
|
+
function _t(t, n, e) {
|
|
235
|
+
const r = [], i = Math.abs(n) / 2, o = Math.abs(e) / 2, l = (a, s, c) => {
|
|
236
|
+
const u = C(z(a), i, o);
|
|
236
237
|
if (u.length === 0) return;
|
|
237
|
-
const
|
|
238
|
+
const h = s, p = { fill: h.noFill ? !1 : void 0, stroke: h.noStroke ? !1 : void 0 };
|
|
238
239
|
if (c) {
|
|
239
|
-
r.push({ cmds: u, ...
|
|
240
|
+
r.push({ cmds: u, ...p });
|
|
240
241
|
return;
|
|
241
242
|
}
|
|
242
|
-
let
|
|
243
|
+
let d = [];
|
|
243
244
|
for (const x of u)
|
|
244
|
-
x.op === "M" &&
|
|
245
|
-
|
|
246
|
-
}, f = (
|
|
247
|
-
const
|
|
248
|
-
switch (
|
|
245
|
+
x.op === "M" && d.length && (r.push({ cmds: d, ...p }), d = []), d.push(x);
|
|
246
|
+
d.length && r.push({ cmds: d, ...p });
|
|
247
|
+
}, f = (a) => {
|
|
248
|
+
const s = (c) => Math.round(c * 1e3) / 1e3;
|
|
249
|
+
switch (a.type) {
|
|
249
250
|
case "rect": {
|
|
250
|
-
const c = Math.min(Math.abs(
|
|
251
|
-
l(`M ${g + u} ${k} H ${g + m -
|
|
251
|
+
const c = Math.min(Math.abs(a.w), Math.abs(a.h)) / 2, [u, h, p, d] = (Array.isArray(a.r) ? a.r : [a.r || 0, a.r || 0, a.r || 0, a.r || 0]).map((b) => Math.max(0, Math.min(b || 0, c))), x = (b, M, w) => b ? ` A ${s(b)} ${s(b)} 0 0 1 ${s(M)} ${s(w)}` : "", { x: g, y: k } = a, m = a.w, y = a.h;
|
|
252
|
+
l(`M ${g + u} ${k} H ${g + m - h}${x(h, g + m, k + h)} V ${k + y - p}${x(p, g + m - p, k + y)} H ${g + d}${x(d, g, k + y - d)} V ${k + u}${x(u, g + u, k)} Z`, a, !1);
|
|
252
253
|
break;
|
|
253
254
|
}
|
|
254
255
|
case "ellipse":
|
|
255
|
-
l(`M ${
|
|
256
|
+
l(`M ${a.cx - a.rx} ${a.cy} A ${a.rx} ${a.ry} 0 1 0 ${a.cx + a.rx} ${a.cy} A ${a.rx} ${a.ry} 0 1 0 ${a.cx - a.rx} ${a.cy} Z`, a, !1);
|
|
256
257
|
break;
|
|
257
258
|
case "points":
|
|
258
|
-
|
|
259
|
+
a.points.length >= 2 && l(`M ${a.points.map((c) => `${c.x} ${c.y}`).join(" L ")}${a.isClosed !== !1 ? " Z" : ""}`, a, !1);
|
|
259
260
|
break;
|
|
260
261
|
case "path":
|
|
261
|
-
l(
|
|
262
|
+
l(a.path, a, !!a.evenOdd);
|
|
262
263
|
break;
|
|
263
264
|
case "multi":
|
|
264
|
-
|
|
265
|
+
a.shapes.forEach(f);
|
|
265
266
|
break;
|
|
266
267
|
}
|
|
267
268
|
};
|
|
268
269
|
return f(t), r;
|
|
269
270
|
}
|
|
270
|
-
function
|
|
271
|
+
function Zt(t) {
|
|
271
272
|
if (t.warp || t.points && t.points.length) return null;
|
|
272
273
|
if (t.type === "circle") return { kind: "preset", prst: "ellipse" };
|
|
273
274
|
if (t.type === "rectangle") {
|
|
274
|
-
const [n, e, r, i] =
|
|
275
|
+
const [n, e, r, i] = At(t);
|
|
275
276
|
if (!n && !e && !r && !i) return { kind: "preset", prst: "rect" };
|
|
276
277
|
if (n === e && e === r && r === i) {
|
|
277
278
|
const o = Math.min(Math.abs(t.width), Math.abs(t.height));
|
|
@@ -280,10 +281,10 @@ function Nt(t) {
|
|
|
280
281
|
}
|
|
281
282
|
return null;
|
|
282
283
|
}
|
|
283
|
-
const
|
|
284
|
-
function
|
|
284
|
+
const Gt = /* @__PURE__ */ new Set(["umlClass", "umlInterface", "qrCode", "video", "codeBlock"]), Vt = /* @__PURE__ */ new Set(["fineliner", "inkbrush", "marker", "ink"]), qt = /* @__PURE__ */ new Set(["text", "richtext", "image", "line", "arrow"]);
|
|
285
|
+
function Jt(t) {
|
|
285
286
|
const n = t;
|
|
286
|
-
if (
|
|
287
|
+
if (Gt.has(t.type) || t.clipMaskId || t.shadowEnabled || t.glowEnabled || (t.featherRadius ?? 0) > 0 || t.blendMode && t.blendMode !== "normal" || t.shearX || t.shearY || yt(t) || kt(t) || bt(t) || Mt(t) || t.appearance && (t.appearance.fills?.length ?? 0) + (t.appearance.strokes?.length ?? 0) > 0) return !0;
|
|
287
288
|
const e = t.fillStyle;
|
|
288
289
|
if (e === "image" || e === "mesh" || e === "pattern" || t.backgroundImage || t.curvedText || (t.type === "text" || t.type === "richtext") && (t.verticalText || (n.charTransforms?.length ?? 0) > 0)) return !0;
|
|
289
290
|
if (t.type === "image") {
|
|
@@ -310,7 +311,7 @@ function _(t) {
|
|
|
310
311
|
if (n && n.mime === "image/png") return { bytes: n.bytes, ext: "png" };
|
|
311
312
|
if (n && (n.mime === "image/jpeg" || n.mime === "image/jpg")) return { bytes: n.bytes, ext: "jpeg" };
|
|
312
313
|
if (n && n.mime === "image/gif") return { bytes: n.bytes, ext: "gif" };
|
|
313
|
-
const e =
|
|
314
|
+
const e = rt(t);
|
|
314
315
|
if (!e || !e.naturalWidth) return null;
|
|
315
316
|
try {
|
|
316
317
|
const r = document.createElement("canvas");
|
|
@@ -330,25 +331,25 @@ function W(t, n, e) {
|
|
|
330
331
|
const r = n.hooks.rasterize(t), i = r ? _(r.dataURL) : null;
|
|
331
332
|
return !r || !i ? [] : (n.report.pictures++, [{ kind: "picture", id: n.nextId++, name: e, x: r.x - n.ox, y: r.y - n.oy, w: r.width, h: r.height, media: i }]);
|
|
332
333
|
}
|
|
333
|
-
function
|
|
334
|
+
function Kt(t, n) {
|
|
334
335
|
const e = _(t.dataURL);
|
|
335
336
|
if (!e) return W([t], n, A(t));
|
|
336
337
|
let r;
|
|
337
338
|
if (t.crop) {
|
|
338
|
-
const o = t.dataURL ?
|
|
339
|
+
const o = t.dataURL ? rt(t.dataURL) : null, l = o?.naturalWidth, f = o?.naturalHeight;
|
|
339
340
|
if (l && f) {
|
|
340
|
-
const
|
|
341
|
-
r = { l:
|
|
341
|
+
const a = t.crop;
|
|
342
|
+
r = { l: a.x / l, t: a.y / f, r: 1 - (a.x + a.width) / l, b: 1 - (a.y + a.height) / f };
|
|
342
343
|
}
|
|
343
344
|
}
|
|
344
345
|
const i = (t.opacity ?? 100) / 100;
|
|
345
346
|
return n.report.native++, [{ kind: "picture", id: n.nextId++, name: A(t), ...Z(t, n), media: e, crop: r, alpha: i < 1 ? i : void 0, descr: t.altText }];
|
|
346
347
|
}
|
|
347
|
-
function
|
|
348
|
-
const i =
|
|
348
|
+
function Qt(t, n, e, r) {
|
|
349
|
+
const i = ut(t, r);
|
|
349
350
|
if (!i) return [];
|
|
350
351
|
const o = t.fontSize || 16, l = (t.containerText || "").split(`
|
|
351
|
-
`), f = Math.max(1, ...l.map((c) => c.length)),
|
|
352
|
+
`), f = Math.max(1, ...l.map((c) => c.length)), a = Math.max(40, f * o * 0.6 + 24), s = Math.max(o * 1.6, l.length * o * 1.25 + 8);
|
|
352
353
|
return i.wrap = !1, i.anchor = "ctr", i.paragraphs.forEach((c) => {
|
|
353
354
|
c.align = "ctr";
|
|
354
355
|
}), [{
|
|
@@ -356,38 +357,38 @@ function qt(t, n, e, r) {
|
|
|
356
357
|
id: e.nextId++,
|
|
357
358
|
name: `${A(t)} label`,
|
|
358
359
|
textBox: !0,
|
|
359
|
-
x: n.x - e.ox -
|
|
360
|
-
y: n.y - e.oy -
|
|
361
|
-
w:
|
|
362
|
-
h:
|
|
360
|
+
x: n.x - e.ox - a / 2,
|
|
361
|
+
y: n.y - e.oy - s / 2,
|
|
362
|
+
w: a,
|
|
363
|
+
h: s,
|
|
363
364
|
geom: { kind: "preset", prst: "rect" },
|
|
364
365
|
fill: { kind: "none" },
|
|
365
366
|
line: null,
|
|
366
367
|
text: i
|
|
367
368
|
}];
|
|
368
369
|
}
|
|
369
|
-
function
|
|
370
|
-
const r = t.x + t.w / 2, i = t.y + t.h / 2, o = (t.rot || 0) * Math.PI / 180, l = [[0, -t.h / 2], [-t.w / 2, 0], [0, t.h / 2], [t.w / 2, 0]], f = n.x - e.ox,
|
|
371
|
-
for (let
|
|
372
|
-
let [c, u] = l[
|
|
370
|
+
function tn(t, n, e) {
|
|
371
|
+
const r = t.x + t.w / 2, i = t.y + t.h / 2, o = (t.rot || 0) * Math.PI / 180, l = [[0, -t.h / 2], [-t.w / 2, 0], [0, t.h / 2], [t.w / 2, 0]], f = n.x - e.ox, a = n.y - e.oy;
|
|
372
|
+
for (let s = 0; s < 4; s++) {
|
|
373
|
+
let [c, u] = l[s];
|
|
373
374
|
t.flipH && (c = -c), t.flipV && (u = -u);
|
|
374
|
-
const
|
|
375
|
-
if (Math.hypot(
|
|
375
|
+
const h = r + c * Math.cos(o) - u * Math.sin(o), p = i + c * Math.sin(o) + u * Math.cos(o);
|
|
376
|
+
if (Math.hypot(h - f, p - a) <= 2) return s;
|
|
376
377
|
}
|
|
377
378
|
return -1;
|
|
378
379
|
}
|
|
379
|
-
function
|
|
380
|
+
function nn(t, n, e) {
|
|
380
381
|
const r = e.x - n.x, i = e.y - n.y, o = Math.hypot(r, i);
|
|
381
382
|
if (!(o > 0)) return !1;
|
|
382
|
-
const l = (
|
|
383
|
-
return t.every((
|
|
383
|
+
const l = (s, c) => Math.abs((s - n.x) * i - (c - n.y) * r) / o, f = (s, c) => ((s - n.x) * r + (c - n.y) * i) / (o * o), a = (s, c) => l(s, c) <= 0.5 && f(s, c) >= -0.01 && f(s, c) <= 1.01;
|
|
384
|
+
return t.every((s) => s.op === "Z" ? !1 : s.op === "C" ? a(s.x1, s.y1) && a(s.x2, s.y2) && a(s.x, s.y) : a(s.x, s.y));
|
|
384
385
|
}
|
|
385
|
-
function
|
|
386
|
-
const e = (t.opacity ?? 100) / 100, r = N(t, e, !0), i =
|
|
386
|
+
function en(t, n) {
|
|
387
|
+
const e = (t.opacity ?? 100) / 100, r = N(t, e, !0), i = wt(t), o = [];
|
|
387
388
|
if (r) {
|
|
388
|
-
const l = t.type === "arrow", f = l ? t.startArrowhead : null,
|
|
389
|
-
if (!i.d ||
|
|
390
|
-
const { start: c, end: u } = i,
|
|
389
|
+
const l = t.type === "arrow", f = l ? t.startArrowhead : null, a = l ? t.endArrowhead || (t.startArrowhead ? null : "arrow") : null, s = { ...r, head: J(f, G(t, "start"), t.strokeWidth), tail: J(a, G(t, "end"), t.strokeWidth) };
|
|
390
|
+
if (!i.d || nn(z(i.d), i.start, i.end)) {
|
|
391
|
+
const { start: c, end: u } = i, h = {
|
|
391
392
|
kind: "connector",
|
|
392
393
|
id: n.nextId++,
|
|
393
394
|
name: A(t),
|
|
@@ -398,50 +399,50 @@ function Qt(t, n) {
|
|
|
398
399
|
flipH: u.x < c.x || void 0,
|
|
399
400
|
flipV: u.y < c.y || void 0,
|
|
400
401
|
geom: { kind: "preset", prst: "straightConnector1" },
|
|
401
|
-
line:
|
|
402
|
-
},
|
|
403
|
-
const g =
|
|
402
|
+
line: s
|
|
403
|
+
}, p = (d, x) => {
|
|
404
|
+
const g = d?.elementId ? n.ids.get(d.elementId) : void 0;
|
|
404
405
|
if (!g) return;
|
|
405
|
-
const k =
|
|
406
|
+
const k = tn(g.item, x, n);
|
|
406
407
|
return k >= 0 ? { id: g.id, idx: k } : void 0;
|
|
407
408
|
};
|
|
408
409
|
n.glue.push(() => {
|
|
409
|
-
|
|
410
|
-
}), o.push(
|
|
410
|
+
h.start = p(t.startBinding, c), h.end = p(t.endBinding, u);
|
|
411
|
+
}), o.push(h);
|
|
411
412
|
} else {
|
|
412
413
|
const c = z(i.d), u = j(c);
|
|
413
414
|
if (u) {
|
|
414
|
-
const
|
|
415
|
+
const h = Math.max(u.maxX - u.minX, 0.01), p = Math.max(u.maxY - u.minY, 0.01);
|
|
415
416
|
o.push({
|
|
416
417
|
kind: "shape",
|
|
417
418
|
id: n.nextId++,
|
|
418
419
|
name: A(t),
|
|
419
420
|
x: u.minX - n.ox,
|
|
420
421
|
y: u.minY - n.oy,
|
|
421
|
-
w:
|
|
422
|
-
h:
|
|
422
|
+
w: h,
|
|
423
|
+
h: p,
|
|
423
424
|
geom: { kind: "custom", paths: [{ cmds: C(c, -u.minX, -u.minY), fill: !1 }] },
|
|
424
425
|
fill: { kind: "none" },
|
|
425
|
-
line:
|
|
426
|
+
line: s
|
|
426
427
|
});
|
|
427
428
|
}
|
|
428
429
|
}
|
|
429
430
|
n.report.native++;
|
|
430
431
|
}
|
|
431
|
-
return o.push(...
|
|
432
|
+
return o.push(...Qt(t, i.mid, n, e)), o;
|
|
432
433
|
}
|
|
433
|
-
function
|
|
434
|
-
const e = (t.opacity ?? 100) / 100, r =
|
|
434
|
+
function rn(t, n) {
|
|
435
|
+
const e = (t.opacity ?? 100) / 100, r = vt(t.points), i = N(t, e, !0);
|
|
435
436
|
if (r.length < 2 || !i) return [];
|
|
436
437
|
i.cap = "rnd", i.join = "round";
|
|
437
|
-
const o = r.map((
|
|
438
|
+
const o = r.map((h) => h.x), l = r.map((h) => h.y), f = Math.min(...o), a = Math.min(...l), s = Math.max(Math.max(...o) - f, 0.01), c = Math.max(Math.max(...l) - a, 0.01), u = r.map((h, p) => ({ op: p ? "L" : "M", x: h.x - f, y: h.y - a }));
|
|
438
439
|
return n.report.native++, [{
|
|
439
440
|
kind: "shape",
|
|
440
441
|
id: n.nextId++,
|
|
441
442
|
name: A(t),
|
|
442
443
|
x: t.x + f - n.ox,
|
|
443
|
-
y: t.y +
|
|
444
|
-
w:
|
|
444
|
+
y: t.y + a - n.oy,
|
|
445
|
+
w: s,
|
|
445
446
|
h: c,
|
|
446
447
|
rot: t.angle ? t.angle * 180 / Math.PI : void 0,
|
|
447
448
|
geom: { kind: "custom", paths: [{ cmds: u, fill: !1 }] },
|
|
@@ -449,7 +450,7 @@ function tn(t, n) {
|
|
|
449
450
|
line: i
|
|
450
451
|
}];
|
|
451
452
|
}
|
|
452
|
-
function
|
|
453
|
+
function on(t, n) {
|
|
453
454
|
const e = (t.opacity ?? 100) / 100;
|
|
454
455
|
if (!(t.text || t.richText && t.richText.length > 0)) return [];
|
|
455
456
|
n.report.native++;
|
|
@@ -463,15 +464,15 @@ function nn(t, n) {
|
|
|
463
464
|
geom: { kind: "preset", prst: "rect" },
|
|
464
465
|
fill: i ? { kind: "solid", color: i } : { kind: "none" },
|
|
465
466
|
line: null,
|
|
466
|
-
text:
|
|
467
|
+
text: Ut(t, e)
|
|
467
468
|
}];
|
|
468
469
|
}
|
|
469
|
-
const
|
|
470
|
+
const sn = (t) => {
|
|
470
471
|
const n = t && /matrix\(([^)]+)\)/.exec(t), e = n ? n[1].split(/[\s,]+/).map(Number) : [];
|
|
471
472
|
return e.length === 6 && e.every(Number.isFinite) ? e : [1, 0, 0, 1, 0, 0];
|
|
472
473
|
}, Q = (t, n, e) => ({ x: t[0] * n + t[2] * e + t[4], y: t[1] * n + t[3] * e + t[5] });
|
|
473
|
-
function
|
|
474
|
-
const n =
|
|
474
|
+
function an(t) {
|
|
475
|
+
const n = Lt.generator(), e = (i) => {
|
|
475
476
|
for (const o of n.toPaths(i))
|
|
476
477
|
t.save(), o.fill && o.fill !== "none" && (!o.stroke || o.stroke === "none") ? (t.fillStyle = o.fill, t.fillPath(o.d)) : o.stroke && o.stroke !== "none" && o.strokeWidth > 0 && (t.strokeStyle = o.stroke, t.lineWidth = o.strokeWidth, t.strokePath(o.d)), t.restore();
|
|
477
478
|
return i;
|
|
@@ -480,7 +481,7 @@ function rn(t) {
|
|
|
480
481
|
r[i] = (...o) => e(n[i](...o));
|
|
481
482
|
return r;
|
|
482
483
|
}
|
|
483
|
-
function
|
|
484
|
+
function cn(t) {
|
|
484
485
|
const n = t.fillStyle, e = {
|
|
485
486
|
...t,
|
|
486
487
|
renderStyle: "architectural",
|
|
@@ -493,30 +494,30 @@ function on(t) {
|
|
|
493
494
|
richContainerText: void 0,
|
|
494
495
|
// Hatching is re-created as a pattern fill on the body; recording it would be hundreds of lines.
|
|
495
496
|
fillStyle: Y[n] ? "solid" : t.fillStyle
|
|
496
|
-
}, r = new
|
|
497
|
+
}, r = new $t();
|
|
497
498
|
try {
|
|
498
|
-
const
|
|
499
|
-
|
|
499
|
+
const s = document.createElement("canvas");
|
|
500
|
+
It(an(r), s.getContext("2d"), e, !1, 1, r);
|
|
500
501
|
} catch {
|
|
501
502
|
return null;
|
|
502
503
|
}
|
|
503
504
|
if (r.failed) return null;
|
|
504
505
|
const i = /* @__PURE__ */ new Map();
|
|
505
|
-
for (const
|
|
506
|
-
const o = (
|
|
507
|
-
const u = i.get(
|
|
506
|
+
for (const s of Array.from(r.defs.children)) s.id && i.set(s.id, s);
|
|
507
|
+
const o = (s, c) => {
|
|
508
|
+
const u = i.get(s.replace(/^url\(#|\)$/g, ""));
|
|
508
509
|
if (!u) return null;
|
|
509
|
-
const
|
|
510
|
-
if (!
|
|
510
|
+
const h = Array.from(u.children).map((p) => ({ pos: +(p.getAttribute("offset") || 0), color: S(p.getAttribute("stop-color")) ?? { hex: "#000000", alpha: 0 } }));
|
|
511
|
+
if (!h.length) return null;
|
|
511
512
|
if (u.tagName.toLowerCase() === "lineargradient") {
|
|
512
|
-
const
|
|
513
|
-
return { kind: "linear", x1:
|
|
513
|
+
const p = Q(c, +u.getAttribute("x1"), +u.getAttribute("y1")), d = Q(c, +u.getAttribute("x2"), +u.getAttribute("y2"));
|
|
514
|
+
return { kind: "linear", x1: p.x, y1: p.y, x2: d.x, y2: d.y, stops: h };
|
|
514
515
|
}
|
|
515
|
-
return { kind: "radial", x1: 0, y1: 0, x2: 0, y2: 0, stops:
|
|
516
|
+
return { kind: "radial", x1: 0, y1: 0, x2: 0, y2: 0, stops: h };
|
|
516
517
|
}, l = [];
|
|
517
518
|
let f = "ok";
|
|
518
|
-
const
|
|
519
|
-
for (const c of Array.from(
|
|
519
|
+
const a = (s) => {
|
|
520
|
+
for (const c of Array.from(s.children)) {
|
|
520
521
|
if (f !== "ok") return;
|
|
521
522
|
const u = c.tagName.toLowerCase();
|
|
522
523
|
if (u === "g") {
|
|
@@ -524,62 +525,62 @@ function on(t) {
|
|
|
524
525
|
f = "picture";
|
|
525
526
|
return;
|
|
526
527
|
}
|
|
527
|
-
|
|
528
|
+
a(c);
|
|
528
529
|
continue;
|
|
529
530
|
}
|
|
530
531
|
if (u === "text" || u === "image") {
|
|
531
532
|
f = "picture";
|
|
532
533
|
return;
|
|
533
534
|
}
|
|
534
|
-
let
|
|
535
|
-
if (u === "path")
|
|
535
|
+
let h = null;
|
|
536
|
+
if (u === "path") h = c.getAttribute("d");
|
|
536
537
|
else if (u === "rect") {
|
|
537
538
|
const b = +c.getAttribute("x"), M = +c.getAttribute("y"), w = +c.getAttribute("width"), v = +c.getAttribute("height");
|
|
538
|
-
|
|
539
|
+
h = `M ${b} ${M} L ${b + w} ${M} L ${b + w} ${M + v} L ${b} ${M + v} Z`;
|
|
539
540
|
} else {
|
|
540
541
|
f = "fail";
|
|
541
542
|
return;
|
|
542
543
|
}
|
|
543
|
-
const
|
|
544
|
-
if (!
|
|
544
|
+
const p = sn(c.getAttribute("transform")), d = Rt(z(h || ""), p);
|
|
545
|
+
if (!d.length) continue;
|
|
545
546
|
const x = c.getAttribute("fill"), g = c.getAttribute("stroke"), k = !!x && x.startsWith("url("), m = +(c.getAttribute("fill-opacity") ?? 1), y = +(c.getAttribute("stroke-opacity") ?? 1);
|
|
546
547
|
l.push({
|
|
547
|
-
cmds:
|
|
548
|
+
cmds: d,
|
|
548
549
|
fill: x && x !== "none" && !k ? x : null,
|
|
549
|
-
grad: k ? o(x,
|
|
550
|
+
grad: k ? o(x, p) : null,
|
|
550
551
|
stroke: g && g !== "none" ? g : null,
|
|
551
552
|
fillAlpha: Number.isFinite(m) ? m : 1,
|
|
552
553
|
strokeAlpha: Number.isFinite(y) ? y : 1,
|
|
553
|
-
width: +(c.getAttribute("stroke-width") || 1) * Math.sqrt(Math.abs(
|
|
554
|
+
width: +(c.getAttribute("stroke-width") || 1) * Math.sqrt(Math.abs(p[0] * p[3] - p[1] * p[2])),
|
|
554
555
|
dash: !!c.getAttribute("stroke-dasharray"),
|
|
555
556
|
evenOdd: c.getAttribute("fill-rule") === "evenodd"
|
|
556
557
|
});
|
|
557
558
|
}
|
|
558
559
|
};
|
|
559
|
-
return
|
|
560
|
+
return a(r.root), f === "ok" ? l : f === "picture" ? "picture" : null;
|
|
560
561
|
}
|
|
561
562
|
const tt = (t, n) => {
|
|
562
563
|
if (!t || !n) return !1;
|
|
563
564
|
const e = T(t), r = T(n);
|
|
564
565
|
return !!e && !!r && e[0] === r[0] && e[1] === r[1] && e[2] === r[2];
|
|
565
566
|
};
|
|
566
|
-
function
|
|
567
|
-
const r = t.stops.map((
|
|
567
|
+
function ln(t, n, e) {
|
|
568
|
+
const r = t.stops.map((d) => ({ pos: d.pos, color: e < 1 ? { ...d.color, alpha: (d.color.alpha ?? 1) * e } : d.color }));
|
|
568
569
|
if (t.kind === "radial") return { kind: "radial", stops: r };
|
|
569
570
|
const i = t.x2 - t.x1, o = t.y2 - t.y1, l = Math.hypot(i, o);
|
|
570
571
|
if (!(l > 0)) return { kind: "solid", color: r[r.length - 1].color };
|
|
571
|
-
const f = i / l,
|
|
572
|
+
const f = i / l, a = o / l, s = (n.minX + n.maxX) / 2, c = (n.minY + n.maxY) / 2, u = (Math.abs((n.maxX - n.minX) * f) + Math.abs((n.maxY - n.minY) * a)) / 2;
|
|
572
573
|
if (!(u > 0)) return { kind: "solid", color: r[0].color };
|
|
573
|
-
const
|
|
574
|
-
return { kind: "linear", angle: Math.atan2(o, i) * 180 / Math.PI, stops:
|
|
574
|
+
const h = (d) => ((t.x1 + i * d - s) * f + (t.y1 + o * d - c) * a + u) / (2 * u), p = [...r].sort((d, x) => d.pos - x.pos).map((d) => ({ pos: h(d.pos), color: d.color }));
|
|
575
|
+
return { kind: "linear", angle: Math.atan2(o, i) * 180 / Math.PI, stops: dt(p) };
|
|
575
576
|
}
|
|
576
|
-
function
|
|
577
|
+
function dt(t) {
|
|
577
578
|
if (t.length < 2) return t.map((e) => ({ ...e, pos: Math.max(0, Math.min(1, e.pos)) }));
|
|
578
579
|
const n = (e) => {
|
|
579
580
|
if (e <= t[0].pos) return t[0].color;
|
|
580
581
|
for (let r = 1; r < t.length; r++) {
|
|
581
582
|
const i = t[r - 1], o = t[r];
|
|
582
|
-
if (e <= o.pos) return
|
|
583
|
+
if (e <= o.pos) return gn(i.color, o.color, o.pos > i.pos ? (e - i.pos) / (o.pos - i.pos) : 0);
|
|
583
584
|
}
|
|
584
585
|
return t[t.length - 1].color;
|
|
585
586
|
};
|
|
@@ -595,23 +596,23 @@ function H(t) {
|
|
|
595
596
|
return t.stroke !== !1 && r.push({ cmds: t.cmds, fill: !1, stroke: t.stroke }), r;
|
|
596
597
|
}
|
|
597
598
|
const E = (t) => JSON.stringify(t.cmds);
|
|
598
|
-
function
|
|
599
|
-
const e = (t.opacity ?? 100) / 100, r = Z(t, n), i =
|
|
600
|
-
let o =
|
|
599
|
+
function fn(t, n) {
|
|
600
|
+
const e = (t.opacity ?? 100) / 100, r = Z(t, n), i = ut(t, e);
|
|
601
|
+
let o = Zt(t);
|
|
601
602
|
if (!o) {
|
|
602
|
-
const f =
|
|
603
|
-
if (
|
|
604
|
-
if (
|
|
605
|
-
const c = Math.min(t.x, t.x + t.width), u = Math.min(t.y, t.y + t.height),
|
|
606
|
-
if (!
|
|
607
|
-
const m =
|
|
603
|
+
const f = St(t), a = f ? _t(f, t.width, t.height) : [], s = cn(t);
|
|
604
|
+
if (s === "picture") return null;
|
|
605
|
+
if (s && s.length) {
|
|
606
|
+
const c = Math.min(t.x, t.x + t.width), u = Math.min(t.y, t.y + t.height), h = a.length ? a.filter((m) => m.fill !== !1).map((m) => C(m.cmds, c, u)) : null, p = !!it(t), d = ["linear", "radial", "conic"].includes(t.fillStyle);
|
|
607
|
+
if (!s.every((m) => (!m.grad || d) && m.fillAlpha >= 1 && m.strokeAlpha >= 1 && (!m.fill || tt(m.fill, t.backgroundColor)) && (!m.stroke || tt(m.stroke, t.strokeColor) && Math.abs(m.width - t.strokeWidth) < 0.75 && m.dash === p))) {
|
|
608
|
+
const m = dn(t, s, r, i, n, e, h);
|
|
608
609
|
return m ? [m] : null;
|
|
609
610
|
}
|
|
610
611
|
const g = [], k = (m) => C(m, -c, -u);
|
|
611
|
-
for (let m = 0; m <
|
|
612
|
-
const y =
|
|
612
|
+
for (let m = 0; m < s.length; m++) {
|
|
613
|
+
const y = s[m], b = s[m + 1], M = !!((y.fill || y.grad) && !y.stroke && b && b.stroke && !b.fill && !b.grad && E(b) === E(y)), w = !!y.stroke || M;
|
|
613
614
|
if (y.fill || y.grad) {
|
|
614
|
-
const v =
|
|
615
|
+
const v = ht(y, h);
|
|
615
616
|
if (!v) return null;
|
|
616
617
|
v.length === 1 && v[0] === y.cmds ? g.push(...H({ cmds: k(y.cmds), stroke: w ? void 0 : !1 })) : (g.push(...v.map((O) => ({ cmds: k(O), stroke: !1 }))), w && g.push({ cmds: k(y.cmds), fill: !1 }));
|
|
617
618
|
} else
|
|
@@ -619,8 +620,8 @@ function an(t, n) {
|
|
|
619
620
|
M && m++;
|
|
620
621
|
}
|
|
621
622
|
o = { kind: "custom", paths: g };
|
|
622
|
-
} else if (
|
|
623
|
-
o = { kind: "custom", paths:
|
|
623
|
+
} else if (a.length)
|
|
624
|
+
o = { kind: "custom", paths: a.flatMap(H) };
|
|
624
625
|
else return null;
|
|
625
626
|
}
|
|
626
627
|
const l = {
|
|
@@ -629,58 +630,58 @@ function an(t, n) {
|
|
|
629
630
|
name: A(t),
|
|
630
631
|
...r,
|
|
631
632
|
geom: o,
|
|
632
|
-
fill:
|
|
633
|
+
fill: Wt(t, e),
|
|
633
634
|
line: N(t, e),
|
|
634
635
|
text: i
|
|
635
636
|
};
|
|
636
637
|
return n.ids.set(t.id, { id: l.id, item: l }), n.report.native++, [l];
|
|
637
638
|
}
|
|
638
|
-
const
|
|
639
|
-
let
|
|
639
|
+
const un = (t) => t.map((n) => n.op === "Z" ? "Z" : n.op === "C" ? `C ${n.x1} ${n.y1} ${n.x2} ${n.y2} ${n.x} ${n.y}` : `${n.op} ${n.x} ${n.y}`).join(" ");
|
|
640
|
+
let D = null;
|
|
640
641
|
const P = 28;
|
|
641
|
-
function
|
|
642
|
-
|
|
642
|
+
function B(t, n, e) {
|
|
643
|
+
D ??= document.createElement("canvas").getContext("2d");
|
|
643
644
|
const r = [];
|
|
644
|
-
if (!
|
|
645
|
-
const i = t.map((o) => new Path2D(
|
|
645
|
+
if (!D) return r;
|
|
646
|
+
const i = t.map((o) => new Path2D(un(o)));
|
|
646
647
|
for (let o = 0; o < P; o++) for (let l = 0; l < P; l++) {
|
|
647
|
-
const f = e.minX + (l + 0.5) / P * (e.maxX - e.minX),
|
|
648
|
-
r.push(i.some((
|
|
648
|
+
const f = e.minX + (l + 0.5) / P * (e.maxX - e.minX), a = e.minY + (o + 0.5) / P * (e.maxY - e.minY);
|
|
649
|
+
r.push(i.some((s) => D.isPointInPath(s, f, a, n)));
|
|
649
650
|
}
|
|
650
651
|
return r;
|
|
651
652
|
}
|
|
652
653
|
const nt = (t, n) => t.reduce((e, r, i) => e + (r !== n[i] ? 1 : 0), 0) / Math.max(1, t.length);
|
|
653
|
-
function
|
|
654
|
+
function ht(t, n) {
|
|
654
655
|
if (t.evenOdd) return [t.cmds];
|
|
655
656
|
const e = j(t.cmds);
|
|
656
657
|
if (!e) return [t.cmds];
|
|
657
|
-
const r =
|
|
658
|
-
return nt(r,
|
|
658
|
+
const r = B([t.cmds], "nonzero", e);
|
|
659
|
+
return nt(r, B([t.cmds], "evenodd", e)) === 0 ? [t.cmds] : n && nt(r, B(n, "evenodd", e)) <= 0.03 ? n : null;
|
|
659
660
|
}
|
|
660
|
-
function
|
|
661
|
+
function dn(t, n, e, r, i, o, l) {
|
|
661
662
|
const f = [];
|
|
662
|
-
for (let
|
|
663
|
-
const
|
|
664
|
-
if (!
|
|
665
|
-
const
|
|
663
|
+
for (let a = 0; a < n.length; a++) {
|
|
664
|
+
const s = n[a], c = n[a + 1], u = !!((s.fill || s.grad) && !s.stroke && c && c.stroke && !c.fill && !c.grad && E(c) === E(s)), h = u ? c : s, p = j(s.cmds);
|
|
665
|
+
if (!p) continue;
|
|
666
|
+
const d = Math.max(p.maxX - p.minX, 0.01), x = Math.max(p.maxY - p.minY, 0.01), g = S(s.fill, o * s.fillAlpha), k = s.grad ? ln(s.grad, p, o) : g ? { kind: "solid", color: g } : { kind: "none" }, m = S(h.stroke, o * h.strokeAlpha), y = m ? { width: h.width, color: m, dash: h.dash ? "dash" : void 0, join: "round", cap: "rnd" } : null, b = !!(s.fill || s.grad), M = (v) => C(v, -p.minX, -p.minY);
|
|
666
667
|
let w;
|
|
667
668
|
if (b) {
|
|
668
|
-
const v =
|
|
669
|
+
const v = ht(s, l);
|
|
669
670
|
if (!v) return null;
|
|
670
|
-
w = v.length === 1 && v[0] ===
|
|
671
|
-
} else w = [{ cmds: M(
|
|
671
|
+
w = v.length === 1 && v[0] === s.cmds ? H({ cmds: M(s.cmds), stroke: m ? void 0 : !1 }) : [...v.map((O) => ({ cmds: M(O), stroke: !1 })), ...m ? [{ cmds: M(s.cmds), fill: !1 }] : []];
|
|
672
|
+
} else w = [{ cmds: M(s.cmds), fill: !1, stroke: m ? void 0 : !1 }];
|
|
672
673
|
f.push({
|
|
673
674
|
kind: "shape",
|
|
674
675
|
id: i.nextId++,
|
|
675
676
|
name: `${A(t)} part`,
|
|
676
|
-
x:
|
|
677
|
-
y:
|
|
678
|
-
w:
|
|
677
|
+
x: p.minX - i.ox,
|
|
678
|
+
y: p.minY - i.oy,
|
|
679
|
+
w: d,
|
|
679
680
|
h: x,
|
|
680
681
|
geom: { kind: "custom", paths: w },
|
|
681
682
|
fill: k,
|
|
682
683
|
line: y
|
|
683
|
-
}), u &&
|
|
684
|
+
}), u && a++;
|
|
684
685
|
}
|
|
685
686
|
return r && f.push({
|
|
686
687
|
kind: "shape",
|
|
@@ -697,22 +698,22 @@ function ln(t, n, e, r, i, o, l) {
|
|
|
697
698
|
text: r
|
|
698
699
|
}), i.report.native++, { kind: "group", id: i.nextId++, name: A(t), ...e, children: f };
|
|
699
700
|
}
|
|
700
|
-
function
|
|
701
|
-
if (
|
|
701
|
+
function hn(t, n) {
|
|
702
|
+
if (Jt(t)) return W([t], n, A(t));
|
|
702
703
|
try {
|
|
703
|
-
if (t.type === "text" || t.type === "richtext") return
|
|
704
|
-
if (t.type === "image") return
|
|
705
|
-
if (t.type === "line" || t.type === "arrow") return
|
|
706
|
-
if (
|
|
707
|
-
if (!
|
|
708
|
-
const e =
|
|
704
|
+
if (t.type === "text" || t.type === "richtext") return on(t, n);
|
|
705
|
+
if (t.type === "image") return Kt(t, n);
|
|
706
|
+
if (t.type === "line" || t.type === "arrow") return en(t, n);
|
|
707
|
+
if (Vt.has(t.type)) return rn(t, n);
|
|
708
|
+
if (!qt.has(t.type)) {
|
|
709
|
+
const e = fn(t, n);
|
|
709
710
|
if (e) return e;
|
|
710
711
|
}
|
|
711
712
|
} catch {
|
|
712
713
|
}
|
|
713
714
|
return W([t], n, A(t));
|
|
714
715
|
}
|
|
715
|
-
function
|
|
716
|
+
function pt(t, n, e) {
|
|
716
717
|
const r = [];
|
|
717
718
|
let i = 0;
|
|
718
719
|
const o = (l) => {
|
|
@@ -722,29 +723,30 @@ function ht(t, n, e) {
|
|
|
722
723
|
for (; i < t.length; ) {
|
|
723
724
|
const l = o(t[i]);
|
|
724
725
|
if (!l) {
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
726
|
+
let s = hn(t[i], e);
|
|
727
|
+
const c = yn(t[i].link);
|
|
728
|
+
if (c) for (const u of s) u.link = c;
|
|
729
|
+
e.animTargets && t[i].animations?.length && s.length > 1 && (s = [{ kind: "group", id: e.nextId++, name: A(t[i]), ...et(s), children: s }]), e.animTargets && s.length === 1 && e.animTargets.set(t[i].id, s[0].id), r.push(...s), i++;
|
|
728
730
|
continue;
|
|
729
731
|
}
|
|
730
732
|
let f = i;
|
|
731
733
|
for (; f < t.length && o(t[f]) === l; ) f++;
|
|
732
|
-
const
|
|
733
|
-
if (
|
|
734
|
-
const
|
|
735
|
-
r.push(c);
|
|
736
|
-
} else r.push(...
|
|
734
|
+
const a = pt(t.slice(i, f), n + 1, e);
|
|
735
|
+
if (a.length > 1) {
|
|
736
|
+
const s = et(a), c = { kind: "group", id: e.nextId++, name: t[i].groupNames?.[l] || "Group", ...s, children: a };
|
|
737
|
+
if (r.push(c), e.animTargets) for (const u of t.slice(i, f)) e.animTargets.set(u.id, c.id);
|
|
738
|
+
} else r.push(...a);
|
|
737
739
|
i = f;
|
|
738
740
|
}
|
|
739
741
|
return r;
|
|
740
742
|
}
|
|
741
|
-
function
|
|
743
|
+
function et(t) {
|
|
742
744
|
let n = 1 / 0, e = 1 / 0, r = -1 / 0, i = -1 / 0;
|
|
743
745
|
for (const o of t)
|
|
744
746
|
n = Math.min(n, o.x), e = Math.min(e, o.y), r = Math.max(r, o.x + o.w), i = Math.max(i, o.y + o.h);
|
|
745
747
|
return { x: n, y: e, w: Math.max(0, r - n), h: Math.max(0, i - e) };
|
|
746
748
|
}
|
|
747
|
-
function
|
|
749
|
+
function pn(t) {
|
|
748
750
|
if (!t || t.type === "none") return;
|
|
749
751
|
const n = t.duration ?? 500;
|
|
750
752
|
switch (t.type) {
|
|
@@ -762,11 +764,13 @@ function dn(t) {
|
|
|
762
764
|
return { kind: "zoom", zoomIn: !0, durationMs: n };
|
|
763
765
|
case "zoom-out":
|
|
764
766
|
return { kind: "zoom", zoomIn: !1, durationMs: n };
|
|
767
|
+
case "morph":
|
|
768
|
+
return { kind: "morph", durationMs: n };
|
|
765
769
|
default:
|
|
766
770
|
return;
|
|
767
771
|
}
|
|
768
772
|
}
|
|
769
|
-
function
|
|
773
|
+
function mn(t, n) {
|
|
770
774
|
const e = t.slide;
|
|
771
775
|
if (!e) {
|
|
772
776
|
const f = S(t.background);
|
|
@@ -776,58 +780,86 @@ function hn(t, n) {
|
|
|
776
780
|
if (i && r === "solid")
|
|
777
781
|
return { kind: "solid", color: S(e.backgroundColor === "transparent" ? "#ffffff" : e.backgroundColor || "#ffffff") ?? { hex: "#ffffff" } };
|
|
778
782
|
if (i && (r === "linear" || r === "radial") && (e.gradientStops?.length ?? 0) > 0) {
|
|
779
|
-
const f = e.gradientDirection || 0,
|
|
780
|
-
return r === "radial" ? { kind: "radial", stops:
|
|
783
|
+
const f = e.gradientDirection || 0, a = e.gradientStops.map((s) => ({ pos: s.offset, color: S(s.color) ?? { hex: "#ffffff" } }));
|
|
784
|
+
return r === "radial" ? { kind: "radial", stops: a } : { kind: "linear", stops: xn(a, f, t.w, t.h), angle: f };
|
|
781
785
|
}
|
|
782
786
|
const o = n.rasterizeBackground?.(e), l = o ? _(o) : null;
|
|
783
787
|
return l ? { kind: "image", media: l } : { kind: "solid", color: S(e.backgroundColor) ?? { hex: "#ffffff" } };
|
|
784
788
|
}
|
|
785
|
-
function
|
|
789
|
+
function xn(t, n, e, r) {
|
|
786
790
|
const i = n * Math.PI / 180, o = Math.hypot(e, r) / 2, l = (Math.abs(e * Math.cos(i)) + Math.abs(r * Math.sin(i))) / 2;
|
|
787
791
|
if (!(l > 0) || t.length < 2) return t;
|
|
788
|
-
const f = [...t].sort((
|
|
789
|
-
return
|
|
792
|
+
const f = [...t].sort((a, s) => a.pos - s.pos).map((a) => ({ pos: (-o + 2 * o * a.pos + l) / (2 * l), color: a.color }));
|
|
793
|
+
return dt(f);
|
|
790
794
|
}
|
|
791
|
-
function
|
|
792
|
-
const r = T(t.hex), i = T(n.hex), o = [0, 1, 2].map((
|
|
793
|
-
return
|
|
795
|
+
function gn(t, n, e) {
|
|
796
|
+
const r = T(t.hex), i = T(n.hex), o = [0, 1, 2].map((s) => Math.round(r[s] + (i[s] - r[s]) * e)), l = t.alpha ?? 1, f = n.alpha ?? 1, a = l + (f - l) * e;
|
|
797
|
+
return a < 0.999 ? { hex: L(o), alpha: a } : { hex: L(o) };
|
|
794
798
|
}
|
|
795
|
-
function
|
|
796
|
-
const n =
|
|
799
|
+
function yn(t) {
|
|
800
|
+
const n = gt(t);
|
|
797
801
|
if (n.kind === "url") return { kind: "url", url: n.url };
|
|
798
802
|
if (n.kind === "slide") return { kind: "slide", key: n.slideId };
|
|
799
803
|
if (n.kind === "action") return { kind: "action", action: n.action };
|
|
800
804
|
}
|
|
801
|
-
function
|
|
805
|
+
function kn(t) {
|
|
802
806
|
return {
|
|
803
807
|
...t?.hidden && { hidden: !0 },
|
|
804
808
|
...t?.advanceAfter && t.advanceAfter > 0 && { advanceAfterMs: t.advanceAfter },
|
|
805
809
|
...t?.section && { section: t.section }
|
|
806
810
|
};
|
|
807
811
|
}
|
|
808
|
-
function
|
|
809
|
-
const r = { ox: t.x, oy: t.y, nextId: 2, ids: /* @__PURE__ */ new Map(), glue: [], hooks: n, report: e }, i =
|
|
810
|
-
|
|
812
|
+
function Sn(t, n, e) {
|
|
813
|
+
const r = { ox: t.x, oy: t.y, nextId: 2, ids: /* @__PURE__ */ new Map(), glue: [], hooks: n, report: e, ...t.layers && { animTargets: /* @__PURE__ */ new Map() } }, i = pt(t.elements, 0, r);
|
|
814
|
+
r.glue.forEach((l) => l());
|
|
815
|
+
const o = t.layers && r.animTargets ? bn(t.elements, t.layers, r.animTargets, e) : [];
|
|
816
|
+
return {
|
|
811
817
|
name: t.name,
|
|
812
818
|
items: i,
|
|
813
|
-
background:
|
|
814
|
-
transition:
|
|
819
|
+
background: mn(t, n),
|
|
820
|
+
transition: pn(t.slide?.transition),
|
|
815
821
|
notes: t.slide?.notes?.trim() ? t.slide.notes : void 0,
|
|
816
822
|
key: t.slide?.id,
|
|
817
|
-
...
|
|
823
|
+
...kn(t.slide),
|
|
824
|
+
...o.length && { anims: o }
|
|
818
825
|
};
|
|
819
826
|
}
|
|
820
|
-
function
|
|
827
|
+
function bn(t, n, e, r) {
|
|
828
|
+
const i = xt(t.filter((a) => !a.id.includes("@page")), n), o = [];
|
|
829
|
+
let l = 0;
|
|
830
|
+
for (const a of i) {
|
|
831
|
+
const s = a.animation.trigger;
|
|
832
|
+
if (s === "with-prev" || s === "after-prev") {
|
|
833
|
+
const c = o[o.length - 1];
|
|
834
|
+
!c || c.skip ? l++ : c.steps.push(a);
|
|
835
|
+
} else s === "on-load" || s === "on-click" ? o.push({ load: s === "on-load", skip: !1, steps: [a] }) : (o.push({ load: !1, skip: !0, steps: [] }), l++);
|
|
836
|
+
}
|
|
837
|
+
const f = [];
|
|
838
|
+
for (const a of [...o.filter((s) => s.load && !s.skip), ...o.filter((s) => !s.load && !s.skip)]) {
|
|
839
|
+
const s = /* @__PURE__ */ new Set();
|
|
840
|
+
a.steps.forEach((c, u) => {
|
|
841
|
+
const h = e.get(c.elementId), p = u === 0 ? a.load ? "with" : "click" : c.animation.trigger === "after-prev" ? "after" : "with", d = h !== void 0 ? Ot(c.animation, h, p) : null;
|
|
842
|
+
if (!d) {
|
|
843
|
+
l++;
|
|
844
|
+
return;
|
|
845
|
+
}
|
|
846
|
+
const x = `${h}|${d.cls}|${d.effect}`;
|
|
847
|
+
s.has(x) || (s.add(x), f.push(d));
|
|
848
|
+
});
|
|
849
|
+
}
|
|
850
|
+
return l && (r.animsSkipped = (r.animsSkipped ?? 0) + l), f;
|
|
851
|
+
}
|
|
852
|
+
function An(t, n, e, r) {
|
|
821
853
|
const i = Math.min(e / Math.max(t, 1), r / Math.max(n, 1));
|
|
822
854
|
return { scale: i, dx: (e - t * i) / 2, dy: (r - n * i) / 2 };
|
|
823
855
|
}
|
|
824
856
|
export {
|
|
825
|
-
|
|
857
|
+
An as fitInto,
|
|
826
858
|
_ as mediaOf,
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
859
|
+
Sn as pageToSlide,
|
|
860
|
+
xn as remapPageStops,
|
|
861
|
+
kn as showFields,
|
|
830
862
|
S as toColor,
|
|
831
|
-
|
|
832
|
-
|
|
863
|
+
pn as transitionOf,
|
|
864
|
+
ot as typefaceOf
|
|
833
865
|
};
|