@silurus/ooxml 0.82.1 → 0.83.0
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 +72 -3
- package/dist/assets/{render-worker-Cy-QsDge.js → render-worker-Bu31cf1J.js} +4 -4
- package/dist/assets/render-worker-DuztdEcX.js +11 -0
- package/dist/{canvas-viewer-mechanics-CS_qbr6T.js → canvas-viewer-mechanics-h07vpVOQ.js} +42 -2
- package/dist/{comment-ui-runtime-C1RV_3iu.js → comment-ui-runtime-BelHJt73.js} +2 -2
- package/dist/{comment-ui-runtime-DgCZpPR0.js → comment-ui-runtime-DD5a3x3k.js} +2 -2
- package/dist/{comments-Cf9W7r3M.js → comments-AAaNnQTi.js} +7 -2
- package/dist/{document-pull-client-B1WOjA0z.js → document-pull-client-BAhqoTmm.js} +4508 -3952
- package/dist/docx-Dg73PGgC.js +2707 -0
- package/dist/docx.mjs +6 -6
- package/dist/docx_parser_bg.wasm +0 -0
- package/dist/dom-interaction-boundary-CepOlXt6.js +217 -0
- package/dist/index.mjs +4 -4
- package/dist/line-distribute-D7A_wnJg.js +1003 -0
- package/dist/{line-metrics-B3syvDn2.js → line-metrics-Bpn7OeZD.js} +616 -616
- package/dist/node.mjs +308 -308
- package/dist/pptx-BcUCETmQ.js +2990 -0
- package/dist/pptx.mjs +5 -5
- package/dist/pptx_parser_bg.wasm +0 -0
- package/dist/{render-BC8p7vZQ.js → render-CL-7V3E8.js} +1 -1
- package/dist/{render-worker-host-DhnkTyjj.js → render-worker-host-DDZo0feh.js} +1 -1
- package/dist/{render-worker-host-BNnXCtAu.js → render-worker-host-FJ19-fUI.js} +1 -1
- package/dist/{resource-measurement-CsW4_eYt.js → resource-measurement-DuiFWzam.js} +3 -3
- package/dist/{session-Da7LEQUB.js → session-BjydZEDF.js} +107 -94
- package/dist/{slide-pull-client-Bg9DusLX.js → slide-pull-client-CwvvncPA.js} +1158 -935
- package/dist/types/docx.d.ts +98 -8
- package/dist/types/index.d.ts +184 -13
- package/dist/types/node.d.ts +2 -2
- package/dist/types/pptx.d.ts +94 -5
- package/dist/types/xlsx.d.ts +2 -2
- package/dist/{worksheet-pull-client-CYtwXP5D.js → worksheet-pull-client-DyFsDF4A.js} +32 -32
- package/dist/{xlsx-DMWeXT-c.js → xlsx-BibrHQ52.js} +476 -476
- package/dist/xlsx.mjs +5 -5
- package/dist/xlsx_parser_bg.wasm +0 -0
- package/package.json +3 -1
- package/dist/assets/render-worker-aHayzR7v.js +0 -11
- package/dist/docx-HoZXZUPA.js +0 -2162
- package/dist/dom-interaction-boundary-C8F6HO5x.js +0 -119
- package/dist/line-distribute-iXsUCIH-.js +0 -1003
- package/dist/pptx-DEUP4Yq5.js +0 -2432
- /package/dist/{comment-occurrence-C34fWs_F.js → comment-occurrence-X54si2ob.js} +0 -0
- /package/dist/{highlight-rect-MaCt0om0.js → highlight-rect-Hes0z_Mj.js} +0 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as
|
|
3
|
-
import { S as
|
|
1
|
+
import { $ as e, A as t, At as n, Bt as r, C as i, Ct as a, D as o, Dt as s, Et as c, J as l, M as u, Mt as d, N as f, O as p, Ot as m, Pt as h, Qt as g, S as _, St as v, Tt as y, _ as b, at as x, bt as S, c as C, ct as w, d as T, dt as E, et as D, f as O, g as k, gt as A, h as j, i as M, it as N, j as P, jt as F, kt as I, m as L, mt as R, n as z, nt as B, p as V, pt as H, r as U, rt as ee, s as W, st as te, tt as G, u as K, ut as q, vt as ne, w as re, wt as ie, xt as ae, y as oe, zt as se } from "./line-metrics-Bpn7OeZD.js";
|
|
2
|
+
import { a as ce, c as le, d as ue, i as de, l as fe, n as pe, o as me, r as he, s as ge, t as _e, u as ve } from "./line-distribute-D7A_wnJg.js";
|
|
3
|
+
import { S as ye, _ as be, an as xe, h as Se, in as Ce, k as we, ln as Te, nn as Ee, un as De, v as Oe, w as ke } from "./plot-area-frame-DHV02PJU.js";
|
|
4
4
|
import { r as J } from "./units-BzZ0gAxs.js";
|
|
5
|
-
import { A as
|
|
6
|
-
import { k as
|
|
7
|
-
import { i as
|
|
5
|
+
import { A as Ae, F as je, I as Me, L as Ne, M as Pe, N as Fe, P as Ie, j as Le } from "./three-d-7MaVzQuZ.js";
|
|
6
|
+
import { k as Re } from "./renderer-CYr9YTXM.js";
|
|
7
|
+
import { i as ze, n as Be, t as Ve } from "./resource-measurement-DuiFWzam.js";
|
|
8
8
|
//#region packages/pptx/src/types.ts
|
|
9
|
-
function
|
|
9
|
+
function He(e) {
|
|
10
10
|
return e;
|
|
11
11
|
}
|
|
12
|
-
var
|
|
12
|
+
var Ue = {
|
|
13
13
|
textarchdown: {
|
|
14
14
|
adj: [["adj", "val 0"]],
|
|
15
15
|
gd: [
|
|
@@ -2391,22 +2391,22 @@ var Re = {
|
|
|
2391
2391
|
]
|
|
2392
2392
|
}]
|
|
2393
2393
|
}
|
|
2394
|
-
},
|
|
2395
|
-
function
|
|
2396
|
-
return e.toLowerCase() in
|
|
2394
|
+
}, We = Math.PI * 2 / 216e5, Ge = Ue, Ke = /* @__PURE__ */ new Map();
|
|
2395
|
+
function qe(e) {
|
|
2396
|
+
return e.toLowerCase() in Ge;
|
|
2397
2397
|
}
|
|
2398
|
-
function
|
|
2399
|
-
let t =
|
|
2398
|
+
function Je(e) {
|
|
2399
|
+
let t = Ke.get(e);
|
|
2400
2400
|
if (t) return t;
|
|
2401
|
-
let n =
|
|
2401
|
+
let n = Ge[e];
|
|
2402
2402
|
return n ? (t = {
|
|
2403
|
-
adj: n.adj.map(([e, t]) => [e,
|
|
2404
|
-
gd: n.gd.map(([e, t]) => [e,
|
|
2403
|
+
adj: n.adj.map(([e, t]) => [e, ie(t)]),
|
|
2404
|
+
gd: n.gd.map(([e, t]) => [e, ie(t)]),
|
|
2405
2405
|
paths: n.paths
|
|
2406
|
-
},
|
|
2406
|
+
}, Ke.set(e, t), t) : null;
|
|
2407
2407
|
}
|
|
2408
|
-
var
|
|
2409
|
-
function
|
|
2408
|
+
var Ye = 48;
|
|
2409
|
+
function Xe(e, t, n, r) {
|
|
2410
2410
|
let i = e.w == null ? 1 : n / e.w, a = e.h == null ? 1 : r / e.h, o = (e) => e * i, s = (e) => e * a, c = [], l = 0, u = 0;
|
|
2411
2411
|
for (let n of e.cmds) switch (n[0]) {
|
|
2412
2412
|
case "m":
|
|
@@ -2423,8 +2423,8 @@ function Ge(e, t, n, r) {
|
|
|
2423
2423
|
break;
|
|
2424
2424
|
case "C": {
|
|
2425
2425
|
let e = o(t.resolve(n[1])), r = s(t.resolve(n[2])), i = o(t.resolve(n[3])), a = s(t.resolve(n[4])), d = o(t.resolve(n[5])), f = s(t.resolve(n[6]));
|
|
2426
|
-
for (let t = 1; t <=
|
|
2427
|
-
let n = t /
|
|
2426
|
+
for (let t = 1; t <= Ye; t++) {
|
|
2427
|
+
let n = t / Ye, o = 1 - n, s = o * o * o * l + 3 * o * o * n * e + 3 * o * n * n * i + n * n * n * d, p = o * o * o * u + 3 * o * o * n * r + 3 * o * n * n * a + n * n * n * f;
|
|
2428
2428
|
c.push({
|
|
2429
2429
|
x: s,
|
|
2430
2430
|
y: p
|
|
@@ -2435,8 +2435,8 @@ function Ge(e, t, n, r) {
|
|
|
2435
2435
|
}
|
|
2436
2436
|
case "Q": {
|
|
2437
2437
|
let e = o(t.resolve(n[1])), r = s(t.resolve(n[2])), i = o(t.resolve(n[3])), a = s(t.resolve(n[4]));
|
|
2438
|
-
for (let t = 1; t <=
|
|
2439
|
-
let n = t /
|
|
2438
|
+
for (let t = 1; t <= Ye; t++) {
|
|
2439
|
+
let n = t / Ye, o = 1 - n, s = o * o * l + 2 * o * n * e + n * n * i, d = o * o * u + 2 * o * n * r + n * n * a;
|
|
2440
2440
|
c.push({
|
|
2441
2441
|
x: s,
|
|
2442
2442
|
y: d
|
|
@@ -2446,9 +2446,9 @@ function Ge(e, t, n, r) {
|
|
|
2446
2446
|
break;
|
|
2447
2447
|
}
|
|
2448
2448
|
case "a": {
|
|
2449
|
-
let e = t.resolve(n[1]), r = t.resolve(n[2]), o = e * i, s = r * a, d = t.resolve(n[3]) *
|
|
2449
|
+
let e = t.resolve(n[1]), r = t.resolve(n[2]), o = e * i, s = r * a, d = t.resolve(n[3]) * We, f = t.resolve(n[4]) * We, p = (t) => Math.atan2(e * Math.sin(t), r * Math.cos(t)), m = Math.PI * 2, h = p(d), g = Math.trunc(f / m), _ = f - g * m, v = p(d + _) - h;
|
|
2450
2450
|
_ > 0 && v < 0 ? v += m : _ < 0 && v > 0 && (v -= m);
|
|
2451
|
-
let y = v + g * m, b = l - o * Math.cos(h), x = u - s * Math.sin(h), S = Math.max(
|
|
2451
|
+
let y = v + g * m, b = l - o * Math.cos(h), x = u - s * Math.sin(h), S = Math.max(Ye, Math.ceil(Math.abs(y) / m * 96));
|
|
2452
2452
|
for (let e = 1; e <= S; e++) {
|
|
2453
2453
|
let t = h + y * e / S;
|
|
2454
2454
|
c.push({
|
|
@@ -2463,7 +2463,7 @@ function Ge(e, t, n, r) {
|
|
|
2463
2463
|
}
|
|
2464
2464
|
return c;
|
|
2465
2465
|
}
|
|
2466
|
-
function
|
|
2466
|
+
function Ze(e) {
|
|
2467
2467
|
let t = [0];
|
|
2468
2468
|
for (let n = 1; n < e.length; n++) {
|
|
2469
2469
|
let r = e[n].x - e[n - 1].x, i = e[n].y - e[n - 1].y;
|
|
@@ -2471,23 +2471,23 @@ function Ke(e) {
|
|
|
2471
2471
|
}
|
|
2472
2472
|
return t;
|
|
2473
2473
|
}
|
|
2474
|
-
function
|
|
2475
|
-
let i =
|
|
2474
|
+
function Qe(e, t, n, r) {
|
|
2475
|
+
let i = Je(e.toLowerCase());
|
|
2476
2476
|
if (!i || i.paths.length === 0) return null;
|
|
2477
|
-
let a =
|
|
2477
|
+
let a = y({
|
|
2478
2478
|
w: n,
|
|
2479
2479
|
h: r,
|
|
2480
2480
|
adj: t
|
|
2481
|
-
}, i.adj, i.gd), o = i.paths.length === 1, s =
|
|
2481
|
+
}, i.adj, i.gd), o = i.paths.length === 1, s = Xe(i.paths[0], a, n, r), c = o ? s : Xe(i.paths[i.paths.length - 1], a, n, r);
|
|
2482
2482
|
return {
|
|
2483
2483
|
top: s,
|
|
2484
2484
|
bottom: c,
|
|
2485
|
-
topLen:
|
|
2486
|
-
bottomLen:
|
|
2485
|
+
topLen: Ze(s),
|
|
2486
|
+
bottomLen: Ze(c),
|
|
2487
2487
|
singleEdge: o
|
|
2488
2488
|
};
|
|
2489
2489
|
}
|
|
2490
|
-
function
|
|
2490
|
+
function $e(e, t, n) {
|
|
2491
2491
|
let r = t[t.length - 1];
|
|
2492
2492
|
if (e.length === 1 || r === 0) return {
|
|
2493
2493
|
x: e[0].x,
|
|
@@ -2508,17 +2508,17 @@ function Je(e, t, n) {
|
|
|
2508
2508
|
ty: f / p
|
|
2509
2509
|
};
|
|
2510
2510
|
}
|
|
2511
|
-
function
|
|
2511
|
+
function et(e) {
|
|
2512
2512
|
return e.topLen[e.topLen.length - 1] ?? 0;
|
|
2513
2513
|
}
|
|
2514
|
-
function
|
|
2514
|
+
function tt(e, t) {
|
|
2515
2515
|
if (!e.singleEdge) return 1;
|
|
2516
|
-
let n =
|
|
2516
|
+
let n = et(e);
|
|
2517
2517
|
return n <= 0 ? 1 : Math.max(0, Math.min(1, t / n));
|
|
2518
2518
|
}
|
|
2519
|
-
function
|
|
2519
|
+
function nt(e, t, n, r) {
|
|
2520
2520
|
if (e.singleEdge) {
|
|
2521
|
-
let i =
|
|
2521
|
+
let i = $e(e.top, e.topLen, t), a = Math.atan2(i.ty, i.tx), o = i.ty, s = -i.tx, c = n * (1 - r);
|
|
2522
2522
|
return {
|
|
2523
2523
|
x: i.x - o * c,
|
|
2524
2524
|
y: i.y - s * c,
|
|
@@ -2527,7 +2527,7 @@ function Ze(e, t, n, r) {
|
|
|
2527
2527
|
shear: 0
|
|
2528
2528
|
};
|
|
2529
2529
|
}
|
|
2530
|
-
let i =
|
|
2530
|
+
let i = $e(e.top, e.topLen, t), a = $e(e.bottom, e.bottomLen, t), o = a.x - i.x, s = a.y - i.y, c = i.x + o * r, l = i.y + s * r, u = i.tx + a.tx, d = i.ty + a.ty, f = Math.atan2(d, u), p = Math.cos(f), m = Math.sin(f), h = (p * o + m * s) / (n > 0 ? n : 1), g = (-m * o + p * s) / (n > 0 ? n : 1);
|
|
2531
2531
|
return {
|
|
2532
2532
|
x: c,
|
|
2533
2533
|
y: l,
|
|
@@ -2538,7 +2538,7 @@ function Ze(e, t, n, r) {
|
|
|
2538
2538
|
}
|
|
2539
2539
|
//#endregion
|
|
2540
2540
|
//#region packages/core/src/shape/scene3d-camera.ts
|
|
2541
|
-
var
|
|
2541
|
+
var rt = 26, it = {
|
|
2542
2542
|
orthographicFront: {
|
|
2543
2543
|
kind: "orthographic",
|
|
2544
2544
|
baseLat: 0,
|
|
@@ -2551,52 +2551,52 @@ var Qe = 26, $e = {
|
|
|
2551
2551
|
baseLat: 0,
|
|
2552
2552
|
baseLon: 0,
|
|
2553
2553
|
baseRev: 0,
|
|
2554
|
-
fovDeg:
|
|
2554
|
+
fovDeg: rt
|
|
2555
2555
|
},
|
|
2556
2556
|
perspectiveRelaxed: {
|
|
2557
2557
|
kind: "perspective",
|
|
2558
2558
|
baseLat: 0,
|
|
2559
2559
|
baseLon: 0,
|
|
2560
2560
|
baseRev: 0,
|
|
2561
|
-
fovDeg:
|
|
2561
|
+
fovDeg: rt
|
|
2562
2562
|
},
|
|
2563
2563
|
perspectiveRelaxedModerately: {
|
|
2564
2564
|
kind: "perspective",
|
|
2565
2565
|
baseLat: 0,
|
|
2566
2566
|
baseLon: 0,
|
|
2567
2567
|
baseRev: 0,
|
|
2568
|
-
fovDeg:
|
|
2568
|
+
fovDeg: rt
|
|
2569
2569
|
},
|
|
2570
2570
|
perspectiveAbove: {
|
|
2571
2571
|
kind: "perspective",
|
|
2572
2572
|
baseLat: -20,
|
|
2573
2573
|
baseLon: 0,
|
|
2574
2574
|
baseRev: 0,
|
|
2575
|
-
fovDeg:
|
|
2575
|
+
fovDeg: rt
|
|
2576
2576
|
},
|
|
2577
2577
|
perspectiveBelow: {
|
|
2578
2578
|
kind: "perspective",
|
|
2579
2579
|
baseLat: 20,
|
|
2580
2580
|
baseLon: 0,
|
|
2581
2581
|
baseRev: 0,
|
|
2582
|
-
fovDeg:
|
|
2582
|
+
fovDeg: rt
|
|
2583
2583
|
},
|
|
2584
2584
|
perspectiveLeft: {
|
|
2585
2585
|
kind: "perspective",
|
|
2586
2586
|
baseLat: 0,
|
|
2587
2587
|
baseLon: -20,
|
|
2588
2588
|
baseRev: 0,
|
|
2589
|
-
fovDeg:
|
|
2589
|
+
fovDeg: rt
|
|
2590
2590
|
},
|
|
2591
2591
|
perspectiveRight: {
|
|
2592
2592
|
kind: "perspective",
|
|
2593
2593
|
baseLat: 0,
|
|
2594
2594
|
baseLon: 20,
|
|
2595
2595
|
baseRev: 0,
|
|
2596
|
-
fovDeg:
|
|
2596
|
+
fovDeg: rt
|
|
2597
2597
|
}
|
|
2598
2598
|
};
|
|
2599
|
-
function
|
|
2599
|
+
function at(e, t) {
|
|
2600
2600
|
let n = Array(9).fill(0);
|
|
2601
2601
|
for (let r = 0; r < 3; r++) for (let i = 0; i < 3; i++) {
|
|
2602
2602
|
let a = 0;
|
|
@@ -2605,7 +2605,7 @@ function et(e, t) {
|
|
|
2605
2605
|
}
|
|
2606
2606
|
return n;
|
|
2607
2607
|
}
|
|
2608
|
-
function
|
|
2608
|
+
function ot(e) {
|
|
2609
2609
|
let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
|
|
2610
2610
|
return [
|
|
2611
2611
|
1,
|
|
@@ -2619,7 +2619,7 @@ function tt(e) {
|
|
|
2619
2619
|
n
|
|
2620
2620
|
];
|
|
2621
2621
|
}
|
|
2622
|
-
function
|
|
2622
|
+
function st(e) {
|
|
2623
2623
|
let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
|
|
2624
2624
|
return [
|
|
2625
2625
|
n,
|
|
@@ -2633,7 +2633,7 @@ function nt(e) {
|
|
|
2633
2633
|
n
|
|
2634
2634
|
];
|
|
2635
2635
|
}
|
|
2636
|
-
function
|
|
2636
|
+
function ct(e) {
|
|
2637
2637
|
let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
|
|
2638
2638
|
return [
|
|
2639
2639
|
n,
|
|
@@ -2647,22 +2647,22 @@ function rt(e) {
|
|
|
2647
2647
|
1
|
|
2648
2648
|
];
|
|
2649
2649
|
}
|
|
2650
|
-
function
|
|
2650
|
+
function lt(e, t, n, r) {
|
|
2651
2651
|
return [
|
|
2652
2652
|
e[0] * t + e[1] * n + e[2] * r,
|
|
2653
2653
|
e[3] * t + e[4] * n + e[5] * r,
|
|
2654
2654
|
e[6] * t + e[7] * n + e[8] * r
|
|
2655
2655
|
];
|
|
2656
2656
|
}
|
|
2657
|
-
function
|
|
2657
|
+
function ut(e, t) {
|
|
2658
2658
|
let n = t ? t.lat : e.baseLat, r = t ? t.lon : e.baseLon;
|
|
2659
|
-
return
|
|
2659
|
+
return at(ct(-(t ? t.rev : e.baseRev)), at(ot(-n), st(-r)));
|
|
2660
2660
|
}
|
|
2661
|
-
function
|
|
2662
|
-
return
|
|
2661
|
+
function dt(e) {
|
|
2662
|
+
return it[e] || (e.startsWith("perspective") ? it.perspectiveFront : it.orthographicFront);
|
|
2663
2663
|
}
|
|
2664
|
-
function
|
|
2665
|
-
let r =
|
|
2664
|
+
function ft(e, t, n) {
|
|
2665
|
+
let r = dt(e.prst), i = ut(r, e.rot);
|
|
2666
2666
|
if (t <= 0 || n <= 0) return {
|
|
2667
2667
|
corners: [
|
|
2668
2668
|
{
|
|
@@ -2694,11 +2694,11 @@ function st(e, t, n) {
|
|
|
2694
2694
|
if (r.kind === "perspective") {
|
|
2695
2695
|
let t = e.fov ?? r.fovDeg, n = Math.max(1, Math.min(179, t)) * Math.PI / 180, a = l / Math.tan(n / 2);
|
|
2696
2696
|
u = s.map(([e, t]) => {
|
|
2697
|
-
let [n, r, o] =
|
|
2697
|
+
let [n, r, o] = lt(i, e, t, 0), s = a - o, c = a / (Math.abs(s) < 1e-6 ? 1e-6 * Math.sign(s || 1) : s);
|
|
2698
2698
|
return [n * c, r * c];
|
|
2699
2699
|
});
|
|
2700
2700
|
} else u = s.map(([e, t]) => {
|
|
2701
|
-
let [n, r] =
|
|
2701
|
+
let [n, r] = lt(i, e, t, 0);
|
|
2702
2702
|
return [n, r];
|
|
2703
2703
|
});
|
|
2704
2704
|
u = u.map(([e, t]) => [e * c, t * c]);
|
|
@@ -2721,18 +2721,18 @@ function st(e, t, n) {
|
|
|
2721
2721
|
isIdentity: _
|
|
2722
2722
|
};
|
|
2723
2723
|
}
|
|
2724
|
-
function
|
|
2725
|
-
let { isIdentity: t } =
|
|
2724
|
+
function pt(e) {
|
|
2725
|
+
let { isIdentity: t } = ft(e, 1e3, 1e3);
|
|
2726
2726
|
return !t;
|
|
2727
2727
|
}
|
|
2728
|
-
function
|
|
2729
|
-
let i =
|
|
2728
|
+
function mt(e, t, n, r) {
|
|
2729
|
+
let i = dt(e.prst), a = ut(i, e.rot);
|
|
2730
2730
|
if (t <= 0 || n <= 0 || r === 0) return {
|
|
2731
2731
|
x: 0,
|
|
2732
2732
|
y: 0
|
|
2733
2733
|
};
|
|
2734
2734
|
let o = t / 2, s = n / 2, c = Math.max(o, s), l = e.zoom ?? 1, u = (t) => {
|
|
2735
|
-
let [n, r, o] =
|
|
2735
|
+
let [n, r, o] = lt(a, 0, 0, t);
|
|
2736
2736
|
if (i.kind === "perspective") {
|
|
2737
2737
|
let t = e.fov ?? i.fovDeg, a = Math.max(1, Math.min(179, t)) * Math.PI / 180, s = c / Math.tan(a / 2), u = s - o, d = s / (Math.abs(u) < 1e-6 ? 1e-6 * Math.sign(u || 1) : u);
|
|
2738
2738
|
return [n * d * l, r * d * l];
|
|
@@ -2746,12 +2746,12 @@ function lt(e, t, n, r) {
|
|
|
2746
2746
|
}
|
|
2747
2747
|
//#endregion
|
|
2748
2748
|
//#region packages/core/src/shape/bevel-shading.ts
|
|
2749
|
-
function
|
|
2749
|
+
function ht(e, t) {
|
|
2750
2750
|
if (t <= 0) return () => 1;
|
|
2751
2751
|
let n = (e) => Math.max(0, Math.min(1, e / t));
|
|
2752
2752
|
switch (e) {
|
|
2753
2753
|
case "hardEdge": {
|
|
2754
|
-
let e =
|
|
2754
|
+
let e = Ct;
|
|
2755
2755
|
return (t) => {
|
|
2756
2756
|
let r = Math.min(1, n(t) / e);
|
|
2757
2757
|
return r * r * (3 - 2 * r);
|
|
@@ -2771,7 +2771,7 @@ function ut(e, t) {
|
|
|
2771
2771
|
};
|
|
2772
2772
|
}
|
|
2773
2773
|
}
|
|
2774
|
-
function
|
|
2774
|
+
function gt(e) {
|
|
2775
2775
|
let t = e.length, n = new Float64Array(t);
|
|
2776
2776
|
if (t === 0) return n;
|
|
2777
2777
|
let r = new Int32Array(t), i = new Float64Array(t + 1), a = 0;
|
|
@@ -2789,7 +2789,7 @@ function dt(e) {
|
|
|
2789
2789
|
}
|
|
2790
2790
|
return n;
|
|
2791
2791
|
}
|
|
2792
|
-
function
|
|
2792
|
+
function _t(e, t = 3) {
|
|
2793
2793
|
if (e <= 0) return Array(t).fill(1);
|
|
2794
2794
|
let n = Math.sqrt(12 * e * e / t + 1), r = Math.floor(n);
|
|
2795
2795
|
r % 2 == 0 && r--;
|
|
@@ -2797,7 +2797,7 @@ function ft(e, t = 3) {
|
|
|
2797
2797
|
for (let e = 0; e < t; e++) s.push(e < o ? r : i);
|
|
2798
2798
|
return s;
|
|
2799
2799
|
}
|
|
2800
|
-
function
|
|
2800
|
+
function vt(e, t, n, r, i, a) {
|
|
2801
2801
|
let o = 1 / (2 * i + 1);
|
|
2802
2802
|
if (a) for (let a = 0; a < r; a++) {
|
|
2803
2803
|
let r = a * n, s = 0;
|
|
@@ -2818,29 +2818,29 @@ function pt(e, t, n, r, i, a) {
|
|
|
2818
2818
|
}
|
|
2819
2819
|
}
|
|
2820
2820
|
}
|
|
2821
|
-
function
|
|
2821
|
+
function yt(e, t, n, r) {
|
|
2822
2822
|
let i = Float64Array.from(e);
|
|
2823
2823
|
if (r <= 0 || t <= 0 || n <= 0) return i;
|
|
2824
2824
|
let a = new Float64Array(t * n);
|
|
2825
|
-
for (let e of
|
|
2825
|
+
for (let e of _t(r, 3)) {
|
|
2826
2826
|
let r = Math.max(1, (e - 1) / 2);
|
|
2827
|
-
|
|
2827
|
+
vt(i, a, t, n, r, !0), vt(a, i, t, n, r, !1);
|
|
2828
2828
|
}
|
|
2829
2829
|
return i;
|
|
2830
2830
|
}
|
|
2831
|
-
function
|
|
2831
|
+
function bt(e, t, n, r = 128) {
|
|
2832
2832
|
let i = new Float64Array(t * n);
|
|
2833
2833
|
for (let a = 0; a < t * n; a++) i[a] = (e[a] ?? 0) >= r ? 0x56bc75e2d63100000 : 0;
|
|
2834
2834
|
let a = new Float64Array(n);
|
|
2835
2835
|
for (let e = 0; e < t; e++) {
|
|
2836
2836
|
for (let r = 0; r < n; r++) a[r] = i[r * t + e];
|
|
2837
|
-
let r =
|
|
2837
|
+
let r = gt(a);
|
|
2838
2838
|
for (let a = 0; a < n; a++) i[a * t + e] = r[a];
|
|
2839
2839
|
}
|
|
2840
2840
|
let o = new Float64Array(t);
|
|
2841
2841
|
for (let e = 0; e < n; e++) {
|
|
2842
2842
|
for (let n = 0; n < t; n++) o[n] = i[e * t + n];
|
|
2843
|
-
let n =
|
|
2843
|
+
let n = gt(o);
|
|
2844
2844
|
for (let r = 0; r < t; r++) i[e * t + r] = n[r];
|
|
2845
2845
|
}
|
|
2846
2846
|
for (let e = 0; e < n; e++) for (let r = 0; r < t; r++) {
|
|
@@ -2852,15 +2852,15 @@ function ht(e, t, n, r = 128) {
|
|
|
2852
2852
|
for (let e = 0; e < t * n; e++) i[e] = Math.sqrt(i[e]);
|
|
2853
2853
|
return i;
|
|
2854
2854
|
}
|
|
2855
|
-
var
|
|
2856
|
-
function
|
|
2855
|
+
var xt = .25, St = .35, Ct = .5;
|
|
2856
|
+
function wt(e, t, n, r, i, a) {
|
|
2857
2857
|
let o = new Float32Array(t * n * 3), s = new Uint8Array(t * n), c = new Float32Array(t * n);
|
|
2858
2858
|
if (t <= 0 || n <= 0) return {
|
|
2859
2859
|
normals: o,
|
|
2860
2860
|
bandMask: s,
|
|
2861
2861
|
bandWeight: c
|
|
2862
2862
|
};
|
|
2863
|
-
let l =
|
|
2863
|
+
let l = bt(e, t, n), u = ht(i, r), d = (n, r) => (e[r * t + n] ?? 0) >= 128, f = (r > 0 ? a / r : 0) * r, p = yt(l, t, n, Math.max(1, r * xt)), m = (e) => {
|
|
2864
2864
|
let t = u(Math.max(0, e - .5));
|
|
2865
2865
|
return u(e + .5) - t;
|
|
2866
2866
|
};
|
|
@@ -2875,9 +2875,9 @@ function yt(e, t, n, r, i, a) {
|
|
|
2875
2875
|
o[a * 3 + 2] = 1;
|
|
2876
2876
|
continue;
|
|
2877
2877
|
}
|
|
2878
|
-
let g = u / r, _ = 1 -
|
|
2878
|
+
let g = u / r, _ = 1 - St, v = 1;
|
|
2879
2879
|
if (g > _) {
|
|
2880
|
-
let e = Math.min(1, (g - _) /
|
|
2880
|
+
let e = Math.min(1, (g - _) / St);
|
|
2881
2881
|
v = 1 - e * e * (3 - 2 * e);
|
|
2882
2882
|
}
|
|
2883
2883
|
c[a] = v;
|
|
@@ -2892,7 +2892,7 @@ function yt(e, t, n, r, i, a) {
|
|
|
2892
2892
|
bandWeight: c
|
|
2893
2893
|
};
|
|
2894
2894
|
}
|
|
2895
|
-
var
|
|
2895
|
+
var Tt = 35 * Math.PI / 180, Et = 12 * Math.PI / 180, Dt = {
|
|
2896
2896
|
t: {
|
|
2897
2897
|
x: 0,
|
|
2898
2898
|
y: -1
|
|
@@ -2926,22 +2926,22 @@ var bt = 35 * Math.PI / 180, xt = 12 * Math.PI / 180, St = {
|
|
|
2926
2926
|
y: 1
|
|
2927
2927
|
}
|
|
2928
2928
|
};
|
|
2929
|
-
function
|
|
2929
|
+
function Ot(e, t, n) {
|
|
2930
2930
|
let r = n * Math.PI / 180, i = Math.cos(r), a = Math.sin(r);
|
|
2931
2931
|
return {
|
|
2932
2932
|
x: e * i - t * a,
|
|
2933
2933
|
y: e * a + t * i
|
|
2934
2934
|
};
|
|
2935
2935
|
}
|
|
2936
|
-
function
|
|
2937
|
-
let r =
|
|
2938
|
-
return n && n.rev && (r =
|
|
2936
|
+
function kt(e, t, n) {
|
|
2937
|
+
let r = Dt[t] ?? Dt.t;
|
|
2938
|
+
return n && n.rev && (r = Ot(r.x, r.y, n.rev)), jt(r.x, r.y, Tt);
|
|
2939
2939
|
}
|
|
2940
|
-
function
|
|
2940
|
+
function At(e) {
|
|
2941
2941
|
let t = Math.hypot(e.x, e.y) || 1;
|
|
2942
|
-
return
|
|
2942
|
+
return jt(-e.x / t, -e.y / t, Et);
|
|
2943
2943
|
}
|
|
2944
|
-
function
|
|
2944
|
+
function jt(e, t, n) {
|
|
2945
2945
|
let r = Math.hypot(e, t) || 1, i = Math.cos(n), a = Math.sin(n), o = e / r * i, s = t / r * i, c = a, l = Math.hypot(o, s, c) || 1;
|
|
2946
2946
|
return {
|
|
2947
2947
|
x: o / l,
|
|
@@ -2949,7 +2949,7 @@ function Et(e, t, n) {
|
|
|
2949
2949
|
z: c / l
|
|
2950
2950
|
};
|
|
2951
2951
|
}
|
|
2952
|
-
var
|
|
2952
|
+
var Mt = 2, Nt = {
|
|
2953
2953
|
matte: {
|
|
2954
2954
|
ambient: .62,
|
|
2955
2955
|
diffuse: .45,
|
|
@@ -2962,8 +2962,8 @@ var Dt = 2, Ot = {
|
|
|
2962
2962
|
specular: .35,
|
|
2963
2963
|
shininess: 22
|
|
2964
2964
|
}
|
|
2965
|
-
},
|
|
2966
|
-
function
|
|
2965
|
+
}, Pt = .8;
|
|
2966
|
+
function Ft(e) {
|
|
2967
2967
|
switch (e) {
|
|
2968
2968
|
case "plastic":
|
|
2969
2969
|
case "metal":
|
|
@@ -2974,8 +2974,8 @@ function At(e) {
|
|
|
2974
2974
|
default: return "matte";
|
|
2975
2975
|
}
|
|
2976
2976
|
}
|
|
2977
|
-
function
|
|
2978
|
-
let r =
|
|
2977
|
+
function It(e, t, n = !0) {
|
|
2978
|
+
let r = Nt[e], i = {
|
|
2979
2979
|
light: t,
|
|
2980
2980
|
material: e,
|
|
2981
2981
|
ambient: r.ambient,
|
|
@@ -2983,9 +2983,9 @@ function jt(e, t, n = !0) {
|
|
|
2983
2983
|
specular: r.specular,
|
|
2984
2984
|
shininess: r.shininess
|
|
2985
2985
|
};
|
|
2986
|
-
return n && (i.fillLight =
|
|
2986
|
+
return n && (i.fillLight = At(t), i.fillDiffuse = i.diffuse * Pt), i;
|
|
2987
2987
|
}
|
|
2988
|
-
function
|
|
2988
|
+
function Lt(e, t) {
|
|
2989
2989
|
let n = e.x * t.light.x + e.y * t.light.y + e.z * t.light.z, r = t.diffuse * Math.max(0, n), i = 0;
|
|
2990
2990
|
if (t.fillLight && t.fillDiffuse) {
|
|
2991
2991
|
let n = e.x * t.fillLight.x + e.y * t.fillLight.y + e.z * t.fillLight.z;
|
|
@@ -2998,7 +2998,7 @@ function Mt(e, t) {
|
|
|
2998
2998
|
}
|
|
2999
2999
|
return Math.max(0, t.ambient + r + i + a);
|
|
3000
3000
|
}
|
|
3001
|
-
function
|
|
3001
|
+
function Rt(e, t, n) {
|
|
3002
3002
|
if (!e) return {
|
|
3003
3003
|
x: 0,
|
|
3004
3004
|
y: 0,
|
|
@@ -3013,16 +3013,16 @@ function Nt(e, t, n) {
|
|
|
3013
3013
|
h: Math.max(0, o - i)
|
|
3014
3014
|
};
|
|
3015
3015
|
}
|
|
3016
|
-
function
|
|
3016
|
+
function zt(e, t, n) {
|
|
3017
3017
|
let r = e.canvas.width, i = e.canvas.height;
|
|
3018
3018
|
if (r <= 0 || i <= 0) return;
|
|
3019
3019
|
let a = t.widthPx;
|
|
3020
3020
|
if (a < .75) return;
|
|
3021
|
-
let { x: o, y: s, w: c, h: l } =
|
|
3021
|
+
let { x: o, y: s, w: c, h: l } = Rt(n, r, i);
|
|
3022
3022
|
if (c <= 0 || l <= 0) return;
|
|
3023
3023
|
let u = e.getImageData(o, s, c, l), d = u.data, f = new Uint8ClampedArray(c * l);
|
|
3024
3024
|
for (let e = 0; e < c * l; e++) f[e] = d[e * 4 + 3];
|
|
3025
|
-
let { bandMask: p, bandWeight: m, normals: h } =
|
|
3025
|
+
let { bandMask: p, bandWeight: m, normals: h } = wt(f, c, l, a, t.prst, t.heightPx), g = It(t.material, t.light), _ = Lt({
|
|
3026
3026
|
x: 0,
|
|
3027
3027
|
y: 0,
|
|
3028
3028
|
z: 1
|
|
@@ -3033,13 +3033,13 @@ function Pt(e, t, n) {
|
|
|
3033
3033
|
if (n <= 0) continue;
|
|
3034
3034
|
let r = h[e * 3], i = h[e * 3 + 1], a = h[e * 3 + 2];
|
|
3035
3035
|
t.bottom && (r = -r, i = -i);
|
|
3036
|
-
let o = 1 + (
|
|
3036
|
+
let o = 1 + (Lt({
|
|
3037
3037
|
x: r,
|
|
3038
3038
|
y: i,
|
|
3039
3039
|
z: a
|
|
3040
3040
|
}, g) / _ - 1) * n, s = e * 4;
|
|
3041
3041
|
if (o >= 1) {
|
|
3042
|
-
let e = Math.min(1, (o - 1) *
|
|
3042
|
+
let e = Math.min(1, (o - 1) * Mt);
|
|
3043
3043
|
for (let t = 0; t < 3; t++) {
|
|
3044
3044
|
let n = Math.min(255, d[s + t] * o);
|
|
3045
3045
|
d[s + t] = n + (255 - n) * e;
|
|
@@ -3048,12 +3048,12 @@ function Pt(e, t, n) {
|
|
|
3048
3048
|
}
|
|
3049
3049
|
e.putImageData(u, o, s);
|
|
3050
3050
|
}
|
|
3051
|
-
function
|
|
3051
|
+
function Bt(e, t, n) {
|
|
3052
3052
|
let r = e.canvas.width, i = e.canvas.height;
|
|
3053
3053
|
if (r <= 0 || i <= 0) return;
|
|
3054
3054
|
let a = t.offsetX, o = t.offsetY, s = Math.hypot(a, o);
|
|
3055
3055
|
if (s < .75) return;
|
|
3056
|
-
let { x: c, y: l, w: u, h: d } =
|
|
3056
|
+
let { x: c, y: l, w: u, h: d } = Rt(n, r, i);
|
|
3057
3057
|
if (u <= 0 || d <= 0) return;
|
|
3058
3058
|
let f = e.getImageData(c, l, u, d), p = f.data, m = new Uint8ClampedArray(u * d);
|
|
3059
3059
|
for (let e = 0; e < u * d; e++) m[e] = p[e * 4 + 3];
|
|
@@ -3077,36 +3077,36 @@ function Ft(e, t, n) {
|
|
|
3077
3077
|
}
|
|
3078
3078
|
//#endregion
|
|
3079
3079
|
//#region packages/core/src/text/underline.ts
|
|
3080
|
-
function
|
|
3081
|
-
let
|
|
3082
|
-
if (
|
|
3083
|
-
let
|
|
3084
|
-
|
|
3085
|
-
let a = Math.max(1,
|
|
3086
|
-
for (let o = 0; o <=
|
|
3087
|
-
let
|
|
3088
|
-
|
|
3080
|
+
function Vt(t, n, r, i, a, o, s, c = 1) {
|
|
3081
|
+
let l = Math.max(1, a * .05), u = s === "heavy" || (s?.endsWith("Heavy") ?? !1) ? l * 1.8 : l, d = r + Math.max(2, u), f = e(d, u, c);
|
|
3082
|
+
if (t.strokeStyle = o, t.lineWidth = u, t.setLineDash([]), s && s.startsWith("wavy")) {
|
|
3083
|
+
let e = u, r = u * 6;
|
|
3084
|
+
t.beginPath(), t.moveTo(n, d);
|
|
3085
|
+
let a = Math.max(1, u * .5);
|
|
3086
|
+
for (let o = 0; o <= i; o += a) {
|
|
3087
|
+
let i = d + Math.sin(o / r * Math.PI * 2) * e;
|
|
3088
|
+
t.lineTo(n + o, i);
|
|
3089
3089
|
}
|
|
3090
|
-
if (
|
|
3091
|
-
|
|
3092
|
-
for (let o = 0; o <=
|
|
3093
|
-
let
|
|
3094
|
-
|
|
3090
|
+
if (t.stroke(), s === "wavyDbl") {
|
|
3091
|
+
t.beginPath(), t.moveTo(n, d + e * 2.5);
|
|
3092
|
+
for (let o = 0; o <= i; o += a) {
|
|
3093
|
+
let i = d + e * 2.5 + Math.sin(o / r * Math.PI * 2) * e;
|
|
3094
|
+
t.lineTo(n + o, i);
|
|
3095
3095
|
}
|
|
3096
|
-
|
|
3096
|
+
t.stroke();
|
|
3097
3097
|
}
|
|
3098
3098
|
return;
|
|
3099
3099
|
}
|
|
3100
|
-
if (
|
|
3101
|
-
let
|
|
3102
|
-
|
|
3100
|
+
if (s === "dbl") {
|
|
3101
|
+
let r = u * 1.4, a = d - r / 2, o = d + r / 2;
|
|
3102
|
+
t.beginPath(), t.moveTo(n, a + e(a, u, c)), t.lineTo(n + i, a + e(a, u, c)), t.moveTo(n, o + e(o, u, c)), t.lineTo(n + i, o + e(o, u, c)), t.stroke();
|
|
3103
3103
|
return;
|
|
3104
3104
|
}
|
|
3105
|
-
|
|
3105
|
+
t.setLineDash(ye(s ?? "sng", u)), t.beginPath(), t.moveTo(n, d + f), t.lineTo(n + i, d + f), t.stroke(), t.setLineDash([]);
|
|
3106
3106
|
}
|
|
3107
3107
|
//#endregion
|
|
3108
3108
|
//#region packages/core/src/text/highlight-box.ts
|
|
3109
|
-
function
|
|
3109
|
+
function Ht(e, t) {
|
|
3110
3110
|
return {
|
|
3111
3111
|
top: e - t * .85,
|
|
3112
3112
|
height: t * 1.1
|
|
@@ -3114,7 +3114,7 @@ function Lt(e, t) {
|
|
|
3114
3114
|
}
|
|
3115
3115
|
//#endregion
|
|
3116
3116
|
//#region packages/core/src/text/justify-positions.ts
|
|
3117
|
-
function
|
|
3117
|
+
function Ut(e, t, n, r, i = 0) {
|
|
3118
3118
|
let a = [], o = 0, s = 0;
|
|
3119
3119
|
for (let c of t) a.push({
|
|
3120
3120
|
text: e.slice(o, c).join(""),
|
|
@@ -3127,14 +3127,14 @@ function Rt(e, t, n, r, i = 0) {
|
|
|
3127
3127
|
}
|
|
3128
3128
|
//#endregion
|
|
3129
3129
|
//#region packages/pptx/src/reflection-blur.ts
|
|
3130
|
-
var
|
|
3131
|
-
function
|
|
3130
|
+
var Wt = .5;
|
|
3131
|
+
function Gt(e, t) {
|
|
3132
3132
|
if (!(t > 0) || !(e.h > 0)) return [{
|
|
3133
3133
|
y: e.y,
|
|
3134
3134
|
h: Math.max(0, e.h),
|
|
3135
3135
|
radius: 0
|
|
3136
3136
|
}];
|
|
3137
|
-
let n = Math.max(4, Math.min(24, Math.ceil(t /
|
|
3137
|
+
let n = Math.max(4, Math.min(24, Math.ceil(t / Wt) + 1)), r = e.y + e.h, i = [];
|
|
3138
3138
|
for (let a = 0; a < n; a++) {
|
|
3139
3139
|
let o = Math.sqrt(a / (n - 1)), s = a === 0 ? 0 : Math.sqrt((a - 1) / (n - 1)), c = a === n - 1 ? 1 : Math.sqrt((a + 1) / (n - 1)), l = a === 0 ? 0 : (s + o) / 2, u = a === n - 1 ? 1 : (o + c) / 2, d = r - u * e.h;
|
|
3140
3140
|
i.push({
|
|
@@ -3145,19 +3145,19 @@ function Bt(e, t) {
|
|
|
3145
3145
|
}
|
|
3146
3146
|
return i;
|
|
3147
3147
|
}
|
|
3148
|
-
function
|
|
3149
|
-
for (let a of
|
|
3148
|
+
function Kt(e, t, n, r, i) {
|
|
3149
|
+
for (let a of Gt(n, r)) e.save(), e.beginPath(), e.rect(0, a.y, i, a.h), e.clip(), e.filter = a.radius > 0 ? `blur(${a.radius}px)` : "none", e.drawImage(t, 0, 0), e.restore();
|
|
3150
3150
|
}
|
|
3151
3151
|
//#endregion
|
|
3152
3152
|
//#region packages/pptx/src/hyperlink.ts
|
|
3153
|
-
function
|
|
3153
|
+
function qt(e, t) {
|
|
3154
3154
|
let n = e !== void 0 && e !== "" ? e : void 0, r = t !== void 0 && t !== "" ? t : void 0;
|
|
3155
3155
|
if (n === void 0 && r === void 0) return;
|
|
3156
3156
|
if (r !== void 0) return {
|
|
3157
3157
|
kind: "internal",
|
|
3158
3158
|
ref: n ?? r
|
|
3159
3159
|
};
|
|
3160
|
-
let i = n, a =
|
|
3160
|
+
let i = n, a = M(i);
|
|
3161
3161
|
return a !== null && U.includes(a) ? {
|
|
3162
3162
|
kind: "external",
|
|
3163
3163
|
url: i
|
|
@@ -3168,7 +3168,7 @@ function Ht(e, t) {
|
|
|
3168
3168
|
}
|
|
3169
3169
|
//#endregion
|
|
3170
3170
|
//#region packages/pptx/src/media-chrome.ts
|
|
3171
|
-
function
|
|
3171
|
+
function Jt(e, t, n, r, i, a) {
|
|
3172
3172
|
let o = Math.max(18, Math.min(32, Math.min(r, i) * .25));
|
|
3173
3173
|
if (e.save(), e.shadowColor = "rgba(0, 0, 0, 0.3)", e.shadowBlur = o * .35, e.fillStyle = "rgba(20, 20, 20, 0.7)", e.beginPath(), e.arc(t, n, o, 0, Math.PI * 2), e.fill(), e.shadowColor = "transparent", e.shadowBlur = 0, e.fillStyle = "#fff", a === "paused") {
|
|
3174
3174
|
e.beginPath();
|
|
@@ -3182,47 +3182,47 @@ function Ut(e, t, n, r, i, a) {
|
|
|
3182
3182
|
}
|
|
3183
3183
|
//#endregion
|
|
3184
3184
|
//#region packages/pptx/src/bidi-line.ts
|
|
3185
|
-
var
|
|
3185
|
+
var Yt = (e) => {
|
|
3186
3186
|
let t = e.text;
|
|
3187
3187
|
return typeof t == "string" ? t : void 0;
|
|
3188
|
-
},
|
|
3189
|
-
function
|
|
3188
|
+
}, Xt = (e) => "isTab" in e;
|
|
3189
|
+
function Zt(e) {
|
|
3190
3190
|
for (let t of e) {
|
|
3191
|
-
let e =
|
|
3192
|
-
if (e !== void 0 &&
|
|
3191
|
+
let e = Yt(t);
|
|
3192
|
+
if (e !== void 0 && P(e)) return !0;
|
|
3193
3193
|
}
|
|
3194
3194
|
return !1;
|
|
3195
3195
|
}
|
|
3196
|
-
function
|
|
3197
|
-
let r =
|
|
3196
|
+
function Qt(e, n) {
|
|
3197
|
+
let r = e.length;
|
|
3198
3198
|
if (r === 0) return {
|
|
3199
3199
|
order: [],
|
|
3200
3200
|
rtl: []
|
|
3201
3201
|
};
|
|
3202
3202
|
let i = "", a = Array(r), o;
|
|
3203
|
-
for (let
|
|
3204
|
-
a[
|
|
3205
|
-
let n =
|
|
3206
|
-
if (i += n.length > 0 ? n : "",
|
|
3203
|
+
for (let t = 0; t < r; t++) {
|
|
3204
|
+
a[t] = i.length;
|
|
3205
|
+
let n = Yt(e[t]) ?? "";
|
|
3206
|
+
if (i += n.length > 0 ? n : "", Xt(e[t])) {
|
|
3207
3207
|
for (o ??= []; o.length < i.length;) o.push(null);
|
|
3208
|
-
o[a[
|
|
3208
|
+
o[a[t]] = "S";
|
|
3209
3209
|
}
|
|
3210
3210
|
}
|
|
3211
3211
|
if (o) for (; o.length < i.length;) o.push(null);
|
|
3212
|
-
let { levels: s, paragraphLevel: c } =
|
|
3213
|
-
for (let e = 0; e < r; e++)
|
|
3212
|
+
let { levels: s, paragraphLevel: c } = u().computeLevels(i, n ? "rtl" : "ltr", o), { order: l, segLevels: d } = t(s, c, a), f = Array(r);
|
|
3213
|
+
for (let e = 0; e < r; e++) f[e] = (d[e] & 1) == 1;
|
|
3214
3214
|
return {
|
|
3215
3215
|
order: l,
|
|
3216
|
-
rtl:
|
|
3216
|
+
rtl: f
|
|
3217
3217
|
};
|
|
3218
3218
|
}
|
|
3219
3219
|
//#endregion
|
|
3220
3220
|
//#region packages/pptx/src/cjk-wrap.ts
|
|
3221
|
-
function
|
|
3221
|
+
function $t(e, t, n, r, i = 0, a = !1) {
|
|
3222
3222
|
if (e.length === 0) return 0;
|
|
3223
3223
|
let s = t === 0, c = 0, l = t;
|
|
3224
3224
|
for (let t of e) {
|
|
3225
|
-
let e = c > 0 ||
|
|
3225
|
+
let e = c > 0 || a ? i : 0;
|
|
3226
3226
|
if (l + e + t.w > n) {
|
|
3227
3227
|
if (c > 0 || !s) break;
|
|
3228
3228
|
l += e + t.w, c++;
|
|
@@ -3230,20 +3230,20 @@ function Jt(e, t, n, r, a = 0, o = !1) {
|
|
|
3230
3230
|
}
|
|
3231
3231
|
l += e + t.w, c++;
|
|
3232
3232
|
}
|
|
3233
|
-
return c === 0 ? 0 : c >= e.length ? e.length :
|
|
3233
|
+
return c === 0 ? 0 : c >= e.length ? e.length : o(e.map((e) => e.ch), c, r, +!!s);
|
|
3234
3234
|
}
|
|
3235
3235
|
//#endregion
|
|
3236
3236
|
//#region packages/pptx/src/text-justify.ts
|
|
3237
|
-
var
|
|
3238
|
-
function
|
|
3237
|
+
var en = (e) => /\s/.test(String.fromCodePoint(e));
|
|
3238
|
+
function tn(e, t, n, r, i) {
|
|
3239
3239
|
if (r === "just" && i) return null;
|
|
3240
3240
|
let a = t - n;
|
|
3241
3241
|
if (a <= .5) return null;
|
|
3242
|
-
let o =
|
|
3242
|
+
let o = _e(e, a, {
|
|
3243
3243
|
firstContentSi: 0,
|
|
3244
3244
|
lastDrawnSi: e.length,
|
|
3245
|
-
isGapChar:
|
|
3246
|
-
isWhitespace:
|
|
3245
|
+
isGapChar: re,
|
|
3246
|
+
isWhitespace: en,
|
|
3247
3247
|
seaClusterGaps: r === "thaiDist"
|
|
3248
3248
|
});
|
|
3249
3249
|
if (!o) return null;
|
|
@@ -3264,7 +3264,7 @@ function Xt(e, t, n, r, i) {
|
|
|
3264
3264
|
}
|
|
3265
3265
|
//#endregion
|
|
3266
3266
|
//#region packages/pptx/src/table-border-conflict.ts
|
|
3267
|
-
function
|
|
3267
|
+
function nn(e) {
|
|
3268
3268
|
if (!e) return {
|
|
3269
3269
|
r: 0,
|
|
3270
3270
|
g: 0,
|
|
@@ -3281,37 +3281,37 @@ function Zt(e) {
|
|
|
3281
3281
|
b: parseInt(t.slice(4, 6), 16)
|
|
3282
3282
|
};
|
|
3283
3283
|
}
|
|
3284
|
-
function
|
|
3285
|
-
let t =
|
|
3284
|
+
function rn(e) {
|
|
3285
|
+
let t = nn(e);
|
|
3286
3286
|
return .299 * t.r + .587 * t.g + .114 * t.b;
|
|
3287
3287
|
}
|
|
3288
|
-
function
|
|
3288
|
+
function an(e, t) {
|
|
3289
3289
|
if (!e && !t) return null;
|
|
3290
3290
|
if (!e) return t;
|
|
3291
3291
|
if (!t) return e;
|
|
3292
3292
|
if (e.width !== t.width) return e.width > t.width ? e : t;
|
|
3293
|
-
let n =
|
|
3293
|
+
let n = rn(e.color), r = rn(t.color);
|
|
3294
3294
|
return n === r || n < r ? e : t;
|
|
3295
3295
|
}
|
|
3296
3296
|
//#endregion
|
|
3297
3297
|
//#region packages/pptx/src/smartart-fallback-contrast.ts
|
|
3298
|
-
function
|
|
3299
|
-
let t =
|
|
3298
|
+
function on(e) {
|
|
3299
|
+
let t = te(e.length === 8 ? e.slice(0, 6) : e);
|
|
3300
3300
|
if (!t) return null;
|
|
3301
|
-
let n =
|
|
3301
|
+
let n = w(t[0], t[1], t[2]);
|
|
3302
3302
|
if (e.length !== 8) return n;
|
|
3303
3303
|
let r = Number.parseInt(e.slice(6, 8), 16);
|
|
3304
3304
|
if (Number.isNaN(r)) return null;
|
|
3305
3305
|
let i = r / 255;
|
|
3306
3306
|
return i * n + (1 - i);
|
|
3307
3307
|
}
|
|
3308
|
-
function
|
|
3308
|
+
function sn(e) {
|
|
3309
3309
|
if (!e) return null;
|
|
3310
|
-
if (e.fillType === "solid") return
|
|
3310
|
+
if (e.fillType === "solid") return on(e.color);
|
|
3311
3311
|
if (e.fillType === "gradient") {
|
|
3312
3312
|
let t = e.stops.map((e) => ({
|
|
3313
3313
|
p: Math.min(1, Math.max(0, e.position)),
|
|
3314
|
-
l:
|
|
3314
|
+
l: on(e.color)
|
|
3315
3315
|
})).filter((e) => e.l !== null).sort((e, t) => e.p - t.p);
|
|
3316
3316
|
if (t.length === 0) return null;
|
|
3317
3317
|
let n = t[0], r = t[t.length - 1], i = n.l * n.p + r.l * (1 - r.p);
|
|
@@ -3320,18 +3320,18 @@ function tn(e) {
|
|
|
3320
3320
|
}
|
|
3321
3321
|
return null;
|
|
3322
3322
|
}
|
|
3323
|
-
function
|
|
3323
|
+
function cn(e) {
|
|
3324
3324
|
return e.name === "SmartArt" && e.id === void 0;
|
|
3325
3325
|
}
|
|
3326
|
-
function
|
|
3327
|
-
let n =
|
|
3326
|
+
function ln(e, t) {
|
|
3327
|
+
let n = sn(e);
|
|
3328
3328
|
if (n === null || n >= .5) return null;
|
|
3329
|
-
let r =
|
|
3329
|
+
let r = on(t.replace(/^#/, ""));
|
|
3330
3330
|
return r !== null && r >= .5 ? null : "#FFFFFF";
|
|
3331
3331
|
}
|
|
3332
3332
|
//#endregion
|
|
3333
3333
|
//#region packages/pptx/src/tab-layout.ts
|
|
3334
|
-
function
|
|
3334
|
+
function un(e, t, n, r, i, a = 0) {
|
|
3335
3335
|
let o = e.map((e) => e.width), s = (t) => {
|
|
3336
3336
|
let n = 0;
|
|
3337
3337
|
for (let r = t; r < e.length && !e[r].isTab; r++) n += o[r];
|
|
@@ -3359,8 +3359,8 @@ function an(e, t, n, r, i, a = 0) {
|
|
|
3359
3359
|
}
|
|
3360
3360
|
//#endregion
|
|
3361
3361
|
//#region packages/pptx/src/vertical-text.ts
|
|
3362
|
-
var
|
|
3363
|
-
function
|
|
3362
|
+
var dn = () => !1;
|
|
3363
|
+
function fn(e, t, n) {
|
|
3364
3364
|
let r = e.textBaseline;
|
|
3365
3365
|
e.textBaseline = "alphabetic";
|
|
3366
3366
|
let i = e.measureText(t);
|
|
@@ -3368,7 +3368,7 @@ function sn(e, t, n) {
|
|
|
3368
3368
|
let a = i.fontBoundingBoxAscent, o = i.fontBoundingBoxDescent;
|
|
3369
3369
|
return typeof a == "number" && typeof o == "number" && (a !== 0 || o !== 0) ? (a - o) / 2 : .38 * n;
|
|
3370
3370
|
}
|
|
3371
|
-
function
|
|
3371
|
+
function pn(e, t) {
|
|
3372
3372
|
let n = e.textAlign, r = e.textBaseline;
|
|
3373
3373
|
e.textAlign = "center", e.textBaseline = "middle";
|
|
3374
3374
|
let i = e.measureText(t);
|
|
@@ -3376,15 +3376,15 @@ function cn(e, t) {
|
|
|
3376
3376
|
let a = i.actualBoundingBoxAscent, o = i.actualBoundingBoxDescent;
|
|
3377
3377
|
return typeof a == "number" && typeof o == "number" ? (a - o) / 2 : 0;
|
|
3378
3378
|
}
|
|
3379
|
-
function
|
|
3380
|
-
let c = e.textAlign, l = e.textBaseline, u = o === "stroke" ? e.strokeText.bind(e) : e.fillText.bind(e), d = r -
|
|
3379
|
+
function mn(e, t, n, r, i, a, o = "fill", s = dn) {
|
|
3380
|
+
let c = e.textAlign, l = e.textBaseline, u = o === "stroke" ? e.strokeText.bind(e) : e.fillText.bind(e), d = r - fn(e, t, i), f = 0;
|
|
3381
3381
|
for (let o of t) {
|
|
3382
|
-
let t = o.codePointAt(0) ?? 0, l =
|
|
3383
|
-
if (
|
|
3382
|
+
let t = o.codePointAt(0) ?? 0, l = O(t), p = e.measureText(o).width + a, m = l === "Tr" ? K(t) : null, h = l === "Tr" && m === null && L(t), g = l === "U" || l === "Tu" || m !== null || h;
|
|
3383
|
+
if (V(t) && s(t)) {
|
|
3384
3384
|
let t = n + f + p / 2;
|
|
3385
|
-
e.save(), e.translate(t, d), e.rotate(-Math.PI / 2), e.textAlign = "center", e.textBaseline = "middle",
|
|
3385
|
+
e.save(), e.translate(t, d), e.rotate(-Math.PI / 2), e.textAlign = "center", e.textBaseline = "middle", C(e, () => u(o, 0, 0)), e.restore();
|
|
3386
3386
|
} else if (g) {
|
|
3387
|
-
let r = m === null && l === "Tu" ?
|
|
3387
|
+
let r = m === null && l === "Tu" ? T(t) : null, a = m === null ? r : m, s = a === null ? o : String.fromCodePoint(a), c = n + f + p / 2, h = r === null ? pn(e, s) / i : 0;
|
|
3388
3388
|
e.save(), e.translate(c, d), e.rotate(-Math.PI / 2), e.textAlign = "center", e.textBaseline = "middle", u(s, 0, h * i), e.restore();
|
|
3389
3389
|
} else if (l === "Tr") {
|
|
3390
3390
|
let t = n + f + p / 2;
|
|
@@ -3394,30 +3394,30 @@ function ln(e, t, n, r, i, a, o = "fill", s = on) {
|
|
|
3394
3394
|
}
|
|
3395
3395
|
e.textAlign = c, e.textBaseline = l;
|
|
3396
3396
|
}
|
|
3397
|
-
function
|
|
3398
|
-
|
|
3397
|
+
function hn(e, t, n, r, i, a, o = "fill") {
|
|
3398
|
+
mn(e, t, n, r, i, a, o, (t) => W(e, t));
|
|
3399
3399
|
}
|
|
3400
3400
|
//#endregion
|
|
3401
3401
|
//#region packages/pptx/src/renderer.ts
|
|
3402
3402
|
function Y(e, t) {
|
|
3403
3403
|
return e * t;
|
|
3404
3404
|
}
|
|
3405
|
-
var X =
|
|
3406
|
-
function
|
|
3407
|
-
let { top: s, height: c } =
|
|
3405
|
+
var X = be;
|
|
3406
|
+
function gn(e, t, n, r, i, a, o) {
|
|
3407
|
+
let { top: s, height: c } = Ht(n, i);
|
|
3408
3408
|
e.fillStyle = a, e.fillRect(t, s, r, c), e.fillStyle = o;
|
|
3409
3409
|
}
|
|
3410
|
-
function
|
|
3411
|
-
return
|
|
3410
|
+
function _n(e, t, n, r, i, a, o = 0) {
|
|
3411
|
+
return Oe(e, t, n, r, i, a, o);
|
|
3412
3412
|
}
|
|
3413
|
-
var
|
|
3414
|
-
function
|
|
3413
|
+
var vn = /* @__PURE__ */ new WeakMap();
|
|
3414
|
+
function yn(e, t) {
|
|
3415
3415
|
let n = e.tinted.get(t);
|
|
3416
3416
|
if (n) return n;
|
|
3417
|
-
let r =
|
|
3417
|
+
let r = ee(e.raster, t);
|
|
3418
3418
|
return e.tinted.set(t, r), r;
|
|
3419
3419
|
}
|
|
3420
|
-
function
|
|
3420
|
+
function bn(e) {
|
|
3421
3421
|
let t = [], n = (e) => {
|
|
3422
3422
|
if (e) for (let n of e.paragraphs) for (let e of n.runs) e.type === "math" && t.push({
|
|
3423
3423
|
nodes: e.nodes,
|
|
@@ -3428,13 +3428,13 @@ function hn(e) {
|
|
|
3428
3428
|
else if (t.type === "table") for (let e of t.rows) for (let t of e.cells) n(t.textBody);
|
|
3429
3429
|
return t;
|
|
3430
3430
|
}
|
|
3431
|
-
async function
|
|
3432
|
-
let n =
|
|
3431
|
+
async function xn(e, t) {
|
|
3432
|
+
let n = bn(e);
|
|
3433
3433
|
if (n.length !== 0) {
|
|
3434
3434
|
await t.loadMathJax();
|
|
3435
|
-
for (let e of n) if (!
|
|
3436
|
-
let n = await t.mathMLToSvg(
|
|
3437
|
-
|
|
3435
|
+
for (let e of n) if (!vn.has(e.nodes)) try {
|
|
3436
|
+
let n = await t.mathMLToSvg(N(e.nodes, e.display)), r = await B(n, "#000000");
|
|
3437
|
+
vn.set(e.nodes, {
|
|
3438
3438
|
raster: r,
|
|
3439
3439
|
widthEm: n.widthEm,
|
|
3440
3440
|
ascentEm: n.ascentEm,
|
|
@@ -3444,10 +3444,14 @@ async function gn(e, t) {
|
|
|
3444
3444
|
} catch {}
|
|
3445
3445
|
}
|
|
3446
3446
|
}
|
|
3447
|
-
function
|
|
3448
|
-
|
|
3447
|
+
function Sn(e, t) {
|
|
3448
|
+
let n = (e) => t.embeddedFontAliases?.get(e.trim().toLowerCase()) ?? e;
|
|
3449
|
+
if (!e) return n(t.themeMinorFont ?? "sans-serif");
|
|
3450
|
+
if (e.startsWith("+")) return n(e === "+mj-lt" || e === "+mj-ea" || e === "+mj-cs" ? t.themeMajorFont ?? "sans-serif" : t.themeMinorFont ?? "sans-serif");
|
|
3451
|
+
let r = e.split(",")[0].trim();
|
|
3452
|
+
return r ? n(r) : t.themeMinorFont ?? "sans-serif";
|
|
3449
3453
|
}
|
|
3450
|
-
var
|
|
3454
|
+
var Cn = new Set([
|
|
3451
3455
|
"serif",
|
|
3452
3456
|
"sans-serif",
|
|
3453
3457
|
"monospace",
|
|
@@ -3455,11 +3459,11 @@ var vn = new Set([
|
|
|
3455
3459
|
"fantasy",
|
|
3456
3460
|
"system-ui"
|
|
3457
3461
|
]);
|
|
3458
|
-
function
|
|
3459
|
-
let t =
|
|
3462
|
+
function wn(e) {
|
|
3463
|
+
let t = d(e);
|
|
3460
3464
|
return t === "mono" ? "monospace" : t === "serif" ? "serif" : "sans-serif";
|
|
3461
3465
|
}
|
|
3462
|
-
var
|
|
3466
|
+
var Tn = {
|
|
3463
3467
|
calibri: "Carlito",
|
|
3464
3468
|
"calibri light": "Carlito",
|
|
3465
3469
|
cambria: "Caladea",
|
|
@@ -3471,38 +3475,38 @@ var bn = {
|
|
|
3471
3475
|
"simplified arabic": "Noto Naskh Arabic",
|
|
3472
3476
|
"arabic typesetting": "Noto Naskh Arabic",
|
|
3473
3477
|
"univers next arabic": "Noto Sans Arabic"
|
|
3474
|
-
},
|
|
3475
|
-
function
|
|
3476
|
-
if (
|
|
3478
|
+
}, En = "\"Noto Naskh Arabic\", \"Noto Sans Arabic\"";
|
|
3479
|
+
function Dn(e) {
|
|
3480
|
+
if (Tn[e.toLowerCase()]?.includes("Arabic")) return !0;
|
|
3477
3481
|
let t = e.toLowerCase();
|
|
3478
3482
|
return /arabic|naskh|kufi|nastaliq|amiri|scheherazade|lateef|aldhabi|urdu|farsi|العرب|[-ۿ]/.test(t);
|
|
3479
3483
|
}
|
|
3480
|
-
function
|
|
3484
|
+
function On(e) {
|
|
3481
3485
|
return e.map((e) => `"${e}"`).join(", ");
|
|
3482
3486
|
}
|
|
3483
|
-
function
|
|
3484
|
-
let
|
|
3485
|
-
if (
|
|
3486
|
-
let
|
|
3487
|
-
return `"${e}", ${
|
|
3487
|
+
function kn(e, t = e) {
|
|
3488
|
+
let r = wn(t), i = Tn[t.toLowerCase()], a = i ? `"${i}", ` : "";
|
|
3489
|
+
if (Dn(t)) return `"${e}", ${a}${En}, ${r}`;
|
|
3490
|
+
let o = r === "serif" ? "serif" : "sans", l = F(t);
|
|
3491
|
+
return `"${e}", ${a}${l ? `${On(n(l, o))}, ` : ""}${`${On(o === "serif" ? s : c)}, `}${r}`;
|
|
3488
3492
|
}
|
|
3489
|
-
function
|
|
3493
|
+
function An(e) {
|
|
3490
3494
|
return e ? e.kind === "external" ? `e:${e.url}` : `i:${e.ref}` : "";
|
|
3491
3495
|
}
|
|
3492
|
-
function
|
|
3496
|
+
function jn(e) {
|
|
3493
3497
|
let t = e.toLowerCase();
|
|
3494
3498
|
return /\b(thin|hairline)\b/.test(t) ? 100 : /\b(extra[- ]?light|ultra[- ]?light)\b/.test(t) ? 200 : /\blight\b/.test(t) ? 300 : /\b(black|heavy)\b/.test(t) ? 900 : /\b(extra[- ]?bold|ultra[- ]?bold)\b/.test(t) ? 800 : /\b(semi[- ]?bold|demi[- ]?bold)\b/.test(t) ? 600 : /\bbold\b/.test(t) ? 700 : /\bmedium\b/.test(t) ? 600 : null;
|
|
3495
3499
|
}
|
|
3496
|
-
function
|
|
3497
|
-
let c = Math.max(0, r.blur * i), l = Math.ceil(c * 3) + 2, u = Math.max(0, Math.floor(n.x - l)), d = Math.max(0, Math.floor(n.y - l)), f = Math.min(o, Math.ceil(n.x + n.w + l)), p = Math.min(s, Math.ceil(n.y + n.h + l)), m = Math.max(1, f - u), h = Math.max(1, p - d), g =
|
|
3500
|
+
function Mn(e, t, n, r, i, a, o, s) {
|
|
3501
|
+
let c = Math.max(0, r.blur * i), l = Math.ceil(c * 3) + 2, u = Math.max(0, Math.floor(n.x - l)), d = Math.max(0, Math.floor(n.y - l)), f = Math.min(o, Math.ceil(n.x + n.w + l)), p = Math.min(s, Math.ceil(n.y + n.h + l)), m = Math.max(1, f - u), h = Math.max(1, p - d), g = De(m, h), _ = g?.getContext("2d");
|
|
3498
3502
|
if (!g || !_) return;
|
|
3499
3503
|
_.save(), _.setTransform(a.a, a.b, a.c, a.d, a.e - u, a.f - d), t(_), _.restore();
|
|
3500
3504
|
let v = n.y - d, y = v + n.h, b = g, x = _;
|
|
3501
3505
|
if (c > 0) {
|
|
3502
|
-
let e =
|
|
3506
|
+
let e = De(m, h), t = e?.getContext("2d");
|
|
3503
3507
|
e && t && (b = e, x = t);
|
|
3504
3508
|
}
|
|
3505
|
-
b !== g &&
|
|
3509
|
+
b !== g && Kt(x, g, {
|
|
3506
3510
|
x: n.x - u,
|
|
3507
3511
|
y: v,
|
|
3508
3512
|
w: n.w,
|
|
@@ -3530,47 +3534,47 @@ function Dn(e, t, n, r, i, a, o, s) {
|
|
|
3530
3534
|
e.save(), e.setTransform(1, 0, 0, 1, 0, 0), e.translate(n.x + Math.cos(E) * T, D + Math.sin(E) * T), e.scale(r.sx, r.sy), e.translate(-n.x, -D), e.drawImage(b, u, d), e.restore();
|
|
3531
3535
|
}
|
|
3532
3536
|
function Z(e, t, n, r, i) {
|
|
3533
|
-
let a = t ? "italic " : "", o =
|
|
3534
|
-
return
|
|
3537
|
+
let a = t ? "italic " : "", o = Sn(r, i), s = i.embeddedFontAuthoredFamilies?.get(o) ?? o, c = jn(s), l = e ? "bold " : c ? `${c} ` : "";
|
|
3538
|
+
return Cn.has(o) ? `${a}${l}${n}px ${o}` : `${a}${l}${n}px ${kn(o, s)}`;
|
|
3535
3539
|
}
|
|
3536
|
-
function
|
|
3537
|
-
return e.bullet.type === "char" || e.bullet.type === "autoNum" ||
|
|
3540
|
+
function Nn(e) {
|
|
3541
|
+
return e.bullet.type === "char" || e.bullet.type === "autoNum" || He(e.bullet).type === "blip";
|
|
3538
3542
|
}
|
|
3539
|
-
function
|
|
3543
|
+
function Pn(e, t) {
|
|
3540
3544
|
return e ? 0 : Math.max(0, t);
|
|
3541
3545
|
}
|
|
3542
|
-
function
|
|
3546
|
+
function Fn(e, t) {
|
|
3543
3547
|
return t != null && t !== 0 ? e * .65 : e;
|
|
3544
3548
|
}
|
|
3545
|
-
function
|
|
3549
|
+
function In(e, t, n, r, i, a, o) {
|
|
3546
3550
|
let s = (t.defaultFontSize ?? 18) * J * a;
|
|
3547
3551
|
for (let c of t.paragraphs) {
|
|
3548
|
-
let l = Y(c.marL, a), u = Y(c.marR, a), d = Y(c.indent, a), f =
|
|
3552
|
+
let l = Y(c.marL, a), u = Y(c.marR, a), d = Y(c.indent, a), f = Pn(Nn(c), d), p = n - r - i - l - u - f, m = 0;
|
|
3549
3553
|
for (let n of c.runs) {
|
|
3550
3554
|
if (n.type !== "text") continue;
|
|
3551
|
-
let r = n.fontSize == null ? c.defFontSize == null ? s : c.defFontSize * J * a : n.fontSize * J * a, i =
|
|
3552
|
-
e.font = Z(n.bold ?? c.defBold ?? t.defaultBold ?? !1, n.italic ?? c.defItalic ?? t.defaultItalic ?? !1,
|
|
3555
|
+
let r = n.fontSize == null ? c.defFontSize == null ? s : c.defFontSize * J * a : n.fontSize * J * a, i = Sn(n.fontFamily ?? c.defFontFamily ?? null, o);
|
|
3556
|
+
e.font = Z(n.bold ?? c.defBold ?? t.defaultBold ?? !1, n.italic ?? c.defItalic ?? t.defaultItalic ?? !1, Fn(r, n.baseline ?? void 0), i, o);
|
|
3553
3557
|
let l = (n.letterSpacing ?? 0) * J * a;
|
|
3554
3558
|
if (m += Q(e, n.text, l), m > p) return !0;
|
|
3555
3559
|
}
|
|
3556
3560
|
}
|
|
3557
3561
|
return !1;
|
|
3558
3562
|
}
|
|
3559
|
-
function
|
|
3560
|
-
for (let t of e) if (
|
|
3563
|
+
function Ln(e) {
|
|
3564
|
+
for (let t of e) if (re(t.codePointAt(0) ?? 0)) return !0;
|
|
3561
3565
|
return !1;
|
|
3562
3566
|
}
|
|
3563
|
-
function
|
|
3567
|
+
function Rn(e) {
|
|
3564
3568
|
let t = 0;
|
|
3565
3569
|
for (let n of e) t++;
|
|
3566
3570
|
return t;
|
|
3567
3571
|
}
|
|
3568
|
-
var
|
|
3569
|
-
function
|
|
3570
|
-
let t =
|
|
3572
|
+
var zn = /* @__PURE__ */ new WeakMap();
|
|
3573
|
+
function Bn(e) {
|
|
3574
|
+
let t = zn.get(e);
|
|
3571
3575
|
if (t != null) return t;
|
|
3572
3576
|
let n = e, r = n.letterSpacing;
|
|
3573
|
-
if (typeof r != "string") return
|
|
3577
|
+
if (typeof r != "string") return zn.set(e, !1), !1;
|
|
3574
3578
|
let i = !1;
|
|
3575
3579
|
try {
|
|
3576
3580
|
n.letterSpacing = "0px";
|
|
@@ -3585,11 +3589,11 @@ function Fn(e) {
|
|
|
3585
3589
|
n.letterSpacing = r;
|
|
3586
3590
|
} catch {}
|
|
3587
3591
|
}
|
|
3588
|
-
return
|
|
3592
|
+
return zn.set(e, i), i;
|
|
3589
3593
|
}
|
|
3590
3594
|
function Q(e, t, n) {
|
|
3591
3595
|
let r = e, i = r.letterSpacing;
|
|
3592
|
-
if (n !== 0 &&
|
|
3596
|
+
if (n !== 0 && Bn(e)) try {
|
|
3593
3597
|
r.letterSpacing = `${n}px`;
|
|
3594
3598
|
let i = e.measureText(t).width;
|
|
3595
3599
|
if (Number.isFinite(i)) return t.length > 0 ? i - n : i;
|
|
@@ -3598,38 +3602,38 @@ function Q(e, t, n) {
|
|
|
3598
3602
|
r.letterSpacing = i;
|
|
3599
3603
|
} catch {}
|
|
3600
3604
|
}
|
|
3601
|
-
let a = Math.max(0,
|
|
3605
|
+
let a = Math.max(0, Rn(t) - 1);
|
|
3602
3606
|
return e.measureText(t).width + n * a;
|
|
3603
3607
|
}
|
|
3604
|
-
function
|
|
3608
|
+
function Vn(e, t, n, r, a, o, s, c = !1, l = !1, u = 1, d, f = {
|
|
3605
3609
|
themeMajorFont: null,
|
|
3606
3610
|
themeMinorFont: null,
|
|
3607
3611
|
dpr: 1
|
|
3608
|
-
},
|
|
3609
|
-
let
|
|
3610
|
-
for (let e = t.runs.length - 1; e >= 0 &&
|
|
3612
|
+
}, m = 0) {
|
|
3613
|
+
let h = [], g = /* @__PURE__ */ new Map(), v = !0;
|
|
3614
|
+
for (let e = t.runs.length - 1; e >= 0 && v; e--) {
|
|
3611
3615
|
let n = t.runs[e];
|
|
3612
3616
|
if (n.type === "break") continue;
|
|
3613
3617
|
if (n.type === "math") break;
|
|
3614
3618
|
let r = n.text.replace(/ +$/u, "");
|
|
3615
|
-
r !== n.text && g.set(n, r), (r.length > 0 || n.fieldType != null) && (
|
|
3619
|
+
r !== n.text && g.set(n, r), (r.length > 0 || n.fieldType != null) && (v = !1);
|
|
3616
3620
|
}
|
|
3617
|
-
let
|
|
3621
|
+
let y = () => n - (h.length === 0 ? m : 0), x = { segments: [] }, S = 0, C = !1, w = t.rtl === !0, T = Y(t.marR, o), E = (t.tabStops ?? []).map((e) => ({
|
|
3618
3622
|
pos: Y(e.pos, o),
|
|
3619
3623
|
algn: e.algn
|
|
3620
|
-
})), D = Y(t.defTabSz ?? 914400, o), O = !1,
|
|
3621
|
-
let t =
|
|
3624
|
+
})), D = Y(t.defTabSz ?? 914400, o), O = !1, A = [], M = 0, N = () => w ? T : s + (h.length === 0 ? m : 0), P = (e = 0) => {
|
|
3625
|
+
let t = un(e > 0 ? [...A, {
|
|
3622
3626
|
isTab: !1,
|
|
3623
3627
|
width: e
|
|
3624
|
-
}] :
|
|
3628
|
+
}] : A, E, N(), Infinity, M, D), n = 0;
|
|
3625
3629
|
for (let e of t) n += e;
|
|
3626
3630
|
return n;
|
|
3627
3631
|
}, F = (e) => {
|
|
3628
|
-
let t =
|
|
3629
|
-
return Number.isFinite(t) ? O ? P(e) <= t :
|
|
3632
|
+
let t = y();
|
|
3633
|
+
return Number.isFinite(t) ? O ? P(e) <= t : S + e <= t : !0;
|
|
3630
3634
|
}, I = () => {
|
|
3631
|
-
let e =
|
|
3632
|
-
if (!O) return e -
|
|
3635
|
+
let e = y();
|
|
3636
|
+
if (!O) return e - S;
|
|
3633
3637
|
if (!Number.isFinite(e)) return Infinity;
|
|
3634
3638
|
if (P(0) >= e) return 0;
|
|
3635
3639
|
let t = 0, n = e;
|
|
@@ -3639,27 +3643,27 @@ function In(e, t, n, i, a, o, s, c = !1, l = !1, u = 1, d, f = {
|
|
|
3639
3643
|
}
|
|
3640
3644
|
return t;
|
|
3641
3645
|
}, L = (e = !1) => {
|
|
3642
|
-
e && (
|
|
3646
|
+
e && (x.endsWithBreak = !0), h.push(x), x = { segments: [] }, S = 0, O = !1, A = [], C = !1;
|
|
3643
3647
|
}, R = (t, n, r, i) => {
|
|
3644
3648
|
e.font = n;
|
|
3645
|
-
let a = Q(e, t, r), o =
|
|
3649
|
+
let a = Q(e, t, r), o = x.segments.at(-1);
|
|
3646
3650
|
return !o || o.isTab || o.math || o.sourceRunId !== i ? a : o.font === n && (o.letterSpacingPx ?? 0) === r ? Q(e, o.text + t, r) - Q(e, o.text, r) : a + r;
|
|
3647
3651
|
}, z = (t, n, r, i, a, o, s, c) => {
|
|
3648
3652
|
if (!t) return;
|
|
3649
3653
|
e.font = n;
|
|
3650
|
-
let l = c?.letterSpacingPx ?? 0, u = c?.sourceRunId, d = c?.strikeDouble, f = c?.underlineStyle, p = c?.underlineColor, m = c?.shadow, h = c?.reflection, g = c?.outline, _ = c?.highlight, v = c?.fontFamily, y = c?.hyperlink,
|
|
3651
|
-
if (w && C(w) ? T = Q(e, w.text + t, l) - Q(e, w.text, l) : w && !w.isTab && !w.math && u != null && w.sourceRunId === u && (T += l),
|
|
3654
|
+
let l = c?.letterSpacingPx ?? 0, u = c?.sourceRunId, d = c?.strikeDouble, f = c?.underlineStyle, p = c?.underlineColor, m = c?.shadow, h = c?.reflection, g = c?.outline, _ = c?.highlight, v = c?.fontFamily, y = c?.hyperlink, b = c?.drawSizePx ?? r, C = (e) => !e.math && !e.isTab && e.font === n && e.color === i && e.underline === a && (e.underlineStyle ?? "") === (f ?? "") && (e.underlineColor ?? "") === (p ?? "") && e.strikethrough === o && (e.strikeDouble ?? !1) === (d ?? !1) && (e.letterSpacingPx ?? 0) === l && e.baseline === s && e.shadow === m && e.reflection === h && e.outline === g && (e.highlight ?? "") === (_ ?? "") && (e.fontFamily ?? "") === (v ?? "") && (e.drawSizePx ?? e.sizePx) === b && An(e.hyperlink) === An(y) && (l === 0 || e.sourceRunId === u), w = x.segments.at(-1), T = Q(e, t, l);
|
|
3655
|
+
if (w && C(w) ? T = Q(e, w.text + t, l) - Q(e, w.text, l) : w && !w.isTab && !w.math && u != null && w.sourceRunId === u && (T += l), S += T, A.push({
|
|
3652
3656
|
isTab: !1,
|
|
3653
3657
|
width: T
|
|
3654
3658
|
}), w && C(w)) w.text += t;
|
|
3655
3659
|
else {
|
|
3656
3660
|
let e = w && !w.isTab && !w.math && u != null && w.sourceRunId === u ? l : 0;
|
|
3657
|
-
|
|
3661
|
+
x.segments.push({
|
|
3658
3662
|
text: t,
|
|
3659
3663
|
font: n,
|
|
3660
3664
|
fontFamily: v,
|
|
3661
3665
|
sizePx: r,
|
|
3662
|
-
drawSizePx:
|
|
3666
|
+
drawSizePx: b,
|
|
3663
3667
|
color: i,
|
|
3664
3668
|
underline: a,
|
|
3665
3669
|
underlineStyle: f,
|
|
@@ -3678,11 +3682,11 @@ function In(e, t, n, i, a, o, s, c = !1, l = !1, u = 1, d, f = {
|
|
|
3678
3682
|
});
|
|
3679
3683
|
}
|
|
3680
3684
|
}, B = () => {
|
|
3681
|
-
let e =
|
|
3685
|
+
let e = x.segments.at(-1);
|
|
3682
3686
|
if (!e || e.math) return !1;
|
|
3683
3687
|
let t = /^(.*\s)(\S+)$/s.exec(e.text), n;
|
|
3684
3688
|
if (t) e.text = t[1], n = t[2];
|
|
3685
|
-
else if (
|
|
3689
|
+
else if (x.segments.length > 1) x.segments.pop(), n = e.text;
|
|
3686
3690
|
else return !1;
|
|
3687
3691
|
return L(), z(n, e.font, e.sizePx, e.color, e.underline, e.strikethrough, e.baseline, {
|
|
3688
3692
|
strikeDouble: e.strikeDouble,
|
|
@@ -3704,11 +3708,11 @@ function In(e, t, n, i, a, o, s, c = !1, l = !1, u = 1, d, f = {
|
|
|
3704
3708
|
continue;
|
|
3705
3709
|
}
|
|
3706
3710
|
if (s.type === "math") {
|
|
3707
|
-
let e =
|
|
3708
|
-
(s.display &&
|
|
3711
|
+
let e = vn.get(s.nodes), t = s.fontSize == null ? r : s.fontSize * J * o * u, n = e ? e.widthEm * t : 0, i = e ? e.ascentEm * t : 0, c = e ? e.descentEm * t : 0;
|
|
3712
|
+
(s.display && S > 0 || !F(n) && S > 0) && L(), A.push({
|
|
3709
3713
|
isTab: !1,
|
|
3710
3714
|
width: n
|
|
3711
|
-
}),
|
|
3715
|
+
}), x.segments.push({
|
|
3712
3716
|
text: "",
|
|
3713
3717
|
font: `${t}px sans-serif`,
|
|
3714
3718
|
sizePx: t,
|
|
@@ -3719,46 +3723,46 @@ function In(e, t, n, i, a, o, s, c = !1, l = !1, u = 1, d, f = {
|
|
|
3719
3723
|
nodes: s.nodes,
|
|
3720
3724
|
display: s.display,
|
|
3721
3725
|
width: n,
|
|
3722
|
-
ascent:
|
|
3726
|
+
ascent: i,
|
|
3723
3727
|
descent: c
|
|
3724
3728
|
}
|
|
3725
|
-
}),
|
|
3729
|
+
}), S += n, s.display && L();
|
|
3726
3730
|
continue;
|
|
3727
3731
|
}
|
|
3728
|
-
let
|
|
3732
|
+
let m = s.fontSize == null ? r : s.fontSize * J * o * u, h = Fn(m, s.baseline ?? void 0), v = Sn(s.fontFamily ?? t.defFontFamily ?? null, f), w = s.fontFamilyEa ? Sn(s.fontFamilyEa, f) : null, T = s.fontFamilySym ? Sn(s.fontFamilySym, f) : null, E;
|
|
3729
3733
|
E = s.color ? X(s.color) : s.hyperlink && f.themeHlinkColor ? X(f.themeHlinkColor) : a;
|
|
3730
|
-
let D = s.bold ?? t.defBold ?? c,
|
|
3734
|
+
let D = s.bold ?? t.defBold ?? c, N = s.italic ?? t.defItalic ?? l, P = Z(D, N, h, v, f), V = w ? Z(D, N, h, w, f) : P;
|
|
3731
3735
|
e.font = P;
|
|
3732
3736
|
let H = s.caps, U = g.get(s) ?? s.text;
|
|
3733
3737
|
(H === "all" || H === "small") && (U = U.toUpperCase());
|
|
3734
|
-
let ee = s.fieldType === "slidenum" && d !== void 0 ? String(d) : U, W = s.underline || s.hyperlink !== void 0, te = s.strikeDouble === !0,
|
|
3738
|
+
let ee = s.fieldType === "slidenum" && d !== void 0 ? String(d) : U, W = s.underline || s.hyperlink !== void 0, te = s.strikeDouble === !0, G = s.letterSpacing == null ? 0 : s.letterSpacing * J * o, K = {
|
|
3735
3739
|
strikeDouble: te,
|
|
3736
|
-
letterSpacingPx:
|
|
3740
|
+
letterSpacingPx: G,
|
|
3737
3741
|
underlineStyle: s.underlineStyle,
|
|
3738
3742
|
underlineColor: s.underlineColor ? X(s.underlineColor) : void 0,
|
|
3739
3743
|
shadow: s.shadow,
|
|
3740
3744
|
reflection: s.reflection,
|
|
3741
3745
|
outline: s.outline,
|
|
3742
|
-
fontFamily:
|
|
3746
|
+
fontFamily: v,
|
|
3743
3747
|
highlight: s.highlight ? X(s.highlight) : void 0,
|
|
3744
|
-
hyperlink:
|
|
3748
|
+
hyperlink: qt(s.hyperlink),
|
|
3745
3749
|
sourceRunId: n,
|
|
3746
|
-
drawSizePx:
|
|
3747
|
-
},
|
|
3748
|
-
for (let
|
|
3749
|
-
if (!
|
|
3750
|
-
if (/^\t+$/.test(
|
|
3751
|
-
O || (e.font = P,
|
|
3752
|
-
for (let e of
|
|
3750
|
+
drawSizePx: h
|
|
3751
|
+
}, q = ee.split(/(\s+)/);
|
|
3752
|
+
for (let r of q) {
|
|
3753
|
+
if (!r) continue;
|
|
3754
|
+
if (/^\t+$/.test(r)) {
|
|
3755
|
+
O || (e.font = P, M = e.measureText(" ").width);
|
|
3756
|
+
for (let e of r) x.segments.push({
|
|
3753
3757
|
text: "",
|
|
3754
3758
|
isTab: !0,
|
|
3755
3759
|
font: P,
|
|
3756
|
-
fontFamily:
|
|
3757
|
-
sizePx:
|
|
3760
|
+
fontFamily: v,
|
|
3761
|
+
sizePx: m,
|
|
3758
3762
|
color: E,
|
|
3759
3763
|
underline: !1,
|
|
3760
3764
|
strikethrough: !1
|
|
3761
|
-
}),
|
|
3765
|
+
}), A.push({
|
|
3762
3766
|
isTab: !0,
|
|
3763
3767
|
width: 0
|
|
3764
3768
|
});
|
|
@@ -3766,44 +3770,44 @@ function In(e, t, n, i, a, o, s, c = !1, l = !1, u = 1, d, f = {
|
|
|
3766
3770
|
continue;
|
|
3767
3771
|
}
|
|
3768
3772
|
e.font = P;
|
|
3769
|
-
let a = R(
|
|
3770
|
-
if (c.test(
|
|
3771
|
-
let t =
|
|
3772
|
-
for (let
|
|
3773
|
-
let
|
|
3774
|
-
if (c.test(
|
|
3775
|
-
let e =
|
|
3776
|
-
e ===
|
|
3773
|
+
let a = R(r, P, G, n), o = /^\s+$/.test(r), c = /[-]/;
|
|
3774
|
+
if (c.test(r) && (T != null || ve(v))) {
|
|
3775
|
+
let t = T ?? v;
|
|
3776
|
+
for (let i of r) {
|
|
3777
|
+
let r = i, a = P;
|
|
3778
|
+
if (c.test(i)) {
|
|
3779
|
+
let e = ue(i, t);
|
|
3780
|
+
e === i ? a = Z(D, N, h, t, f) : (r = e, a = Z(D, N, h, "sans-serif", f));
|
|
3777
3781
|
}
|
|
3778
|
-
e.font = a, !F(R(
|
|
3782
|
+
e.font = a, !F(R(r, a, G, n)) && S > 0 && L(), z(r, a, m, E, W, s.strikethrough, s.baseline ?? void 0, K);
|
|
3779
3783
|
}
|
|
3780
3784
|
continue;
|
|
3781
3785
|
}
|
|
3782
|
-
if (
|
|
3783
|
-
let
|
|
3784
|
-
for (let t of
|
|
3785
|
-
let n =
|
|
3786
|
-
e.font =
|
|
3786
|
+
if (Ln(r) && (!j(r) || t.eaLnBrk === !1)) {
|
|
3787
|
+
let i = [];
|
|
3788
|
+
for (let t of r) {
|
|
3789
|
+
let n = re(t.codePointAt(0) ?? 0) && w != null, r = n ? V : P, a = n ? w : v;
|
|
3790
|
+
e.font = r, i.push({
|
|
3787
3791
|
ch: t,
|
|
3788
3792
|
w: Q(e, t, 0),
|
|
3789
|
-
font:
|
|
3793
|
+
font: r,
|
|
3790
3794
|
family: a
|
|
3791
3795
|
});
|
|
3792
3796
|
}
|
|
3793
3797
|
if (t.eaLnBrk === !1) {
|
|
3794
|
-
let e =
|
|
3795
|
-
|
|
3796
|
-
for (let e of
|
|
3797
|
-
...
|
|
3798
|
+
let e = x.segments.at(-1), t = !!e && !e.isTab && !e.math && e.sourceRunId === n, r = i.reduce((e, t) => e + t.w, 0) + Math.max(0, i.length - 1) * G + (t && i.length > 0 ? G : 0);
|
|
3799
|
+
S > 0 && !F(r) && L();
|
|
3800
|
+
for (let e of i) z(e.ch, e.font, m, E, W, s.strikethrough, s.baseline ?? void 0, {
|
|
3801
|
+
...K,
|
|
3798
3802
|
fontFamily: e.family
|
|
3799
3803
|
});
|
|
3800
3804
|
continue;
|
|
3801
3805
|
}
|
|
3802
|
-
let a =
|
|
3806
|
+
let a = i;
|
|
3803
3807
|
for (; a.length > 0;) {
|
|
3804
|
-
let e = Number.isFinite(
|
|
3808
|
+
let e = Number.isFinite(y()) ? y() - I() : S, t = x.segments.at(-1), r = !!t && !t.isTab && !t.math && t.sourceRunId === n, i = $t(a, e, y(), p, G, r);
|
|
3805
3809
|
if (i === 0) {
|
|
3806
|
-
if (
|
|
3810
|
+
if (S > 0) {
|
|
3807
3811
|
L();
|
|
3808
3812
|
continue;
|
|
3809
3813
|
}
|
|
@@ -3811,8 +3815,8 @@ function In(e, t, n, i, a, o, s, c = !1, l = !1, u = 1, d, f = {
|
|
|
3811
3815
|
}
|
|
3812
3816
|
for (let e = 0; e < i; e++) {
|
|
3813
3817
|
let t = a[e];
|
|
3814
|
-
z(t.ch, t.font,
|
|
3815
|
-
...
|
|
3818
|
+
z(t.ch, t.font, m, E, W, s.strikethrough, s.baseline ?? void 0, {
|
|
3819
|
+
...K,
|
|
3816
3820
|
fontFamily: t.family
|
|
3817
3821
|
});
|
|
3818
3822
|
}
|
|
@@ -3820,13 +3824,13 @@ function In(e, t, n, i, a, o, s, c = !1, l = !1, u = 1, d, f = {
|
|
|
3820
3824
|
}
|
|
3821
3825
|
continue;
|
|
3822
3826
|
}
|
|
3823
|
-
if (
|
|
3824
|
-
let t =
|
|
3827
|
+
if (j(r)) {
|
|
3828
|
+
let t = _(r, {
|
|
3825
3829
|
cjk: !0,
|
|
3826
|
-
kinsoku:
|
|
3827
|
-
}),
|
|
3828
|
-
let r = 0, i =
|
|
3829
|
-
s !== "" && (e.font = c ? V : P, r += Q(e, s,
|
|
3830
|
+
kinsoku: p
|
|
3831
|
+
}), i = w != null && V !== P, a = (e) => i && re(e.codePointAt(0) ?? 0), o = (t) => {
|
|
3832
|
+
let r = 0, i = x.segments.at(-1), o = !!i && !i.isTab && !i.math && i.sourceRunId === n, s = "", c = null, l = () => {
|
|
3833
|
+
s !== "" && (e.font = c ? V : P, r += Q(e, s, G), o && (r += G), o = !0, s = "");
|
|
3830
3834
|
};
|
|
3831
3835
|
for (let e of t) {
|
|
3832
3836
|
let t = a(e);
|
|
@@ -3836,9 +3840,9 @@ function In(e, t, n, i, a, o, s, c = !1, l = !1, u = 1, d, f = {
|
|
|
3836
3840
|
}, c = (e) => {
|
|
3837
3841
|
let t = "", n = null, r = () => {
|
|
3838
3842
|
if (t === "") return;
|
|
3839
|
-
let e = n ? V : P, r = n ?
|
|
3840
|
-
z(t, e,
|
|
3841
|
-
...
|
|
3843
|
+
let e = n ? V : P, r = n ? w : v;
|
|
3844
|
+
z(t, e, m, E, W, s.strikethrough, s.baseline ?? void 0, {
|
|
3845
|
+
...K,
|
|
3842
3846
|
fontFamily: r
|
|
3843
3847
|
}), t = "";
|
|
3844
3848
|
};
|
|
@@ -3847,59 +3851,59 @@ function In(e, t, n, i, a, o, s, c = !1, l = !1, u = 1, d, f = {
|
|
|
3847
3851
|
n === null || e === n ? (t += i, n = e) : (r(), t = i, n = e);
|
|
3848
3852
|
}
|
|
3849
3853
|
r();
|
|
3850
|
-
}, l =
|
|
3854
|
+
}, l = oe(r), u = r.length, d = 0;
|
|
3851
3855
|
for (; d < u;) {
|
|
3852
|
-
let e = I(), n =
|
|
3856
|
+
let e = I(), n = k(r, t, d, e, o, l);
|
|
3853
3857
|
if (n <= d) {
|
|
3854
|
-
if (
|
|
3858
|
+
if (S > 0) {
|
|
3855
3859
|
L();
|
|
3856
3860
|
continue;
|
|
3857
3861
|
}
|
|
3858
|
-
let
|
|
3862
|
+
let i = t.find((e) => e > d) ?? u, a = r.slice(d, i), s = b(a), c = k(a, s, 0, e, o, l);
|
|
3859
3863
|
c <= 0 && (c = s.length > 0 ? s[0] : a.length), n = d + c;
|
|
3860
3864
|
}
|
|
3861
|
-
c(
|
|
3865
|
+
c(r.slice(d, n)), d = n, d < u && L();
|
|
3862
3866
|
}
|
|
3863
3867
|
continue;
|
|
3864
3868
|
}
|
|
3865
|
-
if (F(a)) z(
|
|
3866
|
-
else if (o)
|
|
3867
|
-
else if (a >
|
|
3868
|
-
|
|
3869
|
-
for (let t of
|
|
3870
|
-
} else if (!
|
|
3869
|
+
if (F(a)) z(r, P, m, E, W, s.strikethrough, s.baseline ?? void 0, K), o && (C = !0);
|
|
3870
|
+
else if (o) S > 0 && L();
|
|
3871
|
+
else if (a > y()) {
|
|
3872
|
+
S > 0 && L();
|
|
3873
|
+
for (let t of r) e.font = P, !F(R(t, P, G, n)) && S > 0 && L(), z(t, P, m, E, W, s.strikethrough, s.baseline ?? void 0, K);
|
|
3874
|
+
} else if (!C) z(r, P, m, E, W, s.strikethrough, s.baseline ?? void 0, K);
|
|
3871
3875
|
else {
|
|
3872
|
-
let e =
|
|
3873
|
-
(o || c) && B() || L(), z(
|
|
3876
|
+
let e = x.segments.at(-1)?.text ?? "", t = r.codePointAt(0), n = [...e].at(-1)?.codePointAt(0), a = /\S$/u.test(e) && /^\S/u.test(r) && n !== 8203 && t !== 8203, o = t !== void 0 && p.lineStartForbidden.has(t) && a, c = n !== void 0 && t !== void 0 && a && !j(e) && !j(r) && i(n, t);
|
|
3877
|
+
(o || c) && B() || L(), z(r, P, m, E, W, s.strikethrough, s.baseline ?? void 0, K);
|
|
3874
3878
|
}
|
|
3875
3879
|
}
|
|
3876
3880
|
}
|
|
3877
|
-
return
|
|
3881
|
+
return h.push(x), h;
|
|
3878
3882
|
}
|
|
3879
|
-
async function
|
|
3883
|
+
async function Hn(e, t, n, r, i, a, o) {
|
|
3880
3884
|
if (t && t.fillType === "image") {
|
|
3881
3885
|
if (e.fillStyle = "#FFFFFF", e.fillRect(0, 0, n, r), !t.imagePath || !t.mimeType || !o) return;
|
|
3882
3886
|
try {
|
|
3883
|
-
let s = await
|
|
3887
|
+
let s = await ze(t.imagePath, t.mimeType, t.duotone, o, {
|
|
3884
3888
|
widthPt: n / i / J,
|
|
3885
3889
|
heightPt: r / i / J
|
|
3886
3890
|
});
|
|
3887
3891
|
if (a() || !s) return;
|
|
3888
|
-
if (e.save(), e.beginPath(), e.rect(0, 0, n, r), e.clip(), t.alpha != null && (e.globalAlpha = t.alpha), t.tile)
|
|
3892
|
+
if (e.save(), e.beginPath(), e.rect(0, 0, n, r), e.clip(), t.alpha != null && (e.globalAlpha = t.alpha), t.tile) Gn(e, s, t.tile, n, r, i);
|
|
3889
3893
|
else {
|
|
3890
3894
|
let i = t.fillRect ?? {}, a = i.l ?? 0, o = i.t ?? 0, c = i.r ?? 0, l = i.b ?? 0, u = a * n, d = o * r, f = n * (1 - a - c), p = r * (1 - o - l);
|
|
3891
3895
|
e.drawImage(s, u, d, f, p);
|
|
3892
3896
|
}
|
|
3893
3897
|
e.restore();
|
|
3894
3898
|
} catch (e) {
|
|
3895
|
-
if (
|
|
3899
|
+
if (Te(e)) throw e;
|
|
3896
3900
|
}
|
|
3897
3901
|
return;
|
|
3898
3902
|
}
|
|
3899
|
-
e.fillStyle =
|
|
3903
|
+
e.fillStyle = _n(t, e, 0, 0, n, r) ?? "#FFFFFF", e.fillRect(0, 0, n, r);
|
|
3900
3904
|
}
|
|
3901
|
-
var
|
|
3902
|
-
function
|
|
3905
|
+
var Un = 9525;
|
|
3906
|
+
function Wn(e, t, n, r, i) {
|
|
3903
3907
|
let a;
|
|
3904
3908
|
a = e === "t" || e === "ctr" || e === "b" ? (t - r) / 2 : e === "tr" || e === "r" || e === "br" ? t - r : 0;
|
|
3905
3909
|
let o;
|
|
@@ -3908,10 +3912,10 @@ function zn(e, t, n, r, i) {
|
|
|
3908
3912
|
ay: o
|
|
3909
3913
|
};
|
|
3910
3914
|
}
|
|
3911
|
-
function
|
|
3912
|
-
let o = t.width *
|
|
3915
|
+
function Gn(e, t, n, r, i, a) {
|
|
3916
|
+
let o = t.width * Un * (n.sx ?? 1) * a, s = t.height * Un * (n.sy ?? 1) * a;
|
|
3913
3917
|
if (!(o > 0) || !(s > 0)) return;
|
|
3914
|
-
let c = n.flip === "x" || n.flip === "xy", l = n.flip === "y" || n.flip === "xy", u =
|
|
3918
|
+
let c = n.flip === "x" || n.flip === "xy", l = n.flip === "y" || n.flip === "xy", u = De(o * (c ? 2 : 1), s * (l ? 2 : 1));
|
|
3915
3919
|
if (!u) return;
|
|
3916
3920
|
let d = u.getContext("2d");
|
|
3917
3921
|
if (!d) return;
|
|
@@ -3921,33 +3925,33 @@ function Bn(e, t, n, r, i, a) {
|
|
|
3921
3925
|
f(0, 0, !1, !1), c && f(o, 0, !0, !1), l && f(0, s, !1, !0), c && l && f(o, s, !0, !0);
|
|
3922
3926
|
let p = e.createPattern(u, "repeat");
|
|
3923
3927
|
if (!p) return;
|
|
3924
|
-
let { ax: m, ay: h } =
|
|
3928
|
+
let { ax: m, ay: h } = Wn(n.algn ?? "tl", r, i, o, s), g = m + Y(n.tx ?? 0, a), _ = h + Y(n.ty ?? 0, a);
|
|
3925
3929
|
typeof p.setTransform == "function" && typeof DOMMatrix < "u" ? (p.setTransform(new DOMMatrix().translateSelf(g, _)), e.fillStyle = p, e.fillRect(0, 0, r, i)) : (e.save(), e.translate(g, _), e.fillStyle = p, e.fillRect(-g, -_, r, i), e.restore());
|
|
3926
3930
|
}
|
|
3927
|
-
function
|
|
3931
|
+
function Kn(e, t, n) {
|
|
3928
3932
|
if (!t) return;
|
|
3929
3933
|
let r = t.dir * Math.PI / 180, i = Y(t.dist, n);
|
|
3930
3934
|
e.shadowColor = X(t.color, t.alpha), e.shadowBlur = 0, e.shadowOffsetX = Math.cos(r) * i, e.shadowOffsetY = Math.sin(r) * i;
|
|
3931
3935
|
}
|
|
3932
|
-
function
|
|
3936
|
+
function qn(e, t, n) {
|
|
3933
3937
|
t && (e.shadowColor = X(t.color, t.alpha), e.shadowBlur = Y(t.radius, n), e.shadowOffsetX = 0, e.shadowOffsetY = 0);
|
|
3934
3938
|
}
|
|
3935
|
-
function
|
|
3939
|
+
function Jn(e) {
|
|
3936
3940
|
e.shadowColor = "transparent", e.shadowBlur = 0, e.shadowOffsetX = 0, e.shadowOffsetY = 0;
|
|
3937
3941
|
}
|
|
3938
|
-
var
|
|
3939
|
-
function
|
|
3942
|
+
var Yn = 8, Xn = 1, Zn = 1, Qn = 256;
|
|
3943
|
+
function $n(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m) {
|
|
3940
3944
|
if (r <= 0) return;
|
|
3941
|
-
let h = e.measureText(t), g = h.actualBoundingBoxAscent > 0 ? h.actualBoundingBoxAscent : r, _ = h.actualBoundingBoxDescent > 0 ? h.actualBoundingBoxDescent : r * .25, v = h.actualBoundingBoxLeft > 0 ? h.actualBoundingBoxLeft : 0, y = h.actualBoundingBoxRight > 0 ? h.actualBoundingBoxRight : r, b = r * l * i, x = Math.min(
|
|
3942
|
-
for (; w >
|
|
3943
|
-
let e = Math.min(
|
|
3945
|
+
let h = e.measureText(t), g = h.actualBoundingBoxAscent > 0 ? h.actualBoundingBoxAscent : r, _ = h.actualBoundingBoxDescent > 0 ? h.actualBoundingBoxDescent : r * .25, v = h.actualBoundingBoxLeft > 0 ? h.actualBoundingBoxLeft : 0, y = h.actualBoundingBoxRight > 0 ? h.actualBoundingBoxRight : r, b = r * l * i, x = Math.min(Qn, Math.max(1, Math.round(b / Yn))), S = (e) => nr(e, a, r, o, s, c, u, d), C = S(x), w = ir(C, a, o, s, c, u, d, l, i, -g, _);
|
|
3946
|
+
for (; w > Zn && x < Qn;) {
|
|
3947
|
+
let e = Math.min(Qn, x * 2), t = S(e), n = ir(t, a, o, s, c, u, d, l, i, -g, _);
|
|
3944
3948
|
if (n >= w * .75) {
|
|
3945
3949
|
C = t;
|
|
3946
3950
|
break;
|
|
3947
3951
|
}
|
|
3948
3952
|
x = e, C = t, w = n;
|
|
3949
3953
|
}
|
|
3950
|
-
let T = 1e4, E =
|
|
3954
|
+
let T = 1e4, E = Xn / (l * i), D = C.length - 1, O = (e, t, n) => e === 0 ? -T : t - n - E, k = (e, t, n) => e === D ? T : t - n + E, A = (e, r) => {
|
|
3951
3955
|
e.fillStyle = r;
|
|
3952
3956
|
for (let r = 0; r <= D; r++) {
|
|
3953
3957
|
let { s0: i, s1: a, g: o } = C[r], s = (i + a) / 2;
|
|
@@ -3955,7 +3959,7 @@ function Jn(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m) {
|
|
|
3955
3959
|
let c = O(r, i, s), u = k(r, a, s);
|
|
3956
3960
|
e.rect(c, -T, u - c, 2 * T), e.clip(), e.fillText(t, -s + n / 2, 0), e.restore();
|
|
3957
3961
|
}
|
|
3958
|
-
}, j =
|
|
3962
|
+
}, j = er(m), M = typeof e.globalAlpha == "number" ? e.globalAlpha : 1;
|
|
3959
3963
|
if (j >= 1 && M >= 1) {
|
|
3960
3964
|
A(e, m);
|
|
3961
3965
|
return;
|
|
@@ -3975,67 +3979,67 @@ function Jn(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m) {
|
|
|
3975
3979
|
[s, _],
|
|
3976
3980
|
[c, _]
|
|
3977
3981
|
]) {
|
|
3978
|
-
let n =
|
|
3982
|
+
let n = rr(i, l, e, t), r = f + n.x, a = p + n.y, o = N.a * r + N.c * a + N.e, s = N.b * r + N.d * a + N.f;
|
|
3979
3983
|
o < P && (P = o), o > I && (I = o), s < F && (F = s), s > L && (L = s);
|
|
3980
3984
|
}
|
|
3981
3985
|
}
|
|
3982
3986
|
if (!(I > P && L > F)) return;
|
|
3983
|
-
let R = Math.floor(P - 2), z = Math.floor(F - 2), B =
|
|
3987
|
+
let R = Math.floor(P - 2), z = Math.floor(F - 2), B = De(Math.ceil(I + 2) - R, Math.ceil(L + 2) - z), V = B ? B.getContext("2d") : null;
|
|
3984
3988
|
if (!B || !V) {
|
|
3985
3989
|
A(e, m);
|
|
3986
3990
|
return;
|
|
3987
3991
|
}
|
|
3988
|
-
V.font = e.font, V.textAlign = "left", V.textBaseline = "alphabetic", V.setTransform(N.a, N.b, N.c, N.d, N.e - R, N.f - z), A(V,
|
|
3992
|
+
V.font = e.font, V.textAlign = "left", V.textBaseline = "alphabetic", V.setTransform(N.a, N.b, N.c, N.d, N.e - R, N.f - z), A(V, tr(m)), e.save(), e.setTransform(1, 0, 0, 1, 0, 0), e.globalAlpha = M * j, e.drawImage(B, R, z), e.restore();
|
|
3989
3993
|
}
|
|
3990
|
-
function
|
|
3994
|
+
function er(e) {
|
|
3991
3995
|
let t = /^rgba?\(\s*[\d.]+\s*,\s*[\d.]+\s*,\s*[\d.]+\s*,\s*([\d.]+)\s*\)$/i.exec(e);
|
|
3992
3996
|
if (!t) return 1;
|
|
3993
3997
|
let n = parseFloat(t[1]);
|
|
3994
3998
|
return Number.isFinite(n) ? Math.min(1, Math.max(0, n)) : 1;
|
|
3995
3999
|
}
|
|
3996
|
-
function
|
|
4000
|
+
function tr(e) {
|
|
3997
4001
|
let t = /^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)/i.exec(e);
|
|
3998
4002
|
return t ? `rgb(${t[1]}, ${t[2]}, ${t[3]})` : e;
|
|
3999
4003
|
}
|
|
4000
|
-
function
|
|
4004
|
+
function nr(e, t, n, r, i, a, o, s) {
|
|
4001
4005
|
let c = Array(e);
|
|
4002
4006
|
for (let l = 0; l < e; l++) {
|
|
4003
4007
|
let u = l / e * n, d = (l + 1) / e * n;
|
|
4004
4008
|
c[l] = {
|
|
4005
4009
|
s0: u,
|
|
4006
4010
|
s1: d,
|
|
4007
|
-
g:
|
|
4011
|
+
g: nt(t, (r + (u + d) / 2) / i * a, o, s)
|
|
4008
4012
|
};
|
|
4009
4013
|
}
|
|
4010
4014
|
return c;
|
|
4011
4015
|
}
|
|
4012
|
-
function
|
|
4016
|
+
function rr(e, t, n, r) {
|
|
4013
4017
|
let i = n * t, a = r * e.vScale, o = i + e.shear * a, s = Math.cos(e.angle), c = Math.sin(e.angle);
|
|
4014
4018
|
return {
|
|
4015
4019
|
x: e.x + s * o - c * a,
|
|
4016
4020
|
y: e.y + c * o + s * a
|
|
4017
4021
|
};
|
|
4018
4022
|
}
|
|
4019
|
-
function
|
|
4023
|
+
function ir(e, t, n, r, i, a, o, s, c, l, u) {
|
|
4020
4024
|
let d = 0;
|
|
4021
4025
|
for (let f of e) {
|
|
4022
4026
|
let e = (f.s0 + f.s1) / 2;
|
|
4023
4027
|
for (let p of [f.s0, f.s1]) {
|
|
4024
|
-
let m =
|
|
4028
|
+
let m = nt(t, (n + p) / r * i, a, o);
|
|
4025
4029
|
for (let t of [l, u]) {
|
|
4026
|
-
let n =
|
|
4030
|
+
let n = rr(m, s, 0, t), r = rr(f.g, s, p - e, t), i = Math.hypot(r.x - n.x, r.y - n.y) * c;
|
|
4027
4031
|
i > d && (d = i);
|
|
4028
4032
|
}
|
|
4029
4033
|
}
|
|
4030
4034
|
}
|
|
4031
4035
|
return d;
|
|
4032
4036
|
}
|
|
4033
|
-
function
|
|
4034
|
-
let d = i, f = a, p = Math.max(1, o), m = Math.max(1, s), h =
|
|
4037
|
+
function ar(e, t, n, r, i, a, o, s, c, l, u) {
|
|
4038
|
+
let d = i, f = a, p = Math.max(1, o), m = Math.max(1, s), h = Qe(n, r, p, m);
|
|
4035
4039
|
if (!h) return;
|
|
4036
4040
|
let g = t.defaultBold ?? !1, _ = t.defaultItalic ?? !1, v = (t.defaultFontSize ?? 18) * J * c, y = [];
|
|
4037
4041
|
for (let n of t.paragraphs) {
|
|
4038
|
-
let t =
|
|
4042
|
+
let t = Vn(e, n, Infinity, n.defFontSize == null ? v : n.defFontSize * J * c, n.defColor ? X(n.defColor) : l, c, 0, g, _, 1, void 0, u, 0);
|
|
4039
4043
|
for (let e of t) y.push(e);
|
|
4040
4044
|
}
|
|
4041
4045
|
if (y.length === 0) return;
|
|
@@ -4054,10 +4058,10 @@ function er(e, t, n, r, i, a, o, s, c, l, u) {
|
|
|
4054
4058
|
}
|
|
4055
4059
|
e.font = t.font;
|
|
4056
4060
|
let n = t.letterSpacingPx ?? 0, r = e.measureText(t.text);
|
|
4057
|
-
a += r.width + n *
|
|
4061
|
+
a += r.width + n * Rn(t.text), o = Math.max(o, t.sizePx), r.actualBoundingBoxAscent > 0 && (s = Math.max(s, r.actualBoundingBoxAscent)), r.actualBoundingBoxDescent > 0 && (c = Math.max(c, r.actualBoundingBoxDescent));
|
|
4058
4062
|
}
|
|
4059
4063
|
if (a <= 0) continue;
|
|
4060
|
-
let l = s + c > 0 ? s + c : o, u = h.singleEdge ? .8 : l > 0 ? s / l : .8, g = h.singleEdge ? 1 : p / a, _ = h.singleEdge ? m : l / (i - r), v =
|
|
4064
|
+
let l = s + c > 0 ? s + c : o, u = h.singleEdge ? .8 : l > 0 ? s / l : .8, g = h.singleEdge ? 1 : p / a, _ = h.singleEdge ? m : l / (i - r), v = tt(h, a), b = 0;
|
|
4061
4065
|
for (let t of n.segments) {
|
|
4062
4066
|
if (t.math) {
|
|
4063
4067
|
b += t.math.width;
|
|
@@ -4068,17 +4072,17 @@ function er(e, t, n, r, i, a, o, s, c, l, u) {
|
|
|
4068
4072
|
for (let s of o) {
|
|
4069
4073
|
let o = e.measureText(s).width + n, c = r + u * (i - r);
|
|
4070
4074
|
if (!h.singleEdge && o > 0) {
|
|
4071
|
-
|
|
4075
|
+
$n(e, s, n, o, x(), h, b, a, v, g, _, c, d, f, t.color), b += o;
|
|
4072
4076
|
continue;
|
|
4073
4077
|
}
|
|
4074
|
-
let l =
|
|
4078
|
+
let l = nt(h, (b + o / 2) / a * v, _, c);
|
|
4075
4079
|
e.save(), e.translate(d + l.x, f + l.y), e.rotate(l.angle), l.shear !== 0 && e.transform(1, 0, l.shear, 1, 0, 0), (g !== 1 || l.vScale !== 1) && e.scale(g, l.vScale), e.fillText(s, -o / 2 + n / 2, 0), e.restore(), b += o;
|
|
4076
4080
|
}
|
|
4077
4081
|
}
|
|
4078
4082
|
}
|
|
4079
4083
|
e.restore();
|
|
4080
4084
|
}
|
|
4081
|
-
function
|
|
4085
|
+
function or(e, t, n, r, i, a, o) {
|
|
4082
4086
|
let s = Math.min(r, i);
|
|
4083
4087
|
switch (e) {
|
|
4084
4088
|
case "rightarrow":
|
|
@@ -4108,17 +4112,17 @@ function tr(e, t, n, r, i, a, o) {
|
|
|
4108
4112
|
default: return null;
|
|
4109
4113
|
}
|
|
4110
4114
|
}
|
|
4111
|
-
function
|
|
4112
|
-
return e.defaultTextColor ? X(e.defaultTextColor) : t.smartArtFallbackTextColor != null &&
|
|
4115
|
+
function sr(e, t) {
|
|
4116
|
+
return e.defaultTextColor ? X(e.defaultTextColor) : t.smartArtFallbackTextColor != null && cn(e) ? t.smartArtFallbackTextColor : null;
|
|
4113
4117
|
}
|
|
4114
|
-
function
|
|
4118
|
+
function cr(e, t, n) {
|
|
4115
4119
|
return {
|
|
4116
4120
|
outerRotation: e,
|
|
4117
4121
|
localFlipH: t,
|
|
4118
4122
|
localFlipV: n
|
|
4119
4123
|
};
|
|
4120
4124
|
}
|
|
4121
|
-
function
|
|
4125
|
+
function lr(e, t, n, r, i) {
|
|
4122
4126
|
let a = [
|
|
4123
4127
|
{
|
|
4124
4128
|
x: t,
|
|
@@ -4147,7 +4151,7 @@ function ir(e, t, n, r, i) {
|
|
|
4147
4151
|
h: l - s
|
|
4148
4152
|
};
|
|
4149
4153
|
}
|
|
4150
|
-
var
|
|
4154
|
+
var ur = {
|
|
4151
4155
|
tl: [0, 0],
|
|
4152
4156
|
t: [.5, 0],
|
|
4153
4157
|
tr: [1, 0],
|
|
@@ -4158,15 +4162,15 @@ var ar = {
|
|
|
4158
4162
|
b: [.5, 1],
|
|
4159
4163
|
br: [1, 1]
|
|
4160
4164
|
};
|
|
4161
|
-
function
|
|
4165
|
+
function dr(e, t, n) {
|
|
4162
4166
|
return [e.a * t + e.c * n + e.e, e.b * t + e.d * n + e.f];
|
|
4163
4167
|
}
|
|
4164
|
-
function
|
|
4165
|
-
let [o, s] =
|
|
4166
|
-
return
|
|
4168
|
+
function fr(e, t, n, r, i, a) {
|
|
4169
|
+
let [o, s] = ur[a ?? "b"];
|
|
4170
|
+
return dr(e, t + o * r, n + s * i);
|
|
4167
4171
|
}
|
|
4168
|
-
function
|
|
4169
|
-
let c =
|
|
4172
|
+
function pr(e, t, n, r, i, a, o, s) {
|
|
4173
|
+
let c = ft(e, i, a).corners, l = (o > 0 ? Le(c, o / i, o / a) ?? c : c).map((e) => dr(t, n + e.x, r + e.y)), u = l.map(([e]) => e), d = l.map(([, e]) => e), f = Math.min(...u), p = Math.min(...d), m = Math.max(...u), h = Math.max(...d), [g, _] = ur[s ?? "b"], v = Pe(c, g, _);
|
|
4170
4174
|
return {
|
|
4171
4175
|
bbox: {
|
|
4172
4176
|
x: f,
|
|
@@ -4174,15 +4178,15 @@ function cr(e, t, n, r, i, a, o, s) {
|
|
|
4174
4178
|
w: m - f,
|
|
4175
4179
|
h: h - p
|
|
4176
4180
|
},
|
|
4177
|
-
anchor: v ?
|
|
4181
|
+
anchor: v ? dr(t, n + v.x, r + v.y) : fr(t, n, r, i, a, s)
|
|
4178
4182
|
};
|
|
4179
4183
|
}
|
|
4180
|
-
function
|
|
4184
|
+
function mr(e, t, n, r) {
|
|
4181
4185
|
let i = Math.floor(n.x) - 1, a = Math.floor(n.y) - 1, o = Math.max(1, Math.ceil(n.x + n.w) - i + 1), s = Math.max(1, Math.ceil(n.y + n.h) - a + 1);
|
|
4182
|
-
if (r && (i + o <= 0 || a + s <= 0 || i >= r.w || a >= r.h) ||
|
|
4186
|
+
if (r && (i + o <= 0 || a + s <= 0 || i >= r.w || a >= r.h) || Ne(o, s).clamped) return e;
|
|
4183
4187
|
let c = null;
|
|
4184
4188
|
try {
|
|
4185
|
-
c =
|
|
4189
|
+
c = De(o, s);
|
|
4186
4190
|
} catch {
|
|
4187
4191
|
return e;
|
|
4188
4192
|
}
|
|
@@ -4201,7 +4205,7 @@ function lr(e, t, n, r) {
|
|
|
4201
4205
|
e.save(), e.setTransform(u), e.drawImage(c, i, a), e.restore();
|
|
4202
4206
|
};
|
|
4203
4207
|
}
|
|
4204
|
-
function
|
|
4208
|
+
function hr(e, t, n, r, i, a, o, s, c, l = !0, u = r) {
|
|
4205
4209
|
let d = e.canvas.width || 0, f = e.canvas.height || 0, p = d > 0 && f > 0, m = {
|
|
4206
4210
|
a: 1,
|
|
4207
4211
|
b: 0,
|
|
@@ -4216,40 +4220,40 @@ function ur(e, t, n, r, i, a, o, s, c, l = !0, u = r) {
|
|
|
4216
4220
|
}, v = (e) => {
|
|
4217
4221
|
h(e), u(e);
|
|
4218
4222
|
}, y = !1;
|
|
4219
|
-
t.shadow && p ? (e.save(), e.setTransform(m), y = !
|
|
4223
|
+
t.shadow && p ? (e.save(), e.setTransform(m), y = !Ie(e, g, i, t.shadow, s, d, f, Math.atan2(c.b, c.a) * 180 / Math.PI, a), e.restore()) : t.shadow && (y = !0), t.reflection && p && (e.save(), e.setTransform(m), je(e, g, i, t.reflection, s, d, f), e.restore()), y ? Kn(e, t.shadow ?? null, o) : t.glow && qn(e, t.glow, o), t.softEdge && p ? (e.save(), e.setTransform(m), Me(e, g, i, t.softEdge, s, d, f, _), e.restore()) : n(e), (y || t.glow) && Jn(e), t.innerShadow && l && p && (e.save(), e.setTransform(m), Fe(e, v, i, t.innerShadow, s, d, f), e.restore());
|
|
4220
4224
|
}
|
|
4221
|
-
function
|
|
4225
|
+
function gr(e, t, n, r = "#000000", i, o = {
|
|
4222
4226
|
themeMajorFont: null,
|
|
4223
4227
|
themeMinorFont: null,
|
|
4224
4228
|
dpr: 1
|
|
4225
4229
|
}, s, c) {
|
|
4226
|
-
let
|
|
4230
|
+
let l = Y(t.x, n), u = Y(t.y, n), d = Y(t.width, n), f = Y(t.height, n), p = s && t.id !== void 0 ? (e) => s({
|
|
4227
4231
|
...e,
|
|
4228
4232
|
shapeId: t.id
|
|
4229
4233
|
}) : s;
|
|
4230
|
-
if (
|
|
4231
|
-
if (t.stroke && (e.save(),
|
|
4232
|
-
x:
|
|
4233
|
-
y:
|
|
4234
|
-
w:
|
|
4234
|
+
if (f === 0 && t.textBody?.verticalAnchor === "b") {
|
|
4235
|
+
if (t.stroke && (e.save(), Nr(e, t.stroke, n, {
|
|
4236
|
+
x: l,
|
|
4237
|
+
y: u,
|
|
4238
|
+
w: d,
|
|
4235
4239
|
h: 1
|
|
4236
|
-
}, t.rotation), e.beginPath(), e.moveTo(
|
|
4237
|
-
let
|
|
4238
|
-
|
|
4240
|
+
}, t.rotation), e.beginPath(), e.moveTo(l, u), e.lineTo(l + d, u), e.stroke(), e.restore()), t.textBody) {
|
|
4241
|
+
let a = sr(t, o);
|
|
4242
|
+
Sr(e, t.textBody, l, u, d, f, n, a, t.rotation, t.flipH, t.flipV, r, i, o, p, !1, c);
|
|
4239
4243
|
}
|
|
4240
4244
|
return;
|
|
4241
4245
|
}
|
|
4242
|
-
let
|
|
4243
|
-
if (
|
|
4244
|
-
let
|
|
4245
|
-
e.save(),
|
|
4246
|
+
let m = t.scene3d && pt(t.scene3d.camera) ? t.scene3d : null;
|
|
4247
|
+
if (m && d > 0 && f > 0) {
|
|
4248
|
+
let a = e.getTransform(), s = Math.abs(a.a * a.d - a.b * a.c), c = s > 0 ? Math.sqrt(s) : 1, p = Cr(t.sp3d, t.scene3d?.lightRig, t.sp3d?.prstMaterial, n, c), h = wr(t.sp3d, m.camera, d, f, n, c), g = cr(t.rotation, t.flipH, t.flipV);
|
|
4249
|
+
e.save(), g.outerRotation !== 0 && (e.translate(l + d / 2, u + f / 2), e.rotate(g.outerRotation * Math.PI / 180), e.translate(-(l + d / 2), -(u + f / 2)));
|
|
4246
4250
|
let _ = {
|
|
4247
4251
|
...t,
|
|
4248
4252
|
x: 0,
|
|
4249
4253
|
y: 0,
|
|
4250
4254
|
rotation: 0,
|
|
4251
|
-
flipH:
|
|
4252
|
-
flipV:
|
|
4255
|
+
flipH: g.localFlipH,
|
|
4256
|
+
flipV: g.localFlipV,
|
|
4253
4257
|
scene3d: void 0,
|
|
4254
4258
|
sp3d: void 0,
|
|
4255
4259
|
shadow: null,
|
|
@@ -4264,21 +4268,21 @@ function dr(e, t, n, r = "#000000", i, a = {
|
|
|
4264
4268
|
..._,
|
|
4265
4269
|
fill: null,
|
|
4266
4270
|
stroke: null
|
|
4267
|
-
}, b = (t.stroke ? t.stroke.width * n / 2 : 0) + (t.sp3d?.contourW ? t.sp3d.contourW * n : 0) + (
|
|
4268
|
-
|
|
4269
|
-
},
|
|
4270
|
-
bevels:
|
|
4271
|
-
extrusion:
|
|
4271
|
+
}, b = (t.stroke ? t.stroke.width * n / 2 : 0) + (t.sp3d?.contourW ? t.sp3d.contourW * n : 0) + (h ? Math.hypot(h.offsetX, h.offsetY) / c : 0) + 2, x = (e, t, a) => Tr(e, m.camera, l, u, d, f, (e) => {
|
|
4272
|
+
gr(e, t, n, r, i, o, void 0);
|
|
4273
|
+
}, a ? {
|
|
4274
|
+
bevels: p,
|
|
4275
|
+
extrusion: h ?? void 0,
|
|
4272
4276
|
edgePadCss: b
|
|
4273
4277
|
} : {}), S = (e) => x(e, v, !0), C = (e) => !t.textBody || x(e, y, !1);
|
|
4274
4278
|
if (t.shadow || t.innerShadow || t.glow || t.softEdge || t.reflection) {
|
|
4275
|
-
let r = e.getTransform(), i = Math.abs(r.a * r.d - r.b * r.c), a = i > 0 ? Math.sqrt(i) : 1, o =
|
|
4279
|
+
let r = e.getTransform(), i = Math.abs(r.a * r.d - r.b * r.c), a = i > 0 ? Math.sqrt(i) : 1, o = pr(m.camera, r, l, u, d, f, b, t.shadow?.algn), s = !1, c = mr((e) => {
|
|
4276
4280
|
s = S(e) || s;
|
|
4277
4281
|
}, r, o.bbox, {
|
|
4278
4282
|
w: e.canvas.width || 0,
|
|
4279
4283
|
h: e.canvas.height || 0
|
|
4280
4284
|
});
|
|
4281
|
-
if (
|
|
4285
|
+
if (hr(e, t, c, c, o.bbox, o.anchor, n, n * a, r, !!t.fill), s) {
|
|
4282
4286
|
C(e), e.restore();
|
|
4283
4287
|
return;
|
|
4284
4288
|
}
|
|
@@ -4288,10 +4292,10 @@ function dr(e, t, n, r = "#000000", i, a = {
|
|
|
4288
4292
|
}
|
|
4289
4293
|
e.restore();
|
|
4290
4294
|
}
|
|
4291
|
-
e.save(), (t.rotation !== 0 || t.flipH || t.flipV) && (e.translate(
|
|
4292
|
-
let
|
|
4293
|
-
t.shadow ||
|
|
4294
|
-
let
|
|
4295
|
+
e.save(), (t.rotation !== 0 || t.flipH || t.flipV) && (e.translate(l + d / 2, u + f / 2), e.rotate(t.rotation * Math.PI / 180), t.flipH && e.scale(-1, 1), t.flipV && e.scale(1, -1), e.translate(-(l + d / 2), -(u + f / 2)));
|
|
4296
|
+
let h = t.geometry.toLowerCase(), g = _n(t.fill, e, l, u, d, f, t.rotation);
|
|
4297
|
+
t.shadow || qn(e, t.glow ?? null, n);
|
|
4298
|
+
let _ = new Set([
|
|
4295
4299
|
"line",
|
|
4296
4300
|
"straightconnector1",
|
|
4297
4301
|
"bentconnector2",
|
|
@@ -4302,7 +4306,7 @@ function dr(e, t, n, r = "#000000", i, a = {
|
|
|
4302
4306
|
"curvedconnector3",
|
|
4303
4307
|
"curvedconnector4",
|
|
4304
4308
|
"curvedconnector5"
|
|
4305
|
-
]),
|
|
4309
|
+
]), y = new Set([
|
|
4306
4310
|
"callout1",
|
|
4307
4311
|
"callout2",
|
|
4308
4312
|
"callout3",
|
|
@@ -4315,22 +4319,22 @@ function dr(e, t, n, r = "#000000", i, a = {
|
|
|
4315
4319
|
"accentbordercallout1",
|
|
4316
4320
|
"accentbordercallout2",
|
|
4317
4321
|
"accentbordercallout3"
|
|
4318
|
-
]),
|
|
4319
|
-
x:
|
|
4320
|
-
y:
|
|
4321
|
-
w:
|
|
4322
|
-
h:
|
|
4322
|
+
]), b = (e) => y.has(e) || e === "line" || e === "straightconnector1" || e.startsWith("bentconnector"), x = !t.custGeom && v(h), C = (r, i, o = {
|
|
4323
|
+
x: l,
|
|
4324
|
+
y: u,
|
|
4325
|
+
w: d,
|
|
4326
|
+
h: f
|
|
4323
4327
|
}) => {
|
|
4324
|
-
let { x:
|
|
4325
|
-
|
|
4326
|
-
x:
|
|
4327
|
-
y:
|
|
4328
|
-
w:
|
|
4329
|
-
h:
|
|
4328
|
+
let { x: s, y: c, w: p, h: m } = o, _ = i ?? (r === e && s === l && c === u && p === d && m === f ? g : _n(t.fill, r, s, c, p, m, t.rotation)), v = i ? null : t.stroke ? () => {
|
|
4329
|
+
Nr(r, t.stroke, n, {
|
|
4330
|
+
x: s,
|
|
4331
|
+
y: c,
|
|
4332
|
+
w: p,
|
|
4333
|
+
h: m
|
|
4330
4334
|
}, t.rotation), r.stroke();
|
|
4331
|
-
} : null,
|
|
4332
|
-
if (
|
|
4333
|
-
|
|
4335
|
+
} : null, y = () => Jn(r);
|
|
4336
|
+
if (x && !i) {
|
|
4337
|
+
a(r, h, s, c, p, m, [
|
|
4334
4338
|
t.adj,
|
|
4335
4339
|
t.adj2,
|
|
4336
4340
|
t.adj3,
|
|
@@ -4339,11 +4343,11 @@ function dr(e, t, n, r = "#000000", i, a = {
|
|
|
4339
4343
|
t.adj6,
|
|
4340
4344
|
t.adj7,
|
|
4341
4345
|
t.adj8
|
|
4342
|
-
],
|
|
4346
|
+
], _, v, y, b(h) ? { skipTrailingStroke: !0 } : void 0);
|
|
4343
4347
|
return;
|
|
4344
4348
|
}
|
|
4345
|
-
r.beginPath(), t.custGeom && t.custGeom.length > 0 ?
|
|
4346
|
-
},
|
|
4349
|
+
r.beginPath(), t.custGeom && t.custGeom.length > 0 ? _r(r, t.custGeom, s, c, p, m) : me(r, h, s, c, p, m, t.adj, t.adj2, t.adj3, t.adj4), _ && h !== "arc" && (r.fillStyle = _, h === "donut" || h === "smileyface" || h === "frame" ? r.fill("evenodd") : r.fill(), i || y()), v && v();
|
|
4350
|
+
}, w = e.getTransform(), T = Math.abs(w.a * w.d - w.b * w.c), E = T > 0 ? Math.sqrt(T) : 1, D = (t.shadow || t.reflection || t.softEdge || t.innerShadow ? x ? ae(h, l, u, d, f, [
|
|
4347
4351
|
t.adj,
|
|
4348
4352
|
t.adj2,
|
|
4349
4353
|
t.adj3,
|
|
@@ -4352,20 +4356,20 @@ function dr(e, t, n, r = "#000000", i, a = {
|
|
|
4352
4356
|
t.adj6,
|
|
4353
4357
|
t.adj7,
|
|
4354
4358
|
t.adj8
|
|
4355
|
-
]) : t.custGeom && t.custGeom.length > 0 ?
|
|
4356
|
-
x:
|
|
4357
|
-
y:
|
|
4358
|
-
w:
|
|
4359
|
-
h:
|
|
4360
|
-
},
|
|
4361
|
-
x:
|
|
4362
|
-
y:
|
|
4363
|
-
w:
|
|
4364
|
-
h:
|
|
4365
|
-
} :
|
|
4366
|
-
let r = t.stroke?.fill ?
|
|
4367
|
-
if (t.stroke && (
|
|
4368
|
-
let i =
|
|
4359
|
+
]) : t.custGeom && t.custGeom.length > 0 ? fe(t.custGeom, l, u, d, f) : null : null) ?? {
|
|
4360
|
+
x: l,
|
|
4361
|
+
y: u,
|
|
4362
|
+
w: d,
|
|
4363
|
+
h: f
|
|
4364
|
+
}, O = t.stroke ? t.stroke.width * n / 2 : 0, k = t.stroke ? Math.max(t.stroke.headEnd ? he(t.stroke.headEnd, t.stroke, n) : 0, t.stroke.tailEnd ? he(t.stroke.tailEnd, t.stroke, n) : 0) : 0, A = t.sp3d?.contourW ? t.sp3d.contourW * n : 0, j = Math.max(O, k, A), M = j > 0 ? {
|
|
4365
|
+
x: D.x - j,
|
|
4366
|
+
y: D.y - j,
|
|
4367
|
+
w: D.w + j * 2,
|
|
4368
|
+
h: D.h + j * 2
|
|
4369
|
+
} : D, N = lr(w, M.x, M.y, M.w, M.h), P = n * E, F = m ? [] : Cr(t.sp3d, t.scene3d?.lightRig, t.sp3d?.prstMaterial, n, E), I = (t.stroke ? t.stroke.width * n / 2 : 0) + 2, L = (e) => {
|
|
4370
|
+
let r = t.stroke?.fill ? _n(t.stroke.fill, e, l, u, d, f, t.rotation) ?? void 0 : void 0;
|
|
4371
|
+
if (t.stroke && (_.has(h) || y.has(h))) {
|
|
4372
|
+
let i = S(h, l, u, d, f, [
|
|
4369
4373
|
t.adj,
|
|
4370
4374
|
t.adj2,
|
|
4371
4375
|
t.adj3,
|
|
@@ -4376,69 +4380,69 @@ function dr(e, t, n, r = "#000000", i, a = {
|
|
|
4376
4380
|
t.adj8
|
|
4377
4381
|
]);
|
|
4378
4382
|
if (!i) return;
|
|
4379
|
-
let a = t.stroke.cmpd, o =
|
|
4380
|
-
if (
|
|
4383
|
+
let a = t.stroke.cmpd, o = h === "line" || h === "straightconnector1";
|
|
4384
|
+
if (b(h) && i.vertices.length >= 2 && !(a && o)) {
|
|
4381
4385
|
let r = i.vertices.map((e) => ({
|
|
4382
4386
|
x: e.x,
|
|
4383
4387
|
y: e.y
|
|
4384
4388
|
}));
|
|
4385
4389
|
if (t.stroke.tailEnd) {
|
|
4386
|
-
let e =
|
|
4387
|
-
r[r.length - 1] =
|
|
4390
|
+
let e = de(t.stroke.tailEnd, t.stroke, n);
|
|
4391
|
+
r[r.length - 1] = ce(r[r.length - 1], r[r.length - 2], e);
|
|
4388
4392
|
}
|
|
4389
4393
|
if (t.stroke.headEnd) {
|
|
4390
|
-
let e =
|
|
4391
|
-
r[0] =
|
|
4394
|
+
let e = de(t.stroke.headEnd, t.stroke, n);
|
|
4395
|
+
r[0] = ce(r[0], r[1], e);
|
|
4392
4396
|
}
|
|
4393
|
-
|
|
4394
|
-
x:
|
|
4395
|
-
y:
|
|
4396
|
-
w:
|
|
4397
|
-
h:
|
|
4397
|
+
Nr(e, t.stroke, n, {
|
|
4398
|
+
x: l,
|
|
4399
|
+
y: u,
|
|
4400
|
+
w: d,
|
|
4401
|
+
h: f
|
|
4398
4402
|
}, t.rotation), e.beginPath(), e.moveTo(r[0].x, r[0].y);
|
|
4399
4403
|
for (let t = 1; t < r.length; t++) e.lineTo(r[t].x, r[t].y);
|
|
4400
4404
|
e.stroke();
|
|
4401
4405
|
}
|
|
4402
|
-
a && o &&
|
|
4406
|
+
a && o && Mr(e, i.start, i.end, t.stroke, a, n, t.rotation), t.stroke.tailEnd && pe(e, i.end.x, i.end.y, i.end.angle, t.stroke.tailEnd, t.stroke, n, r), t.stroke.headEnd && pe(e, i.start.x, i.start.y, i.start.angle, t.stroke.headEnd, t.stroke, n, r);
|
|
4403
4407
|
return;
|
|
4404
4408
|
}
|
|
4405
4409
|
if (!t.stroke || !t.custGeom || t.custGeom.length === 0 || (!t.stroke.headEnd || t.stroke.headEnd.type === "none") && (!t.stroke.tailEnd || t.stroke.tailEnd.type === "none")) return;
|
|
4406
|
-
let { start: i, end: a } =
|
|
4407
|
-
i && t.stroke.headEnd && t.stroke.headEnd.type !== "none" &&
|
|
4408
|
-
},
|
|
4409
|
-
if (
|
|
4410
|
+
let { start: i, end: a } = ge(t.custGeom);
|
|
4411
|
+
i && t.stroke.headEnd && t.stroke.headEnd.type !== "none" && pe(e, l + i.x * d, u + i.y * f, Math.atan2(i.dy * f, i.dx * d), t.stroke.headEnd, t.stroke, n, r), a && t.stroke.tailEnd && t.stroke.tailEnd.type !== "none" && pe(e, l + a.x * d, u + a.y * f, Math.atan2(a.dy * f, a.dx * d), t.stroke.tailEnd, t.stroke, n, r);
|
|
4412
|
+
}, R = (e) => {
|
|
4413
|
+
if (F.length > 0 && Er(e, l, u, d, f, F, (e, t, n, r, i) => C(e, void 0, {
|
|
4410
4414
|
x: t,
|
|
4411
4415
|
y: n,
|
|
4412
4416
|
w: r,
|
|
4413
4417
|
h: i
|
|
4414
|
-
}), void 0,
|
|
4415
|
-
|
|
4418
|
+
}), void 0, I)) {
|
|
4419
|
+
L(e), Jn(e);
|
|
4416
4420
|
return;
|
|
4417
4421
|
}
|
|
4418
|
-
|
|
4422
|
+
C(e), L(e);
|
|
4419
4423
|
};
|
|
4420
|
-
if (
|
|
4421
|
-
let
|
|
4424
|
+
if (hr(e, t, R, R, N, fr(w, l, u, d, f, t.shadow?.algn), n, P, w, !!g, (e) => C(e, "#000")), t.textBody) {
|
|
4425
|
+
let a = sr(t, o);
|
|
4422
4426
|
if (e.save(), t.flipH || t.flipV) {
|
|
4423
|
-
let n =
|
|
4427
|
+
let n = l + d / 2, r = u + f / 2;
|
|
4424
4428
|
e.translate(n, r), t.flipH && e.scale(-1, 1), t.flipV && e.scale(1, -1), e.translate(-n, -r);
|
|
4425
4429
|
}
|
|
4426
|
-
let s =
|
|
4427
|
-
if (t.textRect) s = Y(t.textRect.x, n),
|
|
4428
|
-
else if (
|
|
4429
|
-
let e =
|
|
4430
|
-
s =
|
|
4430
|
+
let s = l, m = u, g = d, _ = f;
|
|
4431
|
+
if (t.textRect) s = Y(t.textRect.x, n), m = Y(t.textRect.y, n), g = Y(t.textRect.width, n), _ = Y(t.textRect.height, n);
|
|
4432
|
+
else if (h === "ellipse") {
|
|
4433
|
+
let e = d * (1 - 1 / Math.SQRT2) / 2, t = f * (1 - 1 / Math.SQRT2) / 2;
|
|
4434
|
+
s = l + e, m = u + t, g = d / Math.SQRT2, _ = f / Math.SQRT2;
|
|
4431
4435
|
} else {
|
|
4432
|
-
let e =
|
|
4433
|
-
e && (s = e.tx,
|
|
4436
|
+
let e = or(h, l, u, d, f, t.adj, t.adj2);
|
|
4437
|
+
e && (s = e.tx, m = e.ty, g = e.tw, _ = e.th);
|
|
4434
4438
|
}
|
|
4435
|
-
|
|
4439
|
+
Sr(e, t.textBody, s, m, g, _, n, a, t.rotation, !1, !1, r, i, o, p, !1, c), e.restore();
|
|
4436
4440
|
}
|
|
4437
4441
|
e.restore();
|
|
4438
4442
|
}
|
|
4439
|
-
var
|
|
4440
|
-
function
|
|
4441
|
-
let n = `${e}`, r = e >= 1 && e <= 26 ? String.fromCharCode(96 + e) : n, i = e >= 1 && e <= 26 ? String.fromCharCode(64 + e) : n, a =
|
|
4443
|
+
var _r = le;
|
|
4444
|
+
function vr(e, t) {
|
|
4445
|
+
let n = `${e}`, r = e >= 1 && e <= 26 ? String.fromCharCode(96 + e) : n, i = e >= 1 && e <= 26 ? String.fromCharCode(64 + e) : n, a = yr(e).toLowerCase(), o = yr(e), s = n.replace(/[0-9]/g, (e) => String.fromCharCode(65296 + (e.charCodeAt(0) - 48)));
|
|
4442
4446
|
switch (t) {
|
|
4443
4447
|
case "arabicPlain": return n;
|
|
4444
4448
|
case "arabicPeriod": return `${n}.`;
|
|
@@ -4465,7 +4469,7 @@ function pr(e, t) {
|
|
|
4465
4469
|
default: return `${n}.`;
|
|
4466
4470
|
}
|
|
4467
4471
|
}
|
|
4468
|
-
function
|
|
4472
|
+
function yr(e) {
|
|
4469
4473
|
let t = [
|
|
4470
4474
|
1e3,
|
|
4471
4475
|
900,
|
|
@@ -4498,28 +4502,28 @@ function mr(e) {
|
|
|
4498
4502
|
for (let i = 0; i < t.length; i++) for (; e >= t[i];) r += n[i], e -= t[i];
|
|
4499
4503
|
return r;
|
|
4500
4504
|
}
|
|
4501
|
-
function
|
|
4505
|
+
function br(e) {
|
|
4502
4506
|
for (let t of e.runs) if (t.type === "text" && t.text !== "" || t.type === "math") return !0;
|
|
4503
4507
|
return !1;
|
|
4504
4508
|
}
|
|
4505
|
-
function
|
|
4506
|
-
let n =
|
|
4507
|
-
if (e.bullet.type === "char") return t.clear(), n ?
|
|
4509
|
+
function xr(e, t) {
|
|
4510
|
+
let n = br(e);
|
|
4511
|
+
if (e.bullet.type === "char") return t.clear(), n ? ue(e.bullet.char, e.bullet.fontFamily ?? null) : "";
|
|
4508
4512
|
if (e.bullet.type === "autoNum") {
|
|
4509
4513
|
if (!n) return "";
|
|
4510
4514
|
let r = e.lvl;
|
|
4511
|
-
return t.has(r) ? t.set(r, t.get(r) + 1) : t.set(r, e.bullet.startAt ?? 1),
|
|
4515
|
+
return t.has(r) ? t.set(r, t.get(r) + 1) : t.set(r, e.bullet.startAt ?? 1), vr(t.get(r), e.bullet.numType);
|
|
4512
4516
|
}
|
|
4513
4517
|
return t.clear(), "";
|
|
4514
4518
|
}
|
|
4515
|
-
function
|
|
4519
|
+
function Sr(t, n, r, i, a, o, s, c = null, l = 0, u = !1, d = !1, f = "#000000", p, m = {
|
|
4516
4520
|
themeMajorFont: null,
|
|
4517
4521
|
themeMinorFont: null,
|
|
4518
4522
|
dpr: 1
|
|
4519
4523
|
}, h, g = !1, _, v = !1, y = g) {
|
|
4520
4524
|
let b = n.vert === "vert" || n.vert === "eaVert", x = n.vert === "vert270";
|
|
4521
4525
|
if (b || x) {
|
|
4522
|
-
let
|
|
4526
|
+
let e = r + a / 2, u = i + o / 2, d = b ? 90 : -90, v = h ? (e) => h({
|
|
4523
4527
|
...e,
|
|
4524
4528
|
inShapeX: e.inShapeX - o / 2 + a / 2,
|
|
4525
4529
|
inShapeY: e.inShapeY - a / 2 + o / 2,
|
|
@@ -4531,49 +4535,49 @@ function _r(e, n, r, i, a, o, s, c = null, l = 0, u = !1, d = !1, f = "#000000",
|
|
|
4531
4535
|
textBodyRotation: d
|
|
4532
4536
|
}) : void 0;
|
|
4533
4537
|
if (g) return a;
|
|
4534
|
-
|
|
4538
|
+
t.save(), t.translate(e, u), t.rotate(x ? -Math.PI / 2 : Math.PI / 2), Sr(t, {
|
|
4535
4539
|
...n,
|
|
4536
4540
|
vert: "horz"
|
|
4537
|
-
}, -o / 2, -a / 2, o, a, s, c, 0, !1, !1, f, p, m, v, !1, _, n.vert === "eaVert"),
|
|
4541
|
+
}, -o / 2, -a / 2, o, a, s, c, 0, !1, !1, f, p, m, v, !1, _, n.vert === "eaVert"), t.restore();
|
|
4538
4542
|
return;
|
|
4539
4543
|
}
|
|
4540
4544
|
let S = n.textWarp;
|
|
4541
|
-
if (!g && S &&
|
|
4542
|
-
|
|
4545
|
+
if (!g && S && qe(S.preset)) {
|
|
4546
|
+
ar(t, n, S.preset, S.adj ?? [], r, i, a, o, s, c ?? f, m);
|
|
4543
4547
|
return;
|
|
4544
4548
|
}
|
|
4545
|
-
let C = Y(n.lIns, s), w = Y(n.rIns, s), T = Y(n.tIns, s), E = Y(n.bIns, s), D = n.wrap !== "none", O = n.autoFit === "sp" ? D &&
|
|
4546
|
-
let i = (n.defaultFontSize ?? 18) * J * s *
|
|
4549
|
+
let C = Y(n.lIns, s), w = Y(n.rIns, s), T = Y(n.tIns, s), E = Y(n.bIns, s), D = n.wrap !== "none", O = n.autoFit === "sp" ? D && In(t, n, a, C, w, s, m) : D, k = Math.max(1, n.numCol ?? 1), j = Y(n.spcCol ?? 0, s), M = n.defaultBold ?? !1, N = n.defaultItalic ?? !1, P = c ?? f, F = (e) => {
|
|
4550
|
+
let i = (n.defaultFontSize ?? 18) * J * s * e, o = [], c = 0, l = /* @__PURE__ */ new Map();
|
|
4547
4551
|
for (let u = 0; u < n.paragraphs.length; u++) {
|
|
4548
|
-
let d = n.paragraphs[u], f = Y(d.marL, s), h = Y(d.marR, s), _ = Y(d.indent, s), v = d.defFontSize == null ? i : d.defFontSize * J * s *
|
|
4552
|
+
let d = n.paragraphs[u], f = Y(d.marL, s), h = Y(d.marR, s), _ = Y(d.indent, s), v = d.defFontSize == null ? i : d.defFontSize * J * s * e, b = d.defColor ? X(d.defColor) : P, x = Nn(d), S = (() => {
|
|
4549
4553
|
for (let e of d.runs) if (e.type === "text" && e.fontSize != null) return e.fontSize;
|
|
4550
4554
|
return null;
|
|
4551
|
-
})(), T = S == null ? v : S * J * s *
|
|
4555
|
+
})(), T = S == null ? v : S * J * s * e, E = (() => {
|
|
4552
4556
|
for (let e of d.runs) if (e.type === "text" && e.color) return e.color;
|
|
4553
4557
|
return null;
|
|
4554
|
-
})(), D = E ? X(E) : b,
|
|
4558
|
+
})(), D = E ? X(E) : b, A = (() => {
|
|
4555
4559
|
for (let e of d.runs) if (e.type === "text" && e.fontFamily) return e.fontFamily;
|
|
4556
4560
|
return d.defFontFamily ?? null;
|
|
4557
4561
|
})(), F = "", I = Z(!1, !1, T, "sans-serif", m), L = D, R = null;
|
|
4558
|
-
F =
|
|
4559
|
-
let B =
|
|
4562
|
+
F = xr(d, l);
|
|
4563
|
+
let B = He(d.bullet);
|
|
4560
4564
|
if (B.type === "char") {
|
|
4561
|
-
let
|
|
4562
|
-
I = Z(!1, !1,
|
|
4565
|
+
let t = B;
|
|
4566
|
+
I = Z(!1, !1, t.sizePts == null ? t.sizePct == null ? T : T * (t.sizePct / 100) : t.sizePts * J * s * e, F === t.char ? Sn(t.fontFamily ?? null, m) : "sans-serif", m), L = t.color ? X(t.color) : D;
|
|
4563
4567
|
} else if (B.type === "autoNum") {
|
|
4564
|
-
let
|
|
4565
|
-
I = Z(!1, !1,
|
|
4568
|
+
let t = B;
|
|
4569
|
+
I = Z(!1, !1, t.sizePts == null ? t.sizePct == null ? T : T * (t.sizePct / 100) : t.sizePts * J * s * e, Sn(t.fontFamily ?? A, m), m), L = B.color ? X(B.color) : D;
|
|
4566
4570
|
} else if (B.type === "blip") {
|
|
4567
|
-
let
|
|
4571
|
+
let t = B, n = t.sizePts == null ? t.sizePct == null ? T : T * (t.sizePct / 100) : t.sizePts * J * s * e;
|
|
4568
4572
|
R = {
|
|
4569
|
-
imagePath:
|
|
4570
|
-
mimeType:
|
|
4573
|
+
imagePath: t.imagePath,
|
|
4574
|
+
mimeType: t.mimeType,
|
|
4571
4575
|
sizePx: n
|
|
4572
4576
|
};
|
|
4573
4577
|
}
|
|
4574
|
-
let V = k > 1 ? (a - C - w - (k - 1) *
|
|
4575
|
-
for (let
|
|
4576
|
-
let r = W[
|
|
4578
|
+
let V = k > 1 ? (a - C - w - (k - 1) * j) / k : a - C - w, H = r + C + f, U = r + C + f + _, ee = V - f - h, W = Vn(t, d, O ? ee : Infinity, v, b, s, f, M, N, e, p, m, Pn(x, _)), te = d.spaceBefore == null ? 0 : d.spaceBefore / 100 * J * s * e, G = d.spaceAfter == null ? 0 : d.spaceAfter / 100 * J * s * e;
|
|
4579
|
+
for (let e = 0; e < W.length; e++) {
|
|
4580
|
+
let r = W[e], i = e === 0, a = e === W.length - 1, l = 0, f = 0;
|
|
4577
4581
|
for (let e of r.segments) {
|
|
4578
4582
|
let t = e.math ? Math.max(e.sizePx, (e.math.ascent + e.math.descent) / 1.2) : e.sizePx;
|
|
4579
4583
|
if (t > l && (l = t), !e.math) {
|
|
@@ -4582,14 +4586,14 @@ function _r(e, n, r, i, a, o, s, c = null, l = 0, u = !1, d = !1, f = "#000000",
|
|
|
4582
4586
|
}
|
|
4583
4587
|
}
|
|
4584
4588
|
if (l === 0 && (l = v), i && F) {
|
|
4585
|
-
|
|
4586
|
-
let
|
|
4589
|
+
t.font = I;
|
|
4590
|
+
let e = t.measureText("M"), n = e.actualBoundingBoxAscent + e.actualBoundingBoxDescent;
|
|
4587
4591
|
n > l && (l = n);
|
|
4588
4592
|
}
|
|
4589
4593
|
i && R && R.sizePx > l && (l = R.sizePx);
|
|
4590
4594
|
let p = l * 1.2, m = Math.max(p, f), h;
|
|
4591
4595
|
h = d.spaceLine ? d.spaceLine.type === "pct" ? (g ? l : p) * (d.spaceLine.val / 1e5) : d.spaceLine.val * J * s : g ? y ? p : l : m, n.autoFit === "norm" && n.lnSpcReduction != null && d.spaceLine?.type !== "pts" && (h *= 1 - n.lnSpcReduction);
|
|
4592
|
-
let b = h + (a ? G : 0), S = i && u > 0 ? te : 0, C = i ?
|
|
4596
|
+
let b = h + (a ? G : 0), S = i && u > 0 ? te : 0, C = i ? Pn(x, _) : 0, w = r.segments.some((e) => e.text && e.text.length > 0 || e.math != null), T = i && w ? R : null;
|
|
4593
4597
|
o.push({
|
|
4594
4598
|
line: r,
|
|
4595
4599
|
linePx: b,
|
|
@@ -4613,46 +4617,46 @@ function _r(e, n, r, i, a, o, s, c = null, l = 0, u = !1, d = !1, f = "#000000",
|
|
|
4613
4617
|
allLines: o,
|
|
4614
4618
|
totalHeight: c
|
|
4615
4619
|
};
|
|
4616
|
-
}, { allLines:
|
|
4617
|
-
if (n.autoFit === "norm") if (n.fontScale != null && n.fontScale > 0) n.fontScale < 1 && ({allLines:
|
|
4620
|
+
}, { allLines: I, totalHeight: L } = F(1);
|
|
4621
|
+
if (n.autoFit === "norm") if (n.fontScale != null && n.fontScale > 0) n.fontScale < 1 && ({allLines: I, totalHeight: L} = F(n.fontScale));
|
|
4618
4622
|
else {
|
|
4619
4623
|
let e = o - T - E;
|
|
4620
|
-
if (
|
|
4624
|
+
if (L > e && e > 0) {
|
|
4621
4625
|
let t = .1, n = 1;
|
|
4622
4626
|
for (let r = 0; r < 6; r++) {
|
|
4623
4627
|
let r = (t + n) / 2;
|
|
4624
|
-
|
|
4628
|
+
F(r).totalHeight <= e ? t = r : n = r;
|
|
4625
4629
|
}
|
|
4626
|
-
({allLines:
|
|
4630
|
+
({allLines: I, totalHeight: L} = F(t));
|
|
4627
4631
|
}
|
|
4628
4632
|
}
|
|
4629
|
-
if (g) return T +
|
|
4630
|
-
let
|
|
4631
|
-
o === 0 &&
|
|
4632
|
-
let H, U = Math.max(0,
|
|
4633
|
-
H =
|
|
4634
|
-
let ee = H, W = k > 1 ? (a - C - w - (k - 1) *
|
|
4635
|
-
for (let c of
|
|
4633
|
+
if (g) return T + L + E;
|
|
4634
|
+
let R = n.verticalAnchor ?? "t", B = i, V;
|
|
4635
|
+
o === 0 && R === "b" ? (V = T + L + E, B = i - V) : V = n.autoFit === "sp" ? Math.max(o, T + L + E) : o;
|
|
4636
|
+
let H, U = Math.max(0, V - T - E);
|
|
4637
|
+
H = R === "ctr" ? B + T + (U - L) / 2 : R === "b" ? B + V - E - L : B + T, t.save(), t.textAlign = "left", t.textBaseline = "alphabetic";
|
|
4638
|
+
let ee = H, W = k > 1 ? (a - C - w - (k - 1) * j) / k + j : 0, te = Math.max(0, V - T - E), G = I[I.length - 1], K = G ? Math.max(0, G.linePx - G.lineHeight) : 0, q = L - K, ne = o === 0 || q <= te + .5, re = k > 1 && !ne ? Math.ceil(I.length / k) : I.length, ie = 0, ae = 0;
|
|
4639
|
+
for (let c of I) {
|
|
4636
4640
|
let { line: u, linePx: d, lineHeight: f, topGapPx: p, textXOffset: g, bulletLabel: y, bulletFont: b, bulletColor: x, bulletImage: S, alignment: C, isLastLine: w } = c;
|
|
4637
4641
|
k > 1 && ie < k - 1 && ae >= re && (ie++, ae = 0, H = ee), H += p, ae++;
|
|
4638
|
-
let T = (n.rtlCol ? k - 1 - ie : ie) * W, E = c.textX + T, D = c.bulletX + T, O = c.textMaxW,
|
|
4639
|
-
if (
|
|
4640
|
-
let
|
|
4641
|
-
|
|
4642
|
-
let a =
|
|
4643
|
-
if (
|
|
4642
|
+
let T = (n.rtlCol ? k - 1 - ie : ie) * W, E = c.textX + T, D = c.bulletX + T, O = c.textMaxW, j = c.para.rtl === !0, M = j || Zt(u.segments), N = u.segments.some((e) => e.isTab);
|
|
4643
|
+
if (N) {
|
|
4644
|
+
let e = Y(c.para.marL, s), n = Y(c.para.marR, s), r = j ? n : e + g, i = O + e + n;
|
|
4645
|
+
t.font = u.segments.find((e) => e.isTab).font;
|
|
4646
|
+
let a = t.measureText(" ").width, o = un(u.segments.map((e) => {
|
|
4647
|
+
if (e.isTab) return {
|
|
4644
4648
|
isTab: !0,
|
|
4645
4649
|
width: 0
|
|
4646
4650
|
};
|
|
4647
|
-
if (
|
|
4651
|
+
if (e.math) return {
|
|
4648
4652
|
isTab: !1,
|
|
4649
|
-
width:
|
|
4653
|
+
width: e.math.width
|
|
4650
4654
|
};
|
|
4651
|
-
|
|
4652
|
-
let n =
|
|
4655
|
+
t.font = e.font;
|
|
4656
|
+
let n = e.letterSpacingPx ?? 0;
|
|
4653
4657
|
return {
|
|
4654
4658
|
isTab: !1,
|
|
4655
|
-
width:
|
|
4659
|
+
width: e.text ? (e.leadingLetterSpacingPx ?? 0) + Q(t, e.text, n) : 0
|
|
4656
4660
|
};
|
|
4657
4661
|
}), (c.para.tabStops ?? []).map((e) => ({
|
|
4658
4662
|
pos: Y(e.pos, s),
|
|
@@ -4660,78 +4664,78 @@ function _r(e, n, r, i, a, o, s, c = null, l = 0, u = !1, d = !1, f = "#000000",
|
|
|
4660
4664
|
})), r, i, a, Y(c.para.defTabSz ?? 914400, s));
|
|
4661
4665
|
for (let e = 0; e < u.segments.length; e++) u.segments[e].isTab && (u.segments[e].tabWidthPx = o[e]);
|
|
4662
4666
|
}
|
|
4663
|
-
let
|
|
4664
|
-
for (let
|
|
4665
|
-
if (
|
|
4666
|
-
|
|
4667
|
+
let P = 0, F = f * .8;
|
|
4668
|
+
for (let e of u.segments) {
|
|
4669
|
+
if (e.isTab) {
|
|
4670
|
+
P += e.tabWidthPx ?? 0;
|
|
4667
4671
|
continue;
|
|
4668
4672
|
}
|
|
4669
|
-
if (
|
|
4670
|
-
|
|
4673
|
+
if (e.math) {
|
|
4674
|
+
P += e.math.width, F = Math.max(F, e.math.ascent);
|
|
4671
4675
|
continue;
|
|
4672
4676
|
}
|
|
4673
|
-
|
|
4674
|
-
let n =
|
|
4675
|
-
|
|
4677
|
+
t.font = e.font;
|
|
4678
|
+
let n = t.measureText(e.text || "M"), r = e.letterSpacingPx ?? 0;
|
|
4679
|
+
P += e.leadingLetterSpacingPx ?? 0, P += e.text ? Q(t, e.text, r) : 0, n.actualBoundingBoxAscent > 0 && (F = Math.max(F, n.actualBoundingBoxAscent));
|
|
4676
4680
|
}
|
|
4677
|
-
let
|
|
4678
|
-
if (
|
|
4679
|
-
if (y)
|
|
4680
|
-
else if (S && _ && (
|
|
4681
|
+
let I = H + F, L = E + O, R = 0, z = null;
|
|
4682
|
+
if (M && j) {
|
|
4683
|
+
if (y) t.font = b, R = t.measureText(y).width;
|
|
4684
|
+
else if (S && _ && (z = A(S.imagePath, _), z)) {
|
|
4681
4685
|
let e = S.sizePx;
|
|
4682
|
-
|
|
4686
|
+
R = z.height > 0 ? e * (z.width / z.height) : e;
|
|
4683
4687
|
}
|
|
4684
4688
|
}
|
|
4685
|
-
if (y) if (
|
|
4686
|
-
let
|
|
4687
|
-
|
|
4688
|
-
} else
|
|
4689
|
+
if (y) if (t.font = b, t.fillStyle = x, M && j) {
|
|
4690
|
+
let e = t.direction;
|
|
4691
|
+
t.direction = "rtl", t.fillText(y, L - R, I), t.direction = e;
|
|
4692
|
+
} else t.fillText(y, D, I);
|
|
4689
4693
|
if (S && _) {
|
|
4690
|
-
let
|
|
4691
|
-
if (
|
|
4692
|
-
let
|
|
4693
|
-
|
|
4694
|
+
let e = A(S.imagePath, _);
|
|
4695
|
+
if (e) {
|
|
4696
|
+
let n = S.sizePx, r = e.height > 0 ? n * (e.width / e.height) : n, i = I - n;
|
|
4697
|
+
M && j ? t.drawImage(e, L - r, i, r, n) : t.drawImage(e, D, i, r, n);
|
|
4694
4698
|
}
|
|
4695
4699
|
}
|
|
4696
|
-
let
|
|
4697
|
-
|
|
4698
|
-
let U = C === "just" || C === "justLow" ? "just" : C === "thaiDist" ? "thaiDist" : C === "dist" ? "dist" : null, te = w || (u.endsWithBreak ?? !1), G = (U && !
|
|
4700
|
+
let B = E + g, V;
|
|
4701
|
+
V = N ? j ? E + O - R - P : B : C === "ctr" ? B + (O - g - P) / 2 : C === "r" ? E + O - R - P : B;
|
|
4702
|
+
let U = C === "just" || C === "justLow" ? "just" : C === "thaiDist" ? "thaiDist" : C === "dist" ? "dist" : null, te = w || (u.endsWithBreak ?? !1), G = (U && !M && !N ? tn(u.segments, O - g, P, U, te) : null) ?? u.segments, K = M ? Qt(u.segments, j) : null, q = (e, t) => {
|
|
4699
4703
|
if (Math.abs(e - t) !== 1) return 0;
|
|
4700
4704
|
let n = u.segments[Math.min(e, t)], r = u.segments[Math.max(e, t)];
|
|
4701
4705
|
return n.isTab || n.math || r.isTab || r.math || n.sourceRunId == null || n.sourceRunId !== r.sourceRunId ? 0 : r.leadingLetterSpacingPx ?? 0;
|
|
4702
4706
|
}, ne = G.length;
|
|
4703
|
-
for (let
|
|
4704
|
-
let
|
|
4705
|
-
if (
|
|
4706
|
-
let e = K ? K.order[
|
|
4707
|
-
|
|
4707
|
+
for (let n = 0; n < ne; n++) {
|
|
4708
|
+
let c = K ? K.order[n] : n, u = G[c], d = K ? K.rtl[c] : !1;
|
|
4709
|
+
if (M && (t.direction = d ? "rtl" : "ltr"), n > 0) {
|
|
4710
|
+
let e = K ? K.order[n - 1] : n - 1;
|
|
4711
|
+
V += q(e, c);
|
|
4708
4712
|
}
|
|
4709
|
-
if (
|
|
4710
|
-
|
|
4713
|
+
if (u.isTab) {
|
|
4714
|
+
V += u.tabWidthPx ?? 0;
|
|
4711
4715
|
continue;
|
|
4712
4716
|
}
|
|
4713
|
-
let
|
|
4714
|
-
if (
|
|
4715
|
-
let
|
|
4716
|
-
if (
|
|
4717
|
-
let i =
|
|
4718
|
-
|
|
4717
|
+
let p = u.jext ?? 0, g = u.splitBefore, _ = u.perGap ?? 0, y = g && g.length > 0 ? g.length * _ : 0;
|
|
4718
|
+
if (u.math) {
|
|
4719
|
+
let e = vn.get(u.math.nodes), n = u.math.width, r = u.math.ascent + u.math.descent;
|
|
4720
|
+
if (e && n > 0 && r > 0) {
|
|
4721
|
+
let i = I - u.math.ascent, a = yn(e, u.color);
|
|
4722
|
+
t.drawImage(a, V, i, n, r);
|
|
4719
4723
|
}
|
|
4720
|
-
|
|
4724
|
+
V += n, V += p;
|
|
4721
4725
|
continue;
|
|
4722
4726
|
}
|
|
4723
|
-
|
|
4724
|
-
let
|
|
4725
|
-
if (
|
|
4726
|
-
let
|
|
4727
|
-
|
|
4727
|
+
t.font = u.font, t.fillStyle = u.color;
|
|
4728
|
+
let b = u.drawSizePx ?? u.sizePx, x = I + (u.baseline ? -(u.baseline / 1e5) * u.sizePx : 0), S = u.letterSpacingPx ?? 0;
|
|
4729
|
+
if (u.highlight && u.text) {
|
|
4730
|
+
let e = Q(t, u.text, S) + y + p;
|
|
4731
|
+
gn(t, V, x, e, b, u.highlight, u.color);
|
|
4728
4732
|
}
|
|
4729
|
-
let
|
|
4733
|
+
let C = u.shadow, w = (e, t, n, r) => {
|
|
4730
4734
|
let i = r === "fill" ? e.fillText.bind(e) : e.strokeText.bind(e);
|
|
4731
|
-
if (
|
|
4735
|
+
if (S !== 0 && Rn(t) > 1) {
|
|
4732
4736
|
let r = e, a = r.letterSpacing;
|
|
4733
|
-
if (
|
|
4734
|
-
r.letterSpacing = `${
|
|
4737
|
+
if (Bn(e)) {
|
|
4738
|
+
r.letterSpacing = `${S}px`, i(t, n, x);
|
|
4735
4739
|
try {
|
|
4736
4740
|
r.letterSpacing = a;
|
|
4737
4741
|
} catch {}
|
|
@@ -4739,92 +4743,92 @@ function _r(e, n, r, i, a, o, s, c = null, l = 0, u = !1, d = !1, f = "#000000",
|
|
|
4739
4743
|
let r = n, a = [...t];
|
|
4740
4744
|
for (let t = 0; t < a.length; t++) {
|
|
4741
4745
|
let n = a[t];
|
|
4742
|
-
i(n, r,
|
|
4746
|
+
i(n, r, x), t < a.length - 1 && (r += e.measureText(n).width + S);
|
|
4743
4747
|
}
|
|
4744
4748
|
}
|
|
4745
|
-
} else i(t, n,
|
|
4746
|
-
},
|
|
4749
|
+
} else i(t, n, x);
|
|
4750
|
+
}, T = (e) => Q(t, e, S), E = g && g.length > 0 ? Ut([...u.text], g, _, T) : null, D = [...u.text], O = !!g && g.length === D.length - 1 && D.length > 1, k = (e, t) => {
|
|
4747
4751
|
if (v) {
|
|
4748
|
-
let n =
|
|
4749
|
-
|
|
4752
|
+
let n = O ? S + _ : S;
|
|
4753
|
+
hn(e, u.text, V, x, b, n, t);
|
|
4750
4754
|
return;
|
|
4751
4755
|
}
|
|
4752
|
-
if (
|
|
4753
|
-
let n = t === "fill" ? e.fillText.bind(e) : e.strokeText.bind(e), r =
|
|
4754
|
-
if (
|
|
4756
|
+
if (O) {
|
|
4757
|
+
let n = t === "fill" ? e.fillText.bind(e) : e.strokeText.bind(e), r = S + _;
|
|
4758
|
+
if (Bn(e)) {
|
|
4755
4759
|
let t = e, i = t.letterSpacing;
|
|
4756
|
-
t.letterSpacing = `${r}px`, n(
|
|
4760
|
+
t.letterSpacing = `${r}px`, n(u.text, V, x);
|
|
4757
4761
|
try {
|
|
4758
4762
|
t.letterSpacing = i;
|
|
4759
4763
|
} catch {}
|
|
4760
4764
|
} else {
|
|
4761
|
-
let t =
|
|
4762
|
-
for (let i = 0; i <
|
|
4763
|
-
let a =
|
|
4764
|
-
n(a, t,
|
|
4765
|
+
let t = V;
|
|
4766
|
+
for (let i = 0; i < D.length; i++) {
|
|
4767
|
+
let a = D[i];
|
|
4768
|
+
n(a, t, x), i < D.length - 1 && (t += e.measureText(a).width + r);
|
|
4765
4769
|
}
|
|
4766
4770
|
}
|
|
4767
|
-
} else if (
|
|
4768
|
-
else
|
|
4769
|
-
},
|
|
4770
|
-
if (
|
|
4771
|
-
let
|
|
4772
|
-
if (
|
|
4773
|
-
|
|
4774
|
-
let r =
|
|
4775
|
-
|
|
4776
|
-
e.font =
|
|
4771
|
+
} else if (E) for (let { text: n, dx: r } of E) w(e, n, V + r, t);
|
|
4772
|
+
else w(e, u.text, V, t);
|
|
4773
|
+
}, A = u.reflection;
|
|
4774
|
+
if (A && u.text) {
|
|
4775
|
+
let e = t.canvas.width || 0, n = t.canvas.height || 0;
|
|
4776
|
+
if (e > 0 && n > 0) {
|
|
4777
|
+
t.font = u.font;
|
|
4778
|
+
let r = t.measureText(u.text), i = Number.isFinite(r.actualBoundingBoxAscent) ? r.actualBoundingBoxAscent : b * .8, a = Number.isFinite(r.actualBoundingBoxDescent) ? r.actualBoundingBoxDescent : b * .2, o = Number.isFinite(r.actualBoundingBoxLeft) ? r.actualBoundingBoxLeft : 0, c = Number.isFinite(r.actualBoundingBoxRight) ? r.actualBoundingBoxRight : r.width, l = t.getTransform(), d = Math.abs(l.a * l.d - l.b * l.c), f = d > 0 ? Math.sqrt(d) : 1;
|
|
4779
|
+
Mn(t, (e) => {
|
|
4780
|
+
e.font = u.font, e.fillStyle = u.color, k(e, "fill");
|
|
4777
4781
|
}, {
|
|
4778
|
-
x: (
|
|
4779
|
-
y: (
|
|
4780
|
-
w: Math.max(1, o +
|
|
4782
|
+
x: (V - o) * f,
|
|
4783
|
+
y: (x - i) * f,
|
|
4784
|
+
w: Math.max(1, o + c) * f,
|
|
4781
4785
|
h: Math.max(1, i + a) * f
|
|
4782
|
-
},
|
|
4786
|
+
}, A, s * f, l, e, n), t.font = u.font, t.fillStyle = u.color;
|
|
4783
4787
|
}
|
|
4784
4788
|
}
|
|
4785
|
-
if (
|
|
4786
|
-
let
|
|
4787
|
-
|
|
4789
|
+
if (C) {
|
|
4790
|
+
let e = C.dir * Math.PI / 180, n = Y(C.dist, s);
|
|
4791
|
+
t.save(), t.shadowColor = X(C.color, C.alpha), t.shadowBlur = Y(C.blur, s), t.shadowOffsetX = Math.cos(e) * n, t.shadowOffsetY = Math.sin(e) * n;
|
|
4788
4792
|
}
|
|
4789
|
-
|
|
4790
|
-
let
|
|
4791
|
-
|
|
4792
|
-
let
|
|
4793
|
-
if (h &&
|
|
4794
|
-
text:
|
|
4795
|
-
inShapeX:
|
|
4793
|
+
k(t, "fill"), C && t.restore();
|
|
4794
|
+
let j = u.outline;
|
|
4795
|
+
j && j.width > 0 && (t.save(), t.lineWidth = Math.max(.5, Y(j.width, s)), t.strokeStyle = j.color ? `#${j.color}` : u.color, t.lineJoin = "round", k(t, "stroke"), t.restore()), t.font = u.font;
|
|
4796
|
+
let N = Q(t, u.text, S) + y;
|
|
4797
|
+
if (h && u.text && h({
|
|
4798
|
+
text: u.text,
|
|
4799
|
+
inShapeX: V - r,
|
|
4796
4800
|
inShapeY: H - i,
|
|
4797
|
-
w:
|
|
4801
|
+
w: N + p,
|
|
4798
4802
|
h: f,
|
|
4799
|
-
fontSize:
|
|
4800
|
-
font:
|
|
4803
|
+
fontSize: b,
|
|
4804
|
+
font: u.font,
|
|
4801
4805
|
shapeX: r,
|
|
4802
4806
|
shapeY: i,
|
|
4803
4807
|
shapeW: a,
|
|
4804
4808
|
shapeH: o,
|
|
4805
4809
|
rotation: l,
|
|
4806
|
-
hyperlink:
|
|
4807
|
-
}),
|
|
4808
|
-
let
|
|
4809
|
-
|
|
4810
|
-
let
|
|
4811
|
-
if (
|
|
4812
|
-
let
|
|
4813
|
-
|
|
4810
|
+
hyperlink: u.hyperlink
|
|
4811
|
+
}), u.underline && Vt(t, V, x, N + p, b, u.underlineColor ?? u.color, u.underlineStyle, m.dpr), u.strikethrough) {
|
|
4812
|
+
let n = Math.max(1, b * .05);
|
|
4813
|
+
t.strokeStyle = u.color, t.lineWidth = n, t.setLineDash([]);
|
|
4814
|
+
let r = x - b * .32;
|
|
4815
|
+
if (u.strikeDouble) {
|
|
4816
|
+
let i = n * .9, a = r - i, o = r + i;
|
|
4817
|
+
t.beginPath(), t.moveTo(V, a + e(a, n, m.dpr)), t.lineTo(V + N + p, a + e(a, n, m.dpr)), t.moveTo(V, o + e(o, n, m.dpr)), t.lineTo(V + N + p, o + e(o, n, m.dpr)), t.stroke();
|
|
4814
4818
|
} else {
|
|
4815
|
-
let
|
|
4816
|
-
|
|
4819
|
+
let i = r + e(r, n, m.dpr);
|
|
4820
|
+
t.beginPath(), t.moveTo(V, i), t.lineTo(V + N + p, i), t.stroke();
|
|
4817
4821
|
}
|
|
4818
4822
|
}
|
|
4819
|
-
|
|
4823
|
+
V += N, V += p;
|
|
4820
4824
|
}
|
|
4821
|
-
|
|
4825
|
+
M && (t.direction = "ltr"), H += d;
|
|
4822
4826
|
}
|
|
4823
|
-
|
|
4827
|
+
t.restore();
|
|
4824
4828
|
}
|
|
4825
|
-
function
|
|
4829
|
+
function Cr(e, t, n, r, i) {
|
|
4826
4830
|
if (!e) return [];
|
|
4827
|
-
let a =
|
|
4831
|
+
let a = kt(t?.rig ?? "threePt", t?.dir ?? "t", t?.rot), o = Ft(n), s = r * i, c = [];
|
|
4828
4832
|
return e.bevelT && e.bevelT.w > 0 && e.bevelT.h > 0 && c.push({
|
|
4829
4833
|
widthPx: e.bevelT.w * s,
|
|
4830
4834
|
heightPx: e.bevelT.h * s,
|
|
@@ -4840,9 +4844,9 @@ function vr(e, t, n, r, i) {
|
|
|
4840
4844
|
bottom: !0
|
|
4841
4845
|
}), c;
|
|
4842
4846
|
}
|
|
4843
|
-
function
|
|
4847
|
+
function wr(e, t, n, r, i, a) {
|
|
4844
4848
|
if (!e || !e.extrusionH || e.extrusionH <= 0) return null;
|
|
4845
|
-
let o = e.extrusionH * i * a, s =
|
|
4849
|
+
let o = e.extrusionH * i * a, s = mt(t, n * a, r * a, o);
|
|
4846
4850
|
if (Math.hypot(s.x, s.y) < .75) return null;
|
|
4847
4851
|
let c = [
|
|
4848
4852
|
64,
|
|
@@ -4863,14 +4867,14 @@ function yr(e, t, n, r, i, a) {
|
|
|
4863
4867
|
rgb: c
|
|
4864
4868
|
};
|
|
4865
4869
|
}
|
|
4866
|
-
function
|
|
4870
|
+
function Tr(e, t, n, r, i, a, o, s = {}) {
|
|
4867
4871
|
if (i <= 0 || a <= 0) return !1;
|
|
4868
|
-
let c = e.getTransform(), l = Math.abs(c.a * c.d - c.b * c.c), u = l > 0 ? Math.sqrt(l) : 1, d = Math.max(0, Math.ceil((s.edgePadCss ?? 0) * u)), f =
|
|
4872
|
+
let c = e.getTransform(), l = Math.abs(c.a * c.d - c.b * c.c), u = l > 0 ? Math.sqrt(l) : 1, d = Math.max(0, Math.ceil((s.edgePadCss ?? 0) * u)), f = ft(t, i, a), p = f.corners;
|
|
4869
4873
|
if (d > 0) {
|
|
4870
|
-
let e = d / u, t =
|
|
4874
|
+
let e = d / u, t = Le(f.corners, e / i, e / a);
|
|
4871
4875
|
t ? p = t : d = 0;
|
|
4872
4876
|
}
|
|
4873
|
-
let m = d / u, h = Math.max(1, Math.ceil(i * u) + 2 * d), g = Math.max(1, Math.ceil(a * u) + 2 * d), _ =
|
|
4877
|
+
let m = d / u, h = Math.max(1, Math.ceil(i * u) + 2 * d), g = Math.max(1, Math.ceil(a * u) + 2 * d), _ = De(h, g);
|
|
4874
4878
|
if (!_) return !1;
|
|
4875
4879
|
let v = _.getContext("2d");
|
|
4876
4880
|
if (!v) return !1;
|
|
@@ -4883,17 +4887,17 @@ function br(e, t, n, r, i, a, o, s = {}) {
|
|
|
4883
4887
|
});
|
|
4884
4888
|
if (s.extrusion) {
|
|
4885
4889
|
let e = Math.ceil(Math.hypot(s.extrusion.offsetX, s.extrusion.offsetY)) + 2;
|
|
4886
|
-
|
|
4890
|
+
Bt(v, s.extrusion, x(e));
|
|
4887
4891
|
}
|
|
4888
|
-
if (s.bevels && s.bevels.length > 0) for (let e of s.bevels)
|
|
4889
|
-
return s.paintEdges && (v.save(), v.scale(u, u), v.translate(m, m), s.paintEdges(v, 0, 0, i, a), v.restore()),
|
|
4892
|
+
if (s.bevels && s.bevels.length > 0) for (let e of s.bevels) zt(v, e, x(Math.ceil(e.widthPx) + 2));
|
|
4893
|
+
return s.paintEdges && (v.save(), v.scale(u, u), v.translate(m, m), s.paintEdges(v, 0, 0, i, a), v.restore()), Ae(_, e, h, g, p.map((e) => ({
|
|
4890
4894
|
x: n + e.x,
|
|
4891
4895
|
y: r + e.y
|
|
4892
4896
|
}))), !0;
|
|
4893
4897
|
}
|
|
4894
|
-
function
|
|
4898
|
+
function Er(e, t, n, r, i, a, o, s, c = 0) {
|
|
4895
4899
|
if (r <= 0 || i <= 0 || a.length === 0) return !1;
|
|
4896
|
-
let l = e.getTransform(), u = Math.abs(l.a * l.d - l.b * l.c), d = u > 0 ? Math.sqrt(u) : 1, f = Math.max(0, Math.ceil(c * d)), p = f / d, m = Math.max(1, Math.ceil(r * d) + 2 * f), h = Math.max(1, Math.ceil(i * d) + 2 * f), g =
|
|
4900
|
+
let l = e.getTransform(), u = Math.abs(l.a * l.d - l.b * l.c), d = u > 0 ? Math.sqrt(u) : 1, f = Math.max(0, Math.ceil(c * d)), p = f / d, m = Math.max(1, Math.ceil(r * d) + 2 * f), h = Math.max(1, Math.ceil(i * d) + 2 * f), g = De(m, h);
|
|
4897
4901
|
if (!g) return !1;
|
|
4898
4902
|
let _ = g.getContext("2d");
|
|
4899
4903
|
if (!_) return !1;
|
|
@@ -4901,7 +4905,7 @@ function xr(e, t, n, r, i, a, o, s, c = 0) {
|
|
|
4901
4905
|
let v = Math.ceil(r * d), y = Math.ceil(i * d);
|
|
4902
4906
|
for (let e of a) {
|
|
4903
4907
|
let t = Math.ceil(e.widthPx) + 2;
|
|
4904
|
-
|
|
4908
|
+
zt(_, e, {
|
|
4905
4909
|
x: f - t,
|
|
4906
4910
|
y: f - t,
|
|
4907
4911
|
w: v + 2 * t,
|
|
@@ -4910,19 +4914,19 @@ function xr(e, t, n, r, i, a, o, s, c = 0) {
|
|
|
4910
4914
|
}
|
|
4911
4915
|
return s && (_.save(), _.scale(d, d), _.translate(p, p), s(_, 0, 0, r, i), _.restore()), e.drawImage(g, t - p, n - p, m / d, h / d), !0;
|
|
4912
4916
|
}
|
|
4913
|
-
var
|
|
4914
|
-
function
|
|
4915
|
-
let t =
|
|
4917
|
+
var Dr = /* @__PURE__ */ new WeakMap();
|
|
4918
|
+
function Or(e) {
|
|
4919
|
+
let t = Dr.get(e);
|
|
4916
4920
|
return t || (t = async (t, n) => {
|
|
4917
4921
|
let r = await e(t);
|
|
4918
4922
|
return r.type === n ? r : new Blob([r], { type: n });
|
|
4919
|
-
},
|
|
4923
|
+
}, Dr.set(e, t)), t;
|
|
4920
4924
|
}
|
|
4921
|
-
function
|
|
4922
|
-
return
|
|
4925
|
+
function kr(e, t, n = Or(t)) {
|
|
4926
|
+
return R("base", e.posterPath, n, async () => {
|
|
4923
4927
|
let n = await t(e.posterPath), r = e.posterMimeType || n.type || "application/octet-stream";
|
|
4924
4928
|
return {
|
|
4925
|
-
bitmap: await
|
|
4929
|
+
bitmap: await xe(n.type === r ? n : new Blob([n], { type: r })),
|
|
4926
4930
|
owned: !0
|
|
4927
4931
|
};
|
|
4928
4932
|
}).then((e) => {
|
|
@@ -4930,98 +4934,98 @@ function wr(e, t, n = Cr(t)) {
|
|
|
4930
4934
|
return e;
|
|
4931
4935
|
});
|
|
4932
4936
|
}
|
|
4933
|
-
async function
|
|
4937
|
+
async function Ar(e, t, n, r, i) {
|
|
4934
4938
|
if (i) try {
|
|
4935
|
-
let a = t.mimeType === "image/svg+xml",
|
|
4936
|
-
if (!
|
|
4937
|
-
let { widthPt:
|
|
4938
|
-
if (
|
|
4939
|
-
|
|
4939
|
+
let a = t.mimeType === "image/svg+xml", o = Ce(t.mimeType, t.srcRect, t.width / J, t.height / J);
|
|
4940
|
+
if (!o) return;
|
|
4941
|
+
let { widthPt: s, heightPt: c } = o, l;
|
|
4942
|
+
if (x(t)) try {
|
|
4943
|
+
l = await q(t.svgImagePath, i);
|
|
4940
4944
|
} catch {
|
|
4941
|
-
|
|
4942
|
-
widthPt:
|
|
4943
|
-
heightPt:
|
|
4945
|
+
l = a ? await q(t.imagePath, i) : await ze(t.imagePath, t.mimeType, t.duotone, i, {
|
|
4946
|
+
widthPt: s,
|
|
4947
|
+
heightPt: c
|
|
4944
4948
|
});
|
|
4945
4949
|
}
|
|
4946
|
-
else
|
|
4947
|
-
widthPt:
|
|
4948
|
-
heightPt:
|
|
4950
|
+
else l = a ? await q(t.imagePath, i) : await ze(t.imagePath, t.mimeType, t.duotone, i, {
|
|
4951
|
+
widthPt: s,
|
|
4952
|
+
heightPt: c
|
|
4949
4953
|
});
|
|
4950
|
-
if (!
|
|
4954
|
+
if (!l || r()) return;
|
|
4951
4955
|
e.save(), t.alpha != null && (e.globalAlpha *= t.alpha);
|
|
4952
|
-
let
|
|
4953
|
-
(t.rotation !== 0 || t.flipH || t.flipV) && (e.translate(
|
|
4954
|
-
let
|
|
4955
|
-
t.custGeom && t.custGeom.length > 0 ?
|
|
4956
|
-
},
|
|
4957
|
-
e.beginPath(),
|
|
4958
|
-
},
|
|
4959
|
-
(t.prstGeom || t.custGeom && t.custGeom.length > 0) && (
|
|
4960
|
-
},
|
|
4961
|
-
t.stroke && (e.save(),
|
|
4956
|
+
let u = Y(t.x, n), d = Y(t.y, n), f = Y(t.width, n), p = Y(t.height, n);
|
|
4957
|
+
(t.rotation !== 0 || t.flipH || t.flipV) && (e.translate(u + f / 2, d + p / 2), e.rotate(t.rotation * Math.PI / 180), t.flipH && e.scale(-1, 1), t.flipV && e.scale(1, -1), e.translate(-(u + f / 2), -(d + p / 2)));
|
|
4958
|
+
let m = (e, n, r, i, a) => {
|
|
4959
|
+
t.custGeom && t.custGeom.length > 0 ? _r(e, t.custGeom, n, r, i, a) : t.prstGeom && ne(e, t.prstGeom, n, r, i, a, t.prstAdjust ?? []) || e.rect(n, r, i, a);
|
|
4960
|
+
}, h = (e, t, n, r, i) => {
|
|
4961
|
+
e.beginPath(), m(e, t, n, r, i);
|
|
4962
|
+
}, g = (e, n, r, i, a) => {
|
|
4963
|
+
(t.prstGeom || t.custGeom && t.custGeom.length > 0) && (h(e, n, r, i, a), e.clip());
|
|
4964
|
+
}, _ = (e, r, i, a, o) => {
|
|
4965
|
+
t.stroke && (e.save(), Nr(e, t.stroke, n, {
|
|
4962
4966
|
x: r,
|
|
4963
4967
|
y: i,
|
|
4964
4968
|
w: a,
|
|
4965
4969
|
h: o
|
|
4966
|
-
}, t.rotation),
|
|
4967
|
-
},
|
|
4970
|
+
}, t.rotation), h(e, r, i, a, o), e.stroke(), e.restore());
|
|
4971
|
+
}, y = (e, r, i, a, o) => {
|
|
4968
4972
|
let s = t.sp3d;
|
|
4969
4973
|
if (s && (s.contourW ?? 0) > 0 && s.contourClr) {
|
|
4970
4974
|
let t = Math.max(.5, s.contourW * n);
|
|
4971
4975
|
e.save(), e.beginPath();
|
|
4972
4976
|
let c = t * 2 + Math.max(a, o);
|
|
4973
|
-
e.rect(r - c, i - c, a + 2 * c, o + 2 * c),
|
|
4977
|
+
e.rect(r - c, i - c, a + 2 * c, o + 2 * c), m(e, r, i, a, o), e.clip("evenodd"), e.beginPath(), h(e, r, i, a, o), e.strokeStyle = X(s.contourClr), e.lineWidth = t * 2, e.setLineDash([]), e.stroke(), e.restore();
|
|
4974
4978
|
}
|
|
4975
|
-
},
|
|
4976
|
-
e.save(),
|
|
4979
|
+
}, b = t.scene3d && pt(t.scene3d.camera) ? t.scene3d : null, S = (e, n, r, i, a) => {
|
|
4980
|
+
e.save(), g(e, n, r, i, a), Ee(e, l, t.srcRect, n, r, i, a), e.restore();
|
|
4981
|
+
}, C = (e, t, n, r, i) => {
|
|
4982
|
+
S(e, t, n, r, i), _(e, t, n, r, i), y(e, t, n, r, i);
|
|
4977
4983
|
}, w = (e, t, n, r, i) => {
|
|
4978
|
-
|
|
4979
|
-
}, T = (
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
paintEdges: x,
|
|
4987
|
-
edgePadCss: P
|
|
4984
|
+
S(e, t, n, r, i), _(e, t, n, r, i);
|
|
4985
|
+
}, T = e.getTransform(), E = Math.abs(T.a * T.d - T.b * T.c), D = E > 0 ? Math.sqrt(E) : 1, O = Cr(t.sp3d, t.scene3d?.lightRig, t.sp3d ? t.sp3d.prstMaterial : void 0, n, D), k = b ? wr(t.sp3d, b.camera, f, p, n, D) : null, A = t.stroke ? t.stroke.width * n / 2 : 0, j = t.sp3d?.contourW ? t.sp3d.contourW * n : 0, M = k ? Math.hypot(k.offsetX, k.offsetY) / D : 0, N = A + j + M + 2, P = (e) => {
|
|
4986
|
+
if (b) {
|
|
4987
|
+
if (Tr(e, b.camera, u, d, f, p, w, {
|
|
4988
|
+
bevels: O,
|
|
4989
|
+
extrusion: k ?? void 0,
|
|
4990
|
+
paintEdges: y,
|
|
4991
|
+
edgePadCss: N
|
|
4988
4992
|
})) return;
|
|
4989
|
-
} else if (
|
|
4990
|
-
|
|
4991
|
-
},
|
|
4992
|
-
e.save(),
|
|
4993
|
-
},
|
|
4994
|
-
|
|
4995
|
-
},
|
|
4996
|
-
x:
|
|
4997
|
-
y:
|
|
4998
|
-
w:
|
|
4999
|
-
h:
|
|
5000
|
-
},
|
|
5001
|
-
bbox:
|
|
5002
|
-
anchor:
|
|
5003
|
-
},
|
|
5004
|
-
|
|
4993
|
+
} else if (O.length > 0 && Er(e, u, d, f, p, O, w, y, N)) return;
|
|
4994
|
+
C(e, u, d, f, p);
|
|
4995
|
+
}, F = (e, t, n, r, i, a) => {
|
|
4996
|
+
e.save(), g(e, n, r, i, a), e.fillStyle = t, e.fillRect(n, r, i, a), e.restore();
|
|
4997
|
+
}, I = (e, t) => {
|
|
4998
|
+
b && Tr(e, b.camera, u, d, f, p, (e, n, r, i, a) => F(e, t, n, r, i, a)) || F(e, t, u, d, f, p);
|
|
4999
|
+
}, L = e.getTransform(), R = Math.abs(L.a * L.d - L.b * L.c), z = R > 0 ? Math.sqrt(R) : 1, B = A + j, V = (t.custGeom && t.custGeom.length > 0 ? fe(t.custGeom, u, d, f, p) : t.prstGeom && v(t.prstGeom.toLowerCase()) ? ae(t.prstGeom.toLowerCase(), u, d, f, p, t.prstAdjust ?? []) : null) ?? {
|
|
5000
|
+
x: u,
|
|
5001
|
+
y: d,
|
|
5002
|
+
w: f,
|
|
5003
|
+
h: p
|
|
5004
|
+
}, H = b ? pr(b.camera, L, u, d, f, p, N, t.shadow?.algn) : {
|
|
5005
|
+
bbox: lr(L, V.x - B, V.y - B, V.w + B * 2, V.h + B * 2),
|
|
5006
|
+
anchor: fr(L, u, d, f, p, t.shadow?.algn)
|
|
5007
|
+
}, U = n * z, ee = !!(t.shadow || t.innerShadow || t.glow || t.softEdge || t.reflection), W = (e) => I(e, "#000");
|
|
5008
|
+
hr(e, t, b && ee ? mr(P, L, H.bbox, {
|
|
5005
5009
|
w: e.canvas.width || 0,
|
|
5006
5010
|
h: e.canvas.height || 0
|
|
5007
|
-
}) :
|
|
5011
|
+
}) : P, b && ee ? mr(W, L, H.bbox, {
|
|
5008
5012
|
w: e.canvas.width || 0,
|
|
5009
5013
|
h: e.canvas.height || 0
|
|
5010
|
-
}) :
|
|
5014
|
+
}) : W, H.bbox, H.anchor, n, U, L), e.restore();
|
|
5011
5015
|
} catch (e) {
|
|
5012
|
-
if (
|
|
5016
|
+
if (Te(e)) throw e;
|
|
5013
5017
|
}
|
|
5014
5018
|
}
|
|
5015
|
-
async function
|
|
5019
|
+
async function jr(e, t, n, r, i, a, o) {
|
|
5016
5020
|
let s = Y(t.x, n), c = Y(t.y, n), l = Y(t.width, n), u = Y(t.height, n), d;
|
|
5017
5021
|
if (t.posterPath && i) try {
|
|
5018
|
-
d = await
|
|
5022
|
+
d = await kr(t, i, o);
|
|
5019
5023
|
} catch (e) {
|
|
5020
|
-
if (
|
|
5024
|
+
if (Te(e)) throw e;
|
|
5021
5025
|
}
|
|
5022
|
-
r() || (e.save(),
|
|
5026
|
+
r() || (e.save(), Pr(e, t, n), d ? e.drawImage(d, s, c, l, u) : (e.fillStyle = t.mediaKind === "video" ? "#111" : "#f0f0f0", e.fillRect(s, c, l, u)), a || Jt(e, s + l / 2, c + u / 2, l, u, "paused"), e.restore());
|
|
5023
5027
|
}
|
|
5024
|
-
function
|
|
5028
|
+
function Mr(e, t, n, r, i, a, o) {
|
|
5025
5029
|
let s = Math.max(.5, Y(r.width, a)), c = n.x - t.x, l = n.y - t.y, u = Math.hypot(c, l);
|
|
5026
5030
|
if (u === 0) return;
|
|
5027
5031
|
let d = -l / u, f = c / u, p;
|
|
@@ -5071,170 +5075,170 @@ function Dr(e, t, n, r, i, a, o) {
|
|
|
5071
5075
|
break;
|
|
5072
5076
|
default: return;
|
|
5073
5077
|
}
|
|
5074
|
-
e.save(), e.globalCompositeOperation = "destination-out", e.strokeStyle = "#000", e.lineWidth = s + .5, e.setLineDash([]), e.beginPath(), e.moveTo(t.x, t.y), e.lineTo(n.x, n.y), e.stroke(), e.globalCompositeOperation = "source-over", e.strokeStyle = (r.fill ?
|
|
5078
|
+
e.save(), e.globalCompositeOperation = "destination-out", e.strokeStyle = "#000", e.lineWidth = s + .5, e.setLineDash([]), e.beginPath(), e.moveTo(t.x, t.y), e.lineTo(n.x, n.y), e.stroke(), e.globalCompositeOperation = "source-over", e.strokeStyle = (r.fill ? _n(r.fill, e, Math.min(t.x, n.x), Math.min(t.y, n.y), Math.max(1, Math.abs(n.x - t.x)), Math.max(1, Math.abs(n.y - t.y)), o) : null) ?? X(r.color);
|
|
5075
5079
|
for (let r of p) {
|
|
5076
5080
|
let i = d * (s * r.offset), a = f * (s * r.offset);
|
|
5077
5081
|
e.lineWidth = Math.max(.5, s * r.widthFrac), e.beginPath(), e.moveTo(t.x + i, t.y + a), e.lineTo(n.x + i, n.y + a), e.stroke();
|
|
5078
5082
|
}
|
|
5079
5083
|
e.restore();
|
|
5080
5084
|
}
|
|
5081
|
-
function
|
|
5082
|
-
if (
|
|
5083
|
-
let n =
|
|
5085
|
+
function Nr(e, t, n, r, i = 0) {
|
|
5086
|
+
if (Se(e, t, n), t?.fill && r) {
|
|
5087
|
+
let n = _n(t.fill, e, r.x, r.y, r.w, r.h, i);
|
|
5084
5088
|
n && (e.strokeStyle = n);
|
|
5085
5089
|
}
|
|
5086
5090
|
}
|
|
5087
|
-
function
|
|
5091
|
+
function Pr(e, t, n) {
|
|
5088
5092
|
if (t.rotation === 0 && !t.flipH && !t.flipV) return;
|
|
5089
5093
|
let r = Y(t.x, n), i = Y(t.y, n), a = Y(t.width, n), o = Y(t.height, n);
|
|
5090
5094
|
e.translate(r + a / 2, i + o / 2), e.rotate(t.rotation * Math.PI / 180), t.flipH && e.scale(-1, 1), t.flipV && e.scale(1, -1), e.translate(-(r + a / 2), -(i + o / 2));
|
|
5091
5095
|
}
|
|
5092
|
-
function
|
|
5096
|
+
function Fr(t, n, r, i, a = {
|
|
5093
5097
|
themeMajorFont: null,
|
|
5094
5098
|
themeMinorFont: null,
|
|
5095
5099
|
dpr: 1
|
|
5096
5100
|
}) {
|
|
5097
|
-
|
|
5098
|
-
let
|
|
5101
|
+
t.save(), Pr(t, n, r);
|
|
5102
|
+
let o = Y(n.x, r), s = Y(n.y, r), c = n.cols.map((e) => Y(e, r)), l = c.length, u = (e, t) => {
|
|
5099
5103
|
let n = 0;
|
|
5100
|
-
for (let r = 0; r < t; r++) n +=
|
|
5104
|
+
for (let r = 0; r < t; r++) n += c[e + r] ?? 0;
|
|
5101
5105
|
return n;
|
|
5102
|
-
},
|
|
5103
|
-
for (let
|
|
5104
|
-
let o =
|
|
5105
|
-
for (let
|
|
5106
|
-
let s = o.cells[
|
|
5106
|
+
}, d = n.rows.map((e) => Y(e.height, r));
|
|
5107
|
+
for (let e = 0; e < n.rows.length; e++) {
|
|
5108
|
+
let o = n.rows[e];
|
|
5109
|
+
for (let n = 0; n < o.cells.length; n++) {
|
|
5110
|
+
let s = o.cells[n];
|
|
5107
5111
|
if (s.hMerge || s.vMerge || (s.rowSpan || 1) > 1 || !s.textBody) continue;
|
|
5108
|
-
let c =
|
|
5109
|
-
|
|
5112
|
+
let c = u(n, s.gridSpan || 1), l = Sr(t, s.textBody, 0, 0, c, 0, r, null, 0, !1, !1, "#000000", i, a, void 0, !0, void 0, !1, o.height === 0) || 0;
|
|
5113
|
+
l > d[e] && (d[e] = l);
|
|
5110
5114
|
}
|
|
5111
5115
|
}
|
|
5112
|
-
for (let
|
|
5113
|
-
let o =
|
|
5116
|
+
for (let e = 0; e < n.rows.length; e++) {
|
|
5117
|
+
let o = n.rows[e];
|
|
5114
5118
|
for (let s = 0; s < o.cells.length; s++) {
|
|
5115
5119
|
let c = o.cells[s];
|
|
5116
5120
|
if (c.hMerge || c.vMerge) continue;
|
|
5117
|
-
let
|
|
5118
|
-
if (
|
|
5119
|
-
let f =
|
|
5120
|
-
for (let
|
|
5121
|
+
let l = c.rowSpan || 1;
|
|
5122
|
+
if (l <= 1 || !c.textBody) continue;
|
|
5123
|
+
let f = u(s, c.gridSpan || 1), p = n.rows.slice(e, Math.min(n.rows.length, e + l)).some((e) => e.height === 0), m = Sr(t, c.textBody, 0, 0, f, 0, r, null, 0, !1, !1, "#000000", i, a, void 0, !0, void 0, !1, p) || 0, h = 0;
|
|
5124
|
+
for (let t = 0; t < l && e + t < d.length; t++) h += d[e + t];
|
|
5121
5125
|
if (m > h) {
|
|
5122
|
-
let
|
|
5123
|
-
for (let
|
|
5126
|
+
let t = (m - h) / l;
|
|
5127
|
+
for (let n = 0; n < l && e + n < d.length; n++) d[e + n] += t;
|
|
5124
5128
|
}
|
|
5125
5129
|
}
|
|
5126
5130
|
}
|
|
5127
|
-
let
|
|
5128
|
-
if (
|
|
5129
|
-
let e =
|
|
5130
|
-
for (let t = 0; t <
|
|
5131
|
+
let f = c.reduce((e, t) => e + t, 0), p = Array(l);
|
|
5132
|
+
if (n.rtl) {
|
|
5133
|
+
let e = o + f;
|
|
5134
|
+
for (let t = 0; t < l; t++) e -= c[t], p[t] = e;
|
|
5131
5135
|
} else {
|
|
5132
|
-
let e =
|
|
5133
|
-
for (let t = 0; t <
|
|
5136
|
+
let e = o;
|
|
5137
|
+
for (let t = 0; t < l; t++) p[t] = e, e += c[t];
|
|
5134
5138
|
}
|
|
5135
|
-
let
|
|
5139
|
+
let m = (e, t) => n.rtl ? p[e + t - 1] : p[e], h = Array(n.rows.length);
|
|
5136
5140
|
{
|
|
5137
|
-
let e =
|
|
5138
|
-
for (let
|
|
5141
|
+
let e = s;
|
|
5142
|
+
for (let t = 0; t < n.rows.length; t++) h[t] = e, e += d[t];
|
|
5139
5143
|
}
|
|
5140
|
-
let
|
|
5141
|
-
for (let e = 0; e <
|
|
5142
|
-
let
|
|
5143
|
-
for (let i = 0; i <
|
|
5144
|
-
let a =
|
|
5144
|
+
let g = [], _ = n.rows.map(() => Array(l).fill(-1));
|
|
5145
|
+
for (let e = 0; e < n.rows.length; e++) {
|
|
5146
|
+
let t = n.rows[e], r = h[e];
|
|
5147
|
+
for (let i = 0; i < t.cells.length; i++) {
|
|
5148
|
+
let a = t.cells[i];
|
|
5145
5149
|
if (a.hMerge || a.vMerge) continue;
|
|
5146
|
-
let o = a.gridSpan || 1, s = a.rowSpan || 1,
|
|
5147
|
-
for (let t = 0; t < s; t++) f +=
|
|
5148
|
-
let
|
|
5149
|
-
|
|
5150
|
+
let o = a.gridSpan || 1, s = a.rowSpan || 1, c = u(i, o), f = 0;
|
|
5151
|
+
for (let t = 0; t < s; t++) f += d[e + t] ?? 0;
|
|
5152
|
+
let p = m(i, o), h = Math.min(e + s - 1, n.rows.length - 1), v = g.length;
|
|
5153
|
+
g.push({
|
|
5150
5154
|
cell: a,
|
|
5151
|
-
colX:
|
|
5155
|
+
colX: p,
|
|
5152
5156
|
rowY: r,
|
|
5153
|
-
cellW:
|
|
5157
|
+
cellW: c,
|
|
5154
5158
|
cellH: f,
|
|
5155
5159
|
ci: i,
|
|
5156
5160
|
ri: e,
|
|
5157
5161
|
span: o,
|
|
5158
|
-
lastRi:
|
|
5162
|
+
lastRi: h
|
|
5159
5163
|
});
|
|
5160
|
-
for (let t = e; t <=
|
|
5164
|
+
for (let t = e; t <= h; t++) for (let e = i; e < i + o && e < l; e++) _[t][e] = v;
|
|
5161
5165
|
}
|
|
5162
5166
|
}
|
|
5163
|
-
for (let { cell:
|
|
5164
|
-
let u =
|
|
5165
|
-
if (u && (
|
|
5166
|
-
let
|
|
5167
|
-
|
|
5167
|
+
for (let { cell: e, colX: o, rowY: s, cellW: c, cellH: l } of g) {
|
|
5168
|
+
let u = _n(e.fill, t, o, s, c, l, n.rotation);
|
|
5169
|
+
if (u && (t.fillStyle = u, t.fillRect(o, s, c, l)), e.textBody) {
|
|
5170
|
+
let n = e.textColor ? X(e.textColor) : null;
|
|
5171
|
+
Sr(t, e.textBody, o, s, c, l, r, n, 0, !1, !1, "#000000", i, a);
|
|
5168
5172
|
}
|
|
5169
5173
|
}
|
|
5170
|
-
let
|
|
5171
|
-
if (e < 0 || e >=
|
|
5172
|
-
let n =
|
|
5173
|
-
return n < 0 ? null :
|
|
5174
|
-
},
|
|
5175
|
-
|
|
5176
|
-
x: Math.min(
|
|
5177
|
-
y: Math.min(
|
|
5178
|
-
w: Math.max(1, Math.abs(
|
|
5179
|
-
h: Math.max(1, Math.abs(
|
|
5180
|
-
},
|
|
5181
|
-
let
|
|
5182
|
-
|
|
5174
|
+
let v = a.dpr, y = (e, t) => {
|
|
5175
|
+
if (e < 0 || e >= _.length || t < 0 || t >= l) return null;
|
|
5176
|
+
let n = _[e][t];
|
|
5177
|
+
return n < 0 ? null : g[n];
|
|
5178
|
+
}, b = (i, a, o, s, c) => {
|
|
5179
|
+
Nr(t, i, r, {
|
|
5180
|
+
x: Math.min(a, s),
|
|
5181
|
+
y: Math.min(o, c),
|
|
5182
|
+
w: Math.max(1, Math.abs(s - a)),
|
|
5183
|
+
h: Math.max(1, Math.abs(c - o))
|
|
5184
|
+
}, n.rotation);
|
|
5185
|
+
let l = a === s ? e(a, t.lineWidth, v) : 0, u = o === c ? e(o, t.lineWidth, v) : 0;
|
|
5186
|
+
t.beginPath(), t.moveTo(a + l, o + u), t.lineTo(s + l, c + u), t.stroke();
|
|
5183
5187
|
};
|
|
5184
|
-
for (let
|
|
5185
|
-
let { cell: i, colX: a, rowY: o, cellW: s, cellH:
|
|
5186
|
-
|
|
5187
|
-
let f =
|
|
5188
|
-
if (
|
|
5188
|
+
for (let e of g) {
|
|
5189
|
+
let { cell: i, colX: a, rowY: o, cellW: s, cellH: c } = e;
|
|
5190
|
+
t.save();
|
|
5191
|
+
let f = n.rtl ? i.borderR : i.borderL, p = n.rtl ? i.borderL : i.borderR, g = n.rtl ? e.ci + e.span === l : e.ci === 0, v = n.rtl ? e.ci === 0 : e.ci + e.span === l, x = n.rtl ? e.ci - 1 : e.ci + e.span, S = (e) => n.rtl ? e.borderR : e.borderL;
|
|
5192
|
+
if (e.ri === 0 && i.borderT && b(i.borderT, a, o, a + s, o), g && f && b(f, a, o, a, o + c), e.lastRi === n.rows.length - 1) {
|
|
5189
5193
|
let e = i.borderB;
|
|
5190
|
-
e &&
|
|
5194
|
+
e && b(e, a, o + c, a + s, o + c);
|
|
5191
5195
|
} else {
|
|
5192
|
-
let
|
|
5193
|
-
for (; a <
|
|
5194
|
-
let
|
|
5195
|
-
for (; o <
|
|
5196
|
-
let s =
|
|
5196
|
+
let t = e.lastRi + 1, n = o + c, r = Math.min(e.ci + e.span, l), a = e.ci;
|
|
5197
|
+
for (; a < r;) {
|
|
5198
|
+
let e = _[t][a], o = a + 1;
|
|
5199
|
+
for (; o < r && _[t][o] === e;) o++;
|
|
5200
|
+
let s = y(t, a), c = an(i.borderB, s ? s.cell.borderT : null);
|
|
5197
5201
|
if (c) {
|
|
5198
|
-
let e =
|
|
5199
|
-
|
|
5202
|
+
let e = m(a, o - a);
|
|
5203
|
+
b(c, e, n, e + u(a, o - a), n);
|
|
5200
5204
|
}
|
|
5201
5205
|
a = o;
|
|
5202
5206
|
}
|
|
5203
5207
|
}
|
|
5204
|
-
if (
|
|
5205
|
-
let e =
|
|
5206
|
-
e &&
|
|
5208
|
+
if (v) {
|
|
5209
|
+
let e = p;
|
|
5210
|
+
e && b(e, a + s, o, a + s, o + c);
|
|
5207
5211
|
} else {
|
|
5208
|
-
let
|
|
5209
|
-
for (;
|
|
5210
|
-
let
|
|
5211
|
-
for (; i + 1 <=
|
|
5212
|
-
let a =
|
|
5213
|
-
o &&
|
|
5212
|
+
let t = a + s, n = e.ri;
|
|
5213
|
+
for (; n <= e.lastRi;) {
|
|
5214
|
+
let r = _[n][x], i = n;
|
|
5215
|
+
for (; i + 1 <= e.lastRi && _[i + 1][x] === r;) i++;
|
|
5216
|
+
let a = y(n, x), o = an(p, a ? S(a.cell) : null);
|
|
5217
|
+
o && b(o, t, h[n], t, h[i] + d[i]), n = i + 1;
|
|
5214
5218
|
}
|
|
5215
5219
|
}
|
|
5216
|
-
i.diagonalTL && (
|
|
5220
|
+
i.diagonalTL && (Nr(t, i.diagonalTL, r, {
|
|
5217
5221
|
x: a,
|
|
5218
5222
|
y: o,
|
|
5219
5223
|
w: s,
|
|
5220
|
-
h:
|
|
5221
|
-
},
|
|
5224
|
+
h: c
|
|
5225
|
+
}, n.rotation), t.beginPath(), t.moveTo(a, o), t.lineTo(a + s, o + c), t.stroke()), i.diagonalTR && (Nr(t, i.diagonalTR, r, {
|
|
5222
5226
|
x: a,
|
|
5223
5227
|
y: o,
|
|
5224
5228
|
w: s,
|
|
5225
|
-
h:
|
|
5226
|
-
},
|
|
5229
|
+
h: c
|
|
5230
|
+
}, n.rotation), t.beginPath(), t.moveTo(a + s, o), t.lineTo(a, o + c), t.stroke()), t.restore();
|
|
5227
5231
|
}
|
|
5228
|
-
|
|
5232
|
+
t.restore();
|
|
5229
5233
|
}
|
|
5230
|
-
function
|
|
5234
|
+
function Ir(e, t, n, r) {
|
|
5231
5235
|
e.save(), e.globalAlpha = t.opacity, e.fillStyle = t.color, e.fillRect(0, 0, n, r), e.restore();
|
|
5232
5236
|
}
|
|
5233
|
-
var
|
|
5234
|
-
function
|
|
5235
|
-
|
|
5237
|
+
var Lr = /* @__PURE__ */ new WeakMap();
|
|
5238
|
+
function Rr(e) {
|
|
5239
|
+
Lr.set(e, (Lr.get(e) ?? 0) + 1);
|
|
5236
5240
|
}
|
|
5237
|
-
function
|
|
5241
|
+
function zr(e, t, n, r, i) {
|
|
5238
5242
|
e.save(), e.fillStyle = "#f7f7f8", e.fillRect(0, 0, t, n);
|
|
5239
5243
|
let a = Math.max(12, Math.min(t, n) * .04);
|
|
5240
5244
|
e.strokeStyle = "#c8ccd2", e.lineWidth = Math.max(1, Math.min(t, n) * .004), e.setLineDash([e.lineWidth * 6, e.lineWidth * 5]), e.strokeRect(a, a, t - a * 2, n - a * 2), e.setLineDash([]);
|
|
@@ -5254,129 +5258,172 @@ function Pr(e, t, n, r, i) {
|
|
|
5254
5258
|
for (let t of f.slice(0, 4)) e.fillText(t, o, h), h += m;
|
|
5255
5259
|
e.restore();
|
|
5256
5260
|
}
|
|
5257
|
-
async function
|
|
5258
|
-
|
|
5261
|
+
async function Br(e, t, n, r, i = {}, a) {
|
|
5262
|
+
return Vr(e, t, n, r, i, a);
|
|
5263
|
+
}
|
|
5264
|
+
async function Vr(e, t, n, r, i = {}, a) {
|
|
5265
|
+
let o = i.fetchImage ?? (i.fetchMedia ? Or(i.fetchMedia) : void 0), s = o ? E(o) : void 0;
|
|
5259
5266
|
try {
|
|
5260
|
-
return await
|
|
5267
|
+
return await Hr(e, t, n, r, i, a, o);
|
|
5261
5268
|
} finally {
|
|
5262
5269
|
s?.();
|
|
5263
5270
|
}
|
|
5264
5271
|
}
|
|
5265
|
-
async function
|
|
5266
|
-
let
|
|
5267
|
-
|
|
5268
|
-
let
|
|
5269
|
-
e.width =
|
|
5270
|
-
let
|
|
5271
|
-
if (!
|
|
5272
|
-
if (
|
|
5273
|
-
let
|
|
5272
|
+
async function Hr(e, t, n, r, i = {}, a, o) {
|
|
5273
|
+
let s = (Lr.get(e) ?? 0) + 1;
|
|
5274
|
+
Lr.set(e, s);
|
|
5275
|
+
let c = () => Lr.get(e) !== s, l = i.width ?? ((G(e) ? e.offsetWidth : 0) || 960), u = l / n, d = Math.round(l), f = Math.round(r * u), p = i.dpr ?? D(), m = Ne(d * p, f * p), h = m.clamped ? p * m.scale : p;
|
|
5276
|
+
e.width = m.width, e.height = m.height, G(e) && (e.style.width = `${d}px`, e.style.display || (e.style.display = "block"));
|
|
5277
|
+
let g = e.getContext("2d");
|
|
5278
|
+
if (!g) throw Error("Could not get 2D context");
|
|
5279
|
+
if (g.scale(h, h), t.parseError) return zr(g, d, f, t.slideNumber, t.parseError), e;
|
|
5280
|
+
let _ = i.defaultTextColor ? `#${i.defaultTextColor}` : "#000000", v = {
|
|
5274
5281
|
themeMajorFont: i.majorFont ?? null,
|
|
5275
5282
|
themeMinorFont: i.minorFont ?? null,
|
|
5276
5283
|
themeHlinkColor: i.hlinkColor ?? null,
|
|
5277
|
-
|
|
5278
|
-
|
|
5284
|
+
embeddedFontAliases: i.embeddedFontAliases,
|
|
5285
|
+
embeddedFontAuthoredFamilies: i.embeddedFontAuthoredFamilies,
|
|
5286
|
+
dpr: h,
|
|
5287
|
+
smartArtFallbackTextColor: ln(t.background, _)
|
|
5279
5288
|
};
|
|
5280
|
-
if (await
|
|
5281
|
-
let
|
|
5289
|
+
if (await Hn(g, t.background, d, f, u, c, i.fetchImage), c() || (i.math && await xn(t, i.math), c())) return e;
|
|
5290
|
+
let y = t.slideNumber;
|
|
5282
5291
|
for (let e of t.elements) if (e.type === "picture" && i.fetchImage) {
|
|
5283
5292
|
let t = e, n = t.mimeType === "image/svg+xml";
|
|
5284
|
-
if (
|
|
5285
|
-
else if (n)
|
|
5293
|
+
if (x(t)) q(t.svgImagePath, i.fetchImage).catch(() => void 0);
|
|
5294
|
+
else if (n) q(t.imagePath, i.fetchImage).catch(() => void 0);
|
|
5286
5295
|
else {
|
|
5287
|
-
let e =
|
|
5296
|
+
let e = Ce(t.mimeType, t.srcRect, t.width / J, t.height / J);
|
|
5288
5297
|
if (!e) continue;
|
|
5289
|
-
|
|
5298
|
+
ze(t.imagePath, t.mimeType, t.duotone, i.fetchImage, {
|
|
5290
5299
|
widthPt: e.widthPt,
|
|
5291
5300
|
heightPt: e.heightPt
|
|
5292
5301
|
}).catch(() => void 0);
|
|
5293
5302
|
}
|
|
5294
5303
|
} else if (e.type === "media") {
|
|
5295
5304
|
let t = e;
|
|
5296
|
-
t.posterPath && i.fetchMedia &&
|
|
5305
|
+
t.posterPath && i.fetchMedia && kr(t, i.fetchMedia, o).catch(() => void 0);
|
|
5297
5306
|
}
|
|
5298
|
-
let
|
|
5307
|
+
let b = /* @__PURE__ */ new Map();
|
|
5299
5308
|
if (i.fetchImage) {
|
|
5300
|
-
let n = i.fetchImage, r = /* @__PURE__ */ new Set(),
|
|
5301
|
-
for (let e of
|
|
5302
|
-
let t =
|
|
5303
|
-
|
|
5309
|
+
let n = i.fetchImage, r = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map();
|
|
5310
|
+
for (let e of we(t.elements.filter((e) => e.type === "chart").map((e) => e.chart))) {
|
|
5311
|
+
let t = ke(e);
|
|
5312
|
+
a.has(t) || a.set(t, e);
|
|
5304
5313
|
}
|
|
5305
5314
|
for (let e of t.elements) if (!(e.type !== "shape" || !e.textBody)) for (let t of e.textBody.paragraphs) {
|
|
5306
|
-
let e =
|
|
5315
|
+
let e = He(t.bullet);
|
|
5307
5316
|
e.type === "blip" && r.add(`${e.imagePath} ${e.mimeType}`);
|
|
5308
5317
|
}
|
|
5309
|
-
if (r.size > 0 ||
|
|
5318
|
+
if (r.size > 0 || a.size > 0) {
|
|
5310
5319
|
let t = [...r].map((e) => {
|
|
5311
5320
|
let [t, r] = e.split(" ");
|
|
5312
|
-
return
|
|
5313
|
-
if (
|
|
5321
|
+
return H(t, r, n).catch((e) => {
|
|
5322
|
+
if (Te(e)) throw e;
|
|
5314
5323
|
});
|
|
5315
|
-
}), i = [...
|
|
5324
|
+
}), i = [...a].map(async ([e, t]) => {
|
|
5316
5325
|
try {
|
|
5317
|
-
let r =
|
|
5326
|
+
let r = Ce(t.mimeType, t.srcRect, 72, 72);
|
|
5318
5327
|
if (!r) {
|
|
5319
|
-
|
|
5328
|
+
b.set(e, null);
|
|
5320
5329
|
return;
|
|
5321
5330
|
}
|
|
5322
|
-
let i = () => t.mimeType === "image/svg+xml" ? t.duotone ? Promise.resolve(null) :
|
|
5331
|
+
let i = () => t.mimeType === "image/svg+xml" ? t.duotone ? Promise.resolve(null) : q(t.imagePath, n) : ze(t.imagePath, t.mimeType, t.duotone, n, {
|
|
5323
5332
|
widthPt: r.widthPt,
|
|
5324
5333
|
heightPt: r.heightPt,
|
|
5325
5334
|
failClosedOnDuotoneFailure: !0
|
|
5326
5335
|
}), a;
|
|
5327
|
-
if (!t.duotone &&
|
|
5328
|
-
a = await
|
|
5336
|
+
if (!t.duotone && x(t)) try {
|
|
5337
|
+
a = await q(t.svgImagePath, n);
|
|
5329
5338
|
} catch {
|
|
5330
5339
|
a = await i();
|
|
5331
5340
|
}
|
|
5332
5341
|
else a = await i();
|
|
5333
|
-
|
|
5342
|
+
b.set(e, a);
|
|
5334
5343
|
} catch (t) {
|
|
5335
|
-
if (
|
|
5336
|
-
|
|
5344
|
+
if (Te(t)) throw t;
|
|
5345
|
+
b.set(e, null);
|
|
5337
5346
|
}
|
|
5338
5347
|
});
|
|
5339
|
-
if (await Promise.all([...t, ...i]),
|
|
5348
|
+
if (await Promise.all([...t, ...i]), c()) return e;
|
|
5340
5349
|
}
|
|
5341
5350
|
}
|
|
5342
5351
|
for (let [n, r] of t.elements.entries()) {
|
|
5343
|
-
if (
|
|
5344
|
-
if (r.type === "shape")
|
|
5352
|
+
if (c()) return e;
|
|
5353
|
+
if (r.type === "shape") gr(g, r, u, _, y, v, a ? (e) => a({
|
|
5345
5354
|
...e,
|
|
5346
5355
|
elementIndex: n,
|
|
5347
5356
|
origin: t.elementSources?.[n]?.origin ?? "slide"
|
|
5348
5357
|
}) : void 0, i.fetchImage);
|
|
5349
|
-
else if (r.type === "picture") await
|
|
5350
|
-
else if (r.type === "table")
|
|
5351
|
-
else if (r.type === "media") await
|
|
5358
|
+
else if (r.type === "picture") await Ar(g, r, u, c, i.fetchImage);
|
|
5359
|
+
else if (r.type === "table") Fr(g, r, u, y, v);
|
|
5360
|
+
else if (r.type === "media") await jr(g, r, u, c, i.fetchMedia, i.skipMediaControls, i.fetchImage);
|
|
5352
5361
|
else if (r.type === "chart") {
|
|
5353
|
-
let e = J *
|
|
5354
|
-
|
|
5355
|
-
x: Y(r.x,
|
|
5356
|
-
y: Y(r.y,
|
|
5357
|
-
w: Y(r.width,
|
|
5358
|
-
h: Y(r.height,
|
|
5359
|
-
}, e, r.rotation, i.threeD, i.regionMap, (e) =>
|
|
5362
|
+
let e = J * u;
|
|
5363
|
+
g.save(), Pr(g, r, u), Re(g, r.chart, {
|
|
5364
|
+
x: Y(r.x, u),
|
|
5365
|
+
y: Y(r.y, u),
|
|
5366
|
+
w: Y(r.width, u),
|
|
5367
|
+
h: Y(r.height, u)
|
|
5368
|
+
}, e, r.rotation, i.threeD, i.regionMap, (e) => b.get(ke(e)), i.chartEx), g.restore();
|
|
5360
5369
|
}
|
|
5361
5370
|
}
|
|
5362
|
-
return
|
|
5371
|
+
return c() || i.dim && Ir(g, i.dim, d, f), e;
|
|
5363
5372
|
}
|
|
5364
5373
|
//#endregion
|
|
5365
5374
|
//#region packages/pptx/src/google-fonts.ts
|
|
5366
|
-
var
|
|
5367
|
-
...
|
|
5368
|
-
...
|
|
5375
|
+
var Ur = {
|
|
5376
|
+
...h,
|
|
5377
|
+
...m
|
|
5369
5378
|
};
|
|
5370
|
-
|
|
5379
|
+
function* Wr(e) {
|
|
5380
|
+
for (let t of e?.paragraphs ?? []) for (let e of t.runs) e.type === "text" && (yield e.text);
|
|
5381
|
+
}
|
|
5382
|
+
function* Gr(e) {
|
|
5383
|
+
for (let t of e?.paragraphs ?? []) {
|
|
5384
|
+
t.defFontFamily && (yield t.defFontFamily);
|
|
5385
|
+
for (let e of t.runs) e.type === "text" && (e.fontFamily && (yield e.fontFamily), e.fontFamilyEa && (yield e.fontFamilyEa), e.fontFamilySym && (yield e.fontFamilySym));
|
|
5386
|
+
}
|
|
5387
|
+
}
|
|
5388
|
+
function* Kr(e) {
|
|
5389
|
+
for (let t of e.elements) if (t.type === "shape") yield* Wr(t.textBody);
|
|
5390
|
+
else if (t.type === "table") for (let e of t.rows) for (let t of e.cells) yield* Wr(t.textBody);
|
|
5391
|
+
else if (t.type === "chart") {
|
|
5392
|
+
t.chart.title && (yield t.chart.title);
|
|
5393
|
+
for (let e of t.chart.categories) yield e;
|
|
5394
|
+
for (let e of t.chart.series) e.name && (yield e.name);
|
|
5395
|
+
}
|
|
5396
|
+
}
|
|
5397
|
+
var qr = class e {
|
|
5398
|
+
scripts;
|
|
5399
|
+
families;
|
|
5400
|
+
constructor(e, t, n, r) {
|
|
5401
|
+
this.majorFont = e, this.minorFont = t;
|
|
5402
|
+
let i = F(e) ?? F(t) ?? null;
|
|
5403
|
+
this.scripts = n ?? new I(i), this.families = r ?? /* @__PURE__ */ new Set(), e && this.families.add(e), t && this.families.add(t);
|
|
5404
|
+
}
|
|
5405
|
+
addSlide(e) {
|
|
5406
|
+
this.scripts.addText(Kr(e));
|
|
5407
|
+
for (let t of e.elements) if (t.type === "shape") for (let e of Gr(t.textBody)) this.families.add(e);
|
|
5408
|
+
else if (t.type === "table") for (let e of t.rows) for (let t of e.cells) for (let e of Gr(t.textBody)) this.families.add(e);
|
|
5409
|
+
}
|
|
5410
|
+
names() {
|
|
5411
|
+
return [...this.families, ...this.scripts.names()];
|
|
5412
|
+
}
|
|
5413
|
+
withSlide(t) {
|
|
5414
|
+
let n = new e(this.majorFont, this.minorFont, this.scripts.clone(), new Set(this.families));
|
|
5415
|
+
return n.addSlide(t), n;
|
|
5416
|
+
}
|
|
5417
|
+
}, Jr = Object.freeze({
|
|
5371
5418
|
archiveEntryCount: 0,
|
|
5372
5419
|
declaredInflatedBytes: 0,
|
|
5373
5420
|
distinctInflatedBytes: 0,
|
|
5374
5421
|
operationInflatedBytes: 0
|
|
5375
|
-
});
|
|
5422
|
+
}), Yr = se;
|
|
5376
5423
|
function $(e, t) {
|
|
5377
5424
|
if (e !== null && typeof e != "string") throw Error(`invalid PPTX presentation bootstrap ${t}`);
|
|
5378
5425
|
}
|
|
5379
|
-
function
|
|
5426
|
+
function Xr(e, t) {
|
|
5380
5427
|
if (!e || typeof e != "object" || Array.isArray(e)) throw Error(`invalid PPTX presentation bootstrap slide at ${t}`);
|
|
5381
5428
|
let n = e;
|
|
5382
5429
|
if (n.index !== t) throw Error(`invalid PPTX presentation bootstrap slide index ${n.index}`);
|
|
@@ -5386,10 +5433,26 @@ function Rr(e, t) {
|
|
|
5386
5433
|
...n.partName === void 0 ? {} : { partName: n.partName }
|
|
5387
5434
|
});
|
|
5388
5435
|
}
|
|
5389
|
-
function
|
|
5436
|
+
function Zr(e, t) {
|
|
5437
|
+
if (!e || typeof e != "object" || Array.isArray(e)) throw Error(`invalid PPTX presentation bootstrap embedded font at ${t}`);
|
|
5438
|
+
let n = e;
|
|
5439
|
+
if (typeof n.fontName != "string" || n.fontName.length === 0 || ![
|
|
5440
|
+
"regular",
|
|
5441
|
+
"bold",
|
|
5442
|
+
"italic",
|
|
5443
|
+
"boldItalic"
|
|
5444
|
+
].includes(n.style ?? "") || typeof n.partPath != "string" || n.partPath.length === 0 || n.partPath.startsWith("/") || n.partPath.split("/").includes("..") || !["application/x-font-ttf", "application/x-fontdata"].includes(n.contentType ?? "")) throw Error(`invalid PPTX presentation bootstrap embedded font fields at ${t}`);
|
|
5445
|
+
return Object.freeze({
|
|
5446
|
+
fontName: n.fontName,
|
|
5447
|
+
style: n.style,
|
|
5448
|
+
partPath: n.partPath,
|
|
5449
|
+
contentType: n.contentType
|
|
5450
|
+
});
|
|
5451
|
+
}
|
|
5452
|
+
function Qr(e) {
|
|
5390
5453
|
if (!e || typeof e != "object" || Array.isArray(e)) throw Error("invalid PPTX presentation bootstrap payload");
|
|
5391
5454
|
let t = e;
|
|
5392
|
-
if (!Number.isSafeInteger(t.slideCount) || (t.slideCount ?? -1) < 0 || !Number.isSafeInteger(t.slideWidth) || (t.slideWidth ?? 0) <= 0 || !Number.isSafeInteger(t.slideHeight) || (t.slideHeight ?? 0) <= 0 || !Array.isArray(t.slides) || t.slides.length !== t.slideCount) throw Error("invalid PPTX presentation bootstrap dimensions or slide count");
|
|
5455
|
+
if (!Number.isSafeInteger(t.slideCount) || (t.slideCount ?? -1) < 0 || !Number.isSafeInteger(t.slideWidth) || (t.slideWidth ?? 0) <= 0 || !Number.isSafeInteger(t.slideHeight) || (t.slideHeight ?? 0) <= 0 || !Array.isArray(t.embeddedFonts) || !Array.isArray(t.slides) || t.slides.length !== t.slideCount) throw Error("invalid PPTX presentation bootstrap dimensions or slide count");
|
|
5393
5456
|
return $(t.defaultTextColor, "defaultTextColor"), $(t.majorFont, "majorFont"), $(t.minorFont, "minorFont"), $(t.hlinkColor, "hlinkColor"), $(t.folHlinkColor, "folHlinkColor"), Object.freeze({
|
|
5394
5457
|
slideCount: t.slideCount,
|
|
5395
5458
|
slideWidth: t.slideWidth,
|
|
@@ -5399,10 +5462,11 @@ function zr(e) {
|
|
|
5399
5462
|
minorFont: t.minorFont,
|
|
5400
5463
|
hlinkColor: t.hlinkColor,
|
|
5401
5464
|
folHlinkColor: t.folHlinkColor,
|
|
5402
|
-
|
|
5465
|
+
embeddedFonts: Object.freeze(t.embeddedFonts.map(Zr)),
|
|
5466
|
+
slides: Object.freeze(t.slides.map(Xr))
|
|
5403
5467
|
});
|
|
5404
5468
|
}
|
|
5405
|
-
function
|
|
5469
|
+
function $r(e) {
|
|
5406
5470
|
return Object.freeze({
|
|
5407
5471
|
type: "media",
|
|
5408
5472
|
x: e.x,
|
|
@@ -5419,7 +5483,7 @@ function Br(e) {
|
|
|
5419
5483
|
mimeType: e.mimeType
|
|
5420
5484
|
});
|
|
5421
5485
|
}
|
|
5422
|
-
function
|
|
5486
|
+
function ei(e) {
|
|
5423
5487
|
return Object.freeze({
|
|
5424
5488
|
...e.id === void 0 ? {} : { id: e.id },
|
|
5425
5489
|
...e.authorId === void 0 ? {} : { authorId: e.authorId },
|
|
@@ -5429,10 +5493,10 @@ function Vr(e) {
|
|
|
5429
5493
|
text: e.text
|
|
5430
5494
|
});
|
|
5431
5495
|
}
|
|
5432
|
-
function
|
|
5496
|
+
function ti(e) {
|
|
5433
5497
|
return Object.freeze({ ...e });
|
|
5434
5498
|
}
|
|
5435
|
-
function
|
|
5499
|
+
function ni(e) {
|
|
5436
5500
|
return Object.freeze({
|
|
5437
5501
|
...e.authorId === void 0 ? {} : { authorId: e.authorId },
|
|
5438
5502
|
...e.modernAuthorId === void 0 ? {} : { modernAuthorId: e.modernAuthorId },
|
|
@@ -5442,16 +5506,16 @@ function Ur(e) {
|
|
|
5442
5506
|
...e.date === void 0 ? {} : { date: e.date },
|
|
5443
5507
|
...e.x === void 0 ? {} : { x: e.x },
|
|
5444
5508
|
...e.y === void 0 ? {} : { y: e.y },
|
|
5445
|
-
...e.anchors?.length ? { anchors: Object.freeze(e.anchors.map(
|
|
5509
|
+
...e.anchors?.length ? { anchors: Object.freeze(e.anchors.map(ti)) } : {},
|
|
5446
5510
|
...e.status === void 0 ? {} : { status: e.status },
|
|
5447
5511
|
text: e.text,
|
|
5448
|
-
...e.replies?.length ? { replies: Object.freeze(e.replies.map(
|
|
5512
|
+
...e.replies?.length ? { replies: Object.freeze(e.replies.map(ei)) } : {}
|
|
5449
5513
|
});
|
|
5450
5514
|
}
|
|
5451
|
-
function
|
|
5515
|
+
function ri(e, t, n) {
|
|
5452
5516
|
if (e !== void 0 && typeof e != "string") throw Error(`invalid PPTX presentation preflight comment ${t} at slide ${n}`);
|
|
5453
5517
|
}
|
|
5454
|
-
function
|
|
5518
|
+
function ii(e, t) {
|
|
5455
5519
|
if (!e || typeof e != "object" || Array.isArray(e)) throw Error(`invalid PPTX presentation preflight comment reply at slide ${t}`);
|
|
5456
5520
|
let n = e;
|
|
5457
5521
|
for (let e of [
|
|
@@ -5460,16 +5524,16 @@ function Gr(e, t) {
|
|
|
5460
5524
|
"author",
|
|
5461
5525
|
"date",
|
|
5462
5526
|
"status"
|
|
5463
|
-
])
|
|
5527
|
+
]) ri(n[e], e, t);
|
|
5464
5528
|
if (typeof n.text != "string") throw Error(`invalid PPTX presentation preflight comment reply text at slide ${t}`);
|
|
5465
5529
|
if (n.status !== void 0 && ![
|
|
5466
5530
|
"active",
|
|
5467
5531
|
"resolved",
|
|
5468
5532
|
"closed"
|
|
5469
5533
|
].includes(n.status)) throw Error(`invalid PPTX presentation preflight comment reply status at slide ${t}`);
|
|
5470
|
-
return
|
|
5534
|
+
return ei(n);
|
|
5471
5535
|
}
|
|
5472
|
-
function
|
|
5536
|
+
function ai(e, t) {
|
|
5473
5537
|
if (!e || typeof e != "object" || Array.isArray(e)) throw Error(`invalid PPTX presentation preflight comment at slide ${t}`);
|
|
5474
5538
|
let n = e;
|
|
5475
5539
|
for (let e of [
|
|
@@ -5478,7 +5542,7 @@ function Kr(e, t) {
|
|
|
5478
5542
|
"author",
|
|
5479
5543
|
"date",
|
|
5480
5544
|
"status"
|
|
5481
|
-
])
|
|
5545
|
+
]) ri(n[e], e, t);
|
|
5482
5546
|
for (let e of [
|
|
5483
5547
|
"authorId",
|
|
5484
5548
|
"index",
|
|
@@ -5494,23 +5558,23 @@ function Kr(e, t) {
|
|
|
5494
5558
|
"resolved",
|
|
5495
5559
|
"closed"
|
|
5496
5560
|
].includes(n.status)) throw Error(`invalid PPTX presentation preflight comment status at slide ${t}`);
|
|
5497
|
-
return
|
|
5561
|
+
return ni({
|
|
5498
5562
|
...n,
|
|
5499
|
-
...n.anchors?.length ? { anchors: n.anchors.map((e) =>
|
|
5500
|
-
...n.replies?.length ? { replies: n.replies.map((e) =>
|
|
5563
|
+
...n.anchors?.length ? { anchors: n.anchors.map((e) => oi(e, t)) } : {},
|
|
5564
|
+
...n.replies?.length ? { replies: n.replies.map((e) => ii(e, t)) } : {}
|
|
5501
5565
|
});
|
|
5502
5566
|
}
|
|
5503
|
-
function
|
|
5567
|
+
function oi(e, t) {
|
|
5504
5568
|
if (!e || typeof e != "object" || Array.isArray(e)) throw Error(`invalid PPTX presentation preflight comment anchor at slide ${t}`);
|
|
5505
5569
|
let n = e;
|
|
5506
5570
|
if (n.type === "slide" || n.type === "unknown") return Object.freeze({ type: n.type });
|
|
5507
|
-
if (n.type === "drawingElement") return
|
|
5571
|
+
if (n.type === "drawingElement") return ri(n.elementId, "anchor.elementId", t), ri(n.creationId, "anchor.creationId", t), Object.freeze({
|
|
5508
5572
|
type: "drawingElement",
|
|
5509
5573
|
...n.elementId === void 0 ? {} : { elementId: n.elementId },
|
|
5510
5574
|
...n.creationId === void 0 ? {} : { creationId: n.creationId }
|
|
5511
5575
|
});
|
|
5512
5576
|
if (n.type === "textRange") {
|
|
5513
|
-
|
|
5577
|
+
ri(n.elementId, "anchor.elementId", t);
|
|
5514
5578
|
for (let e of ["start", "length"]) {
|
|
5515
5579
|
let r = n[e];
|
|
5516
5580
|
if (r !== void 0 && (typeof r != "number" || !Number.isSafeInteger(r))) throw Error(`invalid PPTX presentation preflight comment anchor.${e} at slide ${t}`);
|
|
@@ -5524,7 +5588,7 @@ function qr(e, t) {
|
|
|
5524
5588
|
}
|
|
5525
5589
|
throw Error(`invalid PPTX presentation preflight comment anchor type at slide ${t}`);
|
|
5526
5590
|
}
|
|
5527
|
-
function
|
|
5591
|
+
function si(e, t) {
|
|
5528
5592
|
if (!e || typeof e != "object" || Array.isArray(e)) throw Error(`invalid PPTX presentation preflight media at slide ${t}`);
|
|
5529
5593
|
let n = e;
|
|
5530
5594
|
for (let e of [
|
|
@@ -5535,14 +5599,14 @@ function Jr(e, t) {
|
|
|
5535
5599
|
"rotation"
|
|
5536
5600
|
]) if (typeof n[e] != "number" || !Number.isFinite(n[e])) throw Error(`invalid PPTX presentation preflight media ${e} at slide ${t}`);
|
|
5537
5601
|
if (n.type !== "media" || typeof n.flipH != "boolean" || typeof n.flipV != "boolean" || n.mediaKind !== "audio" && n.mediaKind !== "video" || typeof n.posterPath != "string" || typeof n.posterMimeType != "string" || typeof n.mediaPath != "string" || typeof n.mimeType != "string") throw Error(`invalid PPTX presentation preflight media fields at slide ${t}`);
|
|
5538
|
-
return
|
|
5602
|
+
return $r(n);
|
|
5539
5603
|
}
|
|
5540
|
-
function
|
|
5604
|
+
function ci(e, t) {
|
|
5541
5605
|
if (!e || typeof e != "object" || Array.isArray(e)) throw Error("invalid PPTX presentation preflight payload");
|
|
5542
|
-
let
|
|
5543
|
-
if (!Number.isSafeInteger(
|
|
5544
|
-
$(
|
|
5545
|
-
let
|
|
5606
|
+
let n = e;
|
|
5607
|
+
if (!Number.isSafeInteger(n.slideCount) || (n.slideCount ?? -1) < 0 || !Number.isSafeInteger(n.slideWidth) || (n.slideWidth ?? 0) <= 0 || !Number.isSafeInteger(n.slideHeight) || (n.slideHeight ?? 0) <= 0 || !Array.isArray(n.embeddedFonts) || !Array.isArray(n.slides) || (t ? n.slides.length > (n.slideCount ?? -1) : n.slides.length !== n.slideCount) || !Array.isArray(n.fontPreloadNames)) throw Error("invalid PPTX presentation preflight dimensions or slide count");
|
|
5608
|
+
$(n.defaultTextColor, "defaultTextColor"), $(n.majorFont, "majorFont"), $(n.minorFont, "minorFont"), $(n.hlinkColor, "hlinkColor"), $(n.folHlinkColor, "folHlinkColor");
|
|
5609
|
+
let r = n.slides.map((e, t) => {
|
|
5546
5610
|
if (!e || typeof e != "object" || Array.isArray(e)) throw Error(`invalid PPTX presentation preflight slide at ${t}`);
|
|
5547
5611
|
let n = e;
|
|
5548
5612
|
if (n.index !== t || n.partName !== void 0 && typeof n.partName != "string" || n.notes !== null && typeof n.notes != "string" || typeof n.hidden != "boolean" || !Array.isArray(n.mediaElements) || n.comments !== void 0 && !Array.isArray(n.comments)) throw Error(`invalid PPTX presentation preflight slide fields at ${t}`);
|
|
@@ -5551,36 +5615,195 @@ function Yr(e) {
|
|
|
5551
5615
|
...n.partName === void 0 ? {} : { partName: n.partName },
|
|
5552
5616
|
notes: n.notes,
|
|
5553
5617
|
hidden: n.hidden,
|
|
5554
|
-
mediaElements: Object.freeze(n.mediaElements.map((e) =>
|
|
5555
|
-
...n.comments?.length ? { comments: Object.freeze(n.comments.map((e) =>
|
|
5618
|
+
mediaElements: Object.freeze(n.mediaElements.map((e) => si(e, t))),
|
|
5619
|
+
...n.comments?.length ? { comments: Object.freeze(n.comments.map((e) => ai(e, t))) } : {}
|
|
5556
5620
|
});
|
|
5557
|
-
}),
|
|
5621
|
+
}), i = n.fontPreloadNames.map((e, t) => {
|
|
5558
5622
|
if (e !== null && typeof e != "string") throw Error(`invalid PPTX presentation preflight font at ${t}`);
|
|
5559
5623
|
return e;
|
|
5560
5624
|
});
|
|
5561
5625
|
return Object.freeze({
|
|
5562
|
-
slideCount:
|
|
5563
|
-
slideWidth:
|
|
5564
|
-
slideHeight:
|
|
5565
|
-
defaultTextColor:
|
|
5566
|
-
majorFont:
|
|
5567
|
-
minorFont:
|
|
5568
|
-
hlinkColor:
|
|
5569
|
-
folHlinkColor:
|
|
5570
|
-
|
|
5571
|
-
|
|
5626
|
+
slideCount: n.slideCount,
|
|
5627
|
+
slideWidth: n.slideWidth,
|
|
5628
|
+
slideHeight: n.slideHeight,
|
|
5629
|
+
defaultTextColor: n.defaultTextColor,
|
|
5630
|
+
majorFont: n.majorFont,
|
|
5631
|
+
minorFont: n.minorFont,
|
|
5632
|
+
hlinkColor: n.hlinkColor,
|
|
5633
|
+
folHlinkColor: n.folHlinkColor,
|
|
5634
|
+
embeddedFonts: Object.freeze(n.embeddedFonts.map(Zr)),
|
|
5635
|
+
slides: Object.freeze(r),
|
|
5636
|
+
fontPreloadNames: Object.freeze(i)
|
|
5572
5637
|
});
|
|
5573
5638
|
}
|
|
5574
|
-
function
|
|
5639
|
+
function li(e) {
|
|
5640
|
+
return ci(e, !1);
|
|
5641
|
+
}
|
|
5642
|
+
function ui(e) {
|
|
5643
|
+
return ci(e, !0);
|
|
5644
|
+
}
|
|
5645
|
+
function di(e, t) {
|
|
5575
5646
|
for (let n of e.slides) for (let e of n.mediaElements) {
|
|
5576
5647
|
if (e.mediaPath === t) return e.mimeType;
|
|
5577
5648
|
if (e.posterPath === t) return e.posterMimeType;
|
|
5578
5649
|
}
|
|
5579
5650
|
return "";
|
|
5580
5651
|
}
|
|
5581
|
-
|
|
5582
|
-
|
|
5583
|
-
|
|
5652
|
+
function fi(e, t) {
|
|
5653
|
+
if (e.index !== t.index || e.partName !== t.partName) throw Error(`PPTX pulled slide identity does not match bootstrap index ${t.index}`);
|
|
5654
|
+
return Object.freeze({
|
|
5655
|
+
index: t.index,
|
|
5656
|
+
...t.partName === void 0 ? {} : { partName: t.partName },
|
|
5657
|
+
notes: e.notes ?? null,
|
|
5658
|
+
hidden: e.hidden ?? !1,
|
|
5659
|
+
mediaElements: Object.freeze(e.elements.filter((e) => e.type === "media").map($r)),
|
|
5660
|
+
...e.comments?.length ? { comments: Object.freeze(e.comments.map(ni)) } : {}
|
|
5661
|
+
});
|
|
5662
|
+
}
|
|
5663
|
+
function pi(e, t, n) {
|
|
5664
|
+
if (!(e <= t)) throw new g(`PPTX presentation preflight exceeded its hard limit of ${t} projected bytes`, {
|
|
5665
|
+
stage: "parsing",
|
|
5666
|
+
violation: {
|
|
5667
|
+
format: "pptx",
|
|
5668
|
+
operation: "presentation-preflight",
|
|
5669
|
+
resource: "presentation-preflight",
|
|
5670
|
+
metric: "projected-bytes",
|
|
5671
|
+
limit: t,
|
|
5672
|
+
observed: Math.min(e, t + 1),
|
|
5673
|
+
configurable: !1,
|
|
5674
|
+
usage: n
|
|
5675
|
+
}
|
|
5676
|
+
});
|
|
5677
|
+
}
|
|
5678
|
+
var mi = class {
|
|
5679
|
+
slideCountValue;
|
|
5680
|
+
slideWidthValue;
|
|
5681
|
+
slideHeightValue;
|
|
5682
|
+
defaultTextColorValue;
|
|
5683
|
+
majorFontValue;
|
|
5684
|
+
minorFontValue;
|
|
5685
|
+
hlinkColorValue;
|
|
5686
|
+
folHlinkColorValue;
|
|
5687
|
+
embeddedFontsValue;
|
|
5688
|
+
descriptors;
|
|
5689
|
+
slides = [];
|
|
5690
|
+
fonts;
|
|
5691
|
+
fontPreloadNames;
|
|
5692
|
+
fontProjectionBytes;
|
|
5693
|
+
projectionBytesValue;
|
|
5694
|
+
limit;
|
|
5695
|
+
pending = null;
|
|
5696
|
+
finished = null;
|
|
5697
|
+
constructor(e, t = {}) {
|
|
5698
|
+
let n = Qr(e), r = t.hardLimitForTesting ?? Yr;
|
|
5699
|
+
if (!Number.isSafeInteger(r) || r <= 0 || r > Yr) throw Error("invalid PPTX presentation preflight test limit");
|
|
5700
|
+
this.limit = r, this.slideCountValue = n.slideCount, this.slideWidthValue = n.slideWidth, this.slideHeightValue = n.slideHeight, this.defaultTextColorValue = n.defaultTextColor, this.majorFontValue = n.majorFont, this.minorFontValue = n.minorFont, this.hlinkColorValue = n.hlinkColor, this.folHlinkColorValue = n.folHlinkColor, this.embeddedFontsValue = n.embeddedFonts, this.descriptors = [...n.slides], this.fonts = new qr(this.majorFontValue, this.minorFontValue), this.fontPreloadNames = Object.freeze(this.fonts.names()), this.fontProjectionBytes = Be(this.fontPreloadNames, this.limit).jsonBytes, this.projectionBytesValue = Be({
|
|
5701
|
+
slideCount: this.slideCountValue,
|
|
5702
|
+
slideWidth: this.slideWidthValue,
|
|
5703
|
+
slideHeight: this.slideHeightValue,
|
|
5704
|
+
defaultTextColor: this.defaultTextColorValue,
|
|
5705
|
+
majorFont: this.majorFontValue,
|
|
5706
|
+
minorFont: this.minorFontValue,
|
|
5707
|
+
hlinkColor: this.hlinkColorValue,
|
|
5708
|
+
folHlinkColor: this.folHlinkColorValue,
|
|
5709
|
+
embeddedFonts: this.embeddedFontsValue,
|
|
5710
|
+
remainingSlides: this.descriptors,
|
|
5711
|
+
slides: [],
|
|
5712
|
+
fontPreloadNames: this.fontPreloadNames
|
|
5713
|
+
}, this.limit).jsonBytes, pi(this.projectionBytesValue, this.limit, Jr);
|
|
5714
|
+
}
|
|
5715
|
+
get acceptedSlideCount() {
|
|
5716
|
+
return this.finished?.slideCount ?? this.slides.length;
|
|
5717
|
+
}
|
|
5718
|
+
get projectedBytes() {
|
|
5719
|
+
return this.projectionBytesValue;
|
|
5720
|
+
}
|
|
5721
|
+
get remainingDescriptorCount() {
|
|
5722
|
+
return this.descriptors.reduce((e, t) => e + Number(t !== void 0), 0);
|
|
5723
|
+
}
|
|
5724
|
+
get latestSlide() {
|
|
5725
|
+
return this.slides[this.slides.length - 1];
|
|
5726
|
+
}
|
|
5727
|
+
get currentFontPreloadNames() {
|
|
5728
|
+
return this.fontPreloadNames;
|
|
5729
|
+
}
|
|
5730
|
+
snapshot() {
|
|
5731
|
+
if (this.finished) return this.finished;
|
|
5732
|
+
if (this.pending) throw Error("PPTX presentation preflight has an uncommitted slide");
|
|
5733
|
+
return Object.freeze({
|
|
5734
|
+
slideCount: this.slideCountValue,
|
|
5735
|
+
slideWidth: this.slideWidthValue,
|
|
5736
|
+
slideHeight: this.slideHeightValue,
|
|
5737
|
+
defaultTextColor: this.defaultTextColorValue,
|
|
5738
|
+
majorFont: this.majorFontValue,
|
|
5739
|
+
minorFont: this.minorFontValue,
|
|
5740
|
+
hlinkColor: this.hlinkColorValue,
|
|
5741
|
+
folHlinkColor: this.folHlinkColorValue,
|
|
5742
|
+
embeddedFonts: this.embeddedFontsValue,
|
|
5743
|
+
slides: Object.freeze([...this.slides]),
|
|
5744
|
+
fontPreloadNames: this.fontPreloadNames
|
|
5745
|
+
});
|
|
5746
|
+
}
|
|
5747
|
+
addSlide(e, t = Jr) {
|
|
5748
|
+
this.prepareSlide(e, t).commit();
|
|
5749
|
+
}
|
|
5750
|
+
prepareSlide(e, t = Jr) {
|
|
5751
|
+
if (this.finished) throw Error("PPTX presentation preflight is already finished");
|
|
5752
|
+
if (this.pending) throw Error("PPTX presentation preflight already has a prepared slide");
|
|
5753
|
+
let n = this.slides.length, r = this.descriptors[n];
|
|
5754
|
+
if (!r) throw Error("PPTX presentation preflight received an extra slide");
|
|
5755
|
+
let i = fi(e, r), a = this.fonts.withSlide(e), o = Object.freeze(a.names()), s = Be(o, this.limit).jsonBytes, c = Be(i, this.limit).jsonBytes, l = this.projectionBytesValue - this.fontProjectionBytes - Be(r, this.limit).jsonBytes + 4;
|
|
5756
|
+
l = Ve(l, s, this.limit), l = Ve(l, c, this.limit), this.slides.length !== 0 && (l = Ve(l, 1, this.limit));
|
|
5757
|
+
let u = Be({
|
|
5758
|
+
slide: i,
|
|
5759
|
+
fontPreloadNames: o
|
|
5760
|
+
}, this.limit).jsonBytes, d = Ve(this.projectionBytesValue, u, this.limit);
|
|
5761
|
+
pi(Math.max(d, l), this.limit, t);
|
|
5762
|
+
let f = {
|
|
5763
|
+
state: "prepared",
|
|
5764
|
+
fact: i,
|
|
5765
|
+
fonts: a,
|
|
5766
|
+
fontNames: o,
|
|
5767
|
+
fontBytes: s,
|
|
5768
|
+
committedBytes: l
|
|
5769
|
+
};
|
|
5770
|
+
return this.pending = f, {
|
|
5771
|
+
projectedBytes: d,
|
|
5772
|
+
commit: () => {
|
|
5773
|
+
if (f.state !== "committed") {
|
|
5774
|
+
if (f.state === "rolled-back") throw Error("PPTX presentation preflight cannot commit a rolled-back slide");
|
|
5775
|
+
if (this.pending !== f) throw Error("PPTX presentation preflight prepared slide is stale");
|
|
5776
|
+
this.descriptors[n] = void 0, this.slides.push(f.fact), this.fonts = f.fonts, this.fontPreloadNames = f.fontNames, this.fontProjectionBytes = f.fontBytes, this.projectionBytesValue = f.committedBytes, f.state = "committed", this.pending = null;
|
|
5777
|
+
}
|
|
5778
|
+
},
|
|
5779
|
+
rollback: () => {
|
|
5780
|
+
if (f.state !== "rolled-back") {
|
|
5781
|
+
if (f.state === "committed") throw Error("PPTX presentation preflight cannot roll back a committed slide");
|
|
5782
|
+
if (this.pending !== f) throw Error("PPTX presentation preflight prepared slide is stale");
|
|
5783
|
+
f.state = "rolled-back", this.pending = null;
|
|
5784
|
+
}
|
|
5785
|
+
}
|
|
5786
|
+
};
|
|
5787
|
+
}
|
|
5788
|
+
finish() {
|
|
5789
|
+
if (this.finished) return this.finished;
|
|
5790
|
+
if (this.pending) throw Error("PPTX presentation preflight has an uncommitted slide");
|
|
5791
|
+
if (this.slides.length !== this.slideCountValue) throw Error(`PPTX presentation preflight is incomplete: ${this.slides.length}/${this.slideCountValue} slides`);
|
|
5792
|
+
return this.finished = Object.freeze({
|
|
5793
|
+
slideCount: this.slideCountValue,
|
|
5794
|
+
slideWidth: this.slideWidthValue,
|
|
5795
|
+
slideHeight: this.slideHeightValue,
|
|
5796
|
+
defaultTextColor: this.defaultTextColorValue,
|
|
5797
|
+
majorFont: this.majorFontValue,
|
|
5798
|
+
minorFont: this.minorFontValue,
|
|
5799
|
+
hlinkColor: this.hlinkColorValue,
|
|
5800
|
+
folHlinkColor: this.folHlinkColorValue,
|
|
5801
|
+
embeddedFonts: this.embeddedFontsValue,
|
|
5802
|
+
slides: Object.freeze([...this.slides]),
|
|
5803
|
+
fontPreloadNames: this.fontPreloadNames
|
|
5804
|
+
}), this.descriptors = [], this.slides = [], this.projectionBytesValue = Be(this.finished, this.limit).jsonBytes, this.finished;
|
|
5805
|
+
}
|
|
5806
|
+
}, hi = 1024 * 1024, gi = class {
|
|
5584
5807
|
active = /* @__PURE__ */ new Set();
|
|
5585
5808
|
nextSessionId = 1;
|
|
5586
5809
|
constructor(e) {
|
|
@@ -5589,21 +5812,21 @@ var Zr = 1024 * 1024, Qr = class {
|
|
|
5589
5812
|
}
|
|
5590
5813
|
async load(e, t = !0, n) {
|
|
5591
5814
|
this.assertSlideIndex(e);
|
|
5592
|
-
let
|
|
5593
|
-
sessionId:
|
|
5594
|
-
operationId:
|
|
5815
|
+
let i = this.nextSessionId++, a = {
|
|
5816
|
+
sessionId: i,
|
|
5817
|
+
operationId: i,
|
|
5595
5818
|
generation: this.options.generation ?? 1
|
|
5596
|
-
},
|
|
5597
|
-
...
|
|
5598
|
-
maxByteCredit:
|
|
5819
|
+
}, o = new f(this.options.transport, {
|
|
5820
|
+
...a,
|
|
5821
|
+
maxByteCredit: r,
|
|
5599
5822
|
timeoutMs: n
|
|
5600
5823
|
});
|
|
5601
|
-
this.active.add(
|
|
5824
|
+
this.active.add(o);
|
|
5602
5825
|
try {
|
|
5603
|
-
await this.options.open(e,
|
|
5604
|
-
let r = await
|
|
5826
|
+
await this.options.open(e, a, n);
|
|
5827
|
+
let r = await vi(o);
|
|
5605
5828
|
try {
|
|
5606
|
-
let e = r.usage ??
|
|
5829
|
+
let e = r.usage ?? o.usageCheckpoint;
|
|
5607
5830
|
e && this.options.onUsage?.(e);
|
|
5608
5831
|
let n = t ? JSON.parse(new TextDecoder().decode(new Uint8Array(r.payload))) : void 0;
|
|
5609
5832
|
return await r.ack(), n;
|
|
@@ -5611,9 +5834,9 @@ var Zr = 1024 * 1024, Qr = class {
|
|
|
5611
5834
|
r.disposeTransferred();
|
|
5612
5835
|
}
|
|
5613
5836
|
} catch (e) {
|
|
5614
|
-
throw await
|
|
5837
|
+
throw await o.cancel("request-error").catch(() => void 0), e;
|
|
5615
5838
|
} finally {
|
|
5616
|
-
this.active.delete(
|
|
5839
|
+
this.active.delete(o);
|
|
5617
5840
|
}
|
|
5618
5841
|
}
|
|
5619
5842
|
cancelAll() {
|
|
@@ -5624,20 +5847,20 @@ var Zr = 1024 * 1024, Qr = class {
|
|
|
5624
5847
|
if (!Number.isSafeInteger(e) || e < 0 || e >= this.options.slideCount) throw RangeError(`Slide index ${e} out of range (count: ${this.options.slideCount})`);
|
|
5625
5848
|
}
|
|
5626
5849
|
};
|
|
5627
|
-
function
|
|
5850
|
+
function _i(e) {
|
|
5628
5851
|
return !!e && typeof e == "object" && e.protocol === "ooxml-pull-v1";
|
|
5629
5852
|
}
|
|
5630
|
-
async function
|
|
5853
|
+
async function vi(e) {
|
|
5631
5854
|
try {
|
|
5632
|
-
return await e.pull(
|
|
5855
|
+
return await e.pull(hi);
|
|
5633
5856
|
} catch (t) {
|
|
5634
|
-
let n =
|
|
5857
|
+
let n = yi(t);
|
|
5635
5858
|
if (n === void 0) throw t;
|
|
5636
5859
|
return e.pull(n);
|
|
5637
5860
|
}
|
|
5638
5861
|
}
|
|
5639
|
-
function
|
|
5640
|
-
return
|
|
5862
|
+
function yi(e) {
|
|
5863
|
+
return l(e, hi, r);
|
|
5641
5864
|
}
|
|
5642
5865
|
//#endregion
|
|
5643
|
-
export {
|
|
5866
|
+
export { Qr as a, Ur as c, Vr as d, Jt as f, di as i, Rr as l, _i as n, li as o, mi as r, ui as s, gi as t, Br as u };
|