@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.
Files changed (26) hide show
  1. package/README.md +2 -2
  2. package/chunks/anim-map-D7T1mIAM.js +111 -0
  3. package/chunks/{canva-ai-kg789_jz.js → canva-ai-cwK_LwEk.js} +1 -1
  4. package/chunks/{choice-dialog-state-ByeMPVwB.js → choice-dialog-state-CF9ddIAk.js} +1 -1
  5. package/chunks/{custgeom-CEAI2znd.js → custgeom-N1NlyQKZ.js} +1 -1
  6. package/chunks/{design-generator-zF-F-iCB.js → design-generator-DSEgwQ7i.js} +1 -1
  7. package/chunks/{drawing-engine-U5zBcwtj.js → drawing-engine-CPFaJPyz.js} +1 -1
  8. package/chunks/{drawings-store-CZSZCNqP.js → drawings-store-CxGNbTN7.js} +1 -1
  9. package/chunks/{ds-operations-_c-HiYjk.js → ds-operations-BTcGLr6X.js} +1 -1
  10. package/chunks/{export-game-CgMvNkoa.js → export-game-BVjxTYD1.js} +1 -1
  11. package/chunks/{from-yappy-Dd2p9P6N.js → from-yappy-kTebD-0Y.js} +271 -239
  12. package/chunks/{game-runtime-CH3yVPDc.js → game-runtime-Ch0y0mLm.js} +27 -27
  13. package/chunks/{import-C3P7glRz.js → import-eCGTFoVi.js} +711 -623
  14. package/chunks/{index-B_V19zDs.js → index-zg1eC33A.js} +23253 -23073
  15. package/chunks/{lucide-solid-DfQVDBtM.js → lucide-solid-DAmszm-d.js} +1 -1
  16. package/chunks/{markdown-to-slides-B5OASdqg.js → markdown-to-slides-CGvmGrK2.js} +1 -1
  17. package/chunks/{morph-animator-b1aFWI5O.js → morph-animator-BQPPQ08b.js} +1 -1
  18. package/chunks/{onboarding-tour-j-RhQYNM.js → onboarding-tour-CpRCV3Ub.js} +1 -1
  19. package/chunks/{pdf-vector-CzrRoyPR.js → pdf-vector-D65OC03c.js} +1 -1
  20. package/chunks/{search-B7AUhYCm.js → search-rp-eRNJ6.js} +2 -2
  21. package/chunks/{slide-generator-AO60zi1f.js → slide-generator-Ctxdc9Yn.js} +5 -5
  22. package/chunks/{turntable-ai-DddsPGTo.js → turntable-ai-ZhAGEjzz.js} +1 -1
  23. package/chunks/write-ZW6FSyj1.js +327 -0
  24. package/package.json +1 -1
  25. package/yappy.js +1 -1
  26. package/chunks/write-uweO04Cm.js +0 -265
@@ -1,9 +1,10 @@
1
- import { u as fe, a as de } from "./browser-DbZP-BrN.js";
2
- import { E as z, i as Ct, g as ue } from "./custgeom-CEAI2znd.js";
3
- import { aq as he, ar as Lt, as as pe, at as me, M as ge, q as xe, K as be } from "./index-B_V19zDs.js";
4
- const ye = 1e4, ke = 1e5, qt = 6e4, nt = (t) => t / qt * (Math.PI / 180);
5
- function Zt(t, n, e, o = {}) {
6
- const s = /* @__PURE__ */ new Map(), r = Math.max(0, n), a = Math.max(0, e), i = Math.min(r, a), l = Math.max(r, a), x = {
1
+ import { u as he, a as pe } from "./browser-DbZP-BrN.js";
2
+ import { e as me, s as Ft, f as ge } from "./anim-map-D7T1mIAM.js";
3
+ import { E as z, i as Tt, g as xe } from "./custgeom-N1NlyQKZ.js";
4
+ import { ar as be, as as Dt, at as ye, au as ke, M as we, q as Me, K as ve } from "./index-zg1eC33A.js";
5
+ const Se = 1e4, Ce = 1e5, Qt = 6e4, nt = (t) => t / Qt * (Math.PI / 180);
6
+ function Jt(t, n, e, o = {}) {
7
+ const s = /* @__PURE__ */ new Map(), r = Math.max(0, n), a = Math.max(0, e), i = Math.min(r, a), l = Math.max(r, a), p = {
7
8
  w: r,
8
9
  h: a,
9
10
  l: 0,
@@ -22,28 +23,28 @@ function Zt(t, n, e, o = {}) {
22
23
  "5cd8": 135e5,
23
24
  "7cd8": 189e5
24
25
  };
25
- for (const [m, g] of Object.entries(x)) s.set(m, g);
26
- for (const m of [2, 3, 4, 5, 6, 8, 10, 12, 16, 32])
27
- s.set(`wd${m}`, r / m), s.set(`hd${m}`, a / m), s.set(`ssd${m}`, i / m);
28
- const b = (m) => {
29
- const g = s.get(m);
30
- if (g !== void 0) return g;
31
- const f = /^(wd|hd|ssd)(\d+)$/.exec(m);
26
+ for (const [g, b] of Object.entries(p)) s.set(g, b);
27
+ for (const g of [2, 3, 4, 5, 6, 8, 10, 12, 16, 32])
28
+ s.set(`wd${g}`, r / g), s.set(`hd${g}`, a / g), s.set(`ssd${g}`, i / g);
29
+ const x = (g) => {
30
+ const b = s.get(g);
31
+ if (b !== void 0) return b;
32
+ const f = /^(wd|hd|ssd)(\d+)$/.exec(g);
32
33
  if (f) {
33
- const y = f[1] === "wd" ? r : f[1] === "hd" ? a : i, u = Number(f[2]);
34
- return u ? y / u : 0;
34
+ const y = f[1] === "wd" ? r : f[1] === "hd" ? a : i, d = Number(f[2]);
35
+ return d ? y / d : 0;
35
36
  }
36
- const h = Number(m);
37
+ const h = Number(g);
37
38
  return Number.isFinite(h) ? h : 0;
38
- }, d = (m, g) => {
39
- s.size > ye || s.set(m, we(g, b));
39
+ }, u = (g, b) => {
40
+ s.size > Se || s.set(g, Pe(b, x));
40
41
  };
41
- for (const [m, g] of t.av ?? []) d(m, o[m] ?? g);
42
- for (const [m, g] of Object.entries(o)) s.has(m) || d(m, g);
43
- for (const [m, g] of t.gd ?? []) d(m, g);
42
+ for (const [g, b] of t.av ?? []) u(g, o[g] ?? b);
43
+ for (const [g, b] of Object.entries(o)) s.has(g) || u(g, b);
44
+ for (const [g, b] of t.gd ?? []) u(g, b);
44
45
  return s;
45
46
  }
46
- function we(t, n) {
47
+ function Pe(t, n) {
47
48
  const e = String(t || "").trim().split(/\s+/), o = e[0], [s, r, a] = e.slice(1).map(n);
48
49
  let i;
49
50
  switch (o) {
@@ -66,7 +67,7 @@ function we(t, n) {
66
67
  i = Math.abs(s);
67
68
  break;
68
69
  case "at2":
69
- i = Math.atan2(r, s) * 180 / Math.PI * qt;
70
+ i = Math.atan2(r, s) * 180 / Math.PI * Qt;
70
71
  break;
71
72
  case "cat2":
72
73
  i = s * Math.cos(Math.atan2(a, r));
@@ -103,74 +104,74 @@ function we(t, n) {
103
104
  }
104
105
  return Number.isFinite(i) ? i : 0;
105
106
  }
106
- const Et = (t, n, e) => Math.atan2(n * Math.sin(t), e * Math.cos(t));
107
- function ft(t, n, e, o = {}) {
108
- const s = Math.max(Math.abs(n), 0) * z, r = Math.max(Math.abs(e), 0) * z, a = Zt(t, s, r, o), i = (b) => typeof b == "number" ? b : a.get(b) ?? (Number.isFinite(Number(b)) ? Number(b) : 0), l = [];
109
- let x = ke;
110
- for (const b of t.paths) {
111
- const d = b.w ? s / b.w : 1, m = b.h ? r / b.h : 1, g = (p) => i(p) * d / z, f = (p) => i(p) * m / z, h = [];
112
- let y = { x: 0, y: 0 }, u = { x: 0, y: 0 };
113
- for (const p of b.d) {
114
- if (--x < 0) break;
115
- switch (p[0]) {
107
+ const jt = (t, n, e) => Math.atan2(n * Math.sin(t), e * Math.cos(t));
108
+ function ut(t, n, e, o = {}) {
109
+ const s = Math.max(Math.abs(n), 0) * z, r = Math.max(Math.abs(e), 0) * z, a = Jt(t, s, r, o), i = (x) => typeof x == "number" ? x : a.get(x) ?? (Number.isFinite(Number(x)) ? Number(x) : 0), l = [];
110
+ let p = Ce;
111
+ for (const x of t.paths) {
112
+ const u = x.w ? s / x.w : 1, g = x.h ? r / x.h : 1, b = (m) => i(m) * u / z, f = (m) => i(m) * g / z, h = [];
113
+ let y = { x: 0, y: 0 }, d = { x: 0, y: 0 };
114
+ for (const m of x.d) {
115
+ if (--p < 0) break;
116
+ switch (m[0]) {
116
117
  case "M":
117
- y = { x: g(p[1]), y: f(p[2]) }, u = y, h.push({ op: "M", ...y });
118
+ y = { x: b(m[1]), y: f(m[2]) }, d = y, h.push({ op: "M", ...y });
118
119
  break;
119
120
  case "L":
120
- y = { x: g(p[1]), y: f(p[2]) }, h.push({ op: "L", ...y });
121
+ y = { x: b(m[1]), y: f(m[2]) }, h.push({ op: "L", ...y });
121
122
  break;
122
123
  case "C": {
123
- const w = g(p[1]), M = f(p[2]), S = g(p[3]), v = f(p[4]);
124
- y = { x: g(p[5]), y: f(p[6]) }, h.push({ op: "C", x1: w, y1: M, x2: S, y2: v, ...y });
124
+ const w = b(m[1]), M = f(m[2]), S = b(m[3]), v = f(m[4]);
125
+ y = { x: b(m[5]), y: f(m[6]) }, h.push({ op: "C", x1: w, y1: M, x2: S, y2: v, ...y });
125
126
  break;
126
127
  }
127
128
  case "Q": {
128
- const w = g(p[1]), M = f(p[2]), S = g(p[3]), v = f(p[4]);
129
+ const w = b(m[1]), M = f(m[2]), S = b(m[3]), v = f(m[4]);
129
130
  h.push({ op: "C", x1: y.x + 2 / 3 * (w - y.x), y1: y.y + 2 / 3 * (M - y.y), x2: S + 2 / 3 * (w - S), y2: v + 2 / 3 * (M - v), x: S, y: v }), y = { x: S, y: v };
130
131
  break;
131
132
  }
132
133
  case "A": {
133
- const w = i(p[1]) * d / z, M = i(p[2]) * m / z;
134
- y = Me(h, y, w, M, i(p[3]), i(p[4]));
134
+ const w = i(m[1]) * u / z, M = i(m[2]) * g / z;
135
+ y = Te(h, y, w, M, i(m[3]), i(m[4]));
135
136
  break;
136
137
  }
137
138
  case "Z":
138
- h.push({ op: "Z" }), y = u;
139
+ h.push({ op: "Z" }), y = d;
139
140
  break;
140
141
  }
141
142
  }
142
- h.length && l.push({ cmds: h, fill: b.fill === "none" ? !1 : void 0, stroke: b.stroke === !1 ? !1 : void 0 });
143
+ h.length && l.push({ cmds: h, fill: x.fill === "none" ? !1 : void 0, stroke: x.stroke === !1 ? !1 : void 0 });
143
144
  }
144
145
  return l;
145
146
  }
146
- function Me(t, n, e, o, s, r) {
147
+ function Te(t, n, e, o, s, r) {
147
148
  if (Math.abs(e) < 1e-9 || Math.abs(o) < 1e-9 || r === 0) return n;
148
- const a = nt(s), i = Math.max(-4 * Math.PI, Math.min(4 * Math.PI, nt(r))), l = Et(a, e, o);
149
- let x = Et(a + i, e, o);
150
- if (Math.abs(i) >= 2 * Math.PI - 1e-9) x = l + Math.sign(i) * 2 * Math.PI;
149
+ const a = nt(s), i = Math.max(-4 * Math.PI, Math.min(4 * Math.PI, nt(r))), l = jt(a, e, o);
150
+ let p = jt(a + i, e, o);
151
+ if (Math.abs(i) >= 2 * Math.PI - 1e-9) p = l + Math.sign(i) * 2 * Math.PI;
151
152
  else {
152
- for (; i > 0 && x < l; ) x += 2 * Math.PI;
153
- for (; i < 0 && x > l; ) x -= 2 * Math.PI;
153
+ for (; i > 0 && p < l; ) p += 2 * Math.PI;
154
+ for (; i < 0 && p > l; ) p -= 2 * Math.PI;
154
155
  }
155
- const b = n.x - e * Math.cos(l), d = n.y - o * Math.sin(l), m = x - l, g = Math.max(1, Math.min(16, Math.ceil(Math.abs(m) / (Math.PI / 2)))), f = m / g, h = 4 / 3 * Math.tan(f / 4);
156
- let y = l, u = n;
157
- for (let p = 0; p < g; p++) {
158
- const w = y + f, M = Math.cos(y), S = Math.sin(y), v = Math.cos(w), N = Math.sin(w);
159
- u = { x: b + e * v, y: d + o * N }, t.push({ op: "C", x1: b + e * (M - h * S), y1: d + o * (S + h * M), x2: b + e * (v + h * N), y2: d + o * (N - h * v), ...u }), y = w;
156
+ const x = n.x - e * Math.cos(l), u = n.y - o * Math.sin(l), g = p - l, b = Math.max(1, Math.min(16, Math.ceil(Math.abs(g) / (Math.PI / 2)))), f = g / b, h = 4 / 3 * Math.tan(f / 4);
157
+ let y = l, d = n;
158
+ for (let m = 0; m < b; m++) {
159
+ const w = y + f, M = Math.cos(y), S = Math.sin(y), v = Math.cos(w), I = Math.sin(w);
160
+ d = { x: x + e * v, y: u + o * I }, t.push({ op: "C", x1: x + e * (M - h * S), y1: u + o * (S + h * M), x2: x + e * (v + h * I), y2: u + o * (I - h * v), ...d }), y = w;
160
161
  }
161
- return u;
162
+ return d;
162
163
  }
163
- function Kt(t, n, e, o = {}) {
164
+ function te(t, n, e, o = {}) {
164
165
  const s = Math.abs(n), r = Math.abs(e);
165
166
  if (!t.rect) return { l: 0, t: 0, r: s, b: r };
166
- const a = Zt(t, s * z, r * z, o), i = (m) => (a.get(m) ?? (Number.isFinite(Number(m)) ? Number(m) : 0)) / z, [l, x, b, d] = t.rect.map(i);
167
- return { l, t: x, r: b, b: d };
167
+ const a = Jt(t, s * z, r * z, o), i = (g) => (a.get(g) ?? (Number.isFinite(Number(g)) ? Number(g) : 0)) / z, [l, p, x, u] = t.rect.map(i);
168
+ return { l, t: p, r: x, b: u };
168
169
  }
169
- let Ft = null;
170
- async function ve() {
171
- return Ft ??= (await import("./presets-DP49P8i2.js")).default, Ft;
170
+ let $t = null;
171
+ async function Ie() {
172
+ return $t ??= (await import("./presets-DP49P8i2.js")).default, $t;
172
173
  }
173
- const jt = 5e4, Se = 256 * 1024 * 1024, Dt = 1024 * 1024 * 1024, Ce = 1e4, Pe = 32, Te = 2e4, I = (t, n) => {
174
+ const Bt = 5e4, Ne = 256 * 1024 * 1024, zt = 1024 * 1024 * 1024, Oe = 1e4, Ae = 32, Le = 2e4, N = (t, n) => {
174
175
  if (!t) return [];
175
176
  const e = [];
176
177
  for (let o = t.firstChild; o; o = o.nextSibling)
@@ -180,7 +181,7 @@ const jt = 5e4, Se = 256 * 1024 * 1024, Dt = 1024 * 1024 * 1024, Ce = 1e4, Pe =
180
181
  if (!t) return null;
181
182
  for (let e = t.firstChild; e; e = e.nextSibling) if (e.nodeType === 1 && e.localName === n) return e;
182
183
  return null;
183
- }, R = (t, ...n) => {
184
+ }, A = (t, ...n) => {
184
185
  let e = t;
185
186
  for (const o of n) e = c(e, o);
186
187
  return e ?? null;
@@ -200,16 +201,16 @@ const jt = 5e4, Se = 256 * 1024 * 1024, Dt = 1024 * 1024 * 1024, Ce = 1e4, Pe =
200
201
  }, B = (t, n) => {
201
202
  const e = k(t, n);
202
203
  return e === null ? void 0 : e === "1" || e === "true" || e === "on";
203
- }, E = (t) => t / z, Ie = /* @__PURE__ */ new Set(["p14", "a14", "a16"]);
204
- function Ne(t) {
204
+ }, R = (t) => t / z, Ee = /* @__PURE__ */ new Set(["p14", "a14", "a16"]);
205
+ function Re(t) {
205
206
  if (t.localName !== "AlternateContent") return [t];
206
207
  const n = c(t, "Fallback");
207
- for (const e of I(t, "Choice"))
208
- if ((k(e, "Requires") || "").split(/\s+/).filter(Boolean).every((s) => Ie.has(s))) return I(e);
209
- return I(n);
208
+ for (const e of N(t, "Choice"))
209
+ if ((k(e, "Requires") || "").split(/\s+/).filter(Boolean).every((s) => Ee.has(s))) return N(e);
210
+ return N(n);
210
211
  }
211
- const J = (t) => I(t).flatMap(Ne);
212
- class Oe {
212
+ const V = (t) => N(t).flatMap(Re);
213
+ class Fe {
213
214
  files;
214
215
  text = /* @__PURE__ */ new Map();
215
216
  relCache = /* @__PURE__ */ new Map();
@@ -229,7 +230,7 @@ class Oe {
229
230
  let s = null;
230
231
  if (o) {
231
232
  try {
232
- const r = de(o).replace(/^/, "");
233
+ const r = pe(o).replace(/^/, "");
233
234
  s = /<!DOCTYPE/i.test(r.slice(0, 2048)) ? null : this.parseXml(r), s && s.getElementsByTagName("parsererror").length && (s = null);
234
235
  } catch {
235
236
  s = null;
@@ -246,11 +247,11 @@ class Oe {
246
247
  if (o) return o;
247
248
  o = /* @__PURE__ */ new Map();
248
249
  const s = e.includes("/") ? e.slice(0, e.lastIndexOf("/")) : "", r = e.slice(e.lastIndexOf("/") + 1), a = this.xml(`${s ? s + "/" : ""}_rels/${r}.rels`);
249
- for (const i of I(a, "Relationship")) {
250
- const l = k(i, "Id"), x = k(i, "Type") || "", b = k(i, "Target") || "";
250
+ for (const i of N(a, "Relationship")) {
251
+ const l = k(i, "Id"), p = k(i, "Type") || "", x = k(i, "Target") || "";
251
252
  if (!l) continue;
252
- const d = k(i, "TargetMode") === "External";
253
- o.set(l, { type: x.slice(x.lastIndexOf("/") + 1), target: d ? b : Re(s, b), external: d });
253
+ const u = k(i, "TargetMode") === "External";
254
+ o.set(l, { type: p.slice(p.lastIndexOf("/") + 1), target: u ? x : De(s, x), external: u });
254
255
  }
255
256
  return this.relCache.set(e, o), o;
256
257
  }
@@ -260,7 +261,7 @@ class Oe {
260
261
  }
261
262
  }
262
263
  const et = (t) => t.replace(/\\/g, "/").replace(/^\/+/, "");
263
- function Re(t, n) {
264
+ function De(t, n) {
264
265
  let e = n.split("#")[0];
265
266
  try {
266
267
  e = decodeURIComponent(e);
@@ -272,21 +273,21 @@ function Re(t, n) {
272
273
  r === ".." ? s.pop() : r && r !== "." && s.push(r);
273
274
  return s.join("/");
274
275
  }
275
- const Pt = { bg1: "lt1", tx1: "dk1", bg2: "lt2", tx2: "dk2" };
276
- function gt(t) {
276
+ const It = { bg1: "lt1", tx1: "dk1", bg2: "lt2", tx2: "dk2" };
277
+ function xt(t) {
277
278
  const n = { colors: {}, major: "Calibri Light", minor: "Calibri", fills: [], lines: [], bgFills: [] }, e = c(t, "themeElements");
278
- for (const r of I(c(e, "clrScheme"))) {
279
- const a = I(r)[0];
279
+ for (const r of N(c(e, "clrScheme"))) {
280
+ const a = N(r)[0];
280
281
  if (!a) continue;
281
282
  const i = a.localName === "sysClr" ? k(a, "lastClr") : k(a, "val");
282
283
  i && /^[0-9a-f]{6}$/i.test(i) && (n.colors[r.localName] = "#" + i.toLowerCase());
283
284
  }
284
285
  const o = c(e, "fontScheme");
285
- n.major = k(R(o, "majorFont", "latin"), "typeface") || n.major, n.minor = k(R(o, "minorFont", "latin"), "typeface") || n.minor;
286
+ n.major = k(A(o, "majorFont", "latin"), "typeface") || n.major, n.minor = k(A(o, "minorFont", "latin"), "typeface") || n.minor;
286
287
  const s = c(e, "fmtScheme");
287
- return n.fills = I(c(s, "fillStyleLst")), n.lines = I(c(s, "lnStyleLst")), n.bgFills = I(c(s, "bgFillStyleLst")), n;
288
+ return n.fills = N(c(s, "fillStyleLst")), n.lines = N(c(s, "lnStyleLst")), n.bgFills = N(c(s, "bgFillStyleLst")), n;
288
289
  }
289
- const Ae = {
290
+ const je = {
290
291
  black: "#000000",
291
292
  white: "#ffffff",
292
293
  red: "#ff0000",
@@ -311,27 +312,27 @@ const Ae = {
311
312
  lightGray: "#d3d3d3",
312
313
  dkGray: "#a9a9a9",
313
314
  ltGray: "#d3d3d3"
314
- }, Qt = (t) => {
315
+ }, ee = (t) => {
315
316
  const n = t.replace("#", "");
316
317
  return [parseInt(n.slice(0, 2), 16) || 0, parseInt(n.slice(2, 4), 16) || 0, parseInt(n.slice(4, 6), 16) || 0];
317
- }, ct = (t, n, e) => "#" + [t, n, e].map((o) => Math.max(0, Math.min(255, Math.round(o))).toString(16).padStart(2, "0")).join(""), ot = (t) => (t /= 255, t <= 0.04045 ? t / 12.92 : Math.pow((t + 0.055) / 1.055, 2.4)), U = (t) => 255 * (t <= 31308e-7 ? t * 12.92 : 1.055 * Math.pow(t, 1 / 2.4) - 0.055);
318
- function $t(t, n, e) {
318
+ }, ft = (t, n, e) => "#" + [t, n, e].map((o) => Math.max(0, Math.min(255, Math.round(o))).toString(16).padStart(2, "0")).join(""), ot = (t) => (t /= 255, t <= 0.04045 ? t / 12.92 : Math.pow((t + 0.055) / 1.055, 2.4)), U = (t) => 255 * (t <= 31308e-7 ? t * 12.92 : 1.055 * Math.pow(t, 1 / 2.4) - 0.055);
319
+ function Xt(t, n, e) {
319
320
  t /= 255, n /= 255, e /= 255;
320
321
  const o = Math.max(t, n, e), s = Math.min(t, n, e), r = (o + s) / 2;
321
322
  if (o === s) return [0, 0, r];
322
323
  const a = o - s, i = r > 0.5 ? a / (2 - o - s) : a / (o + s);
323
324
  return [(o === t ? (n - e) / a + (n < e ? 6 : 0) : o === n ? (e - t) / a + 2 : (t - n) / a + 4) * 60, i, r];
324
325
  }
325
- function xt(t, n, e) {
326
+ function bt(t, n, e) {
326
327
  if (t = (t % 360 + 360) % 360 / 360, n === 0) return [e * 255, e * 255, e * 255];
327
328
  const o = e < 0.5 ? e * (1 + n) : e + n - e * n, s = 2 * e - o, r = (a) => (a = (a % 1 + 1) % 1, a < 1 / 6 ? s + (o - s) * 6 * a : a < 1 / 2 ? o : a < 2 / 3 ? s + (o - s) * (2 / 3 - a) * 6 : s);
328
329
  return [r(t + 1 / 3) * 255, r(t) * 255, r(t - 1 / 3) * 255];
329
330
  }
330
- function D(t, n) {
331
- const e = I(t).find((o) => /Clr$/.test(o.localName));
332
- return e ? Le(e, n) : null;
331
+ function j(t, n) {
332
+ const e = N(t).find((o) => /Clr$/.test(o.localName));
333
+ return e ? $e(e, n) : null;
333
334
  }
334
- function Le(t, n) {
335
+ function $e(t, n) {
335
336
  let e = null, o = 1;
336
337
  switch (t.localName) {
337
338
  case "srgbClr": {
@@ -345,14 +346,14 @@ function Le(t, n) {
345
346
  break;
346
347
  }
347
348
  case "prstClr":
348
- e = Ae[k(t, "val") || ""] ?? "#000000";
349
+ e = je[k(t, "val") || ""] ?? "#000000";
349
350
  break;
350
351
  case "scrgbClr":
351
- e = ct(U(C(t, "r") / 1e5), U(C(t, "g") / 1e5), U(C(t, "b") / 1e5));
352
+ e = ft(U(C(t, "r") / 1e5), U(C(t, "g") / 1e5), U(C(t, "b") / 1e5));
352
353
  break;
353
354
  case "hslClr": {
354
- const [l, x, b] = xt(C(t, "hue") / 6e4, C(t, "sat") / 1e5, C(t, "lum") / 1e5);
355
- e = ct(l, x, b);
355
+ const [l, p, x] = bt(C(t, "hue") / 6e4, C(t, "sat") / 1e5, C(t, "lum") / 1e5);
356
+ e = ft(l, p, x);
356
357
  break;
357
358
  }
358
359
  case "schemeClr": {
@@ -361,24 +362,24 @@ function Le(t, n) {
361
362
  n.phClr ? (e = n.phClr.hex, o = n.phClr.alpha ?? 1) : e = n.theme.colors.accent1 ?? "#4472c4";
362
363
  break;
363
364
  }
364
- const x = n.clrMap[l] ?? Pt[l] ?? l;
365
- e = n.theme.colors[x] ?? null;
365
+ const p = n.clrMap[l] ?? It[l] ?? l;
366
+ e = n.theme.colors[p] ?? null;
366
367
  break;
367
368
  }
368
369
  }
369
370
  if (!e) return null;
370
- let [s, r, a] = Qt(e);
371
- for (const l of I(t)) {
372
- const x = C(l, "val") / 1e5;
371
+ let [s, r, a] = ee(e);
372
+ for (const l of N(t)) {
373
+ const p = C(l, "val") / 1e5;
373
374
  switch (l.localName) {
374
375
  case "alpha":
375
- o = x;
376
+ o = p;
376
377
  break;
377
378
  case "alphaMod":
378
- o *= x;
379
+ o *= p;
379
380
  break;
380
381
  case "alphaOff":
381
- o += x;
382
+ o += p;
382
383
  break;
383
384
  case "lumMod":
384
385
  case "lumOff":
@@ -386,19 +387,19 @@ function Le(t, n) {
386
387
  case "satOff":
387
388
  case "hueMod":
388
389
  case "hueOff": {
389
- let [b, d, m] = $t(s, r, a);
390
- l.localName === "lumMod" ? m *= x : l.localName === "lumOff" ? m += x : l.localName === "satMod" ? d *= x : l.localName === "satOff" ? d += x : l.localName === "hueMod" ? b *= x : b += C(l, "val") / 6e4, [s, r, a] = xt(b, Math.max(0, Math.min(1, d)), Math.max(0, Math.min(1, m)));
390
+ let [x, u, g] = Xt(s, r, a);
391
+ l.localName === "lumMod" ? g *= p : l.localName === "lumOff" ? g += p : l.localName === "satMod" ? u *= p : l.localName === "satOff" ? u += p : l.localName === "hueMod" ? x *= p : x += C(l, "val") / 6e4, [s, r, a] = bt(x, Math.max(0, Math.min(1, u)), Math.max(0, Math.min(1, g)));
391
392
  break;
392
393
  }
393
394
  case "tint":
394
- [s, r, a] = [s, r, a].map((b) => U(ot(b) * x + (1 - x)));
395
+ [s, r, a] = [s, r, a].map((x) => U(ot(x) * p + (1 - p)));
395
396
  break;
396
397
  case "shade":
397
- [s, r, a] = [s, r, a].map((b) => U(ot(b) * x));
398
+ [s, r, a] = [s, r, a].map((x) => U(ot(x) * p));
398
399
  break;
399
400
  case "comp": {
400
- const [b, d, m] = $t(s, r, a);
401
- [s, r, a] = xt(b + 180, d, m);
401
+ const [x, u, g] = Xt(s, r, a);
402
+ [s, r, a] = bt(x + 180, u, g);
402
403
  break;
403
404
  }
404
405
  case "inv":
@@ -411,31 +412,31 @@ function Le(t, n) {
411
412
  }
412
413
  }
413
414
  o = Math.max(0, Math.min(1, o));
414
- const i = { hex: ct(s, r, a) };
415
+ const i = { hex: ft(s, r, a) };
415
416
  return o < 0.999 && (i.alpha = o), i;
416
417
  }
417
- function V(t, n) {
418
- for (const e of I(t)) {
419
- const o = Tt(e, n);
418
+ function q(t, n) {
419
+ for (const e of N(t)) {
420
+ const o = Nt(e, n);
420
421
  if (o) return o;
421
422
  }
422
423
  }
423
- function Tt(t, n) {
424
+ function Nt(t, n) {
424
425
  switch (t.localName) {
425
426
  case "noFill":
426
427
  return { kind: "none" };
427
428
  case "solidFill": {
428
- const e = D(t, n.ctx);
429
+ const e = j(t, n.ctx);
429
430
  return e ? { kind: "solid", color: e } : { kind: "none" };
430
431
  }
431
432
  case "gradFill": {
432
- const e = I(c(t, "gsLst"), "gs").slice(0, 256).map((s) => ({ pos: C(s, "pos") / 1e5, color: D(s, n.ctx) ?? { hex: "#000000" } }));
433
+ const e = N(c(t, "gsLst"), "gs").slice(0, 256).map((s) => ({ pos: C(s, "pos") / 1e5, color: j(s, n.ctx) ?? { hex: "#000000" } }));
433
434
  if (!e.length) return { kind: "none" };
434
435
  const o = c(t, "lin");
435
436
  return c(t, "path") ? { kind: "radial", stops: e } : { kind: "linear", stops: e, angle: o ? C(o, "ang") / 6e4 : 90, scaled: B(o, "scaled") ?? !1 };
436
437
  }
437
438
  case "blipFill": {
438
- const e = Jt(t, n);
439
+ const e = ne(t, n);
439
440
  if (!e) return;
440
441
  const o = { kind: "image", media: e }, s = c(t, "tile");
441
442
  s && (o.tile = { sx: Math.max(0.01, C(s, "sx", 1e5) / 1e5), sy: Math.max(0.01, C(s, "sy", 1e5) / 1e5) });
@@ -443,14 +444,14 @@ function Tt(t, n) {
443
444
  return r && (o.alpha = Math.max(0, Math.min(1, C(r, "amt", 1e5) / 1e5))), c(c(t, "blip"), "grayscl") && (o.grayscale = !0), o;
444
445
  }
445
446
  case "pattFill": {
446
- const e = D(c(t, "fgClr"), n.ctx), o = D(c(t, "bgClr"), n.ctx);
447
+ const e = j(c(t, "fgClr"), n.ctx), o = j(c(t, "bgClr"), n.ctx);
447
448
  return e ? { kind: "pattern", preset: k(t, "prst") || "pct50", color: e, ...o ? { bg: o } : {} } : void 0;
448
449
  }
449
450
  case "grpFill":
450
451
  return;
451
452
  }
452
453
  }
453
- const Ee = {
454
+ const Be = {
454
455
  png: "png",
455
456
  jpg: "jpeg",
456
457
  jpeg: "jpeg",
@@ -464,33 +465,33 @@ const Ee = {
464
465
  emf: "emf",
465
466
  wmf: "wmf"
466
467
  };
467
- function Jt(t, n) {
468
+ function ne(t, n) {
468
469
  const e = c(t, "blip"), o = k(e, "r:embed");
469
470
  if (!o) return null;
470
471
  const s = n.pkg.rels(n.part).get(o);
471
472
  if (!s || s.external) return null;
472
- const r = n.pkg.bytes(s.target), a = Ee[(s.target.split(".").pop() || "").toLowerCase()];
473
+ const r = n.pkg.bytes(s.target), a = Be[(s.target.split(".").pop() || "").toLowerCase()];
473
474
  return r && a ? { bytes: r, ext: a } : null;
474
475
  }
475
- const Fe = { solid: "", dot: "sysDot", sysDot: "sysDot", sysDash: "dash", dash: "dash", lgDash: "dash", dashDot: "dash", lgDashDot: "dash", lgDashDotDot: "dash", sysDashDot: "dash", sysDashDotDot: "dash" };
476
+ const ze = { solid: "", dot: "sysDot", sysDot: "sysDot", sysDash: "dash", dash: "dash", lgDash: "dash", dashDot: "dash", lgDashDot: "dash", lgDashDotDot: "dash", sysDashDot: "dash", sysDashDotDot: "dash" };
476
477
  function G(t, n) {
477
478
  if (!t) return;
478
479
  let e;
479
- for (const i of I(t)) {
480
+ for (const i of N(t)) {
480
481
  if (i.localName === "noFill") return null;
481
- i.localName === "solidFill" && (e = D(i, n.ctx)), i.localName === "gradFill" && (e = D(c(c(i, "gsLst"), "gs"), n.ctx));
482
+ i.localName === "solidFill" && (e = j(i, n.ctx)), i.localName === "gradFill" && (e = j(c(c(i, "gsLst"), "gs"), n.ctx));
482
483
  }
483
484
  const o = k(t, "w");
484
485
  if (e === void 0 && o === null && !c(t, "prstDash") && !c(t, "headEnd") && !c(t, "tailEnd")) return;
485
486
  const s = (i) => {
486
487
  const l = k(i, "type");
487
488
  if (!l || l === "none") return;
488
- const x = l === "triangle" || l === "stealth" || l === "arrow" || l === "oval" || l === "diamond" ? l : "triangle", b = k(i, "len") || k(i, "w");
489
- return { type: x, size: b === "sm" || b === "lg" ? b : "med" };
490
- }, r = Fe[k(c(t, "prstDash"), "val") || "solid"], a = k(t, "cap");
489
+ const p = l === "triangle" || l === "stealth" || l === "arrow" || l === "oval" || l === "diamond" ? l : "triangle", x = k(i, "len") || k(i, "w");
490
+ return { type: p, size: x === "sm" || x === "lg" ? x : "med" };
491
+ }, r = ze[k(c(t, "prstDash"), "val") || "solid"], a = k(t, "cap");
491
492
  return {
492
493
  // ECMA's default is 9525 EMU — 0.75 pt, one px.
493
- width: o !== null ? Math.max(0, E(Number(o) || 0)) : 1,
494
+ width: o !== null ? Math.max(0, R(Number(o) || 0)) : 1,
494
495
  color: e ?? { hex: "#000000" },
495
496
  dash: r || void 0,
496
497
  cap: a === "rnd" ? "rnd" : a === "sq" ? "sq" : a === "flat" ? "flat" : void 0,
@@ -506,82 +507,82 @@ function dt(t, n) {
506
507
  if (o === 0) return { kind: "none" };
507
508
  const r = (o >= 1001 ? n.ctx.theme.bgFills : n.ctx.theme.fills)[o >= 1001 ? o - 1001 : o - 1];
508
509
  if (!r) return;
509
- const a = D(e, n.ctx) ?? void 0;
510
- return Tt(r, { ...n, ctx: { ...n.ctx, phClr: a } });
510
+ const a = j(e, n.ctx) ?? void 0;
511
+ return Nt(r, { ...n, ctx: { ...n.ctx, phClr: a } });
511
512
  }
512
- function It(t, n) {
513
+ function Ot(t, n) {
513
514
  const e = c(t, "lnRef");
514
515
  if (!e) return;
515
516
  const o = C(e, "idx");
516
517
  if (o === 0) return null;
517
518
  const s = n.ctx.theme.lines[o - 1];
518
519
  if (!s) return;
519
- const r = D(e, n.ctx) ?? void 0;
520
+ const r = j(e, n.ctx) ?? void 0;
520
521
  return G(s, { ...n, ctx: { ...n.ctx, phClr: r } }) ?? void 0;
521
522
  }
522
523
  function W(t) {
523
524
  if (!t) return null;
524
525
  const n = c(t, "off"), e = c(t, "ext");
525
526
  return !n || !e ? null : {
526
- x: E(C(n, "x")),
527
- y: E(C(n, "y")),
528
- w: Math.max(0, E(C(e, "cx"))),
529
- h: Math.max(0, E(C(e, "cy"))),
527
+ x: R(C(n, "x")),
528
+ y: R(C(n, "y")),
529
+ w: Math.max(0, R(C(e, "cx"))),
530
+ h: Math.max(0, R(C(e, "cy"))),
530
531
  rot: C(t, "rot") / 6e4,
531
532
  flipH: !!B(t, "flipH"),
532
533
  flipV: !!B(t, "flipV")
533
534
  };
534
535
  }
535
- const bt = (t) => t;
536
- function je(t, n) {
536
+ const yt = (t) => t;
537
+ function Xe(t, n) {
537
538
  const e = W(t);
538
539
  if (!e) return n;
539
- const o = c(t, "chOff"), s = c(t, "chExt"), r = o ? E(C(o, "x")) : e.x, a = o ? E(C(o, "y")) : e.y, i = s ? E(C(s, "cx")) : e.w, l = s ? E(C(s, "cy")) : e.h, x = i > 0 ? e.w / i : 1, b = l > 0 ? e.h / l : 1, d = e.x + e.w / 2, m = e.y + e.h / 2, g = e.rot * Math.PI / 180;
540
+ const o = c(t, "chOff"), s = c(t, "chExt"), r = o ? R(C(o, "x")) : e.x, a = o ? R(C(o, "y")) : e.y, i = s ? R(C(s, "cx")) : e.w, l = s ? R(C(s, "cy")) : e.h, p = i > 0 ? e.w / i : 1, x = l > 0 ? e.h / l : 1, u = e.x + e.w / 2, g = e.y + e.h / 2, b = e.rot * Math.PI / 180;
540
541
  return (f) => {
541
- let h = e.x + (f.x + f.w / 2 - r) * x, y = e.y + (f.y + f.h / 2 - a) * b, u = f.rot, p = f.flipH, w = f.flipV;
542
- if (e.flipH && (h = 2 * d - h, p = !p, u = -u), e.flipV && (y = 2 * m - y, w = !w, u = -u), g) {
543
- const v = h - d, N = y - m;
544
- h = d + v * Math.cos(g) - N * Math.sin(g), y = m + v * Math.sin(g) + N * Math.cos(g), u += e.rot;
542
+ let h = e.x + (f.x + f.w / 2 - r) * p, y = e.y + (f.y + f.h / 2 - a) * x, d = f.rot, m = f.flipH, w = f.flipV;
543
+ if (e.flipH && (h = 2 * u - h, m = !m, d = -d), e.flipV && (y = 2 * g - y, w = !w, d = -d), b) {
544
+ const v = h - u, I = y - g;
545
+ h = u + v * Math.cos(b) - I * Math.sin(b), y = g + v * Math.sin(b) + I * Math.cos(b), d += e.rot;
545
546
  }
546
- const M = f.w * x, S = f.h * b;
547
- return n({ x: h - M / 2, y: y - S / 2, w: M, h: S, rot: (u % 360 + 360) % 360, flipH: p, flipV: w });
547
+ const M = f.w * p, S = f.h * x;
548
+ return n({ x: h - M / 2, y: y - S / 2, w: M, h: S, rot: (d % 360 + 360) % 360, flipH: m, flipV: w });
548
549
  };
549
550
  }
550
- function Bt(t) {
551
+ function Ht(t) {
551
552
  const n = c(t, "spcPts"), e = c(t, "spcPct");
552
- if (n) return { px: Math.max(0, Math.min(1584, C(n, "val") / 100)) * (Ct / z) };
553
+ if (n) return { px: Math.max(0, Math.min(1584, C(n, "val") / 100)) * (Tt / z) };
553
554
  if (e) return { lines: Math.max(0, Math.min(13.2, C(e, "val") / 1e5)) };
554
555
  }
555
- function zt(t, n, e) {
556
+ function Yt(t, n, e) {
556
557
  const o = c(t, `lvl${n + 1}pPr`) ?? (t && t.localName.endsWith("pPr") ? t : null);
557
- return o ? te(o, e) : {};
558
+ return o ? oe(o, e) : {};
558
559
  }
559
- function te(t, n) {
560
+ function oe(t, n) {
560
561
  const e = {};
561
- if (k(t, "algn") && (e.algn = k(t, "algn")), k(t, "marL") !== null && (e.marL = E(C(t, "marL"))), k(t, "indent") !== null && (e.indent = E(C(t, "indent"))), c(t, "buNone")) e.bullet = "none";
562
+ if (k(t, "algn") && (e.algn = k(t, "algn")), k(t, "marL") !== null && (e.marL = R(C(t, "marL"))), k(t, "indent") !== null && (e.indent = R(C(t, "indent"))), c(t, "buNone")) e.bullet = "none";
562
563
  else if (c(t, "buAutoNum")) {
563
564
  const a = c(t, "buAutoNum");
564
565
  e.bullet = "num", e.numType = k(a, "type") || "arabicPeriod", e.startAt = k(a, "startAt") !== null ? Math.max(1, Math.min(32767, Math.round(C(a, "startAt", 1)))) : void 0;
565
566
  } else c(t, "buChar") ? (e.bullet = "char", e.buChar = k(c(t, "buChar"), "char") || void 0) : c(t, "buBlip") && (e.bullet = "char", e.buChar = "•");
566
- if (c(t, "buFont") ? e.buFont = k(c(t, "buFont"), "typeface") || null : c(t, "buFontTx") && (e.buFont = null), c(t, "buClr") ? e.buClr = D(c(t, "buClr"), n.ctx) : c(t, "buClrTx") && (e.buClr = null), c(t, "buSzPct")) {
567
+ if (c(t, "buFont") ? e.buFont = k(c(t, "buFont"), "typeface") || null : c(t, "buFontTx") && (e.buFont = null), c(t, "buClr") ? e.buClr = j(c(t, "buClr"), n.ctx) : c(t, "buClrTx") && (e.buClr = null), c(t, "buSzPct")) {
567
568
  const a = k(c(t, "buSzPct"), "val") || "", i = a.endsWith("%") ? parseFloat(a) / 100 : Number(a) / 1e5;
568
569
  e.buSz = Number.isFinite(i) && i > 0 ? Math.max(0.25, Math.min(4, i)) : null;
569
570
  } else (c(t, "buSzTx") || c(t, "buSzPts")) && (e.buSz = null);
570
- const o = R(t, "lnSpc", "spcPct");
571
+ const o = A(t, "lnSpc", "spcPct");
571
572
  o && (e.lnSpcPct = C(o, "val") / 1e5);
572
- const s = Bt(c(t, "spcBef")), r = Bt(c(t, "spcAft"));
573
- return s && (e.spcBef = s), r && (e.spcAft = r), Object.assign(e, ee(c(t, "defRPr"), n)), e;
573
+ const s = Ht(c(t, "spcBef")), r = Ht(c(t, "spcAft"));
574
+ return s && (e.spcBef = s), r && (e.spcAft = r), Object.assign(e, se(c(t, "defRPr"), n)), e;
574
575
  }
575
- function ee(t, n) {
576
+ function se(t, n) {
576
577
  if (!t) return {};
577
578
  const e = {};
578
- k(t, "sz") !== null && (e.sz = C(t, "sz") / 100 * (Ct / z)), B(t, "b") !== void 0 && (e.b = B(t, "b")), B(t, "i") !== void 0 && (e.i = B(t, "i")), k(t, "u") && (e.u = k(t, "u") !== "none"), k(t, "strike") && (e.strike = k(t, "strike") !== "noStrike");
579
+ k(t, "sz") !== null && (e.sz = C(t, "sz") / 100 * (Tt / z)), B(t, "b") !== void 0 && (e.b = B(t, "b")), B(t, "i") !== void 0 && (e.i = B(t, "i")), k(t, "u") && (e.u = k(t, "u") !== "none"), k(t, "strike") && (e.strike = k(t, "strike") !== "noStrike");
579
580
  const o = c(t, "solidFill");
580
- o ? e.color = D(o, n.ctx) : c(t, "noFill") && (e.color = null);
581
+ o ? e.color = j(o, n.ctx) : c(t, "noFill") && (e.color = null);
581
582
  const s = k(c(t, "latin"), "typeface");
582
583
  return s && (e.font = s), e;
583
584
  }
584
- const De = {
585
+ const He = {
585
586
  108: "●",
586
587
  110: "■",
587
588
  111: "□",
@@ -595,130 +596,130 @@ const De = {
595
596
  252: "✔",
596
597
  251: "✗",
597
598
  254: "☑"
598
- }, $e = { 183: "•", 168: "♦", 174: "→", 222: "⇒", 45: "−", 42: "∗" };
599
- function Be(t, n) {
599
+ }, Ye = { 183: "•", 168: "♦", 174: "→", 222: "⇒", 45: "−", 42: "∗" };
600
+ function We(t, n) {
600
601
  if (!t) return "•";
601
602
  let e = t.codePointAt(0);
602
603
  e >= 61440 && e <= 61695 && (e -= 61440);
603
604
  const o = (n || "").toLowerCase();
604
- return o.startsWith("wingdings") ? o === "wingdings" && De[e] || "•" : o === "symbol" ? $e[e] ?? (e < 128 && e > 32 ? String.fromCharCode(e) : "•") : o.startsWith("webdings") || o.startsWith("marlett") ? "•" : o === "courier new" && t === "o" ? "◦" : /\s/.test(t) || e < 32 ? "•" : [...t][0];
605
+ return o.startsWith("wingdings") ? o === "wingdings" && He[e] || "•" : o === "symbol" ? Ye[e] ?? (e < 128 && e > 32 ? String.fromCharCode(e) : "•") : o.startsWith("webdings") || o.startsWith("marlett") ? "•" : o === "courier new" && t === "o" ? "◦" : /\s/.test(t) || e < 32 ? "•" : [...t][0];
605
606
  }
606
- const Xt = (...t) => {
607
+ const Wt = (...t) => {
607
608
  const n = {};
608
609
  for (const e of t) for (const [o, s] of Object.entries(e)) s !== void 0 && (n[o] = s);
609
610
  return n;
610
611
  };
611
- function ze(t, n) {
612
+ function _e(t, n) {
612
613
  if (t)
613
614
  return t.startsWith("+mj") ? n.major : t.startsWith("+mn") ? n.minor : t;
614
615
  }
615
- function Nt(t, n, e) {
616
+ function At(t, n, e) {
616
617
  if (!t) return;
617
- const o = I(t, "p");
618
- if (!o.some((g) => I(g).some((f) => (f.localName === "r" || f.localName === "fld") && (R(f, "t")?.textContent ?? "") !== ""))) return;
618
+ const o = N(t, "p");
619
+ if (!o.some((b) => N(b).some((f) => (f.localName === "r" || f.localName === "fld") && (A(f, "t")?.textContent ?? "") !== ""))) return;
619
620
  const r = {};
620
621
  let a = 1, i = 1;
621
- for (const g of [...n.bodyPr, c(t, "bodyPr")]) {
622
- if (!g) continue;
623
- for (let h = 0; h < g.attributes.length; h++) r[g.attributes[h].localName ?? g.attributes[h].name] = g.attributes[h].value;
624
- const f = c(g, "normAutofit");
625
- f && (a = k(f, "fontScale") !== null ? C(f, "fontScale") / 1e5 : 1), f && (i = 1 - Math.max(0, Math.min(0.9, C(f, "lnSpcReduction") / 1e5))), (c(g, "noAutofit") || c(g, "spAutoFit")) && (a = 1, i = 1);
622
+ for (const b of [...n.bodyPr, c(t, "bodyPr")]) {
623
+ if (!b) continue;
624
+ for (let h = 0; h < b.attributes.length; h++) r[b.attributes[h].localName ?? b.attributes[h].name] = b.attributes[h].value;
625
+ const f = c(b, "normAutofit");
626
+ f && (a = k(f, "fontScale") !== null ? C(f, "fontScale") / 1e5 : 1), f && (i = 1 - Math.max(0, Math.min(0.9, C(f, "lnSpcReduction") / 1e5))), (c(b, "noAutofit") || c(b, "spAutoFit")) && (a = 1, i = 1);
626
627
  }
627
- const l = (g, f) => r[g] !== void 0 ? E(Number(r[g]) || 0) : E(f), x = r.anchor === "ctr" ? "ctr" : r.anchor === "b" ? "b" : "t", b = c(t, "lstStyle"), d = [];
628
- let m;
629
- for (const g of o) {
630
- const f = c(g, "pPr"), h = Math.max(0, Math.min(8, C(f, "lvl"))), y = n.fontRef ? { color: n.fontRef.color ?? void 0, font: n.fontRef.font } : {}, u = Xt(...n.levels.map((P) => zt(P, h, e)), y, zt(b, h, e), f ? te(f, e) : {});
631
- u.lnSpcPct !== void 0 && m === void 0 && (m = u.lnSpcPct);
632
- const p = { runs: [], align: u.algn === "ctr" ? "ctr" : u.algn === "r" ? "r" : (u.algn === "just", "l"), level: h };
633
- if (u.bullet === "char" || u.bullet === "num") {
634
- if (p.bullet = u.bullet, p.marL = u.marL ?? 0, p.indent = u.indent ?? 0, u.bullet === "char") {
635
- const P = Be(u.buChar, u.buFont ?? void 0);
636
- P !== "•" && (p.bulletChar = P);
628
+ const l = (b, f) => r[b] !== void 0 ? R(Number(r[b]) || 0) : R(f), p = r.anchor === "ctr" ? "ctr" : r.anchor === "b" ? "b" : "t", x = c(t, "lstStyle"), u = [];
629
+ let g;
630
+ for (const b of o) {
631
+ const f = c(b, "pPr"), h = Math.max(0, Math.min(8, C(f, "lvl"))), y = n.fontRef ? { color: n.fontRef.color ?? void 0, font: n.fontRef.font } : {}, d = Wt(...n.levels.map((P) => Yt(P, h, e)), y, Yt(x, h, e), f ? oe(f, e) : {});
632
+ d.lnSpcPct !== void 0 && g === void 0 && (g = d.lnSpcPct);
633
+ const m = { runs: [], align: d.algn === "ctr" ? "ctr" : d.algn === "r" ? "r" : (d.algn === "just", "l"), level: h };
634
+ if (d.bullet === "char" || d.bullet === "num") {
635
+ if (m.bullet = d.bullet, m.marL = d.marL ?? 0, m.indent = d.indent ?? 0, d.bullet === "char") {
636
+ const P = We(d.buChar, d.buFont ?? void 0);
637
+ P !== "•" && (m.bulletChar = P);
637
638
  } else
638
- u.numType && u.numType !== "arabicPeriod" && (p.numType = u.numType), u.startAt && u.startAt !== 1 && (p.startAt = u.startAt);
639
- u.buClr && (p.bulletColor = u.buClr), u.buSz && Math.abs(u.buSz - 1) > 1e-3 && (p.bulletScale = u.buSz);
639
+ d.numType && d.numType !== "arabicPeriod" && (m.numType = d.numType), d.startAt && d.startAt !== 1 && (m.startAt = d.startAt);
640
+ d.buClr && (m.bulletColor = d.buClr), d.buSz && Math.abs(d.buSz - 1) > 1e-3 && (m.bulletScale = d.buSz);
640
641
  }
641
642
  const w = (P) => {
642
- const L = Xt(u, ee(P, e)), X = (L.sz ?? 18 * Ct / z) * a, H = L.color === null ? void 0 : L.color ?? ne("tx1", e);
643
+ const E = Wt(d, se(P, e)), X = (E.sz ?? 18 * Tt / z) * a, H = E.color === null ? void 0 : E.color ?? re("tx1", e);
643
644
  return {
644
645
  text: "",
645
646
  size: X,
646
- bold: L.b || void 0,
647
- italic: L.i || void 0,
648
- underline: L.u || void 0,
649
- strike: L.strike || void 0,
647
+ bold: E.b || void 0,
648
+ italic: E.i || void 0,
649
+ underline: E.u || void 0,
650
+ strike: E.strike || void 0,
650
651
  color: H ?? void 0,
651
- font: ze(L.font ?? "+mn-lt", e.ctx.theme)
652
+ font: _e(E.font ?? "+mn-lt", e.ctx.theme)
652
653
  };
653
654
  };
654
- for (const P of I(g))
655
+ for (const P of N(b))
655
656
  if (P.localName === "r" || P.localName === "fld") {
656
- const L = R(P, "t")?.textContent ?? "";
657
- if (!L) continue;
658
- L.split(/[\v\n]/).forEach((X, H) => {
659
- H > 0 && p.runs.push({ ...w(c(P, "rPr")), br: !0 }), X && p.runs.push({ ...w(c(P, "rPr")), text: X });
657
+ const E = A(P, "t")?.textContent ?? "";
658
+ if (!E) continue;
659
+ E.split(/[\v\n]/).forEach((X, H) => {
660
+ H > 0 && m.runs.push({ ...w(c(P, "rPr")), br: !0 }), X && m.runs.push({ ...w(c(P, "rPr")), text: X });
660
661
  });
661
- } else P.localName === "br" && p.runs.push({ ...w(c(P, "rPr")), br: !0 });
662
- p.endSize = w(c(g, "endParaRPr")).size;
663
- const M = (p.runs.length ? Math.max(...p.runs.map((P) => P.size ?? 0)) : p.endSize ?? 0) * 1.2 * (u.lnSpcPct ?? 1), S = (P) => P ? ("px" in P ? P.px : P.lines * M) * i : 0, v = S(u.spcBef), N = S(u.spcAft);
664
- v > 0.05 && (p.spaceBefore = Math.round(v * 100) / 100), N > 0.05 && (p.spaceAfter = Math.round(N * 100) / 100), d.push(p);
662
+ } else P.localName === "br" && m.runs.push({ ...w(c(P, "rPr")), br: !0 });
663
+ m.endSize = w(c(b, "endParaRPr")).size;
664
+ const M = (m.runs.length ? Math.max(...m.runs.map((P) => P.size ?? 0)) : m.endSize ?? 0) * 1.2 * (d.lnSpcPct ?? 1), S = (P) => P ? ("px" in P ? P.px : P.lines * M) * i : 0, v = S(d.spcBef), I = S(d.spcAft);
665
+ v > 0.05 && (m.spaceBefore = Math.round(v * 100) / 100), I > 0.05 && (m.spaceAfter = Math.round(I * 100) / 100), u.push(m);
665
666
  }
666
667
  return {
667
- paragraphs: d,
668
- anchor: x,
668
+ paragraphs: u,
669
+ anchor: p,
669
670
  insets: { l: l("lIns", 91440), t: l("tIns", 45720), r: l("rIns", 91440), b: l("bIns", 45720) },
670
671
  wrap: r.wrap !== "none",
671
- lineSpacing: m
672
+ lineSpacing: g
672
673
  };
673
674
  }
674
- const ne = (t, n) => {
675
- const e = n.ctx.clrMap[t] ?? Pt[t] ?? t, o = n.ctx.theme.colors[e];
675
+ const re = (t, n) => {
676
+ const e = n.ctx.clrMap[t] ?? It[t] ?? t, o = n.ctx.theme.colors[e];
676
677
  return o ? { hex: o } : null;
677
- }, K = (t) => {
678
+ }, Q = (t) => {
678
679
  const n = c(t, "ph");
679
680
  return n ? { type: k(n, "type") || "obj", idx: C(n, "idx") } : null;
680
- }, st = (t) => c(I(t).find((n) => n.localName.startsWith("nv")) ?? null, "nvPr"), it = /* @__PURE__ */ new Set(["title", "ctrTitle"]), Ht = /* @__PURE__ */ new Set(["title", "ctrTitle", "dt", "ftr", "sldNum", "hdr"]), Yt = (t, n) => t === n || it.has(t) && it.has(n) || !Ht.has(t) && !Ht.has(n);
681
- function ut(t, n) {
682
- const e = Xe(t);
681
+ }, st = (t) => c(N(t).find((n) => n.localName.startsWith("nv")) ?? null, "nvPr"), it = /* @__PURE__ */ new Set(["title", "ctrTitle"]), _t = /* @__PURE__ */ new Set(["title", "ctrTitle", "dt", "ftr", "sldNum", "hdr"]), Ut = (t, n) => t === n || it.has(t) && it.has(n) || !_t.has(t) && !_t.has(n);
682
+ function ht(t, n) {
683
+ const e = Ue(t);
683
684
  if (n.idx) {
684
- const o = e.find((s) => s.ph.idx === n.idx && Yt(s.ph.type, n.type));
685
+ const o = e.find((s) => s.ph.idx === n.idx && Ut(s.ph.type, n.type));
685
686
  if (o) return o.el;
686
687
  }
687
- return (e.find((o) => o.ph.type === n.type && (o.ph.idx === n.idx || !n.idx || it.has(n.type))) ?? e.find((o) => o.ph.type === n.type) ?? e.find((o) => Yt(o.ph.type, n.type)))?.el ?? null;
688
+ return (e.find((o) => o.ph.type === n.type && (o.ph.idx === n.idx || !n.idx || it.has(n.type))) ?? e.find((o) => o.ph.type === n.type) ?? e.find((o) => Ut(o.ph.type, n.type)))?.el ?? null;
688
689
  }
689
- function Xe(t) {
690
+ function Ue(t) {
690
691
  const n = [];
691
- for (const e of J(t)) {
692
- const o = K(st(e));
692
+ for (const e of V(t)) {
693
+ const o = Q(st(e));
693
694
  o && n.push({ el: e, ph: o });
694
695
  }
695
696
  return n;
696
697
  }
697
- const oe = (t) => it.has(t) ? "title" : ["dt", "ftr", "sldNum", "hdr"].includes(t) ? t : "body", He = (t) => {
698
+ const ae = (t) => it.has(t) ? "title" : ["dt", "ftr", "sldNum", "hdr"].includes(t) ? t : "body", Ge = (t) => {
698
699
  const n = {};
699
- for (const e of I(c(t, "avLst"), "gd")) {
700
+ for (const e of N(c(t, "avLst"), "gd")) {
700
701
  const o = k(e, "name"), s = k(e, "fmla");
701
702
  o && s && (n[o] = s);
702
703
  }
703
704
  return n;
704
705
  };
705
- function Ye(t) {
706
- const n = (r) => I(r, "gd").slice(0, 1e4).map((a) => [k(a, "name") || "", k(a, "fmla") || "val 0"]), e = I(c(t, "cxnLst"), "cxn").map((r) => [k(r, "ang") || "0", k(c(r, "pos"), "x") || "0", k(c(r, "pos"), "y") || "0"]), o = c(t, "rect"), s = I(c(t, "pathLst"), "path").slice(0, 1e3).map((r) => {
706
+ function Ve(t) {
707
+ const n = (r) => N(r, "gd").slice(0, 1e4).map((a) => [k(a, "name") || "", k(a, "fmla") || "val 0"]), e = N(c(t, "cxnLst"), "cxn").map((r) => [k(r, "ang") || "0", k(c(r, "pos"), "x") || "0", k(c(r, "pos"), "y") || "0"]), o = c(t, "rect"), s = N(c(t, "pathLst"), "path").slice(0, 1e3).map((r) => {
707
708
  const a = [];
708
- for (const l of I(r)) {
709
- const x = I(l, "pt").map((b) => [k(b, "x") || "0", k(b, "y") || "0"]).flat();
709
+ for (const l of N(r)) {
710
+ const p = N(l, "pt").map((x) => [k(x, "x") || "0", k(x, "y") || "0"]).flat();
710
711
  switch (l.localName) {
711
712
  case "moveTo":
712
- a.push(["M", ...x]);
713
+ a.push(["M", ...p]);
713
714
  break;
714
715
  case "lnTo":
715
- a.push(["L", ...x]);
716
+ a.push(["L", ...p]);
716
717
  break;
717
718
  case "quadBezTo":
718
- a.push(["Q", ...x]);
719
+ a.push(["Q", ...p]);
719
720
  break;
720
721
  case "cubicBezTo":
721
- a.push(["C", ...x]);
722
+ a.push(["C", ...p]);
722
723
  break;
723
724
  case "arcTo":
724
725
  a.push(["A", k(l, "wR") || "0", k(l, "hR") || "0", k(l, "stAng") || "0", k(l, "swAng") || "0"]);
@@ -732,7 +733,7 @@ function Ye(t) {
732
733
  return { w: C(r, "w") || void 0, h: C(r, "h") || void 0, fill: i && i !== "norm" ? i : void 0, stroke: B(r, "stroke") === !1 ? !1 : void 0, d: a };
733
734
  });
734
735
  return {
735
- av: I(c(t, "avLst"), "gd").map((r) => [k(r, "name") || "", k(r, "fmla") || "val 0"]),
736
+ av: N(c(t, "avLst"), "gd").map((r) => [k(r, "name") || "", k(r, "fmla") || "val 0"]),
736
737
  gd: n(c(t, "gdLst")),
737
738
  cxn: e,
738
739
  rect: o ? [k(o, "l") || "l", k(o, "t") || "t", k(o, "r") || "r", k(o, "b") || "b"] : null,
@@ -743,7 +744,7 @@ function rt(t, n) {
743
744
  const e = c(t, "prstGeom");
744
745
  if (e) {
745
746
  const s = {};
746
- for (const [r, a] of Object.entries(He(e))) {
747
+ for (const [r, a] of Object.entries(Ge(e))) {
747
748
  const i = /^val\s+(-?\d+(\.\d+)?)/.exec(a);
748
749
  i && (s[r] = Number(i[1]));
749
750
  }
@@ -751,21 +752,21 @@ function rt(t, n) {
751
752
  }
752
753
  const o = c(t, "custGeom");
753
754
  if (o) {
754
- const s = Ye(o);
755
- return { geom: { kind: "custom", paths: ft(s, n.w, n.h) }, textRect: s.rect ? Kt(s, n.w, n.h) : void 0 };
755
+ const s = Ve(o);
756
+ return { geom: { kind: "custom", paths: ut(s, n.w, n.h) }, textRect: s.rect ? te(s, n.w, n.h) : void 0 };
756
757
  }
757
758
  }
758
759
  function at(t, n, e, o, s, r) {
759
760
  const a = [];
760
- if (s > Pe)
761
+ if (s > Ae)
761
762
  return e.warnings.push("Groups nested too deeply; the innermost were skipped."), a;
762
- for (const i of J(t)) {
763
- if (++e.count > Te) {
763
+ for (const i of V(t)) {
764
+ if (++e.count > Le) {
764
765
  e.warnings.push("Too many shapes on one slide; the rest were skipped.");
765
766
  break;
766
767
  }
767
768
  try {
768
- const l = Ue(i, n, e, o, s, r);
769
+ const l = Ke(i, n, e, o, s, r);
769
770
  l && a.push(...Array.isArray(l) ? l : [l]);
770
771
  } catch {
771
772
  e.warnings.push(`A ${i.localName} couldn't be read and was skipped.`);
@@ -773,215 +774,215 @@ function at(t, n, e, o, s, r) {
773
774
  }
774
775
  return a;
775
776
  }
776
- const We = {
777
+ const qe = {
777
778
  nextslide: "next",
778
779
  previousslide: "previous",
779
780
  firstslide: "first",
780
781
  lastslide: "last",
781
782
  endshow: "end"
782
783
  };
783
- function _e(t, n, e) {
784
+ function Ze(t, n, e) {
784
785
  const o = c(t, "hlinkClick");
785
786
  if (!o) return;
786
787
  const s = k(o, "action") || "", r = e.rels(n).get(k(o, "r:id") || "");
787
788
  if (s.startsWith("ppaction://hlinkshowjump")) {
788
- const a = We[(/jump=([a-z]+)/i.exec(s)?.[1] ?? "").toLowerCase()];
789
+ const a = qe[(/jump=([a-z]+)/i.exec(s)?.[1] ?? "").toLowerCase()];
789
790
  return a ? { kind: "action", action: a } : void 0;
790
791
  }
791
792
  if (s.startsWith("ppaction://hlinksldjump")) return r && !r.external ? { kind: "slide", key: r.target } : void 0;
792
793
  if (!s)
793
794
  return r?.external && /^(https?:|mailto:|tel:)/i.test(r.target) ? { kind: "url", url: r.target } : void 0;
794
795
  }
795
- function Ue(t, n, e, o, s, r) {
796
- const a = I(t).find((x) => x.localName.startsWith("nv")), i = Ge(t, n, e, o, s, r), l = i ? _e(c(a ?? null, "cNvPr"), n.part, e.pkg) : void 0;
797
- if (l) for (const x of Array.isArray(i) ? i : [i]) x.link = l;
796
+ function Ke(t, n, e, o, s, r) {
797
+ const a = N(t).find((p) => p.localName.startsWith("nv")), i = Qe(t, n, e, o, s, r), l = i ? Ze(c(a ?? null, "cNvPr"), n.part, e.pkg) : void 0;
798
+ if (l) for (const p of Array.isArray(i) ? i : [i]) p.link = l;
798
799
  return i;
799
800
  }
800
- function Ge(t, n, e, o, s, r) {
801
- const a = { pkg: e.pkg, part: n.part, ctx: e.ctx }, i = I(t).find((d) => d.localName.startsWith("nv")), l = c(i ?? null, "cNvPr"), x = C(l, "id"), b = k(l, "name") || t.localName;
801
+ function Qe(t, n, e, o, s, r) {
802
+ const a = { pkg: e.pkg, part: n.part, ctx: e.ctx }, i = N(t).find((u) => u.localName.startsWith("nv")), l = c(i ?? null, "cNvPr"), p = C(l, "id"), x = k(l, "name") || t.localName;
802
803
  if (k(l, "hidden") === "1") return null;
803
804
  switch (t.localName) {
804
805
  case "sp":
805
- return Ze(t, n, e, o, x, b, r);
806
+ return en(t, n, e, o, p, x, r);
806
807
  case "cxnSp": {
807
- const d = c(t, "spPr"), m = W(c(d, "xfrm"));
808
- if (!m) return null;
809
- const g = o(m), f = c(t, "style"), h = G(c(d, "ln"), a) ?? It(f, a) ?? { width: 1, color: { hex: "#000000" } };
808
+ const u = c(t, "spPr"), g = W(c(u, "xfrm"));
809
+ if (!g) return null;
810
+ const b = o(g), f = c(t, "style"), h = G(c(u, "ln"), a) ?? Ot(f, a) ?? { width: 1, color: { hex: "#000000" } };
810
811
  if (!h) return null;
811
- const y = rt(d, g) ?? { geom: { kind: "preset", prst: "line" } }, u = (w) => w ? { id: C(w, "id"), idx: C(w, "idx") } : void 0, p = c(i ?? null, "cNvCxnSpPr");
812
- return { kind: "connector", id: x, name: b, ...g, geom: y.geom, line: h, start: u(c(p, "stCxn")), end: u(c(p, "endCxn")) };
812
+ const y = rt(u, b) ?? { geom: { kind: "preset", prst: "line" } }, d = (w) => w ? { id: C(w, "id"), idx: C(w, "idx") } : void 0, m = c(i ?? null, "cNvCxnSpPr");
813
+ return { kind: "connector", id: p, name: x, ...b, geom: y.geom, line: h, start: d(c(m, "stCxn")), end: d(c(m, "endCxn")) };
813
814
  }
814
815
  case "pic": {
815
- const d = c(t, "spPr");
816
- let m = W(c(d, "xfrm"));
817
- const g = K(c(i ?? null, "nvPr"));
818
- if (!m && g && (m = Ve(g, e)), !m) return null;
819
- const f = c(t, "blipFill"), h = f ? Jt(f, a) : null;
816
+ const u = c(t, "spPr");
817
+ let g = W(c(u, "xfrm"));
818
+ const b = Q(c(i ?? null, "nvPr"));
819
+ if (!g && b && (g = Je(b, e)), !g) return null;
820
+ const f = c(t, "blipFill"), h = f ? ne(f, a) : null;
820
821
  if (!h)
821
- return e.warnings.push(`Picture "${b}" has no image the importer can read.`), null;
822
- const y = c(f, "srcRect"), u = y ? { l: C(y, "l") / 1e5, t: C(y, "t") / 1e5, r: C(y, "r") / 1e5, b: C(y, "b") / 1e5 } : void 0, p = k(R(f, "blip", "alphaModFix"), "amt"), w = o(m), M = rt(d, w)?.geom, S = M && !(M.kind === "preset" && M.prst === "rect") ? M : void 0;
823
- return { kind: "picture", id: x, name: b, ...w, media: h, crop: u, alpha: p !== null ? Number(p) / 1e5 : void 0, descr: k(l, "descr") || void 0, geom: S, ...R(f, "blip", "grayscl") ? { grayscale: !0 } : {} };
822
+ return e.warnings.push(`Picture "${x}" has no image the importer can read.`), null;
823
+ const y = c(f, "srcRect"), d = y ? { l: C(y, "l") / 1e5, t: C(y, "t") / 1e5, r: C(y, "r") / 1e5, b: C(y, "b") / 1e5 } : void 0, m = k(A(f, "blip", "alphaModFix"), "amt"), w = o(g), M = rt(u, w)?.geom, S = M && !(M.kind === "preset" && M.prst === "rect") ? M : void 0;
824
+ return { kind: "picture", id: p, name: x, ...w, media: h, crop: d, alpha: m !== null ? Number(m) / 1e5 : void 0, descr: k(l, "descr") || void 0, geom: S, ...A(f, "blip", "grayscl") ? { grayscale: !0 } : {} };
824
825
  }
825
826
  case "grpSp": {
826
- const d = c(t, "grpSpPr"), m = c(d, "xfrm"), g = je(m, o), f = at(t, n, e, g, s + 1, r);
827
+ const u = c(t, "grpSpPr"), g = c(u, "xfrm"), b = Xe(g, o), f = at(t, n, e, b, s + 1, r);
827
828
  if (!f.length) return null;
828
- const h = ht(f);
829
- return { kind: "group", id: x, name: b, ...h, children: f };
829
+ const h = pt(f);
830
+ return { kind: "group", id: p, name: x, ...h, children: f };
830
831
  }
831
832
  case "graphicFrame":
832
- return Je(t, n, e, o, x, b, s);
833
+ return sn(t, n, e, o, p, x, s);
833
834
  default:
834
835
  return null;
835
836
  }
836
837
  }
837
- function ht(t) {
838
+ function pt(t) {
838
839
  let n = 1 / 0, e = 1 / 0, o = -1 / 0, s = -1 / 0;
839
840
  for (const r of t)
840
841
  n = Math.min(n, r.x), e = Math.min(e, r.y), o = Math.max(o, r.x + r.w), s = Math.max(s, r.y + r.h);
841
842
  return { x: n, y: e, w: Math.max(0, o - n), h: Math.max(0, s - e) };
842
843
  }
843
- function Ve(t, n) {
844
- const e = ut(n.layout?.tree ?? null, t), o = W(R(e, "spPr", "xfrm"));
844
+ function Je(t, n) {
845
+ const e = ht(n.layout?.tree ?? null, t), o = W(A(e, "spPr", "xfrm"));
845
846
  if (o) return o;
846
- const s = ut(n.master?.tree ?? null, { type: oe(t.type), idx: 0 });
847
- return W(R(s, "spPr", "xfrm"));
847
+ const s = ht(n.master?.tree ?? null, { type: ae(t.type), idx: 0 });
848
+ return W(A(s, "spPr", "xfrm"));
848
849
  }
849
- function qe(...t) {
850
+ function tn(...t) {
850
851
  for (const n of t) {
851
852
  const e = n();
852
853
  if (e !== void 0) return e;
853
854
  }
854
855
  }
855
- function Ze(t, n, e, o, s, r, a) {
856
- const i = { pkg: e.pkg, part: n.part, ctx: e.ctx }, l = st(t), x = K(l);
857
- if (x && !a) return null;
858
- const b = c(t, "spPr"), d = c(t, "style"), m = k(R(t, "nvSpPr", "cNvSpPr"), "txBox") === "1", g = x && e.layout ? ut(e.layout.tree, x) : null, f = x && e.master ? ut(e.master.tree, { type: oe(g ? K(st(g))?.type ?? x.type : x.type), idx: 0 }) : null, h = g && e.layout ? { pkg: e.pkg, part: e.layout.part, ctx: e.ctx } : null, y = f && e.master ? { pkg: e.pkg, part: e.master.part, ctx: e.ctx } : null;
859
- let u = W(c(b, "xfrm")) ?? W(R(g, "spPr", "xfrm")) ?? W(R(f, "spPr", "xfrm"));
860
- if (!u) return null;
861
- u = o(u);
862
- const p = rt(b, u) ?? (g ? rt(c(g, "spPr"), u) : void 0) ?? (f ? rt(c(f, "spPr"), u) : void 0) ?? { geom: { kind: "preset", prst: "rect" } }, M = (B(t, "useBgFill") ? e.background?.kind === "image" ? { kind: "none" } : e.background ?? { kind: "solid", color: { hex: "#ffffff" } } : void 0) ?? V(b, i) ?? dt(d, i) ?? (h ? V(c(g, "spPr"), h) : void 0) ?? (y ? V(c(f, "spPr"), y) : void 0) ?? (h ? dt(c(g, "style"), h) : void 0) ?? { kind: "none" }, S = qe(
863
- () => G(c(b, "ln"), i),
864
- () => It(d, i),
865
- () => h ? G(R(g, "spPr", "ln"), h) : void 0,
866
- () => y ? G(R(f, "spPr", "ln"), y) : void 0
856
+ function en(t, n, e, o, s, r, a) {
857
+ const i = { pkg: e.pkg, part: n.part, ctx: e.ctx }, l = st(t), p = Q(l);
858
+ if (p && !a) return null;
859
+ const x = c(t, "spPr"), u = c(t, "style"), g = k(A(t, "nvSpPr", "cNvSpPr"), "txBox") === "1", b = p && e.layout ? ht(e.layout.tree, p) : null, f = p && e.master ? ht(e.master.tree, { type: ae(b ? Q(st(b))?.type ?? p.type : p.type), idx: 0 }) : null, h = b && e.layout ? { pkg: e.pkg, part: e.layout.part, ctx: e.ctx } : null, y = f && e.master ? { pkg: e.pkg, part: e.master.part, ctx: e.ctx } : null;
860
+ let d = W(c(x, "xfrm")) ?? W(A(b, "spPr", "xfrm")) ?? W(A(f, "spPr", "xfrm"));
861
+ if (!d) return null;
862
+ d = o(d);
863
+ const m = rt(x, d) ?? (b ? rt(c(b, "spPr"), d) : void 0) ?? (f ? rt(c(f, "spPr"), d) : void 0) ?? { geom: { kind: "preset", prst: "rect" } }, M = (B(t, "useBgFill") ? e.background?.kind === "image" ? { kind: "none" } : e.background ?? { kind: "solid", color: { hex: "#ffffff" } } : void 0) ?? q(x, i) ?? dt(u, i) ?? (h ? q(c(b, "spPr"), h) : void 0) ?? (y ? q(c(f, "spPr"), y) : void 0) ?? (h ? dt(c(b, "style"), h) : void 0) ?? { kind: "none" }, S = tn(
864
+ () => G(c(x, "ln"), i),
865
+ () => Ot(u, i),
866
+ () => h ? G(A(b, "spPr", "ln"), h) : void 0,
867
+ () => y ? G(A(f, "spPr", "ln"), y) : void 0
867
868
  ) ?? null, v = [];
868
- if (x) {
869
- const O = g ? K(st(g))?.type ?? x.type : x.type;
870
- v.push(it.has(O) ? e.masterTx.title : ["body", "obj", "subTitle", "tbl", "chart", "dgm", "media", "pic", "clipArt"].includes(O) ? e.masterTx.body : e.masterTx.other), v.push(R(f, "txBody", "lstStyle"), R(g, "txBody", "lstStyle"));
869
+ if (p) {
870
+ const O = b ? Q(st(b))?.type ?? p.type : p.type;
871
+ v.push(it.has(O) ? e.masterTx.title : ["body", "obj", "subTitle", "tbl", "chart", "dgm", "media", "pic", "clipArt"].includes(O) ? e.masterTx.body : e.masterTx.other), v.push(A(f, "txBody", "lstStyle"), A(b, "txBody", "lstStyle"));
871
872
  } else
872
873
  v.push(e.defaultText);
873
- const N = c(d, "fontRef"), P = {
874
+ const I = c(u, "fontRef"), P = {
874
875
  levels: v,
875
- bodyPr: [R(f, "txBody", "bodyPr"), R(g, "txBody", "bodyPr")],
876
- fontRef: N ? { font: k(N, "idx") === "major" ? "+mj-lt" : "+mn-lt", color: D(N, i.ctx) } : void 0
877
- }, L = Nt(c(t, "txBody"), P, i);
878
- if (!(M.kind !== "none" || !!S || !!L)) return null;
879
- let H = p.textRect;
880
- const T = W(c(b, "xfrm")), A = L ? W(c(t, "txXfrm")) : null;
881
- if (A && T && T.w > 0 && T.h > 0) {
882
- const O = u.w / T.w, Y = u.h / T.h, j = { l: (A.x - T.x) * O, t: (A.y - T.y) * Y, r: (A.x + A.w - T.x) * O, b: (A.y + A.h - T.y) * Y };
883
- (Math.abs(j.l) > 0.5 || Math.abs(j.t) > 0.5 || Math.abs(j.r - u.w) > 0.5 || Math.abs(j.b - u.h) > 0.5) && (H = j);
876
+ bodyPr: [A(f, "txBody", "bodyPr"), A(b, "txBody", "bodyPr")],
877
+ fontRef: I ? { font: k(I, "idx") === "major" ? "+mj-lt" : "+mn-lt", color: j(I, i.ctx) } : void 0
878
+ }, E = At(c(t, "txBody"), P, i);
879
+ if (!(M.kind !== "none" || !!S || !!E)) return null;
880
+ let H = m.textRect;
881
+ const T = W(c(x, "xfrm")), L = E ? W(c(t, "txXfrm")) : null;
882
+ if (L && T && T.w > 0 && T.h > 0) {
883
+ const O = d.w / T.w, Y = d.h / T.h, D = { l: (L.x - T.x) * O, t: (L.y - T.y) * Y, r: (L.x + L.w - T.x) * O, b: (L.y + L.h - T.y) * Y };
884
+ (Math.abs(D.l) > 0.5 || Math.abs(D.t) > 0.5 || Math.abs(D.r - d.w) > 0.5 || Math.abs(D.b - d.h) > 0.5) && (H = D);
884
885
  }
885
- return { kind: "shape", id: s, name: r, ...u, geom: p.geom, fill: M, line: S, text: L, textBox: m || void 0, textRect: H };
886
+ return { kind: "shape", id: s, name: r, ...d, geom: m.geom, fill: M, line: S, text: E, textBox: g || void 0, textRect: H };
886
887
  }
887
- const Wt = "{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}";
888
- function Ke(t, n) {
888
+ const Gt = "{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}";
889
+ function nn(t, n) {
889
890
  const e = {};
890
891
  if (!t) return e;
891
- const o = c(t, "tcStyle"), s = c(t, "tcTxStyle"), r = c(o, "fill"), a = r ? V(r, n) : dt(o, n);
892
+ const o = c(t, "tcStyle"), s = c(t, "tcTxStyle"), r = c(o, "fill"), a = r ? q(r, n) : dt(o, n);
892
893
  a && (e.fill = a);
893
- const i = D(s, n.ctx) ?? D(c(s, "fontRef"), n.ctx);
894
+ const i = j(s, n.ctx) ?? j(c(s, "fontRef"), n.ctx);
894
895
  i && (e.text = i), k(s, "b") === "on" && (e.bold = !0);
895
896
  const l = c(o, "tcBdr");
896
- for (const x of ["insideH", "bottom", "top", "left"]) {
897
- const b = c(l, x);
898
- if (!b) continue;
899
- const d = G(c(b, "ln"), n) ?? It(b, n);
900
- if (d !== void 0) {
901
- e.border = d;
897
+ for (const p of ["insideH", "bottom", "top", "left"]) {
898
+ const x = c(l, p);
899
+ if (!x) continue;
900
+ const u = G(c(x, "ln"), n) ?? Ot(x, n);
901
+ if (u !== void 0) {
902
+ e.border = u;
902
903
  break;
903
904
  }
904
905
  }
905
906
  return e;
906
907
  }
907
- function Qe(t, n, e) {
908
- const o = ((c(t, "tableStyleId")?.textContent || "").trim() || k(e, "def") || Wt).toUpperCase(), s = (d) => B(t, d) ?? !1, r = { firstRow: s("firstRow"), lastRow: s("lastRow"), firstCol: s("firstCol"), lastCol: s("lastCol"), bandRow: s("bandRow"), bandCol: s("bandCol") }, a = I(e, "tblStyle").find((d) => (k(d, "styleId") || "").toUpperCase() === o);
908
+ function on(t, n, e) {
909
+ const o = ((c(t, "tableStyleId")?.textContent || "").trim() || k(e, "def") || Gt).toUpperCase(), s = (u) => B(t, u) ?? !1, r = { firstRow: s("firstRow"), lastRow: s("lastRow"), firstCol: s("firstCol"), lastCol: s("lastCol"), bandRow: s("bandRow"), bandCol: s("bandCol") }, a = N(e, "tblStyle").find((u) => (k(u, "styleId") || "").toUpperCase() === o);
909
910
  if (a) {
910
- const d = (y) => Ke(c(a, y), n), m = c(a, "tblBg"), g = m ? c(m, "fill") ? V(c(m, "fill"), n) : dt(m, n) : void 0, f = {
911
- whole: d("wholeTbl"),
912
- b1H: d("band1H"),
913
- b2H: d("band2H"),
914
- b1V: d("band1V"),
915
- b2V: d("band2V"),
916
- firstRow: d("firstRow"),
917
- lastRow: d("lastRow"),
918
- firstCol: d("firstCol"),
919
- lastCol: d("lastCol")
920
- }, h = (y, u, p, w) => {
921
- const M = [f.whole], S = y - (r.firstRow ? 1 : 0), v = u - (r.firstCol ? 1 : 0);
922
- r.bandCol && v >= 0 && M.push(v % 2 === 0 ? f.b1V : f.b2V), r.bandRow && S >= 0 && M.push(S % 2 === 0 ? f.b1H : f.b2H), r.firstCol && u === 0 && M.push(f.firstCol), r.lastCol && u === w - 1 && M.push(f.lastCol), r.firstRow && y === 0 && M.push(f.firstRow), r.lastRow && y === p - 1 && M.push(f.lastRow);
923
- const N = {};
911
+ const u = (y) => nn(c(a, y), n), g = c(a, "tblBg"), b = g ? c(g, "fill") ? q(c(g, "fill"), n) : dt(g, n) : void 0, f = {
912
+ whole: u("wholeTbl"),
913
+ b1H: u("band1H"),
914
+ b2H: u("band2H"),
915
+ b1V: u("band1V"),
916
+ b2V: u("band2V"),
917
+ firstRow: u("firstRow"),
918
+ lastRow: u("lastRow"),
919
+ firstCol: u("firstCol"),
920
+ lastCol: u("lastCol")
921
+ }, h = (y, d, m, w) => {
922
+ const M = [f.whole], S = y - (r.firstRow ? 1 : 0), v = d - (r.firstCol ? 1 : 0);
923
+ r.bandCol && v >= 0 && M.push(v % 2 === 0 ? f.b1V : f.b2V), r.bandRow && S >= 0 && M.push(S % 2 === 0 ? f.b1H : f.b2H), r.firstCol && d === 0 && M.push(f.firstCol), r.lastCol && d === w - 1 && M.push(f.lastCol), r.firstRow && y === 0 && M.push(f.firstRow), r.lastRow && y === m - 1 && M.push(f.lastRow);
924
+ const I = {};
924
925
  for (const P of M)
925
- P.fill && (N.fill = P.fill), P.text && (N.text = P.text), P.bold && (N.bold = !0), P.border !== void 0 && (N.border = P.border);
926
- return N;
926
+ P.fill && (I.fill = P.fill), P.text && (I.text = P.text), P.bold && (I.bold = !0), P.border !== void 0 && (I.border = P.border);
927
+ return I;
927
928
  };
928
- return g && g.kind !== "none" && (h.background = g), h;
929
+ return b && b.kind !== "none" && (h.background = b), h;
929
930
  }
930
- if (o !== Wt) return null;
931
- const i = n.ctx.theme.colors.accent1 ?? "#4472c4", l = (d) => {
932
- const [m, g, f] = Qt(i);
933
- return { hex: ct(U(ot(m) * d + (1 - d)), U(ot(g) * d + (1 - d)), U(ot(f) * d + (1 - d))) };
934
- }, x = { hex: n.ctx.theme.colors.lt1 ?? "#ffffff" }, b = ne("tx1", n) ?? void 0;
935
- return (d) => {
936
- const m = r.firstRow && d === 0, g = r.bandRow && !m && (d - (r.firstRow ? 1 : 0)) % 2 === 0;
931
+ if (o !== Gt) return null;
932
+ const i = n.ctx.theme.colors.accent1 ?? "#4472c4", l = (u) => {
933
+ const [g, b, f] = ee(i);
934
+ return { hex: ft(U(ot(g) * u + (1 - u)), U(ot(b) * u + (1 - u)), U(ot(f) * u + (1 - u))) };
935
+ }, p = { hex: n.ctx.theme.colors.lt1 ?? "#ffffff" }, x = re("tx1", n) ?? void 0;
936
+ return (u) => {
937
+ const g = r.firstRow && u === 0, b = r.bandRow && !g && (u - (r.firstRow ? 1 : 0)) % 2 === 0;
937
938
  return {
938
- fill: { kind: "solid", color: m ? { hex: i } : l(g ? 0.4 : 0.2) },
939
- text: m ? x : b,
940
- bold: m || void 0,
941
- border: { width: 1.33, color: x }
939
+ fill: { kind: "solid", color: g ? { hex: i } : l(b ? 0.4 : 0.2) },
940
+ text: g ? p : x,
941
+ bold: g || void 0,
942
+ border: { width: 1.33, color: p }
942
943
  };
943
944
  };
944
945
  }
945
- function Je(t, n, e, o, s, r, a = 0) {
946
+ function sn(t, n, e, o, s, r, a = 0) {
946
947
  const i = { pkg: e.pkg, part: n.part, ctx: e.ctx }, l = W(c(t, "xfrm"));
947
948
  if (!l) return null;
948
- const x = R(t, "graphic", "graphicData"), b = c(x, "tbl");
949
- if (b) {
950
- const g = I(c(b, "tblGrid"), "gridCol").map((w) => E(C(w, "w"))), f = Qe(c(b, "tblPr"), i, e.tableStyles), h = [];
951
- let y = l.y, u = 1e6 + s * 1e3;
952
- const p = I(b, "tr");
953
- if (p.forEach((w, M) => {
954
- const S = E(C(w, "h"));
955
- let v = l.x, N = 0;
956
- for (const P of I(w, "tc")) {
957
- const L = Math.max(1, C(P, "gridSpan", 1)), X = g.slice(N, N + L).reduce((tt, Z) => tt + Z, 0);
958
- if (N += L, B(P, "hMerge") || B(P, "vMerge")) {
949
+ const p = A(t, "graphic", "graphicData"), x = c(p, "tbl");
950
+ if (x) {
951
+ const b = N(c(x, "tblGrid"), "gridCol").map((w) => R(C(w, "w"))), f = on(c(x, "tblPr"), i, e.tableStyles), h = [];
952
+ let y = l.y, d = 1e6 + s * 1e3;
953
+ const m = N(x, "tr");
954
+ if (m.forEach((w, M) => {
955
+ const S = R(C(w, "h"));
956
+ let v = l.x, I = 0;
957
+ for (const P of N(w, "tc")) {
958
+ const E = Math.max(1, C(P, "gridSpan", 1)), X = b.slice(I, I + E).reduce((tt, K) => tt + K, 0);
959
+ if (I += E, B(P, "hMerge") || B(P, "vMerge")) {
959
960
  v += X;
960
961
  continue;
961
962
  }
962
- const H = Math.max(1, C(P, "rowSpan", 1)), T = c(P, "tcPr"), A = H > 1 ? S * H : S, O = f ? f(M, N - L, p.length, g.length) : null, Y = O?.text ? { color: O.text } : void 0, j = Nt(c(P, "txBody"), { levels: [e.defaultText], bodyPr: [], fontRef: Y }, i);
963
- j && O?.bold && j.paragraphs.forEach((tt) => tt.runs.forEach((Z) => {
964
- Z.bold === void 0 && (Z.bold = !0);
965
- })), j && (j.insets = { l: E(C(T, "marL", 91440)), r: E(C(T, "marR", 91440)), t: E(C(T, "marT", 45720)), b: E(C(T, "marB", 45720)) }, j.anchor = k(T, "anchor") === "ctr" ? "ctr" : k(T, "anchor") === "b" ? "b" : "t");
966
- const _ = G(c(T, "lnB"), i) ?? G(c(T, "lnT"), i) ?? (O ? O.border ?? null : { width: 1, color: { hex: "#bfbfbf" } }), q = O?.fill;
963
+ const H = Math.max(1, C(P, "rowSpan", 1)), T = c(P, "tcPr"), L = H > 1 ? S * H : S, O = f ? f(M, I - E, m.length, b.length) : null, Y = O?.text ? { color: O.text } : void 0, D = At(c(P, "txBody"), { levels: [e.defaultText], bodyPr: [], fontRef: Y }, i);
964
+ D && O?.bold && D.paragraphs.forEach((tt) => tt.runs.forEach((K) => {
965
+ K.bold === void 0 && (K.bold = !0);
966
+ })), D && (D.insets = { l: R(C(T, "marL", 91440)), r: R(C(T, "marR", 91440)), t: R(C(T, "marT", 45720)), b: R(C(T, "marB", 45720)) }, D.anchor = k(T, "anchor") === "ctr" ? "ctr" : k(T, "anchor") === "b" ? "b" : "t");
967
+ const _ = G(c(T, "lnB"), i) ?? G(c(T, "lnT"), i) ?? (O ? O.border ?? null : { width: 1, color: { hex: "#bfbfbf" } }), Z = O?.fill;
967
968
  h.push({
968
969
  kind: "shape",
969
- id: u++,
970
+ id: d++,
970
971
  name: `${r} cell`,
971
- ...o({ x: v, y, w: X, h: A, rot: 0, flipH: !1, flipV: !1 }),
972
+ ...o({ x: v, y, w: X, h: L, rot: 0, flipH: !1, flipV: !1 }),
972
973
  geom: { kind: "preset", prst: "rect" },
973
- fill: V(T, i) ?? q ?? { kind: "none" },
974
+ fill: q(T, i) ?? Z ?? { kind: "none" },
974
975
  line: _,
975
- text: j
976
+ text: D
976
977
  }), v += X;
977
978
  }
978
979
  y += S;
979
980
  }), !h.length) return null;
980
981
  if (f?.background) {
981
- const w = ht(h);
982
+ const w = pt(h);
982
983
  h.unshift({
983
984
  kind: "shape",
984
- id: u++,
985
+ id: d++,
985
986
  name: `${r} background`,
986
987
  x: w.x,
987
988
  y: w.y,
@@ -995,17 +996,17 @@ function Je(t, n, e, o, s, r, a = 0) {
995
996
  line: null
996
997
  });
997
998
  }
998
- return { kind: "group", id: s, name: r, ...ht(h), children: h };
999
+ return { kind: "group", id: s, name: r, ...pt(h), children: h };
999
1000
  }
1000
- const d = k(x, "uri") || "";
1001
- if (/diagram/.test(d)) {
1002
- const g = tn(x, n, e, o, l, s, r, a);
1003
- if (g) return g;
1004
- const f = en(x, n, e, o, l, s, r, i);
1001
+ const u = k(p, "uri") || "";
1002
+ if (/diagram/.test(u)) {
1003
+ const b = rn(p, n, e, o, l, s, r, a);
1004
+ if (b) return b;
1005
+ const f = an(p, n, e, o, l, s, r, i);
1005
1006
  if (f) return f;
1006
1007
  }
1007
- const m = /chart/.test(d) ? "Chart" : /diagram/.test(d) ? "SmartArt diagram" : "Embedded object";
1008
- return e.warnings.push(`${m} "${r}" was imported as a placeholder frame.`), {
1008
+ const g = /chart/.test(u) ? "Chart" : /diagram/.test(u) ? "SmartArt diagram" : "Embedded object";
1009
+ return e.warnings.push(`${g} "${r}" was imported as a placeholder frame.`), {
1009
1010
  kind: "shape",
1010
1011
  id: s,
1011
1012
  name: r,
@@ -1013,64 +1014,64 @@ function Je(t, n, e, o, s, r, a = 0) {
1013
1014
  geom: { kind: "preset", prst: "rect" },
1014
1015
  fill: { kind: "solid", color: { hex: "#f1f3f5" } },
1015
1016
  line: { width: 1, color: { hex: "#adb5bd" }, dash: "dash" },
1016
- text: { paragraphs: [{ runs: [{ text: `${m}: ${r}`, size: 16, color: { hex: "#495057" } }], align: "ctr" }], anchor: "ctr", insets: { l: 8, t: 8, r: 8, b: 8 }, wrap: !0 }
1017
+ text: { paragraphs: [{ runs: [{ text: `${g}: ${r}`, size: 16, color: { hex: "#495057" } }], align: "ctr" }], anchor: "ctr", insets: { l: 8, t: 8, r: 8, b: 8 }, wrap: !0 }
1017
1018
  };
1018
1019
  }
1019
- function tn(t, n, e, o, s, r, a, i) {
1020
- const l = e.pkg.rels(n.part), x = k(c(t, "relIds"), "r:dm"), b = x ? l.get(x) : void 0;
1021
- let d;
1022
- if (b && !b.external) {
1023
- const u = Ot(e.pkg.xml(b.target), "dataModelExt", 6), p = u ? l.get(k(u, "relId") || "") : void 0;
1024
- p && !p.external && (d = p.target);
1020
+ function rn(t, n, e, o, s, r, a, i) {
1021
+ const l = e.pkg.rels(n.part), p = k(c(t, "relIds"), "r:dm"), x = p ? l.get(p) : void 0;
1022
+ let u;
1023
+ if (x && !x.external) {
1024
+ const d = lt(e.pkg.xml(x.target), "dataModelExt", 6), m = d ? l.get(k(d, "relId") || "") : void 0;
1025
+ m && !m.external && (u = m.target);
1025
1026
  }
1026
- if (!d) {
1027
- const u = [...l.values()].filter((p) => p.type === "diagramDrawing" && !p.external);
1028
- u.length === 1 && (d = u[0].target);
1027
+ if (!u) {
1028
+ const d = [...l.values()].filter((m) => m.type === "diagramDrawing" && !m.external);
1029
+ d.length === 1 && (u = d[0].target);
1029
1030
  }
1030
- if (!d) return null;
1031
- const m = c(e.pkg.xml(d), "spTree");
1032
- if (!m) return null;
1033
- const f = at(m, { part: d, tree: m }, e, (u) => o({ ...u, x: u.x + s.x, y: u.y + s.y }), i + 1, !0);
1031
+ if (!u) return null;
1032
+ const g = c(e.pkg.xml(u), "spTree");
1033
+ if (!g) return null;
1034
+ const f = at(g, { part: u, tree: g }, e, (d) => o({ ...d, x: d.x + s.x, y: d.y + s.y }), i + 1, !0);
1034
1035
  if (!f.length) return null;
1035
1036
  let h = 2e6 + r * 1e3;
1036
- const y = (u) => u.forEach((p) => {
1037
- p.id = h++, p.kind === "group" && y(p.children);
1037
+ const y = (d) => d.forEach((m) => {
1038
+ m.id = h++, m.kind === "group" && y(m.children);
1038
1039
  });
1039
- return y(f), { kind: "group", id: r, name: a, ...ht(f), children: f };
1040
- }
1041
- function en(t, n, e, o, s, r, a, i) {
1042
- const l = k(c(t, "relIds"), "r:dm"), x = l ? e.pkg.rels(n.part).get(l) : void 0;
1043
- if (!x || x.external) return null;
1044
- const b = e.pkg.xml(x.target), d = /* @__PURE__ */ new Map();
1045
- for (const u of I(c(b, "ptLst"), "pt")) d.set(k(u, "modelId") || "", u);
1046
- const m = /* @__PURE__ */ new Map();
1047
- for (const u of I(c(b, "cxnLst"), "cxn")) {
1048
- if ((k(u, "type") || "parOf") !== "parOf") continue;
1049
- const p = k(u, "srcId") || "", w = k(u, "destId") || "";
1050
- m.has(p) || m.set(p, []), m.get(p).push({ id: w, ord: C(u, "srcOrd") });
1040
+ return y(f), { kind: "group", id: r, name: a, ...pt(f), children: f };
1041
+ }
1042
+ function an(t, n, e, o, s, r, a, i) {
1043
+ const l = k(c(t, "relIds"), "r:dm"), p = l ? e.pkg.rels(n.part).get(l) : void 0;
1044
+ if (!p || p.external) return null;
1045
+ const x = e.pkg.xml(p.target), u = /* @__PURE__ */ new Map();
1046
+ for (const d of N(c(x, "ptLst"), "pt")) u.set(k(d, "modelId") || "", d);
1047
+ const g = /* @__PURE__ */ new Map();
1048
+ for (const d of N(c(x, "cxnLst"), "cxn")) {
1049
+ if ((k(d, "type") || "parOf") !== "parOf") continue;
1050
+ const m = k(d, "srcId") || "", w = k(d, "destId") || "";
1051
+ g.has(m) || g.set(m, []), g.get(m).push({ id: w, ord: C(d, "srcOrd") });
1051
1052
  }
1052
- const g = [...d.values()].find((u) => k(u, "type") === "doc");
1053
- if (!g) return null;
1054
- const f = [], h = /* @__PURE__ */ new Set(), y = (u, p) => {
1055
- if (!(h.has(u) || p > 16 || f.length > 500)) {
1056
- h.add(u);
1057
- for (const w of (m.get(u) ?? []).sort((M, S) => M.ord - S.ord)) {
1058
- const M = d.get(w.id), S = k(M, "type") || "node";
1053
+ const b = [...u.values()].find((d) => k(d, "type") === "doc");
1054
+ if (!b) return null;
1055
+ const f = [], h = /* @__PURE__ */ new Set(), y = (d, m) => {
1056
+ if (!(h.has(d) || m > 16 || f.length > 500)) {
1057
+ h.add(d);
1058
+ for (const w of (g.get(d) ?? []).sort((M, S) => M.ord - S.ord)) {
1059
+ const M = u.get(w.id), S = k(M, "type") || "node";
1059
1060
  if (!M || S !== "node" && S !== "asst") continue;
1060
- const v = Nt(c(M, "t"), { levels: [e.defaultText], bodyPr: [] }, i);
1061
- for (const N of v?.paragraphs ?? [])
1062
- N.runs.some((P) => !P.br && P.text.trim()) && f.push({
1063
- ...N,
1061
+ const v = At(c(M, "t"), { levels: [e.defaultText], bodyPr: [] }, i);
1062
+ for (const I of v?.paragraphs ?? [])
1063
+ I.runs.some((P) => !P.br && P.text.trim()) && f.push({
1064
+ ...I,
1064
1065
  align: "l",
1065
- level: p,
1066
- ...p > 0 ? { bullet: "char" } : {},
1067
- runs: N.runs.map((P) => ({ ...P, size: P.size ?? (p > 0 ? 16 : 18), bold: P.bold ?? (p === 0 ? !0 : void 0) }))
1066
+ level: m,
1067
+ ...m > 0 ? { bullet: "char" } : {},
1068
+ runs: I.runs.map((P) => ({ ...P, size: P.size ?? (m > 0 ? 16 : 18), bold: P.bold ?? (m === 0 ? !0 : void 0) }))
1068
1069
  });
1069
- y(w.id, p + 1);
1070
+ y(w.id, m + 1);
1070
1071
  }
1071
1072
  }
1072
1073
  };
1073
- return y(k(g, "modelId") || "", 0), f.length ? (e.warnings.push(`SmartArt diagram "${a}" had no saved drawing; its text was imported as a list.`), {
1074
+ return y(k(b, "modelId") || "", 0), f.length ? (e.warnings.push(`SmartArt diagram "${a}" had no saved drawing; its text was imported as a list.`), {
1074
1075
  kind: "shape",
1075
1076
  id: r,
1076
1077
  name: a,
@@ -1082,45 +1083,45 @@ function en(t, n, e, o, s, r, a, i) {
1082
1083
  text: { paragraphs: f, anchor: "ctr", insets: { l: 8, t: 8, r: 8, b: 8 }, wrap: !0 }
1083
1084
  }) : null;
1084
1085
  }
1085
- function Ot(t, n, e) {
1086
+ function lt(t, n, e) {
1086
1087
  if (!t || e < 0) return null;
1087
- for (const o of J(t)) {
1088
+ for (const o of V(t)) {
1088
1089
  if (o.localName === n) return o;
1089
- const s = Ot(o, n, e - 1);
1090
+ const s = lt(o, n, e - 1);
1090
1091
  if (s) return s;
1091
1092
  }
1092
1093
  return null;
1093
1094
  }
1094
- function yt(t, n) {
1095
+ function kt(t, n) {
1095
1096
  const e = c(t, "bg");
1096
1097
  if (!e) return;
1097
1098
  const o = c(e, "bgPr");
1098
1099
  if (o)
1099
- return V(o, n);
1100
+ return q(o, n);
1100
1101
  const s = c(e, "bgRef");
1101
1102
  if (s) {
1102
1103
  const r = C(s, "idx"), i = (r >= 1001 ? n.ctx.theme.bgFills : n.ctx.theme.fills)[r >= 1001 ? r - 1001 : r - 1];
1103
- return (i ? Tt(i, { ...n, ctx: { ...n.ctx, phClr: D(s, n.ctx) ?? void 0 } }) : void 0) ?? (D(s, n.ctx) ? { kind: "solid", color: D(s, n.ctx) } : void 0);
1104
+ return (i ? Nt(i, { ...n, ctx: { ...n.ctx, phClr: j(s, n.ctx) ?? void 0 } }) : void 0) ?? (j(s, n.ctx) ? { kind: "solid", color: j(s, n.ctx) } : void 0);
1104
1105
  }
1105
1106
  }
1106
- function nn(t, n) {
1107
- const e = t.relOfType(n, "notesSlide"), o = e ? R(t.xml(e), "cSld", "spTree") : null;
1107
+ function ln(t, n) {
1108
+ const e = t.relOfType(n, "notesSlide"), o = e ? A(t.xml(e), "cSld", "spTree") : null;
1108
1109
  if (!o) return;
1109
1110
  const s = [], r = (i) => {
1110
- for (const l of J(i)) {
1111
+ for (const l of V(i)) {
1111
1112
  if (l.localName === "grpSp") {
1112
1113
  r(l);
1113
1114
  continue;
1114
1115
  }
1115
1116
  if (l.localName !== "sp") continue;
1116
- const x = K(st(l));
1117
- if (!(!x || x.type !== "body" && x.type !== "obj"))
1118
- for (const b of I(c(l, "txBody"), "p")) {
1119
- let d = "";
1120
- for (const m of I(b))
1121
- m.localName === "r" || m.localName === "fld" ? d += c(m, "t")?.textContent ?? "" : m.localName === "br" && (d += `
1117
+ const p = Q(st(l));
1118
+ if (!(!p || p.type !== "body" && p.type !== "obj"))
1119
+ for (const x of N(c(l, "txBody"), "p")) {
1120
+ let u = "";
1121
+ for (const g of N(x))
1122
+ g.localName === "r" || g.localName === "fld" ? u += c(g, "t")?.textContent ?? "" : g.localName === "br" && (u += `
1122
1123
  `);
1123
- s.push(d);
1124
+ s.push(u);
1124
1125
  }
1125
1126
  }
1126
1127
  };
@@ -1129,10 +1130,18 @@ function nn(t, n) {
1129
1130
  `).replace(/\s+$/, "");
1130
1131
  return a.trim() ? a : void 0;
1131
1132
  }
1132
- function on(t) {
1133
- const n = J(t).find((a) => a.localName === "transition");
1133
+ function cn(t) {
1134
+ for (const a of N(t, "AlternateContent"))
1135
+ for (const i of N(a, "Choice")) {
1136
+ const l = c(i, "transition");
1137
+ if (l && c(l, "morph")) {
1138
+ const p = k(l, "spd");
1139
+ return { kind: "morph", durationMs: k(l, "p14:dur") !== null ? C(l, "p14:dur") : p === "fast" ? 500 : p === "slow" ? 1e3 : 750 };
1140
+ }
1141
+ }
1142
+ const n = V(t).find((a) => a.localName === "transition");
1134
1143
  if (!n) return;
1135
- const e = I(n).find((a) => a.localName !== "sndAc" && a.localName !== "extLst");
1144
+ const e = N(n).find((a) => a.localName !== "sndAc" && a.localName !== "extLst");
1136
1145
  if (!e) return;
1137
1146
  const o = k(n, "spd"), s = k(n, "p14:dur") !== null ? C(n, "p14:dur") : o === "fast" ? 500 : o === "slow" ? 1e3 : 750, r = k(e, "dir");
1138
1147
  switch (e.localName) {
@@ -1143,105 +1152,169 @@ function on(t) {
1143
1152
  return { kind: "push", dir: r === "r" || r === "u" || r === "d" ? r : "l", durationMs: s };
1144
1153
  case "zoom":
1145
1154
  return { kind: "zoom", zoomIn: r !== "out", durationMs: s };
1155
+ case "morph":
1156
+ return { kind: "morph", durationMs: s };
1146
1157
  case "cut":
1147
1158
  return;
1148
1159
  default:
1149
1160
  return { kind: "fade", durationMs: s };
1150
1161
  }
1151
1162
  }
1152
- function _t(t) {
1153
- const n = J(t).find((s) => s.localName === "transition"), e = n ? k(n, "advTm") : null, o = e !== null ? Number(e) : NaN;
1163
+ function fn(t, n) {
1164
+ const e = A(t, "timing", "tnLst");
1165
+ if (!e) return [];
1166
+ const o = [];
1167
+ let s = 0;
1168
+ const r = [], a = (i, l) => {
1169
+ if (!(l > 40))
1170
+ for (const p of V(i)) {
1171
+ if (p.localName === "seq") {
1172
+ const x = c(p, "cTn"), u = k(x, "nodeType");
1173
+ if (u && u !== "mainSeq") {
1174
+ s++;
1175
+ continue;
1176
+ }
1177
+ }
1178
+ if (p.localName === "cTn" && k(p, "presetClass")) {
1179
+ r.push(p);
1180
+ continue;
1181
+ }
1182
+ a(p, l + 1);
1183
+ }
1184
+ };
1185
+ a(e, 0);
1186
+ for (const i of r) {
1187
+ const l = k(i, "presetClass");
1188
+ if (l !== "entr" && l !== "exit" && l !== "emph") {
1189
+ s++;
1190
+ continue;
1191
+ }
1192
+ const p = C(i, "presetID"), x = C(i, "presetSubtype"), u = k(i, "nodeType"), g = u === "clickEffect" ? "click" : u === "afterEffect" ? "after" : "with", b = Number(k(A(i, "stCondLst", "cond"), "delay")), f = vt(c(i, "childTnLst"), "cBhvr", 4), h = f.map((I) => lt(I, "spTgt", 2)).find(Boolean), y = h ? C(h, "spid") : NaN;
1193
+ if (!Number.isFinite(y) || lt(h, "txEl", 1)) {
1194
+ s++;
1195
+ continue;
1196
+ }
1197
+ const d = f.map((I) => Number(k(c(I, "cTn"), "dur"))).filter((I) => Number.isFinite(I) && I > 1), m = d.length ? Math.max(...d) : 500, { effect: w, known: M } = me(l, p);
1198
+ M || n(`An animation PowerPoint calls preset ${p} (${l}) came in as a plain ${w}.`);
1199
+ const S = vt(c(i, "childTnLst"), "animRot", 2)[0], v = k(i, "repeatCount");
1200
+ o.push({
1201
+ target: y,
1202
+ cls: l,
1203
+ effect: w,
1204
+ presetId: p,
1205
+ subtype: x,
1206
+ start: g,
1207
+ durationMs: m,
1208
+ delayMs: Number.isFinite(b) ? Math.max(0, b) : 0,
1209
+ ...Ft(x) && (w === "fly" || w === "wipe") && { dir: Ft(x) },
1210
+ ...w === "spin" && S && { degrees: C(S, "by") / 6e4 },
1211
+ ...v === "indefinite" ? { repeat: -1 } : v && Number(v) > 1e3 ? { repeat: Math.round(Number(v) / 1e3) } : {}
1212
+ });
1213
+ }
1214
+ return s && n(`${s} animation(s) couldn't be imported (motion paths, triggered or by-paragraph effects).`), o;
1215
+ }
1216
+ function vt(t, n, e) {
1217
+ if (!t || e < 0) return [];
1218
+ const o = [];
1219
+ for (const s of V(t))
1220
+ s.localName === n ? o.push(s) : o.push(...vt(s, n, e - 1));
1221
+ return o;
1222
+ }
1223
+ function Vt(t) {
1224
+ const n = V(t).find((s) => s.localName === "transition"), e = n ? k(n, "advTm") : null, o = e !== null ? Number(e) : NaN;
1154
1225
  return Number.isFinite(o) && o > 0 ? o : void 0;
1155
1226
  }
1156
- function sn(t, n) {
1227
+ function un(t, n) {
1157
1228
  const e = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
1158
- for (const r of I(c(t, "sldIdLst"), "sldId")) {
1229
+ for (const r of N(c(t, "sldIdLst"), "sldId")) {
1159
1230
  const a = n.get(k(r, "r:id") || ""), i = k(r, "id");
1160
1231
  a && i && o.set(i, a.target);
1161
1232
  }
1162
- const s = Ot(c(t, "extLst"), "sectionLst", 4);
1163
- for (const r of I(s, "section")) {
1164
- const a = (k(r, "name") || "").trim(), i = I(c(r, "sldIdLst"), "sldId")[0], l = i ? o.get(k(i, "id") || "") : void 0;
1233
+ const s = lt(c(t, "extLst"), "sectionLst", 4);
1234
+ for (const r of N(s, "section")) {
1235
+ const a = (k(r, "name") || "").trim(), i = N(c(r, "sldIdLst"), "sldId")[0], l = i ? o.get(k(i, "id") || "") : void 0;
1165
1236
  a && l && !e.has(l) && e.set(l, a);
1166
1237
  }
1167
1238
  return e;
1168
1239
  }
1169
- function rn(t, n = {}) {
1240
+ function dn(t, n = {}) {
1170
1241
  const e = [], o = (T) => {
1171
1242
  e.length < 200 && !e.includes(T) && e.push(T);
1172
1243
  }, s = n.parseXml ?? ((T) => new DOMParser().parseFromString(T, "application/xml"));
1173
1244
  let r, a = 0, i = 0;
1174
1245
  try {
1175
- r = fe(t, {
1176
- filter: (T) => (a++, i += T.originalSize, a <= jt && T.originalSize <= Se && i <= Dt)
1246
+ r = he(t, {
1247
+ filter: (T) => (a++, i += T.originalSize, a <= Bt && T.originalSize <= Ne && i <= zt)
1177
1248
  });
1178
1249
  } catch {
1179
1250
  throw new Error("This file is not a PowerPoint presentation (it is not a valid .pptx package).");
1180
1251
  }
1181
- (a > jt || i > Dt) && o("The file is very large; some parts were skipped.");
1182
- const l = new Oe(r, s, o), x = l.relOfType("", "officeDocument") ?? "ppt/presentation.xml", b = l.xml(x);
1183
- if (!b || b.localName !== "presentation") throw new Error("This file is not a PowerPoint presentation (no presentation part).");
1184
- const d = c(b, "sldSz"), m = d ? Math.max(1, E(C(d, "cx", 9144e3))) : 960, g = d ? Math.max(1, E(C(d, "cy", 5143500))) : 540, f = c(b, "defaultTextStyle"), h = l.rels(x), y = l.relOfType(x, "tableStyles"), u = y ? l.xml(y) : null, p = [], w = /* @__PURE__ */ new Set();
1185
- for (const T of I(c(b, "sldIdLst"), "sldId")) {
1186
- const A = h.get(k(T, "r:id") || "");
1187
- A && !w.has(A.target) && p.length < Ce && (w.add(A.target), p.push(A.target));
1252
+ (a > Bt || i > zt) && o("The file is very large; some parts were skipped.");
1253
+ const l = new Fe(r, s, o), p = l.relOfType("", "officeDocument") ?? "ppt/presentation.xml", x = l.xml(p);
1254
+ if (!x || x.localName !== "presentation") throw new Error("This file is not a PowerPoint presentation (no presentation part).");
1255
+ const u = c(x, "sldSz"), g = u ? Math.max(1, R(C(u, "cx", 9144e3))) : 960, b = u ? Math.max(1, R(C(u, "cy", 5143500))) : 540, f = c(x, "defaultTextStyle"), h = l.rels(p), y = l.relOfType(p, "tableStyles"), d = y ? l.xml(y) : null, m = [], w = /* @__PURE__ */ new Set();
1256
+ for (const T of N(c(x, "sldIdLst"), "sldId")) {
1257
+ const L = h.get(k(T, "r:id") || "");
1258
+ L && !w.has(L.target) && m.length < Oe && (w.add(L.target), m.push(L.target));
1188
1259
  }
1189
1260
  const M = /* @__PURE__ */ new Map(), S = (T) => {
1190
- const A = l.relOfType(T, "theme");
1191
- return A ? (M.has(A) || M.set(A, gt(l.xml(A))), M.get(A)) : gt(null);
1261
+ const L = l.relOfType(T, "theme");
1262
+ return L ? (M.has(L) || M.set(L, xt(l.xml(L))), M.get(L)) : xt(null);
1192
1263
  }, v = (T) => {
1193
1264
  if (!T) return null;
1194
- const A = {};
1195
- for (let O = 0; O < T.attributes.length; O++) A[T.attributes[O].localName ?? T.attributes[O].name] = T.attributes[O].value;
1196
- return A;
1197
- }, N = sn(b, h), P = [];
1198
- p.forEach((T, A) => {
1265
+ const L = {};
1266
+ for (let O = 0; O < T.attributes.length; O++) L[T.attributes[O].localName ?? T.attributes[O].name] = T.attributes[O].value;
1267
+ return L;
1268
+ }, I = un(x, h), P = [];
1269
+ m.forEach((T, L) => {
1199
1270
  const O = l.xml(T);
1200
1271
  if (!O) {
1201
- o(`Slide ${A + 1} couldn't be read and was skipped.`);
1272
+ o(`Slide ${L + 1} couldn't be read and was skipped.`);
1202
1273
  return;
1203
1274
  }
1204
- const Y = l.relOfType(T, "slideLayout"), j = Y ? l.xml(Y) : null, _ = Y ? l.relOfType(Y, "slideMaster") : null, q = _ ? l.xml(_) : null, tt = _ ? S(_) : gt(null), Z = v(R(O, "clrMapOvr", "overrideClrMapping")) ?? v(R(j, "clrMapOvr", "overrideClrMapping")) ?? v(c(q, "clrMap")) ?? Pt, Rt = { theme: tt, clrMap: Z }, pt = c(q, "txStyles"), $ = {
1275
+ const Y = l.relOfType(T, "slideLayout"), D = Y ? l.xml(Y) : null, _ = Y ? l.relOfType(Y, "slideMaster") : null, Z = _ ? l.xml(_) : null, tt = _ ? S(_) : xt(null), K = v(A(O, "clrMapOvr", "overrideClrMapping")) ?? v(A(D, "clrMapOvr", "overrideClrMapping")) ?? v(c(Z, "clrMap")) ?? It, Lt = { theme: tt, clrMap: K }, mt = c(Z, "txStyles"), $ = {
1205
1276
  pkg: l,
1206
- ctx: Rt,
1207
- slide: { part: T, tree: R(O, "cSld", "spTree") },
1208
- layout: Y ? { part: Y, tree: R(j, "cSld", "spTree") } : null,
1209
- master: _ ? { part: _, tree: R(q, "cSld", "spTree") } : null,
1210
- masterTx: { title: c(pt, "titleStyle"), body: c(pt, "bodyStyle"), other: c(pt, "otherStyle") },
1277
+ ctx: Lt,
1278
+ slide: { part: T, tree: A(O, "cSld", "spTree") },
1279
+ layout: Y ? { part: Y, tree: A(D, "cSld", "spTree") } : null,
1280
+ master: _ ? { part: _, tree: A(Z, "cSld", "spTree") } : null,
1281
+ masterTx: { title: c(mt, "titleStyle"), body: c(mt, "bodyStyle"), other: c(mt, "otherStyle") },
1211
1282
  defaultText: f,
1212
1283
  warnings: e,
1213
1284
  count: 0,
1214
- tableStyles: u
1215
- }, mt = (ce) => ({ pkg: l, part: ce?.part ?? T, ctx: Rt }), At = yt(c(O, "cSld"), mt($.slide)) ?? yt(c(j, "cSld"), mt($.layout)) ?? yt(c(q, "cSld"), mt($.master)) ?? { kind: "solid", color: { hex: "#ffffff" } };
1216
- $.background = At;
1217
- const lt = [], le = B(O, "showMasterSp") !== !1 && B(j, "showMasterSp") !== !1;
1218
- $.master && le && lt.push(...at($.master.tree, $.master, $, bt, 0, !1)), $.layout && B(O, "showMasterSp") !== !1 && lt.push(...at($.layout.tree, $.layout, $, bt, 0, !1)), lt.push(...at($.slide.tree, $.slide, $, bt, 0, !0)), P.push({
1219
- items: lt,
1220
- background: At,
1221
- transition: on(O),
1285
+ tableStyles: d
1286
+ }, gt = (de) => ({ pkg: l, part: de?.part ?? T, ctx: Lt }), Et = kt(c(O, "cSld"), gt($.slide)) ?? kt(c(D, "cSld"), gt($.layout)) ?? kt(c(Z, "cSld"), gt($.master)) ?? { kind: "solid", color: { hex: "#ffffff" } };
1287
+ $.background = Et;
1288
+ const ct = [], ue = B(O, "showMasterSp") !== !1 && B(D, "showMasterSp") !== !1;
1289
+ $.master && ue && ct.push(...at($.master.tree, $.master, $, yt, 0, !1)), $.layout && B(O, "showMasterSp") !== !1 && ct.push(...at($.layout.tree, $.layout, $, yt, 0, !1)), ct.push(...at($.slide.tree, $.slide, $, yt, 0, !0)), P.push({
1290
+ items: ct,
1291
+ background: Et,
1292
+ transition: cn(O),
1222
1293
  name: k(c(O, "cSld"), "name") || void 0,
1223
- notes: nn(l, T),
1294
+ notes: ln(l, T),
1224
1295
  key: T,
1225
1296
  ...k(O, "show") === "0" && { hidden: !0 },
1226
- ..._t(O) && { advanceAfterMs: _t(O) },
1227
- ...N.has(T) && { section: N.get(T) }
1297
+ ...Vt(O) && { advanceAfterMs: Vt(O) },
1298
+ ...I.has(T) && { section: I.get(T) }
1228
1299
  });
1300
+ const Rt = fn(O, o);
1301
+ Rt.length && (P[P.length - 1].anims = Rt);
1229
1302
  }), P.length || o("The presentation has no slides.");
1230
- const L = R(l.xml("docProps/core.xml"), "title")?.textContent || void 0, X = l.relOfType(x, "presProps"), H = k(c(X ? l.xml(X) : null, "showPr"), "loop");
1231
- return { deck: { width: m, height: g, slides: P, title: L, ...(H === "1" || H === "true") && { loop: !0 } }, warnings: e };
1303
+ const E = A(l.xml("docProps/core.xml"), "title")?.textContent || void 0, X = l.relOfType(p, "presProps"), H = k(c(X ? l.xml(X) : null, "showPr"), "loop");
1304
+ return { deck: { width: g, height: b, slides: P, title: E, ...(H === "1" || H === "true") && { loop: !0 } }, warnings: e };
1232
1305
  }
1233
- const an = 80, ln = "default-layer", F = (t) => {
1306
+ const hn = 80, pn = "default-layer", F = (t) => {
1234
1307
  if (!t) return "transparent";
1235
1308
  if (t.alpha === void 0 || t.alpha >= 0.999) return t.hex;
1236
1309
  const n = t.hex.replace("#", "");
1237
1310
  return `rgba(${parseInt(n.slice(0, 2), 16)}, ${parseInt(n.slice(2, 4), 16)}, ${parseInt(n.slice(4, 6), 16)}, ${+t.alpha.toFixed(3)})`;
1238
- }, cn = /(times|georgia|garamond|cambria|book|serif|palatino|baskerville|merriweather)/i, fn = /(courier|consolas|mono|menlo|code)/i;
1239
- function Ut(t) {
1311
+ }, mn = /(times|georgia|garamond|cambria|book|serif|palatino|baskerville|merriweather)/i, gn = /(courier|consolas|mono|menlo|code)/i;
1312
+ function qt(t) {
1240
1313
  if (!t) return "sans-serif";
1241
- const n = ge(t);
1242
- return n || (fn.test(t) ? "monospace" : cn.test(t) ? "serif" : "sans-serif");
1314
+ const n = we(t);
1315
+ return n || (gn.test(t) ? "monospace" : mn.test(t) ? "serif" : "sans-serif");
1243
1316
  }
1244
- function dn(t) {
1317
+ function xn(t) {
1245
1318
  const n = [];
1246
1319
  let e = [], o = !1;
1247
1320
  const s = () => {
@@ -1266,15 +1339,30 @@ function dn(t) {
1266
1339
  } else r.op === "Z" && (o = !0, s());
1267
1340
  return s(), n;
1268
1341
  }
1269
- const un = (t, n, e) => t.map((o) => o.op === "Z" ? o : o.op === "C" ? { ...o, x1: o.x1 + n, y1: o.y1 + e, x2: o.x2 + n, y2: o.y2 + e, x: o.x + n, y: o.y + e } : { ...o, x: o.x + n, y: o.y + e });
1270
- function hn(t, n) {
1342
+ const bn = (t, n, e) => t.map((o) => o.op === "Z" ? o : o.op === "C" ? { ...o, x1: o.x1 + n, y1: o.y1 + e, x2: o.x2 + n, y2: o.y2 + e, x: o.x + n, y: o.y + e } : { ...o, x: o.x + n, y: o.y + e });
1343
+ function yn(t, n, e) {
1344
+ let o = !1;
1345
+ t.forEach((s, r) => {
1346
+ s.start === "click" && (o = !0);
1347
+ const a = n.itemEls?.get(s.target);
1348
+ if (!a?.length) {
1349
+ n.warnings.push("An animation on a shape that wasn't imported was skipped.");
1350
+ return;
1351
+ }
1352
+ a.forEach((i, l) => {
1353
+ const p = ge(l === 0 ? s : { ...s, start: "with", delayMs: s.delayMs }, e("anim"), !o);
1354
+ p.order = r + l / (a.length + 1), (i.animations ??= []).push(p);
1355
+ });
1356
+ });
1357
+ }
1358
+ function kn(t, n) {
1271
1359
  if (!t) return null;
1272
1360
  if (t.kind === "url") return t.url;
1273
- if (t.kind === "action") return pe(t.action);
1361
+ if (t.kind === "action") return ye(t.action);
1274
1362
  const e = n.slideIds?.get(t.key);
1275
- return e ? me(e) : null;
1363
+ return e ? ke(e) : null;
1276
1364
  }
1277
- async function pn(t) {
1365
+ async function wn(t) {
1278
1366
  if (!(typeof document > "u"))
1279
1367
  try {
1280
1368
  const n = new Image();
@@ -1287,7 +1375,7 @@ async function pn(t) {
1287
1375
  return;
1288
1376
  }
1289
1377
  }
1290
- async function mn(t, n) {
1378
+ async function Mn(t, n) {
1291
1379
  const e = /* @__PURE__ */ new Set(), o = (r) => {
1292
1380
  for (const a of r)
1293
1381
  if (a.kind === "group") o(a.children);
@@ -1302,11 +1390,11 @@ async function mn(t, n) {
1302
1390
  t.slides.forEach((r) => o(r.items));
1303
1391
  const s = /* @__PURE__ */ new Map();
1304
1392
  return await Promise.all([...e].map(async (r) => {
1305
- const a = await pn(r);
1393
+ const a = await wn(r);
1306
1394
  a && s.set(r, a);
1307
1395
  })), s;
1308
1396
  }
1309
- async function gn(t, n, e, o) {
1397
+ async function vn(t, n, e, o) {
1310
1398
  if (!(typeof document > "u"))
1311
1399
  try {
1312
1400
  const s = new Image();
@@ -1328,7 +1416,7 @@ async function gn(t, n, e, o) {
1328
1416
  return;
1329
1417
  }
1330
1418
  }
1331
- function Q(t, n, e, o) {
1419
+ function J(t, n, e, o) {
1332
1420
  return {
1333
1421
  id: t.nextId(n),
1334
1422
  type: n,
@@ -1349,13 +1437,13 @@ function Q(t, n, e, o) {
1349
1437
  opacity: 100,
1350
1438
  seed: 1,
1351
1439
  locked: !1,
1352
- layerId: ln,
1440
+ layerId: pn,
1353
1441
  groupIds: [...o].reverse(),
1354
1442
  // innermost first, the store's convention
1355
1443
  name: e.name
1356
1444
  };
1357
1445
  }
1358
- function Gt(t, n, e) {
1446
+ function Zt(t, n, e) {
1359
1447
  switch (n.kind) {
1360
1448
  case "none":
1361
1449
  t.backgroundColor = "transparent";
@@ -1368,7 +1456,7 @@ function Gt(t, n, e) {
1368
1456
  t.fillStyle = n.kind, t.backgroundColor = F(n.stops[0]?.color), t.gradientStops = n.stops.map((o) => ({ offset: o.pos, color: F(o.color) })), n.kind === "linear" && (t.gradientDirection = n.angle);
1369
1457
  break;
1370
1458
  case "pattern": {
1371
- t.backgroundColor = F(n.color), t.fillStyle = "pattern", t.patternFill = Tn(n.preset, F(n.color), n.bg ? F(n.bg) : "transparent");
1459
+ t.backgroundColor = F(n.color), t.fillStyle = "pattern", t.patternFill = Rn(n.preset, F(n.color), n.bg ? F(n.bg) : "transparent");
1372
1460
  break;
1373
1461
  }
1374
1462
  case "image": {
@@ -1378,64 +1466,64 @@ function Gt(t, n, e) {
1378
1466
  }
1379
1467
  }
1380
1468
  }
1381
- function Mt(t, n) {
1469
+ function St(t, n) {
1382
1470
  if (!n || !(n.width > 0)) {
1383
1471
  t.strokeColor = "transparent", t.strokeWidth = 0;
1384
1472
  return;
1385
1473
  }
1386
1474
  t.strokeColor = F(n.color), t.strokeWidth = Math.max(0.5, n.width), t.strokeStyle = n.dash === "sysDot" ? "dotted" : n.dash ? "dashed" : "solid", (n.join === "miter" || n.join === "bevel") && (t.strokeLineJoin = n.join), n.cap === "flat" ? t.strokeLineCap = "butt" : n.cap === "sq" && (t.strokeLineCap = "square");
1387
1475
  }
1388
- function xn(t) {
1476
+ function Sn(t) {
1389
1477
  const n = /^(alphaLc|alphaUc|arabic|romanLc|romanUc)(ParenBoth|ParenR|Period|Plain)$/.exec(t ?? "");
1390
1478
  if (!n) return {};
1391
1479
  const e = { alphaLc: "lower-alpha", alphaUc: "upper-alpha", romanLc: "lower-roman", romanUc: "upper-roman", arabic: void 0 }[n[1]], o = { ParenBoth: "parens", ParenR: "paren", Plain: "none", Period: void 0 }[n[2]], s = {};
1392
1480
  return e && (s.listNumberStyle = e), o && (s.listNumberSuffix = o), s;
1393
1481
  }
1394
- function bn(t, n) {
1395
- const e = t.bullet === "num" ? xn(t.numType) : t.bulletChar ? { listMarker: t.bulletChar } : {}, o = t.runs.find((s) => !s.br)?.color ?? n.defaults?.color;
1482
+ function Cn(t, n) {
1483
+ const e = t.bullet === "num" ? Sn(t.numType) : t.bulletChar ? { listMarker: t.bulletChar } : {}, o = t.runs.find((s) => !s.br)?.color ?? n.defaults?.color;
1396
1484
  return t.bulletColor && F(t.bulletColor) !== F(o) && (e.listMarkerColor = F(t.bulletColor)), t.bulletScale && (e.listMarkerScale = Math.round(t.bulletScale * 100) / 100), t.marL !== void 0 && (e.listIndent = Math.max(0, Math.round(t.marL * 10) / 10), e.listMarkerIndent = Math.max(0, Math.round((t.marL + (t.indent ?? 0)) * 10) / 10)), e;
1397
1485
  }
1398
- const kt = (t, n) => Math.round(((t.paragraphs[n - 1]?.spaceAfter ?? 0) + (t.paragraphs[n]?.spaceBefore ?? 0)) * 100) / 100;
1399
- function se(t, n) {
1400
- const e = t.paragraphs.flatMap((h) => h.runs.filter((y) => !y.br)), o = e[0], s = o?.size ?? 24, r = /* @__PURE__ */ new Map(), a = (h) => h.runs.reduce((y, u) => y + (u.br ? 0 : u.text.trim().length), 0);
1486
+ const wt = (t, n) => Math.round(((t.paragraphs[n - 1]?.spaceAfter ?? 0) + (t.paragraphs[n]?.spaceBefore ?? 0)) * 100) / 100;
1487
+ function ie(t, n) {
1488
+ const e = t.paragraphs.flatMap((h) => h.runs.filter((y) => !y.br)), o = e[0], s = o?.size ?? 24, r = /* @__PURE__ */ new Map(), a = (h) => h.runs.reduce((y, d) => y + (d.br ? 0 : d.text.trim().length), 0);
1401
1489
  for (const h of t.paragraphs) {
1402
1490
  const y = a(h);
1403
1491
  y && r.set(h.align ?? "l", (r.get(h.align ?? "l") ?? 0) + y);
1404
1492
  }
1405
- const i = [...r].sort((h, y) => y[1] - h[1])[0]?.[0] ?? t.paragraphs.find((h) => h.runs.length)?.align ?? "l", l = (h) => a(h) > 0 && (h.align ?? "l") !== i ? h.align === "ctr" ? "center" : h.align === "r" ? "right" : "left" : void 0, x = e.every((h) => h.size === o?.size && h.bold === o?.bold && h.italic === o?.italic && h.underline === o?.underline && h.strike === o?.strike && h.font === o?.font && F(h.color) === F(o?.color)) && !t.paragraphs.some((h) => h.bullet) && !t.paragraphs.some((h, y) => y > 0 && kt(t, y) > 0) && !t.paragraphs.some(l), b = {
1493
+ const i = [...r].sort((h, y) => y[1] - h[1])[0]?.[0] ?? t.paragraphs.find((h) => h.runs.length)?.align ?? "l", l = (h) => a(h) > 0 && (h.align ?? "l") !== i ? h.align === "ctr" ? "center" : h.align === "r" ? "right" : "left" : void 0, p = e.every((h) => h.size === o?.size && h.bold === o?.bold && h.italic === o?.italic && h.underline === o?.underline && h.strike === o?.strike && h.font === o?.font && F(h.color) === F(o?.color)) && !t.paragraphs.some((h) => h.bullet) && !t.paragraphs.some((h, y) => y > 0 && wt(t, y) > 0) && !t.paragraphs.some(l), x = {
1406
1494
  fontSize: Math.round(s * 10) / 10,
1407
- fontFamily: Ut(o?.font),
1495
+ fontFamily: qt(o?.font),
1408
1496
  textAlign: i === "ctr" ? "center" : i === "r" ? "right" : "left",
1409
1497
  verticalAlign: t.anchor === "ctr" ? "middle" : t.anchor === "b" ? "bottom" : "top",
1410
1498
  textColor: F(o?.color ?? { hex: "#000000" })
1411
1499
  };
1412
- t.lineSpacing && Math.abs(t.lineSpacing - 1) > 0.01 && (b.lineHeight = Math.max(0.5, Math.min(4, t.lineSpacing * 1.2)));
1413
- const d = t.paragraphs.map((h) => h.runs.map((y) => y.br ? `
1500
+ t.lineSpacing && Math.abs(t.lineSpacing - 1) > 0.01 && (x.lineHeight = Math.max(0.5, Math.min(4, t.lineSpacing * 1.2)));
1501
+ const u = t.paragraphs.map((h) => h.runs.map((y) => y.br ? `
1414
1502
  ` : y.text).join("")).join(`
1415
1503
  `);
1416
- if (x)
1417
- return o?.bold && (b.fontWeight = 700), o?.italic && (b.fontStyle = "italic"), n ? b.containerText = d : b.text = d, { fields: b, rich: !1 };
1418
- const m = [], g = [], f = [];
1504
+ if (p)
1505
+ return o?.bold && (x.fontWeight = 700), o?.italic && (x.fontStyle = "italic"), n ? x.containerText = u : x.text = u, { fields: x, rich: !1 };
1506
+ const g = [], b = [], f = [];
1419
1507
  return t.paragraphs.forEach((h, y) => {
1420
- const u = h.level ?? 0;
1508
+ const d = h.level ?? 0;
1421
1509
  if (h.bullet === "num") {
1422
1510
  const M = h.numType ?? "arabicPeriod";
1423
- (g[u] === void 0 || f[u] !== M) && (g[u] = (h.startAt ?? 1) - 1), g[u]++, f[u] = M, g.length = u + 1, f.length = u + 1;
1511
+ (b[d] === void 0 || f[d] !== M) && (b[d] = (h.startAt ?? 1) - 1), b[d]++, f[d] = M, b.length = d + 1, f.length = d + 1;
1424
1512
  } else
1425
- g.length = Math.min(g.length, u), f.length = g.length;
1426
- const p = h.bullet ? { listType: h.bullet === "num" ? "ordered" : "bullet", listLevel: u, ...bn(h, t) } : {};
1427
- h.bullet === "num" && (p.listIndex = g[u]), (h.runs.length ? h.runs : [{ text: "" }]).forEach((M, S) => {
1513
+ b.length = Math.min(b.length, d), f.length = b.length;
1514
+ const m = h.bullet ? { listType: h.bullet === "num" ? "ordered" : "bullet", listLevel: d, ...Cn(h, t) } : {};
1515
+ h.bullet === "num" && (m.listIndex = b[d]), (h.runs.length ? h.runs : [{ text: "" }]).forEach((M, S) => {
1428
1516
  const v = { text: M.br ? `
1429
- ` : M.text, ...S === 0 ? p : {} };
1430
- S === 0 && y > 0 && kt(t, y) > 0 && (v.paragraphSpaceBefore = kt(t, y));
1431
- const N = l(h);
1432
- N && (v.paragraphAlign = N), M.bold && (v.bold = !0), M.italic && (v.italic = !0), M.underline && (v.underline = !0), M.strike && (v.strikethrough = !0), M.color && (v.color = F(M.color)), M.size && (v.fontSize = Math.round(M.size * 10) / 10), M.font && (v.fontFamily = Ut(M.font)), m.push(v);
1433
- }), y < t.paragraphs.length - 1 && m.push({ text: `
1517
+ ` : M.text, ...S === 0 ? m : {} };
1518
+ S === 0 && y > 0 && wt(t, y) > 0 && (v.paragraphSpaceBefore = wt(t, y));
1519
+ const I = l(h);
1520
+ I && (v.paragraphAlign = I), M.bold && (v.bold = !0), M.italic && (v.italic = !0), M.underline && (v.underline = !0), M.strike && (v.strikethrough = !0), M.color && (v.color = F(M.color)), M.size && (v.fontSize = Math.round(M.size * 10) / 10), M.font && (v.fontFamily = qt(M.font)), g.push(v);
1521
+ }), y < t.paragraphs.length - 1 && g.push({ text: `
1434
1522
  ` });
1435
- }), n ? (b.richContainerText = m, b.containerText = d) : (b.richText = m, b.text = d), { fields: b, rich: !0 };
1523
+ }), n ? (x.richContainerText = g, x.containerText = u) : (x.richText = g, x.text = u), { fields: x, rich: !0 };
1436
1524
  }
1437
- function wt(t, n, e, o, s) {
1438
- const { fields: r, rich: a } = se(n, !1), i = 4, l = Q(t, a ? "richtext" : "text", {
1525
+ function Mt(t, n, e, o, s) {
1526
+ const { fields: r, rich: a } = ie(n, !1), i = 4, l = J(t, a ? "richtext" : "text", {
1439
1527
  ...e,
1440
1528
  x: e.x + n.insets.l - i,
1441
1529
  y: e.y + n.insets.t - i,
@@ -1444,81 +1532,81 @@ function wt(t, n, e, o, s) {
1444
1532
  }, o);
1445
1533
  return Object.assign(l, r, { autoResize: !n.wrap, strokeColor: r.textColor }), l;
1446
1534
  }
1447
- const re = /* @__PURE__ */ new Set(["line", "straightConnector1"]);
1448
- function ae(t, n, e) {
1535
+ const le = /* @__PURE__ */ new Set(["line", "straightConnector1"]);
1536
+ function ce(t, n, e) {
1449
1537
  const o = t.geom;
1450
1538
  if (t.text && t.fill.kind === "none" && !t.line && (t.textBox || o.kind === "preset" && o.prst === "rect"))
1451
- return n.stats.elements++, [wt(n, t.text, t, e)];
1452
- if (o.kind === "preset" && re.has(o.prst)) return vt({ ...t, kind: "connector", line: t.line ?? { width: 1, color: { hex: "#000000" } } }, n, e);
1453
- if (o.kind === "custom" && t.line && (t.line.head || t.line.tail) && !t.text && o.paths.every((d) => !d.cmds.some((m) => m.op === "Z")))
1454
- return vt({ ...t, kind: "connector", line: t.line }, n, e);
1455
- const s = kn(t);
1539
+ return n.stats.elements++, [Mt(n, t.text, t, e)];
1540
+ if (o.kind === "preset" && le.has(o.prst)) return Ct({ ...t, kind: "connector", line: t.line ?? { width: 1, color: { hex: "#000000" } } }, n, e);
1541
+ if (o.kind === "custom" && t.line && (t.line.head || t.line.tail) && !t.text && o.paths.every((u) => !u.cmds.some((g) => g.op === "Z")))
1542
+ return Ct({ ...t, kind: "connector", line: t.line }, n, e);
1543
+ const s = Tn(t);
1456
1544
  if (s) {
1457
- const d = Q(n, s.type, t, e);
1458
- Object.assign(d, s.extra), Gt(d, t.fill, n), Mt(d, t.line), n.byPptId.set(t.id, { el: d, item: t }), n.stats.elements++;
1459
- const m = t.textRect ?? { l: 0, t: 0, r: t.w, b: t.h }, g = t.text?.insets, f = Math.abs(m.l) > 0.5 || Math.abs(m.t) > 0.5 || Math.abs(m.r - t.w) > 0.5 || Math.abs(m.b - t.h) > 0.5, h = !!g && Math.max(g.l, g.r, g.t, g.b) > 16;
1545
+ const u = J(n, s.type, t, e);
1546
+ Object.assign(u, s.extra), Zt(u, t.fill, n), St(u, t.line), n.byPptId.set(t.id, { el: u, item: t }), n.stats.elements++;
1547
+ const g = t.textRect ?? { l: 0, t: 0, r: t.w, b: t.h }, b = t.text?.insets, f = Math.abs(g.l) > 0.5 || Math.abs(g.t) > 0.5 || Math.abs(g.r - t.w) > 0.5 || Math.abs(g.b - t.h) > 0.5, h = !!b && Math.max(b.l, b.r, b.t, b.b) > 16;
1460
1548
  if (t.text && (f || h)) {
1461
1549
  const y = n.nextId("group");
1462
- return d.groupIds = [...e, y].reverse(), n.stats.elements++, [d, wt(n, t.text, { ...t, rot: 0, x: t.x + m.l, y: t.y + m.t, w: m.r - m.l, h: m.b - m.t }, [...e, y])];
1550
+ return u.groupIds = [...e, y].reverse(), n.stats.elements++, [u, Mt(n, t.text, { ...t, rot: 0, x: t.x + g.l, y: t.y + g.t, w: g.r - g.l, h: g.b - g.t }, [...e, y])];
1463
1551
  }
1464
1552
  if (t.text) {
1465
- const { fields: y } = se(t.text, !0);
1466
- Object.assign(d, y);
1553
+ const { fields: y } = ie(t.text, !0);
1554
+ Object.assign(u, y);
1467
1555
  }
1468
- return [d];
1556
+ return [u];
1469
1557
  }
1470
1558
  const r = o.kind === "custom" ? o.paths : (() => {
1471
- const d = n.presets[o.prst];
1472
- if (!d)
1473
- return n.warnings.push(`Unknown shape "${o.prst}" was imported as a rectangle.`), ft(n.presets.rect, t.w, t.h);
1474
- const m = Object.fromEntries(Object.entries(o.adj ?? {}).map(([g, f]) => [g, `val ${f}`]));
1475
- return ft(d, t.w, t.h, m);
1476
- })(), a = [], i = (t.text || r.some((d) => d.fill === !1)) && r.some((d) => d.fill !== !1) ? n.nextId("group") : null, l = i ? [...e, i] : e, x = /* @__PURE__ */ new Map();
1477
- for (const d of r) {
1478
- const m = `${d.fill === !1 ? "nofill" : "fill"}|${d.stroke === !1 ? "nostroke" : "stroke"}`;
1479
- x.has(m) || x.set(m, []), x.get(m).push(d);
1559
+ const u = n.presets[o.prst];
1560
+ if (!u)
1561
+ return n.warnings.push(`Unknown shape "${o.prst}" was imported as a rectangle.`), ut(n.presets.rect, t.w, t.h);
1562
+ const g = Object.fromEntries(Object.entries(o.adj ?? {}).map(([b, f]) => [b, `val ${f}`]));
1563
+ return ut(u, t.w, t.h, g);
1564
+ })(), a = [], i = (t.text || r.some((u) => u.fill === !1)) && r.some((u) => u.fill !== !1) ? n.nextId("group") : null, l = i ? [...e, i] : e, p = /* @__PURE__ */ new Map();
1565
+ for (const u of r) {
1566
+ const g = `${u.fill === !1 ? "nofill" : "fill"}|${u.stroke === !1 ? "nostroke" : "stroke"}`;
1567
+ p.has(g) || p.set(g, []), p.get(g).push(u);
1480
1568
  }
1481
- let b = null;
1482
- for (const [d, m] of x) {
1483
- const g = m.flatMap((p) => p.cmds), f = ue(g);
1569
+ let x = null;
1570
+ for (const [u, g] of p) {
1571
+ const b = g.flatMap((m) => m.cmds), f = xe(b);
1484
1572
  if (!f) continue;
1485
- const h = dn(un(g, -f.minX, -f.minY));
1573
+ const h = xn(bn(b, -f.minX, -f.minY));
1486
1574
  if (!h.length) continue;
1487
- const y = Q(n, "path", { ...t, x: t.x + f.minX, y: t.y + f.minY, w: Math.max(f.maxX - f.minX, 1), h: Math.max(f.maxY - f.minY, 1) }, l);
1488
- !(Math.abs(f.minX + f.maxX - t.w) < 0.5 && Math.abs(f.minY + f.maxY - t.h) < 0.5) && (t.rot || t.flipH || t.flipV) && yn(y, h, t, f), y.pathSubpaths = h, y.pathAnchors = h[0].anchors, y.pathClosed = h[0].closed, d.startsWith("fill") ? Gt(y, t.fill, n) : y.backgroundColor = "transparent", d.endsWith("|stroke") ? Mt(y, t.line) : (y.strokeColor = "transparent", y.strokeWidth = 0), a.push(y), b ??= y, n.stats.paths++;
1575
+ const y = J(n, "path", { ...t, x: t.x + f.minX, y: t.y + f.minY, w: Math.max(f.maxX - f.minX, 1), h: Math.max(f.maxY - f.minY, 1) }, l);
1576
+ !(Math.abs(f.minX + f.maxX - t.w) < 0.5 && Math.abs(f.minY + f.maxY - t.h) < 0.5) && (t.rot || t.flipH || t.flipV) && Pn(y, h, t, f), y.pathSubpaths = h, y.pathAnchors = h[0].anchors, y.pathClosed = h[0].closed, u.startsWith("fill") ? Zt(y, t.fill, n) : y.backgroundColor = "transparent", u.endsWith("|stroke") ? St(y, t.line) : (y.strokeColor = "transparent", y.strokeWidth = 0), a.push(y), x ??= y, n.stats.paths++;
1489
1577
  }
1490
- if (b && n.byPptId.set(t.id, { el: b, item: t }), t.text) {
1491
- const d = t.textRect ?? (o.kind === "preset" && n.presets[o.prst] ? Kt(n.presets[o.prst], t.w, t.h) : { l: 0, t: 0, r: t.w, b: t.h });
1492
- a.push(wt(n, t.text, { ...t, x: t.x + d.l, y: t.y + d.t, w: d.r - d.l, h: d.b - d.t }, l));
1578
+ if (x && n.byPptId.set(t.id, { el: x, item: t }), t.text) {
1579
+ const u = t.textRect ?? (o.kind === "preset" && n.presets[o.prst] ? te(n.presets[o.prst], t.w, t.h) : { l: 0, t: 0, r: t.w, b: t.h });
1580
+ a.push(Mt(n, t.text, { ...t, x: t.x + u.l, y: t.y + u.t, w: u.r - u.l, h: u.b - u.t }, l));
1493
1581
  }
1494
1582
  return n.stats.elements += a.length, a;
1495
1583
  }
1496
- function yn(t, n, e, o) {
1497
- const s = e.w / 2, r = e.h / 2, a = (e.rot || 0) * Math.PI / 180, i = Math.cos(a), l = Math.sin(a), x = e.flipH ? -1 : 1, b = e.flipV ? -1 : 1, d = (u, p) => {
1498
- const w = (u + o.minX - s) * x, M = (p + o.minY - r) * b;
1584
+ function Pn(t, n, e, o) {
1585
+ const s = e.w / 2, r = e.h / 2, a = (e.rot || 0) * Math.PI / 180, i = Math.cos(a), l = Math.sin(a), p = e.flipH ? -1 : 1, x = e.flipV ? -1 : 1, u = (d, m) => {
1586
+ const w = (d + o.minX - s) * p, M = (m + o.minY - r) * x;
1499
1587
  return { x: s + w * i - M * l, y: r + w * l + M * i };
1500
- }, m = (u, p) => {
1501
- const w = u * x, M = p * b;
1588
+ }, g = (d, m) => {
1589
+ const w = d * p, M = m * x;
1502
1590
  return { x: w * i - M * l, y: w * l + M * i };
1503
1591
  };
1504
- let g = 1 / 0, f = 1 / 0, h = -1 / 0, y = -1 / 0;
1505
- for (const u of n) for (const p of u.anchors) {
1506
- const w = d(p.x, p.y);
1507
- if (p.x = w.x, p.y = w.y, p.inX !== void 0) {
1508
- const M = m(p.inX, p.inY ?? 0);
1509
- p.inX = M.x, p.inY = M.y;
1592
+ let b = 1 / 0, f = 1 / 0, h = -1 / 0, y = -1 / 0;
1593
+ for (const d of n) for (const m of d.anchors) {
1594
+ const w = u(m.x, m.y);
1595
+ if (m.x = w.x, m.y = w.y, m.inX !== void 0) {
1596
+ const M = g(m.inX, m.inY ?? 0);
1597
+ m.inX = M.x, m.inY = M.y;
1510
1598
  }
1511
- if (p.outX !== void 0) {
1512
- const M = m(p.outX, p.outY ?? 0);
1513
- p.outX = M.x, p.outY = M.y;
1599
+ if (m.outX !== void 0) {
1600
+ const M = g(m.outX, m.outY ?? 0);
1601
+ m.outX = M.x, m.outY = M.y;
1514
1602
  }
1515
- g = Math.min(g, p.x), f = Math.min(f, p.y), h = Math.max(h, p.x), y = Math.max(y, p.y);
1603
+ b = Math.min(b, m.x), f = Math.min(f, m.y), h = Math.max(h, m.x), y = Math.max(y, m.y);
1516
1604
  }
1517
- for (const u of n) for (const p of u.anchors)
1518
- p.x -= g, p.y -= f;
1519
- t.x = t.x - o.minX + g, t.y = t.y - o.minY + f, t.width = Math.max(h - g, 1), t.height = Math.max(y - f, 1), t.angle = 0, t.flipX = void 0, t.flipY = void 0;
1605
+ for (const d of n) for (const m of d.anchors)
1606
+ m.x -= b, m.y -= f;
1607
+ t.x = t.x - o.minX + b, t.y = t.y - o.minY + f, t.width = Math.max(h - b, 1), t.height = Math.max(y - f, 1), t.angle = 0, t.flipX = void 0, t.flipY = void 0;
1520
1608
  }
1521
- function kn(t) {
1609
+ function Tn(t) {
1522
1610
  const n = t.geom;
1523
1611
  if (n.kind !== "preset") return null;
1524
1612
  const e = n.adj ?? {};
@@ -1537,35 +1625,35 @@ function kn(t) {
1537
1625
  return null;
1538
1626
  }
1539
1627
  }
1540
- const Vt = { triangle: "triangle", stealth: "arrow", arrow: "arrow", oval: "dot", diamond: "diamondFilled" };
1541
- function vt(t, n, e) {
1628
+ const Kt = { triangle: "triangle", stealth: "arrow", arrow: "arrow", oval: "dot", diamond: "diamondFilled" };
1629
+ function Ct(t, n, e) {
1542
1630
  const o = t.geom;
1543
1631
  let s;
1544
- if (o.kind === "preset" && re.has(o.prst)) s = [{ op: "M", x: 0, y: 0 }, { op: "L", x: t.w, y: t.h }];
1632
+ if (o.kind === "preset" && le.has(o.prst)) s = [{ op: "M", x: 0, y: 0 }, { op: "L", x: t.w, y: t.h }];
1545
1633
  else if (o.kind === "custom") s = o.paths.flatMap((w) => w.cmds);
1546
1634
  else {
1547
1635
  const w = n.presets[o.prst], M = Object.fromEntries(Object.entries(o.adj ?? {}).map(([S, v]) => [S, `val ${v}`]));
1548
- s = w ? ft(w, t.w, t.h, M).flatMap((S) => S.cmds) : [{ op: "M", x: 0, y: 0 }, { op: "L", x: t.w, y: t.h }];
1636
+ s = w ? ut(w, t.w, t.h, M).flatMap((S) => S.cmds) : [{ op: "M", x: 0, y: 0 }, { op: "L", x: t.w, y: t.h }];
1549
1637
  }
1550
1638
  const r = t.w / 2, a = t.h / 2, i = (t.rot || 0) * Math.PI / 180, l = (w, M) => {
1551
1639
  let S = w - r, v = M - a;
1552
1640
  return t.flipH && (S = -S), t.flipV && (v = -v), { x: t.x + r + S * Math.cos(i) - v * Math.sin(i), y: t.y + a + S * Math.sin(i) + v * Math.cos(i) };
1553
- }, x = [];
1554
- let b = { x: 0, y: 0 };
1641
+ }, p = [];
1642
+ let x = { x: 0, y: 0 };
1555
1643
  for (const w of s)
1556
1644
  if (w.op === "M" || w.op === "L")
1557
- b = { x: w.x, y: w.y }, x.push(l(b.x, b.y));
1645
+ x = { x: w.x, y: w.y }, p.push(l(x.x, x.y));
1558
1646
  else if (w.op === "C") {
1559
1647
  for (let M = 1; M <= 12; M++) {
1560
- const S = M / 12, v = 1 - S, N = v * v * v * b.x + 3 * v * v * S * w.x1 + 3 * v * S * S * w.x2 + S * S * S * w.x, P = v * v * v * b.y + 3 * v * v * S * w.y1 + 3 * v * S * S * w.y2 + S * S * S * w.y;
1561
- x.push(l(N, P));
1648
+ const S = M / 12, v = 1 - S, I = v * v * v * x.x + 3 * v * v * S * w.x1 + 3 * v * S * S * w.x2 + S * S * S * w.x, P = v * v * v * x.y + 3 * v * v * S * w.y1 + 3 * v * S * S * w.y2 + S * S * S * w.y;
1649
+ p.push(l(I, P));
1562
1650
  }
1563
- b = { x: w.x, y: w.y };
1651
+ x = { x: w.x, y: w.y };
1564
1652
  }
1565
- if (x.length < 2) return [];
1566
- const d = Math.min(...x.map((w) => w.x)), m = Math.min(...x.map((w) => w.y)), g = Math.max(...x.map((w) => w.x)), f = Math.max(...x.map((w) => w.y)), h = t.line.head && Vt[t.line.head.type], y = t.line.tail && Vt[t.line.tail.type], u = Q(n, h || y ? "arrow" : "line", { ...t, x: d, y: m, w: Math.max(g - d, 1), h: Math.max(f - m, 1), rot: 0, flipH: !1, flipV: !1 }, e);
1567
- u.points = x.map((w) => ({ x: w.x - d, y: w.y - m })), u.curveType = "straight", u.startArrowhead = h ?? null, u.endArrowhead = y ?? null, Mt(u, t.line);
1568
- const p = (w, M) => {
1653
+ if (p.length < 2) return [];
1654
+ const u = Math.min(...p.map((w) => w.x)), g = Math.min(...p.map((w) => w.y)), b = Math.max(...p.map((w) => w.x)), f = Math.max(...p.map((w) => w.y)), h = t.line.head && Kt[t.line.head.type], y = t.line.tail && Kt[t.line.tail.type], d = J(n, h || y ? "arrow" : "line", { ...t, x: u, y: g, w: Math.max(b - u, 1), h: Math.max(f - g, 1), rot: 0, flipH: !1, flipV: !1 }, e);
1655
+ d.points = p.map((w) => ({ x: w.x - u, y: w.y - g })), d.curveType = "straight", d.startArrowhead = h ?? null, d.endArrowhead = y ?? null, St(d, t.line);
1656
+ const m = (w, M) => {
1569
1657
  if (!w) return null;
1570
1658
  const S = n.byPptId.get(w.id);
1571
1659
  if (!S || !S.el.width || !S.el.height) return null;
@@ -1573,19 +1661,19 @@ function vt(t, n, e) {
1573
1661
  return { elementId: v.id, focus: 0, gap: 0, anchorFractionX: (M.x + n.ox - v.x) / v.width, anchorFractionY: (M.y + n.oy - v.y) / v.height };
1574
1662
  };
1575
1663
  return n.glue.push(() => {
1576
- u.startBinding = p(t.start, x[0]), u.endBinding = p(t.end, x[x.length - 1]);
1577
- }), n.stats.elements++, [u];
1664
+ d.startBinding = m(t.start, p[0]), d.endBinding = m(t.end, p[p.length - 1]);
1665
+ }), n.stats.elements++, [d];
1578
1666
  }
1579
- function wn(t, n, e) {
1667
+ function In(t, n, e) {
1580
1668
  const o = n.images.get(t.media);
1581
1669
  if (!o) {
1582
1670
  n.warnings.push(`Picture "${t.name}" is a ${t.media.ext.toUpperCase()} image, which browsers can't show; it was imported as a placeholder.`);
1583
- const l = Q(n, "rectangle", t, e);
1671
+ const l = J(n, "rectangle", t, e);
1584
1672
  return Object.assign(l, { backgroundColor: "#f1f3f5", strokeColor: "#adb5bd", strokeWidth: 1, strokeStyle: "dashed", containerText: `${t.media.ext.toUpperCase()} picture`, fontSize: 14, textColor: "#495057" }), n.stats.elements++, [l];
1585
1673
  }
1586
- const s = Q(n, "image", t, e);
1587
- if (s.dataURL = t.grayscale && n.gray.get(o.url) || o.url, s.status = "loaded", s.mimeType = St[t.media.ext], t.crop && (t.crop.l || t.crop.t || t.crop.r || t.crop.b) && (s.crop = { x: t.crop.l * o.w, y: t.crop.t * o.h, width: Math.max(1, (1 - t.crop.l - t.crop.r) * o.w), height: Math.max(1, (1 - t.crop.t - t.crop.b) * o.h) }), t.alpha !== void 0 && t.alpha < 1 && (s.opacity = Math.round(t.alpha * 100)), t.descr && (s.altText = t.descr), n.stats.elements++, n.stats.pictures++, !t.geom) return [s];
1588
- const r = n.nextId("group"), a = ae({
1674
+ const s = J(n, "image", t, e);
1675
+ if (s.dataURL = t.grayscale && n.gray.get(o.url) || o.url, s.status = "loaded", s.mimeType = Pt[t.media.ext], t.crop && (t.crop.l || t.crop.t || t.crop.r || t.crop.b) && (s.crop = { x: t.crop.l * o.w, y: t.crop.t * o.h, width: Math.max(1, (1 - t.crop.l - t.crop.r) * o.w), height: Math.max(1, (1 - t.crop.t - t.crop.b) * o.h) }), t.alpha !== void 0 && t.alpha < 1 && (s.opacity = Math.round(t.alpha * 100)), t.descr && (s.altText = t.descr), n.stats.elements++, n.stats.pictures++, !t.geom) return [s];
1676
+ const r = n.nextId("group"), a = ce({
1589
1677
  kind: "shape",
1590
1678
  id: t.id,
1591
1679
  name: `${t.name} outline`,
@@ -1605,38 +1693,38 @@ function wn(t, n, e) {
1605
1693
  const i = a[0];
1606
1694
  return i.isClipMask = !0, s.groupIds = [r, ...s.groupIds], s.clipMaskId = i.id, s.maskType = "clip", [s, i];
1607
1695
  }
1608
- function ie(t, n, e) {
1696
+ function fe(t, n, e) {
1609
1697
  const o = [];
1610
1698
  for (const s of t)
1611
1699
  try {
1612
1700
  const r = [];
1613
1701
  switch (s.kind) {
1614
1702
  case "shape":
1615
- r.push(...ae(s, n, e));
1703
+ r.push(...ce(s, n, e));
1616
1704
  break;
1617
1705
  case "connector":
1618
- r.push(...vt(s, n, e));
1706
+ r.push(...Ct(s, n, e));
1619
1707
  break;
1620
1708
  case "picture":
1621
- r.push(...wn(s, n, e));
1709
+ r.push(...In(s, n, e));
1622
1710
  break;
1623
1711
  case "group":
1624
- r.push(...ie(s.children, n, [...e, n.nextId("group")]));
1712
+ r.push(...fe(s.children, n, [...e, n.nextId("group")]));
1625
1713
  break;
1626
1714
  }
1627
- const a = hn(s.link, n);
1715
+ const a = kn(s.link, n);
1628
1716
  if (a)
1629
1717
  for (const i of r) i.link || (i.link = a);
1630
- o.push(...r);
1718
+ n.itemEls?.set(s.id, r), o.push(...r);
1631
1719
  } catch {
1632
1720
  n.warnings.push(`"${s.name}" couldn't be converted and was skipped.`);
1633
1721
  }
1634
1722
  return o;
1635
1723
  }
1636
- function Mn(t) {
1637
- return t ? { type: t.kind === "fade" ? "fade" : t.kind === "zoom" ? t.zoomIn === !1 ? "zoom-out" : "zoom-in" : t.dir === "r" ? "slide-right" : t.dir === "u" ? "slide-up" : t.dir === "d" ? "slide-down" : "slide-left", duration: Math.max(100, Math.min(5e3, t.durationMs)), easing: "easeInOutQuad" } : void 0;
1724
+ function Nn(t) {
1725
+ return t ? { type: t.kind === "morph" ? "morph" : t.kind === "fade" ? "fade" : t.kind === "zoom" ? t.zoomIn === !1 ? "zoom-out" : "zoom-in" : t.dir === "r" ? "slide-right" : t.dir === "u" ? "slide-up" : t.dir === "d" ? "slide-down" : "slide-left", duration: Math.max(100, Math.min(5e3, t.durationMs)), easing: "easeInOutQuad" } : void 0;
1638
1726
  }
1639
- function vn(t, n, e) {
1727
+ function On(t, n, e) {
1640
1728
  if (n)
1641
1729
  if (n.kind === "solid")
1642
1730
  t.fillStyle = "solid", t.backgroundColor = F(n.color);
@@ -1647,7 +1735,7 @@ function vn(t, n, e) {
1647
1735
  s && (t.fillStyle = "image", t.backgroundImage = s, t.backgroundColor = "#ffffff"), s && n.alpha !== void 0 && n.alpha < 1 && (t.backgroundOpacity = n.alpha);
1648
1736
  } else n.kind === "pattern" && (t.fillStyle = "solid", t.backgroundColor = F(n.color));
1649
1737
  }
1650
- const St = {
1738
+ const Pt = {
1651
1739
  png: "image/png",
1652
1740
  jpeg: "image/jpeg",
1653
1741
  gif: "image/gif",
@@ -1657,13 +1745,13 @@ const St = {
1657
1745
  webp: "image/webp",
1658
1746
  emf: "image/x-emf",
1659
1747
  wmf: "image/x-wmf"
1660
- }, Sn = /* @__PURE__ */ new Set(["png", "jpeg", "gif", "svg", "bmp", "webp"]);
1661
- function Cn(t) {
1748
+ }, An = /* @__PURE__ */ new Set(["png", "jpeg", "gif", "svg", "bmp", "webp"]);
1749
+ function Ln(t) {
1662
1750
  let n = "";
1663
1751
  for (let o = 0; o < t.length; o += 32768) n += String.fromCharCode(...t.subarray(o, o + 32768));
1664
1752
  return btoa(n);
1665
1753
  }
1666
- async function Pn(t) {
1754
+ async function En(t) {
1667
1755
  const n = /* @__PURE__ */ new Set(), e = (s) => {
1668
1756
  for (const r of s)
1669
1757
  r.kind === "picture" ? n.add(r.media) : r.kind === "group" ? e(r.children) : r.kind === "shape" && r.fill.kind === "image" && n.add(r.fill.media);
@@ -1672,55 +1760,55 @@ async function Pn(t) {
1672
1760
  e(s.items), s.background?.kind === "image" && n.add(s.background.media);
1673
1761
  const o = /* @__PURE__ */ new Map();
1674
1762
  return await Promise.all([...n].map(async (s) => {
1675
- if (!Sn.has(s.ext)) {
1763
+ if (!An.has(s.ext)) {
1676
1764
  o.set(s, null);
1677
1765
  return;
1678
1766
  }
1679
- const r = `data:${St[s.ext]};base64,${Cn(s.bytes)}`;
1767
+ const r = `data:${Pt[s.ext]};base64,${Ln(s.bytes)}`;
1680
1768
  let a = 0, i = 0;
1681
1769
  try {
1682
- const l = await createImageBitmap(new Blob([s.bytes], { type: St[s.ext] }));
1770
+ const l = await createImageBitmap(new Blob([s.bytes], { type: Pt[s.ext] }));
1683
1771
  a = l.width, i = l.height, l.close();
1684
1772
  } catch {
1685
1773
  }
1686
1774
  o.set(s, { url: r, w: a, h: i });
1687
1775
  })), o;
1688
1776
  }
1689
- function Tn(t, n, e) {
1777
+ function Rn(t, n, e) {
1690
1778
  const o = /^(nar|sm)/.test(t) ? 4 : /^(wd|lg)/.test(t) ? 12 : 8, s = /^dk/.test(t) ? 3 : /^lt/.test(t) ? 1 : /^(wd)/.test(t) ? 3 : 1.5, r = { color: n, background: e, spacing: o, strokeWidth: s }, a = /^pct(\d+)$/.exec(t);
1691
1779
  if (a) {
1692
- const i = Math.max(1, Math.min(99, Number(a[1]))), l = i > 50, x = (l ? 100 - i : i) / 100;
1693
- return { type: "dots", color: l ? e : n, background: l ? n : e, spacing: 4, strokeWidth: Math.max(0.5, 4 * Math.sqrt(x / Math.PI)) };
1780
+ const i = Math.max(1, Math.min(99, Number(a[1]))), l = i > 50, p = (l ? 100 - i : i) / 100;
1781
+ return { type: "dots", color: l ? e : n, background: l ? n : e, spacing: 4, strokeWidth: Math.max(0.5, 4 * Math.sqrt(p / Math.PI)) };
1694
1782
  }
1695
1783
  return /Horz$|^horz|Brick$|^shingle$|^wave$|^zigZag$/.test(t) ? { type: "stripes", ...r, angle: 0 } : /Vert$|^vert$/.test(t) ? { type: "stripes", ...r, angle: 90 } : /DnDiag$|^dnDiag$/.test(t) ? { type: "stripes", ...r, angle: 45 } : /UpDiag$|^upDiag$/.test(t) ? { type: "stripes", ...r, angle: -45 } : /^(diagCross|trellis|openDmnd|weave)$/.test(t) ? { type: "crosshatch", ...r } : /Check$|^solidDmnd$/.test(t) ? { type: "checker", ...r, angle: t === "solidDmnd" ? 45 : 0 } : /^(cross|smGrid|lgGrid|dotGrid|plaid)$/.test(t) ? { type: "grid", ...r } : { type: "dots", ...r, strokeWidth: 1 };
1696
1784
  }
1697
- async function In(t, n, e) {
1698
- const o = await ve(), s = await Pn(t), r = Math.round(t.width), a = Math.round(t.height), i = he(e ?? t.title, "slides", { width: r, height: a }), l = [], x = { slides: 0, elements: 0, pictures: 0, paths: 0 };
1785
+ async function Fn(t, n, e) {
1786
+ const o = await Ie(), s = await En(t), r = Math.round(t.width), a = Math.round(t.height), i = be(e ?? t.title, "slides", { width: r, height: a }), l = [], p = { slides: 0, elements: 0, pictures: 0, paths: 0 };
1699
1787
  i.slides = [];
1700
- const b = await mn(t, s), d = await Promise.all(t.slides.map((f) => {
1788
+ const x = await Mn(t, s), u = await Promise.all(t.slides.map((f) => {
1701
1789
  const h = f.background, y = h?.kind === "image" ? s.get(h.media) : void 0;
1702
- return h?.kind === "image" && y ? gn(y.url, r, a, h.tile) : void 0;
1703
- })), m = t.slides.map(() => n("slide")), g = /* @__PURE__ */ new Map();
1790
+ return h?.kind === "image" && y ? vn(y.url, r, a, h.tile) : void 0;
1791
+ })), g = t.slides.map(() => n("slide")), b = /* @__PURE__ */ new Map();
1704
1792
  return t.slides.forEach((f, h) => {
1705
- f.key && g.set(f.key, m[h]);
1793
+ f.key && b.set(f.key, g[h]);
1706
1794
  }), t.slides.forEach((f, h) => {
1707
- const y = h * (r + an), u = Lt(m[h], f.name || `Slide ${h + 1}`, y, 0, { width: r, height: a });
1708
- u.order = h;
1709
- const p = { ox: y, oy: 0, presets: o, nextId: n, out: [], byPptId: /* @__PURE__ */ new Map(), glue: [], warnings: l, stats: x, images: s, slideBg: d[h], gray: b, slideIds: g };
1710
- i.elements.push(...ie(f.items, p, [])), p.glue.forEach((M) => M()), vn(u, f.background, p);
1711
- const w = Mn(f.transition);
1712
- w && (u.transition = w), f.notes && (u.notes = f.notes), f.hidden && (u.hidden = !0), f.advanceAfterMs && (u.advanceAfter = f.advanceAfterMs), f.section && (u.section = f.section), i.slides.push(u), x.slides++;
1713
- }), i.slides.length || i.slides.push(Lt(void 0, "Slide 1", 0, 0, { width: r, height: a })), t.loop && (i.globalSettings = { ...i.globalSettings || {}, slideShowLoop: !0 }), { doc: i, warnings: [...new Set(l)], stats: x };
1714
- }
1715
- const Nn = 512 * 1024 * 1024;
1716
- async function Ln(t, n) {
1795
+ const y = h * (r + hn), d = Dt(g[h], f.name || `Slide ${h + 1}`, y, 0, { width: r, height: a });
1796
+ d.order = h;
1797
+ const m = { ox: y, oy: 0, presets: o, nextId: n, out: [], byPptId: /* @__PURE__ */ new Map(), glue: [], warnings: l, stats: p, images: s, slideBg: u[h], gray: x, slideIds: b, itemEls: /* @__PURE__ */ new Map() };
1798
+ i.elements.push(...fe(f.items, m, [])), yn(f.anims ?? [], m, n), m.glue.forEach((M) => M()), On(d, f.background, m);
1799
+ const w = Nn(f.transition);
1800
+ w && (d.transition = w), f.notes && (d.notes = f.notes), f.hidden && (d.hidden = !0), f.advanceAfterMs && (d.advanceAfter = f.advanceAfterMs), f.section && (d.section = f.section), i.slides.push(d), p.slides++;
1801
+ }), i.slides.length || i.slides.push(Dt(void 0, "Slide 1", 0, 0, { width: r, height: a })), t.loop && (i.globalSettings = { ...i.globalSettings || {}, slideShowLoop: !0 }), { doc: i, warnings: [...new Set(l)], stats: p };
1802
+ }
1803
+ const Dn = 512 * 1024 * 1024;
1804
+ async function Xn(t, n) {
1717
1805
  const e = t instanceof Uint8Array ? t : t instanceof ArrayBuffer ? new Uint8Array(t) : new Uint8Array(await t.arrayBuffer());
1718
- if (e.length > Nn) throw new Error("This presentation is too large to open (over 512 MB).");
1719
- const { deck: o, warnings: s } = rn(e), r = /* @__PURE__ */ new Set(), a = await In(o, (l) => be(l, r), n);
1720
- xe(a.doc);
1806
+ if (e.length > Dn) throw new Error("This presentation is too large to open (over 512 MB).");
1807
+ const { deck: o, warnings: s } = dn(e), r = /* @__PURE__ */ new Set(), a = await Fn(o, (l) => ve(l, r), n);
1808
+ Me(a.doc);
1721
1809
  const i = [...s, ...a.warnings];
1722
1810
  return i.length && console.warn("[pptx import]", i), { stats: a.stats, warnings: i };
1723
1811
  }
1724
1812
  export {
1725
- Ln as importPptx
1813
+ Xn as importPptx
1726
1814
  };