@silurus/ooxml 0.75.5 → 0.76.1
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 +66 -28
- package/dist/bounded-raw-part-cache-C6ro6Ezf.js +254 -0
- package/dist/{find-cursor-Dc5iM6s7.js → canvas-viewer-mechanics-CwVSOYke.js} +192 -64
- package/dist/{document-pull-client-BcNYhoAG.js → document-pull-client-AAnwzlig.js} +3625 -3601
- package/dist/docx-CCksIXd5.js +1301 -0
- package/dist/docx.mjs +4 -6
- package/dist/docx_parser_bg.wasm +0 -0
- package/dist/index.mjs +3 -3
- package/dist/{line-distribute-B8sqT8kC.js → line-distribute-C1r2zvji.js} +141 -141
- package/dist/{line-metrics-D9gqQWHl.js → line-metrics-BdCACYlq.js} +4026 -1170
- package/dist/math.mjs +1 -1
- package/dist/node.mjs +779 -465
- package/dist/pptx-CKAk5e-J.js +1735 -0
- package/dist/pptx.mjs +5 -7
- package/dist/pptx_parser_bg.wasm +0 -0
- package/dist/{render-CalC7GX4.js → render-CLcpSi0m.js} +11 -18
- package/dist/render-worker-host-B8HAb_sK.js +27 -0
- package/dist/render-worker-host-Bkf1jUcW.js +27 -0
- package/dist/render-worker-host-CKOmXdyr.js +27 -0
- package/dist/resource-measurement-E_S_iau4.js +119 -0
- package/dist/session-B4Y54cbT.js +730 -0
- package/dist/{renderer-B9R6F_QY.js → slide-pull-client-WCuYCjio.js} +973 -820
- package/dist/types/docx.d.ts +1181 -3994
- package/dist/types/index.d.ts +2733 -8171
- package/dist/types/math.d.ts +8 -33
- package/dist/types/node.d.ts +1852 -4433
- package/dist/types/pptx.d.ts +1030 -3678
- package/dist/types/xlsx.d.ts +1291 -3262
- package/dist/worksheet-pull-client-YzjJMOns.js +455 -0
- package/dist/xlsx-BBmmZNQn.js +6362 -0
- package/dist/xlsx.mjs +5 -7
- package/dist/xlsx_parser_bg.wasm +0 -0
- package/package.json +14 -7
- package/dist/bounded-raw-part-cache-BTfZD_Sz.js +0 -1248
- package/dist/docx-DjF8FgoP.js +0 -1274
- package/dist/duotone-bitmap-by-path-CWsSJkJu.js +0 -28
- package/dist/hyperlink-D85FexTa.js +0 -27
- package/dist/pptx-C17xP8AV.js +0 -1705
- package/dist/pptx-Dl8tOSmP.js +0 -822
- package/dist/preload-BEouWnlI.js +0 -132
- package/dist/render-worker-host-BG3a7brz.js +0 -27
- package/dist/render-worker-host-CsB-dPJv.js +0 -27
- package/dist/render-worker-host-Cyv5Hkbh.js +0 -27
- package/dist/resource-measurement-6aReN3K0.js +0 -93
- package/dist/slide-pull-client-D_T0AIoX.js +0 -175
- package/dist/svg-image-by-path-C1M3N2pT.js +0 -1623
- package/dist/worksheet-pull-worker-DCei8u-4.js +0 -347
- package/dist/xlsx-BaH9irS0.js +0 -5515
- /package/dist/{highlight-rect-cCvVU-MW.js → highlight-rect-CAkCWJ37.js} +0 -0
- /package/dist/{mathjax-Dqo857oC.js → mathjax-CMjda8Ip.js} +0 -0
- /package/dist/{transfer-3QEJrsJa.js → transfer-DCu4c2BL.js} +0 -0
- /package/dist/{visible-index-CKvgpUrf.js → visible-index-CgyJLAS_.js} +0 -0
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { t as e } from "./
|
|
2
|
-
import { a as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { $t as e, A as t, At as n, Bt as r, C as i, D as a, Dt as o, Ft as s, Gt as c, Ht as l, Jt as u, K as d, Kt as f, Lt as p, M as m, N as h, Nt as g, O as _, Ot as v, Rt as y, S as b, St as x, Tt as S, Ut as C, Vt as w, Wt as T, Yt as E, Zt as D, _ as O, _t as k, bt as A, c as j, cn as M, ct as N, d as P, dn as F, f as I, g as L, gt as R, h as z, ht as B, i as V, j as H, jt as U, ln as W, m as ee, mt as G, n as te, on as ne, p as re, pn as ie, pt as ae, r as oe, rn as K, s as se, sn as ce, u as le, un as ue, vt as de, w as fe, xt as pe, y as me } from "./line-metrics-BdCACYlq.js";
|
|
2
|
+
import { a as he, c as ge, i as _e, l as ve, n as ye, o as be, r as xe, s as Se, t as Ce } from "./line-distribute-C1r2zvji.js";
|
|
3
|
+
import { i as we } from "./resource-measurement-E_S_iau4.js";
|
|
4
|
+
import { t as Te } from "./mathjax-CMjda8Ip.js";
|
|
5
|
+
//#region packages/pptx/src/types.ts
|
|
6
|
+
function Ee(e) {
|
|
7
|
+
return e;
|
|
8
|
+
}
|
|
9
|
+
var De = {
|
|
9
10
|
textarchdown: {
|
|
10
11
|
adj: [["adj", "val 0"]],
|
|
11
12
|
gd: [
|
|
@@ -2387,22 +2388,22 @@ var ye = {
|
|
|
2387
2388
|
]
|
|
2388
2389
|
}]
|
|
2389
2390
|
}
|
|
2390
|
-
},
|
|
2391
|
-
function
|
|
2392
|
-
return e.toLowerCase() in
|
|
2391
|
+
}, Oe = Math.PI * 2 / 216e5, ke = De, Ae = /* @__PURE__ */ new Map();
|
|
2392
|
+
function je(e) {
|
|
2393
|
+
return e.toLowerCase() in ke;
|
|
2393
2394
|
}
|
|
2394
|
-
function
|
|
2395
|
-
let t =
|
|
2395
|
+
function Me(e) {
|
|
2396
|
+
let t = Ae.get(e);
|
|
2396
2397
|
if (t) return t;
|
|
2397
|
-
let n =
|
|
2398
|
+
let n = ke[e];
|
|
2398
2399
|
return n ? (t = {
|
|
2399
|
-
adj: n.adj.map(([e, t]) => [e,
|
|
2400
|
-
gd: n.gd.map(([e, t]) => [e,
|
|
2400
|
+
adj: n.adj.map(([e, t]) => [e, C(t)]),
|
|
2401
|
+
gd: n.gd.map(([e, t]) => [e, C(t)]),
|
|
2401
2402
|
paths: n.paths
|
|
2402
|
-
},
|
|
2403
|
+
}, Ae.set(e, t), t) : null;
|
|
2403
2404
|
}
|
|
2404
|
-
var
|
|
2405
|
-
function
|
|
2405
|
+
var Ne = 48;
|
|
2406
|
+
function Pe(e, t, n, r) {
|
|
2406
2407
|
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;
|
|
2407
2408
|
for (let n of e.cmds) switch (n[0]) {
|
|
2408
2409
|
case "m":
|
|
@@ -2419,8 +2420,8 @@ function Ee(e, t, n, r) {
|
|
|
2419
2420
|
break;
|
|
2420
2421
|
case "C": {
|
|
2421
2422
|
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]));
|
|
2422
|
-
for (let t = 1; t <=
|
|
2423
|
-
let n = t /
|
|
2423
|
+
for (let t = 1; t <= Ne; t++) {
|
|
2424
|
+
let n = t / Ne, 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;
|
|
2424
2425
|
c.push({
|
|
2425
2426
|
x: s,
|
|
2426
2427
|
y: p
|
|
@@ -2431,8 +2432,8 @@ function Ee(e, t, n, r) {
|
|
|
2431
2432
|
}
|
|
2432
2433
|
case "Q": {
|
|
2433
2434
|
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]));
|
|
2434
|
-
for (let t = 1; t <=
|
|
2435
|
-
let n = t /
|
|
2435
|
+
for (let t = 1; t <= Ne; t++) {
|
|
2436
|
+
let n = t / Ne, 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;
|
|
2436
2437
|
c.push({
|
|
2437
2438
|
x: s,
|
|
2438
2439
|
y: d
|
|
@@ -2442,9 +2443,9 @@ function Ee(e, t, n, r) {
|
|
|
2442
2443
|
break;
|
|
2443
2444
|
}
|
|
2444
2445
|
case "a": {
|
|
2445
|
-
let e = t.resolve(n[1]), r = t.resolve(n[2]), o = e * i, s = r * a, d = t.resolve(n[3]) *
|
|
2446
|
+
let e = t.resolve(n[1]), r = t.resolve(n[2]), o = e * i, s = r * a, d = t.resolve(n[3]) * Oe, f = t.resolve(n[4]) * Oe, 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;
|
|
2446
2447
|
_ > 0 && v < 0 ? v += m : _ < 0 && v > 0 && (v -= m);
|
|
2447
|
-
let y = v + g * m, b = l - o * Math.cos(h), x = u - s * Math.sin(h), S = Math.max(
|
|
2448
|
+
let y = v + g * m, b = l - o * Math.cos(h), x = u - s * Math.sin(h), S = Math.max(Ne, Math.ceil(Math.abs(y) / m * 96));
|
|
2448
2449
|
for (let e = 1; e <= S; e++) {
|
|
2449
2450
|
let t = h + y * e / S;
|
|
2450
2451
|
c.push({
|
|
@@ -2459,7 +2460,7 @@ function Ee(e, t, n, r) {
|
|
|
2459
2460
|
}
|
|
2460
2461
|
return c;
|
|
2461
2462
|
}
|
|
2462
|
-
function
|
|
2463
|
+
function Fe(e) {
|
|
2463
2464
|
let t = [0];
|
|
2464
2465
|
for (let n = 1; n < e.length; n++) {
|
|
2465
2466
|
let r = e[n].x - e[n - 1].x, i = e[n].y - e[n - 1].y;
|
|
@@ -2467,23 +2468,23 @@ function De(e) {
|
|
|
2467
2468
|
}
|
|
2468
2469
|
return t;
|
|
2469
2470
|
}
|
|
2470
|
-
function
|
|
2471
|
-
let i =
|
|
2471
|
+
function Ie(e, t, n, r) {
|
|
2472
|
+
let i = Me(e.toLowerCase());
|
|
2472
2473
|
if (!i || i.paths.length === 0) return null;
|
|
2473
|
-
let a =
|
|
2474
|
+
let a = T({
|
|
2474
2475
|
w: n,
|
|
2475
2476
|
h: r,
|
|
2476
2477
|
adj: t
|
|
2477
|
-
}, i.adj, i.gd), o = i.paths.length === 1, s =
|
|
2478
|
+
}, i.adj, i.gd), o = i.paths.length === 1, s = Pe(i.paths[0], a, n, r), c = o ? s : Pe(i.paths[i.paths.length - 1], a, n, r);
|
|
2478
2479
|
return {
|
|
2479
2480
|
top: s,
|
|
2480
2481
|
bottom: c,
|
|
2481
|
-
topLen:
|
|
2482
|
-
bottomLen:
|
|
2482
|
+
topLen: Fe(s),
|
|
2483
|
+
bottomLen: Fe(c),
|
|
2483
2484
|
singleEdge: o
|
|
2484
2485
|
};
|
|
2485
2486
|
}
|
|
2486
|
-
function
|
|
2487
|
+
function Le(e, t, n) {
|
|
2487
2488
|
let r = t[t.length - 1];
|
|
2488
2489
|
if (e.length === 1 || r === 0) return {
|
|
2489
2490
|
x: e[0].x,
|
|
@@ -2504,17 +2505,17 @@ function ke(e, t, n) {
|
|
|
2504
2505
|
ty: f / p
|
|
2505
2506
|
};
|
|
2506
2507
|
}
|
|
2507
|
-
function
|
|
2508
|
+
function Re(e) {
|
|
2508
2509
|
return e.topLen[e.topLen.length - 1] ?? 0;
|
|
2509
2510
|
}
|
|
2510
|
-
function
|
|
2511
|
+
function ze(e, t) {
|
|
2511
2512
|
if (!e.singleEdge) return 1;
|
|
2512
|
-
let n =
|
|
2513
|
+
let n = Re(e);
|
|
2513
2514
|
return n <= 0 ? 1 : Math.max(0, Math.min(1, t / n));
|
|
2514
2515
|
}
|
|
2515
|
-
function
|
|
2516
|
+
function Be(e, t, n, r) {
|
|
2516
2517
|
if (e.singleEdge) {
|
|
2517
|
-
let i =
|
|
2518
|
+
let i = Le(e.top, e.topLen, t), a = Math.atan2(i.ty, i.tx), o = i.ty, s = -i.tx, c = n * (1 - r);
|
|
2518
2519
|
return {
|
|
2519
2520
|
x: i.x - o * c,
|
|
2520
2521
|
y: i.y - s * c,
|
|
@@ -2523,7 +2524,7 @@ function Me(e, t, n, r) {
|
|
|
2523
2524
|
shear: 0
|
|
2524
2525
|
};
|
|
2525
2526
|
}
|
|
2526
|
-
let i =
|
|
2527
|
+
let i = Le(e.top, e.topLen, t), a = Le(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);
|
|
2527
2528
|
return {
|
|
2528
2529
|
x: c,
|
|
2529
2530
|
y: l,
|
|
@@ -2534,13 +2535,13 @@ function Me(e, t, n, r) {
|
|
|
2534
2535
|
}
|
|
2535
2536
|
//#endregion
|
|
2536
2537
|
//#region packages/core/src/shape/effects.ts
|
|
2537
|
-
function
|
|
2538
|
+
function Ve(e, t) {
|
|
2538
2539
|
return e * t;
|
|
2539
2540
|
}
|
|
2540
|
-
function
|
|
2541
|
+
function He(e) {
|
|
2541
2542
|
return e.getContext("2d") ?? null;
|
|
2542
2543
|
}
|
|
2543
|
-
function
|
|
2544
|
+
function Ue(e, t, n, r) {
|
|
2544
2545
|
let i = Math.max(0, Math.floor(e.x - t)), a = Math.max(0, Math.floor(e.y - t)), o = Math.min(n, Math.ceil(e.x + e.w + t)), s = Math.min(r, Math.ceil(e.y + e.h + t));
|
|
2545
2546
|
return {
|
|
2546
2547
|
x: i,
|
|
@@ -2549,7 +2550,7 @@ function Fe(e, t, n, r) {
|
|
|
2549
2550
|
h: Math.max(1, s - a)
|
|
2550
2551
|
};
|
|
2551
2552
|
}
|
|
2552
|
-
function
|
|
2553
|
+
function We(e, t) {
|
|
2553
2554
|
if (t.x === 0 && t.y === 0) return e;
|
|
2554
2555
|
let n = t.x, r = t.y;
|
|
2555
2556
|
return new Proxy(e, {
|
|
@@ -2565,58 +2566,58 @@ function Ie(e, t) {
|
|
|
2565
2566
|
}
|
|
2566
2567
|
});
|
|
2567
2568
|
}
|
|
2568
|
-
function
|
|
2569
|
-
let c =
|
|
2570
|
-
if (!m) return;
|
|
2571
|
-
let h = Pe(m);
|
|
2569
|
+
function Ge(t, n, r, i, a, o, s) {
|
|
2570
|
+
let c = Ve(i.blur, a), l = Ve(i.dist, a), d = i.dir * Math.PI / 180, f = Math.cos(d) * l, p = Math.sin(d) * l, m = Ue(r, Math.ceil(3 * c + Math.abs(l)) + 2, o, s), h = e(m.w, m.h);
|
|
2572
2571
|
if (!h) return;
|
|
2573
|
-
let g =
|
|
2574
|
-
|
|
2572
|
+
let g = He(h);
|
|
2573
|
+
if (!g) return;
|
|
2574
|
+
let _ = We(g, m);
|
|
2575
|
+
_.save(), _.fillStyle = u(i.color, i.alpha), n(_), _.restore(), _.save(), _.globalCompositeOperation = "destination-out", _.filter = c > 0 ? `blur(${c}px)` : "none", _.translate(f, p), _.fillStyle = "#000", n(_), _.restore(), _.save(), _.globalCompositeOperation = "destination-in", _.filter = "none", _.fillStyle = "#000", n(_), _.restore(), t.save(), t.drawImage(h, m.x, m.y), t.restore();
|
|
2575
2576
|
}
|
|
2576
|
-
function
|
|
2577
|
-
let l =
|
|
2577
|
+
function Ke(t, n, r, i, a, o, s, c) {
|
|
2578
|
+
let l = Ve(i.radius, a);
|
|
2578
2579
|
if (l <= 0) {
|
|
2579
|
-
t
|
|
2580
|
+
n(t);
|
|
2580
2581
|
return;
|
|
2581
2582
|
}
|
|
2582
|
-
let u =
|
|
2583
|
+
let u = Ue(r, Math.ceil(l) + 2, o, s), d = r.x - u.x, f = r.y - u.y, p = e(u.w, u.h);
|
|
2583
2584
|
if (!p) {
|
|
2584
|
-
t
|
|
2585
|
+
n(t);
|
|
2585
2586
|
return;
|
|
2586
2587
|
}
|
|
2587
|
-
let m =
|
|
2588
|
+
let m = He(p);
|
|
2588
2589
|
if (!m) {
|
|
2589
|
-
t
|
|
2590
|
+
n(t);
|
|
2590
2591
|
return;
|
|
2591
2592
|
}
|
|
2592
|
-
let h =
|
|
2593
|
-
|
|
2594
|
-
let _ =
|
|
2593
|
+
let h = We(m, u), g = c ?? n;
|
|
2594
|
+
n(h);
|
|
2595
|
+
let _ = e(u.w, u.h), v = e(u.w, u.h), y = _ ? He(_) : null, b = v ? He(v) : null;
|
|
2595
2596
|
if (_ && y && v && b) {
|
|
2596
|
-
let
|
|
2597
|
-
|
|
2597
|
+
let e = We(y, u);
|
|
2598
|
+
e.fillStyle = "#000", g(e), b.drawImage(p, d, f, r.w, r.h, d - l, f - l, r.w + l * 2, r.h + l * 2), b.drawImage(p, 0, 0), b.globalCompositeOperation = "destination-in", b.filter = `blur(${l / 3}px)`, b.drawImage(_, 0, 0), b.filter = "none", b.globalCompositeOperation = "source-over", t.save(), t.drawImage(v, u.x, u.y), t.restore();
|
|
2598
2599
|
return;
|
|
2599
2600
|
}
|
|
2600
|
-
|
|
2601
|
+
t.save(), t.drawImage(p, 0, 0), t.restore();
|
|
2601
2602
|
}
|
|
2602
|
-
function
|
|
2603
|
-
let c = o
|
|
2603
|
+
function qe(t, n, r, i, a, o, s) {
|
|
2604
|
+
let c = e(o, s);
|
|
2604
2605
|
if (!c) return;
|
|
2605
|
-
let l =
|
|
2606
|
+
let l = He(c);
|
|
2606
2607
|
if (!l) return;
|
|
2607
|
-
let u =
|
|
2608
|
-
l.save(), u > 0 && (l.filter = `blur(${u}px)`),
|
|
2609
|
-
let d =
|
|
2610
|
-
p.addColorStop(0, `rgba(0,0,0,${
|
|
2611
|
-
let g =
|
|
2612
|
-
|
|
2613
|
-
}
|
|
2614
|
-
function
|
|
2608
|
+
let u = Ve(i.blur, a);
|
|
2609
|
+
l.save(), u > 0 && (l.filter = `blur(${u}px)`), n(l), l.restore(), l.save(), l.globalCompositeOperation = "destination-in";
|
|
2610
|
+
let d = r.y, f = r.y + r.h, p = l.createLinearGradient(0, f, 0, d), m = Je(i.stPos), h = Je(i.endPos);
|
|
2611
|
+
p.addColorStop(0, `rgba(0,0,0,${i.stA})`), m > 0 && p.addColorStop(m, `rgba(0,0,0,${i.stA})`), h < 1 && h > m && p.addColorStop(h, `rgba(0,0,0,${i.endA})`), p.addColorStop(1, `rgba(0,0,0,${i.endA})`), l.fillStyle = p, l.fillRect(0, 0, o, s), l.restore();
|
|
2612
|
+
let g = Ve(i.dist, a), _ = i.dir * Math.PI / 180, v = Math.cos(_) * g, y = Math.sin(_) * g;
|
|
2613
|
+
t.save(), t.translate(r.x + v, f + y), t.scale(i.sx, i.sy), t.translate(-r.x, -f), t.drawImage(c, 0, 0), t.restore();
|
|
2614
|
+
}
|
|
2615
|
+
function Je(e) {
|
|
2615
2616
|
return e < 0 ? 0 : e > 1 ? 1 : e;
|
|
2616
2617
|
}
|
|
2617
2618
|
//#endregion
|
|
2618
2619
|
//#region packages/core/src/shape/scene3d-camera.ts
|
|
2619
|
-
var
|
|
2620
|
+
var q = 26, Ye = {
|
|
2620
2621
|
orthographicFront: {
|
|
2621
2622
|
kind: "orthographic",
|
|
2622
2623
|
baseLat: 0,
|
|
@@ -2629,52 +2630,52 @@ var X = 26, Ve = {
|
|
|
2629
2630
|
baseLat: 0,
|
|
2630
2631
|
baseLon: 0,
|
|
2631
2632
|
baseRev: 0,
|
|
2632
|
-
fovDeg:
|
|
2633
|
+
fovDeg: q
|
|
2633
2634
|
},
|
|
2634
2635
|
perspectiveRelaxed: {
|
|
2635
2636
|
kind: "perspective",
|
|
2636
2637
|
baseLat: 0,
|
|
2637
2638
|
baseLon: 0,
|
|
2638
2639
|
baseRev: 0,
|
|
2639
|
-
fovDeg:
|
|
2640
|
+
fovDeg: q
|
|
2640
2641
|
},
|
|
2641
2642
|
perspectiveRelaxedModerately: {
|
|
2642
2643
|
kind: "perspective",
|
|
2643
2644
|
baseLat: 0,
|
|
2644
2645
|
baseLon: 0,
|
|
2645
2646
|
baseRev: 0,
|
|
2646
|
-
fovDeg:
|
|
2647
|
+
fovDeg: q
|
|
2647
2648
|
},
|
|
2648
2649
|
perspectiveAbove: {
|
|
2649
2650
|
kind: "perspective",
|
|
2650
2651
|
baseLat: -20,
|
|
2651
2652
|
baseLon: 0,
|
|
2652
2653
|
baseRev: 0,
|
|
2653
|
-
fovDeg:
|
|
2654
|
+
fovDeg: q
|
|
2654
2655
|
},
|
|
2655
2656
|
perspectiveBelow: {
|
|
2656
2657
|
kind: "perspective",
|
|
2657
2658
|
baseLat: 20,
|
|
2658
2659
|
baseLon: 0,
|
|
2659
2660
|
baseRev: 0,
|
|
2660
|
-
fovDeg:
|
|
2661
|
+
fovDeg: q
|
|
2661
2662
|
},
|
|
2662
2663
|
perspectiveLeft: {
|
|
2663
2664
|
kind: "perspective",
|
|
2664
2665
|
baseLat: 0,
|
|
2665
2666
|
baseLon: -20,
|
|
2666
2667
|
baseRev: 0,
|
|
2667
|
-
fovDeg:
|
|
2668
|
+
fovDeg: q
|
|
2668
2669
|
},
|
|
2669
2670
|
perspectiveRight: {
|
|
2670
2671
|
kind: "perspective",
|
|
2671
2672
|
baseLat: 0,
|
|
2672
2673
|
baseLon: 20,
|
|
2673
2674
|
baseRev: 0,
|
|
2674
|
-
fovDeg:
|
|
2675
|
+
fovDeg: q
|
|
2675
2676
|
}
|
|
2676
2677
|
};
|
|
2677
|
-
function
|
|
2678
|
+
function Xe(e, t) {
|
|
2678
2679
|
let n = Array(9).fill(0);
|
|
2679
2680
|
for (let r = 0; r < 3; r++) for (let i = 0; i < 3; i++) {
|
|
2680
2681
|
let a = 0;
|
|
@@ -2683,7 +2684,7 @@ function He(e, t) {
|
|
|
2683
2684
|
}
|
|
2684
2685
|
return n;
|
|
2685
2686
|
}
|
|
2686
|
-
function
|
|
2687
|
+
function Ze(e) {
|
|
2687
2688
|
let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
|
|
2688
2689
|
return [
|
|
2689
2690
|
1,
|
|
@@ -2697,7 +2698,7 @@ function Ue(e) {
|
|
|
2697
2698
|
n
|
|
2698
2699
|
];
|
|
2699
2700
|
}
|
|
2700
|
-
function
|
|
2701
|
+
function Qe(e) {
|
|
2701
2702
|
let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
|
|
2702
2703
|
return [
|
|
2703
2704
|
n,
|
|
@@ -2711,7 +2712,7 @@ function We(e) {
|
|
|
2711
2712
|
n
|
|
2712
2713
|
];
|
|
2713
2714
|
}
|
|
2714
|
-
function
|
|
2715
|
+
function $e(e) {
|
|
2715
2716
|
let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
|
|
2716
2717
|
return [
|
|
2717
2718
|
n,
|
|
@@ -2725,22 +2726,22 @@ function Ge(e) {
|
|
|
2725
2726
|
1
|
|
2726
2727
|
];
|
|
2727
2728
|
}
|
|
2728
|
-
function
|
|
2729
|
+
function et(e, t, n, r) {
|
|
2729
2730
|
return [
|
|
2730
2731
|
e[0] * t + e[1] * n + e[2] * r,
|
|
2731
2732
|
e[3] * t + e[4] * n + e[5] * r,
|
|
2732
2733
|
e[6] * t + e[7] * n + e[8] * r
|
|
2733
2734
|
];
|
|
2734
2735
|
}
|
|
2735
|
-
function
|
|
2736
|
+
function tt(e, t) {
|
|
2736
2737
|
let n = t ? t.lat : e.baseLat, r = t ? t.lon : e.baseLon;
|
|
2737
|
-
return
|
|
2738
|
+
return Xe($e(-(t ? t.rev : e.baseRev)), Xe(Ze(-n), Qe(-r)));
|
|
2738
2739
|
}
|
|
2739
|
-
function
|
|
2740
|
-
return
|
|
2740
|
+
function nt(e) {
|
|
2741
|
+
return Ye[e] || (e.startsWith("perspective") ? Ye.perspectiveFront : Ye.orthographicFront);
|
|
2741
2742
|
}
|
|
2742
|
-
function
|
|
2743
|
-
let r =
|
|
2743
|
+
function rt(e, t, n) {
|
|
2744
|
+
let r = nt(e.prst), i = tt(r, e.rot);
|
|
2744
2745
|
if (t <= 0 || n <= 0) return {
|
|
2745
2746
|
corners: [
|
|
2746
2747
|
{
|
|
@@ -2772,11 +2773,11 @@ function Ye(e, t, n) {
|
|
|
2772
2773
|
if (r.kind === "perspective") {
|
|
2773
2774
|
let t = e.fov ?? r.fovDeg, n = Math.max(1, Math.min(179, t)) * Math.PI / 180, a = l / Math.tan(n / 2);
|
|
2774
2775
|
u = s.map(([e, t]) => {
|
|
2775
|
-
let [n, r, o] =
|
|
2776
|
+
let [n, r, o] = et(i, e, t, 0), s = a - o, c = a / (Math.abs(s) < 1e-6 ? 1e-6 * Math.sign(s || 1) : s);
|
|
2776
2777
|
return [n * c, r * c];
|
|
2777
2778
|
});
|
|
2778
2779
|
} else u = s.map(([e, t]) => {
|
|
2779
|
-
let [n, r] =
|
|
2780
|
+
let [n, r] = et(i, e, t, 0);
|
|
2780
2781
|
return [n, r];
|
|
2781
2782
|
});
|
|
2782
2783
|
u = u.map(([e, t]) => [e * c, t * c]);
|
|
@@ -2799,18 +2800,18 @@ function Ye(e, t, n) {
|
|
|
2799
2800
|
isIdentity: _
|
|
2800
2801
|
};
|
|
2801
2802
|
}
|
|
2802
|
-
function
|
|
2803
|
-
let { isIdentity: t } =
|
|
2803
|
+
function it(e) {
|
|
2804
|
+
let { isIdentity: t } = rt(e, 1e3, 1e3);
|
|
2804
2805
|
return !t;
|
|
2805
2806
|
}
|
|
2806
|
-
function
|
|
2807
|
-
let i =
|
|
2807
|
+
function at(e, t, n, r) {
|
|
2808
|
+
let i = nt(e.prst), a = tt(i, e.rot);
|
|
2808
2809
|
if (t <= 0 || n <= 0 || r === 0) return {
|
|
2809
2810
|
x: 0,
|
|
2810
2811
|
y: 0
|
|
2811
2812
|
};
|
|
2812
2813
|
let o = t / 2, s = n / 2, c = Math.max(o, s), l = e.zoom ?? 1, u = (t) => {
|
|
2813
|
-
let [n, r, o] =
|
|
2814
|
+
let [n, r, o] = et(a, 0, 0, t);
|
|
2814
2815
|
if (i.kind === "perspective") {
|
|
2815
2816
|
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);
|
|
2816
2817
|
return [n * d * l, r * d * l];
|
|
@@ -2824,7 +2825,7 @@ function Ze(e, t, n, r) {
|
|
|
2824
2825
|
}
|
|
2825
2826
|
//#endregion
|
|
2826
2827
|
//#region packages/core/src/shape/scene3d-draw.ts
|
|
2827
|
-
function
|
|
2828
|
+
function ot(e, t, n, r) {
|
|
2828
2829
|
let i = e.x, a = e.y, o = t.x, s = t.y, c = n.x, l = n.y, u = r.x, d = r.y, f = o - c, p = u - c, m = i - o + c - u, h = s - l, g = d - l, _ = a - s + l - d, v, y;
|
|
2829
2830
|
if (Math.abs(m) < 1e-12 && Math.abs(_) < 1e-12) v = 0, y = 0;
|
|
2830
2831
|
else {
|
|
@@ -2844,15 +2845,15 @@ function Qe(e, t, n, r) {
|
|
|
2844
2845
|
1
|
|
2845
2846
|
];
|
|
2846
2847
|
}
|
|
2847
|
-
function
|
|
2848
|
+
function st(e, t, n) {
|
|
2848
2849
|
let r = e[6] * t + e[7] * n + e[8];
|
|
2849
2850
|
return {
|
|
2850
2851
|
x: (e[0] * t + e[1] * n + e[2]) / r,
|
|
2851
2852
|
y: (e[3] * t + e[4] * n + e[5]) / r
|
|
2852
2853
|
};
|
|
2853
2854
|
}
|
|
2854
|
-
var
|
|
2855
|
-
function
|
|
2855
|
+
var ct = 1;
|
|
2856
|
+
function lt(e, t) {
|
|
2856
2857
|
let [n, r, i, a, o, s] = e, [c, l, u, d, f, p] = t;
|
|
2857
2858
|
return [
|
|
2858
2859
|
n * c + i * l,
|
|
@@ -2863,13 +2864,13 @@ function tt(e, t) {
|
|
|
2863
2864
|
r * f + a * p + s
|
|
2864
2865
|
];
|
|
2865
2866
|
}
|
|
2866
|
-
function
|
|
2867
|
+
function ut(e, t, n, r, i, a, o, s, c, l, u, d, f) {
|
|
2867
2868
|
let p = c - o, m = l - s;
|
|
2868
2869
|
if (p <= 0 || m <= 0) return;
|
|
2869
|
-
let h = (d.x - u.x) / p, g = (d.y - u.y) / p, _ = (f.x - u.x) / m, v = (f.y - u.y) / m, y = (Math.hypot(d.x - u.x, d.y - u.y) || 1) * a, b = (Math.hypot(f.x - u.x, f.y - u.y) || 1) * a, x =
|
|
2870
|
+
let h = (d.x - u.x) / p, g = (d.y - u.y) / p, _ = (f.x - u.x) / m, v = (f.y - u.y) / m, y = (Math.hypot(d.x - u.x, d.y - u.y) || 1) * a, b = (Math.hypot(f.x - u.x, f.y - u.y) || 1) * a, x = ct * p / y, S = ct * m / b, C = Math.max(0, o - x), w = Math.max(0, s - S), T = Math.min(n, c + x), E = Math.min(r, l + S), D = T - C, O = E - w;
|
|
2870
2871
|
if (D <= 0 || O <= 0) return;
|
|
2871
2872
|
e.save();
|
|
2872
|
-
let [k, A, j, M, N, P] =
|
|
2873
|
+
let [k, A, j, M, N, P] = lt(i, [
|
|
2873
2874
|
h,
|
|
2874
2875
|
g,
|
|
2875
2876
|
_,
|
|
@@ -2879,22 +2880,22 @@ function nt(e, t, n, r, i, a, o, s, c, l, u, d, f) {
|
|
|
2879
2880
|
]);
|
|
2880
2881
|
e.setTransform(k, A, j, M, N, P), e.drawImage(t, C, w, D, O, C, w, D, O), e.restore();
|
|
2881
2882
|
}
|
|
2882
|
-
function
|
|
2883
|
-
let p =
|
|
2883
|
+
function dt(e, t, n, r, i, a, o, s, c, l, u, d, f) {
|
|
2884
|
+
let p = st(o, s, c), m = st(o, l, c), h = st(o, s, u), g = st(o, l, u), _ = (s + l) / 2, v = (c + u) / 2, y = st(o, _, v), b = {
|
|
2884
2885
|
x: (p.x + m.x + h.x + g.x) / 4,
|
|
2885
2886
|
y: (p.y + m.y + h.y + g.y) / 4
|
|
2886
|
-
}, x =
|
|
2887
|
+
}, x = pt(i), S = Math.hypot(y.x - b.x, y.y - b.y) * x;
|
|
2887
2888
|
if (f <= 0 || S <= d) {
|
|
2888
|
-
|
|
2889
|
+
ut(e, t, n, r, i, a, s * n, c * r, l * n, u * r, p, m, h);
|
|
2889
2890
|
return;
|
|
2890
2891
|
}
|
|
2891
|
-
l - s >= u - c ? (
|
|
2892
|
+
l - s >= u - c ? (dt(e, t, n, r, i, a, o, s, c, _, u, d, f - 1), dt(e, t, n, r, i, a, o, _, c, l, u, d, f - 1)) : (dt(e, t, n, r, i, a, o, s, c, l, v, d, f - 1), dt(e, t, n, r, i, a, o, s, v, l, u, d, f - 1));
|
|
2892
2893
|
}
|
|
2893
|
-
function
|
|
2894
|
+
function ft(e, t, n, r, i, a = .5) {
|
|
2894
2895
|
if (n <= 0 || r <= 0) return;
|
|
2895
2896
|
let [o, s, c, l] = i;
|
|
2896
2897
|
if (Math.abs(o.x * s.y - s.x * o.y + s.x * c.y - c.x * s.y + c.x * l.y - l.x * c.y + l.x * o.y - o.x * l.y) / 2 < 1e-6) return;
|
|
2897
|
-
let u =
|
|
2898
|
+
let u = ot(i[0], i[1], i[2], i[3]);
|
|
2898
2899
|
if (!u) return;
|
|
2899
2900
|
let d = t.getTransform(), f = [
|
|
2900
2901
|
d.a,
|
|
@@ -2903,14 +2904,14 @@ function it(e, t, n, r, i, a = .5) {
|
|
|
2903
2904
|
d.d,
|
|
2904
2905
|
d.e,
|
|
2905
2906
|
d.f
|
|
2906
|
-
], p =
|
|
2907
|
-
|
|
2907
|
+
], p = pt(f);
|
|
2908
|
+
vt(e, t, n, r, i, f, p, u, a, 14) || (gt(), t.save(), t.beginPath(), t.moveTo(i[0].x, i[0].y), t.lineTo(i[1].x, i[1].y), t.lineTo(i[2].x, i[2].y), t.lineTo(i[3].x, i[3].y), t.closePath(), t.clip(), dt(t, e, n, r, f, p, u, 0, 0, 1, 1, a, 14), t.restore());
|
|
2908
2909
|
}
|
|
2909
|
-
function
|
|
2910
|
+
function pt(e) {
|
|
2910
2911
|
return Math.sqrt(Math.abs(e[0] * e[3] - e[1] * e[2])) || 1;
|
|
2911
2912
|
}
|
|
2912
|
-
function
|
|
2913
|
-
let r =
|
|
2913
|
+
function mt(e, t, n) {
|
|
2914
|
+
let r = ot(e[0], e[1], e[2], e[3]);
|
|
2914
2915
|
if (!r) return null;
|
|
2915
2916
|
let i = [
|
|
2916
2917
|
[-t, -n],
|
|
@@ -2920,48 +2921,48 @@ function ot(e, t, n) {
|
|
|
2920
2921
|
], a = [];
|
|
2921
2922
|
for (let [e, t] of i) {
|
|
2922
2923
|
if (!(r[6] * e + r[7] * t + r[8] > 1e-9)) return null;
|
|
2923
|
-
a.push(
|
|
2924
|
+
a.push(st(r, e, t));
|
|
2924
2925
|
}
|
|
2925
2926
|
return a;
|
|
2926
2927
|
}
|
|
2927
|
-
var
|
|
2928
|
-
function
|
|
2929
|
-
|
|
2928
|
+
var ht = !1;
|
|
2929
|
+
function gt() {
|
|
2930
|
+
ht || (ht = !0, typeof console < "u" && typeof console.warn == "function" && console.warn("[ooxml] scene3d: no offscreen canvas available — using the direct warp fallback (per-cell bleed only, no supersample). Textured-source seams may be faintly visible; the silhouette and geometry are unaffected."));
|
|
2930
2931
|
}
|
|
2931
|
-
var
|
|
2932
|
-
function
|
|
2933
|
-
let d =
|
|
2934
|
-
x:
|
|
2935
|
-
y:
|
|
2932
|
+
var _t = 2;
|
|
2933
|
+
function vt(t, n, r, i, a, o, s, c, l, u) {
|
|
2934
|
+
let d = a.map((e) => ({
|
|
2935
|
+
x: o[0] * e.x + o[2] * e.y + o[4],
|
|
2936
|
+
y: o[1] * e.x + o[3] * e.y + o[5]
|
|
2936
2937
|
})), f = Infinity, p = Infinity, m = -Infinity, h = -Infinity;
|
|
2937
2938
|
for (let e of d) e.x < f && (f = e.x), e.y < p && (p = e.y), e.x > m && (m = e.x), e.y > h && (h = e.y);
|
|
2938
2939
|
f = Math.floor(f) - 1, p = Math.floor(p) - 1, m = Math.ceil(m) + 1, h = Math.ceil(h) + 1;
|
|
2939
2940
|
let g = m - f, _ = h - p;
|
|
2940
2941
|
if (g <= 0 || _ <= 0) return !1;
|
|
2941
|
-
let v = Math.max(1, Math.ceil(g *
|
|
2942
|
+
let v = Math.max(1, Math.ceil(g * _t)), y = Math.max(1, Math.ceil(_ * _t)), b = e(v, y);
|
|
2942
2943
|
if (!b || b.width !== v || b.height !== y) return !1;
|
|
2943
2944
|
let x = b.getContext("2d") ?? null;
|
|
2944
2945
|
if (!x) return !1;
|
|
2945
|
-
let S =
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
(
|
|
2951
|
-
(
|
|
2946
|
+
let S = _t, C = [
|
|
2947
|
+
o[0] * S,
|
|
2948
|
+
o[1] * S,
|
|
2949
|
+
o[2] * S,
|
|
2950
|
+
o[3] * S,
|
|
2951
|
+
(o[4] - f) * S,
|
|
2952
|
+
(o[5] - p) * S
|
|
2952
2953
|
];
|
|
2953
|
-
x.save(), x.setTransform(C[0], C[1], C[2], C[3], C[4], C[5]), x.beginPath(), x.moveTo(
|
|
2954
|
-
let w =
|
|
2955
|
-
return
|
|
2954
|
+
x.save(), x.setTransform(C[0], C[1], C[2], C[3], C[4], C[5]), x.beginPath(), x.moveTo(a[0].x, a[0].y), x.lineTo(a[1].x, a[1].y), x.lineTo(a[2].x, a[2].y), x.lineTo(a[3].x, a[3].y), x.closePath(), x.clip(), dt(x, t, r, i, C, s, c, 0, 0, 1, 1, l * S, u), x.restore(), n.save(), n.setTransform(1, 0, 0, 1, 0, 0);
|
|
2955
|
+
let w = n.imageSmoothingEnabled, T = n.imageSmoothingQuality;
|
|
2956
|
+
return n.imageSmoothingEnabled = !0, n.imageSmoothingQuality = "high", n.drawImage(b, 0, 0, g * S, _ * S, f, p, g, _), n.imageSmoothingEnabled = w, n.imageSmoothingQuality = T, n.restore(), !0;
|
|
2956
2957
|
}
|
|
2957
2958
|
//#endregion
|
|
2958
2959
|
//#region packages/core/src/shape/bevel-shading.ts
|
|
2959
|
-
function
|
|
2960
|
+
function yt(e, t) {
|
|
2960
2961
|
if (t <= 0) return () => 1;
|
|
2961
2962
|
let n = (e) => Math.max(0, Math.min(1, e / t));
|
|
2962
2963
|
switch (e) {
|
|
2963
2964
|
case "hardEdge": {
|
|
2964
|
-
let e =
|
|
2965
|
+
let e = Dt;
|
|
2965
2966
|
return (t) => {
|
|
2966
2967
|
let r = Math.min(1, n(t) / e);
|
|
2967
2968
|
return r * r * (3 - 2 * r);
|
|
@@ -2981,7 +2982,7 @@ function dt(e, t) {
|
|
|
2981
2982
|
};
|
|
2982
2983
|
}
|
|
2983
2984
|
}
|
|
2984
|
-
function
|
|
2985
|
+
function bt(e) {
|
|
2985
2986
|
let t = e.length, n = new Float64Array(t);
|
|
2986
2987
|
if (t === 0) return n;
|
|
2987
2988
|
let r = new Int32Array(t), i = new Float64Array(t + 1), a = 0;
|
|
@@ -2999,7 +3000,7 @@ function ft(e) {
|
|
|
2999
3000
|
}
|
|
3000
3001
|
return n;
|
|
3001
3002
|
}
|
|
3002
|
-
function
|
|
3003
|
+
function xt(e, t = 3) {
|
|
3003
3004
|
if (e <= 0) return Array(t).fill(1);
|
|
3004
3005
|
let n = Math.sqrt(12 * e * e / t + 1), r = Math.floor(n);
|
|
3005
3006
|
r % 2 == 0 && r--;
|
|
@@ -3007,7 +3008,7 @@ function pt(e, t = 3) {
|
|
|
3007
3008
|
for (let e = 0; e < t; e++) s.push(e < o ? r : i);
|
|
3008
3009
|
return s;
|
|
3009
3010
|
}
|
|
3010
|
-
function
|
|
3011
|
+
function St(e, t, n, r, i, a) {
|
|
3011
3012
|
let o = 1 / (2 * i + 1);
|
|
3012
3013
|
if (a) for (let a = 0; a < r; a++) {
|
|
3013
3014
|
let r = a * n, s = 0;
|
|
@@ -3028,29 +3029,29 @@ function mt(e, t, n, r, i, a) {
|
|
|
3028
3029
|
}
|
|
3029
3030
|
}
|
|
3030
3031
|
}
|
|
3031
|
-
function
|
|
3032
|
+
function Ct(e, t, n, r) {
|
|
3032
3033
|
let i = Float64Array.from(e);
|
|
3033
3034
|
if (r <= 0 || t <= 0 || n <= 0) return i;
|
|
3034
3035
|
let a = new Float64Array(t * n);
|
|
3035
|
-
for (let e of
|
|
3036
|
+
for (let e of xt(r, 3)) {
|
|
3036
3037
|
let r = Math.max(1, (e - 1) / 2);
|
|
3037
|
-
|
|
3038
|
+
St(i, a, t, n, r, !0), St(a, i, t, n, r, !1);
|
|
3038
3039
|
}
|
|
3039
3040
|
return i;
|
|
3040
3041
|
}
|
|
3041
|
-
function
|
|
3042
|
+
function wt(e, t, n, r = 128) {
|
|
3042
3043
|
let i = new Float64Array(t * n);
|
|
3043
3044
|
for (let a = 0; a < t * n; a++) i[a] = (e[a] ?? 0) >= r ? 0x56bc75e2d63100000 : 0;
|
|
3044
3045
|
let a = new Float64Array(n);
|
|
3045
3046
|
for (let e = 0; e < t; e++) {
|
|
3046
3047
|
for (let r = 0; r < n; r++) a[r] = i[r * t + e];
|
|
3047
|
-
let r =
|
|
3048
|
+
let r = bt(a);
|
|
3048
3049
|
for (let a = 0; a < n; a++) i[a * t + e] = r[a];
|
|
3049
3050
|
}
|
|
3050
3051
|
let o = new Float64Array(t);
|
|
3051
3052
|
for (let e = 0; e < n; e++) {
|
|
3052
3053
|
for (let n = 0; n < t; n++) o[n] = i[e * t + n];
|
|
3053
|
-
let n =
|
|
3054
|
+
let n = bt(o);
|
|
3054
3055
|
for (let r = 0; r < t; r++) i[e * t + r] = n[r];
|
|
3055
3056
|
}
|
|
3056
3057
|
for (let e = 0; e < n; e++) for (let r = 0; r < t; r++) {
|
|
@@ -3062,15 +3063,15 @@ function gt(e, t, n, r = 128) {
|
|
|
3062
3063
|
for (let e = 0; e < t * n; e++) i[e] = Math.sqrt(i[e]);
|
|
3063
3064
|
return i;
|
|
3064
3065
|
}
|
|
3065
|
-
var
|
|
3066
|
-
function
|
|
3066
|
+
var Tt = .25, Et = .35, Dt = .5;
|
|
3067
|
+
function Ot(e, t, n, r, i, a) {
|
|
3067
3068
|
let o = new Float32Array(t * n * 3), s = new Uint8Array(t * n), c = new Float32Array(t * n);
|
|
3068
3069
|
if (t <= 0 || n <= 0) return {
|
|
3069
3070
|
normals: o,
|
|
3070
3071
|
bandMask: s,
|
|
3071
3072
|
bandWeight: c
|
|
3072
3073
|
};
|
|
3073
|
-
let l =
|
|
3074
|
+
let l = wt(e, t, n), u = yt(i, r), d = (n, r) => (e[r * t + n] ?? 0) >= 128, f = (r > 0 ? a / r : 0) * r, p = Ct(l, t, n, Math.max(1, r * Tt)), m = (e) => {
|
|
3074
3075
|
let t = u(Math.max(0, e - .5));
|
|
3075
3076
|
return u(e + .5) - t;
|
|
3076
3077
|
};
|
|
@@ -3085,9 +3086,9 @@ function bt(e, t, n, r, i, a) {
|
|
|
3085
3086
|
o[a * 3 + 2] = 1;
|
|
3086
3087
|
continue;
|
|
3087
3088
|
}
|
|
3088
|
-
let g = u / r, _ = 1 -
|
|
3089
|
+
let g = u / r, _ = 1 - Et, v = 1;
|
|
3089
3090
|
if (g > _) {
|
|
3090
|
-
let e = Math.min(1, (g - _) /
|
|
3091
|
+
let e = Math.min(1, (g - _) / Et);
|
|
3091
3092
|
v = 1 - e * e * (3 - 2 * e);
|
|
3092
3093
|
}
|
|
3093
3094
|
c[a] = v;
|
|
@@ -3102,7 +3103,7 @@ function bt(e, t, n, r, i, a) {
|
|
|
3102
3103
|
bandWeight: c
|
|
3103
3104
|
};
|
|
3104
3105
|
}
|
|
3105
|
-
var
|
|
3106
|
+
var kt = 35 * Math.PI / 180, At = 12 * Math.PI / 180, jt = {
|
|
3106
3107
|
t: {
|
|
3107
3108
|
x: 0,
|
|
3108
3109
|
y: -1
|
|
@@ -3136,22 +3137,22 @@ var xt = 35 * Math.PI / 180, St = 12 * Math.PI / 180, Ct = {
|
|
|
3136
3137
|
y: 1
|
|
3137
3138
|
}
|
|
3138
3139
|
};
|
|
3139
|
-
function
|
|
3140
|
+
function Mt(e, t, n) {
|
|
3140
3141
|
let r = n * Math.PI / 180, i = Math.cos(r), a = Math.sin(r);
|
|
3141
3142
|
return {
|
|
3142
3143
|
x: e * i - t * a,
|
|
3143
3144
|
y: e * a + t * i
|
|
3144
3145
|
};
|
|
3145
3146
|
}
|
|
3146
|
-
function
|
|
3147
|
-
let r =
|
|
3148
|
-
return n && n.rev && (r =
|
|
3147
|
+
function Nt(e, t, n) {
|
|
3148
|
+
let r = jt[t] ?? jt.t;
|
|
3149
|
+
return n && n.rev && (r = Mt(r.x, r.y, n.rev)), Ft(r.x, r.y, kt);
|
|
3149
3150
|
}
|
|
3150
|
-
function
|
|
3151
|
+
function Pt(e) {
|
|
3151
3152
|
let t = Math.hypot(e.x, e.y) || 1;
|
|
3152
|
-
return
|
|
3153
|
+
return Ft(-e.x / t, -e.y / t, At);
|
|
3153
3154
|
}
|
|
3154
|
-
function
|
|
3155
|
+
function Ft(e, t, n) {
|
|
3155
3156
|
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;
|
|
3156
3157
|
return {
|
|
3157
3158
|
x: o / l,
|
|
@@ -3159,7 +3160,7 @@ function Dt(e, t, n) {
|
|
|
3159
3160
|
z: c / l
|
|
3160
3161
|
};
|
|
3161
3162
|
}
|
|
3162
|
-
var
|
|
3163
|
+
var It = 2, Lt = {
|
|
3163
3164
|
matte: {
|
|
3164
3165
|
ambient: .62,
|
|
3165
3166
|
diffuse: .45,
|
|
@@ -3172,8 +3173,8 @@ var Ot = 2, kt = {
|
|
|
3172
3173
|
specular: .35,
|
|
3173
3174
|
shininess: 22
|
|
3174
3175
|
}
|
|
3175
|
-
},
|
|
3176
|
-
function
|
|
3176
|
+
}, Rt = .8;
|
|
3177
|
+
function zt(e) {
|
|
3177
3178
|
switch (e) {
|
|
3178
3179
|
case "plastic":
|
|
3179
3180
|
case "metal":
|
|
@@ -3184,8 +3185,8 @@ function jt(e) {
|
|
|
3184
3185
|
default: return "matte";
|
|
3185
3186
|
}
|
|
3186
3187
|
}
|
|
3187
|
-
function
|
|
3188
|
-
let r =
|
|
3188
|
+
function Bt(e, t, n = !0) {
|
|
3189
|
+
let r = Lt[e], i = {
|
|
3189
3190
|
light: t,
|
|
3190
3191
|
material: e,
|
|
3191
3192
|
ambient: r.ambient,
|
|
@@ -3193,9 +3194,9 @@ function Mt(e, t, n = !0) {
|
|
|
3193
3194
|
specular: r.specular,
|
|
3194
3195
|
shininess: r.shininess
|
|
3195
3196
|
};
|
|
3196
|
-
return n && (i.fillLight =
|
|
3197
|
+
return n && (i.fillLight = Pt(t), i.fillDiffuse = i.diffuse * Rt), i;
|
|
3197
3198
|
}
|
|
3198
|
-
function
|
|
3199
|
+
function Vt(e, t) {
|
|
3199
3200
|
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;
|
|
3200
3201
|
if (t.fillLight && t.fillDiffuse) {
|
|
3201
3202
|
let n = e.x * t.fillLight.x + e.y * t.fillLight.y + e.z * t.fillLight.z;
|
|
@@ -3208,7 +3209,7 @@ function Nt(e, t) {
|
|
|
3208
3209
|
}
|
|
3209
3210
|
return Math.max(0, t.ambient + r + i + a);
|
|
3210
3211
|
}
|
|
3211
|
-
function
|
|
3212
|
+
function Ht(e, t, n) {
|
|
3212
3213
|
if (!e) return {
|
|
3213
3214
|
x: 0,
|
|
3214
3215
|
y: 0,
|
|
@@ -3223,16 +3224,16 @@ function Pt(e, t, n) {
|
|
|
3223
3224
|
h: Math.max(0, o - i)
|
|
3224
3225
|
};
|
|
3225
3226
|
}
|
|
3226
|
-
function
|
|
3227
|
+
function Ut(e, t, n) {
|
|
3227
3228
|
let r = e.canvas.width, i = e.canvas.height;
|
|
3228
3229
|
if (r <= 0 || i <= 0) return;
|
|
3229
3230
|
let a = t.widthPx;
|
|
3230
3231
|
if (a < .75) return;
|
|
3231
|
-
let { x: o, y: s, w: c, h: l } =
|
|
3232
|
+
let { x: o, y: s, w: c, h: l } = Ht(n, r, i);
|
|
3232
3233
|
if (c <= 0 || l <= 0) return;
|
|
3233
3234
|
let u = e.getImageData(o, s, c, l), d = u.data, f = new Uint8ClampedArray(c * l);
|
|
3234
3235
|
for (let e = 0; e < c * l; e++) f[e] = d[e * 4 + 3];
|
|
3235
|
-
let { bandMask: p, bandWeight: m, normals: h } =
|
|
3236
|
+
let { bandMask: p, bandWeight: m, normals: h } = Ot(f, c, l, a, t.prst, t.heightPx), g = Bt(t.material, t.light), _ = Vt({
|
|
3236
3237
|
x: 0,
|
|
3237
3238
|
y: 0,
|
|
3238
3239
|
z: 1
|
|
@@ -3243,13 +3244,13 @@ function Ft(e, t, n) {
|
|
|
3243
3244
|
if (n <= 0) continue;
|
|
3244
3245
|
let r = h[e * 3], i = h[e * 3 + 1], a = h[e * 3 + 2];
|
|
3245
3246
|
t.bottom && (r = -r, i = -i);
|
|
3246
|
-
let o = 1 + (
|
|
3247
|
+
let o = 1 + (Vt({
|
|
3247
3248
|
x: r,
|
|
3248
3249
|
y: i,
|
|
3249
3250
|
z: a
|
|
3250
3251
|
}, g) / _ - 1) * n, s = e * 4;
|
|
3251
3252
|
if (o >= 1) {
|
|
3252
|
-
let e = Math.min(1, (o - 1) *
|
|
3253
|
+
let e = Math.min(1, (o - 1) * It);
|
|
3253
3254
|
for (let t = 0; t < 3; t++) {
|
|
3254
3255
|
let n = Math.min(255, d[s + t] * o);
|
|
3255
3256
|
d[s + t] = n + (255 - n) * e;
|
|
@@ -3258,12 +3259,12 @@ function Ft(e, t, n) {
|
|
|
3258
3259
|
}
|
|
3259
3260
|
e.putImageData(u, o, s);
|
|
3260
3261
|
}
|
|
3261
|
-
function
|
|
3262
|
+
function Wt(e, t, n) {
|
|
3262
3263
|
let r = e.canvas.width, i = e.canvas.height;
|
|
3263
3264
|
if (r <= 0 || i <= 0) return;
|
|
3264
3265
|
let a = t.offsetX, o = t.offsetY, s = Math.hypot(a, o);
|
|
3265
3266
|
if (s < .75) return;
|
|
3266
|
-
let { x: c, y: l, w: u, h: d } =
|
|
3267
|
+
let { x: c, y: l, w: u, h: d } = Ht(n, r, i);
|
|
3267
3268
|
if (u <= 0 || d <= 0) return;
|
|
3268
3269
|
let f = e.getImageData(c, l, u, d), p = f.data, m = new Uint8ClampedArray(u * d);
|
|
3269
3270
|
for (let e = 0; e < u * d; e++) m[e] = p[e * 4 + 3];
|
|
@@ -3287,8 +3288,8 @@ function It(e, t, n) {
|
|
|
3287
3288
|
}
|
|
3288
3289
|
//#endregion
|
|
3289
3290
|
//#region packages/core/src/text/underline.ts
|
|
3290
|
-
function
|
|
3291
|
-
let c = Math.max(1, i * .05), l = o === "heavy" || (o?.endsWith("Heavy") ?? !1) ? c * 1.8 : c, u = n + Math.max(2, l), d =
|
|
3291
|
+
function Gt(e, t, n, r, i, a, o, s = 1) {
|
|
3292
|
+
let c = Math.max(1, i * .05), l = o === "heavy" || (o?.endsWith("Heavy") ?? !1) ? c * 1.8 : c, u = n + Math.max(2, l), d = G(u, l, s);
|
|
3292
3293
|
if (e.strokeStyle = a, e.lineWidth = l, e.setLineDash([]), o && o.startsWith("wavy")) {
|
|
3293
3294
|
let n = l, i = l * 6;
|
|
3294
3295
|
e.beginPath(), e.moveTo(t, u);
|
|
@@ -3309,14 +3310,14 @@ function Lt(e, t, n, r, i, a, o, s = 1) {
|
|
|
3309
3310
|
}
|
|
3310
3311
|
if (o === "dbl") {
|
|
3311
3312
|
let n = l * 1.4, i = u - n / 2, a = u + n / 2;
|
|
3312
|
-
e.beginPath(), e.moveTo(t, i +
|
|
3313
|
+
e.beginPath(), e.moveTo(t, i + G(i, l, s)), e.lineTo(t + r, i + G(i, l, s)), e.moveTo(t, a + G(a, l, s)), e.lineTo(t + r, a + G(a, l, s)), e.stroke();
|
|
3313
3314
|
return;
|
|
3314
3315
|
}
|
|
3315
|
-
e.setLineDash(
|
|
3316
|
+
e.setLineDash(D(o ?? "sng", l)), e.beginPath(), e.moveTo(t, u + d), e.lineTo(t + r, u + d), e.stroke(), e.setLineDash([]);
|
|
3316
3317
|
}
|
|
3317
3318
|
//#endregion
|
|
3318
3319
|
//#region packages/core/src/text/highlight-box.ts
|
|
3319
|
-
function
|
|
3320
|
+
function Kt(e, t) {
|
|
3320
3321
|
return {
|
|
3321
3322
|
top: e - t * .85,
|
|
3322
3323
|
height: t * 1.1
|
|
@@ -3324,7 +3325,7 @@ function Rt(e, t) {
|
|
|
3324
3325
|
}
|
|
3325
3326
|
//#endregion
|
|
3326
3327
|
//#region packages/core/src/text/justify-positions.ts
|
|
3327
|
-
function
|
|
3328
|
+
function qt(e, t, n, r, i = 0) {
|
|
3328
3329
|
let a = [], o = 0, s = 0;
|
|
3329
3330
|
for (let c of t) a.push({
|
|
3330
3331
|
text: e.slice(o, c).join(""),
|
|
@@ -3336,21 +3337,16 @@ function zt(e, t, n, r, i = 0) {
|
|
|
3336
3337
|
}), a;
|
|
3337
3338
|
}
|
|
3338
3339
|
//#endregion
|
|
3339
|
-
//#region packages/pptx/src/types.ts
|
|
3340
|
-
function Bt(e) {
|
|
3341
|
-
return e;
|
|
3342
|
-
}
|
|
3343
|
-
//#endregion
|
|
3344
3340
|
//#region packages/pptx/src/hyperlink.ts
|
|
3345
|
-
function
|
|
3341
|
+
function Jt(e, t) {
|
|
3346
3342
|
let n = e !== void 0 && e !== "" ? e : void 0, r = t !== void 0 && t !== "" ? t : void 0;
|
|
3347
3343
|
if (n === void 0 && r === void 0) return;
|
|
3348
3344
|
if (r !== void 0) return {
|
|
3349
3345
|
kind: "internal",
|
|
3350
3346
|
ref: n ?? r
|
|
3351
3347
|
};
|
|
3352
|
-
let i = n, a =
|
|
3353
|
-
return a !== null &&
|
|
3348
|
+
let i = n, a = V(i);
|
|
3349
|
+
return a !== null && oe.includes(a) ? {
|
|
3354
3350
|
kind: "external",
|
|
3355
3351
|
url: i
|
|
3356
3352
|
} : {
|
|
@@ -3360,7 +3356,7 @@ function Vt(e, t) {
|
|
|
3360
3356
|
}
|
|
3361
3357
|
//#endregion
|
|
3362
3358
|
//#region packages/pptx/src/media-chrome.ts
|
|
3363
|
-
function
|
|
3359
|
+
function Yt(e, t, n, r, i, a) {
|
|
3364
3360
|
let o = Math.max(18, Math.min(32, Math.min(r, i) * .25));
|
|
3365
3361
|
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") {
|
|
3366
3362
|
e.beginPath();
|
|
@@ -3374,67 +3370,67 @@ function Ht(e, t, n, r, i, a) {
|
|
|
3374
3370
|
}
|
|
3375
3371
|
//#endregion
|
|
3376
3372
|
//#region packages/pptx/src/bidi-line.ts
|
|
3377
|
-
var
|
|
3373
|
+
var Xt = (e) => {
|
|
3378
3374
|
let t = e.text;
|
|
3379
3375
|
return typeof t == "string" ? t : void 0;
|
|
3380
|
-
},
|
|
3381
|
-
function
|
|
3376
|
+
}, Zt = (e) => "isTab" in e;
|
|
3377
|
+
function Qt(e) {
|
|
3382
3378
|
for (let t of e) {
|
|
3383
|
-
let e =
|
|
3384
|
-
if (e !== void 0 &&
|
|
3379
|
+
let e = Xt(t);
|
|
3380
|
+
if (e !== void 0 && H(e)) return !0;
|
|
3385
3381
|
}
|
|
3386
3382
|
return !1;
|
|
3387
3383
|
}
|
|
3388
|
-
function
|
|
3389
|
-
let
|
|
3390
|
-
if (
|
|
3384
|
+
function $t(e, n) {
|
|
3385
|
+
let r = e.length;
|
|
3386
|
+
if (r === 0) return {
|
|
3391
3387
|
order: [],
|
|
3392
3388
|
rtl: []
|
|
3393
3389
|
};
|
|
3394
|
-
let
|
|
3395
|
-
for (let t = 0; t <
|
|
3396
|
-
|
|
3397
|
-
let n =
|
|
3398
|
-
if (
|
|
3399
|
-
for (
|
|
3400
|
-
a[
|
|
3390
|
+
let i = "", a = Array(r), o;
|
|
3391
|
+
for (let t = 0; t < r; t++) {
|
|
3392
|
+
a[t] = i.length;
|
|
3393
|
+
let n = Xt(e[t]) ?? "";
|
|
3394
|
+
if (i += n.length > 0 ? n : "", Zt(e[t])) {
|
|
3395
|
+
for (o ??= []; o.length < i.length;) o.push(null);
|
|
3396
|
+
o[a[t]] = "S";
|
|
3401
3397
|
}
|
|
3402
3398
|
}
|
|
3403
|
-
if (
|
|
3404
|
-
let { levels:
|
|
3405
|
-
for (let e = 0; e <
|
|
3399
|
+
if (o) for (; o.length < i.length;) o.push(null);
|
|
3400
|
+
let { levels: s, paragraphLevel: c } = m().computeLevels(i, n ? "rtl" : "ltr", o), { order: l, segLevels: u } = t(s, c, a), d = Array(r);
|
|
3401
|
+
for (let e = 0; e < r; e++) d[e] = (u[e] & 1) == 1;
|
|
3406
3402
|
return {
|
|
3407
|
-
order:
|
|
3408
|
-
rtl:
|
|
3403
|
+
order: l,
|
|
3404
|
+
rtl: d
|
|
3409
3405
|
};
|
|
3410
3406
|
}
|
|
3411
3407
|
//#endregion
|
|
3412
3408
|
//#region packages/pptx/src/cjk-wrap.ts
|
|
3413
|
-
function
|
|
3409
|
+
function en(e, t, n, r) {
|
|
3414
3410
|
if (e.length === 0) return 0;
|
|
3415
|
-
let i = t === 0,
|
|
3411
|
+
let i = t === 0, o = 0, s = t;
|
|
3416
3412
|
for (let t of e) {
|
|
3417
|
-
if (
|
|
3418
|
-
if (
|
|
3419
|
-
|
|
3413
|
+
if (s + t.w > n) {
|
|
3414
|
+
if (o > 0 || !i) break;
|
|
3415
|
+
s += t.w, o++;
|
|
3420
3416
|
break;
|
|
3421
3417
|
}
|
|
3422
|
-
|
|
3418
|
+
s += t.w, o++;
|
|
3423
3419
|
}
|
|
3424
|
-
return
|
|
3420
|
+
return o === 0 ? 0 : o >= e.length ? e.length : a(e.map((e) => e.ch), o, r, +!!i);
|
|
3425
3421
|
}
|
|
3426
3422
|
//#endregion
|
|
3427
3423
|
//#region packages/pptx/src/text-justify.ts
|
|
3428
|
-
var
|
|
3429
|
-
function
|
|
3424
|
+
var tn = (e) => /\s/.test(String.fromCodePoint(e));
|
|
3425
|
+
function nn(e, t, n, r, i) {
|
|
3430
3426
|
if (r === "just" && i) return null;
|
|
3431
3427
|
let a = t - n;
|
|
3432
3428
|
if (a <= .5) return null;
|
|
3433
|
-
let o =
|
|
3429
|
+
let o = Ce(e, a, {
|
|
3434
3430
|
firstContentSi: 0,
|
|
3435
3431
|
lastDrawnSi: e.length,
|
|
3436
3432
|
isGapChar: fe,
|
|
3437
|
-
isWhitespace:
|
|
3433
|
+
isWhitespace: tn,
|
|
3438
3434
|
seaClusterGaps: r === "thaiDist"
|
|
3439
3435
|
});
|
|
3440
3436
|
if (!o) return null;
|
|
@@ -3455,7 +3451,7 @@ function Yt(e, t, n, r, i) {
|
|
|
3455
3451
|
}
|
|
3456
3452
|
//#endregion
|
|
3457
3453
|
//#region packages/pptx/src/table-border-conflict.ts
|
|
3458
|
-
function
|
|
3454
|
+
function rn(e) {
|
|
3459
3455
|
if (!e) return {
|
|
3460
3456
|
r: 0,
|
|
3461
3457
|
g: 0,
|
|
@@ -3472,37 +3468,37 @@ function Xt(e) {
|
|
|
3472
3468
|
b: parseInt(t.slice(4, 6), 16)
|
|
3473
3469
|
};
|
|
3474
3470
|
}
|
|
3475
|
-
function
|
|
3476
|
-
let t =
|
|
3471
|
+
function an(e) {
|
|
3472
|
+
let t = rn(e);
|
|
3477
3473
|
return .299 * t.r + .587 * t.g + .114 * t.b;
|
|
3478
3474
|
}
|
|
3479
|
-
function
|
|
3475
|
+
function on(e, t) {
|
|
3480
3476
|
if (!e && !t) return null;
|
|
3481
3477
|
if (!e) return t;
|
|
3482
3478
|
if (!t) return e;
|
|
3483
3479
|
if (e.width !== t.width) return e.width > t.width ? e : t;
|
|
3484
|
-
let n =
|
|
3480
|
+
let n = an(e.color), r = an(t.color);
|
|
3485
3481
|
return n === r || n < r ? e : t;
|
|
3486
3482
|
}
|
|
3487
3483
|
//#endregion
|
|
3488
3484
|
//#region packages/pptx/src/smartart-fallback-contrast.ts
|
|
3489
|
-
function
|
|
3490
|
-
let t =
|
|
3485
|
+
function sn(e) {
|
|
3486
|
+
let t = A(e.length === 8 ? e.slice(0, 6) : e);
|
|
3491
3487
|
if (!t) return null;
|
|
3492
|
-
let n =
|
|
3488
|
+
let n = pe(t[0], t[1], t[2]);
|
|
3493
3489
|
if (e.length !== 8) return n;
|
|
3494
3490
|
let r = Number.parseInt(e.slice(6, 8), 16);
|
|
3495
3491
|
if (Number.isNaN(r)) return null;
|
|
3496
3492
|
let i = r / 255;
|
|
3497
3493
|
return i * n + (1 - i);
|
|
3498
3494
|
}
|
|
3499
|
-
function
|
|
3495
|
+
function cn(e) {
|
|
3500
3496
|
if (!e) return null;
|
|
3501
|
-
if (e.fillType === "solid") return
|
|
3497
|
+
if (e.fillType === "solid") return sn(e.color);
|
|
3502
3498
|
if (e.fillType === "gradient") {
|
|
3503
3499
|
let t = e.stops.map((e) => ({
|
|
3504
3500
|
p: Math.min(1, Math.max(0, e.position)),
|
|
3505
|
-
l:
|
|
3501
|
+
l: sn(e.color)
|
|
3506
3502
|
})).filter((e) => e.l !== null).sort((e, t) => e.p - t.p);
|
|
3507
3503
|
if (t.length === 0) return null;
|
|
3508
3504
|
let n = t[0], r = t[t.length - 1], i = n.l * n.p + r.l * (1 - r.p);
|
|
@@ -3511,18 +3507,18 @@ function en(e) {
|
|
|
3511
3507
|
}
|
|
3512
3508
|
return null;
|
|
3513
3509
|
}
|
|
3514
|
-
function
|
|
3510
|
+
function ln(e) {
|
|
3515
3511
|
return e.name === "SmartArt" && e.id === void 0;
|
|
3516
3512
|
}
|
|
3517
|
-
function
|
|
3518
|
-
let n =
|
|
3513
|
+
function un(e, t) {
|
|
3514
|
+
let n = cn(e);
|
|
3519
3515
|
if (n === null || n >= .5) return null;
|
|
3520
|
-
let r =
|
|
3516
|
+
let r = sn(t.replace(/^#/, ""));
|
|
3521
3517
|
return r !== null && r >= .5 ? null : "#FFFFFF";
|
|
3522
3518
|
}
|
|
3523
3519
|
//#endregion
|
|
3524
3520
|
//#region packages/pptx/src/tab-layout.ts
|
|
3525
|
-
function
|
|
3521
|
+
function dn(e, t, n, r, i, a = 0) {
|
|
3526
3522
|
let o = e.map((e) => e.width), s = (t) => {
|
|
3527
3523
|
let n = 0;
|
|
3528
3524
|
for (let r = t; r < e.length && !e[r].isTab; r++) n += o[r];
|
|
@@ -3550,8 +3546,8 @@ function rn(e, t, n, r, i, a = 0) {
|
|
|
3550
3546
|
}
|
|
3551
3547
|
//#endregion
|
|
3552
3548
|
//#region packages/pptx/src/vertical-text.ts
|
|
3553
|
-
var
|
|
3554
|
-
function
|
|
3549
|
+
var fn = () => !1;
|
|
3550
|
+
function pn(e, t, n) {
|
|
3555
3551
|
let r = e.textBaseline;
|
|
3556
3552
|
e.textBaseline = "alphabetic";
|
|
3557
3553
|
let i = e.measureText(t);
|
|
@@ -3559,7 +3555,7 @@ function on(e, t, n) {
|
|
|
3559
3555
|
let a = i.fontBoundingBoxAscent, o = i.fontBoundingBoxDescent;
|
|
3560
3556
|
return typeof a == "number" && typeof o == "number" && (a !== 0 || o !== 0) ? (a - o) / 2 : .38 * n;
|
|
3561
3557
|
}
|
|
3562
|
-
function
|
|
3558
|
+
function mn(e, t) {
|
|
3563
3559
|
let n = e.textAlign, r = e.textBaseline;
|
|
3564
3560
|
e.textAlign = "center", e.textBaseline = "middle";
|
|
3565
3561
|
let i = e.measureText(t);
|
|
@@ -3567,15 +3563,15 @@ function sn(e, t) {
|
|
|
3567
3563
|
let a = i.actualBoundingBoxAscent, o = i.actualBoundingBoxDescent;
|
|
3568
3564
|
return typeof a == "number" && typeof o == "number" ? (a - o) / 2 : 0;
|
|
3569
3565
|
}
|
|
3570
|
-
function
|
|
3571
|
-
let c = e.textAlign, l = e.textBaseline, u = o === "stroke" ? e.strokeText.bind(e) : e.fillText.bind(e), d = r -
|
|
3566
|
+
function hn(e, t, n, r, i, a, o = "fill", s = fn) {
|
|
3567
|
+
let c = e.textAlign, l = e.textBaseline, u = o === "stroke" ? e.strokeText.bind(e) : e.fillText.bind(e), d = r - pn(e, t, i), f = 0;
|
|
3572
3568
|
for (let o of t) {
|
|
3573
|
-
let t = o.codePointAt(0) ?? 0, l =
|
|
3574
|
-
if (
|
|
3569
|
+
let t = o.codePointAt(0) ?? 0, l = I(t), p = e.measureText(o).width + a, m = l === "Tr" ? le(t) : null, h = l === "Tr" && m === null && ee(t), g = l === "U" || l === "Tu" || m !== null || h;
|
|
3570
|
+
if (re(t) && s(t)) {
|
|
3575
3571
|
let t = n + f + p / 2;
|
|
3576
|
-
e.save(), e.translate(t, d), e.rotate(-Math.PI / 2), e.textAlign = "center", e.textBaseline = "middle",
|
|
3572
|
+
e.save(), e.translate(t, d), e.rotate(-Math.PI / 2), e.textAlign = "center", e.textBaseline = "middle", j(e, () => u(o, 0, 0)), e.restore();
|
|
3577
3573
|
} else if (g) {
|
|
3578
|
-
let r = m === null && l === "Tu" ?
|
|
3574
|
+
let r = m === null && l === "Tu" ? P(t) : null, a = m === null ? r : m, s = a === null ? o : String.fromCodePoint(a), c = n + f + p / 2, h = r === null ? mn(e, s) / i : 0;
|
|
3579
3575
|
e.save(), e.translate(c, d), e.rotate(-Math.PI / 2), e.textAlign = "center", e.textBaseline = "middle", u(s, 0, h * i), e.restore();
|
|
3580
3576
|
} else if (l === "Tr") {
|
|
3581
3577
|
let t = n + f + p / 2;
|
|
@@ -3585,45 +3581,27 @@ function cn(e, t, n, r, i, a, o = "fill", s = an) {
|
|
|
3585
3581
|
}
|
|
3586
3582
|
e.textAlign = c, e.textBaseline = l;
|
|
3587
3583
|
}
|
|
3588
|
-
function
|
|
3589
|
-
|
|
3584
|
+
function gn(e, t, n, r, i, a, o = "fill") {
|
|
3585
|
+
hn(e, t, n, r, i, a, o, (t) => se(e, t));
|
|
3590
3586
|
}
|
|
3591
3587
|
//#endregion
|
|
3592
3588
|
//#region packages/pptx/src/renderer.ts
|
|
3593
|
-
|
|
3594
|
-
applyDimOverlay: () => Cr,
|
|
3595
|
-
applyFrameTransform: () => xr,
|
|
3596
|
-
buildBevelInputs: () => ur,
|
|
3597
|
-
cssFontStack: () => On,
|
|
3598
|
-
getPosterBitmap: () => gr,
|
|
3599
|
-
layoutParagraph: () => Fn,
|
|
3600
|
-
naturalWidthExceedsBbox: () => Mn,
|
|
3601
|
-
paintHighlight: () => dn,
|
|
3602
|
-
paragraphHasRenderableContent: () => sr,
|
|
3603
|
-
prepareSlideMath: () => bn,
|
|
3604
|
-
renderSlide: () => Er,
|
|
3605
|
-
renderTable: () => Sr,
|
|
3606
|
-
renderTextBody: () => lr,
|
|
3607
|
-
resolveBulletLabel: () => cr,
|
|
3608
|
-
splitScene3dShapeTransform: () => nr,
|
|
3609
|
-
tileAnchorOffset: () => Rn
|
|
3610
|
-
});
|
|
3611
|
-
function Z(e, t) {
|
|
3589
|
+
function J(e, t) {
|
|
3612
3590
|
return e * t;
|
|
3613
3591
|
}
|
|
3614
|
-
var
|
|
3615
|
-
function
|
|
3616
|
-
let { top: s, height: c } =
|
|
3592
|
+
var Y = u;
|
|
3593
|
+
function _n(e, t, n, r, i, a, o) {
|
|
3594
|
+
let { top: s, height: c } = Kt(n, i);
|
|
3617
3595
|
e.fillStyle = a, e.fillRect(t, s, r, c), e.fillStyle = o;
|
|
3618
3596
|
}
|
|
3619
|
-
function
|
|
3620
|
-
return !e || e.fillType === "none" ? null : e.fillType === "solid" ?
|
|
3597
|
+
function vn(e) {
|
|
3598
|
+
return !e || e.fillType === "none" ? null : e.fillType === "solid" ? Y(e.color) : e.fillType === "gradient" ? e.stops.length > 0 ? Y(e.stops[0].color) : null : e.fillType === "pattern" ? Y(e.fg) : null;
|
|
3621
3599
|
}
|
|
3622
|
-
function
|
|
3623
|
-
return
|
|
3600
|
+
function yn(e, t, n, r, i, a) {
|
|
3601
|
+
return E(e, t, n, r, i, a);
|
|
3624
3602
|
}
|
|
3625
|
-
var
|
|
3626
|
-
function
|
|
3603
|
+
var bn = /* @__PURE__ */ new WeakMap();
|
|
3604
|
+
function xn(e, t) {
|
|
3627
3605
|
let n = e.tinted.get(t);
|
|
3628
3606
|
if (n) return n;
|
|
3629
3607
|
let r = e.img.naturalWidth || 1, i = e.img.naturalHeight || 1, a = document.createElement("canvas");
|
|
@@ -3631,18 +3609,18 @@ function hn(e, t) {
|
|
|
3631
3609
|
let o = a.getContext("2d");
|
|
3632
3610
|
return o ? (o.drawImage(e.img, 0, 0, r, i), o.globalCompositeOperation = "source-in", o.fillStyle = t, o.fillRect(0, 0, r, i), e.tinted.set(t, a), a) : e.img;
|
|
3633
3611
|
}
|
|
3634
|
-
function
|
|
3612
|
+
function Sn(e) {
|
|
3635
3613
|
let t = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`, n = new Image();
|
|
3636
3614
|
return new Promise((e, r) => {
|
|
3637
3615
|
n.onload = () => e(n), n.onerror = r, n.src = t;
|
|
3638
3616
|
});
|
|
3639
3617
|
}
|
|
3640
|
-
var
|
|
3641
|
-
function
|
|
3642
|
-
let r = Math.max(1, Math.round(t *
|
|
3618
|
+
var Cn = 256;
|
|
3619
|
+
function wn(e, t, n) {
|
|
3620
|
+
let r = Math.max(1, Math.round(t * Cn)), i = Math.max(1, Math.round(n * Cn));
|
|
3643
3621
|
return e.replace(/<svg([^>]*?)>/, (e, t) => `<svg${t.replace(/\s(?:width|height)="[^"]*"/g, "")} width="${r}" height="${i}">`);
|
|
3644
3622
|
}
|
|
3645
|
-
function
|
|
3623
|
+
function Tn(e) {
|
|
3646
3624
|
let t = [], n = (e) => {
|
|
3647
3625
|
if (e) for (let n of e.paragraphs) for (let e of n.runs) e.type === "math" && t.push({
|
|
3648
3626
|
nodes: e.nodes,
|
|
@@ -3653,13 +3631,13 @@ function yn(e) {
|
|
|
3653
3631
|
else if (t.type === "table") for (let e of t.rows) for (let t of e.cells) n(t.textBody);
|
|
3654
3632
|
return t;
|
|
3655
3633
|
}
|
|
3656
|
-
async function
|
|
3657
|
-
let n =
|
|
3634
|
+
async function En(e, t) {
|
|
3635
|
+
let n = Tn(e);
|
|
3658
3636
|
if (n.length !== 0) {
|
|
3659
3637
|
await t.loadMathJax();
|
|
3660
|
-
for (let e of n) if (!
|
|
3661
|
-
let n = await t.mathMLToSvg(
|
|
3662
|
-
|
|
3638
|
+
for (let e of n) if (!bn.has(e.nodes)) try {
|
|
3639
|
+
let n = await t.mathMLToSvg(k(e.nodes, e.display)), r = await Sn(wn(Te(n.svg, "#000000"), n.widthEm, n.ascentEm + n.descentEm));
|
|
3640
|
+
bn.set(e.nodes, {
|
|
3663
3641
|
img: r,
|
|
3664
3642
|
widthEm: n.widthEm,
|
|
3665
3643
|
ascentEm: n.ascentEm,
|
|
@@ -3669,10 +3647,10 @@ async function bn(e, t) {
|
|
|
3669
3647
|
} catch {}
|
|
3670
3648
|
}
|
|
3671
3649
|
}
|
|
3672
|
-
function
|
|
3650
|
+
function Dn(e, t) {
|
|
3673
3651
|
return e ? e.startsWith("+") ? e === "+mj-lt" || e === "+mj-ea" || e === "+mj-cs" ? t.themeMajorFont ?? "sans-serif" : t.themeMinorFont ?? "sans-serif" : e.split(",")[0].trim() || (t.themeMinorFont ?? "sans-serif") : t.themeMinorFont ?? "sans-serif";
|
|
3674
3652
|
}
|
|
3675
|
-
var
|
|
3653
|
+
var On = new Set([
|
|
3676
3654
|
"serif",
|
|
3677
3655
|
"sans-serif",
|
|
3678
3656
|
"monospace",
|
|
@@ -3680,11 +3658,11 @@ var Sn = new Set([
|
|
|
3680
3658
|
"fantasy",
|
|
3681
3659
|
"system-ui"
|
|
3682
3660
|
]);
|
|
3683
|
-
function
|
|
3684
|
-
let t =
|
|
3661
|
+
function kn(e) {
|
|
3662
|
+
let t = F(e);
|
|
3685
3663
|
return t === "mono" ? "monospace" : t === "serif" ? "serif" : "sans-serif";
|
|
3686
3664
|
}
|
|
3687
|
-
var
|
|
3665
|
+
var An = {
|
|
3688
3666
|
calibri: "Carlito",
|
|
3689
3667
|
"calibri light": "Carlito",
|
|
3690
3668
|
cambria: "Caladea",
|
|
@@ -3694,91 +3672,91 @@ var wn = {
|
|
|
3694
3672
|
"simplified arabic": "Noto Naskh Arabic",
|
|
3695
3673
|
"arabic typesetting": "Noto Naskh Arabic",
|
|
3696
3674
|
"univers next arabic": "Noto Sans Arabic"
|
|
3697
|
-
},
|
|
3698
|
-
function
|
|
3699
|
-
if (
|
|
3675
|
+
}, jn = "\"Noto Naskh Arabic\", \"Noto Sans Arabic\"";
|
|
3676
|
+
function Mn(e) {
|
|
3677
|
+
if (An[e.toLowerCase()]?.includes("Arabic")) return !0;
|
|
3700
3678
|
let t = e.toLowerCase();
|
|
3701
3679
|
return /arabic|naskh|kufi|nastaliq|amiri|scheherazade|lateef|aldhabi|urdu|farsi|العرب|[-ۿ]/.test(t);
|
|
3702
3680
|
}
|
|
3703
|
-
function
|
|
3681
|
+
function Nn(e) {
|
|
3704
3682
|
return e.map((e) => `"${e}"`).join(", ");
|
|
3705
3683
|
}
|
|
3706
|
-
function
|
|
3707
|
-
let t =
|
|
3708
|
-
if (
|
|
3709
|
-
let
|
|
3710
|
-
return `"${e}", ${r}${
|
|
3684
|
+
function Pn(e) {
|
|
3685
|
+
let t = kn(e), n = An[e.toLowerCase()], r = n ? `"${n}", ` : "";
|
|
3686
|
+
if (Mn(e)) return `"${e}", ${r}${jn}, ${t}`;
|
|
3687
|
+
let i = t === "serif" ? "serif" : "sans", a = ue(e);
|
|
3688
|
+
return `"${e}", ${r}${a ? `${Nn(W(a, i))}, ` : ""}${`${Nn(i === "serif" ? ce : ne)}, `}${t}`;
|
|
3711
3689
|
}
|
|
3712
|
-
function
|
|
3690
|
+
function Fn(e) {
|
|
3713
3691
|
return e ? e.kind === "external" ? `e:${e.url}` : `i:${e.ref}` : "";
|
|
3714
3692
|
}
|
|
3715
|
-
function
|
|
3716
|
-
let a = t ? "italic " : "", o = e ? "bold " : "", s =
|
|
3717
|
-
return
|
|
3693
|
+
function X(e, t, n, r, i) {
|
|
3694
|
+
let a = t ? "italic " : "", o = e ? "bold " : "", s = Dn(r, i);
|
|
3695
|
+
return On.has(s) ? `${a}${o}${n}px ${s}` : `${a}${o}${n}px ${Pn(s)}`;
|
|
3718
3696
|
}
|
|
3719
|
-
function
|
|
3720
|
-
return e.bullet.type === "char" || e.bullet.type === "autoNum" ||
|
|
3697
|
+
function In(e) {
|
|
3698
|
+
return e.bullet.type === "char" || e.bullet.type === "autoNum" || Ee(e.bullet).type === "blip";
|
|
3721
3699
|
}
|
|
3722
|
-
function
|
|
3700
|
+
function Ln(e, t) {
|
|
3723
3701
|
return e ? 0 : Math.max(0, t);
|
|
3724
3702
|
}
|
|
3725
|
-
function
|
|
3726
|
-
let s = (t.defaultFontSize ?? 18) *
|
|
3703
|
+
function Rn(e, t, n, r, i, a, o) {
|
|
3704
|
+
let s = (t.defaultFontSize ?? 18) * K * a;
|
|
3727
3705
|
for (let c of t.paragraphs) {
|
|
3728
|
-
let l =
|
|
3706
|
+
let l = J(c.marL, a), u = J(c.marR, a), d = J(c.indent, a), f = Ln(In(c), d), p = n - r - i - l - u - f, m = 0;
|
|
3729
3707
|
for (let n of c.runs) {
|
|
3730
3708
|
if (n.type !== "text") continue;
|
|
3731
|
-
let r = n.fontSize == null ? c.defFontSize == null ? s : c.defFontSize *
|
|
3732
|
-
if (e.font =
|
|
3709
|
+
let r = n.fontSize == null ? c.defFontSize == null ? s : c.defFontSize * K * a : n.fontSize * K * a, i = Dn(n.fontFamily ?? c.defFontFamily ?? null, o);
|
|
3710
|
+
if (e.font = X(n.bold ?? c.defBold ?? t.defaultBold ?? !1, n.italic ?? c.defItalic ?? t.defaultItalic ?? !1, r, i, o), m += e.measureText(n.text).width, m > p) return !0;
|
|
3733
3711
|
}
|
|
3734
3712
|
}
|
|
3735
3713
|
return !1;
|
|
3736
3714
|
}
|
|
3737
|
-
function
|
|
3715
|
+
function zn(e) {
|
|
3738
3716
|
for (let t of e) if (fe(t.codePointAt(0) ?? 0)) return !0;
|
|
3739
3717
|
return !1;
|
|
3740
3718
|
}
|
|
3741
|
-
function
|
|
3719
|
+
function Z(e) {
|
|
3742
3720
|
let t = 0;
|
|
3743
3721
|
for (let n of e) t++;
|
|
3744
3722
|
return t;
|
|
3745
3723
|
}
|
|
3746
|
-
function
|
|
3724
|
+
function Bn(e, t, n, r, a, o, s, c = !1, l = !1, u = 1, d, f = {
|
|
3747
3725
|
themeMajorFont: null,
|
|
3748
3726
|
themeMinorFont: null,
|
|
3749
3727
|
dpr: 1
|
|
3750
|
-
},
|
|
3751
|
-
let
|
|
3752
|
-
pos:
|
|
3728
|
+
}, p = 0) {
|
|
3729
|
+
let m = [], h = () => n - (m.length === 0 ? p : 0), g = { segments: [] }, v = 0, y = !1, x = t.rtl === !0, S = J(t.marR, o), C = (t.tabStops ?? []).map((e) => ({
|
|
3730
|
+
pos: J(e.pos, o),
|
|
3753
3731
|
algn: e.algn
|
|
3754
|
-
})),
|
|
3755
|
-
let t =
|
|
3732
|
+
})), w = J(t.defTabSz ?? 914400, o), T = !1, E = [], D = 0, k = () => x ? S : s + (m.length === 0 ? p : 0), A = (e = 0) => {
|
|
3733
|
+
let t = dn(e > 0 ? [...E, {
|
|
3756
3734
|
isTab: !1,
|
|
3757
3735
|
width: e
|
|
3758
|
-
}] :
|
|
3736
|
+
}] : E, C, k(), Infinity, D, w), n = 0;
|
|
3759
3737
|
for (let e of t) n += e;
|
|
3760
3738
|
return n;
|
|
3761
|
-
},
|
|
3762
|
-
let t =
|
|
3763
|
-
return Number.isFinite(t) ?
|
|
3764
|
-
},
|
|
3765
|
-
let e =
|
|
3766
|
-
if (!
|
|
3739
|
+
}, j = (e) => {
|
|
3740
|
+
let t = h();
|
|
3741
|
+
return Number.isFinite(t) ? T ? A(e) <= t : v + e <= t : !0;
|
|
3742
|
+
}, M = () => {
|
|
3743
|
+
let e = h();
|
|
3744
|
+
if (!T) return e - v;
|
|
3767
3745
|
if (!Number.isFinite(e)) return Infinity;
|
|
3768
|
-
if (
|
|
3746
|
+
if (A(0) >= e) return 0;
|
|
3769
3747
|
let t = 0, n = e;
|
|
3770
3748
|
for (let r = 0; r < 40; r++) {
|
|
3771
3749
|
let r = (t + n) / 2;
|
|
3772
|
-
|
|
3750
|
+
A(r) <= e ? t = r : n = r;
|
|
3773
3751
|
}
|
|
3774
3752
|
return t;
|
|
3775
|
-
},
|
|
3776
|
-
e && (g.endsWithBreak = !0),
|
|
3777
|
-
},
|
|
3753
|
+
}, N = (e = !1) => {
|
|
3754
|
+
e && (g.endsWithBreak = !0), m.push(g), g = { segments: [] }, v = 0, T = !1, E = [], y = !1;
|
|
3755
|
+
}, P = (t, n, r, i, a, o, s, c) => {
|
|
3778
3756
|
if (!t) return;
|
|
3779
3757
|
e.font = n;
|
|
3780
|
-
let l = c?.letterSpacingPx ?? 0, u = e.measureText(t).width + l *
|
|
3781
|
-
v += u,
|
|
3758
|
+
let l = c?.letterSpacingPx ?? 0, u = e.measureText(t).width + l * Z(t), d = c?.strikeDouble, f = c?.underlineStyle, p = c?.underlineColor, m = c?.shadow, h = c?.outline, _ = c?.highlight, y = c?.fontFamily, b = c?.hyperlink, x = (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.outline === h && (e.highlight ?? "") === (_ ?? "") && (e.fontFamily ?? "") === (y ?? "") && Fn(e.hyperlink) === Fn(b);
|
|
3759
|
+
v += u, E.push({
|
|
3782
3760
|
isTab: !1,
|
|
3783
3761
|
width: u
|
|
3784
3762
|
});
|
|
@@ -3801,14 +3779,14 @@ function Fn(e, t, n, r, i, a, o, s = !1, c = !1, l = 1, u, d = {
|
|
|
3801
3779
|
highlight: _,
|
|
3802
3780
|
hyperlink: b
|
|
3803
3781
|
});
|
|
3804
|
-
},
|
|
3782
|
+
}, F = () => {
|
|
3805
3783
|
let e = g.segments.at(-1);
|
|
3806
3784
|
if (!e || e.math) return !1;
|
|
3807
3785
|
let t = /^(.*\s)(\S+)$/s.exec(e.text), n;
|
|
3808
3786
|
if (t) e.text = t[1], n = t[2];
|
|
3809
3787
|
else if (g.segments.length > 1) g.segments.pop(), n = e.text;
|
|
3810
3788
|
else return !1;
|
|
3811
|
-
return
|
|
3789
|
+
return N(), P(n, e.font, e.sizePx, e.color, e.underline, e.strikethrough, e.baseline, {
|
|
3812
3790
|
strikeDouble: e.strikeDouble,
|
|
3813
3791
|
letterSpacingPx: e.letterSpacingPx,
|
|
3814
3792
|
underlineStyle: e.underlineStyle,
|
|
@@ -3821,88 +3799,88 @@ function Fn(e, t, n, r, i, a, o, s = !1, c = !1, l = 1, u, d = {
|
|
|
3821
3799
|
};
|
|
3822
3800
|
for (let n of t.runs) {
|
|
3823
3801
|
if (n.type === "break") {
|
|
3824
|
-
|
|
3802
|
+
N(!0);
|
|
3825
3803
|
continue;
|
|
3826
3804
|
}
|
|
3827
3805
|
if (n.type === "math") {
|
|
3828
|
-
let e =
|
|
3829
|
-
(n.display && v > 0 || !
|
|
3806
|
+
let e = bn.get(n.nodes), t = n.fontSize == null ? r : n.fontSize * K * o * u, i = e ? e.widthEm * t : 0, s = e ? e.ascentEm * t : 0, c = e ? e.descentEm * t : 0;
|
|
3807
|
+
(n.display && v > 0 || !j(i) && v > 0) && N(), E.push({
|
|
3830
3808
|
isTab: !1,
|
|
3831
|
-
width:
|
|
3809
|
+
width: i
|
|
3832
3810
|
}), g.segments.push({
|
|
3833
3811
|
text: "",
|
|
3834
3812
|
font: `${t}px sans-serif`,
|
|
3835
3813
|
sizePx: t,
|
|
3836
|
-
color: n.color ?
|
|
3814
|
+
color: n.color ? Y(n.color) : a,
|
|
3837
3815
|
underline: !1,
|
|
3838
3816
|
strikethrough: !1,
|
|
3839
3817
|
math: {
|
|
3840
3818
|
nodes: n.nodes,
|
|
3841
3819
|
display: n.display,
|
|
3842
|
-
width:
|
|
3820
|
+
width: i,
|
|
3843
3821
|
ascent: s,
|
|
3844
3822
|
descent: c
|
|
3845
3823
|
}
|
|
3846
|
-
}), v +=
|
|
3824
|
+
}), v += i, n.display && N();
|
|
3847
3825
|
continue;
|
|
3848
3826
|
}
|
|
3849
|
-
let
|
|
3850
|
-
|
|
3851
|
-
let
|
|
3852
|
-
e.font =
|
|
3853
|
-
let
|
|
3854
|
-
(
|
|
3855
|
-
let
|
|
3856
|
-
strikeDouble:
|
|
3857
|
-
letterSpacingPx:
|
|
3827
|
+
let s = n.fontSize == null ? r : n.fontSize * K * o * u, p = Dn(n.fontFamily ?? t.defFontFamily ?? null, f), m = n.fontFamilyEa ? Dn(n.fontFamilyEa, f) : null, x = n.fontFamilySym ? Dn(n.fontFamilySym, f) : null, S;
|
|
3828
|
+
S = n.color ? Y(n.color) : n.hyperlink && f.themeHlinkColor ? Y(f.themeHlinkColor) : a;
|
|
3829
|
+
let C = n.bold ?? t.defBold ?? c, w = n.italic ?? t.defItalic ?? l, k = X(C, w, s, p, f), A = m ? X(C, w, s, m, f) : k;
|
|
3830
|
+
e.font = k;
|
|
3831
|
+
let I = n.caps, R = n.text;
|
|
3832
|
+
(I === "all" || I === "small") && (R = R.toUpperCase());
|
|
3833
|
+
let B = n.fieldType === "slidenum" && d !== void 0 ? String(d) : R, V = n.underline || n.hyperlink !== void 0, H = n.strikeDouble === !0, U = n.letterSpacing == null ? 0 : n.letterSpacing * K * o, W = {
|
|
3834
|
+
strikeDouble: H,
|
|
3835
|
+
letterSpacingPx: U,
|
|
3858
3836
|
underlineStyle: n.underlineStyle,
|
|
3859
|
-
underlineColor: n.underlineColor ?
|
|
3837
|
+
underlineColor: n.underlineColor ? Y(n.underlineColor) : void 0,
|
|
3860
3838
|
shadow: n.shadow,
|
|
3861
3839
|
outline: n.outline,
|
|
3862
|
-
fontFamily:
|
|
3863
|
-
highlight: n.highlight ?
|
|
3864
|
-
hyperlink:
|
|
3865
|
-
},
|
|
3866
|
-
for (let r of
|
|
3840
|
+
fontFamily: p,
|
|
3841
|
+
highlight: n.highlight ? Y(n.highlight) : void 0,
|
|
3842
|
+
hyperlink: Jt(n.hyperlink)
|
|
3843
|
+
}, ee = B.split(/(\s+)/);
|
|
3844
|
+
for (let r of ee) {
|
|
3867
3845
|
if (!r) continue;
|
|
3868
3846
|
if (/^\t+$/.test(r)) {
|
|
3869
|
-
|
|
3847
|
+
T || (e.font = k, D = e.measureText(" ").width);
|
|
3870
3848
|
for (let e of r) g.segments.push({
|
|
3871
3849
|
text: "",
|
|
3872
3850
|
isTab: !0,
|
|
3873
|
-
font:
|
|
3874
|
-
fontFamily:
|
|
3875
|
-
sizePx:
|
|
3876
|
-
color:
|
|
3851
|
+
font: k,
|
|
3852
|
+
fontFamily: p,
|
|
3853
|
+
sizePx: s,
|
|
3854
|
+
color: S,
|
|
3877
3855
|
underline: !1,
|
|
3878
3856
|
strikethrough: !1
|
|
3879
|
-
}),
|
|
3857
|
+
}), E.push({
|
|
3880
3858
|
isTab: !0,
|
|
3881
3859
|
width: 0
|
|
3882
3860
|
});
|
|
3883
|
-
|
|
3861
|
+
T = !0;
|
|
3884
3862
|
continue;
|
|
3885
3863
|
}
|
|
3886
|
-
e.font =
|
|
3887
|
-
let
|
|
3888
|
-
if (
|
|
3889
|
-
let t =
|
|
3864
|
+
e.font = k;
|
|
3865
|
+
let a = e.measureText(r).width, o = /^\s+$/.test(r), c = /[-]/;
|
|
3866
|
+
if (c.test(r) && (x != null || ge(p))) {
|
|
3867
|
+
let t = x ?? p;
|
|
3890
3868
|
for (let i of r) {
|
|
3891
|
-
let r = i, a =
|
|
3892
|
-
if (
|
|
3893
|
-
let e =
|
|
3894
|
-
e === i ? a =
|
|
3869
|
+
let r = i, a = k;
|
|
3870
|
+
if (c.test(i)) {
|
|
3871
|
+
let e = ve(i, t);
|
|
3872
|
+
e === i ? a = X(C, w, s, t, f) : (r = e, a = X(C, w, s, "sans-serif", f));
|
|
3895
3873
|
}
|
|
3896
3874
|
e.font = a;
|
|
3897
|
-
let
|
|
3898
|
-
!
|
|
3875
|
+
let o = e.measureText(r).width;
|
|
3876
|
+
!j(o) && v > 0 && N(), P(r, a, s, S, V, n.strikethrough, n.baseline ?? void 0, W);
|
|
3899
3877
|
}
|
|
3900
3878
|
continue;
|
|
3901
3879
|
}
|
|
3902
|
-
if (
|
|
3880
|
+
if (zn(r) && (!z(r) || t.eaLnBrk === !1)) {
|
|
3903
3881
|
let i = [];
|
|
3904
3882
|
for (let t of r) {
|
|
3905
|
-
let n = fe(t.codePointAt(0) ?? 0) &&
|
|
3883
|
+
let n = fe(t.codePointAt(0) ?? 0) && m != null, r = n ? A : k, a = n ? m : p;
|
|
3906
3884
|
e.font = r, i.push({
|
|
3907
3885
|
ch: t,
|
|
3908
3886
|
w: e.measureText(t).width,
|
|
@@ -3912,41 +3890,41 @@ function Fn(e, t, n, r, i, a, o, s = !1, c = !1, l = 1, u, d = {
|
|
|
3912
3890
|
}
|
|
3913
3891
|
if (t.eaLnBrk === !1) {
|
|
3914
3892
|
let e = i.reduce((e, t) => e + t.w, 0);
|
|
3915
|
-
v > 0 && !
|
|
3916
|
-
for (let e of i)
|
|
3917
|
-
...
|
|
3893
|
+
v > 0 && !j(e) && N();
|
|
3894
|
+
for (let e of i) P(e.ch, e.font, s, S, V, n.strikethrough, n.baseline ?? void 0, {
|
|
3895
|
+
...W,
|
|
3918
3896
|
fontFamily: e.family
|
|
3919
3897
|
});
|
|
3920
3898
|
continue;
|
|
3921
3899
|
}
|
|
3922
3900
|
let a = i;
|
|
3923
3901
|
for (; a.length > 0;) {
|
|
3924
|
-
let e = Number.isFinite(
|
|
3902
|
+
let e = Number.isFinite(h()) ? h() - M() : v, t = en(a, e, h(), _);
|
|
3925
3903
|
if (t === 0) {
|
|
3926
3904
|
if (v > 0) {
|
|
3927
|
-
|
|
3905
|
+
N();
|
|
3928
3906
|
continue;
|
|
3929
3907
|
}
|
|
3930
3908
|
t = 1;
|
|
3931
3909
|
}
|
|
3932
3910
|
for (let e = 0; e < t; e++) {
|
|
3933
3911
|
let t = a[e];
|
|
3934
|
-
|
|
3935
|
-
...
|
|
3912
|
+
P(t.ch, t.font, s, S, V, n.strikethrough, n.baseline ?? void 0, {
|
|
3913
|
+
...W,
|
|
3936
3914
|
fontFamily: t.family
|
|
3937
3915
|
});
|
|
3938
3916
|
}
|
|
3939
|
-
a = a.slice(t), a.length > 0 &&
|
|
3917
|
+
a = a.slice(t), a.length > 0 && N();
|
|
3940
3918
|
}
|
|
3941
3919
|
continue;
|
|
3942
3920
|
}
|
|
3943
|
-
if (
|
|
3944
|
-
let t =
|
|
3921
|
+
if (z(r)) {
|
|
3922
|
+
let t = b(r, {
|
|
3945
3923
|
cjk: !0,
|
|
3946
|
-
kinsoku:
|
|
3947
|
-
}), i =
|
|
3948
|
-
let n =
|
|
3949
|
-
r !== "" && (e.font = i ?
|
|
3924
|
+
kinsoku: _
|
|
3925
|
+
}), i = m != null && A !== k, a = (e) => i && fe(e.codePointAt(0) ?? 0), o = (t) => {
|
|
3926
|
+
let n = U * Z(t), r = "", i = null, o = () => {
|
|
3927
|
+
r !== "" && (e.font = i ? A : k, n += e.measureText(r).width, r = "");
|
|
3950
3928
|
};
|
|
3951
3929
|
for (let e of t) {
|
|
3952
3930
|
let t = a(e);
|
|
@@ -3956,9 +3934,9 @@ function Fn(e, t, n, r, i, a, o, s = !1, c = !1, l = 1, u, d = {
|
|
|
3956
3934
|
}, c = (e) => {
|
|
3957
3935
|
let t = "", r = null, i = () => {
|
|
3958
3936
|
if (t === "") return;
|
|
3959
|
-
let e = r ?
|
|
3960
|
-
|
|
3961
|
-
...
|
|
3937
|
+
let e = r ? A : k, i = r ? m : p;
|
|
3938
|
+
P(t, e, s, S, V, n.strikethrough, n.baseline ?? void 0, {
|
|
3939
|
+
...W,
|
|
3962
3940
|
fontFamily: i
|
|
3963
3941
|
}), t = "";
|
|
3964
3942
|
};
|
|
@@ -3967,63 +3945,63 @@ function Fn(e, t, n, r, i, a, o, s = !1, c = !1, l = 1, u, d = {
|
|
|
3967
3945
|
r === null || e === r ? (t += n, r = e) : (i(), t = n, r = e);
|
|
3968
3946
|
}
|
|
3969
3947
|
i();
|
|
3970
|
-
}, l =
|
|
3948
|
+
}, l = me(r), u = r.length, d = 0;
|
|
3971
3949
|
for (; d < u;) {
|
|
3972
|
-
let e =
|
|
3950
|
+
let e = M(), n = L(r, t, d, e, o, l);
|
|
3973
3951
|
if (n <= d) {
|
|
3974
3952
|
if (v > 0) {
|
|
3975
|
-
|
|
3953
|
+
N();
|
|
3976
3954
|
continue;
|
|
3977
3955
|
}
|
|
3978
|
-
let i = t.find((e) => e > d) ?? u, a = r.slice(d, i),
|
|
3979
|
-
c <= 0 && (c =
|
|
3956
|
+
let i = t.find((e) => e > d) ?? u, a = r.slice(d, i), s = O(a), c = L(a, s, 0, e, o, l);
|
|
3957
|
+
c <= 0 && (c = s.length > 0 ? s[0] : a.length), n = d + c;
|
|
3980
3958
|
}
|
|
3981
|
-
c(r.slice(d, n)), d = n, d < u &&
|
|
3959
|
+
c(r.slice(d, n)), d = n, d < u && N();
|
|
3982
3960
|
}
|
|
3983
3961
|
continue;
|
|
3984
3962
|
}
|
|
3985
|
-
if (
|
|
3986
|
-
else if (
|
|
3987
|
-
else if (
|
|
3988
|
-
v > 0 &&
|
|
3963
|
+
if (j(a)) P(r, k, s, S, V, n.strikethrough, n.baseline ?? void 0, W), o && (y = !0);
|
|
3964
|
+
else if (o) v > 0 && N();
|
|
3965
|
+
else if (a > h()) {
|
|
3966
|
+
v > 0 && N();
|
|
3989
3967
|
for (let t of r) {
|
|
3990
|
-
e.font =
|
|
3968
|
+
e.font = k;
|
|
3991
3969
|
let r = e.measureText(t).width;
|
|
3992
|
-
!
|
|
3970
|
+
!j(r) && v > 0 && N(), P(t, k, s, S, V, n.strikethrough, n.baseline ?? void 0, W);
|
|
3993
3971
|
}
|
|
3994
|
-
} else if (!y)
|
|
3972
|
+
} else if (!y) P(r, k, s, S, V, n.strikethrough, n.baseline ?? void 0, W);
|
|
3995
3973
|
else {
|
|
3996
|
-
let e = g.segments.at(-1)?.text ?? "", t = r.codePointAt(0),
|
|
3997
|
-
(
|
|
3974
|
+
let e = g.segments.at(-1)?.text ?? "", t = r.codePointAt(0), a = [...e].at(-1)?.codePointAt(0), o = /\S$/u.test(e) && /^\S/u.test(r) && a !== 8203 && t !== 8203, c = t !== void 0 && _.lineStartForbidden.has(t) && o, l = a !== void 0 && t !== void 0 && o && !z(e) && !z(r) && i(a, t);
|
|
3975
|
+
(c || l) && F() || N(), P(r, k, s, S, V, n.strikethrough, n.baseline ?? void 0, W);
|
|
3998
3976
|
}
|
|
3999
3977
|
}
|
|
4000
3978
|
}
|
|
4001
|
-
return
|
|
3979
|
+
return m.push(g), m;
|
|
4002
3980
|
}
|
|
4003
|
-
async function
|
|
3981
|
+
async function Vn(e, t, n, r, i, a, o) {
|
|
4004
3982
|
if (t && t.fillType === "image") {
|
|
4005
|
-
if (e.fillStyle = "#FFFFFF", e.fillRect(0, 0, n, r), !t.imagePath || !t.mimeType || !
|
|
3983
|
+
if (e.fillStyle = "#FFFFFF", e.fillRect(0, 0, n, r), !t.imagePath || !t.mimeType || !o) return;
|
|
4006
3984
|
try {
|
|
4007
|
-
let
|
|
4008
|
-
widthPt: n / i /
|
|
4009
|
-
heightPt: r / i /
|
|
3985
|
+
let s = await we(t.imagePath, t.mimeType, t.duotone, o, {
|
|
3986
|
+
widthPt: n / i / K,
|
|
3987
|
+
heightPt: r / i / K
|
|
4010
3988
|
});
|
|
4011
|
-
if (!
|
|
4012
|
-
if (e.save(), e.beginPath(), e.rect(0, 0, n, r), e.clip(), t.alpha != null && (e.globalAlpha = t.alpha), t.tile)
|
|
3989
|
+
if (a() || !s) return;
|
|
3990
|
+
if (e.save(), e.beginPath(), e.rect(0, 0, n, r), e.clip(), t.alpha != null && (e.globalAlpha = t.alpha), t.tile) Wn(e, s, t.tile, n, r, i);
|
|
4013
3991
|
else {
|
|
4014
|
-
let i = t.fillRect ?? {}, a = i.l ?? 0,
|
|
4015
|
-
e.drawImage(
|
|
3992
|
+
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);
|
|
3993
|
+
e.drawImage(s, u, d, f, p);
|
|
4016
3994
|
}
|
|
4017
3995
|
e.restore();
|
|
4018
3996
|
} catch (e) {
|
|
4019
|
-
if (
|
|
3997
|
+
if (p(e)) throw e;
|
|
4020
3998
|
}
|
|
4021
3999
|
return;
|
|
4022
4000
|
}
|
|
4023
|
-
e.fillStyle =
|
|
4001
|
+
e.fillStyle = yn(t, e, 0, 0, n, r) ?? "#FFFFFF", e.fillRect(0, 0, n, r);
|
|
4024
4002
|
}
|
|
4025
|
-
var
|
|
4026
|
-
function
|
|
4003
|
+
var Hn = 9525;
|
|
4004
|
+
function Un(e, t, n, r, i) {
|
|
4027
4005
|
let a;
|
|
4028
4006
|
a = e === "t" || e === "ctr" || e === "b" ? (t - r) / 2 : e === "tr" || e === "r" || e === "br" ? t - r : 0;
|
|
4029
4007
|
let o;
|
|
@@ -4032,134 +4010,134 @@ function Rn(e, t, n, r, i) {
|
|
|
4032
4010
|
ay: o
|
|
4033
4011
|
};
|
|
4034
4012
|
}
|
|
4035
|
-
function
|
|
4036
|
-
let s =
|
|
4013
|
+
function Wn(t, n, r, i, a, o) {
|
|
4014
|
+
let s = n.width * Hn * r.sx * o, c = n.height * Hn * r.sy * o;
|
|
4037
4015
|
if (!(s > 0) || !(c > 0)) return;
|
|
4038
|
-
let l =
|
|
4016
|
+
let l = r.flip === "x" || r.flip === "xy", u = r.flip === "y" || r.flip === "xy", d = e(s * (l ? 2 : 1), c * (u ? 2 : 1));
|
|
4039
4017
|
if (!d) return;
|
|
4040
4018
|
let f = d.getContext("2d");
|
|
4041
4019
|
if (!f) return;
|
|
4042
|
-
let p = (e,
|
|
4043
|
-
f.save(), f.translate(e + (r ? s : 0),
|
|
4020
|
+
let p = (e, t, r, i) => {
|
|
4021
|
+
f.save(), f.translate(e + (r ? s : 0), t + (i ? c : 0)), f.scale(r ? -1 : 1, i ? -1 : 1), f.drawImage(n, 0, 0, s, c), f.restore();
|
|
4044
4022
|
};
|
|
4045
4023
|
p(0, 0, !1, !1), l && p(s, 0, !0, !1), u && p(0, c, !1, !0), l && u && p(s, c, !0, !0);
|
|
4046
|
-
let m =
|
|
4024
|
+
let m = t.createPattern(d, "repeat");
|
|
4047
4025
|
if (!m) return;
|
|
4048
|
-
let { ax: h, ay: g } =
|
|
4049
|
-
typeof m.setTransform == "function" && typeof DOMMatrix < "u" ? (m.setTransform(new DOMMatrix().translateSelf(_, v)),
|
|
4026
|
+
let { ax: h, ay: g } = Un(r.algn ?? "tl", i, a, s, c), _ = h + J(r.tx, o), v = g + J(r.ty, o);
|
|
4027
|
+
typeof m.setTransform == "function" && typeof DOMMatrix < "u" ? (m.setTransform(new DOMMatrix().translateSelf(_, v)), t.fillStyle = m, t.fillRect(0, 0, i, a)) : (t.save(), t.translate(_, v), t.fillStyle = m, t.fillRect(-_, -v, i, a), t.restore());
|
|
4050
4028
|
}
|
|
4051
|
-
function
|
|
4029
|
+
function Gn(e, t, n) {
|
|
4052
4030
|
if (!t) return;
|
|
4053
|
-
let r = t.dir * Math.PI / 180, i =
|
|
4054
|
-
e.shadowColor =
|
|
4031
|
+
let r = t.dir * Math.PI / 180, i = J(t.dist, n);
|
|
4032
|
+
e.shadowColor = Y(t.color, t.alpha), e.shadowBlur = J(t.blur, n), e.shadowOffsetX = Math.cos(r) * i, e.shadowOffsetY = Math.sin(r) * i;
|
|
4055
4033
|
}
|
|
4056
|
-
function
|
|
4057
|
-
t && (e.shadowColor =
|
|
4034
|
+
function Kn(e, t, n) {
|
|
4035
|
+
t && (e.shadowColor = Y(t.color, t.alpha), e.shadowBlur = J(t.radius, n), e.shadowOffsetX = 0, e.shadowOffsetY = 0);
|
|
4058
4036
|
}
|
|
4059
|
-
function
|
|
4037
|
+
function qn(e) {
|
|
4060
4038
|
e.shadowColor = "transparent", e.shadowBlur = 0, e.shadowOffsetX = 0, e.shadowOffsetY = 0;
|
|
4061
4039
|
}
|
|
4062
|
-
var
|
|
4063
|
-
function
|
|
4064
|
-
if (
|
|
4065
|
-
let g =
|
|
4066
|
-
for (; T >
|
|
4067
|
-
let e = Math.min(
|
|
4040
|
+
var Jn = 8, Yn = 1, Xn = 1, Zn = 256;
|
|
4041
|
+
function Qn(t, n, r, i, a, o, s, c, l, u, d, f, p, m, h) {
|
|
4042
|
+
if (i <= 0) return;
|
|
4043
|
+
let g = t.measureText(n), _ = g.actualBoundingBoxAscent > 0 ? g.actualBoundingBoxAscent : i, v = g.actualBoundingBoxDescent > 0 ? g.actualBoundingBoxDescent : i * .25, y = g.actualBoundingBoxLeft > 0 ? g.actualBoundingBoxLeft : 0, b = g.actualBoundingBoxRight > 0 ? g.actualBoundingBoxRight : i, x = i * u * a, S = Math.min(Zn, Math.max(1, Math.round(x / Jn))), C = (e) => tr(e, o, i, s, c, l, d, f), w = C(S), T = rr(w, o, s, c, l, d, f, u, a, -_, v);
|
|
4044
|
+
for (; T > Xn && S < Zn;) {
|
|
4045
|
+
let e = Math.min(Zn, S * 2), t = C(e), n = rr(t, o, s, c, l, d, f, u, a, -_, v);
|
|
4068
4046
|
if (n >= T * .75) {
|
|
4069
4047
|
w = t;
|
|
4070
4048
|
break;
|
|
4071
4049
|
}
|
|
4072
4050
|
S = e, w = t, T = n;
|
|
4073
4051
|
}
|
|
4074
|
-
let E = 1e4, D =
|
|
4075
|
-
e.fillStyle =
|
|
4076
|
-
for (let
|
|
4077
|
-
let { s0: i, s1: a, g: o } = w[
|
|
4052
|
+
let E = 1e4, D = Yn / (u * a), O = w.length - 1, k = (e, t, n) => e === 0 ? -E : t - n - D, A = (e, t, n) => e === O ? E : t - n + D, j = (e, t) => {
|
|
4053
|
+
e.fillStyle = t;
|
|
4054
|
+
for (let t = 0; t <= O; t++) {
|
|
4055
|
+
let { s0: i, s1: a, g: o } = w[t], s = (i + a) / 2;
|
|
4078
4056
|
e.save(), e.translate(p + o.x, m + o.y), e.rotate(o.angle), o.shear !== 0 && e.transform(1, 0, o.shear, 1, 0, 0), (u !== 1 || o.vScale !== 1) && e.scale(u, o.vScale), e.beginPath();
|
|
4079
|
-
let c = k(
|
|
4080
|
-
e.rect(c, -E, l - c, 2 * E), e.clip(), e.fillText(
|
|
4057
|
+
let c = k(t, i, s), l = A(t, a, s);
|
|
4058
|
+
e.rect(c, -E, l - c, 2 * E), e.clip(), e.fillText(n, -s + r / 2, 0), e.restore();
|
|
4081
4059
|
}
|
|
4082
|
-
}, M =
|
|
4060
|
+
}, M = $n(h), N = typeof t.globalAlpha == "number" ? t.globalAlpha : 1;
|
|
4083
4061
|
if (M >= 1 && N >= 1) {
|
|
4084
|
-
j(
|
|
4062
|
+
j(t, h);
|
|
4085
4063
|
return;
|
|
4086
4064
|
}
|
|
4087
4065
|
if (M <= 0 || N <= 0) return;
|
|
4088
|
-
let P = typeof
|
|
4066
|
+
let P = typeof t.getTransform == "function" ? t.getTransform() : null;
|
|
4089
4067
|
if (!P) {
|
|
4090
|
-
j(
|
|
4068
|
+
j(t, h);
|
|
4091
4069
|
return;
|
|
4092
4070
|
}
|
|
4093
4071
|
let F = Infinity, I = Infinity, L = -Infinity, R = -Infinity;
|
|
4094
4072
|
for (let e = 0; e <= O; e++) {
|
|
4095
|
-
let { s0: t, s1:
|
|
4073
|
+
let { s0: t, s1: n, g: i } = w[e], a = (t + n) / 2, o = -a + r / 2, s = Math.max(k(e, t, a), o - y), c = Math.min(A(e, n, a), o + b);
|
|
4096
4074
|
if (!(c <= s)) for (let [e, t] of [
|
|
4097
4075
|
[s, -_],
|
|
4098
4076
|
[c, -_],
|
|
4099
4077
|
[s, v],
|
|
4100
4078
|
[c, v]
|
|
4101
4079
|
]) {
|
|
4102
|
-
let n =
|
|
4080
|
+
let n = nr(i, u, e, t), r = p + n.x, a = m + n.y, o = P.a * r + P.c * a + P.e, s = P.b * r + P.d * a + P.f;
|
|
4103
4081
|
o < F && (F = o), o > L && (L = o), s < I && (I = s), s > R && (R = s);
|
|
4104
4082
|
}
|
|
4105
4083
|
}
|
|
4106
4084
|
if (!(L > F && R > I)) return;
|
|
4107
|
-
let z = Math.floor(F - 2), B = Math.floor(I - 2), V =
|
|
4085
|
+
let z = Math.floor(F - 2), B = Math.floor(I - 2), V = e(Math.ceil(L + 2) - z, Math.ceil(R + 2) - B), H = V ? V.getContext("2d") : null;
|
|
4108
4086
|
if (!V || !H) {
|
|
4109
|
-
j(
|
|
4087
|
+
j(t, h);
|
|
4110
4088
|
return;
|
|
4111
4089
|
}
|
|
4112
|
-
H.font =
|
|
4090
|
+
H.font = t.font, H.textAlign = "left", H.textBaseline = "alphabetic", H.setTransform(P.a, P.b, P.c, P.d, P.e - z, P.f - B), j(H, er(h)), t.save(), t.setTransform(1, 0, 0, 1, 0, 0), t.globalAlpha = N * M, t.drawImage(V, z, B), t.restore();
|
|
4113
4091
|
}
|
|
4114
|
-
function
|
|
4092
|
+
function $n(e) {
|
|
4115
4093
|
let t = /^rgba?\(\s*[\d.]+\s*,\s*[\d.]+\s*,\s*[\d.]+\s*,\s*([\d.]+)\s*\)$/i.exec(e);
|
|
4116
4094
|
if (!t) return 1;
|
|
4117
4095
|
let n = parseFloat(t[1]);
|
|
4118
4096
|
return Number.isFinite(n) ? Math.min(1, Math.max(0, n)) : 1;
|
|
4119
4097
|
}
|
|
4120
|
-
function
|
|
4098
|
+
function er(e) {
|
|
4121
4099
|
let t = /^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)/i.exec(e);
|
|
4122
4100
|
return t ? `rgb(${t[1]}, ${t[2]}, ${t[3]})` : e;
|
|
4123
4101
|
}
|
|
4124
|
-
function
|
|
4102
|
+
function tr(e, t, n, r, i, a, o, s) {
|
|
4125
4103
|
let c = Array(e);
|
|
4126
4104
|
for (let l = 0; l < e; l++) {
|
|
4127
4105
|
let u = l / e * n, d = (l + 1) / e * n;
|
|
4128
4106
|
c[l] = {
|
|
4129
4107
|
s0: u,
|
|
4130
4108
|
s1: d,
|
|
4131
|
-
g:
|
|
4109
|
+
g: Be(t, (r + (u + d) / 2) / i * a, o, s)
|
|
4132
4110
|
};
|
|
4133
4111
|
}
|
|
4134
4112
|
return c;
|
|
4135
4113
|
}
|
|
4136
|
-
function
|
|
4114
|
+
function nr(e, t, n, r) {
|
|
4137
4115
|
let i = n * t, a = r * e.vScale, o = i + e.shear * a, s = Math.cos(e.angle), c = Math.sin(e.angle);
|
|
4138
4116
|
return {
|
|
4139
4117
|
x: e.x + s * o - c * a,
|
|
4140
4118
|
y: e.y + c * o + s * a
|
|
4141
4119
|
};
|
|
4142
4120
|
}
|
|
4143
|
-
function
|
|
4121
|
+
function rr(e, t, n, r, i, a, o, s, c, l, u) {
|
|
4144
4122
|
let d = 0;
|
|
4145
4123
|
for (let f of e) {
|
|
4146
4124
|
let e = (f.s0 + f.s1) / 2;
|
|
4147
4125
|
for (let p of [f.s0, f.s1]) {
|
|
4148
|
-
let m =
|
|
4126
|
+
let m = Be(t, (n + p) / r * i, a, o);
|
|
4149
4127
|
for (let t of [l, u]) {
|
|
4150
|
-
let n =
|
|
4128
|
+
let n = nr(m, s, 0, t), r = nr(f.g, s, p - e, t), i = Math.hypot(r.x - n.x, r.y - n.y) * c;
|
|
4151
4129
|
i > d && (d = i);
|
|
4152
4130
|
}
|
|
4153
4131
|
}
|
|
4154
4132
|
}
|
|
4155
4133
|
return d;
|
|
4156
4134
|
}
|
|
4157
|
-
function
|
|
4158
|
-
let d = i, f = a, p = Math.max(1, o), m = Math.max(1, s), h =
|
|
4135
|
+
function ir(e, t, n, r, i, a, o, s, c, l, u) {
|
|
4136
|
+
let d = i, f = a, p = Math.max(1, o), m = Math.max(1, s), h = Ie(n, r, p, m);
|
|
4159
4137
|
if (!h) return;
|
|
4160
|
-
let g = t.defaultBold ?? !1, _ = t.defaultItalic ?? !1, v = (t.defaultFontSize ?? 18) *
|
|
4138
|
+
let g = t.defaultBold ?? !1, _ = t.defaultItalic ?? !1, v = (t.defaultFontSize ?? 18) * K * c, y = [];
|
|
4161
4139
|
for (let n of t.paragraphs) {
|
|
4162
|
-
let t =
|
|
4140
|
+
let t = Bn(e, n, Infinity, n.defFontSize == null ? v : n.defFontSize * K * c, n.defColor ? Y(n.defColor) : l, c, 0, g, _, 1, void 0, u, 0);
|
|
4163
4141
|
for (let e of t) y.push(e);
|
|
4164
4142
|
}
|
|
4165
4143
|
if (y.length === 0) return;
|
|
@@ -4178,10 +4156,10 @@ function $n(e, t, n, r, i, a, o, s, c, l, u) {
|
|
|
4178
4156
|
}
|
|
4179
4157
|
e.font = t.font;
|
|
4180
4158
|
let n = t.letterSpacingPx ?? 0, r = e.measureText(t.text);
|
|
4181
|
-
a += r.width + n *
|
|
4159
|
+
a += r.width + n * Z(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));
|
|
4182
4160
|
}
|
|
4183
4161
|
if (a <= 0) continue;
|
|
4184
|
-
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 =
|
|
4162
|
+
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 = ze(h, a), b = 0;
|
|
4185
4163
|
for (let t of n.segments) {
|
|
4186
4164
|
if (t.math) {
|
|
4187
4165
|
b += t.math.width;
|
|
@@ -4192,17 +4170,17 @@ function $n(e, t, n, r, i, a, o, s, c, l, u) {
|
|
|
4192
4170
|
for (let s of o) {
|
|
4193
4171
|
let o = e.measureText(s).width + n, c = r + u * (i - r);
|
|
4194
4172
|
if (!h.singleEdge && o > 0) {
|
|
4195
|
-
|
|
4173
|
+
Qn(e, s, n, o, x(), h, b, a, v, g, _, c, d, f, t.color), b += o;
|
|
4196
4174
|
continue;
|
|
4197
4175
|
}
|
|
4198
|
-
let l =
|
|
4176
|
+
let l = Be(h, (b + o / 2) / a * v, _, c);
|
|
4199
4177
|
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;
|
|
4200
4178
|
}
|
|
4201
4179
|
}
|
|
4202
4180
|
}
|
|
4203
4181
|
e.restore();
|
|
4204
4182
|
}
|
|
4205
|
-
function
|
|
4183
|
+
function ar(e, t, n, r, i, a, o) {
|
|
4206
4184
|
let s = Math.min(r, i);
|
|
4207
4185
|
switch (e) {
|
|
4208
4186
|
case "rightarrow":
|
|
@@ -4232,36 +4210,36 @@ function er(e, t, n, r, i, a, o) {
|
|
|
4232
4210
|
default: return null;
|
|
4233
4211
|
}
|
|
4234
4212
|
}
|
|
4235
|
-
function
|
|
4236
|
-
return e.defaultTextColor ?
|
|
4213
|
+
function or(e, t) {
|
|
4214
|
+
return e.defaultTextColor ? Y(e.defaultTextColor) : t.smartArtFallbackTextColor != null && ln(e) ? t.smartArtFallbackTextColor : null;
|
|
4237
4215
|
}
|
|
4238
|
-
function
|
|
4216
|
+
function sr(e, t, n) {
|
|
4239
4217
|
return {
|
|
4240
4218
|
outerRotation: e,
|
|
4241
4219
|
localFlipH: t,
|
|
4242
4220
|
localFlipV: n
|
|
4243
4221
|
};
|
|
4244
4222
|
}
|
|
4245
|
-
function
|
|
4223
|
+
function cr(e, t, n, i = "#000000", a, o = {
|
|
4246
4224
|
themeMajorFont: null,
|
|
4247
4225
|
themeMinorFont: null,
|
|
4248
4226
|
dpr: 1
|
|
4249
|
-
},
|
|
4250
|
-
let
|
|
4227
|
+
}, s, c) {
|
|
4228
|
+
let u = J(t.x, n), d = J(t.y, n), f = J(t.width, n), p = J(t.height, n), m = s && t.id !== void 0 ? (e) => s({
|
|
4251
4229
|
...e,
|
|
4252
4230
|
shapeId: t.id
|
|
4253
|
-
}) :
|
|
4254
|
-
if (
|
|
4255
|
-
if (t.stroke && (e.save(),
|
|
4256
|
-
let
|
|
4257
|
-
|
|
4231
|
+
}) : s;
|
|
4232
|
+
if (p === 0 && t.textBody?.verticalAnchor === "b") {
|
|
4233
|
+
if (t.stroke && (e.save(), Q(e, t.stroke, n), e.beginPath(), e.moveTo(u, d), e.lineTo(u + f, d), e.stroke(), e.restore()), t.textBody) {
|
|
4234
|
+
let r = or(t, o);
|
|
4235
|
+
mr(e, t.textBody, u, d, f, p, n, r, t.rotation, t.flipH, t.flipV, i, a, o, m, !1, c);
|
|
4258
4236
|
}
|
|
4259
4237
|
return;
|
|
4260
4238
|
}
|
|
4261
|
-
let
|
|
4262
|
-
if (
|
|
4263
|
-
let
|
|
4264
|
-
e.save(), g.outerRotation !== 0 && (e.translate(
|
|
4239
|
+
let h = t.scene3d && it(t.scene3d.camera) ? t.scene3d : null;
|
|
4240
|
+
if (h && f > 0 && p > 0) {
|
|
4241
|
+
let r = e.getTransform(), s = Math.abs(r.a * r.d - r.b * r.c), c = s > 0 ? Math.sqrt(s) : 1, l = hr(t.sp3d, t.scene3d?.lightRig, t.sp3d?.prstMaterial, n, c), m = gr(t.sp3d, h.camera, f, p, n, c), g = sr(t.rotation, t.flipH, t.flipV);
|
|
4242
|
+
e.save(), g.outerRotation !== 0 && (e.translate(u + f / 2, d + p / 2), e.rotate(g.outerRotation * Math.PI / 180), e.translate(-(u + f / 2), -(d + p / 2)));
|
|
4265
4243
|
let _ = {
|
|
4266
4244
|
...t,
|
|
4267
4245
|
x: 0,
|
|
@@ -4271,22 +4249,22 @@ function rr(e, t, n, r = "#000000", i, a = {
|
|
|
4271
4249
|
flipV: g.localFlipV,
|
|
4272
4250
|
scene3d: void 0
|
|
4273
4251
|
};
|
|
4274
|
-
if (
|
|
4275
|
-
|
|
4252
|
+
if (_r(e, h.camera, u, d, f, p, (e) => {
|
|
4253
|
+
cr(e, _, n, i, a, o, void 0);
|
|
4276
4254
|
}, {
|
|
4277
|
-
bevels:
|
|
4278
|
-
extrusion:
|
|
4279
|
-
edgePadCss: (t.stroke ? t.stroke.width * n / 2 : 0) + (t.sp3d?.contourW ? t.sp3d.contourW * n : 0) + (
|
|
4255
|
+
bevels: l,
|
|
4256
|
+
extrusion: m ?? void 0,
|
|
4257
|
+
edgePadCss: (t.stroke ? t.stroke.width * n / 2 : 0) + (t.sp3d?.contourW ? t.sp3d.contourW * n : 0) + (m ? Math.hypot(m.offsetX, m.offsetY) / c : 0) + 2
|
|
4280
4258
|
})) {
|
|
4281
4259
|
e.restore();
|
|
4282
4260
|
return;
|
|
4283
4261
|
}
|
|
4284
4262
|
e.restore();
|
|
4285
4263
|
}
|
|
4286
|
-
e.save(), (t.rotation !== 0 || t.flipH || t.flipV) && (e.translate(
|
|
4287
|
-
let
|
|
4288
|
-
|
|
4289
|
-
let
|
|
4264
|
+
e.save(), (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)));
|
|
4265
|
+
let g = t.geometry.toLowerCase(), _ = yn(t.fill, e, u, d, f, p);
|
|
4266
|
+
Gn(e, t.shadow ?? null, n), t.shadow || Kn(e, t.glow ?? null, n);
|
|
4267
|
+
let v = new Set([
|
|
4290
4268
|
"line",
|
|
4291
4269
|
"straightconnector1",
|
|
4292
4270
|
"bentconnector2",
|
|
@@ -4297,7 +4275,7 @@ function rr(e, t, n, r = "#000000", i, a = {
|
|
|
4297
4275
|
"curvedconnector3",
|
|
4298
4276
|
"curvedconnector4",
|
|
4299
4277
|
"curvedconnector5"
|
|
4300
|
-
]),
|
|
4278
|
+
]), y = new Set([
|
|
4301
4279
|
"callout1",
|
|
4302
4280
|
"callout2",
|
|
4303
4281
|
"callout3",
|
|
@@ -4310,12 +4288,12 @@ function rr(e, t, n, r = "#000000", i, a = {
|
|
|
4310
4288
|
"accentbordercallout1",
|
|
4311
4289
|
"accentbordercallout2",
|
|
4312
4290
|
"accentbordercallout3"
|
|
4313
|
-
]),
|
|
4291
|
+
]), b = (e) => y.has(e) || e === "line" || e === "straightconnector1" || e.startsWith("bentconnector"), x = !t.custGeom && w(g), S = (e, r) => {
|
|
4314
4292
|
let i = r ?? _, a = r ? null : t.stroke ? () => {
|
|
4315
|
-
|
|
4316
|
-
} : null, o = () =>
|
|
4317
|
-
if (
|
|
4318
|
-
|
|
4293
|
+
Q(e, t.stroke, n), e.stroke();
|
|
4294
|
+
} : null, o = () => qn(e);
|
|
4295
|
+
if (x && !r) {
|
|
4296
|
+
l(e, g, u, d, f, p, [
|
|
4319
4297
|
t.adj,
|
|
4320
4298
|
t.adj2,
|
|
4321
4299
|
t.adj3,
|
|
@@ -4324,28 +4302,28 @@ function rr(e, t, n, r = "#000000", i, a = {
|
|
|
4324
4302
|
t.adj6,
|
|
4325
4303
|
t.adj7,
|
|
4326
4304
|
t.adj8
|
|
4327
|
-
], i, a, o,
|
|
4305
|
+
], i, a, o, b(g) ? { skipTrailingStroke: !0 } : void 0);
|
|
4328
4306
|
return;
|
|
4329
4307
|
}
|
|
4330
|
-
e.beginPath(), t.custGeom && t.custGeom.length > 0 ?
|
|
4331
|
-
},
|
|
4332
|
-
x:
|
|
4333
|
-
y:
|
|
4334
|
-
w:
|
|
4335
|
-
h:
|
|
4336
|
-
},
|
|
4337
|
-
e.setTransform(
|
|
4308
|
+
e.beginPath(), t.custGeom && t.custGeom.length > 0 ? lr(e, t.custGeom, u, d, f, p) : he(e, g, u, d, f, p, t.adj, t.adj2, t.adj3, t.adj4), i && g !== "arc" && (e.fillStyle = i, g === "donut" || g === "smileyface" || g === "frame" ? e.fill("evenodd") : e.fill(), r || o()), a && a();
|
|
4309
|
+
}, C = e.canvas.width || 0, T = e.canvas.height || 0, E = e.getTransform(), D = Math.abs(E.a * E.d - E.b * E.c), O = D > 0 ? Math.sqrt(D) : 1, k = {
|
|
4310
|
+
x: u * O,
|
|
4311
|
+
y: d * O,
|
|
4312
|
+
w: f * O,
|
|
4313
|
+
h: p * O
|
|
4314
|
+
}, A = n * O, j = (e) => {
|
|
4315
|
+
e.setTransform(E);
|
|
4338
4316
|
};
|
|
4339
|
-
if (t.reflection &&
|
|
4340
|
-
|
|
4341
|
-
},
|
|
4342
|
-
|
|
4343
|
-
},
|
|
4344
|
-
|
|
4345
|
-
}), e.restore()) :
|
|
4346
|
-
|
|
4347
|
-
},
|
|
4348
|
-
let
|
|
4317
|
+
if (t.reflection && C > 0 && T > 0 && (e.save(), e.setTransform(new DOMMatrix()), qe(e, (e) => {
|
|
4318
|
+
j(e), S(e);
|
|
4319
|
+
}, k, t.reflection, A, C, T), e.restore()), t.softEdge && C > 0 && T > 0 ? (e.save(), e.setTransform(new DOMMatrix()), Ke(e, (e) => {
|
|
4320
|
+
j(e), S(e);
|
|
4321
|
+
}, k, t.softEdge, A, C, T, (e) => {
|
|
4322
|
+
j(e), S(e, "#000");
|
|
4323
|
+
}), e.restore()) : S(e), t.innerShadow && C > 0 && T > 0 && (e.save(), e.setTransform(new DOMMatrix()), Ge(e, (e) => {
|
|
4324
|
+
j(e), S(e, "#000");
|
|
4325
|
+
}, k, t.innerShadow, A, C, T), e.restore()), t.stroke && (v.has(g) || y.has(g))) {
|
|
4326
|
+
let i = r(g, u, d, f, p, [
|
|
4349
4327
|
t.adj,
|
|
4350
4328
|
t.adj2,
|
|
4351
4329
|
t.adj3,
|
|
@@ -4355,53 +4333,53 @@ function rr(e, t, n, r = "#000000", i, a = {
|
|
|
4355
4333
|
t.adj7,
|
|
4356
4334
|
t.adj8
|
|
4357
4335
|
]);
|
|
4358
|
-
if (
|
|
4359
|
-
let
|
|
4360
|
-
if (
|
|
4361
|
-
let
|
|
4336
|
+
if (i) {
|
|
4337
|
+
let r = t.stroke.cmpd, a = g === "line" || g === "straightconnector1";
|
|
4338
|
+
if (b(g) && i.vertices.length >= 2 && !(r && a)) {
|
|
4339
|
+
let r = i.vertices.map((e) => ({
|
|
4362
4340
|
x: e.x,
|
|
4363
4341
|
y: e.y
|
|
4364
4342
|
}));
|
|
4365
4343
|
if (t.stroke.tailEnd) {
|
|
4366
|
-
let e =
|
|
4367
|
-
|
|
4344
|
+
let e = xe(t.stroke.tailEnd, t.stroke, n);
|
|
4345
|
+
r[r.length - 1] = _e(r[r.length - 1], r[r.length - 2], e);
|
|
4368
4346
|
}
|
|
4369
4347
|
if (t.stroke.headEnd) {
|
|
4370
|
-
let e =
|
|
4371
|
-
|
|
4348
|
+
let e = xe(t.stroke.headEnd, t.stroke, n);
|
|
4349
|
+
r[0] = _e(r[0], r[1], e);
|
|
4372
4350
|
}
|
|
4373
|
-
|
|
4374
|
-
for (let t = 1; t <
|
|
4351
|
+
Q(e, t.stroke, n), e.beginPath(), e.moveTo(r[0].x, r[0].y);
|
|
4352
|
+
for (let t = 1; t < r.length; t++) e.lineTo(r[t].x, r[t].y);
|
|
4375
4353
|
e.stroke();
|
|
4376
4354
|
}
|
|
4377
|
-
|
|
4355
|
+
r && a && wr(e, i.start, i.end, t.stroke, r, n), t.stroke.tailEnd && ye(e, i.end.x, i.end.y, i.end.angle, t.stroke.tailEnd, t.stroke, n), t.stroke.headEnd && ye(e, i.start.x, i.start.y, i.start.angle, t.stroke.headEnd, t.stroke, n);
|
|
4378
4356
|
}
|
|
4379
4357
|
} else 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")) {
|
|
4380
|
-
let { start: r, end: i } =
|
|
4381
|
-
r && t.stroke.headEnd && t.stroke.headEnd.type !== "none" &&
|
|
4358
|
+
let { start: r, end: i } = be(t.custGeom);
|
|
4359
|
+
r && t.stroke.headEnd && t.stroke.headEnd.type !== "none" && ye(e, u + r.x * f, d + r.y * p, Math.atan2(r.dy * p, r.dx * f), t.stroke.headEnd, t.stroke, n), i && t.stroke.tailEnd && t.stroke.tailEnd.type !== "none" && ye(e, u + i.x * f, d + i.y * p, Math.atan2(i.dy * p, i.dx * f), t.stroke.tailEnd, t.stroke, n);
|
|
4382
4360
|
}
|
|
4383
4361
|
if (t.textBody) {
|
|
4384
|
-
let
|
|
4362
|
+
let r = or(t, o);
|
|
4385
4363
|
if (e.save(), t.flipH || t.flipV) {
|
|
4386
|
-
let n =
|
|
4364
|
+
let n = u + f / 2, r = d + p / 2;
|
|
4387
4365
|
e.translate(n, r), t.flipH && e.scale(-1, 1), t.flipV && e.scale(1, -1), e.translate(-n, -r);
|
|
4388
4366
|
}
|
|
4389
|
-
let
|
|
4390
|
-
if (t.textRect)
|
|
4391
|
-
else if (
|
|
4392
|
-
let e =
|
|
4393
|
-
|
|
4367
|
+
let s = u, l = d, h = f, _ = p;
|
|
4368
|
+
if (t.textRect) s = J(t.textRect.x, n), l = J(t.textRect.y, n), h = J(t.textRect.width, n), _ = J(t.textRect.height, n);
|
|
4369
|
+
else if (g === "ellipse") {
|
|
4370
|
+
let e = f * (1 - 1 / Math.SQRT2) / 2, t = p * (1 - 1 / Math.SQRT2) / 2;
|
|
4371
|
+
s = u + e, l = d + t, h = f / Math.SQRT2, _ = p / Math.SQRT2;
|
|
4394
4372
|
} else {
|
|
4395
|
-
let e =
|
|
4396
|
-
e && (
|
|
4373
|
+
let e = ar(g, u, d, f, p, t.adj, t.adj2);
|
|
4374
|
+
e && (s = e.tx, l = e.ty, h = e.tw, _ = e.th);
|
|
4397
4375
|
}
|
|
4398
|
-
|
|
4376
|
+
mr(e, t.textBody, s, l, h, _, n, r, t.rotation, !1, !1, i, a, o, m, !1, c), e.restore();
|
|
4399
4377
|
}
|
|
4400
4378
|
e.restore();
|
|
4401
4379
|
}
|
|
4402
|
-
var
|
|
4403
|
-
function
|
|
4404
|
-
let n = `${e}`, r = e >= 1 && e <= 26 ? String.fromCharCode(96 + e) : n, i = e >= 1 && e <= 26 ? String.fromCharCode(64 + e) : n, a =
|
|
4380
|
+
var lr = Se;
|
|
4381
|
+
function ur(e, t) {
|
|
4382
|
+
let n = `${e}`, r = e >= 1 && e <= 26 ? String.fromCharCode(96 + e) : n, i = e >= 1 && e <= 26 ? String.fromCharCode(64 + e) : n, a = dr(e).toLowerCase(), o = dr(e), s = n.replace(/[0-9]/g, (e) => String.fromCharCode(65296 + (e.charCodeAt(0) - 48)));
|
|
4405
4383
|
switch (t) {
|
|
4406
4384
|
case "arabicPlain": return n;
|
|
4407
4385
|
case "arabicPeriod": return `${n}.`;
|
|
@@ -4428,7 +4406,7 @@ function ar(e, t) {
|
|
|
4428
4406
|
default: return `${n}.`;
|
|
4429
4407
|
}
|
|
4430
4408
|
}
|
|
4431
|
-
function
|
|
4409
|
+
function dr(e) {
|
|
4432
4410
|
let t = [
|
|
4433
4411
|
1e3,
|
|
4434
4412
|
900,
|
|
@@ -4461,81 +4439,81 @@ function or(e) {
|
|
|
4461
4439
|
for (let i = 0; i < t.length; i++) for (; e >= t[i];) r += n[i], e -= t[i];
|
|
4462
4440
|
return r;
|
|
4463
4441
|
}
|
|
4464
|
-
function
|
|
4442
|
+
function fr(e) {
|
|
4465
4443
|
for (let t of e.runs) if (t.type === "text" && t.text !== "" || t.type === "math") return !0;
|
|
4466
4444
|
return !1;
|
|
4467
4445
|
}
|
|
4468
|
-
function
|
|
4469
|
-
let n =
|
|
4470
|
-
if (e.bullet.type === "char") return t.clear(), n ?
|
|
4446
|
+
function pr(e, t) {
|
|
4447
|
+
let n = fr(e);
|
|
4448
|
+
if (e.bullet.type === "char") return t.clear(), n ? ve(e.bullet.char, e.bullet.fontFamily ?? null) : "";
|
|
4471
4449
|
if (e.bullet.type === "autoNum") {
|
|
4472
4450
|
if (!n) return "";
|
|
4473
4451
|
let r = e.lvl;
|
|
4474
|
-
return t.has(r) ? t.set(r, t.get(r) + 1) : t.set(r, e.bullet.startAt ?? 1),
|
|
4452
|
+
return t.has(r) ? t.set(r, t.get(r) + 1) : t.set(r, e.bullet.startAt ?? 1), ur(t.get(r), e.bullet.numType);
|
|
4475
4453
|
}
|
|
4476
4454
|
return t.clear(), "";
|
|
4477
4455
|
}
|
|
4478
|
-
function
|
|
4456
|
+
function mr(e, t, n, r, i, a, o, s = null, c = 0, l = !1, u = !1, d = "#000000", f, p = {
|
|
4479
4457
|
themeMajorFont: null,
|
|
4480
4458
|
themeMinorFont: null,
|
|
4481
4459
|
dpr: 1
|
|
4482
|
-
},
|
|
4460
|
+
}, m, h = !1, _, v = !1) {
|
|
4483
4461
|
let y = t.vert === "vert" || t.vert === "eaVert", b = t.vert === "vert270";
|
|
4484
4462
|
if (y || b) {
|
|
4485
|
-
let
|
|
4463
|
+
let l = n + i / 2, u = r + a / 2, g = y ? 90 : -90, v = m ? (e) => m({
|
|
4486
4464
|
...e,
|
|
4487
|
-
inShapeX: e.inShapeX -
|
|
4488
|
-
inShapeY: e.inShapeY -
|
|
4465
|
+
inShapeX: e.inShapeX - a / 2 + i / 2,
|
|
4466
|
+
inShapeY: e.inShapeY - i / 2 + a / 2,
|
|
4489
4467
|
shapeX: n,
|
|
4490
|
-
shapeY:
|
|
4491
|
-
shapeW:
|
|
4492
|
-
shapeH:
|
|
4493
|
-
rotation:
|
|
4494
|
-
textBodyRotation:
|
|
4468
|
+
shapeY: r,
|
|
4469
|
+
shapeW: i,
|
|
4470
|
+
shapeH: a,
|
|
4471
|
+
rotation: c,
|
|
4472
|
+
textBodyRotation: g
|
|
4495
4473
|
}) : void 0;
|
|
4496
|
-
if (
|
|
4497
|
-
e.save(), e.translate(
|
|
4474
|
+
if (h) return i;
|
|
4475
|
+
e.save(), e.translate(l, u), e.rotate(b ? -Math.PI / 2 : Math.PI / 2), mr(e, {
|
|
4498
4476
|
...t,
|
|
4499
4477
|
vert: "horz"
|
|
4500
|
-
}, -
|
|
4478
|
+
}, -a / 2, -i / 2, a, i, o, s, 0, !1, !1, d, f, p, v, !1, _, t.vert === "eaVert"), e.restore();
|
|
4501
4479
|
return;
|
|
4502
4480
|
}
|
|
4503
4481
|
let x = t.textWarp;
|
|
4504
|
-
if (!
|
|
4505
|
-
|
|
4482
|
+
if (!h && x && je(x.preset)) {
|
|
4483
|
+
ir(e, t, x.preset, x.adj ?? [], n, r, i, a, o, s ?? d, p);
|
|
4506
4484
|
return;
|
|
4507
4485
|
}
|
|
4508
|
-
let S =
|
|
4509
|
-
let
|
|
4486
|
+
let S = J(t.lIns, o), C = J(t.rIns, o), w = J(t.tIns, o), T = J(t.bIns, o), E = t.wrap !== "none", D = t.autoFit === "sp" ? E && Rn(e, t, i, S, C, o, p) : E, O = Math.max(1, t.numCol ?? 1), k = J(t.spcCol ?? 0, o), A = t.defaultBold ?? !1, j = t.defaultItalic ?? !1, M = s ?? d, N = (r) => {
|
|
4487
|
+
let a = (t.defaultFontSize ?? 18) * K * o * r, s = [], c = 0, l = /* @__PURE__ */ new Map();
|
|
4510
4488
|
for (let u = 0; u < t.paragraphs.length; u++) {
|
|
4511
|
-
let d = t.paragraphs[u],
|
|
4489
|
+
let d = t.paragraphs[u], m = J(d.marL, o), h = J(d.marR, o), g = J(d.indent, o), _ = d.defFontSize == null ? a : d.defFontSize * K * o * r, v = d.defColor ? Y(d.defColor) : M, y = In(d), b = (() => {
|
|
4512
4490
|
for (let e of d.runs) if (e.type === "text" && e.fontSize != null) return e.fontSize;
|
|
4513
4491
|
return null;
|
|
4514
|
-
})(), x = b == null ? _ : b *
|
|
4492
|
+
})(), x = b == null ? _ : b * K * o * r, w = (() => {
|
|
4515
4493
|
for (let e of d.runs) if (e.type === "text" && e.color) return e.color;
|
|
4516
4494
|
return null;
|
|
4517
|
-
})(), T = w ?
|
|
4518
|
-
E =
|
|
4519
|
-
let I =
|
|
4495
|
+
})(), T = w ? Y(w) : v, E = "", N = X(!1, !1, x, "sans-serif", p), P = T, F = null;
|
|
4496
|
+
E = pr(d, l);
|
|
4497
|
+
let I = Ee(d.bullet);
|
|
4520
4498
|
if (I.type === "char") {
|
|
4521
4499
|
let e = I;
|
|
4522
|
-
N =
|
|
4523
|
-
} else if (I.type === "autoNum") N =
|
|
4500
|
+
N = X(!1, !1, e.sizePts == null ? e.sizePct == null ? x : x * (e.sizePct / 100) : e.sizePts * K * o * r, E === e.char ? Dn(e.fontFamily ?? null, p) : "sans-serif", p), P = e.color ? Y(e.color) : T;
|
|
4501
|
+
} else if (I.type === "autoNum") N = X(!1, !1, x, "sans-serif", p), P = I.color ? Y(I.color) : T;
|
|
4524
4502
|
else if (I.type === "blip") {
|
|
4525
|
-
let e = I, t = e.sizePts == null ? e.sizePct == null ? x : x * (e.sizePct / 100) : e.sizePts *
|
|
4503
|
+
let e = I, t = e.sizePts == null ? e.sizePct == null ? x : x * (e.sizePct / 100) : e.sizePts * K * o * r;
|
|
4526
4504
|
F = {
|
|
4527
4505
|
imagePath: e.imagePath,
|
|
4528
4506
|
mimeType: e.mimeType,
|
|
4529
4507
|
sizePx: t
|
|
4530
4508
|
};
|
|
4531
4509
|
}
|
|
4532
|
-
let L = O > 1 ? (
|
|
4510
|
+
let L = O > 1 ? (i - S - C - (O - 1) * k) / O : i - S - C, R = n + S + m, z = n + S + m + g, B = L - m - h, V = Bn(e, d, D ? B : Infinity, _, v, o, m, A, j, r, f, p, Ln(y, g)), H = d.spaceBefore == null ? 0 : d.spaceBefore / 100 * K * o * r, U = d.spaceAfter == null ? 0 : d.spaceAfter / 100 * K * o * r;
|
|
4533
4511
|
for (let n = 0; n < V.length; n++) {
|
|
4534
4512
|
let r = V[n], i = n === 0, a = n === V.length - 1, l = 0, f = 0;
|
|
4535
4513
|
for (let e of r.segments) {
|
|
4536
4514
|
let t = e.math ? Math.max(e.sizePx, (e.math.ascent + e.math.descent) / 1.2) : e.sizePx;
|
|
4537
4515
|
if (t > l && (l = t), !e.math) {
|
|
4538
|
-
let t =
|
|
4516
|
+
let t = te(e.fontFamily, e.sizePx);
|
|
4539
4517
|
t > f && (f = t);
|
|
4540
4518
|
}
|
|
4541
4519
|
}
|
|
@@ -4546,9 +4524,9 @@ function lr(e, t, n, i, a, o, s, c = null, l = 0, u = !1, d = !1, f = "#000000",
|
|
|
4546
4524
|
}
|
|
4547
4525
|
i && F && F.sizePx > l && (l = F.sizePx);
|
|
4548
4526
|
let p = l * 1.2, m = Math.max(p, f), h;
|
|
4549
|
-
h = d.spaceLine ? d.spaceLine.type === "pct" ? p * (d.spaceLine.val / 1e5) : d.spaceLine.val *
|
|
4550
|
-
let v = h + (a ? U : 0), b = i && u > 0 ? H : 0, x = i ?
|
|
4551
|
-
|
|
4527
|
+
h = d.spaceLine ? d.spaceLine.type === "pct" ? p * (d.spaceLine.val / 1e5) : d.spaceLine.val * K * o : m, t.autoFit === "norm" && t.lnSpcReduction != null && d.spaceLine?.type !== "pts" && (h *= 1 - t.lnSpcReduction);
|
|
4528
|
+
let v = h + (a ? U : 0), b = i && u > 0 ? H : 0, x = i ? Ln(y, g) : 0, S = r.segments.some((e) => e.text && e.text.length > 0 || e.math != null), C = i && S ? F : null;
|
|
4529
|
+
s.push({
|
|
4552
4530
|
line: r,
|
|
4553
4531
|
linePx: v,
|
|
4554
4532
|
lineHeight: h,
|
|
@@ -4568,13 +4546,13 @@ function lr(e, t, n, i, a, o, s, c = null, l = 0, u = !1, d = !1, f = "#000000",
|
|
|
4568
4546
|
}
|
|
4569
4547
|
}
|
|
4570
4548
|
return {
|
|
4571
|
-
allLines:
|
|
4549
|
+
allLines: s,
|
|
4572
4550
|
totalHeight: c
|
|
4573
4551
|
};
|
|
4574
4552
|
}, { allLines: P, totalHeight: F } = N(1);
|
|
4575
4553
|
if (t.autoFit === "norm") if (t.fontScale != null && t.fontScale > 0) t.fontScale < 1 && ({allLines: P, totalHeight: F} = N(t.fontScale));
|
|
4576
4554
|
else {
|
|
4577
|
-
let e =
|
|
4555
|
+
let e = a - w - T;
|
|
4578
4556
|
if (F > e && e > 0) {
|
|
4579
4557
|
let t = .1, n = 1;
|
|
4580
4558
|
for (let r = 0; r < 6; r++) {
|
|
@@ -4584,20 +4562,20 @@ function lr(e, t, n, i, a, o, s, c = null, l = 0, u = !1, d = !1, f = "#000000",
|
|
|
4584
4562
|
({allLines: P, totalHeight: F} = N(t));
|
|
4585
4563
|
}
|
|
4586
4564
|
}
|
|
4587
|
-
if (
|
|
4588
|
-
let I = t.verticalAnchor ?? "t", L =
|
|
4589
|
-
|
|
4565
|
+
if (h) return w + F + T;
|
|
4566
|
+
let I = t.verticalAnchor ?? "t", L = r, R;
|
|
4567
|
+
a === 0 && I === "b" ? (R = w + F + T, L = r - R) : R = t.autoFit === "sp" ? Math.max(a, w + F + T) : a;
|
|
4590
4568
|
let z, B = Math.max(0, R - w - T);
|
|
4591
4569
|
z = I === "ctr" ? L + w + (B - F) / 2 : I === "b" ? L + R - T - F : L + w, e.save(), e.textAlign = "left", e.textBaseline = "alphabetic";
|
|
4592
|
-
let V = z, H = O > 1 ? (
|
|
4593
|
-
for (let
|
|
4594
|
-
let { line:
|
|
4595
|
-
O > 1 &&
|
|
4596
|
-
let T = (t.rtlCol ? O - 1 -
|
|
4570
|
+
let V = z, H = O > 1 ? (i - S - C - (O - 1) * k) / O + k : 0, U = Math.max(0, R - w - T), W = P[P.length - 1], ee = W ? Math.max(0, W.linePx - W.lineHeight) : 0, ne = F - ee, re = a === 0 || ne <= U + .5, ie = O > 1 && !re ? Math.ceil(P.length / O) : P.length, ae = 0, oe = 0;
|
|
4571
|
+
for (let s of P) {
|
|
4572
|
+
let { line: l, linePx: u, lineHeight: d, topGapPx: f, textXOffset: h, bulletLabel: y, bulletFont: b, bulletColor: x, bulletImage: S, alignment: C, isLastLine: w } = s;
|
|
4573
|
+
O > 1 && ae < O - 1 && oe >= ie && (ae++, oe = 0, z = V), z += f, oe++;
|
|
4574
|
+
let T = (t.rtlCol ? O - 1 - ae : ae) * H, E = s.textX + T, D = s.bulletX + T, k = s.textMaxW, A = s.para.rtl === !0, j = A || Qt(l.segments), M = l.segments.some((e) => e.isTab);
|
|
4597
4575
|
if (M) {
|
|
4598
|
-
let t =
|
|
4599
|
-
e.font =
|
|
4600
|
-
let a = e.measureText(" ").width,
|
|
4576
|
+
let t = J(s.para.marL, o), n = J(s.para.marR, o), r = A ? n : t + h, i = k + t + n;
|
|
4577
|
+
e.font = l.segments.find((e) => e.isTab).font;
|
|
4578
|
+
let a = e.measureText(" ").width, c = dn(l.segments.map((t) => {
|
|
4601
4579
|
if (t.isTab) return {
|
|
4602
4580
|
isTab: !0,
|
|
4603
4581
|
width: 0
|
|
@@ -4610,16 +4588,16 @@ function lr(e, t, n, i, a, o, s, c = null, l = 0, u = !1, d = !1, f = "#000000",
|
|
|
4610
4588
|
let n = t.letterSpacingPx ?? 0;
|
|
4611
4589
|
return {
|
|
4612
4590
|
isTab: !1,
|
|
4613
|
-
width: t.text ? e.measureText(t.text).width + n *
|
|
4591
|
+
width: t.text ? e.measureText(t.text).width + n * Z(t.text) : 0
|
|
4614
4592
|
};
|
|
4615
|
-
}), (
|
|
4616
|
-
pos:
|
|
4593
|
+
}), (s.para.tabStops ?? []).map((e) => ({
|
|
4594
|
+
pos: J(e.pos, o),
|
|
4617
4595
|
algn: e.algn
|
|
4618
|
-
})), r, i, a,
|
|
4619
|
-
for (let e = 0; e <
|
|
4596
|
+
})), r, i, a, J(s.para.defTabSz ?? 914400, o));
|
|
4597
|
+
for (let e = 0; e < l.segments.length; e++) l.segments[e].isTab && (l.segments[e].tabWidthPx = c[e]);
|
|
4620
4598
|
}
|
|
4621
|
-
let N = 0, P =
|
|
4622
|
-
for (let t of
|
|
4599
|
+
let N = 0, P = d * .8;
|
|
4600
|
+
for (let t of l.segments) {
|
|
4623
4601
|
if (t.isTab) {
|
|
4624
4602
|
N += t.tabWidthPx ?? 0;
|
|
4625
4603
|
continue;
|
|
@@ -4630,12 +4608,12 @@ function lr(e, t, n, i, a, o, s, c = null, l = 0, u = !1, d = !1, f = "#000000",
|
|
|
4630
4608
|
}
|
|
4631
4609
|
e.font = t.font;
|
|
4632
4610
|
let n = e.measureText(t.text || "M"), r = t.letterSpacingPx ?? 0;
|
|
4633
|
-
N += t.text ? n.width + r *
|
|
4611
|
+
N += t.text ? n.width + r * Z(t.text) : 0, n.actualBoundingBoxAscent > 0 && (P = Math.max(P, n.actualBoundingBoxAscent));
|
|
4634
4612
|
}
|
|
4635
4613
|
let F = z + P, I = E + k, L = 0, R = null;
|
|
4636
4614
|
if (j && A) {
|
|
4637
4615
|
if (y) e.font = b, L = e.measureText(y).width;
|
|
4638
|
-
else if (S && _ && (R =
|
|
4616
|
+
else if (S && _ && (R = g(S.imagePath, _), R)) {
|
|
4639
4617
|
let e = S.sizePx;
|
|
4640
4618
|
L = R.height > 0 ? e * (R.width / R.height) : e;
|
|
4641
4619
|
}
|
|
@@ -4645,41 +4623,41 @@ function lr(e, t, n, i, a, o, s, c = null, l = 0, u = !1, d = !1, f = "#000000",
|
|
|
4645
4623
|
e.direction = "rtl", e.fillText(y, I - L, F), e.direction = t;
|
|
4646
4624
|
} else e.fillText(y, D, F);
|
|
4647
4625
|
if (S && _) {
|
|
4648
|
-
let t =
|
|
4626
|
+
let t = g(S.imagePath, _);
|
|
4649
4627
|
if (t) {
|
|
4650
4628
|
let n = S.sizePx, r = t.height > 0 ? n * (t.width / t.height) : n, i = F - n;
|
|
4651
4629
|
j && A ? e.drawImage(t, I - r, i, r, n) : e.drawImage(t, D, i, r, n);
|
|
4652
4630
|
}
|
|
4653
4631
|
}
|
|
4654
|
-
let B = E +
|
|
4655
|
-
U = M ? A ? E + k - L - N : B : C === "ctr" ? B + (k -
|
|
4656
|
-
let W = C === "just" || C === "justLow" ? "just" : C === "thaiDist" ? "thaiDist" : C === "dist" ? "dist" : null,
|
|
4632
|
+
let B = E + h, U;
|
|
4633
|
+
U = M ? A ? E + k - L - N : B : C === "ctr" ? B + (k - h - N) / 2 : C === "r" ? E + k - L - N : B;
|
|
4634
|
+
let W = C === "just" || C === "justLow" ? "just" : C === "thaiDist" ? "thaiDist" : C === "dist" ? "dist" : null, ee = w || (l.endsWithBreak ?? !1), te = (W && !j && !M ? nn(l.segments, k - h, N, W, ee) : null) ?? l.segments, ne = j ? $t(l.segments, A) : null, re = te.length;
|
|
4657
4635
|
for (let t = 0; t < re; t++) {
|
|
4658
|
-
let
|
|
4659
|
-
if (j && (e.direction = u ? "rtl" : "ltr"),
|
|
4660
|
-
U +=
|
|
4636
|
+
let s = ne ? ne.order[t] : t, l = te[s], u = ne ? ne.rtl[s] : !1;
|
|
4637
|
+
if (j && (e.direction = u ? "rtl" : "ltr"), l.isTab) {
|
|
4638
|
+
U += l.tabWidthPx ?? 0;
|
|
4661
4639
|
continue;
|
|
4662
4640
|
}
|
|
4663
|
-
let
|
|
4664
|
-
if (
|
|
4665
|
-
let t =
|
|
4641
|
+
let f = l.jext ?? 0, h = l.splitBefore, g = l.perGap ?? 0, _ = h && h.length > 0 ? h.length * g : 0;
|
|
4642
|
+
if (l.math) {
|
|
4643
|
+
let t = bn.get(l.math.nodes), n = l.math.width, r = l.math.ascent + l.math.descent;
|
|
4666
4644
|
if (t && n > 0 && r > 0) {
|
|
4667
|
-
let i = F -
|
|
4645
|
+
let i = F - l.math.ascent, a = xn(t, l.color);
|
|
4668
4646
|
e.drawImage(a, U, i, n, r);
|
|
4669
4647
|
}
|
|
4670
|
-
U += n, U +=
|
|
4648
|
+
U += n, U += f;
|
|
4671
4649
|
continue;
|
|
4672
4650
|
}
|
|
4673
|
-
e.font =
|
|
4674
|
-
let y = F + (
|
|
4675
|
-
if (
|
|
4676
|
-
let t = e.measureText(
|
|
4677
|
-
|
|
4651
|
+
e.font = l.font, e.fillStyle = l.color;
|
|
4652
|
+
let y = F + (l.baseline ? -(l.baseline / 1e5) * l.sizePx : 0), b = l.letterSpacingPx ?? 0;
|
|
4653
|
+
if (l.highlight && l.text) {
|
|
4654
|
+
let t = e.measureText(l.text).width + (b > 0 ? b * Z(l.text) : 0) + _ + f;
|
|
4655
|
+
_n(e, U, y, t, l.sizePx, l.highlight, l.color);
|
|
4678
4656
|
}
|
|
4679
|
-
let x =
|
|
4657
|
+
let x = l.shadow;
|
|
4680
4658
|
if (x) {
|
|
4681
|
-
let t = x.dir * Math.PI / 180, n =
|
|
4682
|
-
e.save(), e.shadowColor =
|
|
4659
|
+
let t = x.dir * Math.PI / 180, n = J(x.dist, o);
|
|
4660
|
+
e.save(), e.shadowColor = Y(x.color, x.alpha), e.shadowBlur = J(x.blur, o), e.shadowOffsetX = Math.cos(t) * n, e.shadowOffsetY = Math.sin(t) * n;
|
|
4683
4661
|
}
|
|
4684
4662
|
let S = (t, n, r) => {
|
|
4685
4663
|
let i = r === "fill" ? e.fillText.bind(e) : e.strokeText.bind(e);
|
|
@@ -4693,10 +4671,10 @@ function lr(e, t, n, i, a, o, s, c = null, l = 0, u = !1, d = !1, f = "#000000",
|
|
|
4693
4671
|
r.letterSpacing = a;
|
|
4694
4672
|
} catch {}
|
|
4695
4673
|
} else i(t, n, y);
|
|
4696
|
-
}, C = (t) => e.measureText(t).width, w =
|
|
4674
|
+
}, C = (t) => e.measureText(t).width, w = h && h.length > 0 ? qt([...l.text], h, g, C, b) : null, T = [...l.text], E = !!h && h.length === T.length - 1 && T.length > 1, D = (t) => {
|
|
4697
4675
|
if (v) {
|
|
4698
4676
|
let n = E ? b + g : b;
|
|
4699
|
-
|
|
4677
|
+
gn(e, l.text, U, y, l.sizePx, n, t);
|
|
4700
4678
|
return;
|
|
4701
4679
|
}
|
|
4702
4680
|
if (E) {
|
|
@@ -4704,52 +4682,52 @@ function lr(e, t, n, i, a, o, s, c = null, l = 0, u = !1, d = !1, f = "#000000",
|
|
|
4704
4682
|
try {
|
|
4705
4683
|
n.letterSpacing = `${b + g}px`;
|
|
4706
4684
|
} catch {}
|
|
4707
|
-
(t === "fill" ? e.fillText.bind(e) : e.strokeText.bind(e))(
|
|
4685
|
+
(t === "fill" ? e.fillText.bind(e) : e.strokeText.bind(e))(l.text, U, y);
|
|
4708
4686
|
try {
|
|
4709
4687
|
n.letterSpacing = r;
|
|
4710
4688
|
} catch {}
|
|
4711
4689
|
} else if (w) for (let { text: e, dx: n } of w) S(e, U + n, t);
|
|
4712
|
-
else S(
|
|
4690
|
+
else S(l.text, U, t);
|
|
4713
4691
|
};
|
|
4714
4692
|
D("fill"), x && e.restore();
|
|
4715
|
-
let O =
|
|
4716
|
-
O && O.width > 0 && (e.save(), e.lineWidth = Math.max(.5,
|
|
4717
|
-
let k = e.measureText(
|
|
4718
|
-
if (
|
|
4719
|
-
text:
|
|
4693
|
+
let O = l.outline;
|
|
4694
|
+
O && O.width > 0 && (e.save(), e.lineWidth = Math.max(.5, J(O.width, o)), e.strokeStyle = O.color ? `#${O.color}` : l.color, e.lineJoin = "round", D("stroke"), e.restore()), e.font = l.font;
|
|
4695
|
+
let k = e.measureText(l.text).width + (b > 0 ? b * Z(l.text) : 0) + _;
|
|
4696
|
+
if (m && l.text && m({
|
|
4697
|
+
text: l.text,
|
|
4720
4698
|
inShapeX: U - n,
|
|
4721
|
-
inShapeY: z -
|
|
4722
|
-
w: k +
|
|
4723
|
-
h:
|
|
4724
|
-
fontSize:
|
|
4725
|
-
font:
|
|
4699
|
+
inShapeY: z - r,
|
|
4700
|
+
w: k + f,
|
|
4701
|
+
h: d,
|
|
4702
|
+
fontSize: l.sizePx,
|
|
4703
|
+
font: l.font,
|
|
4726
4704
|
shapeX: n,
|
|
4727
|
-
shapeY:
|
|
4728
|
-
shapeW:
|
|
4729
|
-
shapeH:
|
|
4730
|
-
rotation:
|
|
4731
|
-
hyperlink:
|
|
4732
|
-
}),
|
|
4733
|
-
let t = Math.max(1,
|
|
4734
|
-
e.strokeStyle =
|
|
4735
|
-
let n = y -
|
|
4736
|
-
if (
|
|
4705
|
+
shapeY: r,
|
|
4706
|
+
shapeW: i,
|
|
4707
|
+
shapeH: a,
|
|
4708
|
+
rotation: c,
|
|
4709
|
+
hyperlink: l.hyperlink
|
|
4710
|
+
}), l.underline && Gt(e, U, y, k + f, l.sizePx, l.underlineColor ?? l.color, l.underlineStyle, p.dpr), l.strikethrough) {
|
|
4711
|
+
let t = Math.max(1, l.sizePx * .05);
|
|
4712
|
+
e.strokeStyle = l.color, e.lineWidth = t, e.setLineDash([]);
|
|
4713
|
+
let n = y - l.sizePx * .32;
|
|
4714
|
+
if (l.strikeDouble) {
|
|
4737
4715
|
let r = t * .9, i = n - r, a = n + r;
|
|
4738
|
-
e.beginPath(), e.moveTo(U, i +
|
|
4716
|
+
e.beginPath(), e.moveTo(U, i + G(i, t, p.dpr)), e.lineTo(U + k + f, i + G(i, t, p.dpr)), e.moveTo(U, a + G(a, t, p.dpr)), e.lineTo(U + k + f, a + G(a, t, p.dpr)), e.stroke();
|
|
4739
4717
|
} else {
|
|
4740
|
-
let r = n +
|
|
4741
|
-
e.beginPath(), e.moveTo(U, r), e.lineTo(U + k +
|
|
4718
|
+
let r = n + G(n, t, p.dpr);
|
|
4719
|
+
e.beginPath(), e.moveTo(U, r), e.lineTo(U + k + f, r), e.stroke();
|
|
4742
4720
|
}
|
|
4743
4721
|
}
|
|
4744
|
-
U += k, U +=
|
|
4722
|
+
U += k, U += f;
|
|
4745
4723
|
}
|
|
4746
|
-
j && (e.direction = "ltr"), z +=
|
|
4724
|
+
j && (e.direction = "ltr"), z += u;
|
|
4747
4725
|
}
|
|
4748
4726
|
e.restore();
|
|
4749
4727
|
}
|
|
4750
|
-
function
|
|
4728
|
+
function hr(e, t, n, r, i) {
|
|
4751
4729
|
if (!e) return [];
|
|
4752
|
-
let a =
|
|
4730
|
+
let a = Nt(t?.rig ?? "threePt", t?.dir ?? "t", t?.rot), o = zt(n), s = r * i, c = [];
|
|
4753
4731
|
return e.bevelT && e.bevelT.w > 0 && e.bevelT.h > 0 && c.push({
|
|
4754
4732
|
widthPx: e.bevelT.w * s,
|
|
4755
4733
|
heightPx: e.bevelT.h * s,
|
|
@@ -4765,9 +4743,9 @@ function ur(e, t, n, r, i) {
|
|
|
4765
4743
|
bottom: !0
|
|
4766
4744
|
}), c;
|
|
4767
4745
|
}
|
|
4768
|
-
function
|
|
4746
|
+
function gr(e, t, n, r, i, a) {
|
|
4769
4747
|
if (!e || !e.extrusionH || e.extrusionH <= 0) return null;
|
|
4770
|
-
let o = e.extrusionH * i * a, s =
|
|
4748
|
+
let o = e.extrusionH * i * a, s = at(t, n * a, r * a, o);
|
|
4771
4749
|
if (Math.hypot(s.x, s.y) < .75) return null;
|
|
4772
4750
|
let c = [
|
|
4773
4751
|
64,
|
|
@@ -4788,19 +4766,19 @@ function dr(e, t, n, r, i, a) {
|
|
|
4788
4766
|
rgb: c
|
|
4789
4767
|
};
|
|
4790
4768
|
}
|
|
4791
|
-
function
|
|
4792
|
-
if (
|
|
4793
|
-
let l =
|
|
4769
|
+
function _r(t, n, r, i, a, o, s, c = {}) {
|
|
4770
|
+
if (a <= 0 || o <= 0) return !1;
|
|
4771
|
+
let l = t.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.edgePadCss ?? 0) * d)), p = rt(n, a, o), m = p.corners;
|
|
4794
4772
|
if (f > 0) {
|
|
4795
|
-
let e = f / d, t =
|
|
4773
|
+
let e = f / d, t = mt(p.corners, e / a, e / o);
|
|
4796
4774
|
t ? m = t : f = 0;
|
|
4797
4775
|
}
|
|
4798
|
-
let h = f / d, g = Math.max(1, Math.ceil(
|
|
4776
|
+
let h = f / d, g = Math.max(1, Math.ceil(a * d) + 2 * f), _ = Math.max(1, Math.ceil(o * d) + 2 * f), v = e(g, _);
|
|
4799
4777
|
if (!v) return !1;
|
|
4800
4778
|
let y = v.getContext("2d");
|
|
4801
4779
|
if (!y) return !1;
|
|
4802
|
-
y.save(), y.scale(d, d), y.translate(h, h), s(y, 0, 0,
|
|
4803
|
-
let b = Math.ceil(
|
|
4780
|
+
y.save(), y.scale(d, d), y.translate(h, h), s(y, 0, 0, a, o), y.restore();
|
|
4781
|
+
let b = Math.ceil(a * d), x = Math.ceil(o * d), S = (e) => ({
|
|
4804
4782
|
x: f - e,
|
|
4805
4783
|
y: f - e,
|
|
4806
4784
|
w: b + 2 * e,
|
|
@@ -4808,46 +4786,46 @@ function fr(e, t, n, r, i, a, s, c = {}) {
|
|
|
4808
4786
|
});
|
|
4809
4787
|
if (c.extrusion) {
|
|
4810
4788
|
let e = Math.ceil(Math.hypot(c.extrusion.offsetX, c.extrusion.offsetY)) + 2;
|
|
4811
|
-
|
|
4789
|
+
Wt(y, c.extrusion, S(e));
|
|
4812
4790
|
}
|
|
4813
|
-
if (c.bevels && c.bevels.length > 0) for (let e of c.bevels)
|
|
4814
|
-
return c.paintEdges && (y.save(), y.scale(d, d), y.translate(h, h), c.paintEdges(y, 0, 0,
|
|
4815
|
-
x:
|
|
4816
|
-
y:
|
|
4791
|
+
if (c.bevels && c.bevels.length > 0) for (let e of c.bevels) Ut(y, e, S(Math.ceil(e.widthPx) + 2));
|
|
4792
|
+
return c.paintEdges && (y.save(), y.scale(d, d), y.translate(h, h), c.paintEdges(y, 0, 0, a, o), y.restore()), ft(v, t, g, _, m.map((e) => ({
|
|
4793
|
+
x: r + e.x,
|
|
4794
|
+
y: i + e.y
|
|
4817
4795
|
}))), !0;
|
|
4818
4796
|
}
|
|
4819
|
-
function
|
|
4820
|
-
if (
|
|
4821
|
-
let u =
|
|
4797
|
+
function vr(t, n, r, i, a, o, s, c, l = 0) {
|
|
4798
|
+
if (i <= 0 || a <= 0 || o.length === 0) return !1;
|
|
4799
|
+
let u = t.getTransform(), d = Math.abs(u.a * u.d - u.b * u.c), f = d > 0 ? Math.sqrt(d) : 1, p = Math.max(0, Math.ceil(l * f)), m = p / f, h = Math.max(1, Math.ceil(i * f) + 2 * p), g = Math.max(1, Math.ceil(a * f) + 2 * p), _ = e(h, g);
|
|
4822
4800
|
if (!_) return !1;
|
|
4823
4801
|
let v = _.getContext("2d");
|
|
4824
4802
|
if (!v) return !1;
|
|
4825
|
-
v.save(), v.scale(f, f), v.translate(m, m), s(v, 0, 0,
|
|
4826
|
-
let y = Math.ceil(
|
|
4827
|
-
for (let e of
|
|
4803
|
+
v.save(), v.scale(f, f), v.translate(m, m), s(v, 0, 0, i, a), v.restore();
|
|
4804
|
+
let y = Math.ceil(i * f), b = Math.ceil(a * f);
|
|
4805
|
+
for (let e of o) {
|
|
4828
4806
|
let t = Math.ceil(e.widthPx) + 2;
|
|
4829
|
-
|
|
4807
|
+
Ut(v, e, {
|
|
4830
4808
|
x: p - t,
|
|
4831
4809
|
y: p - t,
|
|
4832
4810
|
w: y + 2 * t,
|
|
4833
4811
|
h: b + 2 * t
|
|
4834
4812
|
});
|
|
4835
4813
|
}
|
|
4836
|
-
return c && (v.save(), v.scale(f, f), v.translate(m, m), c(v, 0, 0,
|
|
4814
|
+
return c && (v.save(), v.scale(f, f), v.translate(m, m), c(v, 0, 0, i, a), v.restore()), t.drawImage(_, n - m, r - m, h / f, g / f), !0;
|
|
4837
4815
|
}
|
|
4838
|
-
var
|
|
4839
|
-
function
|
|
4840
|
-
let t =
|
|
4816
|
+
var yr = /* @__PURE__ */ new WeakMap();
|
|
4817
|
+
function br(e) {
|
|
4818
|
+
let t = yr.get(e);
|
|
4841
4819
|
return t || (t = async (t, n) => {
|
|
4842
4820
|
let r = await e(t);
|
|
4843
4821
|
return r.type === n ? r : new Blob([r], { type: n });
|
|
4844
|
-
},
|
|
4822
|
+
}, yr.set(e, t)), t;
|
|
4845
4823
|
}
|
|
4846
|
-
function
|
|
4847
|
-
return
|
|
4824
|
+
function xr(e, t, n = br(t)) {
|
|
4825
|
+
return U("base", e.posterPath, n, async () => {
|
|
4848
4826
|
let n = await t(e.posterPath), r = e.posterMimeType || n.type || "application/octet-stream";
|
|
4849
4827
|
return {
|
|
4850
|
-
bitmap: await
|
|
4828
|
+
bitmap: await s(n.type === r ? n : new Blob([n], { type: r })),
|
|
4851
4829
|
owned: !0
|
|
4852
4830
|
};
|
|
4853
4831
|
}).then((e) => {
|
|
@@ -4855,91 +4833,91 @@ function gr(e, t, n = hr(t)) {
|
|
|
4855
4833
|
return e;
|
|
4856
4834
|
});
|
|
4857
4835
|
}
|
|
4858
|
-
async function
|
|
4859
|
-
if (
|
|
4860
|
-
let
|
|
4861
|
-
if (
|
|
4862
|
-
|
|
4836
|
+
async function Sr(e, t, n, r, i) {
|
|
4837
|
+
if (i) try {
|
|
4838
|
+
let a = t.mimeType === "image/svg+xml", { widthPt: s, heightPt: c } = S(t.mimeType, t.srcRect, t.width / K, t.height / K), l;
|
|
4839
|
+
if (de(t)) try {
|
|
4840
|
+
l = await o(t.svgImagePath, i);
|
|
4863
4841
|
} catch {
|
|
4864
|
-
|
|
4865
|
-
widthPt:
|
|
4866
|
-
heightPt:
|
|
4842
|
+
l = a ? await o(t.imagePath, i) : await we(t.imagePath, t.mimeType, t.duotone, i, {
|
|
4843
|
+
widthPt: s,
|
|
4844
|
+
heightPt: c
|
|
4867
4845
|
});
|
|
4868
4846
|
}
|
|
4869
|
-
else
|
|
4870
|
-
widthPt:
|
|
4871
|
-
heightPt:
|
|
4847
|
+
else l = a ? await o(t.imagePath, i) : await we(t.imagePath, t.mimeType, t.duotone, i, {
|
|
4848
|
+
widthPt: s,
|
|
4849
|
+
heightPt: c
|
|
4872
4850
|
});
|
|
4873
|
-
if (!
|
|
4851
|
+
if (!l || r()) return;
|
|
4874
4852
|
e.save(), t.alpha != null && (e.globalAlpha *= t.alpha);
|
|
4875
|
-
let
|
|
4876
|
-
(t.rotation !== 0 || t.flipH || t.flipV) && (e.translate(
|
|
4877
|
-
let
|
|
4878
|
-
t.custGeom && t.custGeom.length > 0 ?
|
|
4879
|
-
},
|
|
4880
|
-
e.beginPath(),
|
|
4881
|
-
},
|
|
4882
|
-
(t.prstGeom || t.custGeom && t.custGeom.length > 0) && (
|
|
4883
|
-
}, _ = (e, r, i, a, o) => {
|
|
4884
|
-
t.stroke && (e.save(), br(e, t.stroke, n), h(e, r, i, a, o), e.stroke(), e.restore());
|
|
4853
|
+
let u = J(t.x, n), d = J(t.y, n), f = J(t.width, n), p = J(t.height, n);
|
|
4854
|
+
(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)));
|
|
4855
|
+
let m = x(l, t.srcRect), h = (e, n, r, i, a) => {
|
|
4856
|
+
t.custGeom && t.custGeom.length > 0 ? lr(e, t.custGeom, n, r, i, a) : t.prstGeom && y(e, t.prstGeom, n, r, i, a, t.prstAdjust ?? []) || e.rect(n, r, i, a);
|
|
4857
|
+
}, g = (e, t, n, r, i) => {
|
|
4858
|
+
e.beginPath(), h(e, t, n, r, i);
|
|
4859
|
+
}, _ = (e, n, r, i, a) => {
|
|
4860
|
+
(t.prstGeom || t.custGeom && t.custGeom.length > 0) && (g(e, n, r, i, a), e.clip());
|
|
4885
4861
|
}, v = (e, r, i, a, o) => {
|
|
4862
|
+
t.stroke && (e.save(), Q(e, t.stroke, n), g(e, r, i, a, o), e.stroke(), e.restore());
|
|
4863
|
+
}, b = (e, r, i, a, o) => {
|
|
4886
4864
|
let s = t.sp3d;
|
|
4887
4865
|
if (s && (s.contourW ?? 0) > 0 && s.contourClr) {
|
|
4888
4866
|
let t = Math.max(.5, s.contourW * n);
|
|
4889
4867
|
e.save(), e.beginPath();
|
|
4890
4868
|
let c = t * 2 + Math.max(a, o);
|
|
4891
|
-
e.rect(r - c, i - c, a + 2 * c, o + 2 * c),
|
|
4869
|
+
e.rect(r - c, i - c, a + 2 * c, o + 2 * c), h(e, r, i, a, o), e.clip("evenodd"), e.beginPath(), g(e, r, i, a, o), e.strokeStyle = Y(s.contourClr), e.lineWidth = t * 2, e.setLineDash([]), e.stroke(), e.restore();
|
|
4892
4870
|
}
|
|
4893
|
-
},
|
|
4894
|
-
e.save(),
|
|
4895
|
-
},
|
|
4896
|
-
|
|
4897
|
-
},
|
|
4898
|
-
|
|
4899
|
-
},
|
|
4900
|
-
if (
|
|
4901
|
-
if (
|
|
4902
|
-
bevels:
|
|
4903
|
-
extrusion:
|
|
4904
|
-
paintEdges:
|
|
4905
|
-
edgePadCss:
|
|
4871
|
+
}, C = t.scene3d && it(t.scene3d.camera) ? t.scene3d : null, w = (e, t, n, r, i) => {
|
|
4872
|
+
e.save(), _(e, t, n, r, i), m ? e.drawImage(l, m.sx, m.sy, m.sw, m.sh, t, n, r, i) : e.drawImage(l, t, n, r, i), e.restore();
|
|
4873
|
+
}, T = (e, t, n, r, i) => {
|
|
4874
|
+
w(e, t, n, r, i), v(e, t, n, r, i), b(e, t, n, r, i);
|
|
4875
|
+
}, E = (e, t, n, r, i) => {
|
|
4876
|
+
w(e, t, n, r, i), v(e, t, n, r, i);
|
|
4877
|
+
}, D = e.getTransform(), O = Math.abs(D.a * D.d - D.b * D.c), k = O > 0 ? Math.sqrt(O) : 1, A = hr(t.sp3d, t.scene3d?.lightRig, t.sp3d ? t.sp3d.prstMaterial : void 0, n, k), j = C ? gr(t.sp3d, C.camera, f, p, n, k) : null, M = t.stroke ? t.stroke.width * n / 2 : 0, N = t.sp3d?.contourW ? t.sp3d.contourW * n : 0, P = j ? Math.hypot(j.offsetX, j.offsetY) / k : 0, F = M + N + P + 2, I = (e) => {
|
|
4878
|
+
if (C) {
|
|
4879
|
+
if (_r(e, C.camera, u, d, f, p, E, {
|
|
4880
|
+
bevels: A,
|
|
4881
|
+
extrusion: j ?? void 0,
|
|
4882
|
+
paintEdges: b,
|
|
4883
|
+
edgePadCss: F
|
|
4906
4884
|
})) return;
|
|
4907
|
-
} else if (
|
|
4908
|
-
|
|
4909
|
-
},
|
|
4910
|
-
e.save(),
|
|
4911
|
-
},
|
|
4912
|
-
|
|
4913
|
-
},
|
|
4914
|
-
x:
|
|
4915
|
-
y:
|
|
4916
|
-
w:
|
|
4917
|
-
h:
|
|
4918
|
-
},
|
|
4919
|
-
t.reflection &&
|
|
4920
|
-
G(e),
|
|
4921
|
-
},
|
|
4922
|
-
G(e),
|
|
4923
|
-
},
|
|
4924
|
-
G(e),
|
|
4925
|
-
}), e.restore()) :
|
|
4926
|
-
G(e),
|
|
4927
|
-
},
|
|
4885
|
+
} else if (A.length > 0 && vr(e, u, d, f, p, A, E, b, F)) return;
|
|
4886
|
+
T(e, u, d, f, p);
|
|
4887
|
+
}, L = (e, t, n, r, i, a) => {
|
|
4888
|
+
e.save(), _(e, n, r, i, a), e.fillStyle = t, e.fillRect(n, r, i, a), e.restore();
|
|
4889
|
+
}, R = (e, t) => {
|
|
4890
|
+
C && _r(e, C.camera, u, d, f, p, (e, n, r, i, a) => L(e, t, n, r, i, a)) || L(e, t, u, d, f, p);
|
|
4891
|
+
}, z = e.canvas.width || 0, B = e.canvas.height || 0, V = e.getTransform(), H = Math.abs(V.a * V.d - V.b * V.c), U = H > 0 ? Math.sqrt(H) : 1, W = {
|
|
4892
|
+
x: u * U,
|
|
4893
|
+
y: d * U,
|
|
4894
|
+
w: f * U,
|
|
4895
|
+
h: p * U
|
|
4896
|
+
}, ee = n * U, G = (e) => e.setTransform(V), te = z > 0 && B > 0;
|
|
4897
|
+
t.reflection && te && (e.save(), e.setTransform(new DOMMatrix()), qe(e, (e) => {
|
|
4898
|
+
G(e), I(e);
|
|
4899
|
+
}, W, t.reflection, ee, z, B), e.restore()), t.shadow ? Gn(e, t.shadow, n) : t.glow && Kn(e, t.glow, n), t.softEdge && te ? (e.save(), e.setTransform(new DOMMatrix()), Ke(e, (e) => {
|
|
4900
|
+
G(e), I(e);
|
|
4901
|
+
}, W, t.softEdge, ee, z, B, (e) => {
|
|
4902
|
+
G(e), R(e, "#000");
|
|
4903
|
+
}), e.restore()) : I(e), (t.shadow || t.glow) && qn(e), t.innerShadow && te && (e.save(), e.setTransform(new DOMMatrix()), Ge(e, (e) => {
|
|
4904
|
+
G(e), R(e, "#000");
|
|
4905
|
+
}, W, t.innerShadow, ee, z, B), e.restore()), e.restore();
|
|
4928
4906
|
} catch (e) {
|
|
4929
|
-
if (
|
|
4907
|
+
if (p(e)) throw e;
|
|
4930
4908
|
}
|
|
4931
4909
|
}
|
|
4932
|
-
async function
|
|
4933
|
-
let
|
|
4934
|
-
if (t.posterPath &&
|
|
4935
|
-
d = await
|
|
4910
|
+
async function Cr(e, t, n, r, i, a, o) {
|
|
4911
|
+
let s = J(t.x, n), c = J(t.y, n), l = J(t.width, n), u = J(t.height, n), d;
|
|
4912
|
+
if (t.posterPath && i) try {
|
|
4913
|
+
d = await xr(t, i, o);
|
|
4936
4914
|
} catch (e) {
|
|
4937
|
-
if (
|
|
4915
|
+
if (p(e)) throw e;
|
|
4938
4916
|
}
|
|
4939
|
-
e.save(),
|
|
4917
|
+
r() || (e.save(), Tr(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 || Yt(e, s + l / 2, c + u / 2, l, u, "paused"), e.restore());
|
|
4940
4918
|
}
|
|
4941
|
-
function
|
|
4942
|
-
let o = Math.max(.5,
|
|
4919
|
+
function wr(e, t, n, r, i, a) {
|
|
4920
|
+
let o = Math.max(.5, J(r.width, a)), s = n.x - t.x, c = n.y - t.y, l = Math.hypot(s, c);
|
|
4943
4921
|
if (l === 0) return;
|
|
4944
4922
|
let u = -c / l, d = s / l, f;
|
|
4945
4923
|
switch (i) {
|
|
@@ -4988,38 +4966,38 @@ function yr(e, t, n, r, i, a) {
|
|
|
4988
4966
|
break;
|
|
4989
4967
|
default: return;
|
|
4990
4968
|
}
|
|
4991
|
-
e.save(), e.globalCompositeOperation = "destination-out", e.strokeStyle = "#000", e.lineWidth = o + .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 =
|
|
4969
|
+
e.save(), e.globalCompositeOperation = "destination-out", e.strokeStyle = "#000", e.lineWidth = o + .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 = Y(r.color);
|
|
4992
4970
|
for (let r of f) {
|
|
4993
4971
|
let i = u * (o * r.offset), a = d * (o * r.offset);
|
|
4994
4972
|
e.lineWidth = Math.max(.5, o * r.widthFrac), e.beginPath(), e.moveTo(t.x + i, t.y + a), e.lineTo(n.x + i, n.y + a), e.stroke();
|
|
4995
4973
|
}
|
|
4996
4974
|
e.restore();
|
|
4997
4975
|
}
|
|
4998
|
-
function
|
|
4999
|
-
|
|
4976
|
+
function Q(e, t, n) {
|
|
4977
|
+
f(e, t, n);
|
|
5000
4978
|
}
|
|
5001
|
-
function
|
|
4979
|
+
function Tr(e, t, n) {
|
|
5002
4980
|
if (t.rotation === 0 && !t.flipH && !t.flipV) return;
|
|
5003
|
-
let r =
|
|
4981
|
+
let r = J(t.x, n), i = J(t.y, n), a = J(t.width, n), o = J(t.height, n);
|
|
5004
4982
|
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));
|
|
5005
4983
|
}
|
|
5006
|
-
function
|
|
4984
|
+
function Er(e, t, n, r, i = {
|
|
5007
4985
|
themeMajorFont: null,
|
|
5008
4986
|
themeMinorFont: null,
|
|
5009
4987
|
dpr: 1
|
|
5010
4988
|
}) {
|
|
5011
|
-
e.save(),
|
|
5012
|
-
let a =
|
|
4989
|
+
e.save(), Tr(e, t, n);
|
|
4990
|
+
let a = J(t.x, n), o = J(t.y, n), s = t.cols.map((e) => J(e, n)), c = s.length, l = (e, t) => {
|
|
5013
4991
|
let n = 0;
|
|
5014
4992
|
for (let r = 0; r < t; r++) n += s[e + r] ?? 0;
|
|
5015
4993
|
return n;
|
|
5016
|
-
}, u = t.rows.map((e) =>
|
|
4994
|
+
}, u = t.rows.map((e) => J(e.height, n));
|
|
5017
4995
|
for (let a = 0; a < t.rows.length; a++) {
|
|
5018
4996
|
let o = t.rows[a];
|
|
5019
4997
|
for (let t = 0; t < o.cells.length; t++) {
|
|
5020
4998
|
let s = o.cells[t];
|
|
5021
4999
|
if (s.hMerge || s.vMerge || (s.rowSpan || 1) > 1 || !s.textBody) continue;
|
|
5022
|
-
let c = l(t, s.gridSpan || 1), d =
|
|
5000
|
+
let c = l(t, s.gridSpan || 1), d = mr(e, s.textBody, 0, 0, c, 0, n, null, 0, !1, !1, "#000000", r, i, void 0, !0) || 0;
|
|
5023
5001
|
d > u[a] && (u[a] = d);
|
|
5024
5002
|
}
|
|
5025
5003
|
}
|
|
@@ -5030,7 +5008,7 @@ function Sr(e, t, n, r, i = {
|
|
|
5030
5008
|
if (s.hMerge || s.vMerge) continue;
|
|
5031
5009
|
let c = s.rowSpan || 1;
|
|
5032
5010
|
if (c <= 1 || !s.textBody) continue;
|
|
5033
|
-
let d = l(t, s.gridSpan || 1), f =
|
|
5011
|
+
let d = l(t, s.gridSpan || 1), f = mr(e, s.textBody, 0, 0, d, 0, n, null, 0, !1, !1, "#000000", r, i, void 0, !0) || 0, p = 0;
|
|
5034
5012
|
for (let e = 0; e < c && a + e < u.length; e++) p += u[a + e];
|
|
5035
5013
|
if (f > p) {
|
|
5036
5014
|
let e = (f - p) / c;
|
|
@@ -5075,10 +5053,10 @@ function Sr(e, t, n, r, i = {
|
|
|
5075
5053
|
}
|
|
5076
5054
|
}
|
|
5077
5055
|
for (let { cell: t, colX: a, rowY: o, cellW: s, cellH: c } of h) {
|
|
5078
|
-
let l =
|
|
5056
|
+
let l = vn(t.fill);
|
|
5079
5057
|
if (l && (e.fillStyle = l, e.fillRect(a, o, s, c)), t.textBody) {
|
|
5080
|
-
let l = t.textColor ?
|
|
5081
|
-
|
|
5058
|
+
let l = t.textColor ? Y(t.textColor) : null;
|
|
5059
|
+
mr(e, t.textBody, a, o, s, c, n, l, 0, !1, !1, "#000000", r, i);
|
|
5082
5060
|
}
|
|
5083
5061
|
}
|
|
5084
5062
|
let _ = i.dpr, v = (e, t) => {
|
|
@@ -5086,8 +5064,8 @@ function Sr(e, t, n, r, i = {
|
|
|
5086
5064
|
let n = g[e][t];
|
|
5087
5065
|
return n < 0 ? null : h[n];
|
|
5088
5066
|
}, y = (t, r, i, a, o) => {
|
|
5089
|
-
|
|
5090
|
-
let s = r === a ?
|
|
5067
|
+
Q(e, t, n);
|
|
5068
|
+
let s = r === a ? G(r, e.lineWidth, _) : 0, c = i === o ? G(i, e.lineWidth, _) : 0;
|
|
5091
5069
|
e.beginPath(), e.moveTo(r + s, i + c), e.lineTo(a + s, o + c), e.stroke();
|
|
5092
5070
|
};
|
|
5093
5071
|
for (let r of h) {
|
|
@@ -5102,7 +5080,7 @@ function Sr(e, t, n, r, i = {
|
|
|
5102
5080
|
for (; a < n;) {
|
|
5103
5081
|
let r = g[e][a], o = a + 1;
|
|
5104
5082
|
for (; o < n && g[e][o] === r;) o++;
|
|
5105
|
-
let s = v(e, a), c =
|
|
5083
|
+
let s = v(e, a), c = on(i.borderB, s ? s.cell.borderT : null);
|
|
5106
5084
|
if (c) {
|
|
5107
5085
|
let e = p(a, o - a);
|
|
5108
5086
|
y(c, e, t, e + l(a, o - a), t);
|
|
@@ -5118,19 +5096,22 @@ function Sr(e, t, n, r, i = {
|
|
|
5118
5096
|
for (; t <= r.lastRi;) {
|
|
5119
5097
|
let n = g[t][x], i = t;
|
|
5120
5098
|
for (; i + 1 <= r.lastRi && g[i + 1][x] === n;) i++;
|
|
5121
|
-
let a = v(t, x), o =
|
|
5099
|
+
let a = v(t, x), o = on(h, a ? S(a.cell) : null);
|
|
5122
5100
|
o && y(o, e, m[t], e, m[i] + u[i]), t = i + 1;
|
|
5123
5101
|
}
|
|
5124
5102
|
}
|
|
5125
|
-
i.diagonalTL && (
|
|
5103
|
+
i.diagonalTL && (Q(e, i.diagonalTL, n), e.beginPath(), e.moveTo(a, o), e.lineTo(a + s, o + d), e.stroke()), i.diagonalTR && (Q(e, i.diagonalTR, n), e.beginPath(), e.moveTo(a + s, o), e.lineTo(a, o + d), e.stroke()), e.restore();
|
|
5126
5104
|
}
|
|
5127
5105
|
e.restore();
|
|
5128
5106
|
}
|
|
5129
|
-
function
|
|
5107
|
+
function Dr(e, t, n, r) {
|
|
5130
5108
|
e.save(), e.globalAlpha = t.opacity, e.fillStyle = t.color, e.fillRect(0, 0, n, r), e.restore();
|
|
5131
5109
|
}
|
|
5132
|
-
var
|
|
5133
|
-
function
|
|
5110
|
+
var Or = /* @__PURE__ */ new WeakMap();
|
|
5111
|
+
function kr(e) {
|
|
5112
|
+
Or.set(e, (Or.get(e) ?? 0) + 1);
|
|
5113
|
+
}
|
|
5114
|
+
function Ar(e, t, n, r, i) {
|
|
5134
5115
|
e.save(), e.fillStyle = "#f7f7f8", e.fillRect(0, 0, t, n);
|
|
5135
5116
|
let a = Math.max(12, Math.min(t, n) * .04);
|
|
5136
5117
|
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([]);
|
|
@@ -5150,76 +5131,248 @@ function Tr(e, t, n, r, i) {
|
|
|
5150
5131
|
for (let t of f.slice(0, 4)) e.fillText(t, o, h), h += m;
|
|
5151
5132
|
e.restore();
|
|
5152
5133
|
}
|
|
5153
|
-
async function
|
|
5154
|
-
let o = i.fetchImage ?? (i.fetchMedia ?
|
|
5134
|
+
async function jr(e, t, n, r, i = {}, a) {
|
|
5135
|
+
let o = i.fetchImage ?? (i.fetchMedia ? br(i.fetchMedia) : void 0), s = o ? v(o) : void 0;
|
|
5155
5136
|
try {
|
|
5156
|
-
return await
|
|
5137
|
+
return await Mr(e, t, n, r, i, a, o);
|
|
5157
5138
|
} finally {
|
|
5158
5139
|
s?.();
|
|
5159
5140
|
}
|
|
5160
5141
|
}
|
|
5161
|
-
async function
|
|
5162
|
-
let u = (
|
|
5163
|
-
|
|
5164
|
-
let d = () =>
|
|
5165
|
-
e.width =
|
|
5166
|
-
let
|
|
5167
|
-
if (!
|
|
5168
|
-
if (
|
|
5169
|
-
let
|
|
5142
|
+
async function Mr(e, t, r, i, a = {}, s, l) {
|
|
5143
|
+
let u = (Or.get(e) ?? 0) + 1;
|
|
5144
|
+
Or.set(e, u);
|
|
5145
|
+
let d = () => Or.get(e) !== u, f = a.width ?? ((R(e) ? e.offsetWidth : 0) || 960), m = f / r, h = Math.round(f), g = Math.round(i * m), _ = a.dpr ?? B(), v = ae(h * _, g * _), y = v.clamped ? _ * v.scale : _;
|
|
5146
|
+
e.width = v.width, e.height = v.height, R(e) && (e.style.width = `${h}px`, e.style.display || (e.style.display = "block"));
|
|
5147
|
+
let b = e.getContext("2d");
|
|
5148
|
+
if (!b) throw Error("Could not get 2D context");
|
|
5149
|
+
if (b.scale(y, y), t.parseError) return Ar(b, h, g, t.slideNumber, t.parseError), e;
|
|
5150
|
+
let x = a.defaultTextColor ? `#${a.defaultTextColor}` : "#000000", C = {
|
|
5170
5151
|
themeMajorFont: a.majorFont ?? null,
|
|
5171
5152
|
themeMinorFont: a.minorFont ?? null,
|
|
5172
5153
|
themeHlinkColor: a.hlinkColor ?? null,
|
|
5173
|
-
dpr:
|
|
5174
|
-
smartArtFallbackTextColor:
|
|
5154
|
+
dpr: y,
|
|
5155
|
+
smartArtFallbackTextColor: un(t.background, x)
|
|
5175
5156
|
};
|
|
5176
|
-
if (await
|
|
5177
|
-
let
|
|
5178
|
-
for (let e of
|
|
5157
|
+
if (await Vn(b, t.background, h, g, m, d, a.fetchImage), d() || (a.math && await En(t, a.math), d())) return e;
|
|
5158
|
+
let w = t.slideNumber;
|
|
5159
|
+
for (let e of t.elements) if (e.type === "picture" && a.fetchImage) {
|
|
5179
5160
|
let t = e, n = t.mimeType === "image/svg+xml";
|
|
5180
|
-
if (
|
|
5181
|
-
else if (n)
|
|
5161
|
+
if (de(t)) o(t.svgImagePath, a.fetchImage).catch(() => void 0);
|
|
5162
|
+
else if (n) o(t.imagePath, a.fetchImage).catch(() => void 0);
|
|
5182
5163
|
else {
|
|
5183
|
-
let e =
|
|
5184
|
-
|
|
5164
|
+
let e = S(t.mimeType, t.srcRect, t.width / K, t.height / K);
|
|
5165
|
+
we(t.imagePath, t.mimeType, t.duotone, a.fetchImage, {
|
|
5185
5166
|
widthPt: e.widthPt,
|
|
5186
5167
|
heightPt: e.heightPt
|
|
5187
5168
|
}).catch(() => void 0);
|
|
5188
5169
|
}
|
|
5189
5170
|
} else if (e.type === "media") {
|
|
5190
5171
|
let t = e;
|
|
5191
|
-
t.posterPath && a.fetchMedia &&
|
|
5172
|
+
t.posterPath && a.fetchMedia && xr(t, a.fetchMedia, l).catch(() => void 0);
|
|
5192
5173
|
}
|
|
5193
5174
|
if (a.fetchImage) {
|
|
5194
5175
|
let r = a.fetchImage, i = /* @__PURE__ */ new Set();
|
|
5195
|
-
for (let e of
|
|
5196
|
-
let e =
|
|
5176
|
+
for (let e of t.elements) if (!(e.type !== "shape" || !e.textBody)) for (let t of e.textBody.paragraphs) {
|
|
5177
|
+
let e = Ee(t.bullet);
|
|
5197
5178
|
e.type === "blip" && i.add(`${e.imagePath} ${e.mimeType}`);
|
|
5198
5179
|
}
|
|
5199
5180
|
if (i.size > 0 && (await Promise.all([...i].map((e) => {
|
|
5200
|
-
let [
|
|
5201
|
-
return t
|
|
5202
|
-
if (
|
|
5181
|
+
let [t, i] = e.split(" ");
|
|
5182
|
+
return n(t, i, r).catch((e) => {
|
|
5183
|
+
if (p(e)) throw e;
|
|
5203
5184
|
});
|
|
5204
5185
|
})), d())) return e;
|
|
5205
5186
|
}
|
|
5206
|
-
for (let
|
|
5187
|
+
for (let n of t.elements) {
|
|
5207
5188
|
if (d()) return e;
|
|
5208
|
-
if (
|
|
5209
|
-
else if (
|
|
5210
|
-
else if (
|
|
5211
|
-
else if (
|
|
5212
|
-
else if (
|
|
5213
|
-
let e =
|
|
5214
|
-
|
|
5215
|
-
x:
|
|
5216
|
-
y:
|
|
5217
|
-
w:
|
|
5218
|
-
h:
|
|
5219
|
-
}, e),
|
|
5189
|
+
if (n.type === "shape") cr(b, n, m, x, w, C, s, a.fetchImage);
|
|
5190
|
+
else if (n.type === "picture") await Sr(b, n, m, d, a.fetchImage);
|
|
5191
|
+
else if (n.type === "table") Er(b, n, m, w, C);
|
|
5192
|
+
else if (n.type === "media") await Cr(b, n, m, d, a.fetchMedia, a.skipMediaControls, a.fetchImage);
|
|
5193
|
+
else if (n.type === "chart") {
|
|
5194
|
+
let e = K * m;
|
|
5195
|
+
b.save(), Tr(b, n, m), c(b, n.chart, {
|
|
5196
|
+
x: J(n.x, m),
|
|
5197
|
+
y: J(n.y, m),
|
|
5198
|
+
w: J(n.width, m),
|
|
5199
|
+
h: J(n.height, m)
|
|
5200
|
+
}, e), b.restore();
|
|
5220
5201
|
}
|
|
5221
5202
|
}
|
|
5222
|
-
return d() || a.dim &&
|
|
5203
|
+
return d() || a.dim && Dr(b, a.dim, h, g), e;
|
|
5204
|
+
}
|
|
5205
|
+
//#endregion
|
|
5206
|
+
//#region packages/pptx/src/google-fonts.ts
|
|
5207
|
+
var Nr = {
|
|
5208
|
+
...ie,
|
|
5209
|
+
...M
|
|
5210
|
+
};
|
|
5211
|
+
Object.freeze({
|
|
5212
|
+
archiveEntryCount: 0,
|
|
5213
|
+
declaredInflatedBytes: 0,
|
|
5214
|
+
distinctInflatedBytes: 0,
|
|
5215
|
+
operationInflatedBytes: 0
|
|
5216
|
+
});
|
|
5217
|
+
function $(e, t) {
|
|
5218
|
+
if (e !== null && typeof e != "string") throw Error(`invalid PPTX presentation bootstrap ${t}`);
|
|
5219
|
+
}
|
|
5220
|
+
function Pr(e, t) {
|
|
5221
|
+
if (!e || typeof e != "object" || Array.isArray(e)) throw Error(`invalid PPTX presentation bootstrap slide at ${t}`);
|
|
5222
|
+
let n = e;
|
|
5223
|
+
if (n.index !== t) throw Error(`invalid PPTX presentation bootstrap slide index ${n.index}`);
|
|
5224
|
+
if (n.partName !== void 0 && typeof n.partName != "string") throw Error(`invalid PPTX presentation bootstrap slide partName at ${t}`);
|
|
5225
|
+
return Object.freeze({
|
|
5226
|
+
index: n.index,
|
|
5227
|
+
...n.partName === void 0 ? {} : { partName: n.partName }
|
|
5228
|
+
});
|
|
5229
|
+
}
|
|
5230
|
+
function Fr(e) {
|
|
5231
|
+
if (!e || typeof e != "object" || Array.isArray(e)) throw Error("invalid PPTX presentation bootstrap payload");
|
|
5232
|
+
let t = e;
|
|
5233
|
+
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");
|
|
5234
|
+
return $(t.defaultTextColor, "defaultTextColor"), $(t.majorFont, "majorFont"), $(t.minorFont, "minorFont"), $(t.hlinkColor, "hlinkColor"), $(t.folHlinkColor, "folHlinkColor"), Object.freeze({
|
|
5235
|
+
slideCount: t.slideCount,
|
|
5236
|
+
slideWidth: t.slideWidth,
|
|
5237
|
+
slideHeight: t.slideHeight,
|
|
5238
|
+
defaultTextColor: t.defaultTextColor,
|
|
5239
|
+
majorFont: t.majorFont,
|
|
5240
|
+
minorFont: t.minorFont,
|
|
5241
|
+
hlinkColor: t.hlinkColor,
|
|
5242
|
+
folHlinkColor: t.folHlinkColor,
|
|
5243
|
+
slides: Object.freeze(t.slides.map(Pr))
|
|
5244
|
+
});
|
|
5245
|
+
}
|
|
5246
|
+
function Ir(e) {
|
|
5247
|
+
return Object.freeze({
|
|
5248
|
+
type: "media",
|
|
5249
|
+
x: e.x,
|
|
5250
|
+
y: e.y,
|
|
5251
|
+
width: e.width,
|
|
5252
|
+
height: e.height,
|
|
5253
|
+
rotation: e.rotation,
|
|
5254
|
+
flipH: e.flipH,
|
|
5255
|
+
flipV: e.flipV,
|
|
5256
|
+
mediaKind: e.mediaKind,
|
|
5257
|
+
posterPath: e.posterPath,
|
|
5258
|
+
posterMimeType: e.posterMimeType,
|
|
5259
|
+
mediaPath: e.mediaPath,
|
|
5260
|
+
mimeType: e.mimeType
|
|
5261
|
+
});
|
|
5262
|
+
}
|
|
5263
|
+
function Lr(e, t) {
|
|
5264
|
+
if (!e || typeof e != "object" || Array.isArray(e)) throw Error(`invalid PPTX presentation preflight media at slide ${t}`);
|
|
5265
|
+
let n = e;
|
|
5266
|
+
for (let e of [
|
|
5267
|
+
"x",
|
|
5268
|
+
"y",
|
|
5269
|
+
"width",
|
|
5270
|
+
"height",
|
|
5271
|
+
"rotation"
|
|
5272
|
+
]) if (typeof n[e] != "number" || !Number.isFinite(n[e])) throw Error(`invalid PPTX presentation preflight media ${e} at slide ${t}`);
|
|
5273
|
+
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}`);
|
|
5274
|
+
return Ir(n);
|
|
5275
|
+
}
|
|
5276
|
+
function Rr(e) {
|
|
5277
|
+
if (!e || typeof e != "object" || Array.isArray(e)) throw Error("invalid PPTX presentation preflight payload");
|
|
5278
|
+
let t = e;
|
|
5279
|
+
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 || !Array.isArray(t.fontPreloadNames)) throw Error("invalid PPTX presentation preflight dimensions or slide count");
|
|
5280
|
+
$(t.defaultTextColor, "defaultTextColor"), $(t.majorFont, "majorFont"), $(t.minorFont, "minorFont"), $(t.hlinkColor, "hlinkColor"), $(t.folHlinkColor, "folHlinkColor");
|
|
5281
|
+
let n = t.slides.map((e, t) => {
|
|
5282
|
+
if (!e || typeof e != "object" || Array.isArray(e)) throw Error(`invalid PPTX presentation preflight slide at ${t}`);
|
|
5283
|
+
let n = e;
|
|
5284
|
+
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)) throw Error(`invalid PPTX presentation preflight slide fields at ${t}`);
|
|
5285
|
+
return Object.freeze({
|
|
5286
|
+
index: t,
|
|
5287
|
+
...n.partName === void 0 ? {} : { partName: n.partName },
|
|
5288
|
+
notes: n.notes,
|
|
5289
|
+
hidden: n.hidden,
|
|
5290
|
+
mediaElements: Object.freeze(n.mediaElements.map((e) => Lr(e, t)))
|
|
5291
|
+
});
|
|
5292
|
+
}), r = t.fontPreloadNames.map((e, t) => {
|
|
5293
|
+
if (e !== null && typeof e != "string") throw Error(`invalid PPTX presentation preflight font at ${t}`);
|
|
5294
|
+
return e;
|
|
5295
|
+
});
|
|
5296
|
+
return Object.freeze({
|
|
5297
|
+
slideCount: t.slideCount,
|
|
5298
|
+
slideWidth: t.slideWidth,
|
|
5299
|
+
slideHeight: t.slideHeight,
|
|
5300
|
+
defaultTextColor: t.defaultTextColor,
|
|
5301
|
+
majorFont: t.majorFont,
|
|
5302
|
+
minorFont: t.minorFont,
|
|
5303
|
+
hlinkColor: t.hlinkColor,
|
|
5304
|
+
folHlinkColor: t.folHlinkColor,
|
|
5305
|
+
slides: Object.freeze(n),
|
|
5306
|
+
fontPreloadNames: Object.freeze(r)
|
|
5307
|
+
});
|
|
5308
|
+
}
|
|
5309
|
+
function zr(e, t) {
|
|
5310
|
+
for (let n of e.slides) for (let e of n.mediaElements) {
|
|
5311
|
+
if (e.mediaPath === t) return e.mimeType;
|
|
5312
|
+
if (e.posterPath === t) return e.posterMimeType;
|
|
5313
|
+
}
|
|
5314
|
+
return "";
|
|
5315
|
+
}
|
|
5316
|
+
//#endregion
|
|
5317
|
+
//#region packages/pptx/src/slide-pull-client.ts
|
|
5318
|
+
var Br = 1024 * 1024, Vr = class {
|
|
5319
|
+
active = /* @__PURE__ */ new Set();
|
|
5320
|
+
nextSessionId = 1;
|
|
5321
|
+
constructor(e) {
|
|
5322
|
+
if (this.options = e, !Number.isSafeInteger(e.slideCount) || e.slideCount < 0) throw TypeError("slideCount must be a non-negative safe integer");
|
|
5323
|
+
if (e.generation !== void 0 && (!Number.isSafeInteger(e.generation) || e.generation <= 0)) throw TypeError("generation must be a positive safe integer");
|
|
5324
|
+
}
|
|
5325
|
+
async load(e, t = !0, n) {
|
|
5326
|
+
this.assertSlideIndex(e);
|
|
5327
|
+
let r = this.nextSessionId++, i = {
|
|
5328
|
+
sessionId: r,
|
|
5329
|
+
operationId: r,
|
|
5330
|
+
generation: this.options.generation ?? 1
|
|
5331
|
+
}, a = new h(this.options.transport, {
|
|
5332
|
+
...i,
|
|
5333
|
+
maxByteCredit: d,
|
|
5334
|
+
timeoutMs: n
|
|
5335
|
+
});
|
|
5336
|
+
this.active.add(a);
|
|
5337
|
+
try {
|
|
5338
|
+
await this.options.open(e, i, n);
|
|
5339
|
+
let r = await Ur(a);
|
|
5340
|
+
try {
|
|
5341
|
+
let e = r.usage ?? a.usageCheckpoint;
|
|
5342
|
+
e && this.options.onUsage?.(e);
|
|
5343
|
+
let n = t ? JSON.parse(new TextDecoder().decode(new Uint8Array(r.payload))) : void 0;
|
|
5344
|
+
return await r.ack(), n;
|
|
5345
|
+
} finally {
|
|
5346
|
+
r.disposeTransferred();
|
|
5347
|
+
}
|
|
5348
|
+
} catch (e) {
|
|
5349
|
+
throw await a.cancel("request-error").catch(() => void 0), e;
|
|
5350
|
+
} finally {
|
|
5351
|
+
this.active.delete(a);
|
|
5352
|
+
}
|
|
5353
|
+
}
|
|
5354
|
+
cancelAll() {
|
|
5355
|
+
for (let e of this.active) e.cancel("closed").catch(() => void 0);
|
|
5356
|
+
this.active.clear();
|
|
5357
|
+
}
|
|
5358
|
+
assertSlideIndex(e) {
|
|
5359
|
+
if (!Number.isSafeInteger(e) || e < 0 || e >= this.options.slideCount) throw RangeError(`Slide index ${e} out of range (count: ${this.options.slideCount})`);
|
|
5360
|
+
}
|
|
5361
|
+
};
|
|
5362
|
+
function Hr(e) {
|
|
5363
|
+
return !!e && typeof e == "object" && e.protocol === "ooxml-pull-v1";
|
|
5364
|
+
}
|
|
5365
|
+
async function Ur(e) {
|
|
5366
|
+
try {
|
|
5367
|
+
return await e.pull(Br);
|
|
5368
|
+
} catch (t) {
|
|
5369
|
+
let n = Wr(t);
|
|
5370
|
+
if (n === void 0) throw t;
|
|
5371
|
+
return e.pull(n);
|
|
5372
|
+
}
|
|
5373
|
+
}
|
|
5374
|
+
function Wr(e) {
|
|
5375
|
+
return N(e, Br, d);
|
|
5223
5376
|
}
|
|
5224
5377
|
//#endregion
|
|
5225
|
-
export {
|
|
5378
|
+
export { Rr as a, jr as c, Fr as i, Yt as l, Hr as n, Nr as o, zr as r, kr as s, Vr as t };
|