@algorisys/yappydraw 0.8.293 → 0.8.294

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.
Files changed (26) hide show
  1. package/README.md +2 -2
  2. package/chunks/{canva-ai-B5NJGMGr.js → canva-ai-DqccAnxC.js} +1 -1
  3. package/chunks/{choice-dialog-state-Cw0WShhc.js → choice-dialog-state-10-yA9qy.js} +1 -1
  4. package/chunks/{custgeom-BeeylhzV.js → custgeom-gp_HWEYw.js} +13 -10
  5. package/chunks/{design-generator-BSZ2XUOE.js → design-generator-DIyJ4Dr0.js} +1 -1
  6. package/chunks/{drawing-engine-DfASJ_gK.js → drawing-engine-nqE0zI8L.js} +1 -1
  7. package/chunks/{drawings-store-cl-M93Eh.js → drawings-store-BFtMld-q.js} +1 -1
  8. package/chunks/{ds-operations-CXoS_Obn.js → ds-operations-40JYI4lM.js} +1 -1
  9. package/chunks/{export-game-BTjE-uv-.js → export-game-5Kek7Bol.js} +1 -1
  10. package/chunks/{from-yappy-hUcG5auS.js → from-yappy-ChRzxzZ9.js} +98 -88
  11. package/chunks/{game-runtime-33Ly0Axb.js → game-runtime--zmzKmmo.js} +37 -37
  12. package/chunks/{import-Dk___UKU.js → import-DGbhv-Je.js} +571 -507
  13. package/chunks/{index-OCtbNe3Y.js → index-v2rH-W8-.js} +40108 -39488
  14. package/chunks/{lucide-solid-Btzt68l9.js → lucide-solid-BHWkJbay.js} +1 -1
  15. package/chunks/markdown-to-slides-siI6fZd3.js +122 -0
  16. package/chunks/{morph-animator-CWLzpuUc.js → morph-animator-klLNQx0a.js} +1 -1
  17. package/chunks/{onboarding-tour-eLES7UJM.js → onboarding-tour-CV0e3oyB.js} +1 -1
  18. package/chunks/{pdf-vector-C1l03NEO.js → pdf-vector-DLxGyE10.js} +1 -1
  19. package/chunks/{search-tbh5OqVp.js → search-53sGgwDp.js} +2 -2
  20. package/chunks/{slide-generator-CZfB2tSO.js → slide-generator-BttJgv2N.js} +1 -1
  21. package/chunks/{turntable-ai-CeD-w_eE.js → turntable-ai-7udakZBz.js} +1 -1
  22. package/chunks/write-CIGfHqn4.js +254 -0
  23. package/package.json +1 -1
  24. package/yappy.js +1 -1
  25. package/chunks/markdown-to-slides-CNpwNPE8.js +0 -96
  26. package/chunks/write-BUtbdS9L.js +0 -212
@@ -1,6 +1,6 @@
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
- function Lt(t) {
1
+ import { a1 as et, a2 as pt, a3 as mt, a4 as xt, a5 as gt, a6 as yt, a7 as kt, a8 as bt, a9 as G, aa as Mt, ab as wt, ac as vt, ad as St, ae as At, af as $t, ag as It, ah as Ct, ai as Tt, aj as Pt, ak as zt, al as Ft } from "./index-v2rH-W8-.js";
2
+ import { d as F, g as j, t as C, h as Lt } from "./custgeom-gp_HWEYw.js";
3
+ function Et(t) {
4
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;
@@ -11,7 +11,7 @@ function Lt(t) {
11
11
  b: y(m)
12
12
  };
13
13
  }
14
- function O(t) {
14
+ function R(t) {
15
15
  const n = Math.abs(t), e = n > 31308e-7 ? 1.055 * Math.pow(n, 1 / 2.4) - 0.055 : 12.92 * n;
16
16
  return t < 0 ? -e : e;
17
17
  }
@@ -22,12 +22,12 @@ function X(t) {
22
22
  function V(t, n, e) {
23
23
  const r = X(t), i = X(n), o = X(e);
24
24
  return {
25
- r: O(1.2249401762805083 * r - 0.2249401762805082 * i),
26
- g: O(-0.04205697751522136 * r + 1.0420569775152215 * i),
27
- b: O(-0.019637554590334 * r - 0.07863604555063188 * i + 1.0982736001409656 * o)
25
+ r: R(1.2249401762805083 * r - 0.2249401762805082 * i),
26
+ g: R(-0.04205697751522136 * r + 1.0420569775152215 * i),
27
+ b: R(-0.019637554590334 * r - 0.07863604555063188 * i + 1.0982736001409656 * o)
28
28
  };
29
29
  }
30
- function Et(t) {
30
+ function Ot(t) {
31
31
  return t.endsWith("%") ? parseFloat(t) / 100 : parseFloat(t);
32
32
  }
33
33
  function T(t) {
@@ -40,7 +40,7 @@ function T(t) {
40
40
  }
41
41
  const e = (o) => Math.round(Math.max(0, Math.min(1, o)) * 255), r = n.match(/^color\(\s*(display-p3|srgb)\s+([^/)]+?)\s*(?:\/[^)]*)?\)$/);
42
42
  if (r) {
43
- const o = r[2].split(/[\s,]+/).filter(Boolean).map(Et);
43
+ const o = r[2].split(/[\s,]+/).filter(Boolean).map(Ot);
44
44
  if (o.length < 3 || o.some((c) => !isFinite(c))) return null;
45
45
  const [l, f, s] = o;
46
46
  if (r[1] === "srgb") return [e(l), e(f), e(s)];
@@ -53,7 +53,7 @@ function T(t) {
53
53
  if (o.length < 3) return null;
54
54
  const l = o[0].endsWith("%") ? parseFloat(o[0]) / 100 : parseFloat(o[0]), f = parseFloat(o[1]), s = parseFloat(o[2]);
55
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 })));
56
+ const a = V(...(({ r: c, g: u, b: p }) => [c, u, p])(Et({ l, c: f, h: s })));
57
57
  return [e(a.r), e(a.g), e(a.b)];
58
58
  }
59
59
  return Rt(n);
@@ -79,7 +79,7 @@ function Rt(t) {
79
79
  return P.size < 512 && P.set(t, n), n;
80
80
  }
81
81
  const L = (t) => "#" + t.map((n) => n.toString(16).padStart(2, "0")).join("");
82
- function Ot(t) {
82
+ function Xt(t) {
83
83
  const n = t.trim().toLowerCase(), e = n.match(/^#([0-9a-f]{8})$/);
84
84
  if (e) return parseInt(e[1].slice(6), 16) / 255;
85
85
  const r = n.match(/^#([0-9a-f]{4})$/);
@@ -100,10 +100,10 @@ function S(t, n = 1) {
100
100
  if (!t) return null;
101
101
  const e = T(t);
102
102
  if (!e) return null;
103
- const r = Ot(t) * n;
103
+ const r = Xt(t) * n;
104
104
  return r <= 0 ? null : r < 0.999 ? { hex: L(e), alpha: r } : { hex: L(e) };
105
105
  }
106
- const rt = (t) => mt(t).split(",")[0].trim().replace(/^['"]|['"]$/g, "") || "Calibri", Y = {
106
+ const rt = (t) => pt(t).split(",")[0].trim().replace(/^['"]|['"]$/g, "") || "Calibri", Y = {
107
107
  hachure: "ltUpDiag",
108
108
  zigzag: "ltUpDiag",
109
109
  "zigzag-line": "ltUpDiag",
@@ -111,7 +111,7 @@ const rt = (t) => mt(t).split(",")[0].trim().replace(/^['"]|['"]$/g, "") || "Cal
111
111
  "cross-hatch": "diagCross",
112
112
  dots: "pct20"
113
113
  };
114
- function Xt(t, n) {
114
+ function Bt(t, n) {
115
115
  const e = t.fillStyle || "solid";
116
116
  if ((e === "linear" || e === "radial" || e === "conic") && (t.gradientStops?.length ?? 0) > 0) {
117
117
  const i = t.gradientStops.map((o) => ({ pos: Math.max(0, Math.min(1, o.offset)), color: S(o.color, n) ?? { hex: "#000000", alpha: 0 } }));
@@ -150,21 +150,21 @@ function st(t, n) {
150
150
  return t.split(`
151
151
  `).map((e) => ({ runs: e ? [{ text: e }] : [], align: n }));
152
152
  }
153
- function Bt(t) {
153
+ function Dt(t) {
154
154
  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
155
  return n + e;
156
156
  }
157
- let C;
158
- function Dt(t, n) {
159
- if (C === void 0 && (C = typeof document < "u" ? document.createElement("canvas").getContext("2d") : null), C)
160
- return C.font = n, C.measureText(t).width;
157
+ let I;
158
+ function Yt(t, n) {
159
+ if (I === void 0 && (I = typeof document < "u" ? document.createElement("canvas").getContext("2d") : null), I)
160
+ return I.font = n, I.measureText(t).width;
161
161
  const e = Number(/(\d+(?:\.\d+)?)px/.exec(n)?.[1] ?? 16);
162
162
  return t.length * e * 0.6;
163
163
  }
164
- function Yt(t, n, e, r) {
164
+ function Wt(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 s = Bt(t);
167
+ const s = Dt(t);
168
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) {
@@ -178,14 +178,14 @@ function Yt(t, n, e, r) {
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 s = Pt(Dt, t, r), a = () => {
181
+ const s = Pt(Yt, t, r), a = () => {
182
182
  i.push(o), o = { runs: [], align: n }, l = !1;
183
183
  };
184
184
  for (const c of t)
185
185
  String(c.text ?? "").split(`
186
186
  `).forEach((p, d) => {
187
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);
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, Wt(c, e, f, s)), f = o.bullet === "num" ? { level: o.level ?? 0, scheme: o.numType ?? "arabicPeriod", index: c.listIndex || 1 } : null);
189
189
  const h = { text: p };
190
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
191
  const x = S(c.color, e);
@@ -201,12 +201,12 @@ function ct(t, n, e) {
201
201
  size: e,
202
202
  color: r,
203
203
  font: rt(t.fontFamily),
204
- bold: Ct(t.fontWeight) >= 600 ? !0 : void 0,
204
+ bold: It(t.fontWeight) >= 600 ? !0 : void 0,
205
205
  italic: $t(t.fontStyle) === "italic" ? !0 : void 0
206
206
  };
207
207
  }
208
- const lt = (t) => It(t) / Tt;
209
- function Wt(t, n) {
208
+ const lt = (t) => Ct(t) / Tt;
209
+ function Ht(t, n) {
210
210
  const e = t.richText && t.richText.length > 0, r = U(t.textAlign, e ? "ctr" : "l");
211
211
  return {
212
212
  paragraphs: e ? at(t.richText, r, n, { fontSize: t.fontSize || 20, fontFamily: t.fontFamily || "sans-serif" }) : st(t.text || "", r),
@@ -230,9 +230,9 @@ function ft(t, n) {
230
230
  defaults: ct(t, n, t.fontSize || 16)
231
231
  };
232
232
  }
233
- function Ht(t, n, e) {
233
+ function jt(t, n, e) {
234
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);
235
+ const u = C(F(s), i, o);
236
236
  if (u.length === 0) return;
237
237
  const p = a, d = { fill: p.noFill ? !1 : void 0, stroke: p.noStroke ? !1 : void 0 };
238
238
  if (c) {
@@ -267,7 +267,7 @@ function Ht(t, n, e) {
267
267
  };
268
268
  return f(t), r;
269
269
  }
270
- function jt(t) {
270
+ function Nt(t) {
271
271
  if (t.warp || t.points && t.points.length) return null;
272
272
  if (t.type === "circle") return { kind: "preset", prst: "ellipse" };
273
273
  if (t.type === "rectangle") {
@@ -280,10 +280,10 @@ function jt(t) {
280
280
  }
281
281
  return null;
282
282
  }
283
- const Nt = /* @__PURE__ */ new Set(["umlClass", "umlInterface", "qrCode", "video", "codeBlock"]), Ut = /* @__PURE__ */ new Set(["fineliner", "inkbrush", "marker", "ink"]), _t = /* @__PURE__ */ new Set(["text", "richtext", "image", "line", "arrow"]);
284
- function Zt(t) {
283
+ const Ut = /* @__PURE__ */ new Set(["umlClass", "umlInterface", "qrCode", "video", "codeBlock"]), _t = /* @__PURE__ */ new Set(["fineliner", "inkbrush", "marker", "ink"]), Zt = /* @__PURE__ */ new Set(["text", "richtext", "image", "line", "arrow"]);
284
+ function Gt(t) {
285
285
  const n = t;
286
- if (Nt.has(t.type) || t.clipMaskId || t.shadowEnabled || t.glowEnabled || (t.featherRadius ?? 0) > 0 || t.blendMode && t.blendMode !== "normal" || t.shearX || t.shearY || xt(t) || gt(t) || yt(t) || kt(t) || t.appearance && (t.appearance.fills?.length ?? 0) + (t.appearance.strokes?.length ?? 0) > 0) return !0;
286
+ if (Ut.has(t.type) || t.clipMaskId || t.shadowEnabled || t.glowEnabled || (t.featherRadius ?? 0) > 0 || t.blendMode && t.blendMode !== "normal" || t.shearX || t.shearY || xt(t) || gt(t) || yt(t) || kt(t) || t.appearance && (t.appearance.fills?.length ?? 0) + (t.appearance.strokes?.length ?? 0) > 0) return !0;
287
287
  const e = t.fillStyle;
288
288
  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
289
  if (t.type === "image") {
@@ -330,7 +330,7 @@ function W(t, n, e) {
330
330
  const r = n.hooks.rasterize(t), i = r ? _(r.dataURL) : null;
331
331
  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
332
  }
333
- function Gt(t, n) {
333
+ function Vt(t, n) {
334
334
  const e = _(t.dataURL);
335
335
  if (!e) return W([t], n, A(t));
336
336
  let r;
@@ -344,7 +344,7 @@ function Gt(t, n) {
344
344
  const i = (t.opacity ?? 100) / 100;
345
345
  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
346
  }
347
- function Vt(t, n, e, r) {
347
+ function qt(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(`
@@ -366,7 +366,7 @@ function Vt(t, n, e, r) {
366
366
  text: i
367
367
  }];
368
368
  }
369
- function qt(t, n, e) {
369
+ function Jt(t, n, e) {
370
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
371
  for (let a = 0; a < 4; a++) {
372
372
  let [c, u] = l[a];
@@ -376,17 +376,17 @@ function qt(t, n, e) {
376
376
  }
377
377
  return -1;
378
378
  }
379
- function Jt(t, n, e) {
379
+ function Kt(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
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
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
- function Kt(t, n) {
385
+ function Qt(t, n) {
386
386
  const e = (t.opacity ?? 100) / 100, r = N(t, e, !0), i = bt(t), o = [];
387
387
  if (r) {
388
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
- if (!i.d || Jt(F(i.d), i.start, i.end)) {
389
+ if (!i.d || Kt(F(i.d), i.start, i.end)) {
390
390
  const { start: c, end: u } = i, p = {
391
391
  kind: "connector",
392
392
  id: n.nextId++,
@@ -402,7 +402,7 @@ function Kt(t, n) {
402
402
  }, d = (h, x) => {
403
403
  const g = h?.elementId ? n.ids.get(h.elementId) : void 0;
404
404
  if (!g) return;
405
- const k = qt(g.item, x, n);
405
+ const k = Jt(g.item, x, n);
406
406
  return k >= 0 ? { id: g.id, idx: k } : void 0;
407
407
  };
408
408
  n.glue.push(() => {
@@ -420,7 +420,7 @@ function Kt(t, n) {
420
420
  y: u.minY - n.oy,
421
421
  w: p,
422
422
  h: d,
423
- geom: { kind: "custom", paths: [{ cmds: I(c, -u.minX, -u.minY), fill: !1 }] },
423
+ geom: { kind: "custom", paths: [{ cmds: C(c, -u.minX, -u.minY), fill: !1 }] },
424
424
  fill: { kind: "none" },
425
425
  line: a
426
426
  });
@@ -428,9 +428,9 @@ function Kt(t, n) {
428
428
  }
429
429
  n.report.native++;
430
430
  }
431
- return o.push(...Vt(t, i.mid, n, e)), o;
431
+ return o.push(...qt(t, i.mid, n, e)), o;
432
432
  }
433
- function Qt(t, n) {
433
+ function tn(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";
@@ -449,7 +449,7 @@ function Qt(t, n) {
449
449
  line: i
450
450
  }];
451
451
  }
452
- function tn(t, n) {
452
+ function nn(t, n) {
453
453
  const e = (t.opacity ?? 100) / 100;
454
454
  if (!(t.text || t.richText && t.richText.length > 0)) return [];
455
455
  n.report.native++;
@@ -463,14 +463,14 @@ function tn(t, n) {
463
463
  geom: { kind: "preset", prst: "rect" },
464
464
  fill: i ? { kind: "solid", color: i } : { kind: "none" },
465
465
  line: null,
466
- text: Wt(t, e)
466
+ text: Ht(t, e)
467
467
  }];
468
468
  }
469
- const nn = (t) => {
469
+ const en = (t) => {
470
470
  const n = t && /matrix\(([^)]+)\)/.exec(t), e = n ? n[1].split(/[\s,]+/).map(Number) : [];
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
- function en(t) {
473
+ function rn(t) {
474
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();
@@ -480,7 +480,7 @@ function en(t) {
480
480
  r[i] = (...o) => e(n[i](...o));
481
481
  return r;
482
482
  }
483
- function rn(t) {
483
+ function on(t) {
484
484
  const n = t.fillStyle, e = {
485
485
  ...t,
486
486
  renderStyle: "architectural",
@@ -496,7 +496,7 @@ function rn(t) {
496
496
  }, r = new St();
497
497
  try {
498
498
  const a = document.createElement("canvas");
499
- At(en(r), a.getContext("2d"), e, !1, 1, r);
499
+ At(rn(r), a.getContext("2d"), e, !1, 1, r);
500
500
  } catch {
501
501
  return null;
502
502
  }
@@ -540,7 +540,7 @@ function rn(t) {
540
540
  f = "fail";
541
541
  return;
542
542
  }
543
- const d = nn(c.getAttribute("transform")), h = pt(F(p || ""), d);
543
+ const d = en(c.getAttribute("transform")), h = Lt(F(p || ""), d);
544
544
  if (!h.length) continue;
545
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({
@@ -563,7 +563,7 @@ const tt = (t, n) => {
563
563
  const e = T(t), r = T(n);
564
564
  return !!e && !!r && e[0] === r[0] && e[1] === r[1] && e[2] === r[2];
565
565
  };
566
- function on(t, n, e) {
566
+ function sn(t, n, e) {
567
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);
@@ -579,7 +579,7 @@ function ut(t) {
579
579
  if (e <= t[0].pos) return t[0].color;
580
580
  for (let r = 1; r < t.length; r++) {
581
581
  const i = t[r - 1], o = t[r];
582
- if (e <= o.pos) return pn(i.color, o.color, o.pos > i.pos ? (e - i.pos) / (o.pos - i.pos) : 0);
582
+ if (e <= o.pos) return mn(i.color, o.color, o.pos > i.pos ? (e - i.pos) / (o.pos - i.pos) : 0);
583
583
  }
584
584
  return t[t.length - 1].color;
585
585
  };
@@ -595,25 +595,25 @@ function H(t) {
595
595
  return t.stroke !== !1 && r.push({ cmds: t.cmds, fill: !1, stroke: t.stroke }), r;
596
596
  }
597
597
  const E = (t) => JSON.stringify(t.cmds);
598
- function sn(t, n) {
598
+ function an(t, n) {
599
599
  const e = (t.opacity ?? 100) / 100, r = Z(t, n), i = ft(t, e);
600
- let o = jt(t);
600
+ let o = Nt(t);
601
601
  if (!o) {
602
- const f = wt(t), s = f ? Ht(f, t.width, t.height) : [], a = rn(t);
602
+ const f = wt(t), s = f ? jt(f, t.width, t.height) : [], a = on(t);
603
603
  if (a === "picture") return null;
604
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);
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) => C(m.cmds, c, u)) : null, d = !!ot(t), h = ["linear", "radial", "conic"].includes(t.fillStyle);
606
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);
607
+ const m = ln(t, a, r, i, n, e, p);
608
608
  return m ? [m] : null;
609
609
  }
610
- const g = [], k = (m) => I(m, -c, -u);
610
+ const g = [], k = (m) => C(m, -c, -u);
611
611
  for (let m = 0; m < a.length; m++) {
612
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
614
  const v = dt(y, p);
615
615
  if (!v) return null;
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 }));
616
+ 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
617
  } else
618
618
  g.push({ cmds: k(y.cmds), fill: !1, stroke: w ? void 0 : !1 });
619
619
  M && m++;
@@ -629,20 +629,20 @@ function sn(t, n) {
629
629
  name: A(t),
630
630
  ...r,
631
631
  geom: o,
632
- fill: Xt(t, e),
632
+ fill: Bt(t, e),
633
633
  line: N(t, e),
634
634
  text: i
635
635
  };
636
636
  return n.ids.set(t.id, { id: l.id, item: l }), n.report.native++, [l];
637
637
  }
638
- const an = (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(" ");
638
+ const cn = (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(" ");
639
639
  let B = null;
640
640
  const z = 28;
641
641
  function D(t, n, e) {
642
642
  B ??= document.createElement("canvas").getContext("2d");
643
643
  const r = [];
644
644
  if (!B) return r;
645
- const i = t.map((o) => new Path2D(an(o)));
645
+ const i = t.map((o) => new Path2D(cn(o)));
646
646
  for (let o = 0; o < z; o++) for (let l = 0; l < z; l++) {
647
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
648
  r.push(i.some((a) => B.isPointInPath(a, f, s, n)));
@@ -657,17 +657,17 @@ function dt(t, n) {
657
657
  const r = D([t.cmds], "nonzero", e);
658
658
  return nt(r, D([t.cmds], "evenodd", e)) === 0 ? [t.cmds] : n && nt(r, D(n, "evenodd", e)) <= 0.03 ? n : null;
659
659
  }
660
- function cn(t, n, e, r, i, o, l) {
660
+ function ln(t, n, e, r, i, o, l) {
661
661
  const f = [];
662
662
  for (let s = 0; s < n.length; s++) {
663
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 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);
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 ? sn(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) => C(v, -d.minX, -d.minY);
666
666
  let w;
667
667
  if (b) {
668
668
  const v = dt(a, l);
669
669
  if (!v) return null;
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 }] : []];
670
+ w = v.length === 1 && v[0] === a.cmds ? H({ cmds: M(a.cmds), stroke: m ? void 0 : !1 }) : [...v.map((O) => ({ cmds: M(O), stroke: !1 })), ...m ? [{ cmds: M(a.cmds), fill: !1 }] : []];
671
671
  } else w = [{ cmds: M(a.cmds), fill: !1, stroke: m ? void 0 : !1 }];
672
672
  f.push({
673
673
  kind: "shape",
@@ -697,15 +697,15 @@ function cn(t, n, e, r, i, o, l) {
697
697
  text: r
698
698
  }), i.report.native++, { kind: "group", id: i.nextId++, name: A(t), ...e, children: f };
699
699
  }
700
- function ln(t, n) {
701
- if (Zt(t)) return W([t], n, A(t));
700
+ function fn(t, n) {
701
+ if (Gt(t)) return W([t], n, A(t));
702
702
  try {
703
- if (t.type === "text" || t.type === "richtext") return tn(t, n);
704
- if (t.type === "image") return Gt(t, n);
705
- if (t.type === "line" || t.type === "arrow") return Kt(t, n);
706
- if (Ut.has(t.type)) return Qt(t, n);
707
- if (!_t.has(t.type)) {
708
- const e = sn(t, n);
703
+ if (t.type === "text" || t.type === "richtext") return nn(t, n);
704
+ if (t.type === "image") return Vt(t, n);
705
+ if (t.type === "line" || t.type === "arrow") return Qt(t, n);
706
+ if (_t.has(t.type)) return tn(t, n);
707
+ if (!Zt.has(t.type)) {
708
+ const e = an(t, n);
709
709
  if (e) return e;
710
710
  }
711
711
  } catch {
@@ -722,27 +722,29 @@ function ht(t, n, e) {
722
722
  for (; i < t.length; ) {
723
723
  const l = o(t[i]);
724
724
  if (!l) {
725
- r.push(...ln(t[i], e)), i++;
725
+ const a = fn(t[i], e), c = xn(t[i].link);
726
+ if (c) for (const u of a) u.link = c;
727
+ r.push(...a), i++;
726
728
  continue;
727
729
  }
728
730
  let f = i;
729
731
  for (; f < t.length && o(t[f]) === l; ) f++;
730
732
  const s = ht(t.slice(i, f), n + 1, e);
731
733
  if (s.length > 1) {
732
- const a = fn(s), c = { kind: "group", id: e.nextId++, name: t[i].groupNames?.[l] || "Group", ...a, children: s };
734
+ const a = un(s), c = { kind: "group", id: e.nextId++, name: t[i].groupNames?.[l] || "Group", ...a, children: s };
733
735
  r.push(c);
734
736
  } else r.push(...s);
735
737
  i = f;
736
738
  }
737
739
  return r;
738
740
  }
739
- function fn(t) {
741
+ function un(t) {
740
742
  let n = 1 / 0, e = 1 / 0, r = -1 / 0, i = -1 / 0;
741
743
  for (const o of t)
742
744
  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);
743
745
  return { x: n, y: e, w: Math.max(0, r - n), h: Math.max(0, i - e) };
744
746
  }
745
- function un(t) {
747
+ function dn(t) {
746
748
  if (!t || t.type === "none") return;
747
749
  const n = t.duration ?? 500;
748
750
  switch (t.type) {
@@ -764,7 +766,7 @@ function un(t) {
764
766
  return;
765
767
  }
766
768
  }
767
- function dn(t, n) {
769
+ function hn(t, n) {
768
770
  const e = t.slide;
769
771
  if (!e) {
770
772
  const f = S(t.background);
@@ -775,40 +777,48 @@ function dn(t, n) {
775
777
  return { kind: "solid", color: S(e.backgroundColor === "transparent" ? "#ffffff" : e.backgroundColor || "#ffffff") ?? { hex: "#ffffff" } };
776
778
  if (i && (r === "linear" || r === "radial") && (e.gradientStops?.length ?? 0) > 0) {
777
779
  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 };
780
+ return r === "radial" ? { kind: "radial", stops: s } : { kind: "linear", stops: pn(s, f, t.w, t.h), angle: f };
779
781
  }
780
782
  const o = n.rasterizeBackground?.(e), l = o ? _(o) : null;
781
783
  return l ? { kind: "image", media: l } : { kind: "solid", color: S(e.backgroundColor) ?? { hex: "#ffffff" } };
782
784
  }
783
- function hn(t, n, e, r) {
785
+ function pn(t, n, e, r) {
784
786
  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
787
  if (!(l > 0) || t.length < 2) return t;
786
788
  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
789
  return ut(f);
788
790
  }
789
- function pn(t, n, e) {
791
+ function mn(t, n, e) {
790
792
  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
793
  return s < 0.999 ? { hex: L(o), alpha: s } : { hex: L(o) };
792
794
  }
793
- function gn(t, n, e) {
795
+ function xn(t) {
796
+ const n = mt(t);
797
+ if (n.kind === "url") return { kind: "url", url: n.url };
798
+ if (n.kind === "slide") return { kind: "slide", key: n.slideId };
799
+ if (n.kind === "action") return { kind: "action", action: n.action };
800
+ }
801
+ function kn(t, n, e) {
794
802
  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);
795
803
  return r.glue.forEach((o) => o()), {
796
804
  name: t.name,
797
805
  items: i,
798
- background: dn(t, n),
799
- transition: un(t.slide?.transition)
806
+ background: hn(t, n),
807
+ transition: dn(t.slide?.transition),
808
+ notes: t.slide?.notes?.trim() ? t.slide.notes : void 0,
809
+ key: t.slide?.id
800
810
  };
801
811
  }
802
- function yn(t, n, e, r) {
812
+ function bn(t, n, e, r) {
803
813
  const i = Math.min(e / Math.max(t, 1), r / Math.max(n, 1));
804
814
  return { scale: i, dx: (e - t * i) / 2, dy: (r - n * i) / 2 };
805
815
  }
806
816
  export {
807
- yn as fitInto,
817
+ bn as fitInto,
808
818
  _ as mediaOf,
809
- gn as pageToSlide,
810
- hn as remapPageStops,
819
+ kn as pageToSlide,
820
+ pn as remapPageStops,
811
821
  S as toColor,
812
- un as transitionOf,
822
+ dn as transitionOf,
813
823
  rt as typefaceOf
814
824
  };