@algorisys/yappydraw 0.8.292 → 0.8.293
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/{canva-ai-DEXgo3RO.js → canva-ai-B5NJGMGr.js} +1 -1
- package/chunks/{choice-dialog-state-DF7Hd13K.js → choice-dialog-state-Cw0WShhc.js} +1 -1
- package/chunks/{custgeom-DK60FLyH.js → custgeom-BeeylhzV.js} +1 -1
- package/chunks/{design-generator-dbNACXM-.js → design-generator-BSZ2XUOE.js} +1 -1
- package/chunks/{drawing-engine-Dpuzo1lz.js → drawing-engine-DfASJ_gK.js} +1 -1
- package/chunks/{drawings-store-Day7j_Tw.js → drawings-store-cl-M93Eh.js} +1 -1
- package/chunks/{ds-operations-DTBQ2jlO.js → ds-operations-CXoS_Obn.js} +1 -1
- package/chunks/{export-game-B-Zaoh5a.js → export-game-BTjE-uv-.js} +1 -1
- package/chunks/{from-yappy-ChDOEKXM.js → from-yappy-hUcG5auS.js} +137 -137
- package/chunks/{game-runtime-A4EiMP-P.js → game-runtime-33Ly0Axb.js} +5 -5
- package/chunks/import-Dk___UKU.js +1635 -0
- package/chunks/{index-Dxj5fgvO.js → index-OCtbNe3Y.js} +3951 -3935
- package/chunks/{lucide-solid-BXo3zhMX.js → lucide-solid-Btzt68l9.js} +1 -1
- package/chunks/{markdown-to-slides-DdrONEUr.js → markdown-to-slides-CNpwNPE8.js} +1 -1
- package/chunks/{morph-animator-mlVxvG9t.js → morph-animator-CWLzpuUc.js} +1 -1
- package/chunks/{onboarding-tour-EDXLuYEp.js → onboarding-tour-eLES7UJM.js} +1 -1
- package/chunks/{pdf-vector-OO6sbSA5.js → pdf-vector-C1l03NEO.js} +1 -1
- package/chunks/{search-C28u5fM2.js → search-tbh5OqVp.js} +2 -2
- package/chunks/{slide-generator-BxoPBOpW.js → slide-generator-CZfB2tSO.js} +1 -1
- package/chunks/{turntable-ai-BxllwIBP.js → turntable-ai-CeD-w_eE.js} +1 -1
- package/chunks/{write-DbVLX69U.js → write-BUtbdS9L.js} +14 -14
- package/chunks/yappy-CvwwkLs8.css +1 -0
- package/package.json +1 -1
- package/yappy.js +1 -1
- package/chunks/import-D8POTmPt.js +0 -1430
- package/chunks/yappy-FCQs01wv.css +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { d as F, g as j, t as I, h as pt } from "./custgeom-
|
|
2
|
-
import { a1 as et, a2 as mt, a3 as xt, a4 as gt, a5 as yt, a6 as kt, a7 as bt, a8 as G, a9 as Mt, aa as wt, ab as vt, ac as St, ad as At, ae as $t, af as Ct, ag as It, ah as Tt, ai as Pt, aj as zt, ak as Ft } from "./index-
|
|
1
|
+
import { d as F, g as j, t as I, h as pt } from "./custgeom-BeeylhzV.js";
|
|
2
|
+
import { a1 as et, a2 as mt, a3 as xt, a4 as gt, a5 as yt, a6 as kt, a7 as bt, a8 as G, a9 as Mt, aa as wt, ab as vt, ac as St, ad as At, ae as $t, af as Ct, ag as It, ah as Tt, ai as Pt, aj as zt, ak as Ft } from "./index-OCtbNe3Y.js";
|
|
3
3
|
function Lt(t) {
|
|
4
|
-
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,
|
|
4
|
+
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, s = n - 0.1055613458 * o - 0.0638541728 * l, a = n - 0.0894841775 * o - 1.291485548 * l, c = f * f * f, u = s * s * s, p = a * a * a, d = 1.2270138511 * c - 0.5577999807 * u + 0.2812561489 * p, h = -0.0405801784 * c + 1.1122568696 * u - 0.0716766787 * p, x = -0.0763812845 * c - 0.4214819787 * u + 1.5861632204 * p, g = 2.4039459 * d - 0.9898517 * h - 0.4141151 * x, k = -0.7797967 * d + 1.5445214 * h + 0.0352745 * x, m = 0.0384795 * d - 0.1141381 * h + 1.0756786 * x, y = (b) => {
|
|
5
5
|
const M = Math.abs(b), w = M > 31308e-7 ? 1.055 * Math.pow(M, 1 / 2.4) - 0.055 : 12.92 * M;
|
|
6
6
|
return b < 0 ? -w : w;
|
|
7
7
|
};
|
|
8
8
|
return {
|
|
9
|
-
r: y(
|
|
9
|
+
r: y(g),
|
|
10
10
|
g: y(k),
|
|
11
11
|
b: y(m)
|
|
12
12
|
};
|
|
@@ -42,19 +42,19 @@ function T(t) {
|
|
|
42
42
|
if (r) {
|
|
43
43
|
const o = r[2].split(/[\s,]+/).filter(Boolean).map(Et);
|
|
44
44
|
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(
|
|
45
|
+
const [l, f, s] = o;
|
|
46
|
+
if (r[1] === "srgb") return [e(l), e(f), e(s)];
|
|
47
|
+
const a = V(l, f, s);
|
|
48
|
+
return [e(a.r), e(a.g), e(a.b)];
|
|
49
49
|
}
|
|
50
50
|
const i = n.match(/^oklch\(\s*([^/)]+?)\s*(?:\/[^)]*)?\)$/);
|
|
51
51
|
if (i) {
|
|
52
52
|
const o = i[1].split(/[\s,]+/).filter(Boolean);
|
|
53
53
|
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(
|
|
54
|
+
const l = o[0].endsWith("%") ? parseFloat(o[0]) / 100 : parseFloat(o[0]), f = parseFloat(o[1]), s = parseFloat(o[2]);
|
|
55
|
+
if (![l, f, s].every(isFinite)) return null;
|
|
56
|
+
const a = V(...(({ r: c, g: u, b: p }) => [c, u, p])(Lt({ l, c: f, h: s })));
|
|
57
|
+
return [e(a.r), e(a.g), e(a.b)];
|
|
58
58
|
}
|
|
59
59
|
return Rt(n);
|
|
60
60
|
}
|
|
@@ -164,34 +164,34 @@ function Dt(t, n) {
|
|
|
164
164
|
function Yt(t, n, e, r) {
|
|
165
165
|
const i = t.listLevel || 0, o = { bullet: t.listType === "ordered" ? "num" : "char", level: i };
|
|
166
166
|
if (o.bullet === "num") {
|
|
167
|
-
const
|
|
168
|
-
|
|
167
|
+
const s = Bt(t);
|
|
168
|
+
s !== "arabicPeriod" && (o.numType = s), !(e && e.level === i && e.scheme === s && (t.listIndex || 1) === e.index + 1) && (t.listIndex || 1) > 1 && (o.startAt = t.listIndex);
|
|
169
169
|
} else t.listMarker && t.listMarker !== "•" && (o.bulletChar = t.listMarker);
|
|
170
170
|
if (t.listMarkerColor) {
|
|
171
|
-
const
|
|
172
|
-
|
|
171
|
+
const s = S(t.listMarkerColor, n);
|
|
172
|
+
s && (o.bulletColor = s);
|
|
173
173
|
}
|
|
174
174
|
t.listMarkerScale && t.listMarkerScale !== 1 && (o.bulletScale = t.listMarkerScale);
|
|
175
|
-
const l =
|
|
175
|
+
const l = Ft(t), f = r(t);
|
|
176
176
|
return o.marL = f, o.indent = l - f, o;
|
|
177
177
|
}
|
|
178
178
|
function at(t, n, e, r) {
|
|
179
179
|
const i = [];
|
|
180
180
|
let o = { runs: [], align: n }, l = !1, f = null;
|
|
181
|
-
const a = () => {
|
|
181
|
+
const s = Pt(Dt, t, r), a = () => {
|
|
182
182
|
i.push(o), o = { runs: [], align: n }, l = !1;
|
|
183
183
|
};
|
|
184
|
-
for (const
|
|
185
|
-
String(
|
|
186
|
-
`).forEach((
|
|
187
|
-
if (
|
|
188
|
-
l || (l = !0,
|
|
189
|
-
const
|
|
190
|
-
if (
|
|
191
|
-
const
|
|
192
|
-
|
|
184
|
+
for (const c of t)
|
|
185
|
+
String(c.text ?? "").split(`
|
|
186
|
+
`).forEach((p, d) => {
|
|
187
|
+
if (d > 0 && a(), c.fontSize && !l && (o.endSize = c.fontSize), !p) return;
|
|
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, Yt(c, e, f, s)), f = o.bullet === "num" ? { level: o.level ?? 0, scheme: o.numType ?? "arabicPeriod", index: c.listIndex || 1 } : null);
|
|
189
|
+
const h = { text: p };
|
|
190
|
+
if (c.bold && (h.bold = !0), c.italic && (h.italic = !0), c.underline && (h.underline = !0), c.strikethrough && (h.strike = !0), c.color) {
|
|
191
|
+
const x = S(c.color, e);
|
|
192
|
+
x && (h.color = x);
|
|
193
193
|
}
|
|
194
|
-
|
|
194
|
+
c.fontSize && (h.size = c.fontSize), c.fontFamily && (h.font = rt(c.fontFamily)), o.runs.push(h);
|
|
195
195
|
});
|
|
196
196
|
return a(), i;
|
|
197
197
|
}
|
|
@@ -231,37 +231,37 @@ function ft(t, n) {
|
|
|
231
231
|
};
|
|
232
232
|
}
|
|
233
233
|
function Ht(t, n, e) {
|
|
234
|
-
const r = [], i = Math.abs(n) / 2, o = Math.abs(e) / 2, l = (
|
|
235
|
-
const u = I(F(
|
|
234
|
+
const r = [], i = Math.abs(n) / 2, o = Math.abs(e) / 2, l = (s, a, c) => {
|
|
235
|
+
const u = I(F(s), i, o);
|
|
236
236
|
if (u.length === 0) return;
|
|
237
|
-
const
|
|
237
|
+
const p = a, d = { fill: p.noFill ? !1 : void 0, stroke: p.noStroke ? !1 : void 0 };
|
|
238
238
|
if (c) {
|
|
239
239
|
r.push({ cmds: u, ...d });
|
|
240
240
|
return;
|
|
241
241
|
}
|
|
242
|
-
let
|
|
243
|
-
for (const
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}, f = (
|
|
247
|
-
const
|
|
248
|
-
switch (
|
|
242
|
+
let h = [];
|
|
243
|
+
for (const x of u)
|
|
244
|
+
x.op === "M" && h.length && (r.push({ cmds: h, ...d }), h = []), h.push(x);
|
|
245
|
+
h.length && r.push({ cmds: h, ...d });
|
|
246
|
+
}, f = (s) => {
|
|
247
|
+
const a = (c) => Math.round(c * 1e3) / 1e3;
|
|
248
|
+
switch (s.type) {
|
|
249
249
|
case "rect": {
|
|
250
|
-
const c = Math.min(Math.abs(
|
|
251
|
-
l(`M ${
|
|
250
|
+
const c = Math.min(Math.abs(s.w), Math.abs(s.h)) / 2, [u, p, d, h] = (Array.isArray(s.r) ? s.r : [s.r || 0, s.r || 0, s.r || 0, s.r || 0]).map((b) => Math.max(0, Math.min(b || 0, c))), x = (b, M, w) => b ? ` A ${a(b)} ${a(b)} 0 0 1 ${a(M)} ${a(w)}` : "", { x: g, y: k } = s, m = s.w, y = s.h;
|
|
251
|
+
l(`M ${g + u} ${k} H ${g + m - p}${x(p, g + m, k + p)} V ${k + y - d}${x(d, g + m - d, k + y)} H ${g + h}${x(h, g, k + y - h)} V ${k + u}${x(u, g + u, k)} Z`, s, !1);
|
|
252
252
|
break;
|
|
253
253
|
}
|
|
254
254
|
case "ellipse":
|
|
255
|
-
l(`M ${
|
|
255
|
+
l(`M ${s.cx - s.rx} ${s.cy} A ${s.rx} ${s.ry} 0 1 0 ${s.cx + s.rx} ${s.cy} A ${s.rx} ${s.ry} 0 1 0 ${s.cx - s.rx} ${s.cy} Z`, s, !1);
|
|
256
256
|
break;
|
|
257
257
|
case "points":
|
|
258
|
-
|
|
258
|
+
s.points.length >= 2 && l(`M ${s.points.map((c) => `${c.x} ${c.y}`).join(" L ")}${s.isClosed !== !1 ? " Z" : ""}`, s, !1);
|
|
259
259
|
break;
|
|
260
260
|
case "path":
|
|
261
|
-
l(
|
|
261
|
+
l(s.path, s, !!s.evenOdd);
|
|
262
262
|
break;
|
|
263
263
|
case "multi":
|
|
264
|
-
|
|
264
|
+
s.shapes.forEach(f);
|
|
265
265
|
break;
|
|
266
266
|
}
|
|
267
267
|
};
|
|
@@ -337,8 +337,8 @@ function Gt(t, n) {
|
|
|
337
337
|
if (t.crop) {
|
|
338
338
|
const o = t.dataURL ? et(t.dataURL) : null, l = o?.naturalWidth, f = o?.naturalHeight;
|
|
339
339
|
if (l && f) {
|
|
340
|
-
const
|
|
341
|
-
r = { l:
|
|
340
|
+
const s = t.crop;
|
|
341
|
+
r = { l: s.x / l, t: s.y / f, r: 1 - (s.x + s.width) / l, b: 1 - (s.y + s.height) / f };
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
344
|
const i = (t.opacity ?? 100) / 100;
|
|
@@ -348,7 +348,7 @@ function Vt(t, n, e, r) {
|
|
|
348
348
|
const i = ft(t, r);
|
|
349
349
|
if (!i) return [];
|
|
350
350
|
const o = t.fontSize || 16, l = (t.containerText || "").split(`
|
|
351
|
-
`), f = Math.max(1, ...l.map((c) => c.length)),
|
|
351
|
+
`), f = Math.max(1, ...l.map((c) => c.length)), s = Math.max(40, f * o * 0.6 + 24), a = Math.max(o * 1.6, l.length * o * 1.25 + 8);
|
|
352
352
|
return i.wrap = !1, i.anchor = "ctr", i.paragraphs.forEach((c) => {
|
|
353
353
|
c.align = "ctr";
|
|
354
354
|
}), [{
|
|
@@ -356,10 +356,10 @@ function Vt(t, n, e, r) {
|
|
|
356
356
|
id: e.nextId++,
|
|
357
357
|
name: `${A(t)} label`,
|
|
358
358
|
textBox: !0,
|
|
359
|
-
x: n.x - e.ox -
|
|
360
|
-
y: n.y - e.oy -
|
|
361
|
-
w:
|
|
362
|
-
h:
|
|
359
|
+
x: n.x - e.ox - s / 2,
|
|
360
|
+
y: n.y - e.oy - a / 2,
|
|
361
|
+
w: s,
|
|
362
|
+
h: a,
|
|
363
363
|
geom: { kind: "preset", prst: "rect" },
|
|
364
364
|
fill: { kind: "none" },
|
|
365
365
|
line: null,
|
|
@@ -367,27 +367,27 @@ function Vt(t, n, e, r) {
|
|
|
367
367
|
}];
|
|
368
368
|
}
|
|
369
369
|
function qt(t, n, e) {
|
|
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
|
+
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, s = n.y - e.oy;
|
|
371
|
+
for (let a = 0; a < 4; a++) {
|
|
372
|
+
let [c, u] = l[a];
|
|
373
373
|
t.flipH && (c = -c), t.flipV && (u = -u);
|
|
374
|
-
const
|
|
375
|
-
if (Math.hypot(
|
|
374
|
+
const p = r + c * Math.cos(o) - u * Math.sin(o), d = i + c * Math.sin(o) + u * Math.cos(o);
|
|
375
|
+
if (Math.hypot(p - f, d - s) <= 2) return a;
|
|
376
376
|
}
|
|
377
377
|
return -1;
|
|
378
378
|
}
|
|
379
379
|
function Jt(t, n, e) {
|
|
380
380
|
const r = e.x - n.x, i = e.y - n.y, o = Math.hypot(r, i);
|
|
381
381
|
if (!(o > 0)) return !1;
|
|
382
|
-
const l = (
|
|
383
|
-
return t.every((
|
|
382
|
+
const l = (a, c) => Math.abs((a - n.x) * i - (c - n.y) * r) / o, f = (a, c) => ((a - n.x) * r + (c - n.y) * i) / (o * o), s = (a, c) => l(a, c) <= 0.5 && f(a, c) >= -0.01 && f(a, c) <= 1.01;
|
|
383
|
+
return t.every((a) => a.op === "Z" ? !1 : a.op === "C" ? s(a.x1, a.y1) && s(a.x2, a.y2) && s(a.x, a.y) : s(a.x, a.y));
|
|
384
384
|
}
|
|
385
385
|
function Kt(t, n) {
|
|
386
386
|
const e = (t.opacity ?? 100) / 100, r = N(t, e, !0), i = bt(t), o = [];
|
|
387
387
|
if (r) {
|
|
388
|
-
const l = t.type === "arrow", f = l ? t.startArrowhead : null,
|
|
388
|
+
const l = t.type === "arrow", f = l ? t.startArrowhead : null, s = l ? t.endArrowhead || (t.startArrowhead ? null : "arrow") : null, a = { ...r, head: J(f, G(t, "start"), t.strokeWidth), tail: J(s, G(t, "end"), t.strokeWidth) };
|
|
389
389
|
if (!i.d || Jt(F(i.d), i.start, i.end)) {
|
|
390
|
-
const { start: c, end: u } = i,
|
|
390
|
+
const { start: c, end: u } = i, p = {
|
|
391
391
|
kind: "connector",
|
|
392
392
|
id: n.nextId++,
|
|
393
393
|
name: A(t),
|
|
@@ -398,31 +398,31 @@ function Kt(t, n) {
|
|
|
398
398
|
flipH: u.x < c.x || void 0,
|
|
399
399
|
flipV: u.y < c.y || void 0,
|
|
400
400
|
geom: { kind: "preset", prst: "straightConnector1" },
|
|
401
|
-
line:
|
|
402
|
-
}, d = (
|
|
403
|
-
const
|
|
404
|
-
if (!
|
|
405
|
-
const k = qt(
|
|
406
|
-
return k >= 0 ? { id:
|
|
401
|
+
line: a
|
|
402
|
+
}, d = (h, x) => {
|
|
403
|
+
const g = h?.elementId ? n.ids.get(h.elementId) : void 0;
|
|
404
|
+
if (!g) return;
|
|
405
|
+
const k = qt(g.item, x, n);
|
|
406
|
+
return k >= 0 ? { id: g.id, idx: k } : void 0;
|
|
407
407
|
};
|
|
408
408
|
n.glue.push(() => {
|
|
409
|
-
|
|
410
|
-
}), o.push(
|
|
409
|
+
p.start = d(t.startBinding, c), p.end = d(t.endBinding, u);
|
|
410
|
+
}), o.push(p);
|
|
411
411
|
} else {
|
|
412
412
|
const c = F(i.d), u = j(c);
|
|
413
413
|
if (u) {
|
|
414
|
-
const
|
|
414
|
+
const p = Math.max(u.maxX - u.minX, 0.01), d = Math.max(u.maxY - u.minY, 0.01);
|
|
415
415
|
o.push({
|
|
416
416
|
kind: "shape",
|
|
417
417
|
id: n.nextId++,
|
|
418
418
|
name: A(t),
|
|
419
419
|
x: u.minX - n.ox,
|
|
420
420
|
y: u.minY - n.oy,
|
|
421
|
-
w:
|
|
421
|
+
w: p,
|
|
422
422
|
h: d,
|
|
423
423
|
geom: { kind: "custom", paths: [{ cmds: I(c, -u.minX, -u.minY), fill: !1 }] },
|
|
424
424
|
fill: { kind: "none" },
|
|
425
|
-
line:
|
|
425
|
+
line: a
|
|
426
426
|
});
|
|
427
427
|
}
|
|
428
428
|
}
|
|
@@ -434,14 +434,14 @@ function Qt(t, n) {
|
|
|
434
434
|
const e = (t.opacity ?? 100) / 100, r = Mt(t.points), i = N(t, e, !0);
|
|
435
435
|
if (r.length < 2 || !i) return [];
|
|
436
436
|
i.cap = "rnd", i.join = "round";
|
|
437
|
-
const o = r.map((
|
|
437
|
+
const o = r.map((p) => p.x), l = r.map((p) => p.y), f = Math.min(...o), s = Math.min(...l), a = Math.max(Math.max(...o) - f, 0.01), c = Math.max(Math.max(...l) - s, 0.01), u = r.map((p, d) => ({ op: d ? "L" : "M", x: p.x - f, y: p.y - s }));
|
|
438
438
|
return n.report.native++, [{
|
|
439
439
|
kind: "shape",
|
|
440
440
|
id: n.nextId++,
|
|
441
441
|
name: A(t),
|
|
442
442
|
x: t.x + f - n.ox,
|
|
443
|
-
y: t.y +
|
|
444
|
-
w:
|
|
443
|
+
y: t.y + s - n.oy,
|
|
444
|
+
w: a,
|
|
445
445
|
h: c,
|
|
446
446
|
rot: t.angle ? t.angle * 180 / Math.PI : void 0,
|
|
447
447
|
geom: { kind: "custom", paths: [{ cmds: u, fill: !1 }] },
|
|
@@ -471,7 +471,7 @@ const nn = (t) => {
|
|
|
471
471
|
return e.length === 6 && e.every(Number.isFinite) ? e : [1, 0, 0, 1, 0, 0];
|
|
472
472
|
}, Q = (t, n, e) => ({ x: t[0] * n + t[2] * e + t[4], y: t[1] * n + t[3] * e + t[5] });
|
|
473
473
|
function en(t) {
|
|
474
|
-
const n =
|
|
474
|
+
const n = zt.generator(), e = (i) => {
|
|
475
475
|
for (const o of n.toPaths(i))
|
|
476
476
|
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
477
|
return i;
|
|
@@ -495,28 +495,28 @@ function rn(t) {
|
|
|
495
495
|
fillStyle: Y[n] ? "solid" : t.fillStyle
|
|
496
496
|
}, r = new St();
|
|
497
497
|
try {
|
|
498
|
-
const
|
|
499
|
-
At(en(r),
|
|
498
|
+
const a = document.createElement("canvas");
|
|
499
|
+
At(en(r), a.getContext("2d"), e, !1, 1, r);
|
|
500
500
|
} catch {
|
|
501
501
|
return null;
|
|
502
502
|
}
|
|
503
503
|
if (r.failed) return null;
|
|
504
504
|
const i = /* @__PURE__ */ new Map();
|
|
505
|
-
for (const
|
|
506
|
-
const o = (
|
|
507
|
-
const u = i.get(
|
|
505
|
+
for (const a of Array.from(r.defs.children)) a.id && i.set(a.id, a);
|
|
506
|
+
const o = (a, c) => {
|
|
507
|
+
const u = i.get(a.replace(/^url\(#|\)$/g, ""));
|
|
508
508
|
if (!u) return null;
|
|
509
|
-
const
|
|
510
|
-
if (!
|
|
509
|
+
const p = Array.from(u.children).map((d) => ({ pos: +(d.getAttribute("offset") || 0), color: S(d.getAttribute("stop-color")) ?? { hex: "#000000", alpha: 0 } }));
|
|
510
|
+
if (!p.length) return null;
|
|
511
511
|
if (u.tagName.toLowerCase() === "lineargradient") {
|
|
512
|
-
const d = Q(c, +u.getAttribute("x1"), +u.getAttribute("y1")),
|
|
513
|
-
return { kind: "linear", x1: d.x, y1: d.y, x2:
|
|
512
|
+
const d = Q(c, +u.getAttribute("x1"), +u.getAttribute("y1")), h = Q(c, +u.getAttribute("x2"), +u.getAttribute("y2"));
|
|
513
|
+
return { kind: "linear", x1: d.x, y1: d.y, x2: h.x, y2: h.y, stops: p };
|
|
514
514
|
}
|
|
515
|
-
return { kind: "radial", x1: 0, y1: 0, x2: 0, y2: 0, stops:
|
|
515
|
+
return { kind: "radial", x1: 0, y1: 0, x2: 0, y2: 0, stops: p };
|
|
516
516
|
}, l = [];
|
|
517
517
|
let f = "ok";
|
|
518
|
-
const
|
|
519
|
-
for (const c of Array.from(
|
|
518
|
+
const s = (a) => {
|
|
519
|
+
for (const c of Array.from(a.children)) {
|
|
520
520
|
if (f !== "ok") return;
|
|
521
521
|
const u = c.tagName.toLowerCase();
|
|
522
522
|
if (u === "g") {
|
|
@@ -524,30 +524,30 @@ function rn(t) {
|
|
|
524
524
|
f = "picture";
|
|
525
525
|
return;
|
|
526
526
|
}
|
|
527
|
-
|
|
527
|
+
s(c);
|
|
528
528
|
continue;
|
|
529
529
|
}
|
|
530
530
|
if (u === "text" || u === "image") {
|
|
531
531
|
f = "picture";
|
|
532
532
|
return;
|
|
533
533
|
}
|
|
534
|
-
let
|
|
535
|
-
if (u === "path")
|
|
534
|
+
let p = null;
|
|
535
|
+
if (u === "path") p = c.getAttribute("d");
|
|
536
536
|
else if (u === "rect") {
|
|
537
537
|
const b = +c.getAttribute("x"), M = +c.getAttribute("y"), w = +c.getAttribute("width"), v = +c.getAttribute("height");
|
|
538
|
-
|
|
538
|
+
p = `M ${b} ${M} L ${b + w} ${M} L ${b + w} ${M + v} L ${b} ${M + v} Z`;
|
|
539
539
|
} else {
|
|
540
540
|
f = "fail";
|
|
541
541
|
return;
|
|
542
542
|
}
|
|
543
|
-
const d = nn(c.getAttribute("transform")),
|
|
544
|
-
if (!
|
|
545
|
-
const
|
|
543
|
+
const d = nn(c.getAttribute("transform")), h = pt(F(p || ""), d);
|
|
544
|
+
if (!h.length) continue;
|
|
545
|
+
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
546
|
l.push({
|
|
547
|
-
cmds:
|
|
548
|
-
fill:
|
|
549
|
-
grad: k ? o(
|
|
550
|
-
stroke:
|
|
547
|
+
cmds: h,
|
|
548
|
+
fill: x && x !== "none" && !k ? x : null,
|
|
549
|
+
grad: k ? o(x, d) : null,
|
|
550
|
+
stroke: g && g !== "none" ? g : null,
|
|
551
551
|
fillAlpha: Number.isFinite(m) ? m : 1,
|
|
552
552
|
strokeAlpha: Number.isFinite(y) ? y : 1,
|
|
553
553
|
width: +(c.getAttribute("stroke-width") || 1) * Math.sqrt(Math.abs(d[0] * d[3] - d[1] * d[2])),
|
|
@@ -556,7 +556,7 @@ function rn(t) {
|
|
|
556
556
|
});
|
|
557
557
|
}
|
|
558
558
|
};
|
|
559
|
-
return
|
|
559
|
+
return s(r.root), f === "ok" ? l : f === "picture" ? "picture" : null;
|
|
560
560
|
}
|
|
561
561
|
const tt = (t, n) => {
|
|
562
562
|
if (!t || !n) return !1;
|
|
@@ -564,13 +564,13 @@ const tt = (t, n) => {
|
|
|
564
564
|
return !!e && !!r && e[0] === r[0] && e[1] === r[1] && e[2] === r[2];
|
|
565
565
|
};
|
|
566
566
|
function on(t, n, e) {
|
|
567
|
-
const r = t.stops.map((
|
|
567
|
+
const r = t.stops.map((h) => ({ pos: h.pos, color: e < 1 ? { ...h.color, alpha: (h.color.alpha ?? 1) * e } : h.color }));
|
|
568
568
|
if (t.kind === "radial") return { kind: "radial", stops: r };
|
|
569
569
|
const i = t.x2 - t.x1, o = t.y2 - t.y1, l = Math.hypot(i, o);
|
|
570
570
|
if (!(l > 0)) return { kind: "solid", color: r[r.length - 1].color };
|
|
571
|
-
const f = i / l,
|
|
571
|
+
const f = i / l, s = o / l, a = (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) * s)) / 2;
|
|
572
572
|
if (!(u > 0)) return { kind: "solid", color: r[0].color };
|
|
573
|
-
const
|
|
573
|
+
const p = (h) => ((t.x1 + i * h - a) * f + (t.y1 + o * h - c) * s + u) / (2 * u), d = [...r].sort((h, x) => h.pos - x.pos).map((h) => ({ pos: p(h.pos), color: h.color }));
|
|
574
574
|
return { kind: "linear", angle: Math.atan2(o, i) * 180 / Math.PI, stops: ut(d) };
|
|
575
575
|
}
|
|
576
576
|
function ut(t) {
|
|
@@ -599,28 +599,28 @@ function sn(t, n) {
|
|
|
599
599
|
const e = (t.opacity ?? 100) / 100, r = Z(t, n), i = ft(t, e);
|
|
600
600
|
let o = jt(t);
|
|
601
601
|
if (!o) {
|
|
602
|
-
const f = wt(t),
|
|
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 = cn(t,
|
|
602
|
+
const f = wt(t), s = f ? Ht(f, t.width, t.height) : [], a = rn(t);
|
|
603
|
+
if (a === "picture") return null;
|
|
604
|
+
if (a && a.length) {
|
|
605
|
+
const c = Math.min(t.x, t.x + t.width), u = Math.min(t.y, t.y + t.height), p = s.length ? s.filter((m) => m.fill !== !1).map((m) => I(m.cmds, c, u)) : null, d = !!ot(t), h = ["linear", "radial", "conic"].includes(t.fillStyle);
|
|
606
|
+
if (!a.every((m) => (!m.grad || h) && 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 === d))) {
|
|
607
|
+
const m = cn(t, a, r, i, n, e, p);
|
|
608
608
|
return m ? [m] : null;
|
|
609
609
|
}
|
|
610
|
-
const
|
|
611
|
-
for (let m = 0; m <
|
|
612
|
-
const y =
|
|
610
|
+
const g = [], k = (m) => I(m, -c, -u);
|
|
611
|
+
for (let m = 0; m < a.length; m++) {
|
|
612
|
+
const y = a[m], b = a[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
613
|
if (y.fill || y.grad) {
|
|
614
|
-
const v = dt(y,
|
|
614
|
+
const v = dt(y, p);
|
|
615
615
|
if (!v) return null;
|
|
616
|
-
v.length === 1 && v[0] === y.cmds ?
|
|
616
|
+
v.length === 1 && v[0] === y.cmds ? g.push(...H({ cmds: k(y.cmds), stroke: w ? void 0 : !1 })) : (g.push(...v.map((R) => ({ cmds: k(R), stroke: !1 }))), w && g.push({ cmds: k(y.cmds), fill: !1 }));
|
|
617
617
|
} else
|
|
618
|
-
|
|
618
|
+
g.push({ cmds: k(y.cmds), fill: !1, stroke: w ? void 0 : !1 });
|
|
619
619
|
M && m++;
|
|
620
620
|
}
|
|
621
|
-
o = { kind: "custom", paths:
|
|
622
|
-
} else if (
|
|
623
|
-
o = { kind: "custom", paths:
|
|
621
|
+
o = { kind: "custom", paths: g };
|
|
622
|
+
} else if (s.length)
|
|
623
|
+
o = { kind: "custom", paths: s.flatMap(H) };
|
|
624
624
|
else return null;
|
|
625
625
|
}
|
|
626
626
|
const l = {
|
|
@@ -644,8 +644,8 @@ function D(t, n, e) {
|
|
|
644
644
|
if (!B) return r;
|
|
645
645
|
const i = t.map((o) => new Path2D(an(o)));
|
|
646
646
|
for (let o = 0; o < z; o++) for (let l = 0; l < z; l++) {
|
|
647
|
-
const f = e.minX + (l + 0.5) / z * (e.maxX - e.minX),
|
|
648
|
-
r.push(i.some((
|
|
647
|
+
const f = e.minX + (l + 0.5) / z * (e.maxX - e.minX), s = e.minY + (o + 0.5) / z * (e.maxY - e.minY);
|
|
648
|
+
r.push(i.some((a) => B.isPointInPath(a, f, s, n)));
|
|
649
649
|
}
|
|
650
650
|
return r;
|
|
651
651
|
}
|
|
@@ -659,28 +659,28 @@ function dt(t, n) {
|
|
|
659
659
|
}
|
|
660
660
|
function cn(t, n, e, r, i, o, l) {
|
|
661
661
|
const f = [];
|
|
662
|
-
for (let
|
|
663
|
-
const
|
|
662
|
+
for (let s = 0; s < n.length; s++) {
|
|
663
|
+
const a = n[s], c = n[s + 1], u = !!((a.fill || a.grad) && !a.stroke && c && c.stroke && !c.fill && !c.grad && E(c) === E(a)), p = u ? c : a, d = j(a.cmds);
|
|
664
664
|
if (!d) continue;
|
|
665
|
-
const
|
|
665
|
+
const h = Math.max(d.maxX - d.minX, 0.01), x = Math.max(d.maxY - d.minY, 0.01), g = S(a.fill, o * a.fillAlpha), k = a.grad ? on(a.grad, d, o) : g ? { kind: "solid", color: g } : { kind: "none" }, m = S(p.stroke, o * p.strokeAlpha), y = m ? { width: p.width, color: m, dash: p.dash ? "dash" : void 0, join: "round", cap: "rnd" } : null, b = !!(a.fill || a.grad), M = (v) => I(v, -d.minX, -d.minY);
|
|
666
666
|
let w;
|
|
667
667
|
if (b) {
|
|
668
|
-
const v = dt(
|
|
668
|
+
const v = dt(a, l);
|
|
669
669
|
if (!v) return null;
|
|
670
|
-
w = v.length === 1 && v[0] ===
|
|
671
|
-
} else w = [{ cmds: M(
|
|
670
|
+
w = v.length === 1 && v[0] === a.cmds ? H({ cmds: M(a.cmds), stroke: m ? void 0 : !1 }) : [...v.map((R) => ({ cmds: M(R), stroke: !1 })), ...m ? [{ cmds: M(a.cmds), fill: !1 }] : []];
|
|
671
|
+
} else w = [{ cmds: M(a.cmds), fill: !1, stroke: m ? void 0 : !1 }];
|
|
672
672
|
f.push({
|
|
673
673
|
kind: "shape",
|
|
674
674
|
id: i.nextId++,
|
|
675
675
|
name: `${A(t)} part`,
|
|
676
676
|
x: d.minX - i.ox,
|
|
677
677
|
y: d.minY - i.oy,
|
|
678
|
-
w:
|
|
679
|
-
h:
|
|
678
|
+
w: h,
|
|
679
|
+
h: x,
|
|
680
680
|
geom: { kind: "custom", paths: w },
|
|
681
681
|
fill: k,
|
|
682
682
|
line: y
|
|
683
|
-
}), u &&
|
|
683
|
+
}), u && s++;
|
|
684
684
|
}
|
|
685
685
|
return r && f.push({
|
|
686
686
|
kind: "shape",
|
|
@@ -727,11 +727,11 @@ function ht(t, n, e) {
|
|
|
727
727
|
}
|
|
728
728
|
let f = i;
|
|
729
729
|
for (; f < t.length && o(t[f]) === l; ) f++;
|
|
730
|
-
const
|
|
731
|
-
if (
|
|
732
|
-
const
|
|
730
|
+
const s = ht(t.slice(i, f), n + 1, e);
|
|
731
|
+
if (s.length > 1) {
|
|
732
|
+
const a = fn(s), c = { kind: "group", id: e.nextId++, name: t[i].groupNames?.[l] || "Group", ...a, children: s };
|
|
733
733
|
r.push(c);
|
|
734
|
-
} else r.push(...
|
|
734
|
+
} else r.push(...s);
|
|
735
735
|
i = f;
|
|
736
736
|
}
|
|
737
737
|
return r;
|
|
@@ -774,8 +774,8 @@ function dn(t, n) {
|
|
|
774
774
|
if (i && r === "solid")
|
|
775
775
|
return { kind: "solid", color: S(e.backgroundColor === "transparent" ? "#ffffff" : e.backgroundColor || "#ffffff") ?? { hex: "#ffffff" } };
|
|
776
776
|
if (i && (r === "linear" || r === "radial") && (e.gradientStops?.length ?? 0) > 0) {
|
|
777
|
-
const f = e.gradientDirection || 0,
|
|
778
|
-
return r === "radial" ? { kind: "radial", stops:
|
|
777
|
+
const f = e.gradientDirection || 0, s = e.gradientStops.map((a) => ({ pos: a.offset, color: S(a.color) ?? { hex: "#ffffff" } }));
|
|
778
|
+
return r === "radial" ? { kind: "radial", stops: s } : { kind: "linear", stops: hn(s, f, t.w, t.h), angle: f };
|
|
779
779
|
}
|
|
780
780
|
const o = n.rasterizeBackground?.(e), l = o ? _(o) : null;
|
|
781
781
|
return l ? { kind: "image", media: l } : { kind: "solid", color: S(e.backgroundColor) ?? { hex: "#ffffff" } };
|
|
@@ -783,12 +783,12 @@ function dn(t, n) {
|
|
|
783
783
|
function hn(t, n, e, r) {
|
|
784
784
|
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;
|
|
785
785
|
if (!(l > 0) || t.length < 2) return t;
|
|
786
|
-
const f = [...t].sort((
|
|
786
|
+
const f = [...t].sort((s, a) => s.pos - a.pos).map((s) => ({ pos: (-o + 2 * o * s.pos + l) / (2 * l), color: s.color }));
|
|
787
787
|
return ut(f);
|
|
788
788
|
}
|
|
789
789
|
function pn(t, n, e) {
|
|
790
|
-
const r = T(t.hex), i = T(n.hex), o = [0, 1, 2].map((
|
|
791
|
-
return
|
|
790
|
+
const r = T(t.hex), i = T(n.hex), o = [0, 1, 2].map((a) => Math.round(r[a] + (i[a] - r[a]) * e)), l = t.alpha ?? 1, f = n.alpha ?? 1, s = l + (f - l) * e;
|
|
791
|
+
return s < 0.999 ? { hex: L(o), alpha: s } : { hex: L(o) };
|
|
792
792
|
}
|
|
793
793
|
function gn(t, n, e) {
|
|
794
794
|
const r = { ox: t.x, oy: t.y, nextId: 2, ids: /* @__PURE__ */ new Map(), glue: [], hooks: n, report: e }, i = ht(t.elements, 0, r);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as o, b as m, d as b, z as W, h as z, g as a, i as U, j as B } from "./index-
|
|
1
|
+
import { s as o, b as m, d as b, z as W, h as z, g as a, i as U, j as B } from "./index-OCtbNe3Y.js";
|
|
2
2
|
const h = /* @__PURE__ */ new Set(), x = [], G = {
|
|
3
3
|
ArrowLeft: "left",
|
|
4
4
|
a: "left",
|
|
@@ -240,17 +240,17 @@ function X() {
|
|
|
240
240
|
t && B(t.id);
|
|
241
241
|
},
|
|
242
242
|
playAnim: (n, t) => {
|
|
243
|
-
n?.alive && import("./index-
|
|
243
|
+
n?.alive && import("./index-OCtbNe3Y.js").then((r) => r.aQ).then((r) => r.sequenceAnimator.playAnimation(n.id, { id: `bhv-${Date.now()}`, type: "preset", name: t, trigger: "programmatic" }, () => {
|
|
244
244
|
}));
|
|
245
245
|
},
|
|
246
246
|
goToPage: (n) => {
|
|
247
247
|
n >= 0 && n < o.slides.length && U(n);
|
|
248
248
|
},
|
|
249
249
|
sound: (n) => {
|
|
250
|
-
import("./index-
|
|
250
|
+
import("./index-OCtbNe3Y.js").then((t) => t.aR).then((t) => t.playSfx(n));
|
|
251
251
|
},
|
|
252
252
|
music: (n) => {
|
|
253
|
-
import("./index-
|
|
253
|
+
import("./index-OCtbNe3Y.js").then((t) => t.aR).then((t) => n ? t.startMusic() : t.stopMusic());
|
|
254
254
|
},
|
|
255
255
|
end: (n) => {
|
|
256
256
|
if (P(!0), n) {
|
|
@@ -316,7 +316,7 @@ ${i}`);
|
|
|
316
316
|
return y = requestAnimationFrame(n), !0;
|
|
317
317
|
}
|
|
318
318
|
function p() {
|
|
319
|
-
if (y !== null && (cancelAnimationFrame(y), y = null), window.removeEventListener("keydown", L, !0), window.removeEventListener("keyup", K, !0), import("./index-
|
|
319
|
+
if (y !== null && (cancelAnimationFrame(y), y = null), window.removeEventListener("keydown", L, !0), window.removeEventListener("keyup", K, !0), import("./index-OCtbNe3Y.js").then((e) => e.aR).then((e) => e.stopMusic()), h.clear(), w = [], x.length = 0, v.length = 0, g) {
|
|
320
320
|
const e = g;
|
|
321
321
|
g = null, b(() => {
|
|
322
322
|
a("elements", JSON.parse(e.elements)), a("selection", e.selection), a("activeSlideIndex", e.activeSlideIndex), a("appMode", e.appMode), a("gameActive", !1);
|