@algorisys/yappydraw 0.8.293 → 0.8.294
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/chunks/{canva-ai-B5NJGMGr.js → canva-ai-DqccAnxC.js} +1 -1
- package/chunks/{choice-dialog-state-Cw0WShhc.js → choice-dialog-state-10-yA9qy.js} +1 -1
- package/chunks/{custgeom-BeeylhzV.js → custgeom-gp_HWEYw.js} +13 -10
- package/chunks/{design-generator-BSZ2XUOE.js → design-generator-DIyJ4Dr0.js} +1 -1
- package/chunks/{drawing-engine-DfASJ_gK.js → drawing-engine-nqE0zI8L.js} +1 -1
- package/chunks/{drawings-store-cl-M93Eh.js → drawings-store-BFtMld-q.js} +1 -1
- package/chunks/{ds-operations-CXoS_Obn.js → ds-operations-40JYI4lM.js} +1 -1
- package/chunks/{export-game-BTjE-uv-.js → export-game-5Kek7Bol.js} +1 -1
- package/chunks/{from-yappy-hUcG5auS.js → from-yappy-ChRzxzZ9.js} +98 -88
- package/chunks/{game-runtime-33Ly0Axb.js → game-runtime--zmzKmmo.js} +37 -37
- package/chunks/{import-Dk___UKU.js → import-DGbhv-Je.js} +571 -507
- package/chunks/{index-OCtbNe3Y.js → index-v2rH-W8-.js} +40108 -39488
- package/chunks/{lucide-solid-Btzt68l9.js → lucide-solid-BHWkJbay.js} +1 -1
- package/chunks/markdown-to-slides-siI6fZd3.js +122 -0
- package/chunks/{morph-animator-CWLzpuUc.js → morph-animator-klLNQx0a.js} +1 -1
- package/chunks/{onboarding-tour-eLES7UJM.js → onboarding-tour-CV0e3oyB.js} +1 -1
- package/chunks/{pdf-vector-C1l03NEO.js → pdf-vector-DLxGyE10.js} +1 -1
- package/chunks/{search-tbh5OqVp.js → search-53sGgwDp.js} +2 -2
- package/chunks/{slide-generator-CZfB2tSO.js → slide-generator-BttJgv2N.js} +1 -1
- package/chunks/{turntable-ai-CeD-w_eE.js → turntable-ai-7udakZBz.js} +1 -1
- package/chunks/write-CIGfHqn4.js +254 -0
- package/package.json +1 -1
- package/yappy.js +1 -1
- package/chunks/markdown-to-slides-CNpwNPE8.js +0 -96
- package/chunks/write-BUtbdS9L.js +0 -212
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { u as ae, a as ie } from "./browser-DbZP-BrN.js";
|
|
2
|
-
import { E as H, i as vt, g as le } from "./custgeom-
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
2
|
+
import { E as H, i as vt, g as le } from "./custgeom-gp_HWEYw.js";
|
|
3
|
+
import { aq as ce, ar as Nt, as as fe, at as ue, M as de, q as he, K as pe } from "./index-v2rH-W8-.js";
|
|
4
|
+
const me = 1e4, ge = 1e5, Wt = 6e4, Q = (t) => t / Wt * (Math.PI / 180);
|
|
5
5
|
function _t(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), c = Math.max(r, a),
|
|
6
|
+
const s = /* @__PURE__ */ new Map(), r = Math.max(0, n), a = Math.max(0, e), i = Math.min(r, a), c = Math.max(r, a), x = {
|
|
7
7
|
w: r,
|
|
8
8
|
h: a,
|
|
9
9
|
l: 0,
|
|
@@ -22,28 +22,28 @@ function _t(t, n, e, o = {}) {
|
|
|
22
22
|
"5cd8": 135e5,
|
|
23
23
|
"7cd8": 189e5
|
|
24
24
|
};
|
|
25
|
-
for (const [
|
|
26
|
-
for (const
|
|
27
|
-
s.set(`wd${
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
if (
|
|
31
|
-
const u = /^(wd|hd|ssd)(\d+)$/.exec(
|
|
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 u = /^(wd|hd|ssd)(\d+)$/.exec(m);
|
|
32
32
|
if (u) {
|
|
33
|
-
const
|
|
34
|
-
return d ?
|
|
33
|
+
const y = u[1] === "wd" ? r : u[1] === "hd" ? a : i, d = Number(u[2]);
|
|
34
|
+
return d ? y / d : 0;
|
|
35
35
|
}
|
|
36
|
-
const
|
|
37
|
-
return Number.isFinite(
|
|
38
|
-
}, f = (
|
|
39
|
-
s.size >
|
|
36
|
+
const h = Number(m);
|
|
37
|
+
return Number.isFinite(h) ? h : 0;
|
|
38
|
+
}, f = (m, g) => {
|
|
39
|
+
s.size > me || s.set(m, xe(g, b));
|
|
40
40
|
};
|
|
41
|
-
for (const [
|
|
42
|
-
for (const [
|
|
43
|
-
for (const [
|
|
41
|
+
for (const [m, g] of t.av ?? []) f(m, o[m] ?? g);
|
|
42
|
+
for (const [m, g] of Object.entries(o)) s.has(m) || f(m, g);
|
|
43
|
+
for (const [m, g] of t.gd ?? []) f(m, g);
|
|
44
44
|
return s;
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function xe(t, n) {
|
|
47
47
|
const e = String(t || "").trim().split(/\s+/), o = e[0], [s, r, a] = e.slice(1).map(n);
|
|
48
48
|
let i;
|
|
49
49
|
switch (o) {
|
|
@@ -75,13 +75,13 @@ function me(t, n) {
|
|
|
75
75
|
i = s * Math.sin(Math.atan2(a, r));
|
|
76
76
|
break;
|
|
77
77
|
case "cos":
|
|
78
|
-
i = s * Math.cos(
|
|
78
|
+
i = s * Math.cos(Q(r));
|
|
79
79
|
break;
|
|
80
80
|
case "sin":
|
|
81
|
-
i = s * Math.sin(
|
|
81
|
+
i = s * Math.sin(Q(r));
|
|
82
82
|
break;
|
|
83
83
|
case "tan":
|
|
84
|
-
i = s * Math.tan(
|
|
84
|
+
i = s * Math.tan(Q(r));
|
|
85
85
|
break;
|
|
86
86
|
case "max":
|
|
87
87
|
i = Math.max(s, r);
|
|
@@ -103,74 +103,74 @@ function me(t, n) {
|
|
|
103
103
|
}
|
|
104
104
|
return Number.isFinite(i) ? i : 0;
|
|
105
105
|
}
|
|
106
|
-
const
|
|
107
|
-
function
|
|
108
|
-
const s = Math.max(Math.abs(n), 0) * H, r = Math.max(Math.abs(e), 0) * H, a = _t(t, s, r, o), i = (
|
|
109
|
-
let
|
|
110
|
-
for (const
|
|
111
|
-
const f =
|
|
112
|
-
let
|
|
113
|
-
for (const
|
|
114
|
-
if (--
|
|
115
|
-
switch (
|
|
106
|
+
const Ot = (t, n, e) => Math.atan2(n * Math.sin(t), e * Math.cos(t));
|
|
107
|
+
function lt(t, n, e, o = {}) {
|
|
108
|
+
const s = Math.max(Math.abs(n), 0) * H, r = Math.max(Math.abs(e), 0) * H, a = _t(t, s, r, o), i = (b) => typeof b == "number" ? b : a.get(b) ?? (Number.isFinite(Number(b)) ? Number(b) : 0), c = [];
|
|
109
|
+
let x = ge;
|
|
110
|
+
for (const b of t.paths) {
|
|
111
|
+
const f = b.w ? s / b.w : 1, m = b.h ? r / b.h : 1, g = (p) => i(p) * f / H, u = (p) => i(p) * m / H, h = [];
|
|
112
|
+
let y = { x: 0, y: 0 }, d = { x: 0, y: 0 };
|
|
113
|
+
for (const p of b.d) {
|
|
114
|
+
if (--x < 0) break;
|
|
115
|
+
switch (p[0]) {
|
|
116
116
|
case "M":
|
|
117
|
-
|
|
117
|
+
y = { x: g(p[1]), y: u(p[2]) }, d = y, h.push({ op: "M", ...y });
|
|
118
118
|
break;
|
|
119
119
|
case "L":
|
|
120
|
-
|
|
120
|
+
y = { x: g(p[1]), y: u(p[2]) }, h.push({ op: "L", ...y });
|
|
121
121
|
break;
|
|
122
122
|
case "C": {
|
|
123
|
-
const k =
|
|
124
|
-
|
|
123
|
+
const k = g(p[1]), M = u(p[2]), S = g(p[3]), v = u(p[4]);
|
|
124
|
+
y = { x: g(p[5]), y: u(p[6]) }, h.push({ op: "C", x1: k, y1: M, x2: S, y2: v, ...y });
|
|
125
125
|
break;
|
|
126
126
|
}
|
|
127
127
|
case "Q": {
|
|
128
|
-
const k =
|
|
129
|
-
|
|
128
|
+
const k = g(p[1]), M = u(p[2]), S = g(p[3]), v = u(p[4]);
|
|
129
|
+
h.push({ op: "C", x1: y.x + 2 / 3 * (k - y.x), y1: y.y + 2 / 3 * (M - y.y), x2: S + 2 / 3 * (k - S), y2: v + 2 / 3 * (M - v), x: S, y: v }), y = { x: S, y: v };
|
|
130
130
|
break;
|
|
131
131
|
}
|
|
132
132
|
case "A": {
|
|
133
|
-
const k = i(
|
|
134
|
-
|
|
133
|
+
const k = i(p[1]) * f / H, M = i(p[2]) * m / H;
|
|
134
|
+
y = be(h, y, k, M, i(p[3]), i(p[4]));
|
|
135
135
|
break;
|
|
136
136
|
}
|
|
137
137
|
case "Z":
|
|
138
|
-
|
|
138
|
+
h.push({ op: "Z" }), y = d;
|
|
139
139
|
break;
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
-
|
|
142
|
+
h.length && c.push({ cmds: h, fill: b.fill === "none" ? !1 : void 0, stroke: b.stroke === !1 ? !1 : void 0 });
|
|
143
143
|
}
|
|
144
144
|
return c;
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function be(t, n, e, o, s, r) {
|
|
147
147
|
if (Math.abs(e) < 1e-9 || Math.abs(o) < 1e-9 || r === 0) return n;
|
|
148
|
-
const a =
|
|
149
|
-
let
|
|
150
|
-
if (Math.abs(i) >= 2 * Math.PI - 1e-9)
|
|
148
|
+
const a = Q(s), i = Math.max(-4 * Math.PI, Math.min(4 * Math.PI, Q(r))), c = Ot(a, e, o);
|
|
149
|
+
let x = Ot(a + i, e, o);
|
|
150
|
+
if (Math.abs(i) >= 2 * Math.PI - 1e-9) x = c + Math.sign(i) * 2 * Math.PI;
|
|
151
151
|
else {
|
|
152
|
-
for (; i > 0 &&
|
|
153
|
-
for (; i < 0 &&
|
|
152
|
+
for (; i > 0 && x < c; ) x += 2 * Math.PI;
|
|
153
|
+
for (; i < 0 && x > c; ) x -= 2 * Math.PI;
|
|
154
154
|
}
|
|
155
|
-
const
|
|
156
|
-
let
|
|
157
|
-
for (let
|
|
158
|
-
const k =
|
|
159
|
-
d = { x:
|
|
155
|
+
const b = n.x - e * Math.cos(c), f = n.y - o * Math.sin(c), m = x - c, g = Math.max(1, Math.min(16, Math.ceil(Math.abs(m) / (Math.PI / 2)))), u = m / g, h = 4 / 3 * Math.tan(u / 4);
|
|
156
|
+
let y = c, d = n;
|
|
157
|
+
for (let p = 0; p < g; p++) {
|
|
158
|
+
const k = y + u, M = Math.cos(y), S = Math.sin(y), v = Math.cos(k), N = Math.sin(k);
|
|
159
|
+
d = { x: b + e * v, y: f + o * N }, t.push({ op: "C", x1: b + e * (M - h * S), y1: f + o * (S + h * M), x2: b + e * (v + h * N), y2: f + o * (N - h * v), ...d }), y = k;
|
|
160
160
|
}
|
|
161
161
|
return d;
|
|
162
162
|
}
|
|
163
163
|
function Ut(t, n, e, o = {}) {
|
|
164
164
|
const s = Math.abs(n), r = Math.abs(e);
|
|
165
165
|
if (!t.rect) return { l: 0, t: 0, r: s, b: r };
|
|
166
|
-
const a = _t(t, s * H, r * H, o), i = (
|
|
167
|
-
return { l: c, t:
|
|
166
|
+
const a = _t(t, s * H, r * H, o), i = (m) => (a.get(m) ?? (Number.isFinite(Number(m)) ? Number(m) : 0)) / H, [c, x, b, f] = t.rect.map(i);
|
|
167
|
+
return { l: c, t: x, r: b, b: f };
|
|
168
168
|
}
|
|
169
|
-
let
|
|
170
|
-
async function
|
|
171
|
-
return
|
|
169
|
+
let Rt = null;
|
|
170
|
+
async function ye() {
|
|
171
|
+
return Rt ??= (await import("./presets-DP49P8i2.js")).default, Rt;
|
|
172
172
|
}
|
|
173
|
-
const
|
|
173
|
+
const At = 5e4, ke = 256 * 1024 * 1024, Et = 1024 * 1024 * 1024, we = 1e4, Me = 32, ve = 2e4, I = (t, n) => {
|
|
174
174
|
if (!t) return [];
|
|
175
175
|
const e = [];
|
|
176
176
|
for (let o = t.firstChild; o; o = o.nextSibling)
|
|
@@ -180,7 +180,7 @@ const Et = 5e4, be = 256 * 1024 * 1024, At = 1024 * 1024 * 1024, ye = 1e4, ke =
|
|
|
180
180
|
if (!t) return null;
|
|
181
181
|
for (let e = t.firstChild; e; e = e.nextSibling) if (e.nodeType === 1 && e.localName === n) return e;
|
|
182
182
|
return null;
|
|
183
|
-
},
|
|
183
|
+
}, R = (t, ...n) => {
|
|
184
184
|
let e = t;
|
|
185
185
|
for (const o of n) e = l(e, o);
|
|
186
186
|
return e ?? null;
|
|
@@ -200,16 +200,16 @@ const Et = 5e4, be = 256 * 1024 * 1024, At = 1024 * 1024 * 1024, ye = 1e4, ke =
|
|
|
200
200
|
}, B = (t, n) => {
|
|
201
201
|
const e = w(t, n);
|
|
202
202
|
return e === null ? void 0 : e === "1" || e === "true" || e === "on";
|
|
203
|
-
}, L = (t) => t / H,
|
|
204
|
-
function
|
|
203
|
+
}, L = (t) => t / H, Se = /* @__PURE__ */ new Set(["p14", "a14", "a16"]);
|
|
204
|
+
function Ce(t) {
|
|
205
205
|
if (t.localName !== "AlternateContent") return [t];
|
|
206
206
|
const n = l(t, "Fallback");
|
|
207
|
-
for (const e of
|
|
208
|
-
if ((w(e, "Requires") || "").split(/\s+/).filter(Boolean).every((s) =>
|
|
209
|
-
return
|
|
207
|
+
for (const e of I(t, "Choice"))
|
|
208
|
+
if ((w(e, "Requires") || "").split(/\s+/).filter(Boolean).every((s) => Se.has(s))) return I(e);
|
|
209
|
+
return I(n);
|
|
210
210
|
}
|
|
211
|
-
const
|
|
212
|
-
class
|
|
211
|
+
const st = (t) => I(t).flatMap(Ce);
|
|
212
|
+
class Pe {
|
|
213
213
|
files;
|
|
214
214
|
text = /* @__PURE__ */ new Map();
|
|
215
215
|
relCache = /* @__PURE__ */ new Map();
|
|
@@ -217,13 +217,13 @@ class Se {
|
|
|
217
217
|
warn;
|
|
218
218
|
constructor(n, e, o) {
|
|
219
219
|
this.parseXml = e, this.warn = o, this.files = {};
|
|
220
|
-
for (const [s, r] of Object.entries(n)) this.files[
|
|
220
|
+
for (const [s, r] of Object.entries(n)) this.files[K(s)] = r;
|
|
221
221
|
}
|
|
222
222
|
bytes(n) {
|
|
223
|
-
return this.files[
|
|
223
|
+
return this.files[K(n)];
|
|
224
224
|
}
|
|
225
225
|
xml(n) {
|
|
226
|
-
const e =
|
|
226
|
+
const e = K(n);
|
|
227
227
|
if (!this.text.has(e)) {
|
|
228
228
|
const o = this.files[e];
|
|
229
229
|
let s = null;
|
|
@@ -241,16 +241,16 @@ class Se {
|
|
|
241
241
|
return this.text.get(e)?.documentElement ?? null;
|
|
242
242
|
}
|
|
243
243
|
rels(n) {
|
|
244
|
-
const e =
|
|
244
|
+
const e = K(n);
|
|
245
245
|
let o = this.relCache.get(e);
|
|
246
246
|
if (o) return o;
|
|
247
247
|
o = /* @__PURE__ */ new Map();
|
|
248
248
|
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
|
|
250
|
-
const c = w(i, "Id"),
|
|
249
|
+
for (const i of I(a, "Relationship")) {
|
|
250
|
+
const c = w(i, "Id"), x = w(i, "Type") || "", b = w(i, "Target") || "";
|
|
251
251
|
if (!c) continue;
|
|
252
252
|
const f = w(i, "TargetMode") === "External";
|
|
253
|
-
o.set(c, { type:
|
|
253
|
+
o.set(c, { type: x.slice(x.lastIndexOf("/") + 1), target: f ? b : Te(s, b), external: f });
|
|
254
254
|
}
|
|
255
255
|
return this.relCache.set(e, o), o;
|
|
256
256
|
}
|
|
@@ -259,14 +259,14 @@ class Se {
|
|
|
259
259
|
return null;
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
|
-
const
|
|
263
|
-
function
|
|
262
|
+
const K = (t) => t.replace(/\\/g, "/").replace(/^\/+/, "");
|
|
263
|
+
function Te(t, n) {
|
|
264
264
|
let e = n.split("#")[0];
|
|
265
265
|
try {
|
|
266
266
|
e = decodeURIComponent(e);
|
|
267
267
|
} catch {
|
|
268
268
|
}
|
|
269
|
-
if (e.startsWith("/")) return
|
|
269
|
+
if (e.startsWith("/")) return K(e);
|
|
270
270
|
const o = (t ? t.split("/") : []).concat(e.split("/")), s = [];
|
|
271
271
|
for (const r of o)
|
|
272
272
|
r === ".." ? s.pop() : r && r !== "." && s.push(r);
|
|
@@ -275,18 +275,18 @@ function Ce(t, n) {
|
|
|
275
275
|
const St = { bg1: "lt1", tx1: "dk1", bg2: "lt2", tx2: "dk2" };
|
|
276
276
|
function pt(t) {
|
|
277
277
|
const n = { colors: {}, major: "Calibri Light", minor: "Calibri", fills: [], lines: [], bgFills: [] }, e = l(t, "themeElements");
|
|
278
|
-
for (const r of
|
|
279
|
-
const a =
|
|
278
|
+
for (const r of I(l(e, "clrScheme"))) {
|
|
279
|
+
const a = I(r)[0];
|
|
280
280
|
if (!a) continue;
|
|
281
281
|
const i = a.localName === "sysClr" ? w(a, "lastClr") : w(a, "val");
|
|
282
282
|
i && /^[0-9a-f]{6}$/i.test(i) && (n.colors[r.localName] = "#" + i.toLowerCase());
|
|
283
283
|
}
|
|
284
284
|
const o = l(e, "fontScheme");
|
|
285
|
-
n.major = w(
|
|
285
|
+
n.major = w(R(o, "majorFont", "latin"), "typeface") || n.major, n.minor = w(R(o, "minorFont", "latin"), "typeface") || n.minor;
|
|
286
286
|
const s = l(e, "fmtScheme");
|
|
287
|
-
return n.fills =
|
|
287
|
+
return n.fills = I(l(s, "fillStyleLst")), n.lines = I(l(s, "lnStyleLst")), n.bgFills = I(l(s, "bgFillStyleLst")), n;
|
|
288
288
|
}
|
|
289
|
-
const
|
|
289
|
+
const Ie = {
|
|
290
290
|
black: "#000000",
|
|
291
291
|
white: "#ffffff",
|
|
292
292
|
red: "#ff0000",
|
|
@@ -314,7 +314,7 @@ const Pe = {
|
|
|
314
314
|
}, Gt = (t) => {
|
|
315
315
|
const n = t.replace("#", "");
|
|
316
316
|
return [parseInt(n.slice(0, 2), 16) || 0, parseInt(n.slice(2, 4), 16) || 0, parseInt(n.slice(4, 6), 16) || 0];
|
|
317
|
-
},
|
|
317
|
+
}, it = (t, n, e) => "#" + [t, n, e].map((o) => Math.max(0, Math.min(255, Math.round(o))).toString(16).padStart(2, "0")).join(""), J = (t) => (t /= 255, t <= 0.04045 ? t / 12.92 : Math.pow((t + 0.055) / 1.055, 2.4)), _ = (t) => 255 * (t <= 31308e-7 ? t * 12.92 : 1.055 * Math.pow(t, 1 / 2.4) - 0.055);
|
|
318
318
|
function Lt(t, n, e) {
|
|
319
319
|
t /= 255, n /= 255, e /= 255;
|
|
320
320
|
const o = Math.max(t, n, e), s = Math.min(t, n, e), r = (o + s) / 2;
|
|
@@ -328,10 +328,10 @@ function mt(t, n, e) {
|
|
|
328
328
|
return [r(t + 1 / 3) * 255, r(t) * 255, r(t - 1 / 3) * 255];
|
|
329
329
|
}
|
|
330
330
|
function $(t, n) {
|
|
331
|
-
const e =
|
|
332
|
-
return e ?
|
|
331
|
+
const e = I(t).find((o) => /Clr$/.test(o.localName));
|
|
332
|
+
return e ? Ne(e, n) : null;
|
|
333
333
|
}
|
|
334
|
-
function
|
|
334
|
+
function Ne(t, n) {
|
|
335
335
|
let e = null, o = 1;
|
|
336
336
|
switch (t.localName) {
|
|
337
337
|
case "srgbClr": {
|
|
@@ -345,14 +345,14 @@ function Te(t, n) {
|
|
|
345
345
|
break;
|
|
346
346
|
}
|
|
347
347
|
case "prstClr":
|
|
348
|
-
e =
|
|
348
|
+
e = Ie[w(t, "val") || ""] ?? "#000000";
|
|
349
349
|
break;
|
|
350
350
|
case "scrgbClr":
|
|
351
|
-
e =
|
|
351
|
+
e = it(_(C(t, "r") / 1e5), _(C(t, "g") / 1e5), _(C(t, "b") / 1e5));
|
|
352
352
|
break;
|
|
353
353
|
case "hslClr": {
|
|
354
|
-
const [c,
|
|
355
|
-
e =
|
|
354
|
+
const [c, x, b] = mt(C(t, "hue") / 6e4, C(t, "sat") / 1e5, C(t, "lum") / 1e5);
|
|
355
|
+
e = it(c, x, b);
|
|
356
356
|
break;
|
|
357
357
|
}
|
|
358
358
|
case "schemeClr": {
|
|
@@ -361,24 +361,24 @@ function Te(t, n) {
|
|
|
361
361
|
n.phClr ? (e = n.phClr.hex, o = n.phClr.alpha ?? 1) : e = n.theme.colors.accent1 ?? "#4472c4";
|
|
362
362
|
break;
|
|
363
363
|
}
|
|
364
|
-
const
|
|
365
|
-
e = n.theme.colors[
|
|
364
|
+
const x = n.clrMap[c] ?? St[c] ?? c;
|
|
365
|
+
e = n.theme.colors[x] ?? null;
|
|
366
366
|
break;
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
369
|
if (!e) return null;
|
|
370
370
|
let [s, r, a] = Gt(e);
|
|
371
|
-
for (const c of
|
|
372
|
-
const
|
|
371
|
+
for (const c of I(t)) {
|
|
372
|
+
const x = C(c, "val") / 1e5;
|
|
373
373
|
switch (c.localName) {
|
|
374
374
|
case "alpha":
|
|
375
|
-
o =
|
|
375
|
+
o = x;
|
|
376
376
|
break;
|
|
377
377
|
case "alphaMod":
|
|
378
|
-
o *=
|
|
378
|
+
o *= x;
|
|
379
379
|
break;
|
|
380
380
|
case "alphaOff":
|
|
381
|
-
o +=
|
|
381
|
+
o += x;
|
|
382
382
|
break;
|
|
383
383
|
case "lumMod":
|
|
384
384
|
case "lumOff":
|
|
@@ -386,19 +386,19 @@ function Te(t, n) {
|
|
|
386
386
|
case "satOff":
|
|
387
387
|
case "hueMod":
|
|
388
388
|
case "hueOff": {
|
|
389
|
-
let [
|
|
390
|
-
c.localName === "lumMod" ?
|
|
389
|
+
let [b, f, m] = Lt(s, r, a);
|
|
390
|
+
c.localName === "lumMod" ? m *= x : c.localName === "lumOff" ? m += x : c.localName === "satMod" ? f *= x : c.localName === "satOff" ? f += x : c.localName === "hueMod" ? b *= x : b += C(c, "val") / 6e4, [s, r, a] = mt(b, Math.max(0, Math.min(1, f)), Math.max(0, Math.min(1, m)));
|
|
391
391
|
break;
|
|
392
392
|
}
|
|
393
393
|
case "tint":
|
|
394
|
-
[s, r, a] = [s, r, a].map((
|
|
394
|
+
[s, r, a] = [s, r, a].map((b) => _(J(b) * x + (1 - x)));
|
|
395
395
|
break;
|
|
396
396
|
case "shade":
|
|
397
|
-
[s, r, a] = [s, r, a].map((
|
|
397
|
+
[s, r, a] = [s, r, a].map((b) => _(J(b) * x));
|
|
398
398
|
break;
|
|
399
399
|
case "comp": {
|
|
400
|
-
const [
|
|
401
|
-
[s, r, a] = mt(
|
|
400
|
+
const [b, f, m] = Lt(s, r, a);
|
|
401
|
+
[s, r, a] = mt(b + 180, f, m);
|
|
402
402
|
break;
|
|
403
403
|
}
|
|
404
404
|
case "inv":
|
|
@@ -411,11 +411,11 @@ function Te(t, n) {
|
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
413
|
o = Math.max(0, Math.min(1, o));
|
|
414
|
-
const i = { hex:
|
|
414
|
+
const i = { hex: it(s, r, a) };
|
|
415
415
|
return o < 0.999 && (i.alpha = o), i;
|
|
416
416
|
}
|
|
417
417
|
function V(t, n) {
|
|
418
|
-
for (const e of
|
|
418
|
+
for (const e of I(t)) {
|
|
419
419
|
const o = Ct(e, n);
|
|
420
420
|
if (o) return o;
|
|
421
421
|
}
|
|
@@ -429,7 +429,7 @@ function Ct(t, n) {
|
|
|
429
429
|
return e ? { kind: "solid", color: e } : { kind: "none" };
|
|
430
430
|
}
|
|
431
431
|
case "gradFill": {
|
|
432
|
-
const e =
|
|
432
|
+
const e = I(l(t, "gsLst"), "gs").slice(0, 256).map((s) => ({ pos: C(s, "pos") / 1e5, color: $(s, n.ctx) ?? { hex: "#000000" } }));
|
|
433
433
|
if (!e.length) return { kind: "none" };
|
|
434
434
|
const o = l(t, "lin");
|
|
435
435
|
return l(t, "path") ? { kind: "radial", stops: e } : { kind: "linear", stops: e, angle: o ? C(o, "ang") / 6e4 : 90, scaled: B(o, "scaled") ?? !1 };
|
|
@@ -450,7 +450,7 @@ function Ct(t, n) {
|
|
|
450
450
|
return;
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
|
-
const
|
|
453
|
+
const Oe = {
|
|
454
454
|
png: "png",
|
|
455
455
|
jpg: "jpeg",
|
|
456
456
|
jpeg: "jpeg",
|
|
@@ -469,14 +469,14 @@ function Vt(t, n) {
|
|
|
469
469
|
if (!o) return null;
|
|
470
470
|
const s = n.pkg.rels(n.part).get(o);
|
|
471
471
|
if (!s || s.external) return null;
|
|
472
|
-
const r = n.pkg.bytes(s.target), a =
|
|
472
|
+
const r = n.pkg.bytes(s.target), a = Oe[(s.target.split(".").pop() || "").toLowerCase()];
|
|
473
473
|
return r && a ? { bytes: r, ext: a } : null;
|
|
474
474
|
}
|
|
475
475
|
const Re = { solid: "", dot: "sysDot", sysDot: "sysDot", sysDash: "dash", dash: "dash", lgDash: "dash", dashDot: "dash", lgDashDot: "dash", lgDashDotDot: "dash", sysDashDot: "dash", sysDashDotDot: "dash" };
|
|
476
476
|
function U(t, n) {
|
|
477
477
|
if (!t) return;
|
|
478
478
|
let e;
|
|
479
|
-
for (const i of
|
|
479
|
+
for (const i of I(t)) {
|
|
480
480
|
if (i.localName === "noFill") return null;
|
|
481
481
|
i.localName === "solidFill" && (e = $(i, n.ctx)), i.localName === "gradFill" && (e = $(l(l(i, "gsLst"), "gs"), n.ctx));
|
|
482
482
|
}
|
|
@@ -485,8 +485,8 @@ function U(t, n) {
|
|
|
485
485
|
const s = (i) => {
|
|
486
486
|
const c = w(i, "type");
|
|
487
487
|
if (!c || c === "none") return;
|
|
488
|
-
const
|
|
489
|
-
return { type:
|
|
488
|
+
const x = c === "triangle" || c === "stealth" || c === "arrow" || c === "oval" || c === "diamond" ? c : "triangle", b = w(i, "len") || w(i, "w");
|
|
489
|
+
return { type: x, size: b === "sm" || b === "lg" ? b : "med" };
|
|
490
490
|
}, r = Re[w(l(t, "prstDash"), "val") || "solid"], a = w(t, "cap");
|
|
491
491
|
return {
|
|
492
492
|
// ECMA's default is 9525 EMU — 0.75 pt, one px.
|
|
@@ -499,7 +499,7 @@ function U(t, n) {
|
|
|
499
499
|
tail: s(l(t, "tailEnd"))
|
|
500
500
|
};
|
|
501
501
|
}
|
|
502
|
-
function
|
|
502
|
+
function ct(t, n) {
|
|
503
503
|
const e = l(t, "fillRef");
|
|
504
504
|
if (!e) return;
|
|
505
505
|
const o = C(e, "idx");
|
|
@@ -533,18 +533,18 @@ function Y(t) {
|
|
|
533
533
|
};
|
|
534
534
|
}
|
|
535
535
|
const gt = (t) => t;
|
|
536
|
-
function
|
|
536
|
+
function Ae(t, n) {
|
|
537
537
|
const e = Y(t);
|
|
538
538
|
if (!e) return n;
|
|
539
|
-
const o = l(t, "chOff"), s = l(t, "chExt"), r = o ? L(C(o, "x")) : e.x, a = o ? L(C(o, "y")) : e.y, i = s ? L(C(s, "cx")) : e.w, c = s ? L(C(s, "cy")) : e.h,
|
|
539
|
+
const o = l(t, "chOff"), s = l(t, "chExt"), r = o ? L(C(o, "x")) : e.x, a = o ? L(C(o, "y")) : e.y, i = s ? L(C(s, "cx")) : e.w, c = s ? L(C(s, "cy")) : e.h, x = i > 0 ? e.w / i : 1, b = c > 0 ? e.h / c : 1, f = e.x + e.w / 2, m = e.y + e.h / 2, g = e.rot * Math.PI / 180;
|
|
540
540
|
return (u) => {
|
|
541
|
-
let
|
|
542
|
-
if (e.flipH && (
|
|
543
|
-
const v =
|
|
544
|
-
|
|
541
|
+
let h = e.x + (u.x + u.w / 2 - r) * x, y = e.y + (u.y + u.h / 2 - a) * b, d = u.rot, p = u.flipH, k = u.flipV;
|
|
542
|
+
if (e.flipH && (h = 2 * f - h, p = !p, d = -d), e.flipV && (y = 2 * m - y, k = !k, d = -d), g) {
|
|
543
|
+
const v = h - f, N = y - m;
|
|
544
|
+
h = f + v * Math.cos(g) - N * Math.sin(g), y = m + v * Math.sin(g) + N * Math.cos(g), d += e.rot;
|
|
545
545
|
}
|
|
546
|
-
const M = u.w *
|
|
547
|
-
return n({ x:
|
|
546
|
+
const M = u.w * x, S = u.h * b;
|
|
547
|
+
return n({ x: h - M / 2, y: y - S / 2, w: M, h: S, rot: (d % 360 + 360) % 360, flipH: p, flipV: k });
|
|
548
548
|
};
|
|
549
549
|
}
|
|
550
550
|
function Ft(t) {
|
|
@@ -552,7 +552,7 @@ function Ft(t) {
|
|
|
552
552
|
if (n) return { px: Math.max(0, Math.min(1584, C(n, "val") / 100)) * (vt / H) };
|
|
553
553
|
if (e) return { lines: Math.max(0, Math.min(13.2, C(e, "val") / 1e5)) };
|
|
554
554
|
}
|
|
555
|
-
function
|
|
555
|
+
function jt(t, n, e) {
|
|
556
556
|
const o = l(t, `lvl${n + 1}pPr`) ?? (t && t.localName.endsWith("pPr") ? t : null);
|
|
557
557
|
return o ? qt(o, e) : {};
|
|
558
558
|
}
|
|
@@ -567,7 +567,7 @@ function qt(t, n) {
|
|
|
567
567
|
const a = w(l(t, "buSzPct"), "val") || "", i = a.endsWith("%") ? parseFloat(a) / 100 : Number(a) / 1e5;
|
|
568
568
|
e.buSz = Number.isFinite(i) && i > 0 ? Math.max(0.25, Math.min(4, i)) : null;
|
|
569
569
|
} else (l(t, "buSzTx") || l(t, "buSzPts")) && (e.buSz = null);
|
|
570
|
-
const o =
|
|
570
|
+
const o = R(t, "lnSpc", "spcPct");
|
|
571
571
|
o && (e.lnSpcPct = C(o, "val") / 1e5);
|
|
572
572
|
const s = Ft(l(t, "spcBef")), r = Ft(l(t, "spcAft"));
|
|
573
573
|
return s && (e.spcBef = s), r && (e.spcAft = r), Object.assign(e, Zt(l(t, "defRPr"), n)), e;
|
|
@@ -581,7 +581,7 @@ function Zt(t, n) {
|
|
|
581
581
|
const s = w(l(t, "latin"), "typeface");
|
|
582
582
|
return s && (e.font = s), e;
|
|
583
583
|
}
|
|
584
|
-
const
|
|
584
|
+
const Ee = {
|
|
585
585
|
108: "●",
|
|
586
586
|
110: "■",
|
|
587
587
|
111: "□",
|
|
@@ -595,130 +595,130 @@ const Oe = {
|
|
|
595
595
|
252: "✔",
|
|
596
596
|
251: "✗",
|
|
597
597
|
254: "☑"
|
|
598
|
-
},
|
|
599
|
-
function
|
|
598
|
+
}, Le = { 183: "•", 168: "♦", 174: "→", 222: "⇒", 45: "−", 42: "∗" };
|
|
599
|
+
function Fe(t, n) {
|
|
600
600
|
if (!t) return "•";
|
|
601
601
|
let e = t.codePointAt(0);
|
|
602
602
|
e >= 61440 && e <= 61695 && (e -= 61440);
|
|
603
603
|
const o = (n || "").toLowerCase();
|
|
604
|
-
return o.startsWith("wingdings") ? o === "wingdings" &&
|
|
604
|
+
return o.startsWith("wingdings") ? o === "wingdings" && Ee[e] || "•" : o === "symbol" ? Le[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
605
|
}
|
|
606
|
-
const
|
|
606
|
+
const Dt = (...t) => {
|
|
607
607
|
const n = {};
|
|
608
608
|
for (const e of t) for (const [o, s] of Object.entries(e)) s !== void 0 && (n[o] = s);
|
|
609
609
|
return n;
|
|
610
610
|
};
|
|
611
|
-
function
|
|
611
|
+
function je(t, n) {
|
|
612
612
|
if (t)
|
|
613
613
|
return t.startsWith("+mj") ? n.major : t.startsWith("+mn") ? n.minor : t;
|
|
614
614
|
}
|
|
615
615
|
function Tt(t, n, e) {
|
|
616
616
|
if (!t) return;
|
|
617
|
-
const o =
|
|
618
|
-
if (!o.some((
|
|
617
|
+
const o = I(t, "p");
|
|
618
|
+
if (!o.some((g) => I(g).some((u) => (u.localName === "r" || u.localName === "fld") && (R(u, "t")?.textContent ?? "") !== ""))) return;
|
|
619
619
|
const r = {};
|
|
620
620
|
let a = 1, i = 1;
|
|
621
|
-
for (const
|
|
622
|
-
if (!
|
|
623
|
-
for (let
|
|
624
|
-
const u = l(
|
|
625
|
-
u && (a = w(u, "fontScale") !== null ? C(u, "fontScale") / 1e5 : 1), u && (i = 1 - Math.max(0, Math.min(0.9, C(u, "lnSpcReduction") / 1e5))), (l(
|
|
621
|
+
for (const g of [...n.bodyPr, l(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 u = l(g, "normAutofit");
|
|
625
|
+
u && (a = w(u, "fontScale") !== null ? C(u, "fontScale") / 1e5 : 1), u && (i = 1 - Math.max(0, Math.min(0.9, C(u, "lnSpcReduction") / 1e5))), (l(g, "noAutofit") || l(g, "spAutoFit")) && (a = 1, i = 1);
|
|
626
626
|
}
|
|
627
|
-
const c = (
|
|
628
|
-
let
|
|
629
|
-
for (const
|
|
630
|
-
const u = l(
|
|
631
|
-
d.lnSpcPct !== void 0 &&
|
|
632
|
-
const
|
|
627
|
+
const c = (g, u) => r[g] !== void 0 ? L(Number(r[g]) || 0) : L(u), x = r.anchor === "ctr" ? "ctr" : r.anchor === "b" ? "b" : "t", b = l(t, "lstStyle"), f = [];
|
|
628
|
+
let m;
|
|
629
|
+
for (const g of o) {
|
|
630
|
+
const u = l(g, "pPr"), h = Math.max(0, Math.min(8, C(u, "lvl"))), y = n.fontRef ? { color: n.fontRef.color ?? void 0, font: n.fontRef.font } : {}, d = Dt(...n.levels.map((P) => jt(P, h, e)), y, jt(b, h, e), u ? qt(u, e) : {});
|
|
631
|
+
d.lnSpcPct !== void 0 && m === void 0 && (m = d.lnSpcPct);
|
|
632
|
+
const p = { runs: [], align: d.algn === "ctr" ? "ctr" : d.algn === "r" ? "r" : (d.algn === "just", "l"), level: h };
|
|
633
633
|
if (d.bullet === "char" || d.bullet === "num") {
|
|
634
|
-
if (
|
|
635
|
-
const P =
|
|
636
|
-
P !== "•" && (
|
|
634
|
+
if (p.bullet = d.bullet, p.marL = d.marL ?? 0, p.indent = d.indent ?? 0, d.bullet === "char") {
|
|
635
|
+
const P = Fe(d.buChar, d.buFont ?? void 0);
|
|
636
|
+
P !== "•" && (p.bulletChar = P);
|
|
637
637
|
} else
|
|
638
|
-
d.numType && d.numType !== "arabicPeriod" && (
|
|
639
|
-
d.buClr && (
|
|
638
|
+
d.numType && d.numType !== "arabicPeriod" && (p.numType = d.numType), d.startAt && d.startAt !== 1 && (p.startAt = d.startAt);
|
|
639
|
+
d.buClr && (p.bulletColor = d.buClr), d.buSz && Math.abs(d.buSz - 1) > 1e-3 && (p.bulletScale = d.buSz);
|
|
640
640
|
}
|
|
641
641
|
const k = (P) => {
|
|
642
|
-
const T =
|
|
642
|
+
const T = Dt(d, Zt(P, e)), A = (T.sz ?? 18 * vt / H) * a, E = T.color === null ? void 0 : T.color ?? Kt("tx1", e);
|
|
643
643
|
return {
|
|
644
644
|
text: "",
|
|
645
|
-
size:
|
|
645
|
+
size: A,
|
|
646
646
|
bold: T.b || void 0,
|
|
647
647
|
italic: T.i || void 0,
|
|
648
648
|
underline: T.u || void 0,
|
|
649
649
|
strike: T.strike || void 0,
|
|
650
|
-
color:
|
|
651
|
-
font:
|
|
650
|
+
color: E ?? void 0,
|
|
651
|
+
font: je(T.font ?? "+mn-lt", e.ctx.theme)
|
|
652
652
|
};
|
|
653
653
|
};
|
|
654
|
-
for (const P of
|
|
654
|
+
for (const P of I(g))
|
|
655
655
|
if (P.localName === "r" || P.localName === "fld") {
|
|
656
|
-
const T =
|
|
656
|
+
const T = R(P, "t")?.textContent ?? "";
|
|
657
657
|
if (!T) continue;
|
|
658
|
-
T.split(/[\v\n]/).forEach((
|
|
659
|
-
|
|
658
|
+
T.split(/[\v\n]/).forEach((A, E) => {
|
|
659
|
+
E > 0 && p.runs.push({ ...k(l(P, "rPr")), br: !0 }), A && p.runs.push({ ...k(l(P, "rPr")), text: A });
|
|
660
660
|
});
|
|
661
|
-
} else P.localName === "br" &&
|
|
662
|
-
|
|
663
|
-
const M = (
|
|
664
|
-
v > 0.05 && (
|
|
661
|
+
} else P.localName === "br" && p.runs.push({ ...k(l(P, "rPr")), br: !0 });
|
|
662
|
+
p.endSize = k(l(g, "endParaRPr")).size;
|
|
663
|
+
const M = (p.runs.length ? Math.max(...p.runs.map((P) => P.size ?? 0)) : p.endSize ?? 0) * 1.2 * (d.lnSpcPct ?? 1), S = (P) => P ? ("px" in P ? P.px : P.lines * M) * i : 0, v = S(d.spcBef), N = S(d.spcAft);
|
|
664
|
+
v > 0.05 && (p.spaceBefore = Math.round(v * 100) / 100), N > 0.05 && (p.spaceAfter = Math.round(N * 100) / 100), f.push(p);
|
|
665
665
|
}
|
|
666
666
|
return {
|
|
667
667
|
paragraphs: f,
|
|
668
|
-
anchor:
|
|
668
|
+
anchor: x,
|
|
669
669
|
insets: { l: c("lIns", 91440), t: c("tIns", 45720), r: c("rIns", 91440), b: c("bIns", 45720) },
|
|
670
670
|
wrap: r.wrap !== "none",
|
|
671
|
-
lineSpacing:
|
|
671
|
+
lineSpacing: m
|
|
672
672
|
};
|
|
673
673
|
}
|
|
674
674
|
const Kt = (t, n) => {
|
|
675
675
|
const e = n.ctx.clrMap[t] ?? St[t] ?? t, o = n.ctx.theme.colors[e];
|
|
676
676
|
return o ? { hex: o } : null;
|
|
677
|
-
},
|
|
677
|
+
}, q = (t) => {
|
|
678
678
|
const n = l(t, "ph");
|
|
679
679
|
return n ? { type: w(n, "type") || "obj", idx: C(n, "idx") } : null;
|
|
680
|
-
},
|
|
681
|
-
function
|
|
682
|
-
const e =
|
|
680
|
+
}, tt = (t) => l(I(t).find((n) => n.localName.startsWith("nv")) ?? null, "nvPr"), ot = /* @__PURE__ */ new Set(["title", "ctrTitle"]), $t = /* @__PURE__ */ new Set(["title", "ctrTitle", "dt", "ftr", "sldNum", "hdr"]), Bt = (t, n) => t === n || ot.has(t) && ot.has(n) || !$t.has(t) && !$t.has(n);
|
|
681
|
+
function ft(t, n) {
|
|
682
|
+
const e = De(t);
|
|
683
683
|
if (n.idx) {
|
|
684
684
|
const o = e.find((s) => s.ph.idx === n.idx && Bt(s.ph.type, n.type));
|
|
685
685
|
if (o) return o.el;
|
|
686
686
|
}
|
|
687
|
-
return (e.find((o) => o.ph.type === n.type && (o.ph.idx === n.idx || !n.idx ||
|
|
687
|
+
return (e.find((o) => o.ph.type === n.type && (o.ph.idx === n.idx || !n.idx || ot.has(n.type))) ?? e.find((o) => o.ph.type === n.type) ?? e.find((o) => Bt(o.ph.type, n.type)))?.el ?? null;
|
|
688
688
|
}
|
|
689
|
-
function
|
|
689
|
+
function De(t) {
|
|
690
690
|
const n = [];
|
|
691
|
-
for (const e of
|
|
692
|
-
const o =
|
|
691
|
+
for (const e of st(t)) {
|
|
692
|
+
const o = q(tt(e));
|
|
693
693
|
o && n.push({ el: e, ph: o });
|
|
694
694
|
}
|
|
695
695
|
return n;
|
|
696
696
|
}
|
|
697
|
-
const Qt = (t) =>
|
|
697
|
+
const Qt = (t) => ot.has(t) ? "title" : ["dt", "ftr", "sldNum", "hdr"].includes(t) ? t : "body", $e = (t) => {
|
|
698
698
|
const n = {};
|
|
699
|
-
for (const e of
|
|
699
|
+
for (const e of I(l(t, "avLst"), "gd")) {
|
|
700
700
|
const o = w(e, "name"), s = w(e, "fmla");
|
|
701
701
|
o && s && (n[o] = s);
|
|
702
702
|
}
|
|
703
703
|
return n;
|
|
704
704
|
};
|
|
705
|
-
function
|
|
706
|
-
const n = (r) =>
|
|
705
|
+
function Be(t) {
|
|
706
|
+
const n = (r) => I(r, "gd").slice(0, 1e4).map((a) => [w(a, "name") || "", w(a, "fmla") || "val 0"]), e = I(l(t, "cxnLst"), "cxn").map((r) => [w(r, "ang") || "0", w(l(r, "pos"), "x") || "0", w(l(r, "pos"), "y") || "0"]), o = l(t, "rect"), s = I(l(t, "pathLst"), "path").slice(0, 1e3).map((r) => {
|
|
707
707
|
const a = [];
|
|
708
|
-
for (const c of
|
|
709
|
-
const
|
|
708
|
+
for (const c of I(r)) {
|
|
709
|
+
const x = I(c, "pt").map((b) => [w(b, "x") || "0", w(b, "y") || "0"]).flat();
|
|
710
710
|
switch (c.localName) {
|
|
711
711
|
case "moveTo":
|
|
712
|
-
a.push(["M", ...
|
|
712
|
+
a.push(["M", ...x]);
|
|
713
713
|
break;
|
|
714
714
|
case "lnTo":
|
|
715
|
-
a.push(["L", ...
|
|
715
|
+
a.push(["L", ...x]);
|
|
716
716
|
break;
|
|
717
717
|
case "quadBezTo":
|
|
718
|
-
a.push(["Q", ...
|
|
718
|
+
a.push(["Q", ...x]);
|
|
719
719
|
break;
|
|
720
720
|
case "cubicBezTo":
|
|
721
|
-
a.push(["C", ...
|
|
721
|
+
a.push(["C", ...x]);
|
|
722
722
|
break;
|
|
723
723
|
case "arcTo":
|
|
724
724
|
a.push(["A", w(c, "wR") || "0", w(c, "hR") || "0", w(c, "stAng") || "0", w(c, "swAng") || "0"]);
|
|
@@ -732,18 +732,18 @@ function je(t) {
|
|
|
732
732
|
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
733
|
});
|
|
734
734
|
return {
|
|
735
|
-
av:
|
|
735
|
+
av: I(l(t, "avLst"), "gd").map((r) => [w(r, "name") || "", w(r, "fmla") || "val 0"]),
|
|
736
736
|
gd: n(l(t, "gdLst")),
|
|
737
737
|
cxn: e,
|
|
738
738
|
rect: o ? [w(o, "l") || "l", w(o, "t") || "t", w(o, "r") || "r", w(o, "b") || "b"] : null,
|
|
739
739
|
paths: s
|
|
740
740
|
};
|
|
741
741
|
}
|
|
742
|
-
function
|
|
742
|
+
function et(t, n) {
|
|
743
743
|
const e = l(t, "prstGeom");
|
|
744
744
|
if (e) {
|
|
745
745
|
const s = {};
|
|
746
|
-
for (const [r, a] of Object.entries(
|
|
746
|
+
for (const [r, a] of Object.entries($e(e))) {
|
|
747
747
|
const i = /^val\s+(-?\d+(\.\d+)?)/.exec(a);
|
|
748
748
|
i && (s[r] = Number(i[1]));
|
|
749
749
|
}
|
|
@@ -751,21 +751,21 @@ function tt(t, n) {
|
|
|
751
751
|
}
|
|
752
752
|
const o = l(t, "custGeom");
|
|
753
753
|
if (o) {
|
|
754
|
-
const s =
|
|
755
|
-
return { geom: { kind: "custom", paths:
|
|
754
|
+
const s = Be(o);
|
|
755
|
+
return { geom: { kind: "custom", paths: lt(s, n.w, n.h) }, textRect: s.rect ? Ut(s, n.w, n.h) : void 0 };
|
|
756
756
|
}
|
|
757
757
|
}
|
|
758
|
-
function
|
|
758
|
+
function nt(t, n, e, o, s, r) {
|
|
759
759
|
const a = [];
|
|
760
|
-
if (s >
|
|
760
|
+
if (s > Me)
|
|
761
761
|
return e.warnings.push("Groups nested too deeply; the innermost were skipped."), a;
|
|
762
|
-
for (const i of
|
|
763
|
-
if (++e.count >
|
|
762
|
+
for (const i of st(t)) {
|
|
763
|
+
if (++e.count > ve) {
|
|
764
764
|
e.warnings.push("Too many shapes on one slide; the rest were skipped.");
|
|
765
765
|
break;
|
|
766
766
|
}
|
|
767
767
|
try {
|
|
768
|
-
const c =
|
|
768
|
+
const c = He(i, n, e, o, s, r);
|
|
769
769
|
c && a.push(...Array.isArray(c) ? c : [c]);
|
|
770
770
|
} catch {
|
|
771
771
|
e.warnings.push(`A ${i.localName} couldn't be read and was skipped.`);
|
|
@@ -773,106 +773,130 @@ function et(t, n, e, o, s, r) {
|
|
|
773
773
|
}
|
|
774
774
|
return a;
|
|
775
775
|
}
|
|
776
|
-
|
|
777
|
-
|
|
776
|
+
const ze = {
|
|
777
|
+
nextslide: "next",
|
|
778
|
+
previousslide: "previous",
|
|
779
|
+
firstslide: "first",
|
|
780
|
+
lastslide: "last",
|
|
781
|
+
endshow: "end"
|
|
782
|
+
};
|
|
783
|
+
function Xe(t, n, e) {
|
|
784
|
+
const o = l(t, "hlinkClick");
|
|
785
|
+
if (!o) return;
|
|
786
|
+
const s = w(o, "action") || "", r = e.rels(n).get(w(o, "r:id") || "");
|
|
787
|
+
if (s.startsWith("ppaction://hlinkshowjump")) {
|
|
788
|
+
const a = ze[(/jump=([a-z]+)/i.exec(s)?.[1] ?? "").toLowerCase()];
|
|
789
|
+
return a ? { kind: "action", action: a } : void 0;
|
|
790
|
+
}
|
|
791
|
+
if (s.startsWith("ppaction://hlinksldjump")) return r && !r.external ? { kind: "slide", key: r.target } : void 0;
|
|
792
|
+
if (!s)
|
|
793
|
+
return r?.external && /^(https?:|mailto:|tel:)/i.test(r.target) ? { kind: "url", url: r.target } : void 0;
|
|
794
|
+
}
|
|
795
|
+
function He(t, n, e, o, s, r) {
|
|
796
|
+
const a = I(t).find((x) => x.localName.startsWith("nv")), i = Ye(t, n, e, o, s, r), c = i ? Xe(l(a ?? null, "cNvPr"), n.part, e.pkg) : void 0;
|
|
797
|
+
if (c) for (const x of Array.isArray(i) ? i : [i]) x.link = c;
|
|
798
|
+
return i;
|
|
799
|
+
}
|
|
800
|
+
function Ye(t, n, e, o, s, r) {
|
|
801
|
+
const a = { pkg: e.pkg, part: n.part, ctx: e.ctx }, i = I(t).find((f) => f.localName.startsWith("nv")), c = l(i ?? null, "cNvPr"), x = C(c, "id"), b = w(c, "name") || t.localName;
|
|
778
802
|
if (w(c, "hidden") === "1") return null;
|
|
779
803
|
switch (t.localName) {
|
|
780
804
|
case "sp":
|
|
781
|
-
return
|
|
805
|
+
return Ue(t, n, e, o, x, b, r);
|
|
782
806
|
case "cxnSp": {
|
|
783
|
-
const f = l(t, "spPr"),
|
|
784
|
-
if (!
|
|
785
|
-
const
|
|
786
|
-
if (!
|
|
787
|
-
const
|
|
788
|
-
return { kind: "connector", id:
|
|
807
|
+
const f = l(t, "spPr"), m = Y(l(f, "xfrm"));
|
|
808
|
+
if (!m) return null;
|
|
809
|
+
const g = o(m), u = l(t, "style"), h = U(l(f, "ln"), a) ?? Pt(u, a) ?? { width: 1, color: { hex: "#000000" } };
|
|
810
|
+
if (!h) return null;
|
|
811
|
+
const y = et(f, g) ?? { geom: { kind: "preset", prst: "line" } }, d = (k) => k ? { id: C(k, "id"), idx: C(k, "idx") } : void 0, p = l(i ?? null, "cNvCxnSpPr");
|
|
812
|
+
return { kind: "connector", id: x, name: b, ...g, geom: y.geom, line: h, start: d(l(p, "stCxn")), end: d(l(p, "endCxn")) };
|
|
789
813
|
}
|
|
790
814
|
case "pic": {
|
|
791
815
|
const f = l(t, "spPr");
|
|
792
|
-
let
|
|
793
|
-
const
|
|
794
|
-
if (!
|
|
795
|
-
const u = l(t, "blipFill"),
|
|
796
|
-
if (!
|
|
797
|
-
return e.warnings.push(`Picture "${
|
|
798
|
-
const
|
|
799
|
-
return { kind: "picture", id:
|
|
816
|
+
let m = Y(l(f, "xfrm"));
|
|
817
|
+
const g = q(l(i ?? null, "nvPr"));
|
|
818
|
+
if (!m && g && (m = We(g, e)), !m) return null;
|
|
819
|
+
const u = l(t, "blipFill"), h = u ? Vt(u, a) : null;
|
|
820
|
+
if (!h)
|
|
821
|
+
return e.warnings.push(`Picture "${b}" has no image the importer can read.`), null;
|
|
822
|
+
const y = l(u, "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, p = w(R(u, "blip", "alphaModFix"), "amt"), k = o(m), M = et(f, k)?.geom, S = M && !(M.kind === "preset" && M.prst === "rect") ? M : void 0;
|
|
823
|
+
return { kind: "picture", id: x, name: b, ...k, media: h, crop: d, alpha: p !== null ? Number(p) / 1e5 : void 0, descr: w(c, "descr") || void 0, geom: S, ...R(u, "blip", "grayscl") ? { grayscale: !0 } : {} };
|
|
800
824
|
}
|
|
801
825
|
case "grpSp": {
|
|
802
|
-
const f = l(t, "grpSpPr"),
|
|
826
|
+
const f = l(t, "grpSpPr"), m = l(f, "xfrm"), g = Ae(m, o), u = nt(t, n, e, g, s + 1, r);
|
|
803
827
|
if (!u.length) return null;
|
|
804
|
-
const
|
|
805
|
-
return { kind: "group", id:
|
|
828
|
+
const h = ut(u);
|
|
829
|
+
return { kind: "group", id: x, name: b, ...h, children: u };
|
|
806
830
|
}
|
|
807
831
|
case "graphicFrame":
|
|
808
|
-
return
|
|
832
|
+
return qe(t, n, e, o, x, b, s);
|
|
809
833
|
default:
|
|
810
834
|
return null;
|
|
811
835
|
}
|
|
812
836
|
}
|
|
813
|
-
function
|
|
837
|
+
function ut(t) {
|
|
814
838
|
let n = 1 / 0, e = 1 / 0, o = -1 / 0, s = -1 / 0;
|
|
815
839
|
for (const r of t)
|
|
816
840
|
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);
|
|
817
841
|
return { x: n, y: e, w: Math.max(0, o - n), h: Math.max(0, s - e) };
|
|
818
842
|
}
|
|
819
|
-
function
|
|
820
|
-
const e =
|
|
843
|
+
function We(t, n) {
|
|
844
|
+
const e = ft(n.layout?.tree ?? null, t), o = Y(R(e, "spPr", "xfrm"));
|
|
821
845
|
if (o) return o;
|
|
822
|
-
const s =
|
|
823
|
-
return Y(
|
|
846
|
+
const s = ft(n.master?.tree ?? null, { type: Qt(t.type), idx: 0 });
|
|
847
|
+
return Y(R(s, "spPr", "xfrm"));
|
|
824
848
|
}
|
|
825
|
-
function
|
|
849
|
+
function _e(...t) {
|
|
826
850
|
for (const n of t) {
|
|
827
851
|
const e = n();
|
|
828
852
|
if (e !== void 0) return e;
|
|
829
853
|
}
|
|
830
854
|
}
|
|
831
|
-
function
|
|
832
|
-
const i = { pkg: e.pkg, part: n.part, ctx: e.ctx }, c =
|
|
833
|
-
if (
|
|
834
|
-
const
|
|
835
|
-
let d = Y(l(
|
|
855
|
+
function Ue(t, n, e, o, s, r, a) {
|
|
856
|
+
const i = { pkg: e.pkg, part: n.part, ctx: e.ctx }, c = tt(t), x = q(c);
|
|
857
|
+
if (x && !a) return null;
|
|
858
|
+
const b = l(t, "spPr"), f = l(t, "style"), m = w(R(t, "nvSpPr", "cNvSpPr"), "txBox") === "1", g = x && e.layout ? ft(e.layout.tree, x) : null, u = x && e.master ? ft(e.master.tree, { type: Qt(g ? q(tt(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 = u && e.master ? { pkg: e.pkg, part: e.master.part, ctx: e.ctx } : null;
|
|
859
|
+
let d = Y(l(b, "xfrm")) ?? Y(R(g, "spPr", "xfrm")) ?? Y(R(u, "spPr", "xfrm"));
|
|
836
860
|
if (!d) return null;
|
|
837
861
|
d = o(d);
|
|
838
|
-
const
|
|
839
|
-
() => U(l(
|
|
862
|
+
const p = et(b, d) ?? (g ? et(l(g, "spPr"), d) : void 0) ?? (u ? et(l(u, "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) ?? V(b, i) ?? ct(f, i) ?? (h ? V(l(g, "spPr"), h) : void 0) ?? (y ? V(l(u, "spPr"), y) : void 0) ?? (h ? ct(l(g, "style"), h) : void 0) ?? { kind: "none" }, S = _e(
|
|
863
|
+
() => U(l(b, "ln"), i),
|
|
840
864
|
() => Pt(f, i),
|
|
841
|
-
() =>
|
|
842
|
-
() =>
|
|
865
|
+
() => h ? U(R(g, "spPr", "ln"), h) : void 0,
|
|
866
|
+
() => y ? U(R(u, "spPr", "ln"), y) : void 0
|
|
843
867
|
) ?? null, v = [];
|
|
844
|
-
if (
|
|
845
|
-
const
|
|
846
|
-
v.push(
|
|
868
|
+
if (x) {
|
|
869
|
+
const j = g ? q(tt(g))?.type ?? x.type : x.type;
|
|
870
|
+
v.push(ot.has(j) ? e.masterTx.title : ["body", "obj", "subTitle", "tbl", "chart", "dgm", "media", "pic", "clipArt"].includes(j) ? e.masterTx.body : e.masterTx.other), v.push(R(u, "txBody", "lstStyle"), R(g, "txBody", "lstStyle"));
|
|
847
871
|
} else
|
|
848
872
|
v.push(e.defaultText);
|
|
849
|
-
const
|
|
873
|
+
const N = l(f, "fontRef"), P = {
|
|
850
874
|
levels: v,
|
|
851
|
-
bodyPr: [
|
|
852
|
-
fontRef:
|
|
875
|
+
bodyPr: [R(u, "txBody", "bodyPr"), R(g, "txBody", "bodyPr")],
|
|
876
|
+
fontRef: N ? { font: w(N, "idx") === "major" ? "+mj-lt" : "+mn-lt", color: $(N, i.ctx) } : void 0
|
|
853
877
|
}, T = Tt(l(t, "txBody"), P, i);
|
|
854
878
|
if (!(M.kind !== "none" || !!S || !!T)) return null;
|
|
855
|
-
let
|
|
856
|
-
const
|
|
857
|
-
if (z &&
|
|
858
|
-
const
|
|
859
|
-
(Math.abs(X.l) > 0.5 || Math.abs(X.t) > 0.5 || Math.abs(X.r - d.w) > 0.5 || Math.abs(X.b - d.h) > 0.5) && (
|
|
879
|
+
let E = p.textRect;
|
|
880
|
+
const O = Y(l(b, "xfrm")), z = T ? Y(l(t, "txXfrm")) : null;
|
|
881
|
+
if (z && O && O.w > 0 && O.h > 0) {
|
|
882
|
+
const j = d.w / O.w, W = d.h / O.h, X = { l: (z.x - O.x) * j, t: (z.y - O.y) * W, r: (z.x + z.w - O.x) * j, b: (z.y + z.h - O.y) * W };
|
|
883
|
+
(Math.abs(X.l) > 0.5 || Math.abs(X.t) > 0.5 || Math.abs(X.r - d.w) > 0.5 || Math.abs(X.b - d.h) > 0.5) && (E = X);
|
|
860
884
|
}
|
|
861
|
-
return { kind: "shape", id: s, name: r, ...d, geom:
|
|
885
|
+
return { kind: "shape", id: s, name: r, ...d, geom: p.geom, fill: M, line: S, text: T, textBox: m || void 0, textRect: E };
|
|
862
886
|
}
|
|
863
887
|
const zt = "{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}";
|
|
864
|
-
function
|
|
888
|
+
function Ge(t, n) {
|
|
865
889
|
const e = {};
|
|
866
890
|
if (!t) return e;
|
|
867
|
-
const o = l(t, "tcStyle"), s = l(t, "tcTxStyle"), r = l(o, "fill"), a = r ? V(r, n) :
|
|
891
|
+
const o = l(t, "tcStyle"), s = l(t, "tcTxStyle"), r = l(o, "fill"), a = r ? V(r, n) : ct(o, n);
|
|
868
892
|
a && (e.fill = a);
|
|
869
893
|
const i = $(s, n.ctx) ?? $(l(s, "fontRef"), n.ctx);
|
|
870
894
|
i && (e.text = i), w(s, "b") === "on" && (e.bold = !0);
|
|
871
895
|
const c = l(o, "tcBdr");
|
|
872
|
-
for (const
|
|
873
|
-
const
|
|
874
|
-
if (!
|
|
875
|
-
const f = U(l(
|
|
896
|
+
for (const x of ["insideH", "bottom", "top", "left"]) {
|
|
897
|
+
const b = l(c, x);
|
|
898
|
+
if (!b) continue;
|
|
899
|
+
const f = U(l(b, "ln"), n) ?? Pt(b, n);
|
|
876
900
|
if (f !== void 0) {
|
|
877
901
|
e.border = f;
|
|
878
902
|
break;
|
|
@@ -880,10 +904,10 @@ function He(t, n) {
|
|
|
880
904
|
}
|
|
881
905
|
return e;
|
|
882
906
|
}
|
|
883
|
-
function
|
|
884
|
-
const o = ((l(t, "tableStyleId")?.textContent || "").trim() || w(e, "def") || zt).toUpperCase(), s = (f) => B(t, f) ?? !1, r = { firstRow: s("firstRow"), lastRow: s("lastRow"), firstCol: s("firstCol"), lastCol: s("lastCol"), bandRow: s("bandRow"), bandCol: s("bandCol") }, a =
|
|
907
|
+
function Ve(t, n, e) {
|
|
908
|
+
const o = ((l(t, "tableStyleId")?.textContent || "").trim() || w(e, "def") || zt).toUpperCase(), s = (f) => B(t, f) ?? !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((f) => (w(f, "styleId") || "").toUpperCase() === o);
|
|
885
909
|
if (a) {
|
|
886
|
-
const f = (
|
|
910
|
+
const f = (y) => Ge(l(a, y), n), m = l(a, "tblBg"), g = m ? l(m, "fill") ? V(l(m, "fill"), n) : ct(m, n) : void 0, u = {
|
|
887
911
|
whole: f("wholeTbl"),
|
|
888
912
|
b1H: f("band1H"),
|
|
889
913
|
b2H: f("band2H"),
|
|
@@ -893,69 +917,69 @@ function Ye(t, n, e) {
|
|
|
893
917
|
lastRow: f("lastRow"),
|
|
894
918
|
firstCol: f("firstCol"),
|
|
895
919
|
lastCol: f("lastCol")
|
|
896
|
-
},
|
|
897
|
-
const M = [u.whole], S =
|
|
898
|
-
r.bandCol && v >= 0 && M.push(v % 2 === 0 ? u.b1V : u.b2V), r.bandRow && S >= 0 && M.push(S % 2 === 0 ? u.b1H : u.b2H), r.firstCol && d === 0 && M.push(u.firstCol), r.lastCol && d === k - 1 && M.push(u.lastCol), r.firstRow &&
|
|
899
|
-
const
|
|
920
|
+
}, h = (y, d, p, k) => {
|
|
921
|
+
const M = [u.whole], S = y - (r.firstRow ? 1 : 0), v = d - (r.firstCol ? 1 : 0);
|
|
922
|
+
r.bandCol && v >= 0 && M.push(v % 2 === 0 ? u.b1V : u.b2V), r.bandRow && S >= 0 && M.push(S % 2 === 0 ? u.b1H : u.b2H), r.firstCol && d === 0 && M.push(u.firstCol), r.lastCol && d === k - 1 && M.push(u.lastCol), r.firstRow && y === 0 && M.push(u.firstRow), r.lastRow && y === p - 1 && M.push(u.lastRow);
|
|
923
|
+
const N = {};
|
|
900
924
|
for (const P of M)
|
|
901
|
-
P.fill && (
|
|
902
|
-
return
|
|
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;
|
|
903
927
|
};
|
|
904
|
-
return
|
|
928
|
+
return g && g.kind !== "none" && (h.background = g), h;
|
|
905
929
|
}
|
|
906
930
|
if (o !== zt) return null;
|
|
907
931
|
const i = n.ctx.theme.colors.accent1 ?? "#4472c4", c = (f) => {
|
|
908
|
-
const [
|
|
909
|
-
return { hex:
|
|
910
|
-
},
|
|
932
|
+
const [m, g, u] = Gt(i);
|
|
933
|
+
return { hex: it(_(J(m) * f + (1 - f)), _(J(g) * f + (1 - f)), _(J(u) * f + (1 - f))) };
|
|
934
|
+
}, x = { hex: n.ctx.theme.colors.lt1 ?? "#ffffff" }, b = Kt("tx1", n) ?? void 0;
|
|
911
935
|
return (f) => {
|
|
912
|
-
const
|
|
936
|
+
const m = r.firstRow && f === 0, g = r.bandRow && !m && (f - (r.firstRow ? 1 : 0)) % 2 === 0;
|
|
913
937
|
return {
|
|
914
|
-
fill: { kind: "solid", color:
|
|
915
|
-
text:
|
|
916
|
-
bold:
|
|
917
|
-
border: { width: 1.33, color:
|
|
938
|
+
fill: { kind: "solid", color: m ? { hex: i } : c(g ? 0.4 : 0.2) },
|
|
939
|
+
text: m ? x : b,
|
|
940
|
+
bold: m || void 0,
|
|
941
|
+
border: { width: 1.33, color: x }
|
|
918
942
|
};
|
|
919
943
|
};
|
|
920
944
|
}
|
|
921
|
-
function
|
|
945
|
+
function qe(t, n, e, o, s, r, a = 0) {
|
|
922
946
|
const i = { pkg: e.pkg, part: n.part, ctx: e.ctx }, c = Y(l(t, "xfrm"));
|
|
923
947
|
if (!c) return null;
|
|
924
|
-
const
|
|
925
|
-
if (
|
|
926
|
-
const
|
|
927
|
-
let
|
|
928
|
-
const
|
|
929
|
-
if (
|
|
948
|
+
const x = R(t, "graphic", "graphicData"), b = l(x, "tbl");
|
|
949
|
+
if (b) {
|
|
950
|
+
const g = I(l(b, "tblGrid"), "gridCol").map((k) => L(C(k, "w"))), u = Ve(l(b, "tblPr"), i, e.tableStyles), h = [];
|
|
951
|
+
let y = c.y, d = 1e6 + s * 1e3;
|
|
952
|
+
const p = I(b, "tr");
|
|
953
|
+
if (p.forEach((k, M) => {
|
|
930
954
|
const S = L(C(k, "h"));
|
|
931
|
-
let v = c.x,
|
|
932
|
-
for (const P of
|
|
933
|
-
const T = Math.max(1, C(P, "gridSpan", 1)),
|
|
934
|
-
if (
|
|
935
|
-
v +=
|
|
955
|
+
let v = c.x, N = 0;
|
|
956
|
+
for (const P of I(k, "tc")) {
|
|
957
|
+
const T = Math.max(1, C(P, "gridSpan", 1)), A = g.slice(N, N + T).reduce((G, F) => G + F, 0);
|
|
958
|
+
if (N += T, B(P, "hMerge") || B(P, "vMerge")) {
|
|
959
|
+
v += A;
|
|
936
960
|
continue;
|
|
937
961
|
}
|
|
938
|
-
const
|
|
939
|
-
X &&
|
|
962
|
+
const E = Math.max(1, C(P, "rowSpan", 1)), O = l(P, "tcPr"), z = E > 1 ? S * E : S, j = u ? u(M, N - T, p.length, g.length) : null, W = j?.text ? { color: j.text } : void 0, X = Tt(l(P, "txBody"), { levels: [e.defaultText], bodyPr: [], fontRef: W }, i);
|
|
963
|
+
X && j?.bold && X.paragraphs.forEach((G) => G.runs.forEach((F) => {
|
|
940
964
|
F.bold === void 0 && (F.bold = !0);
|
|
941
|
-
})), X && (X.insets = { l: L(C(
|
|
942
|
-
const dt = U(l(
|
|
943
|
-
|
|
965
|
+
})), X && (X.insets = { l: L(C(O, "marL", 91440)), r: L(C(O, "marR", 91440)), t: L(C(O, "marT", 45720)), b: L(C(O, "marB", 45720)) }, X.anchor = w(O, "anchor") === "ctr" ? "ctr" : w(O, "anchor") === "b" ? "b" : "t");
|
|
966
|
+
const dt = U(l(O, "lnB"), i) ?? U(l(O, "lnT"), i) ?? (j ? j.border ?? null : { width: 1, color: { hex: "#bfbfbf" } }), rt = j?.fill;
|
|
967
|
+
h.push({
|
|
944
968
|
kind: "shape",
|
|
945
969
|
id: d++,
|
|
946
970
|
name: `${r} cell`,
|
|
947
|
-
...o({ x: v, y
|
|
971
|
+
...o({ x: v, y, w: A, h: z, rot: 0, flipH: !1, flipV: !1 }),
|
|
948
972
|
geom: { kind: "preset", prst: "rect" },
|
|
949
|
-
fill: V(
|
|
973
|
+
fill: V(O, i) ?? rt ?? { kind: "none" },
|
|
950
974
|
line: dt,
|
|
951
975
|
text: X
|
|
952
|
-
}), v +=
|
|
976
|
+
}), v += A;
|
|
953
977
|
}
|
|
954
|
-
|
|
955
|
-
}), !
|
|
978
|
+
y += S;
|
|
979
|
+
}), !h.length) return null;
|
|
956
980
|
if (u?.background) {
|
|
957
|
-
const k =
|
|
958
|
-
|
|
981
|
+
const k = ut(h);
|
|
982
|
+
h.unshift({
|
|
959
983
|
kind: "shape",
|
|
960
984
|
id: d++,
|
|
961
985
|
name: `${r} background`,
|
|
@@ -971,17 +995,17 @@ function We(t, n, e, o, s, r, a = 0) {
|
|
|
971
995
|
line: null
|
|
972
996
|
});
|
|
973
997
|
}
|
|
974
|
-
return { kind: "group", id: s, name: r, ...
|
|
998
|
+
return { kind: "group", id: s, name: r, ...ut(h), children: h };
|
|
975
999
|
}
|
|
976
|
-
const f = w(
|
|
1000
|
+
const f = w(x, "uri") || "";
|
|
977
1001
|
if (/diagram/.test(f)) {
|
|
978
|
-
const
|
|
979
|
-
if (
|
|
980
|
-
const u =
|
|
1002
|
+
const g = Ze(x, n, e, o, c, s, r, a);
|
|
1003
|
+
if (g) return g;
|
|
1004
|
+
const u = Ke(x, n, e, o, c, s, r, i);
|
|
981
1005
|
if (u) return u;
|
|
982
1006
|
}
|
|
983
|
-
const
|
|
984
|
-
return e.warnings.push(`${
|
|
1007
|
+
const m = /chart/.test(f) ? "Chart" : /diagram/.test(f) ? "SmartArt diagram" : "Embedded object";
|
|
1008
|
+
return e.warnings.push(`${m} "${r}" was imported as a placeholder frame.`), {
|
|
985
1009
|
kind: "shape",
|
|
986
1010
|
id: s,
|
|
987
1011
|
name: r,
|
|
@@ -989,64 +1013,64 @@ function We(t, n, e, o, s, r, a = 0) {
|
|
|
989
1013
|
geom: { kind: "preset", prst: "rect" },
|
|
990
1014
|
fill: { kind: "solid", color: { hex: "#f1f3f5" } },
|
|
991
1015
|
line: { width: 1, color: { hex: "#adb5bd" }, dash: "dash" },
|
|
992
|
-
text: { paragraphs: [{ runs: [{ text: `${
|
|
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 }
|
|
993
1017
|
};
|
|
994
1018
|
}
|
|
995
|
-
function
|
|
996
|
-
const c = e.pkg.rels(n.part),
|
|
1019
|
+
function Ze(t, n, e, o, s, r, a, i) {
|
|
1020
|
+
const c = e.pkg.rels(n.part), x = w(l(t, "relIds"), "r:dm"), b = x ? c.get(x) : void 0;
|
|
997
1021
|
let f;
|
|
998
|
-
if (
|
|
999
|
-
const d = Jt(e.pkg.xml(
|
|
1000
|
-
|
|
1022
|
+
if (b && !b.external) {
|
|
1023
|
+
const d = Jt(e.pkg.xml(b.target), "dataModelExt", 6), p = d ? c.get(w(d, "relId") || "") : void 0;
|
|
1024
|
+
p && !p.external && (f = p.target);
|
|
1001
1025
|
}
|
|
1002
1026
|
if (!f) {
|
|
1003
|
-
const d = [...c.values()].filter((
|
|
1027
|
+
const d = [...c.values()].filter((p) => p.type === "diagramDrawing" && !p.external);
|
|
1004
1028
|
d.length === 1 && (f = d[0].target);
|
|
1005
1029
|
}
|
|
1006
1030
|
if (!f) return null;
|
|
1007
|
-
const
|
|
1008
|
-
if (!
|
|
1009
|
-
const u =
|
|
1031
|
+
const m = l(e.pkg.xml(f), "spTree");
|
|
1032
|
+
if (!m) return null;
|
|
1033
|
+
const u = nt(m, { part: f, tree: m }, e, (d) => o({ ...d, x: d.x + s.x, y: d.y + s.y }), i + 1, !0);
|
|
1010
1034
|
if (!u.length) return null;
|
|
1011
|
-
let
|
|
1012
|
-
const
|
|
1013
|
-
|
|
1035
|
+
let h = 2e6 + r * 1e3;
|
|
1036
|
+
const y = (d) => d.forEach((p) => {
|
|
1037
|
+
p.id = h++, p.kind === "group" && y(p.children);
|
|
1014
1038
|
});
|
|
1015
|
-
return
|
|
1016
|
-
}
|
|
1017
|
-
function
|
|
1018
|
-
const c = w(l(t, "relIds"), "r:dm"),
|
|
1019
|
-
if (!
|
|
1020
|
-
const
|
|
1021
|
-
for (const d of
|
|
1022
|
-
const
|
|
1023
|
-
for (const d of
|
|
1039
|
+
return y(u), { kind: "group", id: r, name: a, ...ut(u), children: u };
|
|
1040
|
+
}
|
|
1041
|
+
function Ke(t, n, e, o, s, r, a, i) {
|
|
1042
|
+
const c = w(l(t, "relIds"), "r:dm"), x = c ? e.pkg.rels(n.part).get(c) : void 0;
|
|
1043
|
+
if (!x || x.external) return null;
|
|
1044
|
+
const b = e.pkg.xml(x.target), f = /* @__PURE__ */ new Map();
|
|
1045
|
+
for (const d of I(l(b, "ptLst"), "pt")) f.set(w(d, "modelId") || "", d);
|
|
1046
|
+
const m = /* @__PURE__ */ new Map();
|
|
1047
|
+
for (const d of I(l(b, "cxnLst"), "cxn")) {
|
|
1024
1048
|
if ((w(d, "type") || "parOf") !== "parOf") continue;
|
|
1025
|
-
const
|
|
1026
|
-
|
|
1049
|
+
const p = w(d, "srcId") || "", k = w(d, "destId") || "";
|
|
1050
|
+
m.has(p) || m.set(p, []), m.get(p).push({ id: k, ord: C(d, "srcOrd") });
|
|
1027
1051
|
}
|
|
1028
|
-
const
|
|
1029
|
-
if (!
|
|
1030
|
-
const u = [],
|
|
1031
|
-
if (!(
|
|
1032
|
-
|
|
1033
|
-
for (const k of (
|
|
1052
|
+
const g = [...f.values()].find((d) => w(d, "type") === "doc");
|
|
1053
|
+
if (!g) return null;
|
|
1054
|
+
const u = [], h = /* @__PURE__ */ new Set(), y = (d, p) => {
|
|
1055
|
+
if (!(h.has(d) || p > 16 || u.length > 500)) {
|
|
1056
|
+
h.add(d);
|
|
1057
|
+
for (const k of (m.get(d) ?? []).sort((M, S) => M.ord - S.ord)) {
|
|
1034
1058
|
const M = f.get(k.id), S = w(M, "type") || "node";
|
|
1035
1059
|
if (!M || S !== "node" && S !== "asst") continue;
|
|
1036
1060
|
const v = Tt(l(M, "t"), { levels: [e.defaultText], bodyPr: [] }, i);
|
|
1037
|
-
for (const
|
|
1038
|
-
|
|
1039
|
-
...
|
|
1061
|
+
for (const N of v?.paragraphs ?? [])
|
|
1062
|
+
N.runs.some((P) => !P.br && P.text.trim()) && u.push({
|
|
1063
|
+
...N,
|
|
1040
1064
|
align: "l",
|
|
1041
|
-
level:
|
|
1042
|
-
...
|
|
1043
|
-
runs:
|
|
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) }))
|
|
1044
1068
|
});
|
|
1045
|
-
|
|
1069
|
+
y(k.id, p + 1);
|
|
1046
1070
|
}
|
|
1047
1071
|
}
|
|
1048
1072
|
};
|
|
1049
|
-
return
|
|
1073
|
+
return y(w(g, "modelId") || "", 0), u.length ? (e.warnings.push(`SmartArt diagram "${a}" had no saved drawing; its text was imported as a list.`), {
|
|
1050
1074
|
kind: "shape",
|
|
1051
1075
|
id: r,
|
|
1052
1076
|
name: a,
|
|
@@ -1060,7 +1084,7 @@ function Ue(t, n, e, o, s, r, a, i) {
|
|
|
1060
1084
|
}
|
|
1061
1085
|
function Jt(t, n, e) {
|
|
1062
1086
|
if (!t || e < 0) return null;
|
|
1063
|
-
for (const o of
|
|
1087
|
+
for (const o of st(t)) {
|
|
1064
1088
|
if (o.localName === n) return o;
|
|
1065
1089
|
const s = Jt(o, n, e - 1);
|
|
1066
1090
|
if (s) return s;
|
|
@@ -1079,10 +1103,36 @@ function xt(t, n) {
|
|
|
1079
1103
|
return (i ? Ct(i, { ...n, ctx: { ...n.ctx, phClr: $(s, n.ctx) ?? void 0 } }) : void 0) ?? ($(s, n.ctx) ? { kind: "solid", color: $(s, n.ctx) } : void 0);
|
|
1080
1104
|
}
|
|
1081
1105
|
}
|
|
1082
|
-
function
|
|
1083
|
-
const
|
|
1106
|
+
function Qe(t, n) {
|
|
1107
|
+
const e = t.relOfType(n, "notesSlide"), o = e ? R(t.xml(e), "cSld", "spTree") : null;
|
|
1108
|
+
if (!o) return;
|
|
1109
|
+
const s = [], r = (i) => {
|
|
1110
|
+
for (const c of st(i)) {
|
|
1111
|
+
if (c.localName === "grpSp") {
|
|
1112
|
+
r(c);
|
|
1113
|
+
continue;
|
|
1114
|
+
}
|
|
1115
|
+
if (c.localName !== "sp") continue;
|
|
1116
|
+
const x = q(tt(c));
|
|
1117
|
+
if (!(!x || x.type !== "body" && x.type !== "obj"))
|
|
1118
|
+
for (const b of I(l(c, "txBody"), "p")) {
|
|
1119
|
+
let f = "";
|
|
1120
|
+
for (const m of I(b))
|
|
1121
|
+
m.localName === "r" || m.localName === "fld" ? f += l(m, "t")?.textContent ?? "" : m.localName === "br" && (f += `
|
|
1122
|
+
`);
|
|
1123
|
+
s.push(f);
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
};
|
|
1127
|
+
r(o);
|
|
1128
|
+
const a = s.join(`
|
|
1129
|
+
`).replace(/\s+$/, "");
|
|
1130
|
+
return a.trim() ? a : void 0;
|
|
1131
|
+
}
|
|
1132
|
+
function Je(t) {
|
|
1133
|
+
const n = st(t).find((a) => a.localName === "transition");
|
|
1084
1134
|
if (!n) return;
|
|
1085
|
-
const e =
|
|
1135
|
+
const e = I(n).find((a) => a.localName !== "sndAc" && a.localName !== "extLst");
|
|
1086
1136
|
if (!e) return;
|
|
1087
1137
|
const o = w(n, "spd"), s = w(n, "p14:dur") !== null ? C(n, "p14:dur") : o === "fast" ? 500 : o === "slow" ? 1e3 : 750, r = w(e, "dir");
|
|
1088
1138
|
switch (e.localName) {
|
|
@@ -1099,72 +1149,72 @@ function Ge(t) {
|
|
|
1099
1149
|
return { kind: "fade", durationMs: s };
|
|
1100
1150
|
}
|
|
1101
1151
|
}
|
|
1102
|
-
function
|
|
1152
|
+
function tn(t, n = {}) {
|
|
1103
1153
|
const e = [], o = (T) => {
|
|
1104
1154
|
e.length < 200 && !e.includes(T) && e.push(T);
|
|
1105
1155
|
}, s = n.parseXml ?? ((T) => new DOMParser().parseFromString(T, "application/xml"));
|
|
1106
1156
|
let r, a = 0, i = 0;
|
|
1107
1157
|
try {
|
|
1108
1158
|
r = ae(t, {
|
|
1109
|
-
filter: (T) => (a++, i += T.originalSize, a <=
|
|
1159
|
+
filter: (T) => (a++, i += T.originalSize, a <= At && T.originalSize <= ke && i <= Et)
|
|
1110
1160
|
});
|
|
1111
1161
|
} catch {
|
|
1112
1162
|
throw new Error("This file is not a PowerPoint presentation (it is not a valid .pptx package).");
|
|
1113
1163
|
}
|
|
1114
|
-
(a >
|
|
1115
|
-
const c = new
|
|
1116
|
-
if (!
|
|
1117
|
-
const f = l(
|
|
1118
|
-
for (const T of
|
|
1119
|
-
const
|
|
1120
|
-
|
|
1164
|
+
(a > At || i > Et) && o("The file is very large; some parts were skipped.");
|
|
1165
|
+
const c = new Pe(r, s, o), x = c.relOfType("", "officeDocument") ?? "ppt/presentation.xml", b = c.xml(x);
|
|
1166
|
+
if (!b || b.localName !== "presentation") throw new Error("This file is not a PowerPoint presentation (no presentation part).");
|
|
1167
|
+
const f = l(b, "sldSz"), m = f ? Math.max(1, L(C(f, "cx", 9144e3))) : 960, g = f ? Math.max(1, L(C(f, "cy", 5143500))) : 540, u = l(b, "defaultTextStyle"), h = c.rels(x), y = c.relOfType(x, "tableStyles"), d = y ? c.xml(y) : null, p = [], k = /* @__PURE__ */ new Set();
|
|
1168
|
+
for (const T of I(l(b, "sldIdLst"), "sldId")) {
|
|
1169
|
+
const A = h.get(w(T, "r:id") || "");
|
|
1170
|
+
A && !k.has(A.target) && p.length < we && (k.add(A.target), p.push(A.target));
|
|
1121
1171
|
}
|
|
1122
1172
|
const M = /* @__PURE__ */ new Map(), S = (T) => {
|
|
1123
|
-
const
|
|
1124
|
-
return
|
|
1173
|
+
const A = c.relOfType(T, "theme");
|
|
1174
|
+
return A ? (M.has(A) || M.set(A, pt(c.xml(A))), M.get(A)) : pt(null);
|
|
1125
1175
|
}, v = (T) => {
|
|
1126
1176
|
if (!T) return null;
|
|
1127
|
-
const
|
|
1128
|
-
for (let
|
|
1129
|
-
return
|
|
1130
|
-
},
|
|
1131
|
-
|
|
1132
|
-
const
|
|
1133
|
-
if (!
|
|
1134
|
-
o(`Slide ${
|
|
1177
|
+
const A = {};
|
|
1178
|
+
for (let E = 0; E < T.attributes.length; E++) A[T.attributes[E].localName ?? T.attributes[E].name] = T.attributes[E].value;
|
|
1179
|
+
return A;
|
|
1180
|
+
}, N = [];
|
|
1181
|
+
p.forEach((T, A) => {
|
|
1182
|
+
const E = c.xml(T);
|
|
1183
|
+
if (!E) {
|
|
1184
|
+
o(`Slide ${A + 1} couldn't be read and was skipped.`);
|
|
1135
1185
|
return;
|
|
1136
1186
|
}
|
|
1137
|
-
const
|
|
1187
|
+
const O = c.relOfType(T, "slideLayout"), z = O ? c.xml(O) : null, j = O ? c.relOfType(O, "slideMaster") : null, W = j ? c.xml(j) : null, X = j ? S(j) : pt(null), dt = v(R(E, "clrMapOvr", "overrideClrMapping")) ?? v(R(z, "clrMapOvr", "overrideClrMapping")) ?? v(l(W, "clrMap")) ?? St, rt = { theme: X, clrMap: dt }, G = l(W, "txStyles"), F = {
|
|
1138
1188
|
pkg: c,
|
|
1139
|
-
ctx:
|
|
1140
|
-
slide: { part: T, tree: E
|
|
1141
|
-
layout:
|
|
1142
|
-
master:
|
|
1189
|
+
ctx: rt,
|
|
1190
|
+
slide: { part: T, tree: R(E, "cSld", "spTree") },
|
|
1191
|
+
layout: O ? { part: O, tree: R(z, "cSld", "spTree") } : null,
|
|
1192
|
+
master: j ? { part: j, tree: R(W, "cSld", "spTree") } : null,
|
|
1143
1193
|
masterTx: { title: l(G, "titleStyle"), body: l(G, "bodyStyle"), other: l(G, "otherStyle") },
|
|
1144
1194
|
defaultText: u,
|
|
1145
1195
|
warnings: e,
|
|
1146
1196
|
count: 0,
|
|
1147
1197
|
tableStyles: d
|
|
1148
|
-
}, ht = (re) => ({ pkg: c, part: re?.part ?? T, ctx:
|
|
1198
|
+
}, ht = (re) => ({ pkg: c, part: re?.part ?? T, ctx: rt }), It = xt(l(E, "cSld"), ht(F.slide)) ?? xt(l(z, "cSld"), ht(F.layout)) ?? xt(l(W, "cSld"), ht(F.master)) ?? { kind: "solid", color: { hex: "#ffffff" } };
|
|
1149
1199
|
F.background = It;
|
|
1150
|
-
const
|
|
1151
|
-
F.master && se &&
|
|
1152
|
-
}),
|
|
1153
|
-
const P =
|
|
1154
|
-
return { deck: { width:
|
|
1200
|
+
const at = [], se = B(E, "showMasterSp") !== !1 && B(z, "showMasterSp") !== !1;
|
|
1201
|
+
F.master && se && at.push(...nt(F.master.tree, F.master, F, gt, 0, !1)), F.layout && B(E, "showMasterSp") !== !1 && at.push(...nt(F.layout.tree, F.layout, F, gt, 0, !1)), at.push(...nt(F.slide.tree, F.slide, F, gt, 0, !0)), N.push({ items: at, background: It, transition: Je(E), name: w(l(E, "cSld"), "name") || void 0, notes: Qe(c, T), key: T });
|
|
1202
|
+
}), N.length || o("The presentation has no slides.");
|
|
1203
|
+
const P = R(c.xml("docProps/core.xml"), "title")?.textContent || void 0;
|
|
1204
|
+
return { deck: { width: m, height: g, slides: N, title: P }, warnings: e };
|
|
1155
1205
|
}
|
|
1156
|
-
const
|
|
1206
|
+
const en = 80, nn = "default-layer", D = (t) => {
|
|
1157
1207
|
if (!t) return "transparent";
|
|
1158
1208
|
if (t.alpha === void 0 || t.alpha >= 0.999) return t.hex;
|
|
1159
1209
|
const n = t.hex.replace("#", "");
|
|
1160
1210
|
return `rgba(${parseInt(n.slice(0, 2), 16)}, ${parseInt(n.slice(2, 4), 16)}, ${parseInt(n.slice(4, 6), 16)}, ${+t.alpha.toFixed(3)})`;
|
|
1161
|
-
},
|
|
1211
|
+
}, on = /(times|georgia|garamond|cambria|book|serif|palatino|baskerville|merriweather)/i, sn = /(courier|consolas|mono|menlo|code)/i;
|
|
1162
1212
|
function Xt(t) {
|
|
1163
1213
|
if (!t) return "sans-serif";
|
|
1164
|
-
const n =
|
|
1165
|
-
return n || (
|
|
1214
|
+
const n = de(t);
|
|
1215
|
+
return n || (sn.test(t) ? "monospace" : on.test(t) ? "serif" : "sans-serif");
|
|
1166
1216
|
}
|
|
1167
|
-
function
|
|
1217
|
+
function rn(t) {
|
|
1168
1218
|
const n = [];
|
|
1169
1219
|
let e = [], o = !1;
|
|
1170
1220
|
const s = () => {
|
|
@@ -1189,8 +1239,15 @@ function Je(t) {
|
|
|
1189
1239
|
} else r.op === "Z" && (o = !0, s());
|
|
1190
1240
|
return s(), n;
|
|
1191
1241
|
}
|
|
1192
|
-
const
|
|
1193
|
-
|
|
1242
|
+
const an = (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 });
|
|
1243
|
+
function ln(t, n) {
|
|
1244
|
+
if (!t) return null;
|
|
1245
|
+
if (t.kind === "url") return t.url;
|
|
1246
|
+
if (t.kind === "action") return fe(t.action);
|
|
1247
|
+
const e = n.slideIds?.get(t.key);
|
|
1248
|
+
return e ? ue(e) : null;
|
|
1249
|
+
}
|
|
1250
|
+
async function cn(t) {
|
|
1194
1251
|
if (!(typeof document > "u"))
|
|
1195
1252
|
try {
|
|
1196
1253
|
const n = new Image();
|
|
@@ -1203,7 +1260,7 @@ async function en(t) {
|
|
|
1203
1260
|
return;
|
|
1204
1261
|
}
|
|
1205
1262
|
}
|
|
1206
|
-
async function
|
|
1263
|
+
async function fn(t, n) {
|
|
1207
1264
|
const e = /* @__PURE__ */ new Set(), o = (r) => {
|
|
1208
1265
|
for (const a of r)
|
|
1209
1266
|
if (a.kind === "group") o(a.children);
|
|
@@ -1218,11 +1275,11 @@ async function nn(t, n) {
|
|
|
1218
1275
|
t.slides.forEach((r) => o(r.items));
|
|
1219
1276
|
const s = /* @__PURE__ */ new Map();
|
|
1220
1277
|
return await Promise.all([...e].map(async (r) => {
|
|
1221
|
-
const a = await
|
|
1278
|
+
const a = await cn(r);
|
|
1222
1279
|
a && s.set(r, a);
|
|
1223
1280
|
})), s;
|
|
1224
1281
|
}
|
|
1225
|
-
async function
|
|
1282
|
+
async function un(t, n, e, o) {
|
|
1226
1283
|
if (!(typeof document > "u"))
|
|
1227
1284
|
try {
|
|
1228
1285
|
const s = new Image();
|
|
@@ -1244,7 +1301,7 @@ async function on(t, n, e, o) {
|
|
|
1244
1301
|
return;
|
|
1245
1302
|
}
|
|
1246
1303
|
}
|
|
1247
|
-
function
|
|
1304
|
+
function Z(t, n, e, o) {
|
|
1248
1305
|
return {
|
|
1249
1306
|
id: t.nextId(n),
|
|
1250
1307
|
type: n,
|
|
@@ -1265,7 +1322,7 @@ function q(t, n, e, o) {
|
|
|
1265
1322
|
opacity: 100,
|
|
1266
1323
|
seed: 1,
|
|
1267
1324
|
locked: !1,
|
|
1268
|
-
layerId:
|
|
1325
|
+
layerId: nn,
|
|
1269
1326
|
groupIds: [...o].reverse(),
|
|
1270
1327
|
// innermost first, the store's convention
|
|
1271
1328
|
name: e.name
|
|
@@ -1277,14 +1334,14 @@ function Ht(t, n, e) {
|
|
|
1277
1334
|
t.backgroundColor = "transparent";
|
|
1278
1335
|
break;
|
|
1279
1336
|
case "solid":
|
|
1280
|
-
t.backgroundColor =
|
|
1337
|
+
t.backgroundColor = D(n.color), t.fillStyle = "solid";
|
|
1281
1338
|
break;
|
|
1282
1339
|
case "linear":
|
|
1283
1340
|
case "radial":
|
|
1284
|
-
t.fillStyle = n.kind, t.backgroundColor =
|
|
1341
|
+
t.fillStyle = n.kind, t.backgroundColor = D(n.stops[0]?.color), t.gradientStops = n.stops.map((o) => ({ offset: o.pos, color: D(o.color) })), n.kind === "linear" && (t.gradientDirection = n.angle);
|
|
1285
1342
|
break;
|
|
1286
1343
|
case "pattern": {
|
|
1287
|
-
t.backgroundColor =
|
|
1344
|
+
t.backgroundColor = D(n.color), t.fillStyle = "pattern", t.patternFill = Mn(n.preset, D(n.color), n.bg ? D(n.bg) : "transparent");
|
|
1288
1345
|
break;
|
|
1289
1346
|
}
|
|
1290
1347
|
case "image": {
|
|
@@ -1299,59 +1356,59 @@ function kt(t, n) {
|
|
|
1299
1356
|
t.strokeColor = "transparent", t.strokeWidth = 0;
|
|
1300
1357
|
return;
|
|
1301
1358
|
}
|
|
1302
|
-
t.strokeColor =
|
|
1359
|
+
t.strokeColor = D(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");
|
|
1303
1360
|
}
|
|
1304
|
-
function
|
|
1361
|
+
function dn(t) {
|
|
1305
1362
|
const n = /^(alphaLc|alphaUc|arabic|romanLc|romanUc)(ParenBoth|ParenR|Period|Plain)$/.exec(t ?? "");
|
|
1306
1363
|
if (!n) return {};
|
|
1307
1364
|
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 = {};
|
|
1308
1365
|
return e && (s.listNumberStyle = e), o && (s.listNumberSuffix = o), s;
|
|
1309
1366
|
}
|
|
1310
|
-
function
|
|
1311
|
-
const e = t.bullet === "num" ?
|
|
1312
|
-
return t.bulletColor &&
|
|
1367
|
+
function hn(t, n) {
|
|
1368
|
+
const e = t.bullet === "num" ? dn(t.numType) : t.bulletChar ? { listMarker: t.bulletChar } : {}, o = t.runs.find((s) => !s.br)?.color ?? n.defaults?.color;
|
|
1369
|
+
return t.bulletColor && D(t.bulletColor) !== D(o) && (e.listMarkerColor = D(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;
|
|
1313
1370
|
}
|
|
1314
1371
|
const bt = (t, n) => Math.round(((t.paragraphs[n - 1]?.spaceAfter ?? 0) + (t.paragraphs[n]?.spaceBefore ?? 0)) * 100) / 100;
|
|
1315
1372
|
function te(t, n) {
|
|
1316
|
-
const e = t.paragraphs.flatMap((
|
|
1317
|
-
for (const
|
|
1318
|
-
const
|
|
1319
|
-
|
|
1373
|
+
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);
|
|
1374
|
+
for (const h of t.paragraphs) {
|
|
1375
|
+
const y = a(h);
|
|
1376
|
+
y && r.set(h.align ?? "l", (r.get(h.align ?? "l") ?? 0) + y);
|
|
1320
1377
|
}
|
|
1321
|
-
const i = [...r].sort((
|
|
1378
|
+
const i = [...r].sort((h, y) => y[1] - h[1])[0]?.[0] ?? t.paragraphs.find((h) => h.runs.length)?.align ?? "l", c = (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 && D(h.color) === D(o?.color)) && !t.paragraphs.some((h) => h.bullet) && !t.paragraphs.some((h, y) => y > 0 && bt(t, y) > 0) && !t.paragraphs.some(c), b = {
|
|
1322
1379
|
fontSize: Math.round(s * 10) / 10,
|
|
1323
1380
|
fontFamily: Xt(o?.font),
|
|
1324
1381
|
textAlign: i === "ctr" ? "center" : i === "r" ? "right" : "left",
|
|
1325
1382
|
verticalAlign: t.anchor === "ctr" ? "middle" : t.anchor === "b" ? "bottom" : "top",
|
|
1326
|
-
textColor:
|
|
1383
|
+
textColor: D(o?.color ?? { hex: "#000000" })
|
|
1327
1384
|
};
|
|
1328
|
-
t.lineSpacing && Math.abs(t.lineSpacing - 1) > 0.01 && (
|
|
1329
|
-
const f = t.paragraphs.map((
|
|
1330
|
-
` :
|
|
1385
|
+
t.lineSpacing && Math.abs(t.lineSpacing - 1) > 0.01 && (b.lineHeight = Math.max(0.5, Math.min(4, t.lineSpacing * 1.2)));
|
|
1386
|
+
const f = t.paragraphs.map((h) => h.runs.map((y) => y.br ? `
|
|
1387
|
+
` : y.text).join("")).join(`
|
|
1331
1388
|
`);
|
|
1332
|
-
if (
|
|
1333
|
-
return o?.bold && (
|
|
1334
|
-
const
|
|
1335
|
-
return t.paragraphs.forEach((
|
|
1336
|
-
const d =
|
|
1337
|
-
if (
|
|
1338
|
-
const M =
|
|
1339
|
-
(
|
|
1389
|
+
if (x)
|
|
1390
|
+
return o?.bold && (b.fontWeight = 700), o?.italic && (b.fontStyle = "italic"), n ? b.containerText = f : b.text = f, { fields: b, rich: !1 };
|
|
1391
|
+
const m = [], g = [], u = [];
|
|
1392
|
+
return t.paragraphs.forEach((h, y) => {
|
|
1393
|
+
const d = h.level ?? 0;
|
|
1394
|
+
if (h.bullet === "num") {
|
|
1395
|
+
const M = h.numType ?? "arabicPeriod";
|
|
1396
|
+
(g[d] === void 0 || u[d] !== M) && (g[d] = (h.startAt ?? 1) - 1), g[d]++, u[d] = M, g.length = d + 1, u.length = d + 1;
|
|
1340
1397
|
} else
|
|
1341
|
-
|
|
1342
|
-
const
|
|
1343
|
-
|
|
1398
|
+
g.length = Math.min(g.length, d), u.length = g.length;
|
|
1399
|
+
const p = h.bullet ? { listType: h.bullet === "num" ? "ordered" : "bullet", listLevel: d, ...hn(h, t) } : {};
|
|
1400
|
+
h.bullet === "num" && (p.listIndex = g[d]), (h.runs.length ? h.runs : [{ text: "" }]).forEach((M, S) => {
|
|
1344
1401
|
const v = { text: M.br ? `
|
|
1345
|
-
` : M.text, ...S === 0 ?
|
|
1346
|
-
S === 0 &&
|
|
1347
|
-
const
|
|
1348
|
-
|
|
1349
|
-
}),
|
|
1402
|
+
` : M.text, ...S === 0 ? p : {} };
|
|
1403
|
+
S === 0 && y > 0 && bt(t, y) > 0 && (v.paragraphSpaceBefore = bt(t, y));
|
|
1404
|
+
const N = c(h);
|
|
1405
|
+
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 = D(M.color)), M.size && (v.fontSize = Math.round(M.size * 10) / 10), M.font && (v.fontFamily = Xt(M.font)), m.push(v);
|
|
1406
|
+
}), y < t.paragraphs.length - 1 && m.push({ text: `
|
|
1350
1407
|
` });
|
|
1351
|
-
}), n ? (
|
|
1408
|
+
}), n ? (b.richContainerText = m, b.containerText = f) : (b.richText = m, b.text = f), { fields: b, rich: !0 };
|
|
1352
1409
|
}
|
|
1353
1410
|
function yt(t, n, e, o, s) {
|
|
1354
|
-
const { fields: r, rich: a } = te(n, !1), i = 4, c =
|
|
1411
|
+
const { fields: r, rich: a } = te(n, !1), i = 4, c = Z(t, a ? "richtext" : "text", {
|
|
1355
1412
|
...e,
|
|
1356
1413
|
x: e.x + n.insets.l - i,
|
|
1357
1414
|
y: e.y + n.insets.t - i,
|
|
@@ -1366,75 +1423,75 @@ function ne(t, n, e) {
|
|
|
1366
1423
|
if (t.text && t.fill.kind === "none" && !t.line && (t.textBox || o.kind === "preset" && o.prst === "rect"))
|
|
1367
1424
|
return n.stats.elements++, [yt(n, t.text, t, e)];
|
|
1368
1425
|
if (o.kind === "preset" && ee.has(o.prst)) return wt({ ...t, kind: "connector", line: t.line ?? { width: 1, color: { hex: "#000000" } } }, n, e);
|
|
1369
|
-
if (o.kind === "custom" && t.line && (t.line.head || t.line.tail) && !t.text && o.paths.every((f) => !f.cmds.some((
|
|
1426
|
+
if (o.kind === "custom" && t.line && (t.line.head || t.line.tail) && !t.text && o.paths.every((f) => !f.cmds.some((m) => m.op === "Z")))
|
|
1370
1427
|
return wt({ ...t, kind: "connector", line: t.line }, n, e);
|
|
1371
|
-
const s =
|
|
1428
|
+
const s = mn(t);
|
|
1372
1429
|
if (s) {
|
|
1373
|
-
const f =
|
|
1430
|
+
const f = Z(n, s.type, t, e);
|
|
1374
1431
|
Object.assign(f, s.extra), Ht(f, t.fill, n), kt(f, t.line), n.byPptId.set(t.id, { el: f, item: t }), n.stats.elements++;
|
|
1375
|
-
const
|
|
1376
|
-
if (t.text && (u ||
|
|
1377
|
-
const
|
|
1378
|
-
return f.groupIds = [...e,
|
|
1432
|
+
const m = t.textRect ?? { l: 0, t: 0, r: t.w, b: t.h }, g = t.text?.insets, u = 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;
|
|
1433
|
+
if (t.text && (u || h)) {
|
|
1434
|
+
const y = n.nextId("group");
|
|
1435
|
+
return f.groupIds = [...e, y].reverse(), n.stats.elements++, [f, yt(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])];
|
|
1379
1436
|
}
|
|
1380
1437
|
if (t.text) {
|
|
1381
|
-
const { fields:
|
|
1382
|
-
Object.assign(f,
|
|
1438
|
+
const { fields: y } = te(t.text, !0);
|
|
1439
|
+
Object.assign(f, y);
|
|
1383
1440
|
}
|
|
1384
1441
|
return [f];
|
|
1385
1442
|
}
|
|
1386
1443
|
const r = o.kind === "custom" ? o.paths : (() => {
|
|
1387
1444
|
const f = n.presets[o.prst];
|
|
1388
1445
|
if (!f)
|
|
1389
|
-
return n.warnings.push(`Unknown shape "${o.prst}" was imported as a rectangle.`),
|
|
1390
|
-
const
|
|
1391
|
-
return
|
|
1392
|
-
})(), a = [], i = (t.text || r.some((f) => f.fill === !1)) && r.some((f) => f.fill !== !1) ? n.nextId("group") : null, c = i ? [...e, i] : e,
|
|
1446
|
+
return n.warnings.push(`Unknown shape "${o.prst}" was imported as a rectangle.`), lt(n.presets.rect, t.w, t.h);
|
|
1447
|
+
const m = Object.fromEntries(Object.entries(o.adj ?? {}).map(([g, u]) => [g, `val ${u}`]));
|
|
1448
|
+
return lt(f, t.w, t.h, m);
|
|
1449
|
+
})(), a = [], i = (t.text || r.some((f) => f.fill === !1)) && r.some((f) => f.fill !== !1) ? n.nextId("group") : null, c = i ? [...e, i] : e, x = /* @__PURE__ */ new Map();
|
|
1393
1450
|
for (const f of r) {
|
|
1394
|
-
const
|
|
1395
|
-
|
|
1451
|
+
const m = `${f.fill === !1 ? "nofill" : "fill"}|${f.stroke === !1 ? "nostroke" : "stroke"}`;
|
|
1452
|
+
x.has(m) || x.set(m, []), x.get(m).push(f);
|
|
1396
1453
|
}
|
|
1397
|
-
let
|
|
1398
|
-
for (const [f,
|
|
1399
|
-
const
|
|
1454
|
+
let b = null;
|
|
1455
|
+
for (const [f, m] of x) {
|
|
1456
|
+
const g = m.flatMap((p) => p.cmds), u = le(g);
|
|
1400
1457
|
if (!u) continue;
|
|
1401
|
-
const
|
|
1402
|
-
if (!
|
|
1403
|
-
const
|
|
1404
|
-
!(Math.abs(u.minX + u.maxX - t.w) < 0.5 && Math.abs(u.minY + u.maxY - t.h) < 0.5) && (t.rot || t.flipH || t.flipV) &&
|
|
1458
|
+
const h = rn(an(g, -u.minX, -u.minY));
|
|
1459
|
+
if (!h.length) continue;
|
|
1460
|
+
const y = Z(n, "path", { ...t, x: t.x + u.minX, y: t.y + u.minY, w: Math.max(u.maxX - u.minX, 1), h: Math.max(u.maxY - u.minY, 1) }, c);
|
|
1461
|
+
!(Math.abs(u.minX + u.maxX - t.w) < 0.5 && Math.abs(u.minY + u.maxY - t.h) < 0.5) && (t.rot || t.flipH || t.flipV) && pn(y, h, t, u), y.pathSubpaths = h, y.pathAnchors = h[0].anchors, y.pathClosed = h[0].closed, f.startsWith("fill") ? Ht(y, t.fill, n) : y.backgroundColor = "transparent", f.endsWith("|stroke") ? kt(y, t.line) : (y.strokeColor = "transparent", y.strokeWidth = 0), a.push(y), b ??= y, n.stats.paths++;
|
|
1405
1462
|
}
|
|
1406
|
-
if (
|
|
1463
|
+
if (b && n.byPptId.set(t.id, { el: b, item: t }), t.text) {
|
|
1407
1464
|
const f = t.textRect ?? (o.kind === "preset" && n.presets[o.prst] ? Ut(n.presets[o.prst], t.w, t.h) : { l: 0, t: 0, r: t.w, b: t.h });
|
|
1408
1465
|
a.push(yt(n, t.text, { ...t, x: t.x + f.l, y: t.y + f.t, w: f.r - f.l, h: f.b - f.t }, c));
|
|
1409
1466
|
}
|
|
1410
1467
|
return n.stats.elements += a.length, a;
|
|
1411
1468
|
}
|
|
1412
|
-
function
|
|
1413
|
-
const s = e.w / 2, r = e.h / 2, a = (e.rot || 0) * Math.PI / 180, i = Math.cos(a), c = Math.sin(a),
|
|
1414
|
-
const k = (d + o.minX - s) *
|
|
1469
|
+
function pn(t, n, e, o) {
|
|
1470
|
+
const s = e.w / 2, r = e.h / 2, a = (e.rot || 0) * Math.PI / 180, i = Math.cos(a), c = Math.sin(a), x = e.flipH ? -1 : 1, b = e.flipV ? -1 : 1, f = (d, p) => {
|
|
1471
|
+
const k = (d + o.minX - s) * x, M = (p + o.minY - r) * b;
|
|
1415
1472
|
return { x: s + k * i - M * c, y: r + k * c + M * i };
|
|
1416
|
-
},
|
|
1417
|
-
const k = d *
|
|
1473
|
+
}, m = (d, p) => {
|
|
1474
|
+
const k = d * x, M = p * b;
|
|
1418
1475
|
return { x: k * i - M * c, y: k * c + M * i };
|
|
1419
1476
|
};
|
|
1420
|
-
let
|
|
1421
|
-
for (const d of n) for (const
|
|
1422
|
-
const k = f(
|
|
1423
|
-
if (
|
|
1424
|
-
const M =
|
|
1425
|
-
|
|
1477
|
+
let g = 1 / 0, u = 1 / 0, h = -1 / 0, y = -1 / 0;
|
|
1478
|
+
for (const d of n) for (const p of d.anchors) {
|
|
1479
|
+
const k = f(p.x, p.y);
|
|
1480
|
+
if (p.x = k.x, p.y = k.y, p.inX !== void 0) {
|
|
1481
|
+
const M = m(p.inX, p.inY ?? 0);
|
|
1482
|
+
p.inX = M.x, p.inY = M.y;
|
|
1426
1483
|
}
|
|
1427
|
-
if (
|
|
1428
|
-
const M =
|
|
1429
|
-
|
|
1484
|
+
if (p.outX !== void 0) {
|
|
1485
|
+
const M = m(p.outX, p.outY ?? 0);
|
|
1486
|
+
p.outX = M.x, p.outY = M.y;
|
|
1430
1487
|
}
|
|
1431
|
-
|
|
1488
|
+
g = Math.min(g, p.x), u = Math.min(u, p.y), h = Math.max(h, p.x), y = Math.max(y, p.y);
|
|
1432
1489
|
}
|
|
1433
|
-
for (const d of n) for (const
|
|
1434
|
-
|
|
1435
|
-
t.x = t.x - o.minX +
|
|
1490
|
+
for (const d of n) for (const p of d.anchors)
|
|
1491
|
+
p.x -= g, p.y -= u;
|
|
1492
|
+
t.x = t.x - o.minX + g, t.y = t.y - o.minY + u, t.width = Math.max(h - g, 1), t.height = Math.max(y - u, 1), t.angle = 0, t.flipX = void 0, t.flipY = void 0;
|
|
1436
1493
|
}
|
|
1437
|
-
function
|
|
1494
|
+
function mn(t) {
|
|
1438
1495
|
const n = t.geom;
|
|
1439
1496
|
if (n.kind !== "preset") return null;
|
|
1440
1497
|
const e = n.adj ?? {};
|
|
@@ -1461,27 +1518,27 @@ function wt(t, n, e) {
|
|
|
1461
1518
|
else if (o.kind === "custom") s = o.paths.flatMap((k) => k.cmds);
|
|
1462
1519
|
else {
|
|
1463
1520
|
const k = n.presets[o.prst], M = Object.fromEntries(Object.entries(o.adj ?? {}).map(([S, v]) => [S, `val ${v}`]));
|
|
1464
|
-
s = k ?
|
|
1521
|
+
s = k ? lt(k, t.w, t.h, M).flatMap((S) => S.cmds) : [{ op: "M", x: 0, y: 0 }, { op: "L", x: t.w, y: t.h }];
|
|
1465
1522
|
}
|
|
1466
1523
|
const r = t.w / 2, a = t.h / 2, i = (t.rot || 0) * Math.PI / 180, c = (k, M) => {
|
|
1467
1524
|
let S = k - r, v = M - a;
|
|
1468
1525
|
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) };
|
|
1469
|
-
},
|
|
1470
|
-
let
|
|
1526
|
+
}, x = [];
|
|
1527
|
+
let b = { x: 0, y: 0 };
|
|
1471
1528
|
for (const k of s)
|
|
1472
1529
|
if (k.op === "M" || k.op === "L")
|
|
1473
|
-
|
|
1530
|
+
b = { x: k.x, y: k.y }, x.push(c(b.x, b.y));
|
|
1474
1531
|
else if (k.op === "C") {
|
|
1475
1532
|
for (let M = 1; M <= 12; M++) {
|
|
1476
|
-
const S = M / 12, v = 1 - S,
|
|
1477
|
-
|
|
1533
|
+
const S = M / 12, v = 1 - S, N = v * v * v * b.x + 3 * v * v * S * k.x1 + 3 * v * S * S * k.x2 + S * S * S * k.x, P = v * v * v * b.y + 3 * v * v * S * k.y1 + 3 * v * S * S * k.y2 + S * S * S * k.y;
|
|
1534
|
+
x.push(c(N, P));
|
|
1478
1535
|
}
|
|
1479
|
-
|
|
1536
|
+
b = { x: k.x, y: k.y };
|
|
1480
1537
|
}
|
|
1481
|
-
if (
|
|
1482
|
-
const f = Math.min(...
|
|
1483
|
-
d.points =
|
|
1484
|
-
const
|
|
1538
|
+
if (x.length < 2) return [];
|
|
1539
|
+
const f = Math.min(...x.map((k) => k.x)), m = Math.min(...x.map((k) => k.y)), g = Math.max(...x.map((k) => k.x)), u = Math.max(...x.map((k) => k.y)), h = t.line.head && Yt[t.line.head.type], y = t.line.tail && Yt[t.line.tail.type], d = Z(n, h || y ? "arrow" : "line", { ...t, x: f, y: m, w: Math.max(g - f, 1), h: Math.max(u - m, 1), rot: 0, flipH: !1, flipV: !1 }, e);
|
|
1540
|
+
d.points = x.map((k) => ({ x: k.x - f, y: k.y - m })), d.curveType = "straight", d.startArrowhead = h ?? null, d.endArrowhead = y ?? null, kt(d, t.line);
|
|
1541
|
+
const p = (k, M) => {
|
|
1485
1542
|
if (!k) return null;
|
|
1486
1543
|
const S = n.byPptId.get(k.id);
|
|
1487
1544
|
if (!S || !S.el.width || !S.el.height) return null;
|
|
@@ -1489,17 +1546,17 @@ function wt(t, n, e) {
|
|
|
1489
1546
|
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 };
|
|
1490
1547
|
};
|
|
1491
1548
|
return n.glue.push(() => {
|
|
1492
|
-
d.startBinding =
|
|
1549
|
+
d.startBinding = p(t.start, x[0]), d.endBinding = p(t.end, x[x.length - 1]);
|
|
1493
1550
|
}), n.stats.elements++, [d];
|
|
1494
1551
|
}
|
|
1495
|
-
function
|
|
1552
|
+
function gn(t, n, e) {
|
|
1496
1553
|
const o = n.images.get(t.media);
|
|
1497
1554
|
if (!o) {
|
|
1498
1555
|
n.warnings.push(`Picture "${t.name}" is a ${t.media.ext.toUpperCase()} image, which browsers can't show; it was imported as a placeholder.`);
|
|
1499
|
-
const c =
|
|
1556
|
+
const c = Z(n, "rectangle", t, e);
|
|
1500
1557
|
return Object.assign(c, { backgroundColor: "#f1f3f5", strokeColor: "#adb5bd", strokeWidth: 1, strokeStyle: "dashed", containerText: `${t.media.ext.toUpperCase()} picture`, fontSize: 14, textColor: "#495057" }), n.stats.elements++, [c];
|
|
1501
1558
|
}
|
|
1502
|
-
const s =
|
|
1559
|
+
const s = Z(n, "image", t, e);
|
|
1503
1560
|
if (s.dataURL = t.grayscale && n.gray.get(o.url) || o.url, s.status = "loaded", s.mimeType = Mt[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];
|
|
1504
1561
|
const r = n.nextId("group"), a = ne({
|
|
1505
1562
|
kind: "shape",
|
|
@@ -1525,38 +1582,43 @@ function oe(t, n, e) {
|
|
|
1525
1582
|
const o = [];
|
|
1526
1583
|
for (const s of t)
|
|
1527
1584
|
try {
|
|
1585
|
+
const r = [];
|
|
1528
1586
|
switch (s.kind) {
|
|
1529
1587
|
case "shape":
|
|
1530
|
-
|
|
1588
|
+
r.push(...ne(s, n, e));
|
|
1531
1589
|
break;
|
|
1532
1590
|
case "connector":
|
|
1533
|
-
|
|
1591
|
+
r.push(...wt(s, n, e));
|
|
1534
1592
|
break;
|
|
1535
1593
|
case "picture":
|
|
1536
|
-
|
|
1594
|
+
r.push(...gn(s, n, e));
|
|
1537
1595
|
break;
|
|
1538
1596
|
case "group":
|
|
1539
|
-
|
|
1597
|
+
r.push(...oe(s.children, n, [...e, n.nextId("group")]));
|
|
1540
1598
|
break;
|
|
1541
1599
|
}
|
|
1600
|
+
const a = ln(s.link, n);
|
|
1601
|
+
if (a)
|
|
1602
|
+
for (const i of r) i.link || (i.link = a);
|
|
1603
|
+
o.push(...r);
|
|
1542
1604
|
} catch {
|
|
1543
1605
|
n.warnings.push(`"${s.name}" couldn't be converted and was skipped.`);
|
|
1544
1606
|
}
|
|
1545
1607
|
return o;
|
|
1546
1608
|
}
|
|
1547
|
-
function
|
|
1609
|
+
function xn(t) {
|
|
1548
1610
|
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;
|
|
1549
1611
|
}
|
|
1550
|
-
function
|
|
1612
|
+
function bn(t, n, e) {
|
|
1551
1613
|
if (n)
|
|
1552
1614
|
if (n.kind === "solid")
|
|
1553
|
-
t.fillStyle = "solid", t.backgroundColor =
|
|
1615
|
+
t.fillStyle = "solid", t.backgroundColor = D(n.color);
|
|
1554
1616
|
else if (n.kind === "linear" || n.kind === "radial")
|
|
1555
|
-
t.fillStyle = n.kind, t.backgroundColor =
|
|
1617
|
+
t.fillStyle = n.kind, t.backgroundColor = D(n.stops[0]?.color), t.gradientStops = n.stops.map((o) => ({ offset: o.pos, color: D(o.color) })), n.kind === "linear" && (t.gradientDirection = n.angle);
|
|
1556
1618
|
else if (n.kind === "image") {
|
|
1557
1619
|
const o = e.images.get(n.media), s = e.slideBg ?? o?.url;
|
|
1558
1620
|
s && (t.fillStyle = "image", t.backgroundImage = s, t.backgroundColor = "#ffffff"), s && n.alpha !== void 0 && n.alpha < 1 && (t.backgroundOpacity = n.alpha);
|
|
1559
|
-
} else n.kind === "pattern" && (t.fillStyle = "solid", t.backgroundColor =
|
|
1621
|
+
} else n.kind === "pattern" && (t.fillStyle = "solid", t.backgroundColor = D(n.color));
|
|
1560
1622
|
}
|
|
1561
1623
|
const Mt = {
|
|
1562
1624
|
png: "image/png",
|
|
@@ -1568,13 +1630,13 @@ const Mt = {
|
|
|
1568
1630
|
webp: "image/webp",
|
|
1569
1631
|
emf: "image/x-emf",
|
|
1570
1632
|
wmf: "image/x-wmf"
|
|
1571
|
-
},
|
|
1572
|
-
function
|
|
1633
|
+
}, yn = /* @__PURE__ */ new Set(["png", "jpeg", "gif", "svg", "bmp", "webp"]);
|
|
1634
|
+
function kn(t) {
|
|
1573
1635
|
let n = "";
|
|
1574
1636
|
for (let o = 0; o < t.length; o += 32768) n += String.fromCharCode(...t.subarray(o, o + 32768));
|
|
1575
1637
|
return btoa(n);
|
|
1576
1638
|
}
|
|
1577
|
-
async function
|
|
1639
|
+
async function wn(t) {
|
|
1578
1640
|
const n = /* @__PURE__ */ new Set(), e = (s) => {
|
|
1579
1641
|
for (const r of s)
|
|
1580
1642
|
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);
|
|
@@ -1583,11 +1645,11 @@ async function pn(t) {
|
|
|
1583
1645
|
e(s.items), s.background?.kind === "image" && n.add(s.background.media);
|
|
1584
1646
|
const o = /* @__PURE__ */ new Map();
|
|
1585
1647
|
return await Promise.all([...n].map(async (s) => {
|
|
1586
|
-
if (!
|
|
1648
|
+
if (!yn.has(s.ext)) {
|
|
1587
1649
|
o.set(s, null);
|
|
1588
1650
|
return;
|
|
1589
1651
|
}
|
|
1590
|
-
const r = `data:${Mt[s.ext]};base64,${
|
|
1652
|
+
const r = `data:${Mt[s.ext]};base64,${kn(s.bytes)}`;
|
|
1591
1653
|
let a = 0, i = 0;
|
|
1592
1654
|
try {
|
|
1593
1655
|
const c = await createImageBitmap(new Blob([s.bytes], { type: Mt[s.ext] }));
|
|
@@ -1597,39 +1659,41 @@ async function pn(t) {
|
|
|
1597
1659
|
o.set(s, { url: r, w: a, h: i });
|
|
1598
1660
|
})), o;
|
|
1599
1661
|
}
|
|
1600
|
-
function
|
|
1662
|
+
function Mn(t, n, e) {
|
|
1601
1663
|
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);
|
|
1602
1664
|
if (a) {
|
|
1603
|
-
const i = Math.max(1, Math.min(99, Number(a[1]))), c = i > 50,
|
|
1604
|
-
return { type: "dots", color: c ? e : n, background: c ? n : e, spacing: 4, strokeWidth: Math.max(0.5, 4 * Math.sqrt(
|
|
1665
|
+
const i = Math.max(1, Math.min(99, Number(a[1]))), c = i > 50, x = (c ? 100 - i : i) / 100;
|
|
1666
|
+
return { type: "dots", color: c ? e : n, background: c ? n : e, spacing: 4, strokeWidth: Math.max(0.5, 4 * Math.sqrt(x / Math.PI)) };
|
|
1605
1667
|
}
|
|
1606
1668
|
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 };
|
|
1607
1669
|
}
|
|
1608
|
-
async function
|
|
1609
|
-
const o = await
|
|
1670
|
+
async function vn(t, n, e) {
|
|
1671
|
+
const o = await ye(), s = await wn(t), r = Math.round(t.width), a = Math.round(t.height), i = ce(e ?? t.title, "slides", { width: r, height: a }), c = [], x = { slides: 0, elements: 0, pictures: 0, paths: 0 };
|
|
1610
1672
|
i.slides = [];
|
|
1611
|
-
const
|
|
1612
|
-
const h =
|
|
1613
|
-
return h?.kind === "image" &&
|
|
1614
|
-
}));
|
|
1615
|
-
return t.slides.forEach((
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
const
|
|
1619
|
-
|
|
1620
|
-
const
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1673
|
+
const b = await fn(t, s), f = await Promise.all(t.slides.map((u) => {
|
|
1674
|
+
const h = u.background, y = h?.kind === "image" ? s.get(h.media) : void 0;
|
|
1675
|
+
return h?.kind === "image" && y ? un(y.url, r, a, h.tile) : void 0;
|
|
1676
|
+
})), m = t.slides.map(() => n("slide")), g = /* @__PURE__ */ new Map();
|
|
1677
|
+
return t.slides.forEach((u, h) => {
|
|
1678
|
+
u.key && g.set(u.key, m[h]);
|
|
1679
|
+
}), t.slides.forEach((u, h) => {
|
|
1680
|
+
const y = h * (r + en), d = Nt(m[h], u.name || `Slide ${h + 1}`, y, 0, { width: r, height: a });
|
|
1681
|
+
d.order = h;
|
|
1682
|
+
const p = { ox: y, oy: 0, presets: o, nextId: n, out: [], byPptId: /* @__PURE__ */ new Map(), glue: [], warnings: c, stats: x, images: s, slideBg: f[h], gray: b, slideIds: g };
|
|
1683
|
+
i.elements.push(...oe(u.items, p, [])), p.glue.forEach((M) => M()), bn(d, u.background, p);
|
|
1684
|
+
const k = xn(u.transition);
|
|
1685
|
+
k && (d.transition = k), u.notes && (d.notes = u.notes), i.slides.push(d), x.slides++;
|
|
1686
|
+
}), i.slides.length || i.slides.push(Nt(void 0, "Slide 1", 0, 0, { width: r, height: a })), { doc: i, warnings: [...new Set(c)], stats: x };
|
|
1687
|
+
}
|
|
1688
|
+
const Sn = 512 * 1024 * 1024;
|
|
1689
|
+
async function In(t, n) {
|
|
1626
1690
|
const e = t instanceof Uint8Array ? t : t instanceof ArrayBuffer ? new Uint8Array(t) : new Uint8Array(await t.arrayBuffer());
|
|
1627
|
-
if (e.length >
|
|
1628
|
-
const { deck: o, warnings: s } =
|
|
1629
|
-
|
|
1691
|
+
if (e.length > Sn) throw new Error("This presentation is too large to open (over 512 MB).");
|
|
1692
|
+
const { deck: o, warnings: s } = tn(e), r = /* @__PURE__ */ new Set(), a = await vn(o, (c) => pe(c, r), n);
|
|
1693
|
+
he(a.doc);
|
|
1630
1694
|
const i = [...s, ...a.warnings];
|
|
1631
1695
|
return i.length && console.warn("[pptx import]", i), { stats: a.stats, warnings: i };
|
|
1632
1696
|
}
|
|
1633
1697
|
export {
|
|
1634
|
-
|
|
1698
|
+
In as importPptx
|
|
1635
1699
|
};
|