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