@silurus/ooxml 0.72.0 → 0.72.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/dist/{docx-BPF-eH0O.js → docx-CM-oHSyZ.js} +1397 -1339
- package/dist/docx.mjs +2 -2
- package/dist/docx_parser_bg.wasm +0 -0
- package/dist/{find-cursor-DTrEBxjE.js → find-cursor-CABDFafh.js} +1075 -1067
- package/dist/{highlight-rect-B--cPQOV.js → highlight-rect-DIReGC3z.js} +1 -1
- package/dist/index.mjs +3 -3
- package/dist/{pptx-BMxDfEYI.js → pptx-WoReGPPJ.js} +113 -107
- package/dist/pptx.mjs +2 -2
- package/dist/pptx_parser_bg.wasm +0 -0
- package/dist/render-worker-host-BNYGV6vm.js +27 -0
- package/dist/{render-worker-host-l8yqDUfE.js → render-worker-host-CJc3E4ej.js} +1 -1
- package/dist/render-worker-host-DcfYux0W.js +27 -0
- package/dist/{segments-Da-soh2U.js → segments-2VsQNClV.js} +1 -1
- package/dist/types/docx.d.ts +12 -0
- package/dist/types/index.d.ts +26 -0
- package/dist/types/pptx.d.ts +11 -0
- package/dist/types/xlsx.d.ts +3 -0
- package/dist/{visible-index-5hdq_oAL.js → visible-index-YRawP6W8.js} +1 -1
- package/dist/{xlsx-bwQD8c1Q.js → xlsx-CHfWgWy8.js} +5 -5
- package/dist/xlsx.mjs +2 -2
- package/dist/xlsx_parser_bg.wasm +0 -0
- package/package.json +1 -1
- package/dist/render-worker-host-DL_kkykF.js +0 -27
- package/dist/render-worker-host-S0HOWgs0.js +0 -27
|
@@ -235,13 +235,13 @@ function te(e, t, n, r, i, a) {
|
|
|
235
235
|
if (i < 0 || i + s > c.length) return null;
|
|
236
236
|
let o = Math.min(s, a.size - u);
|
|
237
237
|
l.set(c.subarray(i, i + o), u), u += o;
|
|
238
|
-
let h =
|
|
238
|
+
let h = P(e, t, n, r, m, d);
|
|
239
239
|
if (h === null) return null;
|
|
240
240
|
d = h;
|
|
241
241
|
}
|
|
242
242
|
return u === a.size ? l : null;
|
|
243
243
|
}
|
|
244
|
-
function
|
|
244
|
+
function P(e, t, n, r, i, a) {
|
|
245
245
|
let { sectorSize: o } = n, s = Math.floor(a / i), c = a % i, l = n.firstMiniFatSector, u = /* @__PURE__ */ new Set();
|
|
246
246
|
for (let n = 0; n < s; n++) {
|
|
247
247
|
if (!k(l) || u.has(l)) return null;
|
|
@@ -258,7 +258,7 @@ function ne(e, t, n, r, i, a) {
|
|
|
258
258
|
}
|
|
259
259
|
//#endregion
|
|
260
260
|
//#region packages/core/src/crypto/encryption-info.ts
|
|
261
|
-
function
|
|
261
|
+
function ne(e) {
|
|
262
262
|
if (typeof atob == "function") {
|
|
263
263
|
let t = atob(e), n = new Uint8Array(t.length);
|
|
264
264
|
for (let e = 0; e < t.length; e++) n[e] = t.charCodeAt(e);
|
|
@@ -268,19 +268,19 @@ function re(e) {
|
|
|
268
268
|
if (t) return new Uint8Array(t.from(e, "base64"));
|
|
269
269
|
throw Error("no base64 decoder available");
|
|
270
270
|
}
|
|
271
|
-
function
|
|
271
|
+
function F(e, t, n) {
|
|
272
272
|
let r = RegExp(`<(?:[\\w]+:)?${t}\\b[^>]*>`).exec(e);
|
|
273
273
|
if (!r) return null;
|
|
274
274
|
let i = r[0], a = RegExp(`\\b${n}\\s*=\\s*"([^"]*)"`).exec(i);
|
|
275
275
|
return a ? a[1] : null;
|
|
276
276
|
}
|
|
277
|
-
function
|
|
277
|
+
function I(e) {
|
|
278
278
|
if (e === null) return null;
|
|
279
279
|
let t = Number(e);
|
|
280
280
|
return Number.isFinite(t) ? t : null;
|
|
281
281
|
}
|
|
282
|
-
function
|
|
283
|
-
let n = F(
|
|
282
|
+
function L(e, t) {
|
|
283
|
+
let n = I(F(e, t, "saltSize")), r = I(F(e, t, "blockSize")), i = I(F(e, t, "keyBits")), a = I(F(e, t, "hashSize")), o = F(e, t, "cipherAlgorithm"), s = F(e, t, "cipherChaining"), c = F(e, t, "hashAlgorithm"), l = F(e, t, "saltValue");
|
|
284
284
|
return n === null || r === null || i === null || a === null || !o || !s || !c || l === null ? null : {
|
|
285
285
|
saltSize: n,
|
|
286
286
|
blockSize: r,
|
|
@@ -289,14 +289,14 @@ function I(e, t) {
|
|
|
289
289
|
cipherAlgorithm: o,
|
|
290
290
|
cipherChaining: s,
|
|
291
291
|
hashAlgorithm: c,
|
|
292
|
-
saltValue:
|
|
292
|
+
saltValue: ne(l)
|
|
293
293
|
};
|
|
294
294
|
}
|
|
295
|
-
function
|
|
295
|
+
function R(e) {
|
|
296
296
|
if (e.length < 8) return { kind: "unknown" };
|
|
297
297
|
let t = new DataView(e.buffer, e.byteOffset, e.byteLength), n = t.getUint16(0, !0), r = t.getUint16(2, !0);
|
|
298
298
|
if (n === 4 && r === 4) {
|
|
299
|
-
let t =
|
|
299
|
+
let t = z(e.subarray(8));
|
|
300
300
|
return t ? {
|
|
301
301
|
kind: "agile",
|
|
302
302
|
descriptor: t
|
|
@@ -304,21 +304,21 @@ function L(e) {
|
|
|
304
304
|
}
|
|
305
305
|
return r === 16 && (n === 3 || n === 4) ? { kind: "extensible" } : r === 2 && (n === 2 || n === 3 || n === 4) ? { kind: "standard" } : { kind: "unknown" };
|
|
306
306
|
}
|
|
307
|
-
function
|
|
308
|
-
let t = new TextDecoder("utf-8").decode(e), n =
|
|
307
|
+
function z(e) {
|
|
308
|
+
let t = new TextDecoder("utf-8").decode(e), n = L(t, "keyData"), r = L(t, "encryptedKey");
|
|
309
309
|
if (!n || !r) return null;
|
|
310
|
-
let i = F(
|
|
310
|
+
let i = I(F(t, "encryptedKey", "spinCount")), a = F(t, "encryptedKey", "encryptedVerifierHashInput"), o = F(t, "encryptedKey", "encryptedVerifierHashValue"), s = F(t, "encryptedKey", "encryptedKeyValue");
|
|
311
311
|
if (i === null || a === null || o === null || s === null) return null;
|
|
312
312
|
let c = {
|
|
313
313
|
...r,
|
|
314
314
|
spinCount: i,
|
|
315
|
-
encryptedVerifierHashInput:
|
|
316
|
-
encryptedVerifierHashValue:
|
|
317
|
-
encryptedKeyValue:
|
|
318
|
-
}, l = null, u =
|
|
315
|
+
encryptedVerifierHashInput: ne(a),
|
|
316
|
+
encryptedVerifierHashValue: ne(o),
|
|
317
|
+
encryptedKeyValue: ne(s)
|
|
318
|
+
}, l = null, u = F(t, "dataIntegrity", "encryptedHmacKey"), d = F(t, "dataIntegrity", "encryptedHmacValue");
|
|
319
319
|
return u !== null && d !== null && (l = {
|
|
320
|
-
encryptedHmacKey:
|
|
321
|
-
encryptedHmacValue:
|
|
320
|
+
encryptedHmacKey: ne(u),
|
|
321
|
+
encryptedHmacValue: ne(d)
|
|
322
322
|
}), {
|
|
323
323
|
keyData: n,
|
|
324
324
|
passwordKeyEncryptor: c,
|
|
@@ -327,7 +327,7 @@ function R(e) {
|
|
|
327
327
|
}
|
|
328
328
|
//#endregion
|
|
329
329
|
//#region packages/core/src/crypto/agile.ts
|
|
330
|
-
var
|
|
330
|
+
var B = {
|
|
331
331
|
verifierHashInput: new Uint8Array([
|
|
332
332
|
254,
|
|
333
333
|
167,
|
|
@@ -378,32 +378,32 @@ var z = {
|
|
|
378
378
|
132,
|
|
379
379
|
51
|
|
380
380
|
])
|
|
381
|
-
},
|
|
381
|
+
}, V = 54, H = 4096, U = class extends Error {
|
|
382
382
|
reason;
|
|
383
383
|
constructor(e, t) {
|
|
384
384
|
super(t), this.name = "AgileDecryptError", this.reason = e;
|
|
385
385
|
}
|
|
386
386
|
};
|
|
387
|
-
function
|
|
387
|
+
function W() {
|
|
388
388
|
let e = globalThis.crypto;
|
|
389
|
-
if (!e || !e.subtle) throw new
|
|
389
|
+
if (!e || !e.subtle) throw new U("unsupported-encryption", "WebCrypto (globalThis.crypto.subtle) is unavailable; cannot decrypt.");
|
|
390
390
|
return e.subtle;
|
|
391
391
|
}
|
|
392
|
-
function
|
|
392
|
+
function re(e) {
|
|
393
393
|
switch (e.toUpperCase().replace(/[-_]/g, "")) {
|
|
394
394
|
case "SHA512": return "SHA-512";
|
|
395
395
|
case "SHA384": return "SHA-384";
|
|
396
396
|
case "SHA256": return "SHA-256";
|
|
397
397
|
case "SHA1": return "SHA-1";
|
|
398
|
-
default: throw new
|
|
398
|
+
default: throw new U("unsupported-encryption", `Unsupported hashAlgorithm "${e}" (only SHA-1/256/384/512).`);
|
|
399
399
|
}
|
|
400
400
|
}
|
|
401
|
-
function
|
|
402
|
-
if (e.cipherAlgorithm.toUpperCase() !== "AES") throw new
|
|
403
|
-
if (e.cipherChaining.toLowerCase() !== "chainingmodecbc") throw new
|
|
404
|
-
if (e.keyBits !== 128 && e.keyBits !== 192 && e.keyBits !== 256) throw new
|
|
401
|
+
function G(e) {
|
|
402
|
+
if (e.cipherAlgorithm.toUpperCase() !== "AES") throw new U("unsupported-encryption", `Unsupported cipherAlgorithm "${e.cipherAlgorithm}" (only AES).`);
|
|
403
|
+
if (e.cipherChaining.toLowerCase() !== "chainingmodecbc") throw new U("unsupported-encryption", `Unsupported cipherChaining "${e.cipherChaining}" (only ChainingModeCBC).`);
|
|
404
|
+
if (e.keyBits !== 128 && e.keyBits !== 192 && e.keyBits !== 256) throw new U("unsupported-encryption", `Unsupported keyBits ${e.keyBits} (only 128/192/256).`);
|
|
405
405
|
}
|
|
406
|
-
function
|
|
406
|
+
function ie(...e) {
|
|
407
407
|
let t = e.reduce((e, t) => e + t.length, 0), n = new Uint8Array(t), r = 0;
|
|
408
408
|
for (let t of e) n.set(t, r), r += t.length;
|
|
409
409
|
return n;
|
|
@@ -418,29 +418,29 @@ function oe(e) {
|
|
|
418
418
|
return t;
|
|
419
419
|
}
|
|
420
420
|
async function se(e, t) {
|
|
421
|
-
return new Uint8Array(await
|
|
421
|
+
return new Uint8Array(await W().digest(e, t));
|
|
422
422
|
}
|
|
423
423
|
function ce(e, t) {
|
|
424
424
|
if (e.length > t) return e.slice(0, t);
|
|
425
425
|
let n = new Uint8Array(t);
|
|
426
|
-
return n.set(e), e.length < t && n.fill(
|
|
426
|
+
return n.set(e), e.length < t && n.fill(V, e.length), n;
|
|
427
427
|
}
|
|
428
428
|
async function le(e, t, n, r) {
|
|
429
|
-
let i =
|
|
430
|
-
for (let e = 0; e < n; e++) a = await se(i,
|
|
431
|
-
return ce(await se(i,
|
|
429
|
+
let i = re(t.hashAlgorithm), a = await se(i, ie(t.saltValue, oe(e)));
|
|
430
|
+
for (let e = 0; e < n; e++) a = await se(i, ie(ae(e), a));
|
|
431
|
+
return ce(await se(i, ie(a, r)), t.keyBits / 8);
|
|
432
432
|
}
|
|
433
433
|
async function K(e, t, n) {
|
|
434
|
-
return ce(n ? await se(
|
|
434
|
+
return ce(n ? await se(re(e.hashAlgorithm), ie(t, n)) : t, e.blockSize);
|
|
435
435
|
}
|
|
436
436
|
async function q(e, t, n) {
|
|
437
437
|
let r = t.length;
|
|
438
438
|
if (n.length === 0) return new Uint8Array();
|
|
439
|
-
if (n.length % r !== 0) throw new
|
|
440
|
-
let i = await
|
|
439
|
+
if (n.length % r !== 0) throw new U("corrupt", "ciphertext length is not a multiple of the block size");
|
|
440
|
+
let i = await W().importKey("raw", e, { name: "AES-CBC" }, !1, ["decrypt"]), a = await W().importKey("raw", e, { name: "AES-CBC" }, !1, ["encrypt"]), o = n.subarray(n.length - r), s = ue(new Uint8Array(r).fill(r), o), c = ie(n, new Uint8Array(await W().encrypt({
|
|
441
441
|
name: "AES-CBC",
|
|
442
442
|
iv: new Uint8Array(r)
|
|
443
|
-
}, a, s)).subarray(0, r)), l = new Uint8Array(await
|
|
443
|
+
}, a, s)).subarray(0, r)), l = new Uint8Array(await W().decrypt({
|
|
444
444
|
name: "AES-CBC",
|
|
445
445
|
iv: t
|
|
446
446
|
}, i, c));
|
|
@@ -452,8 +452,8 @@ function ue(e, t) {
|
|
|
452
452
|
return n;
|
|
453
453
|
}
|
|
454
454
|
async function J(e, t) {
|
|
455
|
-
|
|
456
|
-
let n =
|
|
455
|
+
G(t);
|
|
456
|
+
let n = re(t.hashAlgorithm), r = await q(await le(e, t, t.spinCount, B.verifierHashInput), await K(t, t.saltValue, null), t.encryptedVerifierHashInput), i = await q(await le(e, t, t.spinCount, B.verifierHashValue), await K(t, t.saltValue, null), t.encryptedVerifierHashValue);
|
|
457
457
|
return de((await se(n, r)).subarray(0, t.hashSize), i.subarray(0, t.hashSize));
|
|
458
458
|
}
|
|
459
459
|
function de(e, t) {
|
|
@@ -463,23 +463,23 @@ function de(e, t) {
|
|
|
463
463
|
return n === 0;
|
|
464
464
|
}
|
|
465
465
|
async function fe(e, t) {
|
|
466
|
-
return await q(await le(e, t, t.spinCount,
|
|
466
|
+
return await q(await le(e, t, t.spinCount, B.keyValue), await K(t, t.saltValue, null), t.encryptedKeyValue);
|
|
467
467
|
}
|
|
468
468
|
async function pe(e, t, n) {
|
|
469
|
-
if (
|
|
469
|
+
if (G(t), e.length < 8) throw new U("corrupt", "EncryptedPackage is shorter than its size prefix");
|
|
470
470
|
let r = new DataView(e.buffer, e.byteOffset, e.byteLength), i = Number(r.getBigUint64(0, !0)), a = e.subarray(8);
|
|
471
|
-
if (i > a.length) throw new
|
|
471
|
+
if (i > a.length) throw new U("corrupt", "EncryptedPackage size prefix exceeds the ciphertext");
|
|
472
472
|
let o = n.slice(0, t.keyBits / 8), s = new Uint8Array(i), c = 0, l = 0;
|
|
473
|
-
for (let e = 0; e < a.length; e +=
|
|
474
|
-
let n = a.subarray(e, e +
|
|
473
|
+
for (let e = 0; e < a.length; e += H) {
|
|
474
|
+
let n = a.subarray(e, e + H), r = await q(o, await K(t, t.saltValue, ae(l)), n), u = Math.min(r.length, i - c);
|
|
475
475
|
if (s.set(r.subarray(0, u), c), c += u, l++, c >= i) break;
|
|
476
476
|
}
|
|
477
|
-
if (c !== i) throw new
|
|
477
|
+
if (c !== i) throw new U("corrupt", "decrypted output is shorter than the declared size");
|
|
478
478
|
return s;
|
|
479
479
|
}
|
|
480
480
|
async function me(e, t, n) {
|
|
481
481
|
let { keyData: r, passwordKeyEncryptor: i } = e;
|
|
482
|
-
if (
|
|
482
|
+
if (G(r), G(i), !await J(n, i)) throw new U("invalid-password", "The supplied password is incorrect.");
|
|
483
483
|
return pe(t, r, await fe(n, i));
|
|
484
484
|
}
|
|
485
485
|
//#endregion
|
|
@@ -491,7 +491,7 @@ async function _e(e, t) {
|
|
|
491
491
|
ok: !1,
|
|
492
492
|
reason: "corrupt"
|
|
493
493
|
};
|
|
494
|
-
let i =
|
|
494
|
+
let i = R(n);
|
|
495
495
|
if (i.kind !== "agile") return {
|
|
496
496
|
ok: !1,
|
|
497
497
|
reason: "unsupported-encryption"
|
|
@@ -502,7 +502,7 @@ async function _e(e, t) {
|
|
|
502
502
|
data: await me(i.descriptor, r, t)
|
|
503
503
|
};
|
|
504
504
|
} catch (e) {
|
|
505
|
-
return e instanceof
|
|
505
|
+
return e instanceof U ? {
|
|
506
506
|
ok: !1,
|
|
507
507
|
reason: e.reason
|
|
508
508
|
} : {
|
|
@@ -1821,7 +1821,13 @@ function Kt(e, t) {
|
|
|
1821
1821
|
let n = Gt[e];
|
|
1822
1822
|
return n ? Bt(n, t) : [];
|
|
1823
1823
|
}
|
|
1824
|
-
|
|
1824
|
+
function qt(e, t) {
|
|
1825
|
+
let n = Kt(e, t);
|
|
1826
|
+
if (n.length > 0) return n;
|
|
1827
|
+
let r = e.trim().split(/[\s,]+/).map(Number);
|
|
1828
|
+
return r.length >= 2 && r.every((e) => Number.isFinite(e) && e >= 0) && r.some((e) => e > 0) ? (r.length % 2 != 0 && r.pop(), Bt(r, t)) : [];
|
|
1829
|
+
}
|
|
1830
|
+
var Jt = {
|
|
1825
1831
|
dotted: [1.5, 3],
|
|
1826
1832
|
dottedHeavy: [1.5, 3],
|
|
1827
1833
|
dash: [6, 3],
|
|
@@ -1857,31 +1863,31 @@ var qt = {
|
|
|
1857
1863
|
3
|
|
1858
1864
|
]
|
|
1859
1865
|
};
|
|
1860
|
-
function
|
|
1861
|
-
let n =
|
|
1866
|
+
function Yt(e, t) {
|
|
1867
|
+
let n = Jt[e];
|
|
1862
1868
|
return n ? Bt(n, t) : [];
|
|
1863
1869
|
}
|
|
1864
1870
|
//#endregion
|
|
1865
1871
|
//#region packages/core/src/shape/paint.ts
|
|
1866
|
-
function
|
|
1872
|
+
function Xt(e, t = 1) {
|
|
1867
1873
|
let n = e.charCodeAt(0) === 35 ? e.slice(1) : e;
|
|
1868
1874
|
return `rgba(${parseInt(n.slice(0, 2), 16)},${parseInt(n.slice(2, 4), 16)},${parseInt(n.slice(4, 6), 16)},${n.length >= 8 ? parseInt(n.slice(6, 8), 16) / 255 : t})`;
|
|
1869
1875
|
}
|
|
1870
|
-
function
|
|
1876
|
+
function Zt(e) {
|
|
1871
1877
|
let t = e.charCodeAt(0) === 35 ? e.slice(1) : e, n = parseInt(t.slice(0, 2), 16), r = parseInt(t.slice(2, 4), 16), i = parseInt(t.slice(4, 6), 16);
|
|
1872
1878
|
return .299 * n + .587 * r + .114 * i;
|
|
1873
1879
|
}
|
|
1874
|
-
function
|
|
1875
|
-
return e &&
|
|
1880
|
+
function Qt(e) {
|
|
1881
|
+
return e && Zt(e) < 128 ? "#FFFFFF" : "#000000";
|
|
1876
1882
|
}
|
|
1877
|
-
function
|
|
1883
|
+
function $t(e, t, n, r, i, a) {
|
|
1878
1884
|
if (!e || e.fillType === "none") return null;
|
|
1879
|
-
if (e.fillType === "solid") return
|
|
1880
|
-
if (e.fillType === "pattern") return
|
|
1885
|
+
if (e.fillType === "solid") return Xt(e.color);
|
|
1886
|
+
if (e.fillType === "pattern") return tn(e, t);
|
|
1881
1887
|
if (e.fillType === "gradient") {
|
|
1882
1888
|
let o = e.stops;
|
|
1883
1889
|
if (o.length === 0) return null;
|
|
1884
|
-
if (o.length === 1) return
|
|
1890
|
+
if (o.length === 1) return Xt(o[0].color);
|
|
1885
1891
|
let s;
|
|
1886
1892
|
if (e.gradType === "radial") {
|
|
1887
1893
|
let e = n + i / 2, o = r + a / 2, c = Math.sqrt(i * i + a * a) / 2;
|
|
@@ -1890,34 +1896,36 @@ function Qt(e, t, n, r, i, a) {
|
|
|
1890
1896
|
let o = e.angle * Math.PI / 180, c = n + i / 2, l = r + a / 2, u = (Math.abs(Math.cos(o)) * i + Math.abs(Math.sin(o)) * a) / 2;
|
|
1891
1897
|
s = t.createLinearGradient(c - Math.cos(o) * u, l - Math.sin(o) * u, c + Math.cos(o) * u, l + Math.sin(o) * u);
|
|
1892
1898
|
}
|
|
1893
|
-
for (let e of o) s.addColorStop(Math.min(1, Math.max(0, e.position)),
|
|
1899
|
+
for (let e of o) s.addColorStop(Math.min(1, Math.max(0, e.position)), Xt(e.color));
|
|
1894
1900
|
return s;
|
|
1895
1901
|
}
|
|
1896
1902
|
return null;
|
|
1897
1903
|
}
|
|
1898
|
-
var
|
|
1899
|
-
function
|
|
1900
|
-
let n = `${e.preset}|${e.fg}|${e.bg}`, r =
|
|
1901
|
-
r || (r = /* @__PURE__ */ new Map(),
|
|
1904
|
+
var en = /* @__PURE__ */ new WeakMap();
|
|
1905
|
+
function tn(e, t) {
|
|
1906
|
+
let n = `${e.preset}|${e.fg}|${e.bg}`, r = en.get(t);
|
|
1907
|
+
r || (r = /* @__PURE__ */ new Map(), en.set(t, r));
|
|
1902
1908
|
let i = r.get(n);
|
|
1903
1909
|
if (i) return i;
|
|
1904
1910
|
let a = Rt(e.preset, e.fg, e.bg);
|
|
1905
|
-
if (!a) return
|
|
1911
|
+
if (!a) return Xt(e.fg);
|
|
1906
1912
|
let o = t.createPattern(a, "repeat");
|
|
1907
|
-
return o ? (r.set(n, o), o) :
|
|
1913
|
+
return o ? (r.set(n, o), o) : Xt(e.fg);
|
|
1908
1914
|
}
|
|
1909
|
-
function
|
|
1915
|
+
function nn(e, t, n) {
|
|
1910
1916
|
if (!t) {
|
|
1911
|
-
e.strokeStyle = "transparent", e.lineWidth = 0, e.setLineDash([]);
|
|
1917
|
+
e.strokeStyle = "transparent", e.lineWidth = 0, e.setLineDash([]), e.lineCap = "butt";
|
|
1912
1918
|
return;
|
|
1913
1919
|
}
|
|
1914
|
-
e.strokeStyle =
|
|
1920
|
+
e.strokeStyle = Xt(t.color);
|
|
1915
1921
|
let r = Math.max(.5, t.width * n);
|
|
1916
|
-
e.lineWidth = r
|
|
1922
|
+
e.lineWidth = r;
|
|
1923
|
+
let i = t.dashStyle ? qt(t.dashStyle, r) : [], a = t.lineCap ?? "butt", o = i.some((e, t) => t % 2 == 0 && e === 0);
|
|
1924
|
+
e.lineCap = a === "butt" && o ? "square" : a, e.setLineDash(i);
|
|
1917
1925
|
}
|
|
1918
1926
|
//#endregion
|
|
1919
1927
|
//#region packages/core/src/chart/renderer.ts
|
|
1920
|
-
var
|
|
1928
|
+
var rn = [
|
|
1921
1929
|
"4472C4",
|
|
1922
1930
|
"ED7D31",
|
|
1923
1931
|
"A9D18E",
|
|
@@ -1931,81 +1939,81 @@ var nn = [
|
|
|
1931
1939
|
"255E91",
|
|
1932
1940
|
"967300"
|
|
1933
1941
|
];
|
|
1934
|
-
function rn(e, t) {
|
|
1935
|
-
return t?.color ? `#${t.color}` : `#${nn[e % nn.length]}`;
|
|
1936
|
-
}
|
|
1937
1942
|
function an(e, t) {
|
|
1938
|
-
|
|
1939
|
-
return n ? `#${n}` : `#${nn[e % nn.length]}`;
|
|
1943
|
+
return t?.color ? `#${t.color}` : `#${rn[e % rn.length]}`;
|
|
1940
1944
|
}
|
|
1941
1945
|
function on(e, t) {
|
|
1946
|
+
let n = t.dataPointColors?.[e];
|
|
1947
|
+
return n ? `#${n}` : `#${rn[e % rn.length]}`;
|
|
1948
|
+
}
|
|
1949
|
+
function sn(e, t) {
|
|
1942
1950
|
let n = e.startsWith("#") ? e.slice(1) : e;
|
|
1943
1951
|
if (n.length < 6) return `#${n}`;
|
|
1944
1952
|
let r = Math.max(0, Math.min(1, t)), i = Math.round(parseInt(n.slice(0, 2), 16) * r), a = Math.round(parseInt(n.slice(2, 4), 16) * r), o = Math.round(parseInt(n.slice(4, 6), 16) * r), s = (e) => e.toString(16).padStart(2, "0");
|
|
1945
1953
|
return `#${s(i)}${s(a)}${s(o)}`;
|
|
1946
1954
|
}
|
|
1947
|
-
function
|
|
1955
|
+
function cn(e, t) {
|
|
1948
1956
|
return t && (t.startsWith("+mj") ? e.themeMajorFontLatin ?? null : t.startsWith("+mn") ? e.themeMinorFontLatin ?? null : t);
|
|
1949
1957
|
}
|
|
1950
1958
|
function X(e, t, n) {
|
|
1951
|
-
let r = n === "major" ? e.themeMajorFontLatin : e.themeMinorFontLatin, i =
|
|
1959
|
+
let r = n === "major" ? e.themeMajorFontLatin : e.themeMinorFontLatin, i = cn(e, t) ?? r;
|
|
1952
1960
|
return i ? `"${i}", Calibri, Arial, sans-serif` : "sans-serif";
|
|
1953
1961
|
}
|
|
1954
|
-
function
|
|
1962
|
+
function ln(e) {
|
|
1955
1963
|
return e === "pie" || e === "doughnut";
|
|
1956
1964
|
}
|
|
1957
|
-
function
|
|
1965
|
+
function un(e) {
|
|
1958
1966
|
return !!e.varyColors && e.series.length === 1 && typeof e.chartType == "string" && /Bar/.test(e.chartType);
|
|
1959
1967
|
}
|
|
1960
|
-
function
|
|
1961
|
-
if (r ||
|
|
1968
|
+
function dn(e, t, n, r = !1) {
|
|
1969
|
+
if (r || ln(e)) {
|
|
1962
1970
|
let e = t[0];
|
|
1963
|
-
return e ?
|
|
1971
|
+
return e ? on(n, e) : `#${rn[n % rn.length]}`;
|
|
1964
1972
|
}
|
|
1965
|
-
return
|
|
1973
|
+
return an(n, t[n]);
|
|
1966
1974
|
}
|
|
1967
|
-
function
|
|
1975
|
+
function fn(e, t, n, r, i, a, o, s, c, l = "sans-serif") {
|
|
1968
1976
|
e.save(), e.font = `${o ? "bold " : ""}${a}px ${l}`, e.fillStyle = s;
|
|
1969
1977
|
let u = Pt(e, t, c);
|
|
1970
1978
|
i === "cat" ? (e.textAlign = "center", e.textBaseline = "middle", e.fillText(u, n, r)) : (e.translate(n, r), e.rotate(-Math.PI / 2), e.textAlign = "center", e.textBaseline = "middle", e.fillText(u, 0, 0)), e.restore();
|
|
1971
1979
|
}
|
|
1972
|
-
function
|
|
1980
|
+
function pn(e) {
|
|
1973
1981
|
return e ? `#${e}` : "#555";
|
|
1974
1982
|
}
|
|
1975
|
-
function
|
|
1983
|
+
function mn(e, t, n, r, i, a, o, s, c, l, u, d, f, p) {
|
|
1976
1984
|
if (t.valAxisTitle) {
|
|
1977
1985
|
let r = n + u + Xe(i) + p / 2, a = s + l / 2;
|
|
1978
|
-
|
|
1986
|
+
fn(e, t.valAxisTitle, r, a, "val", p, t.valAxisTitleFontBold ?? !0, pn(t.valAxisTitleFontColor), l, X(t, t.valAxisTitleFontFace, "major"));
|
|
1979
1987
|
}
|
|
1980
1988
|
if (t.catAxisTitle) {
|
|
1981
1989
|
let n = o + c / 2, i = r + a - d - Xe(a) - f / 2;
|
|
1982
|
-
|
|
1990
|
+
fn(e, t.catAxisTitle, n, i, "cat", f, t.catAxisTitleFontBold ?? !0, pn(t.catAxisTitleFontColor), c, X(t, t.catAxisTitleFontFace, "major"));
|
|
1983
1991
|
}
|
|
1984
1992
|
}
|
|
1985
|
-
function
|
|
1993
|
+
function hn(e) {
|
|
1986
1994
|
return e && (e === "line" || e === "stackedLine" || e === "stackedLinePct" || e === "radar" || e === "scatter" || e === "stock") ? "line" : "fill";
|
|
1987
1995
|
}
|
|
1988
|
-
function
|
|
1996
|
+
function gn(e, t, n) {
|
|
1989
1997
|
if (e !== "scatter") return !1;
|
|
1990
1998
|
let r = t ?? "marker";
|
|
1991
1999
|
return (r === "line" || r === "lineMarker" || r === "lineNoMarker" || r === "smooth" || r === "smoothMarker" || r === "smoothNoMarker") && n.lineHidden !== !0;
|
|
1992
2000
|
}
|
|
1993
|
-
function
|
|
2001
|
+
function _n(e, t, n, r) {
|
|
1994
2002
|
if (e !== "scatter") return null;
|
|
1995
2003
|
let i = n[r];
|
|
1996
|
-
if (!i ||
|
|
2004
|
+
if (!i || gn(e, t, i)) return null;
|
|
1997
2005
|
let a = i.markerSymbol ?? "circle";
|
|
1998
2006
|
if (a === "none") return null;
|
|
1999
|
-
let o =
|
|
2007
|
+
let o = an(r, i);
|
|
2000
2008
|
return {
|
|
2001
2009
|
symbol: a,
|
|
2002
2010
|
fill: i.markerFill ?? o.replace(/^#/, ""),
|
|
2003
2011
|
line: i.markerLine ?? null
|
|
2004
2012
|
};
|
|
2005
2013
|
}
|
|
2006
|
-
function
|
|
2014
|
+
function vn(e, t, n, r, i, a, o, s = null) {
|
|
2007
2015
|
if (s) {
|
|
2008
|
-
|
|
2016
|
+
tr(e, r + a / 2, i + o / 2, s.symbol, o, s.fill, s.line, 1);
|
|
2009
2017
|
return;
|
|
2010
2018
|
}
|
|
2011
2019
|
if (e.fillStyle = n, t === "line") {
|
|
@@ -2016,43 +2024,43 @@ function _n(e, t, n, r, i, a, o, s = null) {
|
|
|
2016
2024
|
e.moveTo(r, s), e.lineTo(r + a, s), e.stroke(), e.lineWidth = t;
|
|
2017
2025
|
} else e.fillRect(r, i, a, o);
|
|
2018
2026
|
}
|
|
2019
|
-
function
|
|
2020
|
-
if (r ||
|
|
2027
|
+
function yn(e, t, n, r = !1) {
|
|
2028
|
+
if (r || ln(t)) {
|
|
2021
2029
|
let n = e[0], i = n ? n.values.length : 0, a = n?.categories ?? [];
|
|
2022
2030
|
return Array.from({ length: i }, (n, i) => ({
|
|
2023
2031
|
label: (a[i] ?? `Item ${i + 1}`).toString(),
|
|
2024
|
-
color:
|
|
2032
|
+
color: dn(t, e, i, r),
|
|
2025
2033
|
marker: null
|
|
2026
2034
|
}));
|
|
2027
2035
|
}
|
|
2028
2036
|
return e.map((r, i) => ({
|
|
2029
2037
|
label: r.name || `Series ${i + 1}`,
|
|
2030
|
-
color:
|
|
2031
|
-
marker:
|
|
2038
|
+
color: dn(t, e, i),
|
|
2039
|
+
marker: _n(t, n, e, i)
|
|
2032
2040
|
}));
|
|
2033
2041
|
}
|
|
2034
|
-
var
|
|
2042
|
+
var bn = {
|
|
2035
2043
|
fontFamily: "sans-serif",
|
|
2036
2044
|
color: "#333",
|
|
2037
2045
|
bold: !1,
|
|
2038
2046
|
sizePx: null
|
|
2039
2047
|
};
|
|
2040
|
-
function
|
|
2041
|
-
let d =
|
|
2048
|
+
function xn(e, t, n, r, i, a, o = "vertical", s, c = bn, l, u = !1) {
|
|
2049
|
+
let d = hn(s), f = yn(t, s, l, u), p = c.bold ? "bold " : "";
|
|
2042
2050
|
if (o === "horizontal") {
|
|
2043
2051
|
let t = c.sizePx ?? Math.max(9, Math.min(12, a * .7));
|
|
2044
2052
|
e.font = `${p}${t}px ${c.fontFamily}`, e.textBaseline = "middle";
|
|
2045
2053
|
let o = Math.max(1, f.length), s = i - 10 - 4, l = f.map((t) => Pt(e, t.label, s)), u = l.map((t) => 14 + e.measureText(t).width), m = n + (i - (u.reduce((e, t) => e + t, 0) + 12 * (o - 1))) / 2, h = r + a / 2;
|
|
2046
|
-
for (let n = 0; n < f.length; n++)
|
|
2054
|
+
for (let n = 0; n < f.length; n++) vn(e, d, f[n].color, m, h - t / 2, 10, t, f[n].marker), e.fillStyle = c.color, e.textAlign = "left", e.fillText(l[n], m + 10 + 4, h), m += u[n] + 12;
|
|
2047
2055
|
return;
|
|
2048
2056
|
}
|
|
2049
2057
|
let m = c.sizePx ?? Math.max(9, Math.min(12, a / (f.length + 1)));
|
|
2050
2058
|
e.font = `${p}${m}px ${c.fontFamily}`, e.textBaseline = "middle";
|
|
2051
2059
|
let h = m + 4, g = i - 10 - 4, _ = r + (a - h * f.length) / 2;
|
|
2052
|
-
for (let t = 0; t < f.length; t++)
|
|
2060
|
+
for (let t = 0; t < f.length; t++) vn(e, d, f[t].color, n, _, 10, m, f[t].marker), e.fillStyle = c.color, e.textAlign = "left", e.fillText(Pt(e, f[t].label, g), n + 10 + 4, _ + m / 2), _ += h;
|
|
2053
2061
|
}
|
|
2054
|
-
function
|
|
2055
|
-
let t =
|
|
2062
|
+
function Sn(e) {
|
|
2063
|
+
let t = cn(e, e.legendFontFace) ?? e.themeMinorFontLatin;
|
|
2056
2064
|
return {
|
|
2057
2065
|
fontFamily: t ? `"${t}", Calibri, Arial, sans-serif` : "sans-serif",
|
|
2058
2066
|
color: e.legendFontColor ? `#${e.legendFontColor}` : "#333",
|
|
@@ -2060,30 +2068,30 @@ function xn(e) {
|
|
|
2060
2068
|
sizePx: e.legendFontSizeHpt == null ? null : e.legendFontSizeHpt / 100
|
|
2061
2069
|
};
|
|
2062
2070
|
}
|
|
2063
|
-
function
|
|
2071
|
+
function Cn(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
2064
2072
|
if (!n) return;
|
|
2065
|
-
let f =
|
|
2073
|
+
let f = Sn(t), p = un(t), m = t.legendManualLayout;
|
|
2066
2074
|
if (m && m.xMode === "edge" && m.yMode === "edge" && m.w > 0 && m.h > 0) {
|
|
2067
2075
|
let n = r + m.x * a, s = i + m.y * o, c = m.w * a, l = m.h * o, u = c >= l ? "horizontal" : "vertical";
|
|
2068
|
-
|
|
2076
|
+
xn(e, t.series, n, s, c, l, u, t.chartType, f, t.scatterStyle, p);
|
|
2069
2077
|
return;
|
|
2070
2078
|
}
|
|
2071
2079
|
switch (n.side) {
|
|
2072
2080
|
case "r":
|
|
2073
|
-
|
|
2081
|
+
xn(e, t.series, r + a - n.reserveW + 4, c, n.reserveW - 8, u, "vertical", t.chartType, f, t.scatterStyle, p);
|
|
2074
2082
|
break;
|
|
2075
2083
|
case "l":
|
|
2076
|
-
|
|
2084
|
+
xn(e, t.series, r + 4, c, n.reserveW - 8, u, "vertical", t.chartType, f, t.scatterStyle, p);
|
|
2077
2085
|
break;
|
|
2078
2086
|
case "t":
|
|
2079
|
-
|
|
2087
|
+
xn(e, t.series, s, i + d, l, n.reserveH, "horizontal", t.chartType, f, t.scatterStyle, p);
|
|
2080
2088
|
break;
|
|
2081
2089
|
case "b":
|
|
2082
|
-
|
|
2090
|
+
xn(e, t.series, s, i + o - n.reserveH, l, n.reserveH, "horizontal", t.chartType, f, t.scatterStyle, p);
|
|
2083
2091
|
break;
|
|
2084
2092
|
}
|
|
2085
2093
|
}
|
|
2086
|
-
function
|
|
2094
|
+
function wn(e, t, n, r, i, a, o, s = !1) {
|
|
2087
2095
|
if (t === "none" || !t) return;
|
|
2088
2096
|
let c = o ? Math.max(4, o + 2) : 4, l = e.strokeStyle, u = e.lineWidth;
|
|
2089
2097
|
if (e.strokeStyle = a ?? "#888", e.lineWidth = o ?? 1, e.beginPath(), n === "val") {
|
|
@@ -2095,10 +2103,10 @@ function Cn(e, t, n, r, i, a, o, s = !1) {
|
|
|
2095
2103
|
}
|
|
2096
2104
|
e.stroke(), e.strokeStyle = l, e.lineWidth = u;
|
|
2097
2105
|
}
|
|
2098
|
-
function
|
|
2106
|
+
function Tn(e, t, n, r, i, a) {
|
|
2099
2107
|
a && a.explicit ? (e.strokeStyle = a.color, e.lineWidth = a.width) : (e.strokeStyle = i ? "#aaa" : a?.color ?? "#e0e0e0", e.lineWidth = i ? 1 : a?.width ?? .5), e.beginPath(), e.moveTo(t, r), e.lineTo(t + n, r), e.stroke();
|
|
2100
2108
|
}
|
|
2101
|
-
function
|
|
2109
|
+
function En(e, t) {
|
|
2102
2110
|
let { color: n, width: r } = _t(e.valAxisGridlineColor, e.valAxisGridlineWidthEmu, t);
|
|
2103
2111
|
return {
|
|
2104
2112
|
color: n,
|
|
@@ -2106,29 +2114,29 @@ function Tn(e, t) {
|
|
|
2106
2114
|
explicit: e.valAxisGridlineColor != null
|
|
2107
2115
|
};
|
|
2108
2116
|
}
|
|
2109
|
-
function
|
|
2117
|
+
function Dn(e) {
|
|
2110
2118
|
return e.catAxisMajorGridlines === !0;
|
|
2111
2119
|
}
|
|
2112
|
-
function
|
|
2120
|
+
function On(e, t) {
|
|
2113
2121
|
return _t(e.catAxisGridlineColor, e.catAxisGridlineWidthEmu, t);
|
|
2114
2122
|
}
|
|
2115
|
-
function
|
|
2123
|
+
function kn(e, t) {
|
|
2116
2124
|
if (t <= 0) return [];
|
|
2117
2125
|
let n = vt(e), r = [], i = n ? t : t - 1;
|
|
2118
2126
|
for (let e = 0; e <= i; e++) r.push(n ? e / t : t === 1 ? .5 : e / (t - 1));
|
|
2119
2127
|
return r;
|
|
2120
2128
|
}
|
|
2121
|
-
function
|
|
2129
|
+
function An(e) {
|
|
2122
2130
|
return e.valAxisOrientation === "maxMin";
|
|
2123
2131
|
}
|
|
2124
|
-
function
|
|
2132
|
+
function jn(e) {
|
|
2125
2133
|
return e.catAxisOrientation === "maxMin";
|
|
2126
2134
|
}
|
|
2127
|
-
function
|
|
2135
|
+
function Mn(e) {
|
|
2128
2136
|
return e.valAxisMajorGridlines !== !1;
|
|
2129
2137
|
}
|
|
2130
|
-
function
|
|
2131
|
-
let i =
|
|
2138
|
+
function Nn(e, t, n, r) {
|
|
2139
|
+
let i = An(e), a = e.valAxisLogBase;
|
|
2132
2140
|
if (a != null && isFinite(a) && a >= 2) {
|
|
2133
2141
|
let { min: r, max: o, lines: s } = ut(t, n, a, e.valMin, e.valMax);
|
|
2134
2142
|
return {
|
|
@@ -2156,7 +2164,7 @@ function Mn(e, t, n, r) {
|
|
|
2156
2164
|
frac: (e) => i ? 1 - (e - o) / l : (e - o) / l
|
|
2157
2165
|
};
|
|
2158
2166
|
}
|
|
2159
|
-
function
|
|
2167
|
+
function Pn(e, t, n, r, i, a) {
|
|
2160
2168
|
let o = t.trendLines;
|
|
2161
2169
|
if (!o || o.length === 0) return;
|
|
2162
2170
|
let s = [], c = [];
|
|
@@ -2186,25 +2194,25 @@ function Nn(e, t, n, r, i, a) {
|
|
|
2186
2194
|
}
|
|
2187
2195
|
e.setLineDash(l);
|
|
2188
2196
|
}
|
|
2189
|
-
function
|
|
2197
|
+
function Fn(e, t, n) {
|
|
2190
2198
|
return e ? e / 100 * n : Math.max(8, t * .045);
|
|
2191
2199
|
}
|
|
2192
|
-
function
|
|
2200
|
+
function In(e) {
|
|
2193
2201
|
return e.catAxisTickLabelPos !== "none";
|
|
2194
2202
|
}
|
|
2195
|
-
var
|
|
2196
|
-
function
|
|
2203
|
+
var Ln = 54e5;
|
|
2204
|
+
function Rn(e) {
|
|
2197
2205
|
let t = e.catAxisLabelRotation;
|
|
2198
|
-
return t == null || t === 0 || Math.abs(t) >
|
|
2206
|
+
return t == null || t === 0 || Math.abs(t) > Ln ? 0 : t / 6e4 * (Math.PI / 180);
|
|
2199
2207
|
}
|
|
2200
|
-
function
|
|
2208
|
+
function zn(e, t, n, r, i) {
|
|
2201
2209
|
if (i === 0) {
|
|
2202
2210
|
e.fillText(t, n, r);
|
|
2203
2211
|
return;
|
|
2204
2212
|
}
|
|
2205
2213
|
e.save(), e.translate(n, r), e.rotate(i), e.textAlign = "right", e.textBaseline = "middle", e.fillText(t, 0, 0), e.restore();
|
|
2206
2214
|
}
|
|
2207
|
-
function
|
|
2215
|
+
function Bn(e, t, n) {
|
|
2208
2216
|
if (!e) return null;
|
|
2209
2217
|
let r = [];
|
|
2210
2218
|
for (let e of t) if (e.useSecondaryAxis === !0) for (let t of e.values) t != null && r.push(t);
|
|
@@ -2216,14 +2224,14 @@ function zn(e, t, n) {
|
|
|
2216
2224
|
makeToY: (e, t) => (n) => e + t - (n - o) / l * t
|
|
2217
2225
|
};
|
|
2218
2226
|
}
|
|
2219
|
-
function
|
|
2227
|
+
function Vn(e, t, n, r, i, a, o, s, c, l, u, d, f, p) {
|
|
2220
2228
|
let m = i + o, { color: h, width: g } = gt(t.lineColor, t.lineWidthEmu, l);
|
|
2221
2229
|
if (t.lineHidden || (e.strokeStyle = h, e.lineWidth = g, e.beginPath(), e.moveTo(m, a), e.lineTo(m, a + s), e.stroke()), !t.hidden) {
|
|
2222
2230
|
e.font = `${u}px sans-serif`, e.fillStyle = t.fontColor ? `#${t.fontColor}` : f, e.textAlign = "left", e.textBaseline = "middle";
|
|
2223
2231
|
let i = n.max - n.min || 1, a = Math.max(1, Math.round(i / n.step));
|
|
2224
2232
|
for (let i = 0; i <= a; i++) {
|
|
2225
2233
|
let a = n.min + i * n.step, o = r(a);
|
|
2226
|
-
|
|
2234
|
+
wn(e, t.majorTickMark, "val", m, o, h, g, !0), e.fillText(Y(a, t.formatCode ?? null, p), m + 14, o);
|
|
2227
2235
|
}
|
|
2228
2236
|
}
|
|
2229
2237
|
if (t.title) {
|
|
@@ -2231,12 +2239,12 @@ function Bn(e, t, n, r, i, a, o, s, c, l, u, d, f, p) {
|
|
|
2231
2239
|
e.save(), e.fillStyle = t.titleFontColor ? `#${t.titleFontColor}` : t.fontColor ? `#${t.fontColor}` : "#555", e.font = `${t.titleFontBold ? "bold " : ""}${n}px sans-serif`, e.textAlign = "center", e.textBaseline = "middle", e.translate(i + o + d + n * .6, a + s / 2), e.rotate(Math.PI / 2), e.fillText(t.title, 0, 0), e.restore();
|
|
2232
2240
|
}
|
|
2233
2241
|
}
|
|
2234
|
-
function
|
|
2242
|
+
function Hn(e, t, n, r, i, a) {
|
|
2235
2243
|
if (!t.title) return;
|
|
2236
|
-
let o =
|
|
2244
|
+
let o = cn(t, t.titleFontFace), s = o ? `"${o}", Calibri, Arial, sans-serif` : "Calibri, Arial, sans-serif";
|
|
2237
2245
|
e.font = `${t.titleFontBold ?? !0 ? "bold " : ""}${a}px ${s}`, e.fillStyle = t.titleFontColor ? `#${t.titleFontColor}` : "#333", e.textAlign = "center", e.textBaseline = "top", e.fillText(t.title, n + i / 2, r);
|
|
2238
2246
|
}
|
|
2239
|
-
function
|
|
2247
|
+
function Un(e) {
|
|
2240
2248
|
if (e.categories.length > 0) return e.categories;
|
|
2241
2249
|
let t = e.series[0];
|
|
2242
2250
|
if (t?.categories && t.categories.length > 0) return t.categories;
|
|
@@ -2244,7 +2252,7 @@ function Hn(e) {
|
|
|
2244
2252
|
for (let t of e.series) t.values.length > n && (n = t.values.length);
|
|
2245
2253
|
return n > 0 ? Array.from({ length: n }, (e, t) => String(t + 1)) : [];
|
|
2246
2254
|
}
|
|
2247
|
-
function
|
|
2255
|
+
function Wn(e, t, n, r, i, a, o, s, c, l = !1) {
|
|
2248
2256
|
let u = s ?? "outEnd";
|
|
2249
2257
|
if (e.fillStyle = c ? `#${c}` : "#333", o === "vertical") {
|
|
2250
2258
|
let o = n + a / 2, s = l ? r + i : r, c = l ? r : r + i;
|
|
@@ -2254,50 +2262,50 @@ function Un(e, t, n, r, i, a, o, s, c, l = !1) {
|
|
|
2254
2262
|
u === "inBase" ? (e.textAlign = l ? "right" : "left", e.textBaseline = "middle", e.fillText(t, l ? c - 4 : c + 4, o)) : u === "inEnd" ? (e.textAlign = l ? "left" : "right", e.textBaseline = "middle", e.fillText(t, l ? s + 4 : s - 4, o)) : u === "ctr" ? (e.textAlign = "center", e.textBaseline = "middle", e.fillText(t, n + i / 2, o)) : (e.textAlign = l ? "right" : "left", e.textBaseline = "middle", e.fillText(t, l ? s - 2 : s + 2, o));
|
|
2255
2263
|
}
|
|
2256
2264
|
}
|
|
2257
|
-
function
|
|
2258
|
-
let { x: i, y: a, w: o, h: s } = n, c = t.chartType === "clusteredBarH" || t.chartType === "stackedBarH" || t.chartType === "stackedBarHPct", l = t.chartType.startsWith("stacked"), u = t.chartType === "stackedBarPct" || t.chartType === "stackedBarHPct", d = t.series.filter((e) => e.seriesType !== "line"), f = t.series.filter((e) => e.seriesType === "line"), p = !c && t.secondaryValAxis && f.some((e) => e.useSecondaryAxis === !0) ? t.secondaryValAxis : null, m =
|
|
2265
|
+
function Gn(e, t, n, r) {
|
|
2266
|
+
let { x: i, y: a, w: o, h: s } = n, c = t.chartType === "clusteredBarH" || t.chartType === "stackedBarH" || t.chartType === "stackedBarHPct", l = t.chartType.startsWith("stacked"), u = t.chartType === "stackedBarPct" || t.chartType === "stackedBarHPct", d = t.series.filter((e) => e.seriesType !== "line"), f = t.series.filter((e) => e.seriesType === "line"), p = !c && t.secondaryValAxis && f.some((e) => e.useSecondaryAxis === !0) ? t.secondaryValAxis : null, m = Un(t), h = m.length;
|
|
2259
2267
|
if (h === 0) return;
|
|
2260
|
-
let g =
|
|
2268
|
+
let g = un(t), _ = et(t, s, r), v = _.fontPx, y = _.topPad, b = _.bandH, x = Fn(t.catAxisFontSizeHpt, s, r), S = Fn(t.valAxisFontSizeHpt, s, r), C = qe(t, o, s, .22), { legRightW: w, legLeftW: T, legTopH: E, legBottomH: D } = Je(C), O = Ze(t, o, s, r), k = O.catFontPx, A = O.valFontPx, j = O.catBandH, M = O.valBandW, N = b + E + S / 2 + 2, ee = c ? (t.valAxisHidden ? s * .02 : tt(S)) + j + D : tt(x) + j + D, te = s - N - ee, P = c ? o - ((t.catAxisHidden ? o * .03 : o * .22) + M + T) - (w + o * .03) : 0, ne = (c ? P : te) / r, F = 0, I = 0;
|
|
2261
2269
|
for (let e = 0; e < h; e++) {
|
|
2262
2270
|
let t = 0, n = 0;
|
|
2263
2271
|
for (let r of d) {
|
|
2264
2272
|
let i = r.values[e] ?? 0;
|
|
2265
|
-
l ? i >= 0 ? t += i : n += i : (
|
|
2273
|
+
l ? i >= 0 ? t += i : n += i : (F = Math.max(F, i), I = Math.min(I, i));
|
|
2266
2274
|
}
|
|
2267
|
-
l && (
|
|
2275
|
+
l && (F = Math.max(F, t), I = Math.min(I, n));
|
|
2268
2276
|
}
|
|
2269
2277
|
if (!u) {
|
|
2270
2278
|
for (let e of f) if (!(p && e.useSecondaryAxis === !0)) for (let t = 0; t < h; t++) {
|
|
2271
2279
|
let n = e.values[t];
|
|
2272
|
-
n != null && (
|
|
2280
|
+
n != null && (F = Math.max(F, n), I = Math.min(I, n));
|
|
2273
2281
|
}
|
|
2274
2282
|
}
|
|
2275
|
-
u && (
|
|
2276
|
-
let
|
|
2283
|
+
u && (F = F > 0 ? 100 : 0, I = I < 0 ? -100 : 0), t.valMax != null && (F = t.valMax), t.valMin != null && (I = t.valMin), F === 0 && I === 0 && (F = 1);
|
|
2284
|
+
let L = Nn(t, I, F, ne), { min: R, max: z, step: B } = L, V = Bn(p, f, te / r), H = V ? V.min : 0, U = V ? V.max : 1, W = V ? V.step : 1, re = Math.max(8, Math.min(11, s / 20)), G = Math.max(8, Math.min(11, te / 20)), ie = e.font, ae = 0;
|
|
2277
2285
|
if (!c && !t.valAxisHidden) {
|
|
2278
|
-
e.font = `${
|
|
2279
|
-
let n = 0, r = Math.round((
|
|
2286
|
+
e.font = `${G}px ${X(t, t.valAxisFontFace, "minor")}`;
|
|
2287
|
+
let n = 0, r = Math.round((z - R) / B);
|
|
2280
2288
|
for (let i = 0; i <= r; i++) {
|
|
2281
|
-
let r =
|
|
2289
|
+
let r = R + i * B, a = u ? `${Math.round(r)}%` : Y(r, t.valAxisFormatCode, t.date1904);
|
|
2282
2290
|
n = Math.max(n, e.measureText(a).width);
|
|
2283
2291
|
}
|
|
2284
2292
|
ae = n + 16;
|
|
2285
2293
|
}
|
|
2286
|
-
let oe = p?.fontSizeHpt ? p.fontSizeHpt / 100 * r :
|
|
2294
|
+
let oe = p?.fontSizeHpt ? p.fontSizeHpt / 100 * r : re, se = 0;
|
|
2287
2295
|
if (p && !p.hidden) {
|
|
2288
2296
|
e.font = `${oe}px sans-serif`;
|
|
2289
|
-
let n = 0, r = Math.round((
|
|
2290
|
-
for (let i = 0; i <= r; i++) n = Math.max(n, e.measureText(Y(
|
|
2297
|
+
let n = 0, r = Math.round((U - H) / W);
|
|
2298
|
+
for (let i = 0; i <= r; i++) n = Math.max(n, e.measureText(Y(H + i * W, p.formatCode ?? null, t.date1904)).width);
|
|
2291
2299
|
se = n + 18;
|
|
2292
2300
|
}
|
|
2293
|
-
e.font =
|
|
2301
|
+
e.font = ie;
|
|
2294
2302
|
let ce = p && p.title ? (p.titleFontSizeHpt ? p.titleFontSizeHpt / 100 * r : Math.max(9, s * .05)) + 8 : 0, le = {
|
|
2295
2303
|
t: N,
|
|
2296
2304
|
r: w + o * .03 + se + ce,
|
|
2297
2305
|
b: ee,
|
|
2298
2306
|
l: c ? (t.catAxisHidden ? o * .03 : o * .22) + M + T : T + M + ae
|
|
2299
2307
|
};
|
|
2300
|
-
|
|
2308
|
+
Hn(e, t, i, a + y, o, v);
|
|
2301
2309
|
let { plotRect: { px0: K, py0: q, pw: ue, ph: J } } = nt(t, i, a, o, s, r, {
|
|
2302
2310
|
titleBand: _,
|
|
2303
2311
|
legendSideReserveFrac: .22,
|
|
@@ -2306,31 +2314,31 @@ function Wn(e, t, n, r) {
|
|
|
2306
2314
|
});
|
|
2307
2315
|
if (ue <= 0 || J <= 0) return;
|
|
2308
2316
|
t.plotAreaBg && (e.fillStyle = `#${t.plotAreaBg}`, e.fillRect(K, q, ue, J));
|
|
2309
|
-
let de =
|
|
2317
|
+
let de = U - H || 1, fe = z - R || 1, pe = (e) => q + J - L.frac(e) * J, me = (e) => K + L.frac(e) * ue, he = pe(0), ge = me(0), _e = pe, ve = V ? V.makeToY(q, J) : pe, ye = En(t, r), be = Math.round(fe / B);
|
|
2310
2318
|
e.textBaseline = "middle", e.font = `${Math.max(8, Math.min(11, J / 20))}px ${X(t, t.valAxisFontFace, "minor")}`;
|
|
2311
2319
|
let xe = t.valAxisFontColor ? `#${t.valAxisFontColor}` : "#555";
|
|
2312
2320
|
if (e.fillStyle = xe, !t.valAxisHidden) {
|
|
2313
|
-
for (let t of
|
|
2321
|
+
for (let t of L.minorLines) if (!c) Tn(e, K, ue, pe(t), !1, ye);
|
|
2314
2322
|
else {
|
|
2315
2323
|
let n = me(t);
|
|
2316
2324
|
e.strokeStyle = ye.color, e.lineWidth = ye.width, e.beginPath(), e.moveTo(n, q), e.lineTo(n, q + J), e.stroke();
|
|
2317
2325
|
}
|
|
2318
|
-
let n =
|
|
2319
|
-
for (let i of
|
|
2320
|
-
let a = Math.abs(i) <
|
|
2326
|
+
let n = Mn(t), r = t.valAxisTickLabelPos !== "none";
|
|
2327
|
+
for (let i of L.majorLines) {
|
|
2328
|
+
let a = Math.abs(i) < B * 1e-9, o = u ? `${Math.round(i)}%` : Y(i, t.valAxisFormatCode, t.date1904);
|
|
2321
2329
|
if (c) {
|
|
2322
2330
|
let t = me(i);
|
|
2323
2331
|
n && (e.strokeStyle = ye.explicit ? ye.color : a ? "#aaa" : ye.color, e.lineWidth = ye.explicit ? ye.width : a ? 1 : ye.width, e.beginPath(), e.moveTo(t, q), e.lineTo(t, q + J), e.stroke()), r && (e.textAlign = "center", e.fillText(o, t, q + J + 10));
|
|
2324
2332
|
} else {
|
|
2325
2333
|
let t = pe(i);
|
|
2326
|
-
n &&
|
|
2334
|
+
n && Tn(e, K, ue, t, a, ye), r && (e.textAlign = "right", e.fillText(o, K - 12, t));
|
|
2327
2335
|
}
|
|
2328
2336
|
}
|
|
2329
2337
|
}
|
|
2330
|
-
if (!t.catAxisHidden &&
|
|
2331
|
-
let n =
|
|
2338
|
+
if (!t.catAxisHidden && Dn(t)) {
|
|
2339
|
+
let n = On(t, r);
|
|
2332
2340
|
e.strokeStyle = n.color, e.lineWidth = n.width;
|
|
2333
|
-
for (let n of
|
|
2341
|
+
for (let n of kn(t, h)) {
|
|
2334
2342
|
if (e.beginPath(), c) {
|
|
2335
2343
|
let t = q + n * J;
|
|
2336
2344
|
e.moveTo(K, t), e.lineTo(K + ue, t);
|
|
@@ -2345,14 +2353,14 @@ function Wn(e, t, n, r) {
|
|
|
2345
2353
|
e.strokeStyle = a, e.lineWidth = o, e.beginPath(), e.moveTo(t, n), e.lineTo(r, i), e.stroke();
|
|
2346
2354
|
}, De = !t.catAxisHidden && !t.catAxisLineHidden, Oe = !t.valAxisHidden && !t.valAxisLineHidden && t.valAxisLineColor != null, ke = () => {
|
|
2347
2355
|
if (c ? (De && Ee(K, q, K, q + J, Se, Ce), Oe && Ee(K, q + J, K + ue, q + J, we, Te)) : (De && Ee(K, q + J, K + ue, q + J, Se, Ce), Oe && Ee(K, q, K, q + J, we, Te)), !t.valAxisHidden && t.valAxisMajorTickMark && t.valAxisMajorTickMark !== "none") for (let n = 0; n <= be; n++) {
|
|
2348
|
-
let r =
|
|
2349
|
-
c ?
|
|
2356
|
+
let r = R + n * B;
|
|
2357
|
+
c ? wn(e, t.valAxisMajorTickMark, "cat", q + J, me(r), we, Te) : wn(e, t.valAxisMajorTickMark, "val", K, pe(r), we, Te);
|
|
2350
2358
|
}
|
|
2351
2359
|
if (!t.catAxisHidden && t.catAxisMajorTickMark && t.catAxisMajorTickMark !== "none") {
|
|
2352
2360
|
let n = vt(t), r = n ? h : h - 1;
|
|
2353
2361
|
for (let i = 0; i <= r; i++) {
|
|
2354
2362
|
let r = n ? i / h : h === 1 ? .5 : i / (h - 1);
|
|
2355
|
-
c ?
|
|
2363
|
+
c ? wn(e, t.catAxisMajorTickMark, "val", K, q + r * J, Se, Ce) : wn(e, t.catAxisMajorTickMark, "cat", q + J, K + r * ue, Se, Ce);
|
|
2356
2364
|
}
|
|
2357
2365
|
}
|
|
2358
2366
|
}, Ae = c ? J / h : ue / h, je = l ? 1 : Math.max(1, d.length), Me = l ? 0 : t.barOverlap ?? 0, Ne = t.barGapWidth ?? 150, Pe = Ae / (1 + (je - 1) * (1 - Me / 100) + Ne / 100), Fe = l ? 0 : Pe * (1 - Me / 100), Ie = (Ae - (Pe + (je - 1) * Fe)) / 2;
|
|
@@ -2363,20 +2371,20 @@ function Wn(e, t, n, r) {
|
|
|
2363
2371
|
o === 0 && (o = 1);
|
|
2364
2372
|
}
|
|
2365
2373
|
for (let s = 0; s < d.length; s++) {
|
|
2366
|
-
let f = d[s], p = f.values[n] ?? 0, m = u ? p / o * 100 : p, _ = m < 0, v = g ?
|
|
2374
|
+
let f = d[s], p = f.values[n] ?? 0, m = u ? p / o * 100 : p, _ = m < 0, v = g ? on(n, f) : an(s, f);
|
|
2367
2375
|
if (c) {
|
|
2368
2376
|
let o = l ? s : d.length - 1 - s, c = l ? q + (h - 1 - n) * Ae + Ie : q + (h - 1 - n) * Ae + Ie + o * Fe, p = l ? me(_ ? a : i) : ge, g = me(l ? (_ ? a : i) + m : m), y = Math.min(p, g), b = Math.abs(g - p);
|
|
2369
|
-
e.fillStyle = v, e.fillRect(y, c, b, Pe), t.showDataLabels && m !== 0 && (e.font = `bold ${t.dataLabelFontSizeHpt ? t.dataLabelFontSizeHpt / 100 * r : Math.max(7, Math.min(11, Pe * .6))}px ${X(t, t.dataLabelFontFace, "minor")}`,
|
|
2377
|
+
e.fillStyle = v, e.fillRect(y, c, b, Pe), t.showDataLabels && m !== 0 && (e.font = `bold ${t.dataLabelFontSizeHpt ? t.dataLabelFontSizeHpt / 100 * r : Math.max(7, Math.min(11, Pe * .6))}px ${X(t, t.dataLabelFontFace, "minor")}`, Wn(e, u ? `${Math.round(m)}%` : Y(m, t.dataLabelFormatCode ?? f.valFormatCode ?? null, t.date1904), y, c, b, Pe, "horizontal", t.dataLabelPosition ?? null, f.labelColor ?? t.dataLabelFontColor ?? null, _));
|
|
2370
2378
|
} else {
|
|
2371
2379
|
let o = l ? K + n * Ae + Ie : K + n * Ae + Ie + s * Fe, c = l ? pe(_ ? a : i) : he, d = pe(l ? (_ ? a : i) + m : m), p = Math.min(c, d), h = Math.abs(d - c);
|
|
2372
|
-
e.fillStyle = v, e.fillRect(o, p, Pe, h), t.showDataLabels && m !== 0 && (e.font = `bold ${t.dataLabelFontSizeHpt ? t.dataLabelFontSizeHpt / 100 * r : Math.max(7, Math.min(11, Pe * .6))}px ${X(t, t.dataLabelFontFace, "minor")}`,
|
|
2380
|
+
e.fillStyle = v, e.fillRect(o, p, Pe, h), t.showDataLabels && m !== 0 && (e.font = `bold ${t.dataLabelFontSizeHpt ? t.dataLabelFontSizeHpt / 100 * r : Math.max(7, Math.min(11, Pe * .6))}px ${X(t, t.dataLabelFontFace, "minor")}`, Wn(e, u ? `${Math.round(m)}%` : Y(m, t.dataLabelFormatCode ?? f.valFormatCode ?? null, t.date1904), o, p, h, Pe, "vertical", t.dataLabelPosition ?? null, f.labelColor ?? t.dataLabelFontColor ?? null, _));
|
|
2373
2381
|
}
|
|
2374
2382
|
l && (_ ? a += m : i += m);
|
|
2375
2383
|
}
|
|
2376
2384
|
}
|
|
2377
|
-
if (!t.catAxisHidden &&
|
|
2385
|
+
if (!t.catAxisHidden && In(t)) {
|
|
2378
2386
|
e.fillStyle = t.catAxisFontColor ? `#${t.catAxisFontColor}` : "#555", e.font = `${Math.max(8, Math.min(11, Ae * .5))}px ${X(t, t.catAxisFontFace, "minor")}`;
|
|
2379
|
-
let n = Ae - 4, r = K - 4 - (i + T + M), a =
|
|
2387
|
+
let n = Ae - 4, r = K - 4 - (i + T + M), a = Rn(t);
|
|
2380
2388
|
for (let i = 0; i < h; i++) {
|
|
2381
2389
|
let o = Dt((m[i] ?? "").toString(), t.catAxisFormatCode, t.date1904);
|
|
2382
2390
|
if (c) {
|
|
@@ -2384,12 +2392,12 @@ function Wn(e, t, n, r) {
|
|
|
2384
2392
|
e.textAlign = "right", e.textBaseline = "middle", e.fillText(Pt(e, o, r), K - 4, t);
|
|
2385
2393
|
} else {
|
|
2386
2394
|
let t = K + i * Ae + Ae / 2;
|
|
2387
|
-
e.textAlign = "center", e.textBaseline = "top",
|
|
2395
|
+
e.textAlign = "center", e.textBaseline = "top", zn(e, Pt(e, o, a === 0 ? n : J * .4), t, q + J + 3, a);
|
|
2388
2396
|
}
|
|
2389
2397
|
}
|
|
2390
2398
|
}
|
|
2391
2399
|
if (f.length > 0 && !c) for (let t = 0; t < f.length; t++) {
|
|
2392
|
-
let n = f[t], i =
|
|
2400
|
+
let n = f[t], i = an(d.length + t, n), a = p && n.useSecondaryAxis === !0 ? ve : _e;
|
|
2393
2401
|
e.strokeStyle = i, e.lineWidth = 2, e.setLineDash([]), e.beginPath();
|
|
2394
2402
|
let o = !1;
|
|
2395
2403
|
for (let t = 0; t < h; t++) {
|
|
@@ -2407,16 +2415,16 @@ function Wn(e, t, n, r) {
|
|
|
2407
2415
|
let o = K + t * Ae + Ae / 2, s = a(r);
|
|
2408
2416
|
e.fillStyle = i, e.beginPath(), e.arc(o, s, 3, 0, Math.PI * 2), e.fill();
|
|
2409
2417
|
}
|
|
2410
|
-
|
|
2418
|
+
Pn(e, n, i, (e) => K + e * Ae + Ae / 2, a, r);
|
|
2411
2419
|
}
|
|
2412
2420
|
if (ke(), p) {
|
|
2413
2421
|
let n = K + ue, { color: i, width: a } = gt(p.lineColor, p.lineWidthEmu, r);
|
|
2414
2422
|
if (p.lineHidden || Ee(n, q, n, q + J, i, a), !p.hidden) {
|
|
2415
2423
|
e.font = `${oe}px sans-serif`, e.fillStyle = p.fontColor ? `#${p.fontColor}` : xe, e.textAlign = "left", e.textBaseline = "middle";
|
|
2416
|
-
let r = Math.max(1, Math.round(de /
|
|
2424
|
+
let r = Math.max(1, Math.round(de / W));
|
|
2417
2425
|
for (let o = 0; o <= r; o++) {
|
|
2418
|
-
let r =
|
|
2419
|
-
|
|
2426
|
+
let r = H + o * W, s = ve(r);
|
|
2427
|
+
wn(e, p.majorTickMark, "val", n, s, i, a, !0), e.fillText(Y(r, p.formatCode ?? null, t.date1904), n + 14, s);
|
|
2420
2428
|
}
|
|
2421
2429
|
}
|
|
2422
2430
|
if (p.title) {
|
|
@@ -2424,13 +2432,13 @@ function Wn(e, t, n, r) {
|
|
|
2424
2432
|
e.save(), e.fillStyle = p.titleFontColor ? `#${p.titleFontColor}` : p.fontColor ? `#${p.fontColor}` : "#555", e.font = `${p.titleFontBold ? "bold " : ""}${t}px sans-serif`, e.textAlign = "center", e.textBaseline = "middle", e.translate(K + ue + se + t * .6, q + J / 2), e.rotate(Math.PI / 2), e.fillText(p.title, 0, 0), e.restore();
|
|
2425
2433
|
}
|
|
2426
2434
|
}
|
|
2427
|
-
|
|
2435
|
+
Cn(e, c && !l ? {
|
|
2428
2436
|
...t,
|
|
2429
2437
|
series: [...t.series].reverse()
|
|
2430
|
-
} : t, C, i, a, o, s, K, q, ue, J, b + 2),
|
|
2438
|
+
} : t, C, i, a, o, s, K, q, ue, J, b + 2), mn(e, t, i, a, o, s, K, q, ue, J, T, D, k, A);
|
|
2431
2439
|
}
|
|
2432
|
-
function
|
|
2433
|
-
let { x: i, y: a, w: o, h: s } = n, c =
|
|
2440
|
+
function Kn(e, t, n, r) {
|
|
2441
|
+
let { x: i, y: a, w: o, h: s } = n, c = Un(t), l = c.length;
|
|
2434
2442
|
if (l === 0) return;
|
|
2435
2443
|
let u = t.chartType === "stackedLine" || t.chartType === "stackedLinePct", d = t.chartType === "stackedLinePct", f = d ? c.map((e, n) => {
|
|
2436
2444
|
let r = 0;
|
|
@@ -2441,68 +2449,68 @@ function Gn(e, t, n, r) {
|
|
|
2441
2449
|
let r = 0;
|
|
2442
2450
|
for (let i = 0; i <= e; i++) r += t.series[i].values[n] ?? 0;
|
|
2443
2451
|
return d && f ? r / f[n] * 100 : r;
|
|
2444
|
-
}, h = !u && t.secondaryValAxis && t.series.some((e) => e.useSecondaryAxis === !0) ? t.secondaryValAxis : null, g = (e) => h != null && e.useSecondaryAxis === !0, _ = et(t, s, r), v = _.fontPx, y = _.topPad, b = _.bandH, x = qe(t, o, s, .22), { legRightW: S, legLeftW: C, legTopH: w, legBottomH: T } = Je(x), E =
|
|
2445
|
-
if (h &&
|
|
2452
|
+
}, h = !u && t.secondaryValAxis && t.series.some((e) => e.useSecondaryAxis === !0) ? t.secondaryValAxis : null, g = (e) => h != null && e.useSecondaryAxis === !0, _ = et(t, s, r), v = _.fontPx, y = _.topPad, b = _.bandH, x = qe(t, o, s, .22), { legRightW: S, legLeftW: C, legTopH: w, legBottomH: T } = Je(x), E = Fn(t.catAxisFontSizeHpt, s, r), D = Fn(t.valAxisFontSizeHpt, s, r), O = Ze(t, o, s, r), k = O.catFontPx, A = O.valFontPx, j = O.catBandH, M = O.valBandW, N = b + w + D / 2 + 2, ee = tt(E) + j + T, te = s - N - ee, P = Bn(h, t.series, te / r), ne = Math.max(8, Math.min(11, s / 20)), F = h?.fontSizeHpt ? h.fontSizeHpt / 100 * r : ne, I = 0;
|
|
2453
|
+
if (h && P && !h.hidden) {
|
|
2446
2454
|
let n = e.font;
|
|
2447
|
-
e.font = `${
|
|
2448
|
-
let r = 0, i = Math.round((
|
|
2449
|
-
for (let n = 0; n <= i; n++) r = Math.max(r, e.measureText(Y(
|
|
2450
|
-
|
|
2455
|
+
e.font = `${F}px sans-serif`;
|
|
2456
|
+
let r = 0, i = Math.round((P.max - P.min) / P.step);
|
|
2457
|
+
for (let n = 0; n <= i; n++) r = Math.max(r, e.measureText(Y(P.min + n * P.step, h.formatCode ?? null, t.date1904)).width);
|
|
2458
|
+
I = r + 18, e.font = n;
|
|
2451
2459
|
}
|
|
2452
|
-
let
|
|
2460
|
+
let L = h && h.title ? (h.titleFontSizeHpt ? h.titleFontSizeHpt / 100 * r : Math.max(9, s * .05)) + 8 : 0, R = {
|
|
2453
2461
|
t: N,
|
|
2454
|
-
r: S + o * .05 +
|
|
2462
|
+
r: S + o * .05 + I + L,
|
|
2455
2463
|
b: ee,
|
|
2456
2464
|
l: D * 2.2 + 10 + M + C
|
|
2457
2465
|
};
|
|
2458
|
-
|
|
2459
|
-
let { plotRect: { px0:
|
|
2466
|
+
Hn(e, t, i, a + y, o, v);
|
|
2467
|
+
let { plotRect: { px0: z, py0: B, pw: V, ph: H } } = nt(t, i, a, o, s, r, {
|
|
2460
2468
|
titleBand: _,
|
|
2461
2469
|
legendSideReserveFrac: .22,
|
|
2462
|
-
pad:
|
|
2470
|
+
pad: R
|
|
2463
2471
|
});
|
|
2464
|
-
if (
|
|
2465
|
-
t.plotAreaBg && (e.fillStyle = `#${t.plotAreaBg}`, e.fillRect(
|
|
2466
|
-
let
|
|
2472
|
+
if (V <= 0 || H <= 0) return;
|
|
2473
|
+
t.plotAreaBg && (e.fillStyle = `#${t.plotAreaBg}`, e.fillRect(z, B, V, H));
|
|
2474
|
+
let U = Infinity, W = -Infinity;
|
|
2467
2475
|
for (let e = 0; e < l; e++) for (let n = 0; n < t.series.length; n++) {
|
|
2468
2476
|
if (g(t.series[n]) || !u && t.series[n].values[e] == null) continue;
|
|
2469
2477
|
let r = m(n, e);
|
|
2470
|
-
|
|
2478
|
+
U = Math.min(U, r), W = Math.max(W, r);
|
|
2471
2479
|
}
|
|
2472
|
-
isFinite(
|
|
2473
|
-
let
|
|
2474
|
-
t.valMin == null ?
|
|
2475
|
-
let
|
|
2476
|
-
if (
|
|
2477
|
-
let
|
|
2480
|
+
isFinite(U) || (U = 0, W = 1);
|
|
2481
|
+
let re = t.valAxisLogBase != null && t.valAxisLogBase >= 2;
|
|
2482
|
+
t.valMin == null ? U > 0 && !re && (U = 0) : U = t.valMin, t.valMax == null ? W < 0 && (W = 0) : W = t.valMax, W === U && (W = U + 1);
|
|
2483
|
+
let G = Nn(t, U, W, H / r);
|
|
2484
|
+
if (G.max - G.min === 0) return;
|
|
2485
|
+
let ie = (e) => B + H - G.frac(e) * H, ae = P ? P.makeToY(B, H) : ie, oe = (e) => g(e) ? ae : ie, se = vt(t), ce = jn(t), le = se ? (e) => z + ((ce ? l - 1 - e : e) + .5) / l * V : (e) => {
|
|
2478
2486
|
let t = ce ? l - 1 - e : e;
|
|
2479
|
-
return
|
|
2487
|
+
return z + (l === 1 ? V / 2 : t / (l - 1) * V);
|
|
2480
2488
|
};
|
|
2481
2489
|
if (!t.valAxisHidden) {
|
|
2482
2490
|
e.font = `${D}px ${X(t, t.valAxisFontFace, "minor")}`, e.textBaseline = "middle";
|
|
2483
|
-
let n =
|
|
2484
|
-
for (let t of
|
|
2485
|
-
let i =
|
|
2486
|
-
for (let r of
|
|
2487
|
-
let o =
|
|
2488
|
-
i &&
|
|
2491
|
+
let n = En(t, r);
|
|
2492
|
+
for (let t of G.minorLines) Tn(e, z, V, ie(t), !1, n);
|
|
2493
|
+
let i = Mn(t), a = t.valAxisTickLabelPos !== "none";
|
|
2494
|
+
for (let r of G.majorLines) {
|
|
2495
|
+
let o = ie(r);
|
|
2496
|
+
i && Tn(e, z, V, o, r === 0, n), wn(e, t.valAxisMajorTickMark, "val", z, o), a && (e.fillStyle = t.valAxisFontColor ? `#${t.valAxisFontColor}` : "#555", e.textAlign = "right", e.fillText(Y(r, t.valAxisFormatCode, t.date1904), z - 6, o));
|
|
2489
2497
|
}
|
|
2490
2498
|
}
|
|
2491
|
-
if (!t.catAxisHidden &&
|
|
2492
|
-
let n =
|
|
2499
|
+
if (!t.catAxisHidden && Dn(t)) {
|
|
2500
|
+
let n = On(t, r);
|
|
2493
2501
|
e.strokeStyle = n.color, e.lineWidth = n.width;
|
|
2494
|
-
for (let n of
|
|
2495
|
-
let t =
|
|
2496
|
-
e.beginPath(), e.moveTo(t,
|
|
2502
|
+
for (let n of kn(t, l)) {
|
|
2503
|
+
let t = z + n * V;
|
|
2504
|
+
e.beginPath(), e.moveTo(t, B), e.lineTo(t, B + H), e.stroke();
|
|
2497
2505
|
}
|
|
2498
2506
|
}
|
|
2499
|
-
e.strokeStyle = "#aaa", e.lineWidth = 1, !t.catAxisHidden && !t.catAxisLineHidden && (e.beginPath(), e.moveTo(
|
|
2500
|
-
let K = Math.max(1, 2.25 * r), q = Math.max(2, 2.5 * r), ue =
|
|
2507
|
+
e.strokeStyle = "#aaa", e.lineWidth = 1, !t.catAxisHidden && !t.catAxisLineHidden && (e.beginPath(), e.moveTo(z, B + H), e.lineTo(z + V, B + H), e.stroke()), !t.valAxisHidden && !t.valAxisLineHidden && (e.beginPath(), e.moveTo(z, B), e.lineTo(z, B + H), e.stroke());
|
|
2508
|
+
let K = Math.max(1, 2.25 * r), q = Math.max(2, 2.5 * r), ue = Fn(t.dataLabelFontSizeHpt, s, r);
|
|
2501
2509
|
for (let n = 0; n < t.series.length; n++) {
|
|
2502
|
-
let i = t.series[n], a =
|
|
2510
|
+
let i = t.series[n], a = an(n, i), o = oe(i);
|
|
2503
2511
|
e.strokeStyle = a, e.lineWidth = K, e.setLineDash([]), e.beginPath();
|
|
2504
2512
|
let s = i.smooth === !0, d = [], f = () => {
|
|
2505
|
-
d.length !== 0 && (e.moveTo(d[0].x, d[0].y),
|
|
2513
|
+
d.length !== 0 && (e.moveTo(d[0].x, d[0].y), or(e, d, s), d = []);
|
|
2506
2514
|
};
|
|
2507
2515
|
for (let e = 0; e < l; e++) {
|
|
2508
2516
|
if (!u && i.values[e] == null) {
|
|
@@ -2519,9 +2527,9 @@ function Gn(e, t, n, r) {
|
|
|
2519
2527
|
}
|
|
2520
2528
|
f(), e.stroke();
|
|
2521
2529
|
let h = (e) => m(n, e);
|
|
2522
|
-
for (let t of i.errBars ?? [])
|
|
2530
|
+
for (let t of i.errBars ?? []) lr(e, i, t, l, le, o, h, a);
|
|
2523
2531
|
e.fillStyle = a;
|
|
2524
|
-
let g = i.showMarker !== !1, _ =
|
|
2532
|
+
let g = i.showMarker !== !1, _ = cr(i), v = ur(e, i, c, l, le, o, h, H, r, t.date1904 ?? !1, u || p === "zero", X(t, t.dataLabelFontFace, "minor"), t.dataLabelPosition ?? "r");
|
|
2525
2533
|
v && (e.fillStyle = a);
|
|
2526
2534
|
for (let s = 0; s < l; s++) {
|
|
2527
2535
|
if (!u && i.values[s] == null && p !== "zero") continue;
|
|
@@ -2530,85 +2538,85 @@ function Gn(e, t, n, r) {
|
|
|
2530
2538
|
let t = (i.dataPointOverrides ?? []).find((e) => e.idx === s), n = t?.markerSymbol ?? i.markerSymbol ?? "circle";
|
|
2531
2539
|
if (n !== "none") {
|
|
2532
2540
|
let l = t?.markerSize ?? i.markerSize ?? 5, u = t?.markerFill ?? t?.color ?? i.markerFill ?? a, d = t?.markerLine ?? i.markerLine ?? null;
|
|
2533
|
-
|
|
2541
|
+
tr(e, le(s), o(c), n, l, u, d, r);
|
|
2534
2542
|
}
|
|
2535
2543
|
} else e.beginPath(), e.arc(le(s), o(c), q, 0, Math.PI * 2), e.fill();
|
|
2536
|
-
t.showDataLabels && !v && (
|
|
2544
|
+
t.showDataLabels && !v && (ir(e, le(s), o(c), Et(c), t.dataLabelPosition ?? "r", ue, void 0, !1, X(t, t.dataLabelFontFace, "minor"), g ? q + 1 : 2), e.fillStyle = a);
|
|
2537
2545
|
}
|
|
2538
|
-
|
|
2546
|
+
Pn(e, i, a, le, o, r);
|
|
2539
2547
|
}
|
|
2540
2548
|
if (!t.catAxisHidden) {
|
|
2541
2549
|
let n = Math.max(1, Math.ceil(l / 8)), r = t.catAxisFontColor ? `#${t.catAxisFontColor}` : "#555";
|
|
2542
2550
|
e.fillStyle = r, e.textAlign = "center", e.textBaseline = "top", e.font = `${E}px ${X(t, t.catAxisFontFace, "minor")}`;
|
|
2543
|
-
let i =
|
|
2551
|
+
let i = V / l * n - 4, a = In(t), o = Rn(t);
|
|
2544
2552
|
for (let s = 0; s < l; s += n) {
|
|
2545
2553
|
let n = le(s);
|
|
2546
|
-
|
|
2554
|
+
wn(e, t.catAxisMajorTickMark, "cat", B + H, n), a && (e.fillStyle = r, zn(e, Pt(e, Dt((c[s] ?? "").toString(), t.catAxisFormatCode, t.date1904), o === 0 ? i : H * .4), n, B + H + 5, o));
|
|
2547
2555
|
}
|
|
2548
2556
|
}
|
|
2549
|
-
if (h &&
|
|
2557
|
+
if (h && P) {
|
|
2550
2558
|
let n = t.valAxisFontColor ? `#${t.valAxisFontColor}` : "#555";
|
|
2551
|
-
|
|
2559
|
+
Vn(e, h, P, ae, z, B, V, H, s, r, F, I, n, t.date1904);
|
|
2552
2560
|
}
|
|
2553
|
-
|
|
2561
|
+
Cn(e, t, x, i, a, o, s, z, B, V, H, b + 2), mn(e, t, i, a, o, s, z, B, V, H, C, T, k, A);
|
|
2554
2562
|
}
|
|
2555
|
-
function
|
|
2556
|
-
let { x: i, y: a, w: o, h: s } = n, c =
|
|
2563
|
+
function qn(e, t, n, r) {
|
|
2564
|
+
let { x: i, y: a, w: o, h: s } = n, c = Un(t), l = c.length;
|
|
2557
2565
|
if (l === 0) return;
|
|
2558
|
-
let u = t.series, d = u.length >= 4, f = d ? 0 : -1, p = +!!d, m = d ? 2 : 1, h = d ? 3 : 2, g = u[p], _ = u[m], v = u[h], y = f >= 0 ? u[f] : void 0, b = et(t, s, r), x = b.fontPx, S = b.topPad, C = b.bandH, w = qe(t, o, s, .22), { legRightW: T, legLeftW: E, legBottomH: D, legTopH: O } = Je(w), k =
|
|
2559
|
-
t:
|
|
2566
|
+
let u = t.series, d = u.length >= 4, f = d ? 0 : -1, p = +!!d, m = d ? 2 : 1, h = d ? 3 : 2, g = u[p], _ = u[m], v = u[h], y = f >= 0 ? u[f] : void 0, b = et(t, s, r), x = b.fontPx, S = b.topPad, C = b.bandH, w = qe(t, o, s, .22), { legRightW: T, legLeftW: E, legBottomH: D, legTopH: O } = Je(w), k = Fn(t.catAxisFontSizeHpt, s, r), A = Fn(t.valAxisFontSizeHpt, s, r), j = Ze(t, o, s, r), M = j.catFontPx, N = j.valFontPx, ee = j.catBandH, te = j.valBandW, P = C + O + A / 2 + 2, ne = tt(k) + ee + D, F = {
|
|
2567
|
+
t: P,
|
|
2560
2568
|
r: T + o * .05,
|
|
2561
|
-
b:
|
|
2569
|
+
b: ne,
|
|
2562
2570
|
l: A * 2.2 + 10 + te + E
|
|
2563
2571
|
};
|
|
2564
|
-
|
|
2565
|
-
let { plotRect: { px0:
|
|
2572
|
+
Hn(e, t, i, a + S, o, x);
|
|
2573
|
+
let { plotRect: { px0: I, py0: L, pw: R, ph: z } } = nt(t, i, a, o, s, r, {
|
|
2566
2574
|
titleBand: b,
|
|
2567
2575
|
legendSideReserveFrac: .22,
|
|
2568
|
-
pad:
|
|
2576
|
+
pad: F
|
|
2569
2577
|
});
|
|
2570
|
-
if (
|
|
2571
|
-
t.plotAreaBg && (e.fillStyle = `#${t.plotAreaBg}`, e.fillRect(
|
|
2572
|
-
let
|
|
2578
|
+
if (R <= 0 || z <= 0) return;
|
|
2579
|
+
t.plotAreaBg && (e.fillStyle = `#${t.plotAreaBg}`, e.fillRect(I, L, R, z));
|
|
2580
|
+
let B = Infinity, V = -Infinity;
|
|
2573
2581
|
for (let e of u) for (let t = 0; t < l; t++) {
|
|
2574
2582
|
let n = e.values[t];
|
|
2575
|
-
n != null && (
|
|
2583
|
+
n != null && (B = Math.min(B, n), V = Math.max(V, n));
|
|
2576
2584
|
}
|
|
2577
|
-
isFinite(
|
|
2578
|
-
let
|
|
2579
|
-
if (
|
|
2580
|
-
let
|
|
2581
|
-
let t =
|
|
2582
|
-
return
|
|
2585
|
+
isFinite(B) || (B = 0, V = 1), t.valMin == null ? B > 0 && (B = 0) : B = t.valMin, t.valMax == null ? V < 0 && (V = 0) : V = t.valMax, V === B && (V = B + 1);
|
|
2586
|
+
let H = Nn(t, B, V, z / r);
|
|
2587
|
+
if (H.max - H.min === 0) return;
|
|
2588
|
+
let U = (e) => L + z - H.frac(e) * z, W = vt(t), re = jn(t), G = W ? (e) => I + ((re ? l - 1 - e : e) + .5) / l * R : (e) => {
|
|
2589
|
+
let t = re ? l - 1 - e : e;
|
|
2590
|
+
return I + (l === 1 ? R / 2 : t / (l - 1) * R);
|
|
2583
2591
|
};
|
|
2584
2592
|
if (!t.valAxisHidden) {
|
|
2585
2593
|
e.font = `${A}px ${X(t, t.valAxisFontFace, "minor")}`, e.textBaseline = "middle";
|
|
2586
|
-
let n =
|
|
2587
|
-
for (let t of
|
|
2588
|
-
let i =
|
|
2589
|
-
for (let r of
|
|
2590
|
-
let o =
|
|
2591
|
-
i &&
|
|
2594
|
+
let n = En(t, r);
|
|
2595
|
+
for (let t of H.minorLines) Tn(e, I, R, U(t), !1, n);
|
|
2596
|
+
let i = Mn(t), a = t.valAxisTickLabelPos !== "none";
|
|
2597
|
+
for (let r of H.majorLines) {
|
|
2598
|
+
let o = U(r);
|
|
2599
|
+
i && Tn(e, I, R, o, r === 0, n), wn(e, t.valAxisMajorTickMark, "val", I, o), a && (e.fillStyle = t.valAxisFontColor ? `#${t.valAxisFontColor}` : "#555", e.textAlign = "right", e.fillText(Y(r, t.valAxisFormatCode, t.date1904), I - 6, o));
|
|
2592
2600
|
}
|
|
2593
2601
|
}
|
|
2594
|
-
if (e.strokeStyle = "#aaa", e.lineWidth = 1, !t.catAxisHidden && !t.catAxisLineHidden && (e.beginPath(), e.moveTo(
|
|
2602
|
+
if (e.strokeStyle = "#aaa", e.lineWidth = 1, !t.catAxisHidden && !t.catAxisLineHidden && (e.beginPath(), e.moveTo(I, L + z), e.lineTo(I + R, L + z), e.stroke()), !t.valAxisHidden && !t.valAxisLineHidden && (e.beginPath(), e.moveTo(I, L), e.lineTo(I, L + z), e.stroke()), (t.stockHiLowLines ?? !0) && g != null && _ != null && g && _) {
|
|
2595
2603
|
e.strokeStyle = t.stockHiLowLineColor ? `#${t.stockHiLowLineColor}` : "#595959", e.lineWidth = Math.max(1, .75 * r), e.setLineDash([]);
|
|
2596
2604
|
for (let t = 0; t < l; t++) {
|
|
2597
2605
|
let n = g.values[t], r = _.values[t];
|
|
2598
2606
|
if (n == null || r == null) continue;
|
|
2599
|
-
let i =
|
|
2600
|
-
e.beginPath(), e.moveTo(i,
|
|
2607
|
+
let i = G(t);
|
|
2608
|
+
e.beginPath(), e.moveTo(i, U(n)), e.lineTo(i, U(r)), e.stroke();
|
|
2601
2609
|
}
|
|
2602
2610
|
}
|
|
2603
|
-
let
|
|
2611
|
+
let ie = (t, n, i) => {
|
|
2604
2612
|
if (!t) return;
|
|
2605
|
-
let a =
|
|
2613
|
+
let a = an(n, t), o = t.markerSymbol ?? null, s = o != null && o !== "none" && cr(t), c = Math.max(3, R / l * .22);
|
|
2606
2614
|
for (let n = 0; n < l; n++) {
|
|
2607
2615
|
let l = t.values[n];
|
|
2608
2616
|
if (l == null) continue;
|
|
2609
|
-
let u =
|
|
2617
|
+
let u = G(n), d = U(l);
|
|
2610
2618
|
if (s) {
|
|
2611
|
-
|
|
2619
|
+
tr(e, u, d, o, t.markerSize ?? 3, t.markerFill ?? a, t.markerLine ?? null, r);
|
|
2612
2620
|
continue;
|
|
2613
2621
|
}
|
|
2614
2622
|
e.strokeStyle = a, e.lineWidth = Math.max(1, .75 * r), e.beginPath();
|
|
@@ -2616,20 +2624,20 @@ function Kn(e, t, n, r) {
|
|
|
2616
2624
|
e.moveTo(f, d), e.lineTo(p, d), e.stroke();
|
|
2617
2625
|
}
|
|
2618
2626
|
};
|
|
2619
|
-
if (
|
|
2627
|
+
if (ie(y, f, "left"), ie(v, h, "right"), u.length < 3) for (let e = 0; e < u.length; e++) ie(u[e], e, "both");
|
|
2620
2628
|
if (!t.catAxisHidden) {
|
|
2621
2629
|
let n = Math.max(1, Math.ceil(l / 8)), r = t.catAxisFontColor ? `#${t.catAxisFontColor}` : "#555";
|
|
2622
2630
|
e.fillStyle = r, e.textAlign = "center", e.textBaseline = "top", e.font = `${k}px ${X(t, t.catAxisFontFace, "minor")}`;
|
|
2623
|
-
let i =
|
|
2631
|
+
let i = R / l * n - 4, a = In(t), o = Rn(t);
|
|
2624
2632
|
for (let s = 0; s < l; s += n) {
|
|
2625
|
-
let n =
|
|
2626
|
-
|
|
2633
|
+
let n = G(s);
|
|
2634
|
+
wn(e, t.catAxisMajorTickMark, "cat", L + z, n), a && (e.fillStyle = r, zn(e, Pt(e, Dt((c[s] ?? "").toString(), t.catAxisFormatCode, t.date1904), o === 0 ? i : z * .4), n, L + z + 5, o));
|
|
2627
2635
|
}
|
|
2628
2636
|
}
|
|
2629
|
-
|
|
2637
|
+
Cn(e, t, w, i, a, o, s, I, L, R, z, C + 2), mn(e, t, i, a, o, s, I, L, R, z, E, D, M, N);
|
|
2630
2638
|
}
|
|
2631
|
-
function
|
|
2632
|
-
let { x: i, y: a, w: o, h: s } = n, c =
|
|
2639
|
+
function Jn(e, t, n, r) {
|
|
2640
|
+
let { x: i, y: a, w: o, h: s } = n, c = Un(t), l = c.length;
|
|
2633
2641
|
if (l === 0) return;
|
|
2634
2642
|
let u = t.chartType === "stackedArea" || t.chartType === "stackedAreaPct", d = t.chartType === "stackedAreaPct", f = d ? c.map((e, n) => {
|
|
2635
2643
|
let r = 0;
|
|
@@ -2638,73 +2646,73 @@ function qn(e, t, n, r) {
|
|
|
2638
2646
|
}) : null, p = (e, n) => {
|
|
2639
2647
|
let r = t.series[e].values[n] ?? 0;
|
|
2640
2648
|
return d && f ? r / f[n] * 100 : r;
|
|
2641
|
-
}, m = !u && t.secondaryValAxis && t.series.some((e) => e.useSecondaryAxis === !0) ? t.secondaryValAxis : null, h = (e) => m != null && e.useSecondaryAxis === !0, g = et(t, s, r), _ = g.fontPx, v = g.topPad, y = g.bandH, b =
|
|
2649
|
+
}, m = !u && t.secondaryValAxis && t.series.some((e) => e.useSecondaryAxis === !0) ? t.secondaryValAxis : null, h = (e) => m != null && e.useSecondaryAxis === !0, g = et(t, s, r), _ = g.fontPx, v = g.topPad, y = g.bandH, b = Fn(t.catAxisFontSizeHpt, s, r), x = Fn(t.valAxisFontSizeHpt, s, r), S = qe(t, o, s, .22), { legRightW: C, legLeftW: w, legTopH: T, legBottomH: E } = Je(S), D = Ze(t, o, s, r), O = D.catFontPx, k = D.valFontPx, A = D.catBandH, j = D.valBandW, M = y + T + x / 2 + 2, N = tt(b) + A + E, ee = s - M - N, te = Bn(m, t.series, ee / r), P = Math.max(8, Math.min(11, s / 20)), ne = m?.fontSizeHpt ? m.fontSizeHpt / 100 * r : P, F = 0;
|
|
2642
2650
|
if (m && te && !m.hidden) {
|
|
2643
2651
|
let n = e.font;
|
|
2644
|
-
e.font = `${
|
|
2652
|
+
e.font = `${ne}px sans-serif`;
|
|
2645
2653
|
let r = 0, i = Math.round((te.max - te.min) / te.step);
|
|
2646
2654
|
for (let n = 0; n <= i; n++) r = Math.max(r, e.measureText(Y(te.min + n * te.step, m.formatCode ?? null, t.date1904)).width);
|
|
2647
|
-
|
|
2655
|
+
F = r + 18, e.font = n;
|
|
2648
2656
|
}
|
|
2649
|
-
let
|
|
2657
|
+
let I = m && m.title ? (m.titleFontSizeHpt ? m.titleFontSizeHpt / 100 * r : Math.max(9, s * .05)) + 8 : 0, L = {
|
|
2650
2658
|
t: M,
|
|
2651
|
-
r: C + o * .05 +
|
|
2659
|
+
r: C + o * .05 + F + I,
|
|
2652
2660
|
b: N,
|
|
2653
2661
|
l: o * .12 + j + w
|
|
2654
2662
|
};
|
|
2655
|
-
|
|
2656
|
-
let { plotRect: { px0:
|
|
2663
|
+
Hn(e, t, i, a + v, o, _);
|
|
2664
|
+
let { plotRect: { px0: R, py0: z, pw: B, ph: V } } = nt(t, i, a, o, s, r, {
|
|
2657
2665
|
titleBand: g,
|
|
2658
2666
|
legendSideReserveFrac: .22,
|
|
2659
|
-
pad:
|
|
2667
|
+
pad: L
|
|
2660
2668
|
});
|
|
2661
|
-
if (
|
|
2662
|
-
t.plotAreaBg && (e.fillStyle = `#${t.plotAreaBg}`, e.fillRect(
|
|
2663
|
-
let
|
|
2669
|
+
if (B <= 0 || V <= 0) return;
|
|
2670
|
+
t.plotAreaBg && (e.fillStyle = `#${t.plotAreaBg}`, e.fillRect(R, z, B, V));
|
|
2671
|
+
let H = 0;
|
|
2664
2672
|
for (let e = 0; e < l; e++) if (u) {
|
|
2665
2673
|
let n = 0;
|
|
2666
2674
|
for (let r = 0; r < t.series.length; r++) n += p(r, e);
|
|
2667
|
-
|
|
2668
|
-
} else for (let n of t.series) h(n) || (
|
|
2669
|
-
d && (
|
|
2670
|
-
let { max:
|
|
2675
|
+
H = Math.max(H, n);
|
|
2676
|
+
} else for (let n of t.series) h(n) || (H = Math.max(H, n.values[e] ?? 0));
|
|
2677
|
+
d && (H = H > 0 ? 100 : 0), t.valMax != null && (H = t.valMax), H === 0 && (H = 1);
|
|
2678
|
+
let { max: U, step: W } = ct(0, H, void 0, t.valMax, V / r, t.valAxisMajorUnit), re = vt(t), G = re ? (e) => R + (e + .5) / l * B : (e) => R + (l === 1 ? B / 2 : e / (l - 1) * B), ie = (e) => z + V - e / U * V, ae = te ? te.makeToY(z, V) : ie, oe = (e) => h(e) ? ae : ie, { color: se, width: ce } = gt(t.catAxisLineColor, t.catAxisLineWidthEmu, r), { color: le, width: K } = gt(t.valAxisLineColor, t.valAxisLineWidthEmu, r);
|
|
2671
2679
|
if (!t.valAxisHidden) {
|
|
2672
|
-
let n =
|
|
2673
|
-
if (t.valAxisMinorGridlines && i != null && isFinite(i) && i > 0 && i <
|
|
2674
|
-
if (
|
|
2675
|
-
let t = Math.round(
|
|
2676
|
-
for (let r = 0; r <= t; r++)
|
|
2680
|
+
let n = En(t, r), i = t.valAxisMinorUnit;
|
|
2681
|
+
if (t.valAxisMinorGridlines && i != null && isFinite(i) && i > 0 && i < W) for (let t = i; t < U - 1e-9; t += i) Math.abs(t / W - Math.round(t / W)) > 1e-6 && Tn(e, R, B, ie(t), !1, n);
|
|
2682
|
+
if (Mn(t)) {
|
|
2683
|
+
let t = Math.round(U / W);
|
|
2684
|
+
for (let r = 0; r <= t; r++) Tn(e, R, B, ie(r * W), r === 0, n);
|
|
2677
2685
|
}
|
|
2678
2686
|
}
|
|
2679
|
-
if (!t.catAxisHidden &&
|
|
2680
|
-
let n =
|
|
2687
|
+
if (!t.catAxisHidden && Dn(t)) {
|
|
2688
|
+
let n = On(t, r);
|
|
2681
2689
|
e.strokeStyle = n.color, e.lineWidth = n.width;
|
|
2682
|
-
for (let n of
|
|
2683
|
-
let t =
|
|
2684
|
-
e.beginPath(), e.moveTo(t,
|
|
2690
|
+
for (let n of kn(t, l)) {
|
|
2691
|
+
let t = R + n * B;
|
|
2692
|
+
e.beginPath(), e.moveTo(t, z), e.lineTo(t, z + V), e.stroke();
|
|
2685
2693
|
}
|
|
2686
2694
|
}
|
|
2687
2695
|
let q = u ? Array(l).fill(0) : null;
|
|
2688
2696
|
for (let n = t.series.length - 1; n >= 0; n--) {
|
|
2689
|
-
let r = t.series[n], i =
|
|
2697
|
+
let r = t.series[n], i = an(n, r), a = z + V, o = oe(r), s = r.smooth === !0;
|
|
2690
2698
|
if (e.beginPath(), u && q) {
|
|
2691
2699
|
let t = [];
|
|
2692
2700
|
for (let e = 0; e < l; e++) t.push({
|
|
2693
|
-
x:
|
|
2694
|
-
y:
|
|
2701
|
+
x: G(e),
|
|
2702
|
+
y: ie(p(n, e) + q[e])
|
|
2695
2703
|
});
|
|
2696
|
-
e.moveTo(t[0].x, t[0].y),
|
|
2697
|
-
for (let t = l - 1; t >= 0; t--) e.lineTo(
|
|
2704
|
+
e.moveTo(t[0].x, t[0].y), or(e, t, s);
|
|
2705
|
+
for (let t = l - 1; t >= 0; t--) e.lineTo(G(t), ie(q[t]));
|
|
2698
2706
|
for (let e = 0; e < l; e++) q[e] += p(n, e);
|
|
2699
2707
|
} else {
|
|
2700
2708
|
let t = [];
|
|
2701
2709
|
for (let e = 0; e < l; e++) t.push({
|
|
2702
|
-
x:
|
|
2710
|
+
x: G(e),
|
|
2703
2711
|
y: o(r.values[e] ?? 0)
|
|
2704
2712
|
});
|
|
2705
|
-
e.moveTo(
|
|
2713
|
+
e.moveTo(G(0), a), e.lineTo(t[0].x, t[0].y), or(e, t, s), e.lineTo(G(l - 1), a);
|
|
2706
2714
|
}
|
|
2707
|
-
e.closePath(), e.fillStyle =
|
|
2715
|
+
e.closePath(), e.fillStyle = Xt(i, .6), e.fill(), e.strokeStyle = i, e.lineWidth = 1.5, e.setLineDash([]), e.stroke();
|
|
2708
2716
|
}
|
|
2709
2717
|
{
|
|
2710
2718
|
let n = Math.max(2, 2.5 * r), i = (e, n) => {
|
|
@@ -2716,43 +2724,43 @@ function qn(e, t, n, r) {
|
|
|
2716
2724
|
return t.series[e].values[n] ?? 0;
|
|
2717
2725
|
};
|
|
2718
2726
|
for (let a = 0; a < t.series.length; a++) {
|
|
2719
|
-
let o = t.series[a], s =
|
|
2720
|
-
for (let t of o.errBars ?? [])
|
|
2721
|
-
if (o.showMarker === !0 ||
|
|
2727
|
+
let o = t.series[a], s = an(a, o), u = oe(o), d = (e) => i(a, e);
|
|
2728
|
+
for (let t of o.errBars ?? []) lr(e, o, t, l, G, u, d, s);
|
|
2729
|
+
if (o.showMarker === !0 || cr(o)) for (let t = 0; t < l; t++) {
|
|
2722
2730
|
if (o.values[t] == null) continue;
|
|
2723
2731
|
let i = (o.dataPointOverrides ?? []).find((e) => e.idx === t), a = i?.markerSymbol ?? o.markerSymbol ?? "circle";
|
|
2724
2732
|
if (a === "none") continue;
|
|
2725
|
-
let c =
|
|
2726
|
-
|
|
2733
|
+
let c = G(t), l = u(d(t));
|
|
2734
|
+
cr(o) ? tr(e, c, l, a, i?.markerSize ?? o.markerSize ?? 5, i?.markerFill ?? i?.color ?? o.markerFill ?? s, i?.markerLine ?? o.markerLine ?? null, r) : (e.fillStyle = s, e.beginPath(), e.arc(c, l, n, 0, Math.PI * 2), e.fill());
|
|
2727
2735
|
}
|
|
2728
|
-
|
|
2736
|
+
ur(e, o, c, l, G, u, d, V, r, t.date1904 ?? !1, !0, X(t, t.dataLabelFontFace, "minor"), t.dataLabelPosition ?? "ctr");
|
|
2729
2737
|
}
|
|
2730
2738
|
}
|
|
2731
2739
|
if (!t.valAxisHidden) {
|
|
2732
|
-
e.font = `${Math.max(8, Math.min(11,
|
|
2733
|
-
let n = Math.round(
|
|
2740
|
+
e.font = `${Math.max(8, Math.min(11, V / 20))}px ${X(t, t.valAxisFontFace, "minor")}`, e.textBaseline = "middle";
|
|
2741
|
+
let n = Math.round(U / W);
|
|
2734
2742
|
for (let r = 0; r <= n; r++) {
|
|
2735
|
-
let n = r *
|
|
2736
|
-
|
|
2743
|
+
let n = r * W, i = ie(n);
|
|
2744
|
+
wn(e, t.valAxisMajorTickMark, "val", R, i, le, K), e.fillStyle = t.valAxisFontColor ? `#${t.valAxisFontColor}` : "#555", e.textAlign = "right", e.fillText(Y(n, t.valAxisFormatCode, t.date1904), R - 6, i);
|
|
2737
2745
|
}
|
|
2738
2746
|
}
|
|
2739
|
-
if (!t.catAxisHidden && !t.catAxisLineHidden && (e.strokeStyle = se, e.lineWidth = ce, e.beginPath(), e.moveTo(
|
|
2740
|
-
else for (let n = 0; n < l; n++)
|
|
2747
|
+
if (!t.catAxisHidden && !t.catAxisLineHidden && (e.strokeStyle = se, e.lineWidth = ce, e.beginPath(), e.moveTo(R, z + V), e.lineTo(R + B, z + V), e.stroke()), !t.valAxisHidden && !t.valAxisLineHidden && t.valAxisLineColor != null && (e.strokeStyle = le, e.lineWidth = K, e.beginPath(), e.moveTo(R, z), e.lineTo(R, z + V), e.stroke()), !t.catAxisHidden && t.catAxisMajorTickMark && t.catAxisMajorTickMark !== "none") if (re) for (let n = 0; n <= l; n++) wn(e, t.catAxisMajorTickMark, "cat", z + V, R + n / l * B, se, ce);
|
|
2748
|
+
else for (let n = 0; n < l; n++) wn(e, t.catAxisMajorTickMark, "cat", z + V, G(n), se, ce);
|
|
2741
2749
|
if (!t.catAxisHidden) {
|
|
2742
|
-
e.fillStyle = t.catAxisFontColor ? `#${t.catAxisFontColor}` : "#555", e.textAlign = "center", e.textBaseline = "top", e.font = `${Math.max(8, Math.min(11,
|
|
2750
|
+
e.fillStyle = t.catAxisFontColor ? `#${t.catAxisFontColor}` : "#555", e.textAlign = "center", e.textBaseline = "top", e.font = `${Math.max(8, Math.min(11, B / l * .8))}px ${X(t, t.catAxisFontFace, "minor")}`;
|
|
2743
2751
|
let n = c.map((e) => Dt((e ?? "").toString(), t.catAxisFormatCode, t.date1904)), r = 0;
|
|
2744
2752
|
for (let t = 0; t < l; t++) r = Math.max(r, e.measureText(n[t] ?? "").width);
|
|
2745
|
-
let i = Math.max(1, Math.ceil((r + 6) / (
|
|
2746
|
-
for (let t = 0; t < l; t += i) e.fillText(Pt(e, n[t] ?? "", a),
|
|
2753
|
+
let i = Math.max(1, Math.ceil((r + 6) / (B / l))), a = B / l * i - 4;
|
|
2754
|
+
for (let t = 0; t < l; t += i) e.fillText(Pt(e, n[t] ?? "", a), G(t), z + V + 3);
|
|
2747
2755
|
}
|
|
2748
2756
|
if (m && te) {
|
|
2749
2757
|
let n = t.valAxisFontColor ? `#${t.valAxisFontColor}` : "#555";
|
|
2750
|
-
|
|
2758
|
+
Vn(e, m, te, ae, R, z, B, V, s, r, ne, F, n, t.date1904);
|
|
2751
2759
|
}
|
|
2752
|
-
|
|
2760
|
+
Cn(e, t, S, i, a, o, s, R, z, B, V, y + 2), mn(e, t, i, a, o, s, R, z, B, V, w, E, O, k);
|
|
2753
2761
|
}
|
|
2754
|
-
var
|
|
2755
|
-
function
|
|
2762
|
+
var Yn = .88;
|
|
2763
|
+
function Xn(e, t, n, r, i) {
|
|
2756
2764
|
let { x: a, y: o, w: s, h: c } = n, l = t.series[0];
|
|
2757
2765
|
if (!l) return;
|
|
2758
2766
|
let u = l.categories && l.categories.length > 0 ? l.categories : t.categories, d = l.values.map((e) => Math.abs(e ?? 0)), f = d.reduce((e, t) => e + t, 0);
|
|
@@ -2763,7 +2771,7 @@ function Yn(e, t, n, r, i) {
|
|
|
2763
2771
|
legendSideReserveFrac: .28,
|
|
2764
2772
|
radialGapFrac: .02
|
|
2765
2773
|
}), m = p.title.fontPx, h = p.title.bandH;
|
|
2766
|
-
|
|
2774
|
+
Hn(e, t, a, o + p.title.topPad, s, m);
|
|
2767
2775
|
let g = p.legend, { px0: _, py0: v, pw: y, ph: b } = p.plotRect, x = p.center.cx, S = p.center.cy, C = Math.min(y, b) * .42, w = -Math.PI / 2 + (t.firstSliceAngle ?? 0) * Math.PI / 180, T = r ? Math.max(1, Math.min(90, t.holeSize ?? 50)) : 0, E = r ? t.series : [l], D = T / 100 * C, O = (C - D) / E.length, k = (e, t) => {
|
|
2768
2776
|
let n = (e.dataPointOverrides ?? []).find((e) => e.idx === t)?.explosion ?? 0;
|
|
2769
2777
|
return n > 0 ? n / 100 * C : 0;
|
|
@@ -2773,7 +2781,7 @@ function Yn(e, t, n, r, i) {
|
|
|
2773
2781
|
if (a === 0) continue;
|
|
2774
2782
|
let o = C - t * O, s = o - O, c = w;
|
|
2775
2783
|
for (let l = 0; l < i.length; l++) {
|
|
2776
|
-
let u = i[l] / a * Math.PI * 2, d =
|
|
2784
|
+
let u = i[l] / a * Math.PI * 2, d = on(l, n), f = c + u / 2, p = k(n, l), m = p > 0 ? Math.cos(f) * p : 0, h = p > 0 ? Math.sin(f) * p : 0;
|
|
2777
2785
|
if (e.beginPath(), s > .01 ? (e.arc(x + m, S + h, o, c, c + u), e.arc(x + m, S + h, s, c + u, c, !0)) : (e.moveTo(x + m, S + h), e.arc(x + m, S + h, o, c, c + u)), e.closePath(), e.fillStyle = d, e.fill(), e.strokeStyle = "#fff", e.lineWidth = 1, e.stroke(), M && t === 0 && u > .15) {
|
|
2778
2786
|
let t = C * (r ? .75 : .6), n = x + m + Math.cos(f) * t, o = S + h + Math.sin(f) * t, s = Math.round(i[l] / a * 100);
|
|
2779
2787
|
e.font = `bold ${Math.max(8, C * .1)}px ${N}`, e.fillStyle = "#fff", e.textAlign = "center", e.textBaseline = "middle", e.fillText(`${s}%`, n, o);
|
|
@@ -2781,20 +2789,20 @@ function Yn(e, t, n, r, i) {
|
|
|
2781
2789
|
c += u;
|
|
2782
2790
|
}
|
|
2783
2791
|
}
|
|
2784
|
-
if (j &&
|
|
2792
|
+
if (j && Zn(e, t, A, l, u, d, f, x, S, C, D, w, N, i, _, v, y, b), g) {
|
|
2785
2793
|
let n = [{
|
|
2786
2794
|
...l,
|
|
2787
2795
|
categories: u
|
|
2788
2796
|
}];
|
|
2789
|
-
|
|
2797
|
+
Cn(e, {
|
|
2790
2798
|
...t,
|
|
2791
2799
|
series: n
|
|
2792
2800
|
}, g, a, o, s, c, _, v, y, b, h + 2);
|
|
2793
2801
|
}
|
|
2794
2802
|
}
|
|
2795
|
-
function
|
|
2803
|
+
function Zn(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h, g, _) {
|
|
2796
2804
|
if (n.labelBox) {
|
|
2797
|
-
|
|
2805
|
+
Qn(e, t, n, r, i, a, o, s, c, l, d, f, p, m, g, h, _);
|
|
2798
2806
|
return;
|
|
2799
2807
|
}
|
|
2800
2808
|
let v = r.dataLabelOverrides ?? [], y = d;
|
|
@@ -2810,11 +2818,11 @@ function Xn(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h, g, _) {
|
|
|
2810
2818
|
g && e.push((i[d] ?? "").toString()), _ && e.push(r.name), b && e.push(Y(a[d], n.formatCode ?? null, t.date1904 ?? !1)), x && e.push(`${Math.round(a[d] / o * 100)}%`), S = e.filter(Boolean).join(" ");
|
|
2811
2819
|
}
|
|
2812
2820
|
if (!S) continue;
|
|
2813
|
-
let C = (h?.position ?? n.position ?? "bestFit") === "outEnd", w = C ? l + Math.max(10, l * .12) : u > .01 ? (u + l) / 2 : l *
|
|
2821
|
+
let C = (h?.position ?? n.position ?? "bestFit") === "outEnd", w = C ? l + Math.max(10, l * .12) : u > .01 ? (u + l) / 2 : l * Yn, T = s + Math.cos(m) * w, E = c + Math.sin(m) * w, D = h?.fontSizeHpt ?? n.fontSizeHpt, O = D ? D / 100 : Math.max(8, l * .1), k = h?.fontBold ?? n.fontBold, A = h?.fontColor ?? n.fontColor;
|
|
2814
2822
|
e.font = `${k ? "bold " : ""}${O}px ${f}`, e.fillStyle = A ? `#${A}` : C ? "#333" : "#fff", e.textAlign = "center", e.textBaseline = "middle", e.fillText(S, T, E);
|
|
2815
2823
|
}
|
|
2816
2824
|
}
|
|
2817
|
-
function
|
|
2825
|
+
function Qn(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h, g) {
|
|
2818
2826
|
let _ = r.dataLabelOverrides ?? [], v = (e) => _.find((t) => t.idx === e), y = n.fontSizeHpt ? n.fontSizeHpt / 100 : Math.max(9, l * .09), b = Math.max(4, y * .45), x = Math.max(2, y * .28), S = y * .22, C = n.labelBox, w = [], T = u;
|
|
2819
2827
|
for (let u = 0; u < a.length; u++) {
|
|
2820
2828
|
let p = a[u] / o * Math.PI * 2, m = T + p / 2;
|
|
@@ -2833,19 +2841,19 @@ function Zn(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h, g) {
|
|
|
2833
2841
|
if (O.length === 0) continue;
|
|
2834
2842
|
let k = h?.fontSizeHpt ? h.fontSizeHpt / 100 : y, A = h?.fontBold ?? n.fontBold ?? !1, j = h?.fontColor ? `#${h.fontColor}` : n.fontColor ? `#${n.fontColor}` : "#000", M = h?.labelBox ?? C, N = M?.fill ? `#${M.fill}` : null, ee = M?.borderColor ? `#${M.borderColor}` : null, te = M?.borderWidthEmu ? Math.max(.75, M.borderWidthEmu / ft * f) : 1;
|
|
2835
2843
|
e.font = `${A ? "bold " : ""}${k}px ${d}`;
|
|
2836
|
-
let
|
|
2837
|
-
for (let t of O)
|
|
2838
|
-
let
|
|
2844
|
+
let P = 0;
|
|
2845
|
+
for (let t of O) P = Math.max(P, e.measureText(t).width);
|
|
2846
|
+
let ne = k + S, F = P + b * 2, I = O.length * ne - S + x * 2, L = s + Math.cos(m) * l, R = c + Math.sin(m) * l, z = Math.cos(m) < 0, B = Math.max(F, I) * .55 + l * .06, V = L + Math.cos(m) * B, H = R + Math.sin(m) * B;
|
|
2839
2847
|
w.push({
|
|
2840
2848
|
lines: O,
|
|
2841
2849
|
midAngle: m,
|
|
2842
|
-
rimX:
|
|
2843
|
-
rimY:
|
|
2844
|
-
boxW:
|
|
2845
|
-
boxH:
|
|
2846
|
-
cxBox:
|
|
2847
|
-
cyBox:
|
|
2848
|
-
leftSide:
|
|
2850
|
+
rimX: L,
|
|
2851
|
+
rimY: R,
|
|
2852
|
+
boxW: F,
|
|
2853
|
+
boxH: I,
|
|
2854
|
+
cxBox: V,
|
|
2855
|
+
cyBox: H,
|
|
2856
|
+
leftSide: z,
|
|
2849
2857
|
fontColor: j,
|
|
2850
2858
|
boxFill: N,
|
|
2851
2859
|
boxBorder: ee,
|
|
@@ -2897,8 +2905,8 @@ function Zn(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h, g) {
|
|
|
2897
2905
|
for (let n = 0; n < t.lines.length; n++) e.fillText(t.lines[n], t.cxBox, a + n * i);
|
|
2898
2906
|
}
|
|
2899
2907
|
}
|
|
2900
|
-
function
|
|
2901
|
-
let { x: i, y: a, w: o, h: s } = n, c =
|
|
2908
|
+
function $n(e, t, n, r) {
|
|
2909
|
+
let { x: i, y: a, w: o, h: s } = n, c = Un(t), l = c.length;
|
|
2902
2910
|
if (l < 3) return;
|
|
2903
2911
|
let u = nt(t, i, a, o, s, r, {
|
|
2904
2912
|
titleTopPadFrac: .035,
|
|
@@ -2906,7 +2914,7 @@ function Qn(e, t, n, r) {
|
|
|
2906
2914
|
legendSideReserveFrac: .22,
|
|
2907
2915
|
radialGapFrac: .02
|
|
2908
2916
|
}), d = u.legend, f = u.title.fontPx;
|
|
2909
|
-
|
|
2917
|
+
Hn(e, t, i, a + u.title.topPad, o, f);
|
|
2910
2918
|
let { px0: p, py0: m, pw: h, ph: g } = u.plotRect, _ = u.center.cx, v = u.center.cy, y = Math.min(h, g) * .38, b = 0;
|
|
2911
2919
|
for (let e of t.series) for (let t of e.values) b = Math.max(b, t ?? 0);
|
|
2912
2920
|
t.valMax != null && (b = t.valMax), b === 0 && (b = 1);
|
|
@@ -2927,7 +2935,7 @@ function Qn(e, t, n, r) {
|
|
|
2927
2935
|
e.beginPath(), e.moveTo(_, v), e.lineTo(_ + Math.cos(n) * y, v + Math.sin(n) * y), e.stroke();
|
|
2928
2936
|
}
|
|
2929
2937
|
if (!t.valAxisHidden) {
|
|
2930
|
-
e.font = `${
|
|
2938
|
+
e.font = `${Fn(t.valAxisFontSizeHpt, s, r)}px ${X(t, t.valAxisFontFace, "minor")}`, e.fillStyle = "#555", e.textAlign = "right", e.textBaseline = "middle";
|
|
2931
2939
|
for (let t = 1; t <= T; t++) {
|
|
2932
2940
|
let n = E(t), r = n / x * y;
|
|
2933
2941
|
e.fillText(Et(n), _ - 3, v - r);
|
|
@@ -2943,7 +2951,7 @@ function Qn(e, t, n, r) {
|
|
|
2943
2951
|
}
|
|
2944
2952
|
let k = t.radarStyle === "filled", A = Math.max(2, y * .025);
|
|
2945
2953
|
for (let n = 0; n < t.series.length; n++) {
|
|
2946
|
-
let r = t.series[n], i =
|
|
2954
|
+
let r = t.series[n], i = an(n, r), a = [];
|
|
2947
2955
|
for (let e = 0; e < l; e++) {
|
|
2948
2956
|
let t = r.values[e];
|
|
2949
2957
|
if (t == null) {
|
|
@@ -2963,18 +2971,18 @@ function Qn(e, t, n, r) {
|
|
|
2963
2971
|
o ? e.lineTo(t[0], t[1]) : (e.moveTo(t[0], t[1]), o = !0);
|
|
2964
2972
|
}
|
|
2965
2973
|
let s = a.every((e) => e != null);
|
|
2966
|
-
if (k && s ? (e.closePath(), e.fillStyle =
|
|
2974
|
+
if (k && s ? (e.closePath(), e.fillStyle = Xt(i, .25), e.fill()) : s && e.closePath(), e.strokeStyle = i, e.lineWidth = 2, e.stroke(), !k && r.showMarker !== !1) {
|
|
2967
2975
|
e.fillStyle = i;
|
|
2968
2976
|
for (let t of a) t != null && (e.beginPath(), e.arc(t[0], t[1], A, 0, Math.PI * 2), e.fill());
|
|
2969
2977
|
}
|
|
2970
2978
|
}
|
|
2971
|
-
|
|
2979
|
+
Cn(e, t, d, i, a, o, s, p, m, h, g, u.title.bandH + 2);
|
|
2972
2980
|
}
|
|
2973
|
-
function
|
|
2974
|
-
let { x: i, y: a, w: o, h: s } = n, c = et(t, s, r), l = c.fontPx, u = c.topPad, d =
|
|
2981
|
+
function er(e, t, n, r) {
|
|
2982
|
+
let { x: i, y: a, w: o, h: s } = n, c = et(t, s, r), l = c.fontPx, u = c.topPad, d = Fn(t.catAxisFontSizeHpt, s, r), f = Fn(t.valAxisFontSizeHpt, s, r), p = qe(t, o, s, .22), { legRightW: m, legLeftW: h, legTopH: g, legBottomH: _ } = Je(p), v = Ze(t, o, s, r), y = v.catFontPx, b = v.valFontPx, x = v.catBandH, S = v.valBandW;
|
|
2975
2983
|
if (t.title) {
|
|
2976
2984
|
let n = t.titleManualLayout;
|
|
2977
|
-
n && (n.x !== void 0 || n.y !== void 0) ?
|
|
2985
|
+
n && (n.x !== void 0 || n.y !== void 0) ? Hn(e, t, i + n.x * o, a + n.y * s, (n.w ?? .5) * o, l) : Hn(e, t, i, a + u, o, l);
|
|
2978
2986
|
}
|
|
2979
2987
|
let { plotRect: { px0: C, py0: w, pw: T, ph: E } } = nt(t, i, a, o, s, r, {
|
|
2980
2988
|
titleBand: c,
|
|
@@ -3005,32 +3013,32 @@ function $n(e, t, n, r) {
|
|
|
3005
3013
|
}
|
|
3006
3014
|
let A = Math.min(...D), j = Math.max(...D), M = Math.min(...O), N = Math.max(...O);
|
|
3007
3015
|
A === j && (--A, j += 1), M === N && (--M, N += 1), t.valMin == null ? M > 0 && (M = 0) : M = t.valMin, t.valMax != null && (N = t.valMax);
|
|
3008
|
-
let { min: ee, max: te, step:
|
|
3016
|
+
let { min: ee, max: te, step: P } = ct(M, N, t.valMin, t.valMax, void 0, t.valAxisMajorUnit);
|
|
3009
3017
|
if (M = ee, N = te, t.catAxisMin != null && (A = t.catAxisMin), t.catAxisMax != null && (j = t.catAxisMax), t.catAxisMin == null || t.catAxisMax == null) {
|
|
3010
3018
|
let e = rt(j - A);
|
|
3011
3019
|
e > 0 && (t.catAxisMin ?? (A = Math.floor(A / e) * e), t.catAxisMax ?? (j = Math.ceil(j / e) * e));
|
|
3012
3020
|
}
|
|
3013
|
-
let
|
|
3021
|
+
let ne = (e) => C + (e - A) / (j - A) * T, F = (e) => w + E - (e - M) / (N - M) * E, I = En(t, r);
|
|
3014
3022
|
if (!t.valAxisHidden) {
|
|
3015
3023
|
let n = Math.max(8, Math.min(11, E / 20));
|
|
3016
3024
|
e.font = `${t.valAxisFontBold ? "bold " : ""}${n}px ${X(t, t.valAxisFontFace, "minor")}`;
|
|
3017
|
-
let i = Math.round((N - M) /
|
|
3025
|
+
let i = Math.round((N - M) / P) + 1;
|
|
3018
3026
|
for (let n = 0; n < i; n++) {
|
|
3019
|
-
let i = M + n *
|
|
3020
|
-
if (i > N +
|
|
3021
|
-
let a =
|
|
3022
|
-
e.strokeStyle =
|
|
3027
|
+
let i = M + n * P;
|
|
3028
|
+
if (i > N + P * .01) break;
|
|
3029
|
+
let a = F(i);
|
|
3030
|
+
e.strokeStyle = I.color, e.lineWidth = I.width, e.beginPath(), e.moveTo(C, a), e.lineTo(C + T, a), e.stroke(), e.fillStyle = "#555", e.textAlign = "right", e.textBaseline = "middle", e.fillText(Y(i, t.valAxisFormatCode, t.date1904), C - 4, a);
|
|
3023
3031
|
let o = t.valAxisLineColor ? `#${t.valAxisLineColor}` : void 0;
|
|
3024
|
-
|
|
3032
|
+
wn(e, t.valAxisMajorTickMark, "val", C, a, o, ht(t.valAxisLineWidthEmu, r));
|
|
3025
3033
|
}
|
|
3026
3034
|
}
|
|
3027
|
-
let
|
|
3028
|
-
if (t.catAxisCrossesAt != null)
|
|
3035
|
+
let L = w + E;
|
|
3036
|
+
if (t.catAxisCrossesAt != null) L = ar(F(t.catAxisCrossesAt), w, w + E);
|
|
3029
3037
|
else {
|
|
3030
3038
|
let e = t.catAxisCrosses ?? "autoZero";
|
|
3031
|
-
e === "autoZero" && M < 0 && N > 0 ?
|
|
3039
|
+
e === "autoZero" && M < 0 && N > 0 ? L = ar(F(0), w, w + E) : e === "min" ? L = w + E : e === "max" && (L = w);
|
|
3032
3040
|
}
|
|
3033
|
-
if (!t.catAxisHidden && !t.catAxisLineHidden && (e.save(), e.strokeStyle = t.catAxisLineColor ? `#${t.catAxisLineColor}` : "#888", e.lineWidth = ht(t.catAxisLineWidthEmu, r), e.lineCap = "butt", e.beginPath(), e.moveTo(C,
|
|
3041
|
+
if (!t.catAxisHidden && !t.catAxisLineHidden && (e.save(), e.strokeStyle = t.catAxisLineColor ? `#${t.catAxisLineColor}` : "#888", e.lineWidth = ht(t.catAxisLineWidthEmu, r), e.lineCap = "butt", e.beginPath(), e.moveTo(C, L), e.lineTo(C + T, L), e.stroke(), e.restore()), !t.valAxisHidden && !t.valAxisLineHidden && (e.save(), e.strokeStyle = t.valAxisLineColor ? `#${t.valAxisLineColor}` : "#888", e.lineWidth = ht(t.valAxisLineWidthEmu, r), e.beginPath(), e.moveTo(C, w), e.lineTo(C, w + E), e.stroke(), e.restore()), !t.catAxisHidden) {
|
|
3034
3042
|
let n = Math.max(8, Math.min(11, E / 20));
|
|
3035
3043
|
e.font = `${t.catAxisFontBold ? "bold " : ""}${n}px ${X(t, t.catAxisFontFace, "minor")}`;
|
|
3036
3044
|
let i = rt(j - A), a = Math.round((j - A) / i) + 1;
|
|
@@ -3038,29 +3046,29 @@ function $n(e, t, n, r) {
|
|
|
3038
3046
|
for (let n = 0; n < a; n++) {
|
|
3039
3047
|
let a = A + n * i;
|
|
3040
3048
|
if (a > j + i * .01) break;
|
|
3041
|
-
let o =
|
|
3042
|
-
e.fillText(Y(a, t.catAxisFormatCode, t.date1904), o,
|
|
3049
|
+
let o = ne(a);
|
|
3050
|
+
e.fillText(Y(a, t.catAxisFormatCode, t.date1904), o, L + 4);
|
|
3043
3051
|
let s = t.catAxisLineColor ? `#${t.catAxisLineColor}` : void 0;
|
|
3044
|
-
|
|
3052
|
+
wn(e, t.catAxisMajorTickMark, "cat", L, o, s, ht(t.catAxisLineWidthEmu, r));
|
|
3045
3053
|
}
|
|
3046
3054
|
}
|
|
3047
|
-
let
|
|
3055
|
+
let R = t.chartType === "bubble", z = R ? "marker" : t.scatterStyle ?? "marker", B = z === "line" || z === "lineMarker" || z === "lineNoMarker", V = z === "smooth" || z === "smoothMarker" || z === "smoothNoMarker", H = z === "lineNoMarker" || z === "smoothNoMarker";
|
|
3048
3056
|
for (let n = 0; n < t.series.length; n++) {
|
|
3049
|
-
let i = t.series[n], a =
|
|
3050
|
-
for (let t of i.errBars ?? [])
|
|
3051
|
-
if ((
|
|
3057
|
+
let i = t.series[n], a = an(n, i), o = i.categories ?? [];
|
|
3058
|
+
for (let t of i.errBars ?? []) nr(e, i, t, o, k, ne, F, a);
|
|
3059
|
+
if ((B || V) && i.lineHidden !== !0) {
|
|
3052
3060
|
let t = [];
|
|
3053
3061
|
for (let e = 0; e < i.values.length; e++) {
|
|
3054
3062
|
let n = i.values[e];
|
|
3055
3063
|
if (n == null) continue;
|
|
3056
3064
|
let r = k ? e : parseFloat(o[e] ?? "0");
|
|
3057
3065
|
isNaN(r) || t.push({
|
|
3058
|
-
x:
|
|
3059
|
-
y:
|
|
3066
|
+
x: ne(r),
|
|
3067
|
+
y: F(n)
|
|
3060
3068
|
});
|
|
3061
3069
|
}
|
|
3062
3070
|
if (t.length >= 2) {
|
|
3063
|
-
if (e.save(), e.strokeStyle = i.color ? `#${i.color}` : a, e.lineWidth = 1.5, e.beginPath(), e.moveTo(t[0].x, t[0].y),
|
|
3071
|
+
if (e.save(), e.strokeStyle = i.color ? `#${i.color}` : a, e.lineWidth = 1.5, e.beginPath(), e.moveTo(t[0].x, t[0].y), V && t.length >= 3) for (let n = 0; n < t.length - 1; n++) {
|
|
3064
3072
|
let r = t[n - 1] ?? t[n], i = t[n], a = t[n + 1], o = t[n + 2] ?? a, s = i.x + (a.x - r.x) / 6, c = i.y + (a.y - r.y) / 6, l = a.x - (o.x - i.x) / 6, u = a.y - (o.y - i.y) / 6;
|
|
3065
3073
|
e.bezierCurveTo(s, c, l, u, a.x, a.y);
|
|
3066
3074
|
}
|
|
@@ -3068,9 +3076,9 @@ function $n(e, t, n, r) {
|
|
|
3068
3076
|
e.stroke(), e.restore();
|
|
3069
3077
|
}
|
|
3070
3078
|
}
|
|
3071
|
-
if (!(
|
|
3079
|
+
if (!(H || i.showMarker === !1 || typeof i.markerSymbol == "string" && i.markerSymbol === "none")) {
|
|
3072
3080
|
let t = 0;
|
|
3073
|
-
if (
|
|
3081
|
+
if (R && i.bubbleSizes && i.bubbleSizes.length > 0) {
|
|
3074
3082
|
let e = Math.max(0, ...i.bubbleSizes.filter((e) => e != null));
|
|
3075
3083
|
e > 0 && (t = Math.min(T, E) / Math.max(8, i.values.length * 1.6) / Math.sqrt(e));
|
|
3076
3084
|
}
|
|
@@ -3080,19 +3088,19 @@ function $n(e, t, n, r) {
|
|
|
3080
3088
|
let c = k ? n : parseFloat(o[n] ?? "0");
|
|
3081
3089
|
if (isNaN(c)) continue;
|
|
3082
3090
|
let l = (i.dataPointOverrides ?? []).find((e) => e.idx === n), u = l?.markerSymbol ?? i.markerSymbol ?? "circle", d = l?.markerSize ?? i.markerSize ?? 5;
|
|
3083
|
-
if (
|
|
3091
|
+
if (R && t > 0) {
|
|
3084
3092
|
let e = i.bubbleSizes?.[n];
|
|
3085
3093
|
e != null && e > 0 && (d = Math.sqrt(e) * t * 2 / r);
|
|
3086
3094
|
}
|
|
3087
3095
|
let f = l?.markerFill ?? l?.color ?? i.markerFill ?? a, p = l?.markerLine ?? i.markerLine ?? null;
|
|
3088
|
-
|
|
3096
|
+
tr(e, ne(c), F(s), u, d, f, p, r);
|
|
3089
3097
|
}
|
|
3090
3098
|
}
|
|
3091
|
-
|
|
3099
|
+
rr(e, i, o, k, ne, F, E, r, t.date1904, X(t, t.dataLabelFontFace, "minor"), t.dataLabelPosition ?? "r");
|
|
3092
3100
|
}
|
|
3093
|
-
|
|
3101
|
+
Cn(e, t, p, i, a, o, s, C, w, T, E, c.bandH + 2), mn(e, t, i, a, o, s, C, w, T, E, h, _, y, b);
|
|
3094
3102
|
}
|
|
3095
|
-
function
|
|
3103
|
+
function tr(e, t, n, r, i, a, o, s) {
|
|
3096
3104
|
let c = Math.max(2, i * s), l = c / 2, u = a.startsWith("#") ? a : `#${a}`, d = o ? o.startsWith("#") ? o : `#${o}` : null;
|
|
3097
3105
|
switch (e.save(), e.fillStyle = u, d && (e.strokeStyle = d, e.lineWidth = 1), r) {
|
|
3098
3106
|
case "square":
|
|
@@ -3132,8 +3140,8 @@ function er(e, t, n, r, i, a, o, s) {
|
|
|
3132
3140
|
}
|
|
3133
3141
|
e.restore();
|
|
3134
3142
|
}
|
|
3135
|
-
function
|
|
3136
|
-
e.save(), e.strokeStyle = n.color ? `#${n.color}` : s, e.lineWidth = n.lineWidthEmu ? Math.max(.5, n.lineWidthEmu / ft) : 1, e.setLineDash(
|
|
3143
|
+
function nr(e, t, n, r, i, a, o, s) {
|
|
3144
|
+
e.save(), e.strokeStyle = n.color ? `#${n.color}` : s, e.lineWidth = n.lineWidthEmu ? Math.max(.5, n.lineWidthEmu / ft) : 1, e.setLineDash(sr(n.dash));
|
|
3137
3145
|
let c = n.barType === "plus" || n.barType === "both", l = n.barType === "minus" || n.barType === "both", u = n.dir === "x", d = e.lineWidth * 1.5;
|
|
3138
3146
|
for (let s = 0; s < t.values.length; s++) {
|
|
3139
3147
|
let f = t.values[s];
|
|
@@ -3155,7 +3163,7 @@ function tr(e, t, n, r, i, a, o, s) {
|
|
|
3155
3163
|
}
|
|
3156
3164
|
e.restore();
|
|
3157
3165
|
}
|
|
3158
|
-
function
|
|
3166
|
+
function rr(e, t, n, r, i, a, o, s, c = !1, l = "sans-serif", u = "r") {
|
|
3159
3167
|
let d = t.dataLabelOverrides ?? [];
|
|
3160
3168
|
if (d.length === 0 && !t.seriesDataLabels) return;
|
|
3161
3169
|
let f = t.seriesDataLabels;
|
|
@@ -3173,10 +3181,10 @@ function nr(e, t, n, r, i, a, o, s, c = !1, l = "sans-serif", u = "r") {
|
|
|
3173
3181
|
if (_ && !r && e.push(n[p] ?? ""), v && e.push(t.name), y && e.push(Y(m, f?.formatCode ?? null, c)), b = e.filter(Boolean).join(" "), !b) continue;
|
|
3174
3182
|
} else continue;
|
|
3175
3183
|
let x = g?.position ?? f?.position ?? u, S = g?.fontSizeHpt ?? f?.fontSizeHpt, C = S ? S / 100 * s : Math.max(9, Math.min(11, o / 25)), w = g?.fontColor ?? f?.fontColor, T = g?.fontBold ?? f?.fontBold ?? !1;
|
|
3176
|
-
|
|
3184
|
+
ir(e, i(h), a(m), b, x, C, w, T, l);
|
|
3177
3185
|
}
|
|
3178
3186
|
}
|
|
3179
|
-
function
|
|
3187
|
+
function ir(e, t, n, r, i, a, o, s, c = "sans-serif", l = 0) {
|
|
3180
3188
|
e.save(), e.font = `${s ? "bold " : ""}${a}px ${c}`, e.fillStyle = o ? `#${o}` : "#333";
|
|
3181
3189
|
let u = a * .6 + l, d = t, f = n;
|
|
3182
3190
|
switch (i) {
|
|
@@ -3204,17 +3212,17 @@ function rr(e, t, n, r, i, a, o, s, c = "sans-serif", l = 0) {
|
|
|
3204
3212
|
for (let t of p) e.fillText(t, d, g), g += m;
|
|
3205
3213
|
e.restore();
|
|
3206
3214
|
}
|
|
3207
|
-
function
|
|
3215
|
+
function ar(e, t, n) {
|
|
3208
3216
|
return e < t ? t : e > n ? n : e;
|
|
3209
3217
|
}
|
|
3210
|
-
function
|
|
3218
|
+
function or(e, t, n) {
|
|
3211
3219
|
if (t.length !== 0) if (n && t.length >= 3) for (let n = 0; n < t.length - 1; n++) {
|
|
3212
3220
|
let r = t[n - 1] ?? t[n], i = t[n], a = t[n + 1], o = t[n + 2] ?? a, s = i.x + (a.x - r.x) / 6, c = i.y + (a.y - r.y) / 6, l = a.x - (o.x - i.x) / 6, u = a.y - (o.y - i.y) / 6;
|
|
3213
3221
|
e.bezierCurveTo(s, c, l, u, a.x, a.y);
|
|
3214
3222
|
}
|
|
3215
3223
|
else for (let n = 1; n < t.length; n++) e.lineTo(t[n].x, t[n].y);
|
|
3216
3224
|
}
|
|
3217
|
-
function
|
|
3225
|
+
function sr(e) {
|
|
3218
3226
|
if (!e) return [];
|
|
3219
3227
|
switch (e) {
|
|
3220
3228
|
case "solid": return [];
|
|
@@ -3249,13 +3257,13 @@ function or(e) {
|
|
|
3249
3257
|
default: return [];
|
|
3250
3258
|
}
|
|
3251
3259
|
}
|
|
3252
|
-
function
|
|
3260
|
+
function cr(e) {
|
|
3253
3261
|
return e.markerSymbol != null || e.markerSize != null || e.markerFill != null || e.markerLine != null || e.dataPointOverrides != null && e.dataPointOverrides.length > 0;
|
|
3254
3262
|
}
|
|
3255
|
-
function
|
|
3263
|
+
function lr(e, t, n, r, i, a, o, s) {
|
|
3256
3264
|
if (n.dir === "x") return;
|
|
3257
3265
|
let c = n.barType === "plus" || n.barType === "both", l = n.barType === "minus" || n.barType === "both";
|
|
3258
|
-
e.save(), e.strokeStyle = n.color ? `#${n.color}` : s, e.lineWidth = n.lineWidthEmu ? Math.max(.5, n.lineWidthEmu / ft) : 1, e.setLineDash(
|
|
3266
|
+
e.save(), e.strokeStyle = n.color ? `#${n.color}` : s, e.lineWidth = n.lineWidthEmu ? Math.max(.5, n.lineWidthEmu / ft) : 1, e.setLineDash(sr(n.dash));
|
|
3259
3267
|
let u = e.lineWidth * 1.5;
|
|
3260
3268
|
for (let s = 0; s < r; s++) {
|
|
3261
3269
|
if (t.values[s] == null) continue;
|
|
@@ -3274,7 +3282,7 @@ function cr(e, t, n, r, i, a, o, s) {
|
|
|
3274
3282
|
}
|
|
3275
3283
|
e.restore();
|
|
3276
3284
|
}
|
|
3277
|
-
function
|
|
3285
|
+
function ur(e, t, n, r, i, a, o, s, c, l, u, d = "sans-serif", f = "t") {
|
|
3278
3286
|
let p = t.dataLabelOverrides ?? [], m = t.seriesDataLabels;
|
|
3279
3287
|
if (p.length === 0 && !m) return !1;
|
|
3280
3288
|
for (let h = 0; h < r; h++) {
|
|
@@ -3288,11 +3296,11 @@ function lr(e, t, n, r, i, a, o, s, c, l, u, d = "sans-serif", f = "t") {
|
|
|
3288
3296
|
if (_ && e.push(n[h] ?? ""), v && e.push(t.name), y && e.push(Y(r, m?.formatCode ?? null, l)), b = e.filter(Boolean).join(" "), !b) continue;
|
|
3289
3297
|
} else continue;
|
|
3290
3298
|
let x = g?.position ?? m?.position ?? f, S = g?.fontSizeHpt ?? m?.fontSizeHpt, C = S ? S / 100 * c : Math.max(9, Math.min(11, s / 25)), w = g?.fontColor ?? m?.fontColor, T = g?.fontBold ?? m?.fontBold ?? !1;
|
|
3291
|
-
|
|
3299
|
+
ir(e, i(h), a(r), b, x, C, w, T, d);
|
|
3292
3300
|
}
|
|
3293
3301
|
return !0;
|
|
3294
3302
|
}
|
|
3295
|
-
function
|
|
3303
|
+
function dr(e, t, n) {
|
|
3296
3304
|
let { x: r, y: i, w: a, h: o } = n, s = t.plotAreaManualLayout, c, l, u, d;
|
|
3297
3305
|
if (s && s.w != null && s.h != null) c = r + s.x * a, l = i + s.y * o, u = s.w * a, d = s.h * o;
|
|
3298
3306
|
else {
|
|
@@ -3351,7 +3359,7 @@ function ur(e, t, n) {
|
|
|
3351
3359
|
}
|
|
3352
3360
|
e.restore();
|
|
3353
3361
|
}
|
|
3354
|
-
function
|
|
3362
|
+
function fr(e, t, n) {
|
|
3355
3363
|
let r = e.length;
|
|
3356
3364
|
if (r === 0) return 0;
|
|
3357
3365
|
if (r === 1) return e[0];
|
|
@@ -3360,9 +3368,9 @@ function dr(e, t, n) {
|
|
|
3360
3368
|
let a = Math.floor(i), o = i - a;
|
|
3361
3369
|
return a >= r ? e[r - 1] : e[a - 1] + o * (e[a] - e[a - 1]);
|
|
3362
3370
|
}
|
|
3363
|
-
function
|
|
3371
|
+
function pr(e, t) {
|
|
3364
3372
|
if (e.length === 0) return null;
|
|
3365
|
-
let n = [...e].sort((e, t) => e - t), r =
|
|
3373
|
+
let n = [...e].sort((e, t) => e - t), r = fr(n, .25, t), i = fr(n, .5, t), a = fr(n, .75, t), o = a - r, s = r - 1.5 * o, c = a + 1.5 * o, l = [], u = [];
|
|
3366
3374
|
for (let e of n) e < s || e > c ? u.push(e) : l.push(e);
|
|
3367
3375
|
return {
|
|
3368
3376
|
q1: r,
|
|
@@ -3375,10 +3383,10 @@ function fr(e, t) {
|
|
|
3375
3383
|
inner: l
|
|
3376
3384
|
};
|
|
3377
3385
|
}
|
|
3378
|
-
function
|
|
3386
|
+
function mr(e, t, n, r) {
|
|
3379
3387
|
let i = t.chartexBox;
|
|
3380
3388
|
if (!i || i.categories.length === 0 || i.series.length === 0) return;
|
|
3381
|
-
let { x: a, y: o, w: s, h: c } = n, l = et(t, c, r), u =
|
|
3389
|
+
let { x: a, y: o, w: s, h: c } = n, l = et(t, c, r), u = Fn(t.catAxisFontSizeHpt, c, r), d = Fn(t.valAxisFontSizeHpt, c, r), f = nt(t, a, o, s, c, r, {
|
|
3382
3390
|
titleBand: l,
|
|
3383
3391
|
legendSideReserveFrac: 0,
|
|
3384
3392
|
pad: {
|
|
@@ -3388,11 +3396,11 @@ function pr(e, t, n, r) {
|
|
|
3388
3396
|
l: t.valAxisHidden ? s * .02 : s * .1
|
|
3389
3397
|
}
|
|
3390
3398
|
});
|
|
3391
|
-
|
|
3399
|
+
Hn(e, t, a, o + f.title.topPad, s, f.title.fontPx);
|
|
3392
3400
|
let { px0: p, py0: m, pw: h, ph: g } = f.plotRect, _ = i.categories, v = _.length, y = i.series.length, b = Infinity, x = -Infinity;
|
|
3393
3401
|
for (let e of i.series) for (let t of e.valuesByCategory) for (let e of t) e < b && (b = e), e > x && (x = e);
|
|
3394
3402
|
if (!isFinite(b) || !isFinite(x)) return;
|
|
3395
|
-
let { min: S, max: C, step: w } = ct(b, x, t.valMin, t.valMax, g / r, t.valAxisMajorUnit), T = C - S || 1, E = (e) => m + g * (1 - (e - S) / T), D = X(t, t.valAxisFontFace, "minor"), O =
|
|
3403
|
+
let { min: S, max: C, step: w } = ct(b, x, t.valMin, t.valMax, g / r, t.valAxisMajorUnit), T = C - S || 1, E = (e) => m + g * (1 - (e - S) / T), D = X(t, t.valAxisFontFace, "minor"), O = Fn(t.valAxisFontSizeHpt, c, r);
|
|
3396
3404
|
if (e.save(), !t.valAxisHidden) {
|
|
3397
3405
|
e.font = `${O}px ${D}`, e.textAlign = "right", e.textBaseline = "middle";
|
|
3398
3406
|
for (let n = S; n <= C + 1e-6; n += w) {
|
|
@@ -3403,14 +3411,14 @@ function pr(e, t, n, r) {
|
|
|
3403
3411
|
!t.catAxisHidden && !t.catAxisLineHidden && (e.strokeStyle = "#bfbfbf", e.lineWidth = 1, e.beginPath(), e.moveTo(p, m + g), e.lineTo(p + h, m + g), e.stroke());
|
|
3404
3412
|
let k = h / v, A = k / (1 + (t.barGapWidth ?? 150) / 100), j = A * .06, M = (A - j * (y - 1)) / y, N = (e) => {
|
|
3405
3413
|
let n = t.chartexAccents?.[e % (t.chartexAccents?.length ?? 1)];
|
|
3406
|
-
return `#${i.series[e].color ?? n ??
|
|
3407
|
-
}, ee =
|
|
3414
|
+
return `#${i.series[e].color ?? n ?? rn[e % rn.length]}`;
|
|
3415
|
+
}, ee = Fn(t.catAxisFontSizeHpt, c, r);
|
|
3408
3416
|
for (let n = 0; n < v; n++) {
|
|
3409
3417
|
let r = p + k * n + (k - A) / 2;
|
|
3410
3418
|
for (let t = 0; t < y; t++) {
|
|
3411
|
-
let a = i.series[t], o =
|
|
3419
|
+
let a = i.series[t], o = pr(a.valuesByCategory[n] ?? [], a.quartileMethod);
|
|
3412
3420
|
if (!o) continue;
|
|
3413
|
-
let s = r + t * (M + j), c = s + M / 2, l = N(t), u =
|
|
3421
|
+
let s = r + t * (M + j), c = s + M / 2, l = N(t), u = sn(l, .8), d = E(o.q1), f = E(o.q3), p = Math.min(d, f), m = Math.max(1, Math.abs(d - f)), h = M * .4;
|
|
3414
3422
|
e.strokeStyle = u, e.lineWidth = 1, e.beginPath(), e.moveTo(c, E(o.whiskerHi)), e.lineTo(c, f), e.moveTo(c, d), e.lineTo(c, E(o.whiskerLo)), e.moveTo(c - h / 2, E(o.whiskerHi)), e.lineTo(c + h / 2, E(o.whiskerHi)), e.moveTo(c - h / 2, E(o.whiskerLo)), e.lineTo(c + h / 2, E(o.whiskerLo)), e.stroke(), e.fillStyle = l, e.fillRect(s, p, M, m), e.strokeStyle = u, e.lineWidth = .75, e.strokeRect(s + .375, p + .375, M - .75, m - .75);
|
|
3415
3423
|
let g = E(o.median);
|
|
3416
3424
|
if (e.strokeStyle = u, e.lineWidth = 1, e.beginPath(), e.moveTo(s, g), e.lineTo(s + M, g), e.stroke(), a.meanMarker) {
|
|
@@ -3431,7 +3439,7 @@ function pr(e, t, n, r) {
|
|
|
3431
3439
|
}
|
|
3432
3440
|
e.restore();
|
|
3433
3441
|
}
|
|
3434
|
-
function
|
|
3442
|
+
function hr(e) {
|
|
3435
3443
|
let t = {
|
|
3436
3444
|
label: "",
|
|
3437
3445
|
value: 0,
|
|
@@ -3458,19 +3466,19 @@ function mr(e) {
|
|
|
3458
3466
|
}
|
|
3459
3467
|
return t.value = t.children.reduce((e, t) => e + t.value, 0), t;
|
|
3460
3468
|
}
|
|
3461
|
-
function
|
|
3469
|
+
function gr(e) {
|
|
3462
3470
|
let t = e.children.reduce((e, t) => e + t.value, 0);
|
|
3463
3471
|
if (t <= 0) return;
|
|
3464
3472
|
let n = e.a0;
|
|
3465
3473
|
for (let r of e.children) {
|
|
3466
3474
|
let i = (e.a1 - e.a0) * r.value / t;
|
|
3467
|
-
r.a0 = n, r.a1 = n + i, n = r.a1,
|
|
3475
|
+
r.a0 = n, r.a1 = n + i, n = r.a1, gr(r);
|
|
3468
3476
|
}
|
|
3469
3477
|
}
|
|
3470
|
-
function
|
|
3471
|
-
return e.children.length === 0 ? e.depth : Math.max(...e.children.map(
|
|
3478
|
+
function _r(e) {
|
|
3479
|
+
return e.children.length === 0 ? e.depth : Math.max(...e.children.map(_r));
|
|
3472
3480
|
}
|
|
3473
|
-
function
|
|
3481
|
+
function vr(e, t, n, r) {
|
|
3474
3482
|
let i = t.chartexSunburst;
|
|
3475
3483
|
if (!i || i.rows.length === 0) return;
|
|
3476
3484
|
let { x: a, y: o, w: s, h: c } = n, l = nt(t, a, o, s, c, r, {
|
|
@@ -3479,11 +3487,11 @@ function _r(e, t, n, r) {
|
|
|
3479
3487
|
legendSideReserveFrac: 0,
|
|
3480
3488
|
radialGapFrac: .02
|
|
3481
3489
|
});
|
|
3482
|
-
|
|
3483
|
-
let { px0: u, py0: d, pw: f, ph: p } = l.plotRect, m = u + f / 2, h = d + p / 2, g = Math.min(f, p) * .46, _ =
|
|
3490
|
+
Hn(e, t, a, o + l.title.topPad, s, l.title.fontPx);
|
|
3491
|
+
let { px0: u, py0: d, pw: f, ph: p } = l.plotRect, m = u + f / 2, h = d + p / 2, g = Math.min(f, p) * .46, _ = hr(i.rows);
|
|
3484
3492
|
if (_.value <= 0 || _.children.length === 0) return;
|
|
3485
|
-
_.a0 = -Math.PI / 2, _.a1 = -Math.PI / 2 + Math.PI * 2,
|
|
3486
|
-
let v =
|
|
3493
|
+
_.a0 = -Math.PI / 2, _.a1 = -Math.PI / 2 + Math.PI * 2, gr(_);
|
|
3494
|
+
let v = _r(_) + 1, y = g * .18, b = (g - y) / v, x = t.chartexAccents, S = (e) => `#${x?.[e % x.length] ?? rn[e % rn.length]}`, C = X(t, t.dataLabelFontFace, "minor"), w = Math.max(7, Math.min(13, g * .075)), T = Array.from({ length: v }, () => []), E = (e) => {
|
|
3487
3495
|
e.depth >= 0 && T[e.depth].push(e), e.children.forEach(E);
|
|
3488
3496
|
};
|
|
3489
3497
|
E(_), e.save();
|
|
@@ -3512,7 +3520,7 @@ function _r(e, t, n, r) {
|
|
|
3512
3520
|
}
|
|
3513
3521
|
e.restore();
|
|
3514
3522
|
}
|
|
3515
|
-
function
|
|
3523
|
+
function yr(e, t, n, r = mt) {
|
|
3516
3524
|
e.save();
|
|
3517
3525
|
try {
|
|
3518
3526
|
let { x: i, y: a, w: o, h: s } = n;
|
|
@@ -3533,42 +3541,42 @@ function vr(e, t, n, r = mt) {
|
|
|
3533
3541
|
case "stackedBarH":
|
|
3534
3542
|
case "stackedBarPct":
|
|
3535
3543
|
case "stackedBarHPct":
|
|
3536
|
-
|
|
3544
|
+
Gn(e, t, n, r);
|
|
3537
3545
|
break;
|
|
3538
3546
|
case "line":
|
|
3539
3547
|
case "stackedLine":
|
|
3540
3548
|
case "stackedLinePct":
|
|
3541
|
-
|
|
3549
|
+
Kn(e, t, n, r);
|
|
3542
3550
|
break;
|
|
3543
3551
|
case "area":
|
|
3544
3552
|
case "stackedArea":
|
|
3545
3553
|
case "stackedAreaPct":
|
|
3546
|
-
|
|
3554
|
+
Jn(e, t, n, r);
|
|
3547
3555
|
break;
|
|
3548
3556
|
case "pie":
|
|
3549
|
-
|
|
3557
|
+
Xn(e, t, n, !1, r);
|
|
3550
3558
|
break;
|
|
3551
3559
|
case "doughnut":
|
|
3552
|
-
|
|
3560
|
+
Xn(e, t, n, !0, r);
|
|
3553
3561
|
break;
|
|
3554
3562
|
case "radar":
|
|
3555
|
-
|
|
3563
|
+
$n(e, t, n, r);
|
|
3556
3564
|
break;
|
|
3557
3565
|
case "scatter":
|
|
3558
3566
|
case "bubble":
|
|
3559
|
-
|
|
3567
|
+
er(e, t, n, r);
|
|
3560
3568
|
break;
|
|
3561
3569
|
case "waterfall":
|
|
3562
|
-
|
|
3570
|
+
dr(e, t, n);
|
|
3563
3571
|
break;
|
|
3564
3572
|
case "stock":
|
|
3565
|
-
|
|
3573
|
+
qn(e, t, n, r);
|
|
3566
3574
|
break;
|
|
3567
3575
|
case "boxWhisker":
|
|
3568
|
-
|
|
3576
|
+
mr(e, t, n, r);
|
|
3569
3577
|
break;
|
|
3570
3578
|
case "sunburst":
|
|
3571
|
-
|
|
3579
|
+
vr(e, t, n, r);
|
|
3572
3580
|
break;
|
|
3573
3581
|
default: e.fillStyle = "#888", e.font = "11px sans-serif", e.textAlign = "center", e.textBaseline = "middle", e.fillText(`Chart: ${t.chartType}`, i + o / 2, a + s / 2);
|
|
3574
3582
|
}
|
|
@@ -3578,7 +3586,7 @@ function vr(e, t, n, r = mt) {
|
|
|
3578
3586
|
}
|
|
3579
3587
|
//#endregion
|
|
3580
3588
|
//#region packages/core/src/autoResize.ts
|
|
3581
|
-
function
|
|
3589
|
+
function br(e, t, n = {}) {
|
|
3582
3590
|
let r = n.pauseWhenHidden ?? !0, i = null, a = 0, o = 0, s = null, c = !1, l = !1, u = () => {
|
|
3583
3591
|
if (!l && !(r && typeof document < "u" && document.hidden)) {
|
|
3584
3592
|
if (s) {
|
|
@@ -3613,7 +3621,7 @@ function yr(e, t, n = {}) {
|
|
|
3613
3621
|
l = !0, f.disconnect(), i !== null && (cancelAnimationFrame(i), i = null), r && typeof document < "u" && document.removeEventListener("visibilitychange", p);
|
|
3614
3622
|
};
|
|
3615
3623
|
}
|
|
3616
|
-
var
|
|
3624
|
+
var xr = {
|
|
3617
3625
|
accentbordercallout1: {
|
|
3618
3626
|
adj: [
|
|
3619
3627
|
["adj1", "val 18750"],
|
|
@@ -25476,15 +25484,15 @@ var br = {
|
|
|
25476
25484
|
]
|
|
25477
25485
|
}]
|
|
25478
25486
|
}
|
|
25479
|
-
},
|
|
25480
|
-
function
|
|
25487
|
+
}, Sr = 216e5, Cr = Math.PI * 2 / Sr;
|
|
25488
|
+
function wr(e) {
|
|
25481
25489
|
let t = e.trim().split(/\s+/);
|
|
25482
25490
|
return {
|
|
25483
25491
|
op: t[0],
|
|
25484
25492
|
argTokens: t.slice(1)
|
|
25485
25493
|
};
|
|
25486
25494
|
}
|
|
25487
|
-
function
|
|
25495
|
+
function Tr(e, t, n) {
|
|
25488
25496
|
let { w: r, h: i, adj: a } = e, o = Math.min(r, i), s = Math.max(r, i), c = Object.create(null);
|
|
25489
25497
|
Object.assign(c, {
|
|
25490
25498
|
w: r,
|
|
@@ -25529,14 +25537,14 @@ function wr(e, t, n) {
|
|
|
25529
25537
|
lsd8: s / 8,
|
|
25530
25538
|
lsd16: s / 16,
|
|
25531
25539
|
lsd32: s / 32,
|
|
25532
|
-
cd:
|
|
25533
|
-
cd2:
|
|
25534
|
-
cd4:
|
|
25535
|
-
cd8:
|
|
25536
|
-
"3cd4": 3 *
|
|
25537
|
-
"3cd8": 3 *
|
|
25538
|
-
"5cd8": 5 *
|
|
25539
|
-
"7cd8": 7 *
|
|
25540
|
+
cd: Sr,
|
|
25541
|
+
cd2: Sr / 2,
|
|
25542
|
+
cd4: Sr / 4,
|
|
25543
|
+
cd8: Sr / 8,
|
|
25544
|
+
"3cd4": 3 * Sr / 4,
|
|
25545
|
+
"3cd8": 3 * Sr / 8,
|
|
25546
|
+
"5cd8": 5 * Sr / 8,
|
|
25547
|
+
"7cd8": 7 * Sr / 8
|
|
25540
25548
|
}), t.forEach(([e, t], n) => {
|
|
25541
25549
|
let r = a[n];
|
|
25542
25550
|
c[e] = typeof r == "number" ? r : u(t), e === "adj" && (c.adj1 = c.adj), e === "adj1" && (c.adj = c.adj1);
|
|
@@ -25573,10 +25581,10 @@ function wr(e, t, n) {
|
|
|
25573
25581
|
case "pin": return t[1] < t[0] ? t[0] : t[1] > t[2] ? t[2] : t[1];
|
|
25574
25582
|
case "sqrt": return Math.sqrt(Math.max(0, t[0]));
|
|
25575
25583
|
case "mod": return Math.sqrt(t[0] * t[0] + t[1] * t[1] + t[2] * t[2]);
|
|
25576
|
-
case "sin": return t[0] * Math.sin(t[1] *
|
|
25577
|
-
case "cos": return t[0] * Math.cos(t[1] *
|
|
25578
|
-
case "tan": return t[0] * Math.tan(t[1] *
|
|
25579
|
-
case "at2": return Math.atan2(t[1], t[0]) /
|
|
25584
|
+
case "sin": return t[0] * Math.sin(t[1] * Cr);
|
|
25585
|
+
case "cos": return t[0] * Math.cos(t[1] * Cr);
|
|
25586
|
+
case "tan": return t[0] * Math.tan(t[1] * Cr);
|
|
25587
|
+
case "at2": return Math.atan2(t[1], t[0]) / Cr;
|
|
25580
25588
|
case "cat2": return t[0] * Math.cos(Math.atan2(t[2], t[1]));
|
|
25581
25589
|
case "sat2": return t[0] * Math.sin(Math.atan2(t[2], t[1]));
|
|
25582
25590
|
default: throw Error(`preset-shape: unknown operator "${e}" in "${[n.op, ...n.argTokens].join(" ")}"`);
|
|
@@ -25585,8 +25593,8 @@ function wr(e, t, n) {
|
|
|
25585
25593
|
}
|
|
25586
25594
|
//#endregion
|
|
25587
25595
|
//#region packages/core/src/shape/preset-geometry/path-executor.ts
|
|
25588
|
-
var
|
|
25589
|
-
function
|
|
25596
|
+
var Er = Math.PI * 2 / 216e5;
|
|
25597
|
+
function Dr(e, t, n, r, i, a, o) {
|
|
25590
25598
|
let s = t.w == null ? 1 : a / t.w, c = t.h == null ? 1 : o / t.h, l = (e) => r + e * s, u = (e) => i + e * c, d = 0, f = 0;
|
|
25591
25599
|
for (let r of t.cmds) switch (r[0]) {
|
|
25592
25600
|
case "m": {
|
|
@@ -25610,7 +25618,7 @@ function Er(e, t, n, r, i, a, o) {
|
|
|
25610
25618
|
break;
|
|
25611
25619
|
}
|
|
25612
25620
|
case "a": {
|
|
25613
|
-
let t = n.resolve(r[1]), i = n.resolve(r[2]), a = t * s, o = i * c, l = n.resolve(r[3]) *
|
|
25621
|
+
let t = n.resolve(r[1]), i = n.resolve(r[2]), a = t * s, o = i * c, l = n.resolve(r[3]) * Er, u = n.resolve(r[4]) * Er, p = Math.PI * 2, m = (e) => Math.atan2(t * Math.sin(e), i * Math.cos(e)), h = m(l), g = Math.trunc(u / p), _ = u - g * p, v = m(l + _) - h;
|
|
25614
25622
|
_ > 0 && v < 0 ? v += p : _ < 0 && v > 0 && (v -= p);
|
|
25615
25623
|
let y = h + v + g * p, b = d - a * Math.cos(h), x = f - o * Math.sin(h);
|
|
25616
25624
|
Math.abs(a) > 1e-6 && Math.abs(o) > 1e-6 && (e.ellipse(b, x, Math.abs(a), Math.abs(o), 0, h, y, u < 0), d = b + a * Math.cos(y), f = x + o * Math.sin(y));
|
|
@@ -25623,37 +25631,37 @@ function Er(e, t, n, r, i, a, o) {
|
|
|
25623
25631
|
}
|
|
25624
25632
|
//#endregion
|
|
25625
25633
|
//#region packages/core/src/shape/preset-geometry/index.ts
|
|
25626
|
-
var
|
|
25627
|
-
function
|
|
25628
|
-
let t =
|
|
25634
|
+
var Or = xr, kr = /* @__PURE__ */ new WeakMap();
|
|
25635
|
+
function Ar(e) {
|
|
25636
|
+
let t = kr.get(e);
|
|
25629
25637
|
return t || (t = {
|
|
25630
|
-
adj: e.adj.map(([e, t]) => [e,
|
|
25631
|
-
gd: e.gd.map(([e, t]) => [e,
|
|
25632
|
-
},
|
|
25638
|
+
adj: e.adj.map(([e, t]) => [e, wr(t)]),
|
|
25639
|
+
gd: e.gd.map(([e, t]) => [e, wr(t)])
|
|
25640
|
+
}, kr.set(e, t)), t;
|
|
25633
25641
|
}
|
|
25634
|
-
function
|
|
25635
|
-
let i =
|
|
25636
|
-
return
|
|
25642
|
+
function jr(e, t, n, r) {
|
|
25643
|
+
let i = Ar(e);
|
|
25644
|
+
return Tr({
|
|
25637
25645
|
w: t,
|
|
25638
25646
|
h: n,
|
|
25639
25647
|
adj: r
|
|
25640
25648
|
}, i.adj, i.gd);
|
|
25641
25649
|
}
|
|
25642
|
-
function
|
|
25643
|
-
return e.toLowerCase() in
|
|
25650
|
+
function Mr(e) {
|
|
25651
|
+
return e.toLowerCase() in Or;
|
|
25644
25652
|
}
|
|
25645
|
-
function
|
|
25646
|
-
let s =
|
|
25653
|
+
function Nr(e, t, n, r, i, a, o = []) {
|
|
25654
|
+
let s = Or[t.toLowerCase()];
|
|
25647
25655
|
if (!s) return !1;
|
|
25648
|
-
let c =
|
|
25649
|
-
for (let t of s.paths)
|
|
25656
|
+
let c = jr(s, i, a, o);
|
|
25657
|
+
for (let t of s.paths) Dr(e, t, c, n, r, i, a);
|
|
25650
25658
|
return !0;
|
|
25651
25659
|
}
|
|
25652
|
-
var
|
|
25660
|
+
var Pr = {
|
|
25653
25661
|
wedgeroundrectcallout: "roundrect",
|
|
25654
25662
|
wedgeellipsecallout: "ellipse",
|
|
25655
25663
|
wedgerectcallout: null
|
|
25656
|
-
},
|
|
25664
|
+
}, Fr = {
|
|
25657
25665
|
adj: [],
|
|
25658
25666
|
gd: [],
|
|
25659
25667
|
paths: [{
|
|
@@ -25687,30 +25695,30 @@ var Nr = {
|
|
|
25687
25695
|
]
|
|
25688
25696
|
}]
|
|
25689
25697
|
};
|
|
25690
|
-
function
|
|
25698
|
+
function Ir(e, t, n) {
|
|
25691
25699
|
let r = e[n];
|
|
25692
25700
|
if (typeof r == "number") return r;
|
|
25693
25701
|
let i = t.adj[n];
|
|
25694
25702
|
return i && Number(i[1].replace(/^val\s+/, "")) || 0;
|
|
25695
25703
|
}
|
|
25696
|
-
function
|
|
25697
|
-
let d = t.toLowerCase(), f =
|
|
25704
|
+
function Lr(e, t, n, r, i, a, o, s, c, l, u) {
|
|
25705
|
+
let d = t.toLowerCase(), f = Or[d];
|
|
25698
25706
|
if (!f) return !1;
|
|
25699
|
-
if (d in
|
|
25700
|
-
let e =
|
|
25707
|
+
if (d in Pr) {
|
|
25708
|
+
let e = Ir(o, f, 0), t = Ir(o, f, 1), n = i / 2 + i * e / 1e5, r = a / 2 + a * t / 1e5;
|
|
25701
25709
|
if (n >= 0 && n <= i && r >= 0 && r <= a) {
|
|
25702
|
-
let e =
|
|
25703
|
-
e === "roundrect" ? (f =
|
|
25710
|
+
let e = Pr[d];
|
|
25711
|
+
e === "roundrect" ? (f = Or.roundrect, o = [Ir(o, Or[d], 2)]) : e && Or[e] ? (f = Or[e], o = []) : (f = Fr, o = []);
|
|
25704
25712
|
}
|
|
25705
25713
|
}
|
|
25706
|
-
let p =
|
|
25714
|
+
let p = jr(f, i, a, o), m = !1, h = f.paths.length - 1;
|
|
25707
25715
|
for (let t = 0; t < f.paths.length; t++) {
|
|
25708
25716
|
let o = f.paths[t];
|
|
25709
|
-
e.beginPath(),
|
|
25717
|
+
e.beginPath(), Dr(e, o, p, n, r, i, a);
|
|
25710
25718
|
let d = o.fill;
|
|
25711
25719
|
if (d !== "none" && s != null) {
|
|
25712
25720
|
e.save(), e.fillStyle = s, e.fill();
|
|
25713
|
-
let t =
|
|
25721
|
+
let t = zr(d);
|
|
25714
25722
|
t && (e.fillStyle = t, e.fill()), e.restore(), m ||= (l(), !0);
|
|
25715
25723
|
}
|
|
25716
25724
|
if (o.stroke && c) {
|
|
@@ -25720,10 +25728,10 @@ function Ir(e, t, n, r, i, a, o, s, c, l, u) {
|
|
|
25720
25728
|
}
|
|
25721
25729
|
return !0;
|
|
25722
25730
|
}
|
|
25723
|
-
function
|
|
25724
|
-
let o =
|
|
25731
|
+
function Rr(e, t, n, r, i, a) {
|
|
25732
|
+
let o = Or[e.toLowerCase()];
|
|
25725
25733
|
if (!o || o.paths.length === 0) return null;
|
|
25726
|
-
let s = o.paths[o.paths.length - 1], c =
|
|
25734
|
+
let s = o.paths[o.paths.length - 1], c = jr(o, r, i, a), l = s.w == null ? 1 : r / s.w, u = s.h == null ? 1 : i / s.h, d = (e) => t + e * l, f = (e) => n + e * u, p = 0, m = 0, h = 0, g = 0, _ = 0, v = 0, y = !1, b = 0, x = 0, S = [];
|
|
25727
25735
|
for (let e of s.cmds) switch (e[0]) {
|
|
25728
25736
|
case "m":
|
|
25729
25737
|
h = d(c.resolve(e[1])), g = f(c.resolve(e[2])), p = h, m = g, S.push({
|
|
@@ -25763,7 +25771,7 @@ function Lr(e, t, n, r, i, a) {
|
|
|
25763
25771
|
vertices: S
|
|
25764
25772
|
};
|
|
25765
25773
|
}
|
|
25766
|
-
function
|
|
25774
|
+
function zr(e) {
|
|
25767
25775
|
switch (e) {
|
|
25768
25776
|
case "lighten": return "rgba(255,255,255,0.30)";
|
|
25769
25777
|
case "lightenLess": return "rgba(255,255,255,0.15)";
|
|
@@ -25774,21 +25782,21 @@ function Rr(e) {
|
|
|
25774
25782
|
}
|
|
25775
25783
|
//#endregion
|
|
25776
25784
|
//#region packages/core/src/image/svg-image-by-path.ts
|
|
25777
|
-
var
|
|
25778
|
-
function
|
|
25779
|
-
let t =
|
|
25785
|
+
var Br = /* @__PURE__ */ new WeakMap(), Vr = 256;
|
|
25786
|
+
function Hr(e) {
|
|
25787
|
+
let t = Br.get(e);
|
|
25780
25788
|
return t || (t = {
|
|
25781
25789
|
imgs: /* @__PURE__ */ new Map(),
|
|
25782
25790
|
urls: /* @__PURE__ */ new Map()
|
|
25783
|
-
},
|
|
25791
|
+
}, Br.set(e, t)), t;
|
|
25784
25792
|
}
|
|
25785
|
-
function
|
|
25793
|
+
function Ur(e, t) {
|
|
25786
25794
|
e.imgs.delete(t);
|
|
25787
25795
|
let n = e.urls.get(t);
|
|
25788
25796
|
n && (URL.revokeObjectURL(n), e.urls.delete(t));
|
|
25789
25797
|
}
|
|
25790
|
-
function
|
|
25791
|
-
let n =
|
|
25798
|
+
function Wr(e, t) {
|
|
25799
|
+
let n = Hr(t), r = n.imgs.get(e);
|
|
25792
25800
|
if (r) return n.imgs.delete(e), n.imgs.set(e, r), r;
|
|
25793
25801
|
let i = (async () => {
|
|
25794
25802
|
let r = await t(e, "image/svg+xml"), i = URL.createObjectURL(r);
|
|
@@ -25800,30 +25808,30 @@ function Ur(e, t) {
|
|
|
25800
25808
|
}, a.onerror = () => n(/* @__PURE__ */ Error(`svg load failed: ${e}`)), a.src = i;
|
|
25801
25809
|
}), a;
|
|
25802
25810
|
})();
|
|
25803
|
-
if (i.catch(() =>
|
|
25811
|
+
if (i.catch(() => Ur(n, e)), n.imgs.set(e, i), n.imgs.size > Vr) {
|
|
25804
25812
|
let e = n.imgs.keys().next().value;
|
|
25805
|
-
|
|
25813
|
+
Ur(n, e);
|
|
25806
25814
|
}
|
|
25807
25815
|
return i;
|
|
25808
25816
|
}
|
|
25809
|
-
function
|
|
25810
|
-
let t =
|
|
25817
|
+
function Gr(e) {
|
|
25818
|
+
let t = Br.get(e);
|
|
25811
25819
|
if (t) {
|
|
25812
25820
|
for (let e of t.urls.values()) URL.revokeObjectURL(e);
|
|
25813
|
-
t.urls.clear(), t.imgs.clear(),
|
|
25821
|
+
t.urls.clear(), t.imgs.clear(), Br.delete(e);
|
|
25814
25822
|
}
|
|
25815
25823
|
}
|
|
25816
25824
|
//#endregion
|
|
25817
25825
|
//#region packages/core/src/image/pixel-budget.ts
|
|
25818
|
-
var
|
|
25819
|
-
function
|
|
25826
|
+
var Kr = 32767, qr = 1 << 26, Jr = Kr, Yr = qr;
|
|
25827
|
+
function Xr(e, t, n, r, i) {
|
|
25820
25828
|
if (n < 40 || t + 40 > e.byteLength) return null;
|
|
25821
25829
|
let a = e.getUint32(t, !0);
|
|
25822
25830
|
if (a < 40) return null;
|
|
25823
25831
|
let o = e.getInt32(t + 4, !0), s = e.getInt32(t + 8, !0), c = e.getUint16(t + 14, !0);
|
|
25824
25832
|
if (e.getUint32(t + 16, !0) !== 0) return null;
|
|
25825
25833
|
let l = s < 0, u = Math.abs(o), d = Math.abs(s);
|
|
25826
|
-
if (u <= 0 || d <= 0 || u >
|
|
25834
|
+
if (u <= 0 || d <= 0 || u > Jr || d > Jr || u * d > Yr) return null;
|
|
25827
25835
|
let f = new Uint8ClampedArray(u * d * 4), p = u * c + 31 >> 5 << 2 >>> 0;
|
|
25828
25836
|
if (r + p * d > r + i + p && r + p * d > e.byteLength) return null;
|
|
25829
25837
|
let m = null;
|
|
@@ -25883,7 +25891,7 @@ function Yr(e, t, n, r, i) {
|
|
|
25883
25891
|
data: f
|
|
25884
25892
|
};
|
|
25885
25893
|
}
|
|
25886
|
-
function
|
|
25894
|
+
function Zr(e, t, n) {
|
|
25887
25895
|
if (n < 40 || t + 40 > e.byteLength) return null;
|
|
25888
25896
|
let r = e.getUint32(t, !0);
|
|
25889
25897
|
if (r < 40) return null;
|
|
@@ -25893,9 +25901,9 @@ function Xr(e, t, n) {
|
|
|
25893
25901
|
n === 0 && (n = 1 << i), a = n;
|
|
25894
25902
|
} else a = e.getUint32(t + 32, !0);
|
|
25895
25903
|
let o = r + a * 4, s = t + o, c = n - o;
|
|
25896
|
-
return c <= 0 ? null :
|
|
25904
|
+
return c <= 0 ? null : Xr(e, t, o, s, c);
|
|
25897
25905
|
}
|
|
25898
|
-
function
|
|
25906
|
+
function Qr(e, t, n, r, i, a) {
|
|
25899
25907
|
try {
|
|
25900
25908
|
let o = It(t.width, t.height);
|
|
25901
25909
|
if (!o) return !1;
|
|
@@ -25962,7 +25970,7 @@ var Z = {
|
|
|
25962
25970
|
EXTCREATEPEN: 95,
|
|
25963
25971
|
BITBLT: 76,
|
|
25964
25972
|
STRETCHDIBITS: 81
|
|
25965
|
-
},
|
|
25973
|
+
}, $r = {
|
|
25966
25974
|
WHITE_BRUSH: 2147483648,
|
|
25967
25975
|
LTGRAY_BRUSH: 2147483649,
|
|
25968
25976
|
GRAY_BRUSH: 2147483650,
|
|
@@ -25974,7 +25982,7 @@ var Z = {
|
|
|
25974
25982
|
NULL_PEN: 2147483656,
|
|
25975
25983
|
DC_BRUSH: 2147483666,
|
|
25976
25984
|
DC_PEN: 2147483662
|
|
25977
|
-
},
|
|
25985
|
+
}, ei = {
|
|
25978
25986
|
TEXT: 1,
|
|
25979
25987
|
LOMETRIC: 2,
|
|
25980
25988
|
HIMETRIC: 3,
|
|
@@ -25983,7 +25991,7 @@ var Z = {
|
|
|
25983
25991
|
TWIPS: 6,
|
|
25984
25992
|
ISOTROPIC: 7,
|
|
25985
25993
|
ANISOTROPIC: 8
|
|
25986
|
-
},
|
|
25994
|
+
}, ti = () => ({
|
|
25987
25995
|
m11: 1,
|
|
25988
25996
|
m12: 0,
|
|
25989
25997
|
m21: 0,
|
|
@@ -25991,7 +25999,7 @@ var Z = {
|
|
|
25991
25999
|
dx: 0,
|
|
25992
26000
|
dy: 0
|
|
25993
26001
|
});
|
|
25994
|
-
function
|
|
26002
|
+
function ni(e, t) {
|
|
25995
26003
|
return {
|
|
25996
26004
|
m11: e.m11 * t.m11 + e.m21 * t.m12,
|
|
25997
26005
|
m12: e.m12 * t.m11 + e.m22 * t.m12,
|
|
@@ -26001,7 +26009,7 @@ function ti(e, t) {
|
|
|
26001
26009
|
dy: e.m12 * t.dx + e.m22 * t.dy + e.dy
|
|
26002
26010
|
};
|
|
26003
26011
|
}
|
|
26004
|
-
var
|
|
26012
|
+
var ri = class {
|
|
26005
26013
|
p;
|
|
26006
26014
|
constructor(e, t, n) {
|
|
26007
26015
|
this.dv = e, this.end = n, this.p = t;
|
|
@@ -26045,137 +26053,137 @@ var ni = class {
|
|
|
26045
26053
|
this.p += e;
|
|
26046
26054
|
}
|
|
26047
26055
|
};
|
|
26048
|
-
function
|
|
26056
|
+
function ii(e, t, n) {
|
|
26049
26057
|
return e.wt.m11 * t + e.wt.m21 * n + e.wt.dx;
|
|
26050
26058
|
}
|
|
26051
|
-
function
|
|
26059
|
+
function ai(e, t, n) {
|
|
26052
26060
|
return e.wt.m12 * t + e.wt.m22 * n + e.wt.dy;
|
|
26053
26061
|
}
|
|
26054
|
-
function ai(e) {
|
|
26055
|
-
return e.winExtX === 0 ? 1 : e.vpExtX / e.winExtX;
|
|
26056
|
-
}
|
|
26057
26062
|
function oi(e) {
|
|
26058
|
-
return e.
|
|
26063
|
+
return e.winExtX === 0 ? 1 : e.vpExtX / e.winExtX;
|
|
26059
26064
|
}
|
|
26060
26065
|
function si(e) {
|
|
26061
|
-
return
|
|
26066
|
+
return e.winExtY === 0 ? 1 : e.vpExtY / e.winExtY;
|
|
26062
26067
|
}
|
|
26063
26068
|
function ci(e) {
|
|
26064
|
-
return
|
|
26069
|
+
return Math.min(Math.abs(oi(e)), Math.abs(si(e)));
|
|
26065
26070
|
}
|
|
26066
26071
|
function li(e) {
|
|
26067
|
-
return e.mapMode ===
|
|
26072
|
+
return e.mapMode === ei.ISOTROPIC ? oi(e) < 0 ? -ci(e) : ci(e) : oi(e);
|
|
26068
26073
|
}
|
|
26069
|
-
function ui(e
|
|
26070
|
-
return (
|
|
26074
|
+
function ui(e) {
|
|
26075
|
+
return e.mapMode === ei.ISOTROPIC ? si(e) < 0 ? -ci(e) : ci(e) : si(e);
|
|
26071
26076
|
}
|
|
26072
26077
|
function di(e, t) {
|
|
26073
|
-
return (t - e.
|
|
26078
|
+
return (t - e.winOrgX) * li(e) + e.vpOrgX;
|
|
26079
|
+
}
|
|
26080
|
+
function fi(e, t) {
|
|
26081
|
+
return (t - e.winOrgY) * ui(e) + e.vpOrgY;
|
|
26074
26082
|
}
|
|
26075
26083
|
function Q(e, t, n) {
|
|
26076
|
-
let r =
|
|
26084
|
+
let r = di(e, ii(e, t, n)), i = fi(e, ai(e, t, n));
|
|
26077
26085
|
return [(r - e.left) * e.W / e.boundsW, (i - e.top) * e.H / e.boundsH];
|
|
26078
26086
|
}
|
|
26079
|
-
function fi(e) {
|
|
26080
|
-
return (Math.hypot(e.wt.m11, e.wt.m12) + Math.hypot(e.wt.m21, e.wt.m22)) / 2;
|
|
26081
|
-
}
|
|
26082
26087
|
function pi(e) {
|
|
26083
|
-
return (Math.
|
|
26088
|
+
return (Math.hypot(e.wt.m11, e.wt.m12) + Math.hypot(e.wt.m21, e.wt.m22)) / 2;
|
|
26084
26089
|
}
|
|
26085
26090
|
function mi(e) {
|
|
26086
|
-
return (
|
|
26091
|
+
return (Math.abs(li(e)) + Math.abs(ui(e))) / 2;
|
|
26087
26092
|
}
|
|
26088
26093
|
function hi(e) {
|
|
26089
|
-
return
|
|
26094
|
+
return (e.W / e.boundsW + e.H / e.boundsH) / 2;
|
|
26090
26095
|
}
|
|
26091
26096
|
function gi(e) {
|
|
26097
|
+
return Math.hypot(e.wt.m21, e.wt.m22);
|
|
26098
|
+
}
|
|
26099
|
+
function _i(e) {
|
|
26092
26100
|
return e.H / e.boundsH;
|
|
26093
26101
|
}
|
|
26094
|
-
function
|
|
26095
|
-
let n = t *
|
|
26102
|
+
function vi(e, t) {
|
|
26103
|
+
let n = t * pi(e) * mi(e) * hi(e);
|
|
26096
26104
|
return Math.max(.75, n);
|
|
26097
26105
|
}
|
|
26098
|
-
function
|
|
26099
|
-
if (e.mapMode = t, t ===
|
|
26106
|
+
function yi(e, t) {
|
|
26107
|
+
if (e.mapMode = t, t === ei.TEXT) {
|
|
26100
26108
|
e.winOrgX = 0, e.winOrgY = 0, e.vpOrgX = 0, e.vpOrgY = 0, e.winExtX = 1, e.winExtY = 1, e.vpExtX = 1, e.vpExtY = 1;
|
|
26101
26109
|
return;
|
|
26102
26110
|
}
|
|
26103
|
-
if (t ===
|
|
26104
|
-
let n = 25.4, r = t ===
|
|
26111
|
+
if (t === ei.ANISOTROPIC || t === ei.ISOTROPIC || e.devPxPerMmX <= 0 || e.devPxPerMmY <= 0) return;
|
|
26112
|
+
let n = 25.4, r = t === ei.LOMETRIC ? .1 : t === ei.HIMETRIC ? .01 : t === ei.LOENGLISH ? .01 * n : t === ei.HIENGLISH ? .001 * n : t === ei.TWIPS ? n / 1440 : 0;
|
|
26105
26113
|
r <= 0 || (e.winOrgX = 0, e.winOrgY = 0, e.vpOrgX = 0, e.vpOrgY = 0, e.winExtX = 1, e.winExtY = 1, e.vpExtX = r * e.devPxPerMmX, e.vpExtY = -(r * e.devPxPerMmY));
|
|
26106
26114
|
}
|
|
26107
|
-
var
|
|
26108
|
-
[
|
|
26115
|
+
var bi = {
|
|
26116
|
+
[$r.WHITE_BRUSH]: {
|
|
26109
26117
|
kind: "brush",
|
|
26110
26118
|
fill: "#ffffff"
|
|
26111
26119
|
},
|
|
26112
|
-
[
|
|
26120
|
+
[$r.LTGRAY_BRUSH]: {
|
|
26113
26121
|
kind: "brush",
|
|
26114
26122
|
fill: "#c0c0c0"
|
|
26115
26123
|
},
|
|
26116
|
-
[
|
|
26124
|
+
[$r.GRAY_BRUSH]: {
|
|
26117
26125
|
kind: "brush",
|
|
26118
26126
|
fill: "#808080"
|
|
26119
26127
|
},
|
|
26120
|
-
[
|
|
26128
|
+
[$r.DKGRAY_BRUSH]: {
|
|
26121
26129
|
kind: "brush",
|
|
26122
26130
|
fill: "#404040"
|
|
26123
26131
|
},
|
|
26124
|
-
[
|
|
26132
|
+
[$r.BLACK_BRUSH]: {
|
|
26125
26133
|
kind: "brush",
|
|
26126
26134
|
fill: "#000000"
|
|
26127
26135
|
},
|
|
26128
|
-
[
|
|
26136
|
+
[$r.NULL_BRUSH]: {
|
|
26129
26137
|
kind: "brush",
|
|
26130
26138
|
fill: null
|
|
26131
26139
|
}
|
|
26132
|
-
},
|
|
26133
|
-
[
|
|
26140
|
+
}, xi = {
|
|
26141
|
+
[$r.WHITE_PEN]: {
|
|
26134
26142
|
kind: "pen",
|
|
26135
26143
|
stroke: "#ffffff",
|
|
26136
26144
|
width: 1
|
|
26137
26145
|
},
|
|
26138
|
-
[
|
|
26146
|
+
[$r.BLACK_PEN]: {
|
|
26139
26147
|
kind: "pen",
|
|
26140
26148
|
stroke: "#000000",
|
|
26141
26149
|
width: 1
|
|
26142
26150
|
},
|
|
26143
|
-
[
|
|
26151
|
+
[$r.NULL_PEN]: {
|
|
26144
26152
|
kind: "pen",
|
|
26145
26153
|
stroke: null,
|
|
26146
26154
|
width: 1
|
|
26147
26155
|
},
|
|
26148
|
-
[
|
|
26156
|
+
[$r.DC_PEN]: {
|
|
26149
26157
|
kind: "pen",
|
|
26150
26158
|
stroke: "#000000",
|
|
26151
26159
|
width: 1
|
|
26152
26160
|
}
|
|
26153
26161
|
};
|
|
26154
|
-
function
|
|
26155
|
-
let n =
|
|
26162
|
+
function Si(e, t) {
|
|
26163
|
+
let n = bi[t];
|
|
26156
26164
|
if (n) {
|
|
26157
26165
|
e.curBrush = n;
|
|
26158
26166
|
return;
|
|
26159
26167
|
}
|
|
26160
|
-
let r =
|
|
26168
|
+
let r = xi[t];
|
|
26161
26169
|
if (r) {
|
|
26162
26170
|
e.curPen = r;
|
|
26163
26171
|
return;
|
|
26164
26172
|
}
|
|
26165
|
-
t ===
|
|
26173
|
+
t === $r.DC_BRUSH && (e.curBrush = e.curBrush ?? {
|
|
26166
26174
|
kind: "brush",
|
|
26167
26175
|
fill: "#000000"
|
|
26168
26176
|
});
|
|
26169
26177
|
}
|
|
26170
|
-
function
|
|
26178
|
+
function Ci(e) {
|
|
26171
26179
|
let t = 0, n = 0, r = 0, i = 0;
|
|
26172
26180
|
for (let a = 0; a < e.data.length; a += 4) e.data[a + 3] !== 0 && (t += e.data[a], n += e.data[a + 1], r += e.data[a + 2], i++);
|
|
26173
26181
|
if (i === 0) return "#808080";
|
|
26174
26182
|
let a = (e) => Math.round(e / i).toString(16).padStart(2, "0");
|
|
26175
26183
|
return `#${a(t)}${a(n)}${a(r)}`;
|
|
26176
26184
|
}
|
|
26177
|
-
var
|
|
26178
|
-
function
|
|
26185
|
+
var wi = (e) => [e.i16(), e.i16()], Ti = (e) => [e.i32(), e.i32()];
|
|
26186
|
+
function Ei(e, t, n) {
|
|
26179
26187
|
t.skip(16);
|
|
26180
26188
|
let r = t.u32();
|
|
26181
26189
|
if (r < 2 || r > 1048576 || !e.curPen || e.curPen.stroke == null) return;
|
|
@@ -26186,9 +26194,9 @@ function Ti(e, t, n) {
|
|
|
26186
26194
|
let [r, c] = n(t), [l, u] = Q(e, r, c);
|
|
26187
26195
|
s === 0 ? i.moveTo(l, u) : i.lineTo(l, u), a = r, o = c;
|
|
26188
26196
|
}
|
|
26189
|
-
i.strokeStyle = e.curPen.stroke, i.lineWidth =
|
|
26197
|
+
i.strokeStyle = e.curPen.stroke, i.lineWidth = vi(e, e.curPen.width), i.stroke(), e.drew = !0, e.curX = a, e.curY = o;
|
|
26190
26198
|
}
|
|
26191
|
-
function
|
|
26199
|
+
function Di(e, t, n) {
|
|
26192
26200
|
t.skip(16);
|
|
26193
26201
|
let r = t.u32();
|
|
26194
26202
|
if (r < 1 || r > 1048576) return;
|
|
@@ -26206,9 +26214,9 @@ function Ei(e, t, n) {
|
|
|
26206
26214
|
}
|
|
26207
26215
|
e.curX = r, e.curY = o;
|
|
26208
26216
|
}
|
|
26209
|
-
a && e.curPen && (i.strokeStyle = e.curPen.stroke, i.lineWidth =
|
|
26217
|
+
a && e.curPen && (i.strokeStyle = e.curPen.stroke, i.lineWidth = vi(e, e.curPen.width), i.stroke(), e.drew = !0);
|
|
26210
26218
|
}
|
|
26211
|
-
function
|
|
26219
|
+
function Oi(e, t, n) {
|
|
26212
26220
|
t.skip(16);
|
|
26213
26221
|
let r = t.u32();
|
|
26214
26222
|
if (r < 2 || r > 1048576) return;
|
|
@@ -26219,9 +26227,9 @@ function Di(e, t, n) {
|
|
|
26219
26227
|
let [r, o] = n(t), [s, c] = Q(e, r, o);
|
|
26220
26228
|
a ? i.lineTo(s, c) : (i.moveTo(s, c), a = !0);
|
|
26221
26229
|
}
|
|
26222
|
-
a && (i.closePath(), !e.inPath && (e.curBrush && e.curBrush.fill != null && (i.fillStyle = e.curBrush.fill, i.fill(e.fillRule), e.drew = !0), e.curPen && e.curPen.stroke != null && (i.strokeStyle = e.curPen.stroke, i.lineWidth =
|
|
26230
|
+
a && (i.closePath(), !e.inPath && (e.curBrush && e.curBrush.fill != null && (i.fillStyle = e.curBrush.fill, i.fill(e.fillRule), e.drew = !0), e.curPen && e.curPen.stroke != null && (i.strokeStyle = e.curPen.stroke, i.lineWidth = vi(e, e.curPen.width), i.stroke(), e.drew = !0)));
|
|
26223
26231
|
}
|
|
26224
|
-
function
|
|
26232
|
+
function ki(e, t, n, r) {
|
|
26225
26233
|
t.skip(16);
|
|
26226
26234
|
let i = t.u32();
|
|
26227
26235
|
if (i < 1 || i > 1048576) return;
|
|
@@ -26247,9 +26255,9 @@ function Oi(e, t, n, r) {
|
|
|
26247
26255
|
}
|
|
26248
26256
|
e.curX = r[0], e.curY = r[1];
|
|
26249
26257
|
}
|
|
26250
|
-
o && e.curPen && (s.strokeStyle = e.curPen.stroke, s.lineWidth =
|
|
26258
|
+
o && e.curPen && (s.strokeStyle = e.curPen.stroke, s.lineWidth = vi(e, e.curPen.width), s.stroke(), e.drew = !0);
|
|
26251
26259
|
}
|
|
26252
|
-
function
|
|
26260
|
+
function Ai(e, t, n, r) {
|
|
26253
26261
|
t.skip(16);
|
|
26254
26262
|
let i = t.u32(), a = t.u32();
|
|
26255
26263
|
if (i <= 0 || i > 65536 || a <= 0 || a > 2097152) return;
|
|
@@ -26272,23 +26280,23 @@ function ki(e, t, n, r) {
|
|
|
26272
26280
|
}
|
|
26273
26281
|
r && s.closePath(), c = !0;
|
|
26274
26282
|
}
|
|
26275
|
-
!c || e.inPath || (r && e.curBrush && e.curBrush.fill != null && (s.fillStyle = e.curBrush.fill, s.fill(e.fillRule), e.drew = !0), e.curPen && e.curPen.stroke != null && (s.strokeStyle = e.curPen.stroke, s.lineWidth =
|
|
26283
|
+
!c || e.inPath || (r && e.curBrush && e.curBrush.fill != null && (s.fillStyle = e.curBrush.fill, s.fill(e.fillRule), e.drew = !0), e.curPen && e.curPen.stroke != null && (s.strokeStyle = e.curPen.stroke, s.lineWidth = vi(e, e.curPen.width), s.stroke(), e.drew = !0));
|
|
26276
26284
|
}
|
|
26277
|
-
function
|
|
26285
|
+
function ji(e, t, n, r, i) {
|
|
26278
26286
|
let { ctx: a } = e, o = Q(e, t, n), s = Q(e, r, n), c = Q(e, r, i), l = Q(e, t, i);
|
|
26279
|
-
e.inPath || a.beginPath(), a.moveTo(o[0], o[1]), a.lineTo(s[0], s[1]), a.lineTo(c[0], c[1]), a.lineTo(l[0], l[1]), a.closePath(), !e.inPath && (e.curBrush && e.curBrush.fill != null && (a.fillStyle = e.curBrush.fill, a.fill(e.fillRule), e.drew = !0), e.curPen && e.curPen.stroke != null && (a.strokeStyle = e.curPen.stroke, a.lineWidth =
|
|
26287
|
+
e.inPath || a.beginPath(), a.moveTo(o[0], o[1]), a.lineTo(s[0], s[1]), a.lineTo(c[0], c[1]), a.lineTo(l[0], l[1]), a.closePath(), !e.inPath && (e.curBrush && e.curBrush.fill != null && (a.fillStyle = e.curBrush.fill, a.fill(e.fillRule), e.drew = !0), e.curPen && e.curPen.stroke != null && (a.strokeStyle = e.curPen.stroke, a.lineWidth = vi(e, e.curPen.width), a.stroke(), e.drew = !0));
|
|
26280
26288
|
}
|
|
26281
|
-
function
|
|
26289
|
+
function Mi(e) {
|
|
26282
26290
|
let t = e.u32(), n = e.u32(), r = e.i32();
|
|
26283
26291
|
e.i32();
|
|
26284
26292
|
let i = e.u32();
|
|
26285
26293
|
return [t, {
|
|
26286
26294
|
kind: "pen",
|
|
26287
|
-
stroke: (n & 255) == 5 ? null :
|
|
26295
|
+
stroke: (n & 255) == 5 ? null : ca(i),
|
|
26288
26296
|
width: Math.abs(r)
|
|
26289
26297
|
}];
|
|
26290
26298
|
}
|
|
26291
|
-
function
|
|
26299
|
+
function Ni(e) {
|
|
26292
26300
|
let t = e.u32();
|
|
26293
26301
|
e.skip(16);
|
|
26294
26302
|
let n = e.u32(), r = e.u32();
|
|
@@ -26296,31 +26304,31 @@ function Mi(e) {
|
|
|
26296
26304
|
let i = e.u32();
|
|
26297
26305
|
return [t, {
|
|
26298
26306
|
kind: "pen",
|
|
26299
|
-
stroke: (n & 255) == 5 ? null :
|
|
26307
|
+
stroke: (n & 255) == 5 ? null : ca(i),
|
|
26300
26308
|
width: Math.abs(r)
|
|
26301
26309
|
}];
|
|
26302
26310
|
}
|
|
26303
|
-
function
|
|
26311
|
+
function Pi(e) {
|
|
26304
26312
|
let t = e.u32(), n = e.u32(), r = e.u32();
|
|
26305
26313
|
return e.u32(), [t, {
|
|
26306
26314
|
kind: "brush",
|
|
26307
|
-
fill: n === 1 ? null :
|
|
26315
|
+
fill: n === 1 ? null : ca(r)
|
|
26308
26316
|
}];
|
|
26309
26317
|
}
|
|
26310
|
-
function
|
|
26318
|
+
function Fi(e, t, n) {
|
|
26311
26319
|
let r = e.u32();
|
|
26312
26320
|
e.u32();
|
|
26313
26321
|
let i = e.u32(), a = e.u32(), o = e.u32(), s = e.u32(), c = "#808080";
|
|
26314
26322
|
try {
|
|
26315
|
-
let e =
|
|
26316
|
-
e && (c =
|
|
26323
|
+
let e = Xr(t, n + i, a, n + o, s);
|
|
26324
|
+
e && (c = Ci(e));
|
|
26317
26325
|
} catch {}
|
|
26318
26326
|
return [r, {
|
|
26319
26327
|
kind: "brush",
|
|
26320
26328
|
fill: c
|
|
26321
26329
|
}];
|
|
26322
26330
|
}
|
|
26323
|
-
function
|
|
26331
|
+
function Ii(e, t, n) {
|
|
26324
26332
|
let r = e.u32(), i = n + 12, a = t.getInt32(i, !0), o = t.getInt32(i + 8, !0), s = t.getInt32(i + 16, !0), c = t.getUint8(i + 20), l = "";
|
|
26325
26333
|
for (let e = 0; e < 32; e++) {
|
|
26326
26334
|
let n = i + 28 + e * 2;
|
|
@@ -26338,7 +26346,7 @@ function Fi(e, t, n) {
|
|
|
26338
26346
|
escapement: o
|
|
26339
26347
|
}];
|
|
26340
26348
|
}
|
|
26341
|
-
function
|
|
26349
|
+
function Li(e, t, n, r) {
|
|
26342
26350
|
t.skip(16), t.u32(), t.f32(), t.f32();
|
|
26343
26351
|
let i = t.i32(), a = t.i32(), o = t.u32(), s = t.u32();
|
|
26344
26352
|
if (t.u32(), o <= 0 || o > 65536) return;
|
|
@@ -26349,7 +26357,7 @@ function Ii(e, t, n, r) {
|
|
|
26349
26357
|
c += String.fromCharCode(n.getUint16(t, !0));
|
|
26350
26358
|
}
|
|
26351
26359
|
if (c.length === 0) return;
|
|
26352
|
-
let l = e.curFont, u = Math.abs(l?.height ?? 0) *
|
|
26360
|
+
let l = e.curFont, u = Math.abs(l?.height ?? 0) * gi(e) * Math.abs(ui(e)) * _i(e);
|
|
26353
26361
|
if (!Number.isFinite(u) || u < 1) return;
|
|
26354
26362
|
let { ctx: d } = e, [f, p] = Q(e, i, a);
|
|
26355
26363
|
d.fillStyle = e.textColor;
|
|
@@ -26370,29 +26378,29 @@ function Ii(e, t, n, r) {
|
|
|
26370
26378
|
e.drew = !0;
|
|
26371
26379
|
} catch {}
|
|
26372
26380
|
}
|
|
26373
|
-
function
|
|
26381
|
+
function Ri(e, t, n, r, i, a, o, s, c, l, u) {
|
|
26374
26382
|
if (i === 0 || o === 0) return;
|
|
26375
|
-
let d =
|
|
26383
|
+
let d = Xr(t, n + r, i, n + a, o);
|
|
26376
26384
|
if (!d) return;
|
|
26377
26385
|
let [f, p] = Q(e, s, c), [m, h] = Q(e, l, u);
|
|
26378
|
-
|
|
26386
|
+
Qr(e.ctx, d, f, p, m, h) && (e.drew = !0);
|
|
26379
26387
|
}
|
|
26380
|
-
function
|
|
26388
|
+
function zi(e, t, n, r) {
|
|
26381
26389
|
t.skip(16);
|
|
26382
26390
|
let i = t.i32(), a = t.i32(), o = t.i32(), s = t.i32();
|
|
26383
|
-
t.u32(), t.i32(), t.i32(), t.skip(24), t.u32(), t.u32(),
|
|
26391
|
+
t.u32(), t.i32(), t.i32(), t.skip(24), t.u32(), t.u32(), Ri(e, n, r, t.u32(), t.u32(), t.u32(), t.u32(), i, a, i + o, a + s);
|
|
26384
26392
|
}
|
|
26385
|
-
function
|
|
26393
|
+
function Bi(e, t, n, r) {
|
|
26386
26394
|
t.skip(16);
|
|
26387
26395
|
let i = t.i32(), a = t.i32();
|
|
26388
26396
|
t.i32(), t.i32(), t.i32(), t.i32();
|
|
26389
26397
|
let o = t.u32(), s = t.u32(), c = t.u32(), l = t.u32();
|
|
26390
26398
|
t.u32(), t.u32();
|
|
26391
26399
|
let u = t.i32(), d = t.i32();
|
|
26392
|
-
|
|
26400
|
+
Ri(e, n, r, o, s, c, l, i, a, i + u, a + d);
|
|
26393
26401
|
}
|
|
26394
|
-
function
|
|
26395
|
-
if (!
|
|
26402
|
+
function Vi(e, t, n, r) {
|
|
26403
|
+
if (!oa(e) || n <= 0 || r <= 0) return !1;
|
|
26396
26404
|
let i = new DataView(e.buffer, e.byteOffset, e.byteLength), a = {
|
|
26397
26405
|
ctx: t,
|
|
26398
26406
|
W: n,
|
|
@@ -26401,8 +26409,8 @@ function Bi(e, t, n, r) {
|
|
|
26401
26409
|
top: 0,
|
|
26402
26410
|
boundsW: n,
|
|
26403
26411
|
boundsH: r,
|
|
26404
|
-
wt:
|
|
26405
|
-
mapMode:
|
|
26412
|
+
wt: ti(),
|
|
26413
|
+
mapMode: ei.TEXT,
|
|
26406
26414
|
winOrgX: 0,
|
|
26407
26415
|
winOrgY: 0,
|
|
26408
26416
|
winExtX: 1,
|
|
@@ -26432,7 +26440,7 @@ function Bi(e, t, n, r) {
|
|
|
26432
26440
|
if (r < 8 || r & 3) break;
|
|
26433
26441
|
let s = o + r;
|
|
26434
26442
|
if (s > e.length || n === Z.EOF) break;
|
|
26435
|
-
let c = new
|
|
26443
|
+
let c = new ri(i, o + 8, s);
|
|
26436
26444
|
try {
|
|
26437
26445
|
switch (n) {
|
|
26438
26446
|
case Z.HEADER: {
|
|
@@ -26451,11 +26459,11 @@ function Bi(e, t, n, r) {
|
|
|
26451
26459
|
break;
|
|
26452
26460
|
case Z.MODIFYWORLDTRANSFORM: {
|
|
26453
26461
|
let e = c.xform(), t = c.u32();
|
|
26454
|
-
t === 1 ? a.wt =
|
|
26462
|
+
t === 1 ? a.wt = ti() : t === 2 ? a.wt = ni(e, a.wt) : t === 3 ? a.wt = ni(a.wt, e) : t === 4 && (a.wt = e);
|
|
26455
26463
|
break;
|
|
26456
26464
|
}
|
|
26457
26465
|
case Z.SETMAPMODE:
|
|
26458
|
-
|
|
26466
|
+
yi(a, c.u32());
|
|
26459
26467
|
break;
|
|
26460
26468
|
case Z.SETWINDOWORGEX:
|
|
26461
26469
|
a.winOrgX = c.i32(), a.winOrgY = c.i32();
|
|
@@ -26528,7 +26536,7 @@ function Bi(e, t, n, r) {
|
|
|
26528
26536
|
break;
|
|
26529
26537
|
case Z.SELECTOBJECT: {
|
|
26530
26538
|
let e = c.u32();
|
|
26531
|
-
if (e & 2147483648)
|
|
26539
|
+
if (e & 2147483648) Si(a, e >>> 0);
|
|
26532
26540
|
else {
|
|
26533
26541
|
let t = a.objects.get(e);
|
|
26534
26542
|
t?.kind === "pen" ? a.curPen = t : t?.kind === "brush" ? a.curBrush = t : t?.kind === "font" && (a.curFont = t);
|
|
@@ -26541,72 +26549,72 @@ function Bi(e, t, n, r) {
|
|
|
26541
26549
|
break;
|
|
26542
26550
|
}
|
|
26543
26551
|
case Z.CREATEPEN: {
|
|
26544
|
-
let [e, t] =
|
|
26552
|
+
let [e, t] = Mi(c);
|
|
26545
26553
|
a.objects.set(e, t);
|
|
26546
26554
|
break;
|
|
26547
26555
|
}
|
|
26548
26556
|
case Z.EXTCREATEPEN: {
|
|
26549
|
-
let [e, t] =
|
|
26557
|
+
let [e, t] = Ni(c);
|
|
26550
26558
|
a.objects.set(e, t);
|
|
26551
26559
|
break;
|
|
26552
26560
|
}
|
|
26553
26561
|
case Z.CREATEBRUSHINDIRECT: {
|
|
26554
|
-
let [e, t] =
|
|
26562
|
+
let [e, t] = Pi(c);
|
|
26555
26563
|
a.objects.set(e, t);
|
|
26556
26564
|
break;
|
|
26557
26565
|
}
|
|
26558
26566
|
case Z.CREATEMONOBRUSH:
|
|
26559
26567
|
case Z.CREATEDIBPATTERNBRUSHPT: {
|
|
26560
|
-
let [e, t] =
|
|
26568
|
+
let [e, t] = Fi(c, i, o);
|
|
26561
26569
|
a.objects.set(e, t);
|
|
26562
26570
|
break;
|
|
26563
26571
|
}
|
|
26564
26572
|
case Z.EXTCREATEFONTINDIRECTW: {
|
|
26565
|
-
let [e, t] =
|
|
26573
|
+
let [e, t] = Ii(c, i, o);
|
|
26566
26574
|
a.objects.set(e, t);
|
|
26567
26575
|
break;
|
|
26568
26576
|
}
|
|
26569
26577
|
case Z.POLYLINE16:
|
|
26570
|
-
|
|
26578
|
+
Ei(a, c, wi);
|
|
26571
26579
|
break;
|
|
26572
26580
|
case Z.POLYLINE:
|
|
26573
|
-
|
|
26581
|
+
Ei(a, c, Ti);
|
|
26574
26582
|
break;
|
|
26575
26583
|
case Z.POLYLINETO16:
|
|
26576
|
-
|
|
26584
|
+
Di(a, c, wi);
|
|
26577
26585
|
break;
|
|
26578
26586
|
case Z.POLYLINETO:
|
|
26579
|
-
|
|
26587
|
+
Di(a, c, Ti);
|
|
26580
26588
|
break;
|
|
26581
26589
|
case Z.POLYGON16:
|
|
26582
|
-
|
|
26590
|
+
Oi(a, c, wi);
|
|
26583
26591
|
break;
|
|
26584
26592
|
case Z.POLYGON:
|
|
26585
|
-
|
|
26593
|
+
Oi(a, c, Ti);
|
|
26586
26594
|
break;
|
|
26587
26595
|
case Z.POLYBEZIER16:
|
|
26588
|
-
|
|
26596
|
+
ki(a, c, wi, !1);
|
|
26589
26597
|
break;
|
|
26590
26598
|
case Z.POLYBEZIER:
|
|
26591
|
-
|
|
26599
|
+
ki(a, c, Ti, !1);
|
|
26592
26600
|
break;
|
|
26593
26601
|
case Z.POLYBEZIERTO16:
|
|
26594
|
-
|
|
26602
|
+
ki(a, c, wi, !0);
|
|
26595
26603
|
break;
|
|
26596
26604
|
case Z.POLYBEZIERTO:
|
|
26597
|
-
|
|
26605
|
+
ki(a, c, Ti, !0);
|
|
26598
26606
|
break;
|
|
26599
26607
|
case Z.POLYPOLYGON16:
|
|
26600
|
-
|
|
26608
|
+
Ai(a, c, wi, !0);
|
|
26601
26609
|
break;
|
|
26602
26610
|
case Z.POLYPOLYGON:
|
|
26603
|
-
|
|
26611
|
+
Ai(a, c, Ti, !0);
|
|
26604
26612
|
break;
|
|
26605
26613
|
case Z.POLYPOLYLINE16:
|
|
26606
|
-
|
|
26614
|
+
Ai(a, c, wi, !1);
|
|
26607
26615
|
break;
|
|
26608
26616
|
case Z.POLYPOLYLINE:
|
|
26609
|
-
|
|
26617
|
+
Ai(a, c, Ti, !1);
|
|
26610
26618
|
break;
|
|
26611
26619
|
case Z.MOVETOEX:
|
|
26612
26620
|
a.curX = c.i32(), a.curY = c.i32();
|
|
@@ -26615,24 +26623,24 @@ function Bi(e, t, n, r) {
|
|
|
26615
26623
|
let e = c.i32(), n = c.i32();
|
|
26616
26624
|
if (a.curPen && a.curPen.stroke != null) {
|
|
26617
26625
|
let [r, i] = Q(a, a.curX, a.curY), [o, s] = Q(a, e, n);
|
|
26618
|
-
t.beginPath(), t.moveTo(r, i), t.lineTo(o, s), t.strokeStyle = a.curPen.stroke, t.lineWidth =
|
|
26626
|
+
t.beginPath(), t.moveTo(r, i), t.lineTo(o, s), t.strokeStyle = a.curPen.stroke, t.lineWidth = vi(a, a.curPen.width), t.stroke(), a.drew = !0;
|
|
26619
26627
|
}
|
|
26620
26628
|
a.curX = e, a.curY = n;
|
|
26621
26629
|
break;
|
|
26622
26630
|
}
|
|
26623
26631
|
case Z.RECTANGLE:
|
|
26624
|
-
|
|
26632
|
+
ji(a, c.i32(), c.i32(), c.i32(), c.i32());
|
|
26625
26633
|
break;
|
|
26626
26634
|
case Z.ELLIPSE: {
|
|
26627
26635
|
let e = c.i32(), n = c.i32(), r = c.i32(), i = c.i32(), [o, s] = [(e + r) / 2, (n + i) / 2], [l, u] = Q(a, o, s), [d] = Q(a, r, s), [, f] = Q(a, o, i), p = Math.abs(d - l), m = Math.abs(f - u);
|
|
26628
|
-
t.beginPath(), t.ellipse(l, u, p, m, 0, 0, Math.PI * 2), a.curBrush && a.curBrush.fill != null && (t.fillStyle = a.curBrush.fill, t.fill(a.fillRule), a.drew = !0), a.curPen && a.curPen.stroke != null && (t.strokeStyle = a.curPen.stroke, t.lineWidth =
|
|
26636
|
+
t.beginPath(), t.ellipse(l, u, p, m, 0, 0, Math.PI * 2), a.curBrush && a.curBrush.fill != null && (t.fillStyle = a.curBrush.fill, t.fill(a.fillRule), a.drew = !0), a.curPen && a.curPen.stroke != null && (t.strokeStyle = a.curPen.stroke, t.lineWidth = vi(a, a.curPen.width), t.stroke(), a.drew = !0);
|
|
26629
26637
|
break;
|
|
26630
26638
|
}
|
|
26631
26639
|
case Z.SETPOLYFILLMODE:
|
|
26632
26640
|
a.fillRule = c.u32() === 1 ? "evenodd" : "nonzero";
|
|
26633
26641
|
break;
|
|
26634
26642
|
case Z.SETTEXTCOLOR:
|
|
26635
|
-
a.textColor =
|
|
26643
|
+
a.textColor = ca(c.u32());
|
|
26636
26644
|
break;
|
|
26637
26645
|
case Z.SETTEXTALIGN:
|
|
26638
26646
|
a.textAlign = c.u32();
|
|
@@ -26641,13 +26649,13 @@ function Bi(e, t, n, r) {
|
|
|
26641
26649
|
a.bkMode = c.u32();
|
|
26642
26650
|
break;
|
|
26643
26651
|
case Z.EXTTEXTOUTW:
|
|
26644
|
-
|
|
26652
|
+
Li(a, c, i, o);
|
|
26645
26653
|
break;
|
|
26646
26654
|
case Z.BITBLT:
|
|
26647
|
-
|
|
26655
|
+
zi(a, c, i, o);
|
|
26648
26656
|
break;
|
|
26649
26657
|
case Z.STRETCHDIBITS:
|
|
26650
|
-
|
|
26658
|
+
Bi(a, c, i, o);
|
|
26651
26659
|
break;
|
|
26652
26660
|
default: break;
|
|
26653
26661
|
}
|
|
@@ -26656,55 +26664,55 @@ function Bi(e, t, n, r) {
|
|
|
26656
26664
|
}
|
|
26657
26665
|
return a.drew;
|
|
26658
26666
|
}
|
|
26659
|
-
async function
|
|
26660
|
-
if (!
|
|
26667
|
+
async function Hi(e, t, n) {
|
|
26668
|
+
if (!oa(e) || t <= 0 || n <= 0) return null;
|
|
26661
26669
|
let r = It(t, n);
|
|
26662
26670
|
if (!r) return null;
|
|
26663
26671
|
let i = r.getContext("2d");
|
|
26664
|
-
return !i || (i.lineJoin = "round", i.lineCap = "round", !
|
|
26672
|
+
return !i || (i.lineJoin = "round", i.lineCap = "round", !Vi(e, i, t, n)) ? null : createImageBitmap(r);
|
|
26665
26673
|
}
|
|
26666
26674
|
//#endregion
|
|
26667
26675
|
//#region packages/core/src/image/raster-dimensions.ts
|
|
26668
|
-
function
|
|
26676
|
+
function Ui(e, t) {
|
|
26669
26677
|
return e[t] << 8 | e[t + 1];
|
|
26670
26678
|
}
|
|
26671
|
-
function
|
|
26679
|
+
function Wi(e, t) {
|
|
26672
26680
|
return (e[t] << 24 | e[t + 1] << 16 | e[t + 2] << 8 | e[t + 3]) >>> 0;
|
|
26673
26681
|
}
|
|
26674
|
-
function
|
|
26682
|
+
function Gi(e, t) {
|
|
26675
26683
|
return e[t] | e[t + 1] << 8;
|
|
26676
26684
|
}
|
|
26677
|
-
function
|
|
26685
|
+
function Ki(e, t) {
|
|
26678
26686
|
return e[t] | e[t + 1] << 8 | e[t + 2] << 16 | e[t + 3] << 24 | 0;
|
|
26679
26687
|
}
|
|
26680
|
-
function
|
|
26688
|
+
function qi(e) {
|
|
26681
26689
|
let t = e.length;
|
|
26682
26690
|
return t >= 24 && e[0] === 137 && e[1] === 80 && e[2] === 78 && e[3] === 71 && e[4] === 13 && e[5] === 10 && e[6] === 26 && e[7] === 10 ? e[12] === 73 && e[13] === 72 && e[14] === 68 && e[15] === 82 ? {
|
|
26683
|
-
width:
|
|
26684
|
-
height: Ui(e, 20)
|
|
26685
|
-
} : null : t >= 10 && e[0] === 71 && e[1] === 73 && e[2] === 70 && e[3] === 56 && (e[4] === 55 || e[4] === 57) && e[5] === 97 ? {
|
|
26686
|
-
width: Wi(e, 6),
|
|
26687
|
-
height: Wi(e, 8)
|
|
26688
|
-
} : t >= 26 && e[0] === 66 && e[1] === 77 ? qi(e, 14) === 12 ? {
|
|
26689
|
-
width: Wi(e, 18),
|
|
26691
|
+
width: Wi(e, 16),
|
|
26690
26692
|
height: Wi(e, 20)
|
|
26693
|
+
} : null : t >= 10 && e[0] === 71 && e[1] === 73 && e[2] === 70 && e[3] === 56 && (e[4] === 55 || e[4] === 57) && e[5] === 97 ? {
|
|
26694
|
+
width: Gi(e, 6),
|
|
26695
|
+
height: Gi(e, 8)
|
|
26696
|
+
} : t >= 26 && e[0] === 66 && e[1] === 77 ? Ji(e, 14) === 12 ? {
|
|
26697
|
+
width: Gi(e, 18),
|
|
26698
|
+
height: Gi(e, 20)
|
|
26691
26699
|
} : {
|
|
26692
|
-
width: Math.abs(
|
|
26693
|
-
height: Math.abs(
|
|
26694
|
-
} : t >= 16 && e[0] === 82 && e[1] === 73 && e[2] === 70 && e[3] === 70 && e[8] === 87 && e[9] === 69 && e[10] === 66 && e[11] === 80 ?
|
|
26700
|
+
width: Math.abs(Ki(e, 18)),
|
|
26701
|
+
height: Math.abs(Ki(e, 22))
|
|
26702
|
+
} : t >= 16 && e[0] === 82 && e[1] === 73 && e[2] === 70 && e[3] === 70 && e[8] === 87 && e[9] === 69 && e[10] === 66 && e[11] === 80 ? Yi(e) : t >= 4 && e[0] === 255 && e[1] === 216 ? Xi(e) : null;
|
|
26695
26703
|
}
|
|
26696
|
-
function
|
|
26704
|
+
function Ji(e, t) {
|
|
26697
26705
|
return (e[t] | e[t + 1] << 8 | e[t + 2] << 16 | e[t + 3] << 24) >>> 0;
|
|
26698
26706
|
}
|
|
26699
|
-
function
|
|
26707
|
+
function Yi(e) {
|
|
26700
26708
|
let t = e.length, n = e[12], r = e[13], i = e[14], a = e[15];
|
|
26701
26709
|
if (n === 86 && r === 80 && i === 56 && a === 32) return t < 30 ? null : {
|
|
26702
|
-
width:
|
|
26703
|
-
height:
|
|
26710
|
+
width: Gi(e, 26) & 16383,
|
|
26711
|
+
height: Gi(e, 28) & 16383
|
|
26704
26712
|
};
|
|
26705
26713
|
if (n === 86 && r === 80 && i === 56 && a === 76) {
|
|
26706
26714
|
if (t < 25 || e[20] !== 47) return null;
|
|
26707
|
-
let n =
|
|
26715
|
+
let n = Ji(e, 21);
|
|
26708
26716
|
return {
|
|
26709
26717
|
width: (n & 16383) + 1,
|
|
26710
26718
|
height: (n >>> 14 & 16383) + 1
|
|
@@ -26715,7 +26723,7 @@ function Ji(e) {
|
|
|
26715
26723
|
height: (e[27] | e[28] << 8 | e[29] << 16) + 1
|
|
26716
26724
|
} : null;
|
|
26717
26725
|
}
|
|
26718
|
-
function
|
|
26726
|
+
function Xi(e) {
|
|
26719
26727
|
let t = e.length, n = 2;
|
|
26720
26728
|
for (; n + 1 < t;) {
|
|
26721
26729
|
if (e[n] !== 255) {
|
|
@@ -26732,12 +26740,12 @@ function Yi(e) {
|
|
|
26732
26740
|
continue;
|
|
26733
26741
|
}
|
|
26734
26742
|
if (r === 217 || n + 3 >= t) return null;
|
|
26735
|
-
let i =
|
|
26743
|
+
let i = Ui(e, n + 2);
|
|
26736
26744
|
if (r >= 192 && r <= 207 && r !== 196 && r !== 200 && r !== 204) {
|
|
26737
26745
|
if (n + 8 >= t) return null;
|
|
26738
|
-
let r =
|
|
26746
|
+
let r = Ui(e, n + 5);
|
|
26739
26747
|
return {
|
|
26740
|
-
width:
|
|
26748
|
+
width: Ui(e, n + 7),
|
|
26741
26749
|
height: r
|
|
26742
26750
|
};
|
|
26743
26751
|
}
|
|
@@ -26746,17 +26754,17 @@ function Yi(e) {
|
|
|
26746
26754
|
}
|
|
26747
26755
|
return null;
|
|
26748
26756
|
}
|
|
26749
|
-
function
|
|
26757
|
+
function Zi(e) {
|
|
26750
26758
|
let { width: t, height: n } = e;
|
|
26751
|
-
return !Number.isFinite(t) || !Number.isFinite(n) || t <= 0 || n <= 0 || t > 32767 || n > 32767 ? !0 : t * n >
|
|
26759
|
+
return !Number.isFinite(t) || !Number.isFinite(n) || t <= 0 || n <= 0 || t > 32767 || n > 32767 ? !0 : t * n > qr;
|
|
26752
26760
|
}
|
|
26753
|
-
function
|
|
26754
|
-
let t =
|
|
26755
|
-
return t !== null &&
|
|
26761
|
+
function Qi(e) {
|
|
26762
|
+
let t = qi(e);
|
|
26763
|
+
return t !== null && Zi(t);
|
|
26756
26764
|
}
|
|
26757
26765
|
//#endregion
|
|
26758
26766
|
//#region packages/core/src/image/wmf.ts
|
|
26759
|
-
var
|
|
26767
|
+
var $i = {
|
|
26760
26768
|
EOF: 0,
|
|
26761
26769
|
SETBKMODE: 258,
|
|
26762
26770
|
SETTEXTALIGN: 302,
|
|
@@ -26777,35 +26785,35 @@ var Qi = {
|
|
|
26777
26785
|
DIBBITBLT: 2368,
|
|
26778
26786
|
DIBSTRETCHBLT: 2881,
|
|
26779
26787
|
STRETCHDIBITS: 3907
|
|
26780
|
-
},
|
|
26781
|
-
function
|
|
26782
|
-
if (e.length < t +
|
|
26788
|
+
}, ea = 2596720087, ta = 22, na = 18, ra = 1179469088;
|
|
26789
|
+
function ia(e, t) {
|
|
26790
|
+
if (e.length < t + na) return !1;
|
|
26783
26791
|
let n = e[t] | e[t + 1] << 8, r = e[t + 2] | e[t + 3] << 8;
|
|
26784
26792
|
return (n === 1 || n === 2) && r === 9;
|
|
26785
26793
|
}
|
|
26786
|
-
function ia(e) {
|
|
26787
|
-
return e.length < 4 ? !1 : (e[0] | e[1] << 8 | e[2] << 16 | e[3] << 24) >>> 0 === $i ? !0 : ra(e, 0);
|
|
26788
|
-
}
|
|
26789
26794
|
function aa(e) {
|
|
26795
|
+
return e.length < 4 ? !1 : (e[0] | e[1] << 8 | e[2] << 16 | e[3] << 24) >>> 0 === ea ? !0 : ia(e, 0);
|
|
26796
|
+
}
|
|
26797
|
+
function oa(e) {
|
|
26790
26798
|
if (e.length < 44) return !1;
|
|
26791
26799
|
let t = new DataView(e.buffer, e.byteOffset, e.byteLength);
|
|
26792
|
-
return t.getUint32(0, !0) === 1 && t.getUint32(40, !0) ===
|
|
26800
|
+
return t.getUint32(0, !0) === 1 && t.getUint32(40, !0) === ra;
|
|
26793
26801
|
}
|
|
26794
|
-
function
|
|
26802
|
+
function sa(e) {
|
|
26795
26803
|
return e === "image/wmf" || e === "image/emf";
|
|
26796
26804
|
}
|
|
26797
|
-
function
|
|
26805
|
+
function ca(e) {
|
|
26798
26806
|
let t = e & 255, n = e >>> 8 & 255, r = e >>> 16 & 255, i = (e) => e.toString(16).padStart(2, "0");
|
|
26799
26807
|
return `#${i(t)}${i(n)}${i(r)}`;
|
|
26800
26808
|
}
|
|
26801
|
-
function
|
|
26809
|
+
function la(e, t) {
|
|
26802
26810
|
for (let n = 0; n < e.length; n++) if (e[n] == null) {
|
|
26803
26811
|
e[n] = t;
|
|
26804
26812
|
return;
|
|
26805
26813
|
}
|
|
26806
26814
|
e.push(t);
|
|
26807
26815
|
}
|
|
26808
|
-
var
|
|
26816
|
+
var ua = class {
|
|
26809
26817
|
p = 0;
|
|
26810
26818
|
constructor(e, t, n) {
|
|
26811
26819
|
this.b = e, this.end = n, this.p = t;
|
|
@@ -26836,56 +26844,56 @@ var la = class {
|
|
|
26836
26844
|
this.p = Math.min(this.p + Math.max(0, e), this.end);
|
|
26837
26845
|
}
|
|
26838
26846
|
};
|
|
26839
|
-
function
|
|
26847
|
+
function da(e, t) {
|
|
26840
26848
|
return (t - e.orgX) * (e.W / e.extX);
|
|
26841
26849
|
}
|
|
26842
|
-
function
|
|
26850
|
+
function fa(e, t) {
|
|
26843
26851
|
return (t - e.orgY) * (e.H / e.extY);
|
|
26844
26852
|
}
|
|
26845
|
-
function
|
|
26853
|
+
function pa(e, t) {
|
|
26846
26854
|
let n = t * Math.abs(e.W / e.extX);
|
|
26847
26855
|
return n >= 1 ? n : 1;
|
|
26848
26856
|
}
|
|
26849
|
-
var
|
|
26850
|
-
function ma(e, t, n) {
|
|
26851
|
-
return Math.abs(e - t) <= pa || Math.abs(e - n) <= pa;
|
|
26852
|
-
}
|
|
26857
|
+
var ma = .001;
|
|
26853
26858
|
function ha(e, t, n) {
|
|
26859
|
+
return Math.abs(e - t) <= ma || Math.abs(e - n) <= ma;
|
|
26860
|
+
}
|
|
26861
|
+
function ga(e, t, n) {
|
|
26854
26862
|
let r = [], i = n ? t.length : t.length - 1;
|
|
26855
26863
|
for (let n = 0; n < i; n++) {
|
|
26856
|
-
let i = t[n], a = t[(n + 1) % t.length], o = Math.abs(i[0] - a[0]) <=
|
|
26864
|
+
let i = t[n], a = t[(n + 1) % t.length], o = Math.abs(i[0] - a[0]) <= ma && ha(i[0], 0, e.W) && ha(a[0], 0, e.W), s = Math.abs(i[1] - a[1]) <= ma && ha(i[1], 0, e.H) && ha(a[1], 0, e.H);
|
|
26857
26865
|
o || s || r.push([i, a]);
|
|
26858
26866
|
}
|
|
26859
26867
|
return r;
|
|
26860
26868
|
}
|
|
26861
|
-
function
|
|
26869
|
+
function _a(e, t, n) {
|
|
26862
26870
|
if (!e.curPen || e.curPen.stroke == null || t.length < 2) return;
|
|
26863
26871
|
let { ctx: r } = e;
|
|
26864
|
-
if (r.strokeStyle = e.curPen.stroke, r.lineWidth =
|
|
26872
|
+
if (r.strokeStyle = e.curPen.stroke, r.lineWidth = pa(e, e.curPen.width), !e.suppressBoundaryFrame) {
|
|
26865
26873
|
r.beginPath(), r.moveTo(t[0][0], t[0][1]);
|
|
26866
26874
|
for (let e = 1; e < t.length; e++) r.lineTo(t[e][0], t[e][1]);
|
|
26867
26875
|
n && r.closePath(), r.stroke(), e.drew = !0;
|
|
26868
26876
|
return;
|
|
26869
26877
|
}
|
|
26870
|
-
let i =
|
|
26878
|
+
let i = ga(e, t, n);
|
|
26871
26879
|
if (i.length === 0) return;
|
|
26872
26880
|
r.beginPath();
|
|
26873
26881
|
let a = null;
|
|
26874
26882
|
for (let [e, t] of i) (!a || a[0] !== e[0] || a[1] !== e[1]) && r.moveTo(e[0], e[1]), r.lineTo(t[0], t[1]), a = t;
|
|
26875
26883
|
r.stroke(), e.drew = !0;
|
|
26876
26884
|
}
|
|
26877
|
-
function
|
|
26885
|
+
function va(e, t, n) {
|
|
26878
26886
|
let r = [];
|
|
26879
26887
|
for (let i = 0; i < n && !(t.remaining < 4); i++) {
|
|
26880
26888
|
let n = t.i16(), i = t.i16();
|
|
26881
|
-
r.push([
|
|
26889
|
+
r.push([da(e, n), fa(e, i)]);
|
|
26882
26890
|
}
|
|
26883
26891
|
return r;
|
|
26884
26892
|
}
|
|
26885
|
-
function va(e, t) {
|
|
26886
|
-
t.length < 2 || !e.curPen || e.curPen.stroke == null || ga(e, t, !1);
|
|
26887
|
-
}
|
|
26888
26893
|
function ya(e, t) {
|
|
26894
|
+
t.length < 2 || !e.curPen || e.curPen.stroke == null || _a(e, t, !1);
|
|
26895
|
+
}
|
|
26896
|
+
function ba(e, t) {
|
|
26889
26897
|
if (t.length < 2) return;
|
|
26890
26898
|
let { ctx: n } = e;
|
|
26891
26899
|
if (e.curBrush && e.curBrush.fill != null) {
|
|
@@ -26893,9 +26901,9 @@ function ya(e, t) {
|
|
|
26893
26901
|
for (let e = 1; e < t.length; e++) n.lineTo(t[e][0], t[e][1]);
|
|
26894
26902
|
n.closePath(), n.fillStyle = e.curBrush.fill, n.fill(e.fillRule), e.drew = !0;
|
|
26895
26903
|
}
|
|
26896
|
-
|
|
26904
|
+
_a(e, t, !0);
|
|
26897
26905
|
}
|
|
26898
|
-
function
|
|
26906
|
+
function xa(e, t) {
|
|
26899
26907
|
let n = t.u16();
|
|
26900
26908
|
if (n <= 0 || n > 65536) return;
|
|
26901
26909
|
let r = [];
|
|
@@ -26911,33 +26919,33 @@ function ba(e, t) {
|
|
|
26911
26919
|
for (let e = 0; e < n && t.remaining >= 4; e++) t.i16(), t.i16();
|
|
26912
26920
|
continue;
|
|
26913
26921
|
}
|
|
26914
|
-
let r =
|
|
26922
|
+
let r = va(e, t, n);
|
|
26915
26923
|
if (!(r.length < 2)) {
|
|
26916
26924
|
i.moveTo(r[0][0], r[0][1]);
|
|
26917
26925
|
for (let e = 1; e < r.length; e++) i.lineTo(r[e][0], r[e][1]);
|
|
26918
26926
|
i.closePath(), a = !0;
|
|
26919
26927
|
}
|
|
26920
26928
|
}
|
|
26921
|
-
a && (e.curBrush && e.curBrush.fill != null && (i.fillStyle = e.curBrush.fill, i.fill(e.fillRule), e.drew = !0), e.curPen && e.curPen.stroke != null && (i.strokeStyle = e.curPen.stroke, i.lineWidth =
|
|
26929
|
+
a && (e.curBrush && e.curBrush.fill != null && (i.fillStyle = e.curBrush.fill, i.fill(e.fillRule), e.drew = !0), e.curPen && e.curPen.stroke != null && (i.strokeStyle = e.curPen.stroke, i.lineWidth = pa(e, e.curPen.width), i.stroke(), e.drew = !0));
|
|
26922
26930
|
}
|
|
26923
|
-
function
|
|
26931
|
+
function Sa(e) {
|
|
26924
26932
|
let t = e.u16(), n = e.i16();
|
|
26925
26933
|
e.i16();
|
|
26926
26934
|
let r = e.u32();
|
|
26927
26935
|
return {
|
|
26928
26936
|
kind: "pen",
|
|
26929
|
-
stroke: (t & 255) == 5 ? null :
|
|
26937
|
+
stroke: (t & 255) == 5 ? null : ca(r),
|
|
26930
26938
|
width: Math.abs(n)
|
|
26931
26939
|
};
|
|
26932
26940
|
}
|
|
26933
|
-
function
|
|
26941
|
+
function Ca(e) {
|
|
26934
26942
|
let t = e.u16(), n = e.u32();
|
|
26935
26943
|
return e.u16(), {
|
|
26936
26944
|
kind: "brush",
|
|
26937
|
-
fill: t === 1 ? null :
|
|
26945
|
+
fill: t === 1 ? null : ca(n)
|
|
26938
26946
|
};
|
|
26939
26947
|
}
|
|
26940
|
-
function
|
|
26948
|
+
function wa(e) {
|
|
26941
26949
|
let t = e.indexOf(0), n = t >= 0 ? e.subarray(0, t) : e;
|
|
26942
26950
|
if (n.length === 0) return "";
|
|
26943
26951
|
try {
|
|
@@ -26946,7 +26954,7 @@ function Ca(e) {
|
|
|
26946
26954
|
return String.fromCharCode(...n);
|
|
26947
26955
|
}
|
|
26948
26956
|
}
|
|
26949
|
-
function
|
|
26957
|
+
function Ta(e) {
|
|
26950
26958
|
let t = Math.abs(e.i16());
|
|
26951
26959
|
e.i16(), e.i16(), e.i16();
|
|
26952
26960
|
let n = e.i16(), r = e.u8() !== 0;
|
|
@@ -26955,12 +26963,12 @@ function wa(e) {
|
|
|
26955
26963
|
height: t,
|
|
26956
26964
|
weight: n,
|
|
26957
26965
|
italic: r,
|
|
26958
|
-
face:
|
|
26966
|
+
face: wa(e.bytes(Math.min(32, e.remaining)))
|
|
26959
26967
|
};
|
|
26960
26968
|
}
|
|
26961
|
-
function
|
|
26969
|
+
function Ea(e, t, n, r) {
|
|
26962
26970
|
if (t.length === 0) return;
|
|
26963
|
-
let i = e.curFont, a = i?.height || 12, o = Math.abs(
|
|
26971
|
+
let i = e.curFont, a = i?.height || 12, o = Math.abs(fa(e, e.orgY + a) - fa(e, e.orgY));
|
|
26964
26972
|
if (!Number.isFinite(o) || o < 1) return;
|
|
26965
26973
|
let { ctx: s } = e;
|
|
26966
26974
|
try {
|
|
@@ -26968,14 +26976,14 @@ function Ta(e, t, n, r) {
|
|
|
26968
26976
|
let a = i && i.weight >= 700 ? "bold " : "";
|
|
26969
26977
|
s.font = `${i?.italic ? "italic " : ""}${a}${o}px ${i?.face || "sans-serif"}`;
|
|
26970
26978
|
let c = e.textAlign & 6;
|
|
26971
|
-
s.textAlign = c === 2 ? "right" : c === 6 ? "center" : "left", s.textBaseline = (e.textAlign & 24) == 24 ? "alphabetic" : "top", s.fillText(t,
|
|
26979
|
+
s.textAlign = c === 2 ? "right" : c === 6 ? "center" : "left", s.textBaseline = (e.textAlign & 24) == 24 ? "alphabetic" : "top", s.fillText(t, da(e, n), fa(e, r)), e.drew = !0;
|
|
26972
26980
|
} catch {}
|
|
26973
26981
|
}
|
|
26974
|
-
function
|
|
26975
|
-
if (!
|
|
26982
|
+
function Da(e, t, n, r, i = !1) {
|
|
26983
|
+
if (!aa(e)) return !1;
|
|
26976
26984
|
let a = 0;
|
|
26977
|
-
(e.length >= 4 ? (e[0] | e[1] << 8 | e[2] << 16 | e[3] << 24) >>> 0 : 0) ===
|
|
26978
|
-
let o = a +
|
|
26985
|
+
(e.length >= 4 ? (e[0] | e[1] << 8 | e[2] << 16 | e[3] << 24) >>> 0 : 0) === ea && (a = ta);
|
|
26986
|
+
let o = a + na;
|
|
26979
26987
|
if (o > e.length) return !1;
|
|
26980
26988
|
let s = {
|
|
26981
26989
|
ctx: t,
|
|
@@ -27000,189 +27008,189 @@ function Ea(e, t, n, r, i = !1) {
|
|
|
27000
27008
|
let t = c.getUint32(o, !0), n = c.getUint16(o + 4, !0);
|
|
27001
27009
|
if (t < 3) break;
|
|
27002
27010
|
let r = t * 2, i = o + r;
|
|
27003
|
-
if (i > e.length || n ===
|
|
27004
|
-
let a = o + 6, l = new
|
|
27011
|
+
if (i > e.length || n === $i.EOF) break;
|
|
27012
|
+
let a = o + 6, l = new ua(e, a, i);
|
|
27005
27013
|
switch (n) {
|
|
27006
|
-
case
|
|
27014
|
+
case $i.SETWINDOWORG:
|
|
27007
27015
|
s.orgY = l.i16(), s.orgX = l.i16();
|
|
27008
27016
|
break;
|
|
27009
|
-
case
|
|
27017
|
+
case $i.SETWINDOWEXT: {
|
|
27010
27018
|
let e = l.i16(), t = l.i16();
|
|
27011
27019
|
s.extY = e || 1, s.extX = t || 1, s.haveExt = !0;
|
|
27012
27020
|
break;
|
|
27013
27021
|
}
|
|
27014
|
-
case
|
|
27022
|
+
case $i.SETPOLYFILLMODE:
|
|
27015
27023
|
s.fillRule = l.u16() === 1 ? "evenodd" : "nonzero";
|
|
27016
27024
|
break;
|
|
27017
|
-
case
|
|
27018
|
-
s.textColor =
|
|
27025
|
+
case $i.SETTEXTCOLOR:
|
|
27026
|
+
s.textColor = ca(l.u32());
|
|
27019
27027
|
break;
|
|
27020
|
-
case
|
|
27028
|
+
case $i.SETTEXTALIGN:
|
|
27021
27029
|
s.textAlign = l.u16();
|
|
27022
27030
|
break;
|
|
27023
|
-
case
|
|
27024
|
-
|
|
27031
|
+
case $i.CREATEPENINDIRECT:
|
|
27032
|
+
la(s.objects, Sa(l));
|
|
27025
27033
|
break;
|
|
27026
|
-
case
|
|
27027
|
-
|
|
27034
|
+
case $i.CREATEBRUSHINDIRECT:
|
|
27035
|
+
la(s.objects, Ca(l));
|
|
27028
27036
|
break;
|
|
27029
|
-
case
|
|
27030
|
-
|
|
27037
|
+
case $i.CREATEFONTINDIRECT:
|
|
27038
|
+
la(s.objects, Ta(l));
|
|
27031
27039
|
break;
|
|
27032
|
-
case
|
|
27040
|
+
case $i.SELECTOBJECT: {
|
|
27033
27041
|
let e = l.u16(), t = s.objects[e];
|
|
27034
27042
|
t?.kind === "pen" ? s.curPen = t : t?.kind === "brush" ? s.curBrush = t : t?.kind === "font" && (s.curFont = t);
|
|
27035
27043
|
break;
|
|
27036
27044
|
}
|
|
27037
|
-
case
|
|
27045
|
+
case $i.DELETEOBJECT: {
|
|
27038
27046
|
let e = l.u16(), t = s.objects[e];
|
|
27039
27047
|
t && (t === s.curPen && (s.curPen = null), t === s.curBrush && (s.curBrush = null), t === s.curFont && (s.curFont = null), s.objects[e] = null);
|
|
27040
27048
|
break;
|
|
27041
27049
|
}
|
|
27042
|
-
case
|
|
27043
|
-
|
|
27050
|
+
case $i.POLYLINE:
|
|
27051
|
+
ya(s, va(s, l, l.i16()));
|
|
27044
27052
|
break;
|
|
27045
|
-
case
|
|
27046
|
-
|
|
27053
|
+
case $i.POLYGON:
|
|
27054
|
+
ba(s, va(s, l, l.i16()));
|
|
27047
27055
|
break;
|
|
27048
|
-
case
|
|
27049
|
-
|
|
27056
|
+
case $i.POLYPOLYGON:
|
|
27057
|
+
xa(s, l);
|
|
27050
27058
|
break;
|
|
27051
|
-
case
|
|
27059
|
+
case $i.RECTANGLE: {
|
|
27052
27060
|
let e = l.i16(), t = l.i16(), n = l.i16(), r = l.i16();
|
|
27053
|
-
|
|
27054
|
-
[
|
|
27055
|
-
[
|
|
27056
|
-
[
|
|
27057
|
-
[
|
|
27061
|
+
ba(s, [
|
|
27062
|
+
[da(s, r), fa(s, n)],
|
|
27063
|
+
[da(s, t), fa(s, n)],
|
|
27064
|
+
[da(s, t), fa(s, e)],
|
|
27065
|
+
[da(s, r), fa(s, e)]
|
|
27058
27066
|
]);
|
|
27059
27067
|
break;
|
|
27060
27068
|
}
|
|
27061
|
-
case
|
|
27062
|
-
let e = l.u16(), t =
|
|
27069
|
+
case $i.TEXTOUT: {
|
|
27070
|
+
let e = l.u16(), t = wa(l.bytes(e));
|
|
27063
27071
|
e % 2 != 0 && l.skip(1);
|
|
27064
27072
|
let n = l.i16();
|
|
27065
|
-
|
|
27073
|
+
Ea(s, t, l.i16(), n);
|
|
27066
27074
|
break;
|
|
27067
27075
|
}
|
|
27068
|
-
case
|
|
27076
|
+
case $i.STRETCHDIBITS: {
|
|
27069
27077
|
l.u32(), l.i16(), l.i16(), l.i16(), l.i16(), l.u16();
|
|
27070
|
-
let e = l.i16(), t = l.i16(), n = l.i16(), r = l.i16(), o = a + 22, u =
|
|
27078
|
+
let e = l.i16(), t = l.i16(), n = l.i16(), r = l.i16(), o = a + 22, u = Zr(c, o, i - o);
|
|
27071
27079
|
if (u) {
|
|
27072
|
-
let i =
|
|
27073
|
-
|
|
27080
|
+
let i = da(s, r), a = fa(s, n), o = da(s, r + t), c = fa(s, n + e);
|
|
27081
|
+
Qr(s.ctx, u, i, a, o, c) && (s.drew = !0);
|
|
27074
27082
|
}
|
|
27075
27083
|
break;
|
|
27076
27084
|
}
|
|
27077
|
-
case
|
|
27078
|
-
case
|
|
27079
|
-
case
|
|
27085
|
+
case $i.DIBSTRETCHBLT:
|
|
27086
|
+
case $i.DIBBITBLT:
|
|
27087
|
+
case $i.SETBKMODE: break;
|
|
27080
27088
|
default: break;
|
|
27081
27089
|
}
|
|
27082
27090
|
o = i;
|
|
27083
27091
|
}
|
|
27084
27092
|
return s.drew;
|
|
27085
27093
|
}
|
|
27086
|
-
var
|
|
27087
|
-
function
|
|
27088
|
-
let n = e > 0 ? e : 300, r = t > 0 ? t : 300, i = (e) => Math.max(1, Math.min(
|
|
27094
|
+
var Oa = 2e3, ka = 2;
|
|
27095
|
+
function Aa(e, t) {
|
|
27096
|
+
let n = e > 0 ? e : 300, r = t > 0 ? t : 300, i = (e) => Math.max(1, Math.min(Oa, Math.round(e)));
|
|
27089
27097
|
return {
|
|
27090
|
-
w: i(n *
|
|
27091
|
-
h: i(r *
|
|
27098
|
+
w: i(n * ka),
|
|
27099
|
+
h: i(r * ka)
|
|
27092
27100
|
};
|
|
27093
27101
|
}
|
|
27094
|
-
async function
|
|
27095
|
-
if (!
|
|
27102
|
+
async function ja(e, t, n, r = !1) {
|
|
27103
|
+
if (!aa(e) || t <= 0 || n <= 0) return null;
|
|
27096
27104
|
let i = It(t, n);
|
|
27097
27105
|
if (!i) return null;
|
|
27098
27106
|
let a = i.getContext("2d");
|
|
27099
|
-
return !a || (a.lineJoin = "round", a.lineCap = "round", !
|
|
27107
|
+
return !a || (a.lineJoin = "round", a.lineCap = "round", !Da(e, a, t, n, r)) ? null : createImageBitmap(i);
|
|
27100
27108
|
}
|
|
27101
|
-
async function
|
|
27109
|
+
async function Ma(e, t = {}) {
|
|
27102
27110
|
let { widthPt: n = 0, heightPt: r = 0, suppressBoundaryFrame: i = !1 } = t, a = new Uint8Array(await e.slice(0, 64 * 1024).arrayBuffer());
|
|
27103
|
-
if (ia(a)) {
|
|
27104
|
-
let { w: t, h: a } = ka(n, r);
|
|
27105
|
-
return Aa(new Uint8Array(await e.arrayBuffer()), t, a, i);
|
|
27106
|
-
}
|
|
27107
27111
|
if (aa(a)) {
|
|
27108
|
-
let { w: t, h:
|
|
27109
|
-
return
|
|
27112
|
+
let { w: t, h: a } = Aa(n, r);
|
|
27113
|
+
return ja(new Uint8Array(await e.arrayBuffer()), t, a, i);
|
|
27110
27114
|
}
|
|
27111
|
-
|
|
27115
|
+
if (oa(a)) {
|
|
27116
|
+
let { w: t, h: i } = Aa(n, r);
|
|
27117
|
+
return Hi(new Uint8Array(await e.arrayBuffer()), t, i);
|
|
27118
|
+
}
|
|
27119
|
+
return Qi(a) ? null : createImageBitmap(e);
|
|
27112
27120
|
}
|
|
27113
27121
|
//#endregion
|
|
27114
27122
|
//#region packages/core/src/image/bitmap-image-by-path.ts
|
|
27115
|
-
var
|
|
27116
|
-
function
|
|
27117
|
-
let t =
|
|
27118
|
-
return t || (t = /* @__PURE__ */ new Map(),
|
|
27119
|
-
}
|
|
27120
|
-
var Fa = /* @__PURE__ */ new WeakMap(), Ia = /* @__PURE__ */ new WeakSet();
|
|
27121
|
-
function La(e) {
|
|
27122
|
-
!e || Ia.has(e) || (Ia.add(e), e.close());
|
|
27123
|
+
var Na = 256, Pa = /* @__PURE__ */ new WeakMap();
|
|
27124
|
+
function Fa(e) {
|
|
27125
|
+
let t = Pa.get(e);
|
|
27126
|
+
return t || (t = /* @__PURE__ */ new Map(), Pa.set(e, t)), t;
|
|
27123
27127
|
}
|
|
27128
|
+
var Ia = /* @__PURE__ */ new WeakMap(), La = /* @__PURE__ */ new WeakSet();
|
|
27124
27129
|
function Ra(e) {
|
|
27125
|
-
|
|
27130
|
+
!e || La.has(e) || (La.add(e), e.close());
|
|
27131
|
+
}
|
|
27132
|
+
function za(e) {
|
|
27133
|
+
let t = Ia.get(e);
|
|
27126
27134
|
t || (t = {
|
|
27127
27135
|
count: 0,
|
|
27128
27136
|
deferred: []
|
|
27129
|
-
},
|
|
27137
|
+
}, Ia.set(e, t));
|
|
27130
27138
|
let n = t;
|
|
27131
27139
|
n.count++;
|
|
27132
27140
|
let r = !1;
|
|
27133
27141
|
return () => {
|
|
27134
27142
|
if (!r && (r = !0, n.count--, !(n.count > 0))) {
|
|
27135
|
-
for (let e of n.deferred) e.then((e) =>
|
|
27136
|
-
n.deferred = [],
|
|
27143
|
+
for (let e of n.deferred) e.then((e) => Ra(e)).catch(() => {});
|
|
27144
|
+
n.deferred = [], Ia.delete(e);
|
|
27137
27145
|
}
|
|
27138
27146
|
};
|
|
27139
27147
|
}
|
|
27140
|
-
function
|
|
27141
|
-
let n =
|
|
27148
|
+
function Ba(e, t) {
|
|
27149
|
+
let n = Ia.get(e);
|
|
27142
27150
|
if (n && n.count > 0) {
|
|
27143
27151
|
n.deferred.push(t);
|
|
27144
27152
|
return;
|
|
27145
27153
|
}
|
|
27146
|
-
t.then((e) =>
|
|
27154
|
+
t.then((e) => Ra(e)).catch(() => {});
|
|
27147
27155
|
}
|
|
27148
|
-
function
|
|
27149
|
-
let { widthPt: i = 0, heightPt: a = 0, suppressBoundaryFrame: o = !1 } = r, s =
|
|
27156
|
+
function Va(e, t, n, r = {}) {
|
|
27157
|
+
let { widthPt: i = 0, heightPt: a = 0, suppressBoundaryFrame: o = !1 } = r, s = Fa(n), c = s.get(e);
|
|
27150
27158
|
if (c) return s.delete(e), s.set(e, c), c.promise;
|
|
27151
|
-
let l = n(e, t).then((e) =>
|
|
27159
|
+
let l = n(e, t).then((e) => Ma(e, {
|
|
27152
27160
|
widthPt: i,
|
|
27153
27161
|
heightPt: a,
|
|
27154
27162
|
suppressBoundaryFrame: o
|
|
27155
27163
|
})), u = { promise: l };
|
|
27156
27164
|
if (l.then((e) => {
|
|
27157
27165
|
u.bitmap = e;
|
|
27158
|
-
}).catch(() => {}), l.catch(() => s.delete(e)), s.set(e, u), s.size >
|
|
27166
|
+
}).catch(() => {}), l.catch(() => s.delete(e)), s.set(e, u), s.size > Na) {
|
|
27159
27167
|
let e = s.keys().next().value, t = s.get(e);
|
|
27160
|
-
s.delete(e), t &&
|
|
27168
|
+
s.delete(e), t && Ba(n, t.promise);
|
|
27161
27169
|
}
|
|
27162
27170
|
return l;
|
|
27163
27171
|
}
|
|
27164
|
-
function
|
|
27165
|
-
return
|
|
27172
|
+
function Ha(e, t) {
|
|
27173
|
+
return Pa.get(t)?.get(e)?.bitmap;
|
|
27166
27174
|
}
|
|
27167
|
-
function
|
|
27168
|
-
let t =
|
|
27175
|
+
function Ua(e) {
|
|
27176
|
+
let t = Pa.get(e);
|
|
27169
27177
|
if (t) {
|
|
27170
|
-
for (let n of t.values())
|
|
27171
|
-
t.clear(),
|
|
27178
|
+
for (let n of t.values()) Ba(e, n.promise);
|
|
27179
|
+
t.clear(), Pa.delete(e);
|
|
27172
27180
|
}
|
|
27173
27181
|
}
|
|
27174
27182
|
//#endregion
|
|
27175
27183
|
//#region packages/core/src/image/crop.ts
|
|
27176
|
-
function
|
|
27184
|
+
function Wa(e) {
|
|
27177
27185
|
let t = e;
|
|
27178
27186
|
return {
|
|
27179
27187
|
w: t.naturalWidth || (typeof t.width == "number" ? t.width : 0) || 0,
|
|
27180
27188
|
h: t.naturalHeight || (typeof t.height == "number" ? t.height : 0) || 0
|
|
27181
27189
|
};
|
|
27182
27190
|
}
|
|
27183
|
-
function
|
|
27191
|
+
function Ga(e, t) {
|
|
27184
27192
|
if (!t || !(t.l || t.t || t.r || t.b)) return null;
|
|
27185
|
-
let { w: n, h: r } =
|
|
27193
|
+
let { w: n, h: r } = Wa(e);
|
|
27186
27194
|
if (n <= 0 || r <= 0) return null;
|
|
27187
27195
|
let i = (e) => Math.max(0, Math.min(1, e)), a = i(t.l) * n, o = i(t.t) * r;
|
|
27188
27196
|
return {
|
|
@@ -27192,12 +27200,12 @@ function Wa(e, t) {
|
|
|
27192
27200
|
sh: Math.max(1, r - o - i(t.b) * r)
|
|
27193
27201
|
};
|
|
27194
27202
|
}
|
|
27195
|
-
function
|
|
27196
|
-
let s =
|
|
27203
|
+
function Ka(e, t, n, r, i, a, o) {
|
|
27204
|
+
let s = Ga(t, n);
|
|
27197
27205
|
s ? e.drawImage(t, s.sx, s.sy, s.sw, s.sh, r, i, a, o) : e.drawImage(t, r, i, a, o);
|
|
27198
27206
|
}
|
|
27199
|
-
function
|
|
27200
|
-
if (!t || !
|
|
27207
|
+
function qa(e, t, n, r) {
|
|
27208
|
+
if (!t || !sa(e)) return {
|
|
27201
27209
|
widthPt: n,
|
|
27202
27210
|
heightPt: r
|
|
27203
27211
|
};
|
|
@@ -27209,32 +27217,32 @@ function Ka(e, t, n, r) {
|
|
|
27209
27217
|
}
|
|
27210
27218
|
//#endregion
|
|
27211
27219
|
//#region packages/core/src/image/duotone.ts
|
|
27212
|
-
function
|
|
27220
|
+
function Ja(e) {
|
|
27213
27221
|
return /^[0-9a-fA-F]{6}$/.test(e) ? [
|
|
27214
27222
|
parseInt(e.slice(0, 2), 16),
|
|
27215
27223
|
parseInt(e.slice(2, 4), 16),
|
|
27216
27224
|
parseInt(e.slice(4, 6), 16)
|
|
27217
27225
|
] : null;
|
|
27218
27226
|
}
|
|
27219
|
-
function
|
|
27227
|
+
function Ya(e, t, n) {
|
|
27220
27228
|
return (.299 * e + .587 * t + .114 * n) / 255;
|
|
27221
27229
|
}
|
|
27222
|
-
function
|
|
27223
|
-
let r =
|
|
27230
|
+
function Xa(e, t, n) {
|
|
27231
|
+
let r = Ja(t), i = Ja(n);
|
|
27224
27232
|
if (!r || !i) return e;
|
|
27225
27233
|
let [a, o, s] = r, [c, l, u] = i, d = e.data;
|
|
27226
27234
|
for (let e = 0; e < d.length; e += 4) {
|
|
27227
27235
|
if (d[e + 3] === 0) continue;
|
|
27228
|
-
let t =
|
|
27236
|
+
let t = Ya(d[e], d[e + 1], d[e + 2]);
|
|
27229
27237
|
d[e] = Math.round(a + (c - a) * t), d[e + 1] = Math.round(o + (l - o) * t), d[e + 2] = Math.round(s + (u - s) * t);
|
|
27230
27238
|
}
|
|
27231
27239
|
return e;
|
|
27232
27240
|
}
|
|
27233
|
-
var
|
|
27234
|
-
async function
|
|
27241
|
+
var Za = (e, t) => typeof OffscreenCanvas > "u" ? null : new OffscreenCanvas(e, t);
|
|
27242
|
+
async function Qa(e, t, n) {
|
|
27235
27243
|
let { width: r, height: i } = n;
|
|
27236
27244
|
if (r <= 0 || i <= 0 || typeof createImageBitmap > "u") return e;
|
|
27237
|
-
let a = (n.offscreenFactory ??
|
|
27245
|
+
let a = (n.offscreenFactory ?? Za)(r, i);
|
|
27238
27246
|
if (!a) return e;
|
|
27239
27247
|
let o = a.getContext("2d");
|
|
27240
27248
|
if (!o) return e;
|
|
@@ -27245,22 +27253,22 @@ async function Za(e, t, n) {
|
|
|
27245
27253
|
} catch {
|
|
27246
27254
|
return e;
|
|
27247
27255
|
}
|
|
27248
|
-
return
|
|
27256
|
+
return Xa(s, t.clr1, t.clr2), o.putImageData(s, 0, 0), createImageBitmap(a);
|
|
27249
27257
|
}
|
|
27250
27258
|
//#endregion
|
|
27251
27259
|
//#region packages/core/src/image/blip-gate.ts
|
|
27252
|
-
function
|
|
27260
|
+
function $a(e) {
|
|
27253
27261
|
return e.svgImagePath != null && e.srcRect == null;
|
|
27254
27262
|
}
|
|
27255
27263
|
//#endregion
|
|
27256
27264
|
//#region packages/core/src/math/mathml.ts
|
|
27257
|
-
var
|
|
27265
|
+
var eo = {
|
|
27258
27266
|
"&": "&",
|
|
27259
27267
|
"<": "<",
|
|
27260
27268
|
">": ">",
|
|
27261
27269
|
"\"": """
|
|
27262
|
-
},
|
|
27263
|
-
function
|
|
27270
|
+
}, to = (e) => e.replace(/[&<>"]/g, (e) => eo[e]);
|
|
27271
|
+
function no(e) {
|
|
27264
27272
|
switch (e) {
|
|
27265
27273
|
case "roman": return "normal";
|
|
27266
27274
|
case "bold": return "bold";
|
|
@@ -27268,10 +27276,10 @@ function to(e) {
|
|
|
27268
27276
|
case "italic": return null;
|
|
27269
27277
|
}
|
|
27270
27278
|
}
|
|
27271
|
-
var
|
|
27272
|
-
function
|
|
27273
|
-
let n =
|
|
27274
|
-
a &&= (i += `<mn${r}>${
|
|
27279
|
+
var ro = new Set([..."⏞⏟⎴⎵︷︸⏜⏝{}[]()¯_‾"]), io = "+−±∓×÷·∗⋅∘∙*/", ao = "=≠<>≤≥≈≡∼≅≃→←↔⇒∈∉⊂⊆⊃⊇∝≪≫⊥≔", oo = "([{⟨⌈⌊", so = ")]}⟩⌉⌋", co = ",;";
|
|
27280
|
+
function lo(e, t) {
|
|
27281
|
+
let n = no(t), r = n ? ` mathvariant="${n}"` : "", i = "", a = "", o = () => {
|
|
27282
|
+
a &&= (i += `<mn${r}>${to(a)}</mn>`, "");
|
|
27275
27283
|
};
|
|
27276
27284
|
for (let t of e) {
|
|
27277
27285
|
if (t === " ") {
|
|
@@ -27282,56 +27290,56 @@ function co(e, t) {
|
|
|
27282
27290
|
a += t;
|
|
27283
27291
|
continue;
|
|
27284
27292
|
}
|
|
27285
|
-
o(),
|
|
27293
|
+
o(), io.includes(t) || ao.includes(t) || co.includes(t) ? i += `<mo>${to(t)}</mo>` : oo.includes(t) || so.includes(t) ? i += `<mo fence="true" stretchy="false">${to(t)}</mo>` : i += `<mi${r}>${to(t)}</mi>`;
|
|
27286
27294
|
}
|
|
27287
27295
|
return o(), i;
|
|
27288
27296
|
}
|
|
27289
|
-
function
|
|
27290
|
-
return e.map(
|
|
27297
|
+
function uo(e) {
|
|
27298
|
+
return e.map(fo).join("");
|
|
27291
27299
|
}
|
|
27292
27300
|
function $(e) {
|
|
27293
|
-
return `<mrow>${
|
|
27301
|
+
return `<mrow>${uo(e)}</mrow>`;
|
|
27294
27302
|
}
|
|
27295
|
-
function
|
|
27303
|
+
function fo(e) {
|
|
27296
27304
|
switch (e.kind) {
|
|
27297
|
-
case "run": return
|
|
27305
|
+
case "run": return lo(e.text, e.style);
|
|
27298
27306
|
case "group": return $(e.items);
|
|
27299
27307
|
case "fraction": return `<mfrac${e.bar === !1 ? " linethickness=\"0\"" : ""}>${$(e.num)}${$(e.den)}</mfrac>`;
|
|
27300
27308
|
case "sup": return `<msup>${$(e.base)}${$(e.sup ?? [])}</msup>`;
|
|
27301
27309
|
case "sub": return `<msub>${$(e.base)}${$(e.sub ?? [])}</msub>`;
|
|
27302
27310
|
case "subSup": return `<msubsup>${$(e.base)}${$(e.sub ?? [])}${$(e.sup ?? [])}</msubsup>`;
|
|
27303
|
-
case "nary": return
|
|
27304
|
-
case "delimiter": return
|
|
27305
|
-
case "radical": return e.index && e.index.length ? `<mroot>${$(e.radicand)}${$(e.index)}</mroot>` : `<msqrt>${
|
|
27306
|
-
case "limit": return
|
|
27307
|
-
case "array": return
|
|
27311
|
+
case "nary": return xo(e);
|
|
27312
|
+
case "delimiter": return So(e);
|
|
27313
|
+
case "radical": return e.index && e.index.length ? `<mroot>${$(e.radicand)}${$(e.index)}</mroot>` : `<msqrt>${uo(e.radicand)}</msqrt>`;
|
|
27314
|
+
case "limit": return vo(e);
|
|
27315
|
+
case "array": return yo(e);
|
|
27308
27316
|
case "groupChr": {
|
|
27309
|
-
let t = $(e.base), n =
|
|
27317
|
+
let t = $(e.base), n = ro.has(e.char), r = e.pos === "top" ? "mover" : "munder", i = `<mo stretchy="${n}">${to(e.char)}</mo>`;
|
|
27310
27318
|
return n ? `<${r}>${t}${i}</${r}>` : `<${r} accent="true">${t}${i}</${r}>`;
|
|
27311
27319
|
}
|
|
27312
27320
|
case "bar": {
|
|
27313
27321
|
let t = $(e.base), n = "<mo stretchy=\"true\">―</mo>";
|
|
27314
27322
|
return e.pos === "bot" ? `<munder>${t}${n}</munder>` : `<mover>${t}${n}</mover>`;
|
|
27315
27323
|
}
|
|
27316
|
-
case "accent": return
|
|
27324
|
+
case "accent": return _o(e);
|
|
27317
27325
|
case "func": return `<mrow>${$(e.name)}<mo>⁡</mo>${$(e.arg)}</mrow>`;
|
|
27318
|
-
case "phant": return
|
|
27326
|
+
case "phant": return po(e);
|
|
27319
27327
|
case "sPre": return `<mmultiscripts>${$(e.base)}<mprescripts/>${$(e.sub)}${$(e.sup)}</mmultiscripts>`;
|
|
27320
27328
|
case "box": return $(e.base);
|
|
27321
|
-
case "borderBox": return
|
|
27329
|
+
case "borderBox": return mo(e);
|
|
27322
27330
|
}
|
|
27323
27331
|
}
|
|
27324
|
-
function
|
|
27325
|
-
let t = e.show ?
|
|
27332
|
+
function po(e) {
|
|
27333
|
+
let t = e.show ? uo(e.base) : `<mphantom>${uo(e.base)}</mphantom>`, n = [];
|
|
27326
27334
|
return e.zeroWid && n.push("width=\"0\""), e.zeroAsc && n.push("height=\"0\""), e.zeroDesc && n.push("depth=\"0\""), n.length ? `<mpadded ${n.join(" ")}>${t}</mpadded>` : `<mrow>${t}</mrow>`;
|
|
27327
27335
|
}
|
|
27328
|
-
function
|
|
27336
|
+
function mo(e) {
|
|
27329
27337
|
let t = [], n = !e.hideTop, r = !e.hideBot, i = !e.hideLeft, a = !e.hideRight;
|
|
27330
27338
|
n && r && i && a ? t.push("box") : (n && t.push("top"), r && t.push("bottom"), i && t.push("left"), a && t.push("right")), e.strikeH && t.push("horizontalstrike"), e.strikeV && t.push("verticalstrike"), e.strikeBltr && t.push("updiagonalstrike"), e.strikeTlbr && t.push("downdiagonalstrike");
|
|
27331
|
-
let o =
|
|
27339
|
+
let o = uo(e.base);
|
|
27332
27340
|
return t.length ? `<menclose notation="${t.join(" ")}">${o}</menclose>` : `<mrow>${o}</mrow>`;
|
|
27333
27341
|
}
|
|
27334
|
-
var
|
|
27342
|
+
var ho = {
|
|
27335
27343
|
"̀": "`",
|
|
27336
27344
|
"́": "´",
|
|
27337
27345
|
"̂": "^",
|
|
@@ -27342,7 +27350,7 @@ var mo = {
|
|
|
27342
27350
|
"̌": "ˇ",
|
|
27343
27351
|
"⃗": "→",
|
|
27344
27352
|
"⃖": "←"
|
|
27345
|
-
},
|
|
27353
|
+
}, go = new Set([
|
|
27346
27354
|
"̅",
|
|
27347
27355
|
"̄",
|
|
27348
27356
|
"¯",
|
|
@@ -27350,53 +27358,53 @@ var mo = {
|
|
|
27350
27358
|
"̲",
|
|
27351
27359
|
"̳"
|
|
27352
27360
|
]);
|
|
27353
|
-
function
|
|
27361
|
+
function _o(e) {
|
|
27354
27362
|
let t = $(e.base);
|
|
27355
|
-
if (
|
|
27356
|
-
let n =
|
|
27357
|
-
return `<mover accent="true">${t}<mo stretchy="${n === "→" || n === "←" ? "true" : "false"}">${
|
|
27363
|
+
if (go.has(e.char)) return `<mover>${t}<mo stretchy="true">―</mo></mover>`;
|
|
27364
|
+
let n = ho[e.char] ?? e.char;
|
|
27365
|
+
return `<mover accent="true">${t}<mo stretchy="${n === "→" || n === "←" ? "true" : "false"}">${to(n)}</mo></mover>`;
|
|
27358
27366
|
}
|
|
27359
|
-
function
|
|
27367
|
+
function vo(e) {
|
|
27360
27368
|
let t = $(e.base), n = e.lower && e.lower.length ? $(e.lower) : null, r = e.upper && e.upper.length ? $(e.upper) : null;
|
|
27361
27369
|
return n && r ? `<munderover>${t}${n}${r}</munderover>` : n ? `<munder>${t}${n}</munder>` : r ? `<mover>${t}${r}</mover>` : t;
|
|
27362
27370
|
}
|
|
27363
|
-
function
|
|
27371
|
+
function yo(e) {
|
|
27364
27372
|
let t = Math.max(1, ...e.rows.map((e) => e.length)), n;
|
|
27365
27373
|
n = e.align === "eq" ? Array.from({ length: t }, (e, t) => t % 2 == 0 ? "right" : "left").join(" ") : e.align === "left" ? "left" : "center";
|
|
27366
|
-
let r = e.rows.map((e) => `<mtr>${e.map((e) => `<mtd>${
|
|
27374
|
+
let r = e.rows.map((e) => `<mtr>${e.map((e) => `<mtd>${uo(e)}</mtd>`).join("")}</mtr>`).join("");
|
|
27367
27375
|
return `<mtable columnalign="${n}" rowspacing="0.2em" columnspacing="0.3em">${r}</mtable>`;
|
|
27368
27376
|
}
|
|
27369
|
-
var
|
|
27370
|
-
function bo(e) {
|
|
27371
|
-
let t = e.limLoc === "subSup" ? !0 : e.limLoc === "undOvr" ? !1 : yo.has(e.op), n = `<mo largeop="true">${eo(e.op)}</mo>`, r = e.sub ?? [], i = e.sup ?? [], a;
|
|
27372
|
-
return a = t ? r.length && i.length ? `<msubsup>${n}${$(r)}${$(i)}</msubsup>` : r.length ? `<msub>${n}${$(r)}</msub>` : i.length ? `<msup>${n}${$(i)}</msup>` : n : r.length && i.length ? `<munderover>${n}${$(r)}${$(i)}</munderover>` : r.length ? `<munder>${n}${$(r)}</munder>` : i.length ? `<mover>${n}${$(i)}</mover>` : n, `<mrow>${a}${lo(e.body)}</mrow>`;
|
|
27373
|
-
}
|
|
27377
|
+
var bo = new Set([..."∫∬∭∮∯∰∱∲∳⨌⨍⨎⨏⨐⨑⨒⨓⨔⨕⨖⨗"]);
|
|
27374
27378
|
function xo(e) {
|
|
27375
|
-
let t = (e)
|
|
27379
|
+
let t = e.limLoc === "subSup" ? !0 : e.limLoc === "undOvr" ? !1 : bo.has(e.op), n = `<mo largeop="true">${to(e.op)}</mo>`, r = e.sub ?? [], i = e.sup ?? [], a;
|
|
27380
|
+
return a = t ? r.length && i.length ? `<msubsup>${n}${$(r)}${$(i)}</msubsup>` : r.length ? `<msub>${n}${$(r)}</msub>` : i.length ? `<msup>${n}${$(i)}</msup>` : n : r.length && i.length ? `<munderover>${n}${$(r)}${$(i)}</munderover>` : r.length ? `<munder>${n}${$(r)}</munder>` : i.length ? `<mover>${n}${$(i)}</mover>` : n, `<mrow>${a}${uo(e.body)}</mrow>`;
|
|
27381
|
+
}
|
|
27382
|
+
function So(e) {
|
|
27383
|
+
let t = (e) => `<mo fence="true" stretchy="true">${to(e)}</mo>`, n = e.items.map((e) => $(e)).join("<mo separator=\"true\">,</mo>");
|
|
27376
27384
|
return `<mrow>${t(e.begChar)}${n}${t(e.endChar)}</mrow>`;
|
|
27377
27385
|
}
|
|
27378
|
-
function
|
|
27379
|
-
return `<math xmlns="http://www.w3.org/1998/Math/MathML" display="${t ? "block" : "inline"}">${
|
|
27386
|
+
function Co(e, t) {
|
|
27387
|
+
return `<math xmlns="http://www.w3.org/1998/Math/MathML" display="${t ? "block" : "inline"}">${uo(e)}</math>`;
|
|
27380
27388
|
}
|
|
27381
27389
|
//#endregion
|
|
27382
27390
|
//#region packages/core/src/canvas/env.ts
|
|
27383
|
-
function
|
|
27391
|
+
function wo(e) {
|
|
27384
27392
|
return typeof HTMLCanvasElement < "u" && e instanceof HTMLCanvasElement;
|
|
27385
27393
|
}
|
|
27386
|
-
function
|
|
27394
|
+
function To(e = 1) {
|
|
27387
27395
|
return typeof window < "u" && window.devicePixelRatio || e;
|
|
27388
27396
|
}
|
|
27389
27397
|
//#endregion
|
|
27390
27398
|
//#region packages/core/src/canvas/crisp.ts
|
|
27391
|
-
function
|
|
27399
|
+
function Eo(e, t, n) {
|
|
27392
27400
|
let r = Math.round(t * n) % 2 == 1 ? .5 : 0, i = e * n;
|
|
27393
27401
|
return (Math.round(i - r) + r) / n - e;
|
|
27394
27402
|
}
|
|
27395
27403
|
//#endregion
|
|
27396
27404
|
//#region packages/core/src/canvas/clamp.ts
|
|
27397
|
-
var
|
|
27398
|
-
function
|
|
27399
|
-
let n = Number.isFinite(e) && e > 0 ? Math.max(1, Math.round(e)) : 1, r = Number.isFinite(t) && t > 0 ? Math.max(1, Math.round(t)) : 1, i = Math.min(1,
|
|
27405
|
+
var Do = 32767, Oo = 1 << 24;
|
|
27406
|
+
function ko(e, t) {
|
|
27407
|
+
let n = Number.isFinite(e) && e > 0 ? Math.max(1, Math.round(e)) : 1, r = Number.isFinite(t) && t > 0 ? Math.max(1, Math.round(t)) : 1, i = Math.min(1, Do / n, Do / r), a = n * r, o = a > 16777216 ? Math.sqrt(Oo / a) : 1, s = Math.min(i, o);
|
|
27400
27408
|
return s >= 1 ? {
|
|
27401
27409
|
width: n,
|
|
27402
27410
|
height: r,
|
|
@@ -27411,11 +27419,11 @@ function Oo(e, t) {
|
|
|
27411
27419
|
}
|
|
27412
27420
|
//#endregion
|
|
27413
27421
|
//#region packages/core/src/worker/bridge.ts
|
|
27414
|
-
function
|
|
27422
|
+
function Ao() {
|
|
27415
27423
|
let e = /* @__PURE__ */ Error("worker request aborted");
|
|
27416
27424
|
return e.name = "AbortError", e;
|
|
27417
27425
|
}
|
|
27418
|
-
var
|
|
27426
|
+
var jo = class {
|
|
27419
27427
|
_worker;
|
|
27420
27428
|
_opts;
|
|
27421
27429
|
_pending = /* @__PURE__ */ new Map();
|
|
@@ -27451,7 +27459,7 @@ var Ao = class {
|
|
|
27451
27459
|
let r = this._nextId++, i = n?.timeoutMs ?? this._opts.timeoutMs, a = n?.signal;
|
|
27452
27460
|
return new Promise((n, o) => {
|
|
27453
27461
|
if (a?.aborted) {
|
|
27454
|
-
o(
|
|
27462
|
+
o(Ao());
|
|
27455
27463
|
return;
|
|
27456
27464
|
}
|
|
27457
27465
|
let s, c;
|
|
@@ -27466,7 +27474,7 @@ var Ao = class {
|
|
|
27466
27474
|
e && (this._pending.delete(r), e.cleanup(), e.reject(/* @__PURE__ */ Error(`worker request timed out after ${i}ms`)));
|
|
27467
27475
|
}, i)), a && (c = () => {
|
|
27468
27476
|
let e = this._pending.get(r);
|
|
27469
|
-
e && (this._pending.delete(r), e.cleanup(), e.reject(
|
|
27477
|
+
e && (this._pending.delete(r), e.cleanup(), e.reject(Ao()));
|
|
27470
27478
|
}, a.addEventListener("abort", c)), this._worker.postMessage(e(r), t);
|
|
27471
27479
|
});
|
|
27472
27480
|
}
|
|
@@ -27476,7 +27484,7 @@ var Ao = class {
|
|
|
27476
27484
|
terminate() {
|
|
27477
27485
|
this._worker.removeEventListener("message", this._handle), this._worker.removeEventListener("messageerror", this._handleWorkerError), this._worker.removeEventListener("error", this._handleWorkerError), this._worker.terminate(), this._rejectAll(/* @__PURE__ */ Error("Worker terminated"));
|
|
27478
27486
|
}
|
|
27479
|
-
},
|
|
27487
|
+
}, Mo = [
|
|
27480
27488
|
"L",
|
|
27481
27489
|
"R",
|
|
27482
27490
|
"AL",
|
|
@@ -27500,7 +27508,7 @@ var Ao = class {
|
|
|
27500
27508
|
"RLI",
|
|
27501
27509
|
"FSI",
|
|
27502
27510
|
"PDI"
|
|
27503
|
-
],
|
|
27511
|
+
], No = [
|
|
27504
27512
|
0,
|
|
27505
27513
|
9,
|
|
27506
27514
|
10,
|
|
@@ -28768,7 +28776,7 @@ var Ao = class {
|
|
|
28768
28776
|
1048574,
|
|
28769
28777
|
1048576,
|
|
28770
28778
|
1114110
|
|
28771
|
-
],
|
|
28779
|
+
], Po = [
|
|
28772
28780
|
9,
|
|
28773
28781
|
11,
|
|
28774
28782
|
10,
|
|
@@ -30036,7 +30044,7 @@ var Ao = class {
|
|
|
30036
30044
|
9,
|
|
30037
30045
|
0,
|
|
30038
30046
|
9
|
|
30039
|
-
],
|
|
30047
|
+
], Fo = [
|
|
30040
30048
|
40,
|
|
30041
30049
|
41,
|
|
30042
30050
|
41,
|
|
@@ -30893,7 +30901,7 @@ var Ao = class {
|
|
|
30893
30901
|
65379,
|
|
30894
30902
|
65379,
|
|
30895
30903
|
65378
|
|
30896
|
-
],
|
|
30904
|
+
], Io = [
|
|
30897
30905
|
40,
|
|
30898
30906
|
41,
|
|
30899
30907
|
0,
|
|
@@ -31281,42 +31289,42 @@ var Ao = class {
|
|
|
31281
31289
|
];
|
|
31282
31290
|
//#endregion
|
|
31283
31291
|
//#region packages/core/src/text/bidi/char-data.ts
|
|
31284
|
-
function
|
|
31285
|
-
let t = 0, n =
|
|
31292
|
+
function Lo(e) {
|
|
31293
|
+
let t = 0, n = No.length - 1;
|
|
31286
31294
|
for (; t < n;) {
|
|
31287
31295
|
let r = t + n + 1 >> 1;
|
|
31288
|
-
|
|
31296
|
+
No[r] <= e ? t = r : n = r - 1;
|
|
31289
31297
|
}
|
|
31290
|
-
return
|
|
31298
|
+
return Po[t];
|
|
31291
31299
|
}
|
|
31292
|
-
function
|
|
31293
|
-
return
|
|
31300
|
+
function Ro(e) {
|
|
31301
|
+
return Mo[Lo(e)];
|
|
31294
31302
|
}
|
|
31295
|
-
var
|
|
31303
|
+
var zo = (() => {
|
|
31296
31304
|
let e = /* @__PURE__ */ new Map();
|
|
31297
|
-
for (let t = 0; t <
|
|
31305
|
+
for (let t = 0; t < Fo.length; t += 2) e.set(Fo[t], Fo[t + 1]);
|
|
31298
31306
|
return e;
|
|
31299
31307
|
})();
|
|
31300
|
-
function
|
|
31301
|
-
return
|
|
31308
|
+
function Bo(e) {
|
|
31309
|
+
return zo.get(e) ?? null;
|
|
31302
31310
|
}
|
|
31303
|
-
var
|
|
31311
|
+
var Vo = (() => {
|
|
31304
31312
|
let e = /* @__PURE__ */ new Map();
|
|
31305
|
-
for (let t = 0; t <
|
|
31306
|
-
pair:
|
|
31307
|
-
type:
|
|
31313
|
+
for (let t = 0; t < Io.length; t += 3) e.set(Io[t], {
|
|
31314
|
+
pair: Io[t + 1],
|
|
31315
|
+
type: Io[t + 2] === 0 ? "o" : "c"
|
|
31308
31316
|
});
|
|
31309
31317
|
return e;
|
|
31310
31318
|
})();
|
|
31311
|
-
function
|
|
31312
|
-
return
|
|
31319
|
+
function Ho(e) {
|
|
31320
|
+
return Vo.get(e) ?? null;
|
|
31313
31321
|
}
|
|
31314
|
-
var
|
|
31315
|
-
function
|
|
31322
|
+
var Uo = (e) => e === "RLE" || e === "LRE" || e === "RLO" || e === "LRO" || e === "PDF" || e === "BN", Wo = (e) => e === "LRI" || e === "RLI" || e === "FSI", Go = (e) => e === "B" || e === "S" || e === "WS" || e === "ON" || e === "FSI" || e === "LRI" || e === "RLI" || e === "PDI", Ko = (e) => e & 1 ? e + 2 : e + 1, qo = (e) => e & 1 ? e + 1 : e + 2;
|
|
31323
|
+
function Jo(e, t, n) {
|
|
31316
31324
|
let r = 0;
|
|
31317
31325
|
for (let i = t; i < n; i++) {
|
|
31318
31326
|
let t = e[i];
|
|
31319
|
-
if (
|
|
31327
|
+
if (Wo(t)) r++;
|
|
31320
31328
|
else if (t === "PDI") r > 0 && r--;
|
|
31321
31329
|
else if (r === 0) {
|
|
31322
31330
|
if (t === "L") return 0;
|
|
@@ -31325,11 +31333,11 @@ function qo(e, t, n) {
|
|
|
31325
31333
|
}
|
|
31326
31334
|
return 0;
|
|
31327
31335
|
}
|
|
31328
|
-
function
|
|
31336
|
+
function Yo(e) {
|
|
31329
31337
|
let t = e.length, n = new Int32Array(t).fill(t), r = new Int32Array(t).fill(-1), i = [];
|
|
31330
31338
|
for (let a = 0; a < t; a++) {
|
|
31331
31339
|
let t = e[a];
|
|
31332
|
-
if (
|
|
31340
|
+
if (Wo(t)) i.push(a);
|
|
31333
31341
|
else if (t === "PDI" && i.length) {
|
|
31334
31342
|
let e = i.pop();
|
|
31335
31343
|
n[e] = a, r[a] = e;
|
|
@@ -31340,7 +31348,7 @@ function Jo(e) {
|
|
|
31340
31348
|
initOf: r
|
|
31341
31349
|
};
|
|
31342
31350
|
}
|
|
31343
|
-
function
|
|
31351
|
+
function Xo(e, t, n) {
|
|
31344
31352
|
let r = e.length, i = Array(r).fill(t), a = e.slice(), o = [{
|
|
31345
31353
|
level: t,
|
|
31346
31354
|
override: "neutral",
|
|
@@ -31354,7 +31362,7 @@ function Yo(e, t, n) {
|
|
|
31354
31362
|
case "RLO":
|
|
31355
31363
|
case "LRO": {
|
|
31356
31364
|
i[d] = u().level;
|
|
31357
|
-
let e = r === "RLE" || r === "RLO" ?
|
|
31365
|
+
let e = r === "RLE" || r === "RLO" ? Ko(u().level) : qo(u().level);
|
|
31358
31366
|
e <= 125 && s === 0 && c === 0 ? o.push({
|
|
31359
31367
|
level: e,
|
|
31360
31368
|
override: r === "RLO" ? "R" : r === "LRO" ? "L" : "neutral",
|
|
@@ -31369,8 +31377,8 @@ function Yo(e, t, n) {
|
|
|
31369
31377
|
let t = u().override;
|
|
31370
31378
|
t !== "neutral" && (a[d] = t);
|
|
31371
31379
|
let f;
|
|
31372
|
-
f = r === "RLI" ? "R" : r === "LRI" ? "L" :
|
|
31373
|
-
let p = f === "R" ?
|
|
31380
|
+
f = r === "RLI" ? "R" : r === "LRI" ? "L" : Jo(e, d + 1, n[d]) === 1 ? "R" : "L";
|
|
31381
|
+
let p = f === "R" ? Ko(u().level) : qo(u().level);
|
|
31374
31382
|
p <= 125 && s === 0 && c === 0 ? (l++, o.push({
|
|
31375
31383
|
level: p,
|
|
31376
31384
|
override: "neutral",
|
|
@@ -31412,10 +31420,10 @@ function Yo(e, t, n) {
|
|
|
31412
31420
|
types: a
|
|
31413
31421
|
};
|
|
31414
31422
|
}
|
|
31415
|
-
function
|
|
31423
|
+
function Zo(e) {
|
|
31416
31424
|
return e === 9001 ? 12296 : e === 9002 ? 12297 : e;
|
|
31417
31425
|
}
|
|
31418
|
-
function
|
|
31426
|
+
function Qo(e, t, n, r, i, a) {
|
|
31419
31427
|
let o = e.length, s = [];
|
|
31420
31428
|
for (let e = 0; e < o; e++) n[e] || s.push(e);
|
|
31421
31429
|
let c = [];
|
|
@@ -31433,7 +31441,7 @@ function Zo(e, t, n, r, i, a) {
|
|
|
31433
31441
|
for (;;) {
|
|
31434
31442
|
for (let e of p) f.push(e);
|
|
31435
31443
|
let t = p[p.length - 1];
|
|
31436
|
-
if (
|
|
31444
|
+
if (Wo(e[t]) && i[t] !== o) {
|
|
31437
31445
|
let e = l.get(i[t]);
|
|
31438
31446
|
if (e) {
|
|
31439
31447
|
p = e;
|
|
@@ -31448,7 +31456,7 @@ function Zo(e, t, n, r, i, a) {
|
|
|
31448
31456
|
break;
|
|
31449
31457
|
}
|
|
31450
31458
|
let g = u(Math.max(m, h)), _ = f[f.length - 1], v = r;
|
|
31451
|
-
if (!(
|
|
31459
|
+
if (!(Wo(e[_]) && i[_] === o)) {
|
|
31452
31460
|
for (let e = _ + 1; e < o; e++) if (!n[e]) {
|
|
31453
31461
|
v = t[e];
|
|
31454
31462
|
break;
|
|
@@ -31464,8 +31472,8 @@ function Zo(e, t, n, r, i, a) {
|
|
|
31464
31472
|
}
|
|
31465
31473
|
return d;
|
|
31466
31474
|
}
|
|
31467
|
-
var
|
|
31468
|
-
function
|
|
31475
|
+
var $o = (e) => e === "L" ? "L" : e === "R" || e === "EN" || e === "AN" ? "R" : null;
|
|
31476
|
+
function es(e, t, n, r, i) {
|
|
31469
31477
|
let a = e.indices, o = a.length, { sos: s, eos: c, level: l } = e;
|
|
31470
31478
|
for (let e = 0; e < o; e++) {
|
|
31471
31479
|
let t = a[e];
|
|
@@ -31512,15 +31520,15 @@ function $o(e, t, n, r, i) {
|
|
|
31512
31520
|
outer: for (let n = 0; n < o; n++) {
|
|
31513
31521
|
let i = a[n];
|
|
31514
31522
|
if (r[i] !== "ON") continue;
|
|
31515
|
-
let o =
|
|
31523
|
+
let o = Ho(t[i]);
|
|
31516
31524
|
if (o) if (o.type === "o") {
|
|
31517
31525
|
if (e.length === 63) break outer;
|
|
31518
31526
|
e.push({
|
|
31519
|
-
expect:
|
|
31527
|
+
expect: Zo(o.pair),
|
|
31520
31528
|
pos: n
|
|
31521
31529
|
});
|
|
31522
31530
|
} else {
|
|
31523
|
-
let r =
|
|
31531
|
+
let r = Zo(t[i]);
|
|
31524
31532
|
for (let t = e.length - 1; t >= 0; t--) if (e[t].expect === r) {
|
|
31525
31533
|
f.push({
|
|
31526
31534
|
open: e[t].pos,
|
|
@@ -31538,7 +31546,7 @@ function $o(e, t, n, r, i) {
|
|
|
31538
31546
|
for (let { open: e, close: t } of f) {
|
|
31539
31547
|
let n = !1, i = !1;
|
|
31540
31548
|
for (let o = e + 1; o < t; o++) {
|
|
31541
|
-
let e =
|
|
31549
|
+
let e = $o(r[a[o]]);
|
|
31542
31550
|
e === u ? n = !0 : e === d && (i = !0);
|
|
31543
31551
|
}
|
|
31544
31552
|
let o = null;
|
|
@@ -31546,7 +31554,7 @@ function $o(e, t, n, r, i) {
|
|
|
31546
31554
|
else if (i) {
|
|
31547
31555
|
let t = s;
|
|
31548
31556
|
for (let n = e - 1; n >= 0; n--) {
|
|
31549
|
-
let e =
|
|
31557
|
+
let e = $o(r[a[n]]);
|
|
31550
31558
|
if (e) {
|
|
31551
31559
|
t = e;
|
|
31552
31560
|
break;
|
|
@@ -31557,29 +31565,29 @@ function $o(e, t, n, r, i) {
|
|
|
31557
31565
|
o && (r[a[e]] = o, r[a[t]] = o, p(e, o), p(t, o));
|
|
31558
31566
|
}
|
|
31559
31567
|
for (let e = 0; e < o; e++) {
|
|
31560
|
-
if (!
|
|
31568
|
+
if (!Go(r[a[e]])) continue;
|
|
31561
31569
|
let t = e;
|
|
31562
|
-
for (; t < o &&
|
|
31563
|
-
let n = e > 0 ?
|
|
31570
|
+
for (; t < o && Go(r[a[t]]);) t++;
|
|
31571
|
+
let n = e > 0 ? $o(r[a[e - 1]]) : s, i = t < o ? $o(r[a[t]]) : c;
|
|
31564
31572
|
if (n && i && n === i) for (let i = e; i < t; i++) r[a[i]] = n;
|
|
31565
31573
|
e = t - 1;
|
|
31566
31574
|
}
|
|
31567
|
-
for (let e = 0; e < o; e++)
|
|
31575
|
+
for (let e = 0; e < o; e++) Go(r[a[e]]) && (r[a[e]] = u);
|
|
31568
31576
|
for (let e = 0; e < o; e++) {
|
|
31569
31577
|
let t = a[e], n = r[t];
|
|
31570
31578
|
l & 1 ? (n === "L" || n === "EN" || n === "AN") && (i[t] += 1) : n === "R" ? i[t] += 1 : (n === "AN" || n === "EN") && (i[t] += 2);
|
|
31571
31579
|
}
|
|
31572
31580
|
}
|
|
31573
|
-
function
|
|
31581
|
+
function ts(e, t, n) {
|
|
31574
31582
|
let r = e.length, i = Array(r);
|
|
31575
|
-
for (let t = 0; t < r; t++) i[t] = n?.[t] ??
|
|
31576
|
-
let a = t === "rtl" ? 1 : t === "ltr" ? 0 :
|
|
31577
|
-
for (let e = 0; e < r; e++) u[e] =
|
|
31578
|
-
let d =
|
|
31579
|
-
for (let t of d)
|
|
31583
|
+
for (let t = 0; t < r; t++) i[t] = n?.[t] ?? Ro(e[t]);
|
|
31584
|
+
let a = t === "rtl" ? 1 : t === "ltr" ? 0 : Jo(i, 0, r), { pdiOf: o, initOf: s } = Yo(i), { levels: c, types: l } = Xo(i, a, o), u = Array(r);
|
|
31585
|
+
for (let e = 0; e < r; e++) u[e] = Uo(i[e]);
|
|
31586
|
+
let d = Qo(i, c, u, a, o, s), f = l.slice();
|
|
31587
|
+
for (let t of d) es(t, e, i, f, c);
|
|
31580
31588
|
let p = (e) => {
|
|
31581
31589
|
let t = i[e];
|
|
31582
|
-
return t === "WS" ||
|
|
31590
|
+
return t === "WS" || Wo(t) || t === "PDI" || u[e];
|
|
31583
31591
|
};
|
|
31584
31592
|
for (let e = 0; e < r; e++) {
|
|
31585
31593
|
let t = i[e];
|
|
@@ -31595,7 +31603,7 @@ function es(e, t, n) {
|
|
|
31595
31603
|
paragraphLevel: a
|
|
31596
31604
|
};
|
|
31597
31605
|
}
|
|
31598
|
-
function
|
|
31606
|
+
function ns(e, t, n) {
|
|
31599
31607
|
let r = [];
|
|
31600
31608
|
for (let i = t; i < n; i++) {
|
|
31601
31609
|
let t = e[i];
|
|
@@ -31623,7 +31631,7 @@ function ts(e, t, n) {
|
|
|
31623
31631
|
}
|
|
31624
31632
|
//#endregion
|
|
31625
31633
|
//#region packages/core/src/text/bidi/uax9/index.ts
|
|
31626
|
-
function
|
|
31634
|
+
function rs(e) {
|
|
31627
31635
|
let t = [], n = [], r = [];
|
|
31628
31636
|
for (let i = 0; i < e.length;) {
|
|
31629
31637
|
let a = e.codePointAt(i), o = a > 65535 ? 2 : 1;
|
|
@@ -31635,9 +31643,9 @@ function ns(e) {
|
|
|
31635
31643
|
starts: r
|
|
31636
31644
|
};
|
|
31637
31645
|
}
|
|
31638
|
-
var
|
|
31646
|
+
var is = class {
|
|
31639
31647
|
computeLevels(e, t, n) {
|
|
31640
|
-
let { cps: r, units: i, starts: a } =
|
|
31648
|
+
let { cps: r, units: i, starts: a } = rs(e), { levels: o, paragraphLevel: s } = ts(r, t, n ? r.map((e, t) => n[a[t]] ?? null) : void 0), c = new Uint8Array(e.length), l = 0;
|
|
31641
31649
|
for (let e = 0; e < o.length; e++) {
|
|
31642
31650
|
let t = o[e] === -1 ? 255 : o[e];
|
|
31643
31651
|
for (let n = 0; n < i[e]; n++) c[l++] = t;
|
|
@@ -31648,63 +31656,63 @@ var rs = class {
|
|
|
31648
31656
|
};
|
|
31649
31657
|
}
|
|
31650
31658
|
reorderVisual(e, t, n) {
|
|
31651
|
-
return
|
|
31659
|
+
return ns(e, t, n);
|
|
31652
31660
|
}
|
|
31653
31661
|
getMirror(e) {
|
|
31654
|
-
return
|
|
31662
|
+
return Bo(e);
|
|
31655
31663
|
}
|
|
31656
31664
|
};
|
|
31657
|
-
function
|
|
31658
|
-
return new
|
|
31665
|
+
function as() {
|
|
31666
|
+
return new is();
|
|
31659
31667
|
}
|
|
31660
31668
|
//#endregion
|
|
31661
31669
|
//#region packages/core/src/text/bidi/engine.ts
|
|
31662
|
-
var
|
|
31663
|
-
function
|
|
31664
|
-
return
|
|
31670
|
+
var os = null;
|
|
31671
|
+
function ss() {
|
|
31672
|
+
return os === null && (os = as()), os;
|
|
31665
31673
|
}
|
|
31666
31674
|
//#endregion
|
|
31667
31675
|
//#region packages/core/src/text/bidi/line-order.ts
|
|
31668
|
-
var
|
|
31669
|
-
function
|
|
31670
|
-
return
|
|
31676
|
+
var cs = /[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF\u200F\u202B\u202E\u2067]|[\u{10800}-\u{10FFF}\u{1E800}-\u{1EFFF}]/u;
|
|
31677
|
+
function ls(e) {
|
|
31678
|
+
return cs.test(e);
|
|
31671
31679
|
}
|
|
31672
|
-
function
|
|
31680
|
+
function us(e, t, n) {
|
|
31673
31681
|
let r = n.length, i = new Uint8Array(r);
|
|
31674
31682
|
for (let a = 0; a < r; a++) {
|
|
31675
31683
|
let r = e[n[a]];
|
|
31676
31684
|
i[a] = r === 255 ? t : r;
|
|
31677
31685
|
}
|
|
31678
31686
|
return {
|
|
31679
|
-
order:
|
|
31687
|
+
order: ss().reorderVisual(i, 0, r),
|
|
31680
31688
|
segLevels: i
|
|
31681
31689
|
};
|
|
31682
31690
|
}
|
|
31683
31691
|
//#endregion
|
|
31684
31692
|
//#region packages/core/src/text/kinsoku/rules.ts
|
|
31685
|
-
var
|
|
31686
|
-
function
|
|
31693
|
+
var ds = "”’)〕]}〉》」』】〙〗〟⦆»、。,.・:;/?!‐ー゠–〜~ぁぃぅぇぉっゃゅょゎゕゖァィゥェォッャュョヮヵヶㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻ゝゞヽヾ゛゜%‰℃°′″。」、・ー゙゚!),.:;?]}⦆", fs = "“‘(〔[{〈《「『【〘〖〝⦅«$¥#£¢([{⦅";
|
|
31694
|
+
function ps(e) {
|
|
31687
31695
|
let t = /* @__PURE__ */ new Set();
|
|
31688
31696
|
for (let n of e) t.add(n.codePointAt(0));
|
|
31689
31697
|
return t;
|
|
31690
31698
|
}
|
|
31691
|
-
function
|
|
31699
|
+
function ms(e) {
|
|
31692
31700
|
return {
|
|
31693
31701
|
enabled: e?.kinsoku !== !1,
|
|
31694
|
-
lineStartForbidden:
|
|
31695
|
-
lineEndForbidden:
|
|
31702
|
+
lineStartForbidden: ps(e?.noLineBreaksBefore ?? ds),
|
|
31703
|
+
lineEndForbidden: ps(e?.noLineBreaksAfter ?? fs)
|
|
31696
31704
|
};
|
|
31697
31705
|
}
|
|
31698
|
-
var
|
|
31706
|
+
var hs = ms();
|
|
31699
31707
|
//#endregion
|
|
31700
31708
|
//#region packages/core/src/text/kinsoku/split.ts
|
|
31701
|
-
function
|
|
31709
|
+
function gs(e, t, n, r = 1) {
|
|
31702
31710
|
if (!n.enabled || t <= 0 || t >= e.length) return t;
|
|
31703
31711
|
let i = (t) => t < e.length && n.lineStartForbidden.has(e[t].codePointAt(0)), a = (t) => t >= 0 && n.lineEndForbidden.has(e[t].codePointAt(0)), o = t;
|
|
31704
31712
|
for (; o > r && (i(o) || a(o - 1));) o--;
|
|
31705
31713
|
return o <= r && (i(o) || a(o - 1)) ? t : o;
|
|
31706
31714
|
}
|
|
31707
|
-
function
|
|
31715
|
+
function _s(e, t, n) {
|
|
31708
31716
|
if (!t.enabled) return 0;
|
|
31709
31717
|
let r = e.length - n;
|
|
31710
31718
|
for (let n = 1; n <= r; n++) {
|
|
@@ -31717,15 +31725,15 @@ function gs(e, t, n) {
|
|
|
31717
31725
|
}
|
|
31718
31726
|
//#endregion
|
|
31719
31727
|
//#region packages/core/src/text/cjk-ranges.ts
|
|
31720
|
-
function
|
|
31728
|
+
function vs(e) {
|
|
31721
31729
|
return e >= 12288 && e <= 40959 || e >= 44032 && e <= 55203 || e >= 63744 && e <= 64255 || e >= 65280 && e <= 65519;
|
|
31722
31730
|
}
|
|
31723
|
-
function
|
|
31724
|
-
return e === 32 || e === 9 || e === 10 || e === 13 ? !1 : !
|
|
31731
|
+
function ys(e) {
|
|
31732
|
+
return e === 32 || e === 9 || e === 10 || e === 13 ? !1 : !vs(e);
|
|
31725
31733
|
}
|
|
31726
31734
|
//#endregion
|
|
31727
31735
|
//#region packages/core/src/text/line-break-class.generated.ts
|
|
31728
|
-
var
|
|
31736
|
+
var bs = /* @__PURE__ */ "BK.CM.CR.GL.LF.NL.SP.WJ.ZW.ZWJ.AK.AL.AP.AS.B2.BA.BB.CB.CL.CP.EB.EM.EX.H2.H3.HL.HH.HY.ID.IN.IS.JL.JT.JV.NS.NU.OP.PO.PR.QU.RI.SY.VF.VI".split("."), xs = [
|
|
31729
31737
|
0,
|
|
31730
31738
|
9,
|
|
31731
31739
|
10,
|
|
@@ -34348,7 +34356,7 @@ var ys = /* @__PURE__ */ "BK.CM.CR.GL.LF.NL.SP.WJ.ZW.ZWJ.AK.AL.AP.AS.B2.BA.BB.CB
|
|
|
34348
34356
|
917632,
|
|
34349
34357
|
917760,
|
|
34350
34358
|
918e3
|
|
34351
|
-
],
|
|
34359
|
+
], Ss = [
|
|
34352
34360
|
1,
|
|
34353
34361
|
15,
|
|
34354
34362
|
4,
|
|
@@ -36971,7 +36979,7 @@ var ys = /* @__PURE__ */ "BK.CM.CR.GL.LF.NL.SP.WJ.ZW.ZWJ.AK.AL.AP.AS.B2.BA.BB.CB
|
|
|
36971
36979
|
11,
|
|
36972
36980
|
1,
|
|
36973
36981
|
11
|
|
36974
|
-
],
|
|
36982
|
+
], Cs = [
|
|
36975
36983
|
4352,
|
|
36976
36984
|
8361,
|
|
36977
36985
|
8986,
|
|
@@ -37101,7 +37109,7 @@ var ys = /* @__PURE__ */ "BK.CM.CR.GL.LF.NL.SP.WJ.ZW.ZWJ.AK.AL.AP.AS.B2.BA.BB.CB
|
|
|
37101
37109
|
129775,
|
|
37102
37110
|
131072,
|
|
37103
37111
|
196608
|
|
37104
|
-
],
|
|
37112
|
+
], ws = [
|
|
37105
37113
|
4448,
|
|
37106
37114
|
8362,
|
|
37107
37115
|
8988,
|
|
@@ -37234,68 +37242,68 @@ var ys = /* @__PURE__ */ "BK.CM.CR.GL.LF.NL.SP.WJ.ZW.ZWJ.AK.AL.AP.AS.B2.BA.BB.CB
|
|
|
37234
37242
|
];
|
|
37235
37243
|
//#endregion
|
|
37236
37244
|
//#region packages/core/src/text/line-break.ts
|
|
37237
|
-
function
|
|
37238
|
-
let t = 0, n =
|
|
37245
|
+
function Ts(e) {
|
|
37246
|
+
let t = 0, n = xs.length - 1;
|
|
37239
37247
|
for (; t < n;) {
|
|
37240
37248
|
let r = t + n + 1 >> 1;
|
|
37241
|
-
|
|
37249
|
+
xs[r] <= e ? t = r : n = r - 1;
|
|
37242
37250
|
}
|
|
37243
|
-
return
|
|
37251
|
+
return bs[Ss[t]];
|
|
37244
37252
|
}
|
|
37245
|
-
function
|
|
37246
|
-
let t = 0, n =
|
|
37247
|
-
if (n < 0 || e <
|
|
37253
|
+
function Es(e) {
|
|
37254
|
+
let t = 0, n = Cs.length - 1;
|
|
37255
|
+
if (n < 0 || e < Cs[0]) return !1;
|
|
37248
37256
|
for (; t < n;) {
|
|
37249
37257
|
let r = t + n + 1 >> 1;
|
|
37250
|
-
|
|
37258
|
+
Cs[r] <= e ? t = r : n = r - 1;
|
|
37251
37259
|
}
|
|
37252
|
-
return e <
|
|
37260
|
+
return e < ws[t];
|
|
37253
37261
|
}
|
|
37254
|
-
function
|
|
37255
|
-
let n =
|
|
37262
|
+
function Ds(e, t) {
|
|
37263
|
+
let n = Ts(e);
|
|
37256
37264
|
if (n === "OP") return !0;
|
|
37257
|
-
let r =
|
|
37258
|
-
return !!(i && (a || r === "NU" || r === "PR" || r === "PO") || a && (n === "NU" || n === "PR" || n === "PO") || n === "PR" && (r === "ID" || r === "EB" || r === "EM") || (n === "ID" || n === "EB" || n === "EM") && r === "PO" || n === "NU" && (r === "NU" || r === "PO" || r === "PR") || r === "NU" && (n === "PO" || n === "PR" || n === "HY" || n === "IS") || (i || n === "NU") && r === "OP" && !
|
|
37265
|
+
let r = Ts(t), i = n === "AL" || n === "HL", a = r === "AL" || r === "HL";
|
|
37266
|
+
return !!(i && (a || r === "NU" || r === "PR" || r === "PO") || a && (n === "NU" || n === "PR" || n === "PO") || n === "PR" && (r === "ID" || r === "EB" || r === "EM") || (n === "ID" || n === "EB" || n === "EM") && r === "PO" || n === "NU" && (r === "NU" || r === "PO" || r === "PR") || r === "NU" && (n === "PO" || n === "PR" || n === "HY" || n === "IS") || (i || n === "NU") && r === "OP" && !Es(t) || n === "CP" && !Es(e) && (a || r === "NU"));
|
|
37259
37267
|
}
|
|
37260
37268
|
//#endregion
|
|
37261
37269
|
//#region packages/core/src/text/sea-break.ts
|
|
37262
|
-
function
|
|
37270
|
+
function Os(e) {
|
|
37263
37271
|
return e === "my" || e === "bo";
|
|
37264
37272
|
}
|
|
37265
|
-
function
|
|
37273
|
+
function ks(e) {
|
|
37266
37274
|
return e >= 3584 && e <= 3711 || e >= 3712 && e <= 3839 || e >= 6016 && e <= 6143 || e >= 4096 && e <= 4255 || e >= 43616 && e <= 43647 || e >= 43488 && e <= 43519 || e >= 3840 && e <= 4095;
|
|
37267
37275
|
}
|
|
37268
|
-
function
|
|
37276
|
+
function As(e) {
|
|
37269
37277
|
return e === 3633 || e >= 3635 && e <= 3642 || e >= 3655 && e <= 3662 || e === 3761 || e >= 3763 && e <= 3772 || e >= 3784 && e <= 3790 || e >= 6068 && e <= 6099 || e === 6109;
|
|
37270
37278
|
}
|
|
37271
|
-
function
|
|
37279
|
+
function js(e) {
|
|
37272
37280
|
return e <= 3711 ? "th" : e <= 3839 ? "lo" : e <= 4095 ? "bo" : e <= 4255 ? "my" : e <= 6143 ? "km" : "my";
|
|
37273
37281
|
}
|
|
37274
|
-
function
|
|
37275
|
-
for (let t of e) if (
|
|
37282
|
+
function Ms(e) {
|
|
37283
|
+
for (let t of e) if (ks(t.codePointAt(0))) return !0;
|
|
37276
37284
|
return !1;
|
|
37277
37285
|
}
|
|
37278
|
-
function
|
|
37286
|
+
function Ns(e) {
|
|
37279
37287
|
for (let t of e) {
|
|
37280
37288
|
let e = t.codePointAt(0);
|
|
37281
|
-
if (
|
|
37289
|
+
if (ks(e)) return Os(js(e));
|
|
37282
37290
|
}
|
|
37283
37291
|
return !1;
|
|
37284
37292
|
}
|
|
37285
|
-
function
|
|
37293
|
+
function Ps(e) {
|
|
37286
37294
|
let t = !1;
|
|
37287
37295
|
for (let n of e) {
|
|
37288
37296
|
let e = n.codePointAt(0);
|
|
37289
|
-
if (
|
|
37290
|
-
if (
|
|
37297
|
+
if (ks(e)) {
|
|
37298
|
+
if (Os(js(e))) return !1;
|
|
37291
37299
|
t = !0;
|
|
37292
37300
|
}
|
|
37293
37301
|
}
|
|
37294
37302
|
return t;
|
|
37295
37303
|
}
|
|
37296
|
-
var
|
|
37297
|
-
function
|
|
37298
|
-
let t =
|
|
37304
|
+
var Fs, Is = /* @__PURE__ */ new Map();
|
|
37305
|
+
function Ls(e) {
|
|
37306
|
+
let t = Is.get(e);
|
|
37299
37307
|
if (t !== void 0) return t;
|
|
37300
37308
|
let n = null;
|
|
37301
37309
|
try {
|
|
@@ -37303,36 +37311,36 @@ function Is(e) {
|
|
|
37303
37311
|
} catch {
|
|
37304
37312
|
n = null;
|
|
37305
37313
|
}
|
|
37306
|
-
return
|
|
37314
|
+
return Is.set(e, n), n;
|
|
37307
37315
|
}
|
|
37308
|
-
function
|
|
37309
|
-
if (
|
|
37310
|
-
if (typeof
|
|
37311
|
-
let t =
|
|
37316
|
+
function Rs(e) {
|
|
37317
|
+
if (Fs === null) return null;
|
|
37318
|
+
if (typeof Fs == "function") {
|
|
37319
|
+
let t = Fs;
|
|
37312
37320
|
return (n) => t(n, e);
|
|
37313
37321
|
}
|
|
37314
|
-
let t =
|
|
37322
|
+
let t = Ls(e);
|
|
37315
37323
|
return t ? (e) => t.segment(e) : null;
|
|
37316
37324
|
}
|
|
37317
|
-
function
|
|
37318
|
-
if (!
|
|
37325
|
+
function zs(e) {
|
|
37326
|
+
if (!Ms(e)) return [];
|
|
37319
37327
|
let t = [], n = e.length, r = 0;
|
|
37320
37328
|
for (; r < n;) {
|
|
37321
37329
|
let i = e.codePointAt(r), a = i > 65535 ? 2 : 1;
|
|
37322
|
-
if (!
|
|
37330
|
+
if (!ks(i)) {
|
|
37323
37331
|
r += a;
|
|
37324
37332
|
continue;
|
|
37325
37333
|
}
|
|
37326
|
-
let o =
|
|
37334
|
+
let o = js(i), s = Os(o), c = r + a;
|
|
37327
37335
|
for (; c < n;) {
|
|
37328
37336
|
let t = e.codePointAt(c);
|
|
37329
|
-
if (!
|
|
37337
|
+
if (!ks(t) || Os(js(t)) !== s) break;
|
|
37330
37338
|
c += t > 65535 ? 2 : 1;
|
|
37331
37339
|
}
|
|
37332
37340
|
let l = e.slice(r, c);
|
|
37333
|
-
if (s) for (let e of
|
|
37341
|
+
if (s) for (let e of qs(l)) t.push(r + e);
|
|
37334
37342
|
else {
|
|
37335
|
-
let e =
|
|
37343
|
+
let e = Rs(o);
|
|
37336
37344
|
if (e) {
|
|
37337
37345
|
let n = [];
|
|
37338
37346
|
try {
|
|
@@ -37345,42 +37353,42 @@ function Rs(e) {
|
|
|
37345
37353
|
}
|
|
37346
37354
|
return t;
|
|
37347
37355
|
}
|
|
37348
|
-
function
|
|
37349
|
-
if (!
|
|
37356
|
+
function Bs(e) {
|
|
37357
|
+
if (!Ms(e)) return [];
|
|
37350
37358
|
let t = [], n = e.length, r = e.codePointAt(0), i = r > 65535 ? 2 : 1;
|
|
37351
37359
|
for (; i < n;) {
|
|
37352
37360
|
let n = e.codePointAt(i), a = n > 65535 ? 2 : 1;
|
|
37353
|
-
|
|
37361
|
+
ks(r) !== ks(n) && !Vs(r) && !Vs(n) && t.push(i), r = n, i += a;
|
|
37354
37362
|
}
|
|
37355
37363
|
return t;
|
|
37356
37364
|
}
|
|
37357
|
-
function
|
|
37365
|
+
function Vs(e) {
|
|
37358
37366
|
return e === 32 || e === 9 || e === 10 || e === 13 || e === 12288 || e === 160 || e === 8199 || e === 8239 || e === 8288 || e === 65279;
|
|
37359
37367
|
}
|
|
37360
|
-
function
|
|
37361
|
-
if (!
|
|
37362
|
-
let n = e.length, r = new Set(
|
|
37368
|
+
function Hs(e, t) {
|
|
37369
|
+
if (!Ms(e)) return [];
|
|
37370
|
+
let n = e.length, r = new Set(zs(e)), i = new Set(qs(e)), a = (e) => {
|
|
37363
37371
|
i.has(e) && r.add(e);
|
|
37364
37372
|
};
|
|
37365
|
-
for (let t of
|
|
37373
|
+
for (let t of Bs(e)) a(t);
|
|
37366
37374
|
if (t?.cjk) {
|
|
37367
37375
|
let t = e.codePointAt(0), r = t > 65535 ? 2 : 1;
|
|
37368
37376
|
for (; r < n;) {
|
|
37369
37377
|
let n = e.codePointAt(r);
|
|
37370
|
-
(
|
|
37378
|
+
(vs(n) || vs(t)) && a(r), t = n, r += n > 65535 ? 2 : 1;
|
|
37371
37379
|
}
|
|
37372
37380
|
}
|
|
37373
37381
|
let o = t?.kinsoku, s = o != null && o.enabled !== !1, c = [];
|
|
37374
37382
|
for (let t of r) if (!(t <= 0 || t >= n)) {
|
|
37375
37383
|
if (s) {
|
|
37376
|
-
let n = e.codePointAt(t), r =
|
|
37384
|
+
let n = e.codePointAt(t), r = Us(e, t);
|
|
37377
37385
|
if (r !== void 0 && o.lineEndForbidden.has(r) || o.lineStartForbidden.has(n)) continue;
|
|
37378
37386
|
}
|
|
37379
37387
|
c.push(t);
|
|
37380
37388
|
}
|
|
37381
37389
|
return c.sort((e, t) => e - t), c;
|
|
37382
37390
|
}
|
|
37383
|
-
function
|
|
37391
|
+
function Us(e, t) {
|
|
37384
37392
|
if (t <= 0) return;
|
|
37385
37393
|
let n = e.charCodeAt(t - 1);
|
|
37386
37394
|
if (n >= 56320 && n <= 57343 && t >= 2) {
|
|
@@ -37389,7 +37397,7 @@ function Hs(e, t) {
|
|
|
37389
37397
|
}
|
|
37390
37398
|
return n;
|
|
37391
37399
|
}
|
|
37392
|
-
function
|
|
37400
|
+
function Ws(e, t, n, r, i, a = !1) {
|
|
37393
37401
|
let o = e.length;
|
|
37394
37402
|
if (n >= o) return n;
|
|
37395
37403
|
if (a) {
|
|
@@ -37405,19 +37413,19 @@ function Us(e, t, n, r, i, a = !1) {
|
|
|
37405
37413
|
for (let a of t) a <= n || a >= o || i(e.slice(n, a)) <= r && (s = a);
|
|
37406
37414
|
return i(e.slice(n, o)) <= r && (s = o), s;
|
|
37407
37415
|
}
|
|
37408
|
-
var
|
|
37409
|
-
function
|
|
37410
|
-
if (
|
|
37416
|
+
var Gs;
|
|
37417
|
+
function Ks() {
|
|
37418
|
+
if (Gs !== void 0) return Gs;
|
|
37411
37419
|
let e = null;
|
|
37412
37420
|
try {
|
|
37413
37421
|
typeof Intl < "u" && typeof Intl.Segmenter == "function" && (e = new Intl.Segmenter(void 0, { granularity: "grapheme" }));
|
|
37414
37422
|
} catch {
|
|
37415
37423
|
e = null;
|
|
37416
37424
|
}
|
|
37417
|
-
return
|
|
37425
|
+
return Gs = e, e;
|
|
37418
37426
|
}
|
|
37419
|
-
function
|
|
37420
|
-
let t =
|
|
37427
|
+
function qs(e) {
|
|
37428
|
+
let t = Ks();
|
|
37421
37429
|
if (t) try {
|
|
37422
37430
|
let n = [];
|
|
37423
37431
|
for (let r of t.segment(e)) r.index > 0 && n.push(r.index);
|
|
@@ -37432,12 +37440,12 @@ function Ks(e) {
|
|
|
37432
37440
|
}
|
|
37433
37441
|
//#endregion
|
|
37434
37442
|
//#region packages/core/src/text/vertical-orientation.generated.ts
|
|
37435
|
-
var
|
|
37443
|
+
var Js = [
|
|
37436
37444
|
"U",
|
|
37437
37445
|
"R",
|
|
37438
37446
|
"Tu",
|
|
37439
37447
|
"Tr"
|
|
37440
|
-
],
|
|
37448
|
+
], Ys = [
|
|
37441
37449
|
0,
|
|
37442
37450
|
167,
|
|
37443
37451
|
168,
|
|
@@ -37718,7 +37726,7 @@ var qs = [
|
|
|
37718
37726
|
1048574,
|
|
37719
37727
|
1048576,
|
|
37720
37728
|
1114110
|
|
37721
|
-
],
|
|
37729
|
+
], Xs = [
|
|
37722
37730
|
1,
|
|
37723
37731
|
0,
|
|
37724
37732
|
1,
|
|
@@ -38002,29 +38010,29 @@ var qs = [
|
|
|
38002
38010
|
];
|
|
38003
38011
|
//#endregion
|
|
38004
38012
|
//#region packages/core/src/text/vertical-orientation.ts
|
|
38005
|
-
function
|
|
38006
|
-
let t = 0, n =
|
|
38013
|
+
function Zs(e) {
|
|
38014
|
+
let t = 0, n = Ys.length - 1;
|
|
38007
38015
|
for (; t < n;) {
|
|
38008
38016
|
let r = t + n + 1 >> 1;
|
|
38009
|
-
|
|
38017
|
+
Ys[r] <= e ? t = r : n = r - 1;
|
|
38010
38018
|
}
|
|
38011
|
-
return
|
|
38012
|
-
}
|
|
38013
|
-
function Zs(e) {
|
|
38014
|
-
return qs[Xs(e)];
|
|
38019
|
+
return Xs[t];
|
|
38015
38020
|
}
|
|
38016
38021
|
function Qs(e) {
|
|
38017
|
-
return
|
|
38022
|
+
return Js[Zs(e)];
|
|
38023
|
+
}
|
|
38024
|
+
function $s(e) {
|
|
38025
|
+
return ec.get(e) ?? null;
|
|
38018
38026
|
}
|
|
38019
|
-
var
|
|
38027
|
+
var ec = new Map([
|
|
38020
38028
|
[65292, 65040],
|
|
38021
38029
|
[12289, 65041],
|
|
38022
38030
|
[12290, 65042]
|
|
38023
38031
|
]);
|
|
38024
|
-
function
|
|
38025
|
-
return
|
|
38032
|
+
function tc(e) {
|
|
38033
|
+
return nc.get(e) ?? null;
|
|
38026
38034
|
}
|
|
38027
|
-
var
|
|
38035
|
+
var nc = new Map([
|
|
38028
38036
|
[65288, 65077],
|
|
38029
38037
|
[65289, 65078],
|
|
38030
38038
|
[65371, 65079],
|
|
@@ -38043,43 +38051,43 @@ var tc = new Map([
|
|
|
38043
38051
|
[12303, 65092],
|
|
38044
38052
|
[12310, 65047],
|
|
38045
38053
|
[12311, 65048]
|
|
38046
|
-
]),
|
|
38047
|
-
function
|
|
38048
|
-
return
|
|
38054
|
+
]), rc = new Set([65307]);
|
|
38055
|
+
function ic(e) {
|
|
38056
|
+
return rc.has(e);
|
|
38049
38057
|
}
|
|
38050
|
-
var
|
|
38058
|
+
var ac = new Set([
|
|
38051
38059
|
12540,
|
|
38052
38060
|
12316,
|
|
38053
38061
|
65374
|
|
38054
38062
|
]);
|
|
38055
|
-
function
|
|
38056
|
-
return
|
|
38063
|
+
function oc(e) {
|
|
38064
|
+
return ac.has(e);
|
|
38057
38065
|
}
|
|
38058
38066
|
//#endregion
|
|
38059
38067
|
//#region packages/core/src/text/vertical-vert-feature.ts
|
|
38060
|
-
var
|
|
38061
|
-
function
|
|
38068
|
+
var sc = 256, cc = 200, lc = /* @__PURE__ */ new WeakMap();
|
|
38069
|
+
function uc(e) {
|
|
38062
38070
|
return typeof HTMLCanvasElement > "u" ? null : e.canvas instanceof HTMLCanvasElement ? e.canvas : null;
|
|
38063
38071
|
}
|
|
38064
|
-
function
|
|
38072
|
+
function dc(e, t) {
|
|
38065
38073
|
return e.replace(/(^|\s)\d*\.?\d+(?:px|pt|pc|in|cm|mm|q|em|rem|%)(?:\/[^\s]+)?(?=\s)/i, `$1${t}`);
|
|
38066
38074
|
}
|
|
38067
|
-
function
|
|
38075
|
+
function fc(e, t = !0) {
|
|
38068
38076
|
let n = e.trim();
|
|
38069
38077
|
return [...n === "" || n.toLowerCase() === "normal" ? [] : n.split(",").map((e) => e.trim()).filter((e) => !/^(["'])vert\1(?:\s+(?:on|off|\d+))?$/i.test(e)), `"vert" ${+!!t}`].join(", ");
|
|
38070
38078
|
}
|
|
38071
|
-
function
|
|
38079
|
+
function pc(e) {
|
|
38072
38080
|
try {
|
|
38073
38081
|
let t = e.ownerDocument?.defaultView, n = t?.getComputedStyle ? t.getComputedStyle(e) : typeof getComputedStyle == "function" ? getComputedStyle(e) : null;
|
|
38074
38082
|
if (n?.fontFeatureSettings) return n.fontFeatureSettings;
|
|
38075
38083
|
} catch {}
|
|
38076
38084
|
return e.style.fontFeatureSettings;
|
|
38077
38085
|
}
|
|
38078
|
-
function
|
|
38079
|
-
let t =
|
|
38086
|
+
function mc(e) {
|
|
38087
|
+
let t = lc.get(e);
|
|
38080
38088
|
if (t) return t;
|
|
38081
38089
|
let n = e.createElement("canvas");
|
|
38082
|
-
n.width =
|
|
38090
|
+
n.width = sc, n.height = sc, n.setAttribute("aria-hidden", "true"), Object.assign(n.style, {
|
|
38083
38091
|
position: "fixed",
|
|
38084
38092
|
left: "-99999px",
|
|
38085
38093
|
top: "0",
|
|
@@ -38093,9 +38101,9 @@ function pc(e) {
|
|
|
38093
38101
|
}, i = () => {
|
|
38094
38102
|
r.epoch += 1, r.cache.clear();
|
|
38095
38103
|
};
|
|
38096
|
-
return e.fonts?.addEventListener?.("loadingdone", i), e.fonts?.addEventListener?.("loadingerror", i),
|
|
38104
|
+
return e.fonts?.addEventListener?.("loadingdone", i), e.fonts?.addEventListener?.("loadingerror", i), lc.set(e, r), r;
|
|
38097
38105
|
}
|
|
38098
|
-
function
|
|
38106
|
+
function hc(e, t) {
|
|
38099
38107
|
let { width: n, height: r } = e.canvas, i = e.getImageData(0, 0, n, r).data, a = new Uint8ClampedArray(n * r), o = n, s = r, c = -1, l = -1, u = 0, d = 0, f = 0;
|
|
38100
38108
|
for (let e = 0; e < r; e += 1) for (let t = 0; t < n; t += 1) {
|
|
38101
38109
|
let r = i[(e * n + t) * 4 + 3];
|
|
@@ -38122,28 +38130,28 @@ function mc(e, t) {
|
|
|
38122
38130
|
]
|
|
38123
38131
|
};
|
|
38124
38132
|
}
|
|
38125
|
-
function
|
|
38133
|
+
function gc(e, t, n) {
|
|
38126
38134
|
let r = e.canvas;
|
|
38127
38135
|
r.style.fontFeatureSettings = n, e.font = e.font, e.clearRect(0, 0, r.width, r.height);
|
|
38128
38136
|
let i = String.fromCodePoint(t);
|
|
38129
|
-
return e.fillText(i, r.width / 2, r.height / 2),
|
|
38137
|
+
return e.fillText(i, r.width / 2, r.height / 2), hc(e, i);
|
|
38130
38138
|
}
|
|
38131
|
-
function
|
|
38139
|
+
function _c(e, t) {
|
|
38132
38140
|
let n = 0, r = Math.min(e.length, t.length);
|
|
38133
38141
|
for (let i = 0; i < r; i += 1) n += Math.abs(e[i] - t[i]);
|
|
38134
38142
|
return n;
|
|
38135
38143
|
}
|
|
38136
|
-
function
|
|
38144
|
+
function vc(e, t, n, r) {
|
|
38137
38145
|
let i = (e, t, n, r) => {
|
|
38138
|
-
let i = Math.max(
|
|
38139
|
-
return Math.min(
|
|
38146
|
+
let i = Math.max(_c(e, t), _c(n, r));
|
|
38147
|
+
return Math.min(_c(e, n), _c(e, r), _c(t, n), _c(t, r)) > i;
|
|
38140
38148
|
};
|
|
38141
38149
|
return i(e.alpha, t.alpha, n.alpha, r.alpha) || i(e.geometry, t.geometry, n.geometry, r.geometry) || i(e.metrics, t.metrics, n.metrics, r.metrics);
|
|
38142
38150
|
}
|
|
38143
|
-
function
|
|
38144
|
-
let n =
|
|
38151
|
+
function yc(e, t) {
|
|
38152
|
+
let n = uc(e);
|
|
38145
38153
|
if (n === null || typeof document > "u") return !1;
|
|
38146
|
-
let r = n.ownerDocument ?? document, i =
|
|
38154
|
+
let r = n.ownerDocument ?? document, i = mc(r), a = pc(n), o = `${i.epoch}:${dc(e.font, "<size>")}:${a}:${t}`, s = i.cache.get(o);
|
|
38147
38155
|
if (s !== void 0) return s;
|
|
38148
38156
|
let c = !1, l = r.body ?? r.documentElement;
|
|
38149
38157
|
if (!l) return !1;
|
|
@@ -38153,9 +38161,9 @@ function vc(e, t) {
|
|
|
38153
38161
|
if (d !== null) {
|
|
38154
38162
|
let n = i.canvas.style.fontFeatureSettings;
|
|
38155
38163
|
try {
|
|
38156
|
-
d.font =
|
|
38157
|
-
let n =
|
|
38158
|
-
c = i !== null && o !== null && s !== null && l !== null &&
|
|
38164
|
+
d.font = dc(e.font, `${cc}px`), d.fillStyle = "#000", d.textAlign = "center", d.textBaseline = "middle";
|
|
38165
|
+
let n = fc(a, !1), r = fc(a, !0), i = gc(d, t, n), o = gc(d, t, n), s = gc(d, t, r), l = gc(d, t, r);
|
|
38166
|
+
c = i !== null && o !== null && s !== null && l !== null && vc(i, o, s, l);
|
|
38159
38167
|
} catch {
|
|
38160
38168
|
c = !1;
|
|
38161
38169
|
} finally {
|
|
@@ -38164,19 +38172,19 @@ function vc(e, t) {
|
|
|
38164
38172
|
}
|
|
38165
38173
|
return i.cache.set(o, c), c;
|
|
38166
38174
|
}
|
|
38167
|
-
function
|
|
38175
|
+
function bc(e, t) {
|
|
38168
38176
|
let n = e.canvas, r = n?.style;
|
|
38169
38177
|
if (!r) return t();
|
|
38170
38178
|
let i = r.fontFeatureSettings;
|
|
38171
|
-
r.fontFeatureSettings =
|
|
38179
|
+
r.fontFeatureSettings = fc(pc(n)), e.font = e.font;
|
|
38172
38180
|
try {
|
|
38173
38181
|
return t();
|
|
38174
38182
|
} finally {
|
|
38175
38183
|
r.fontFeatureSettings = i, e.font = e.font;
|
|
38176
38184
|
}
|
|
38177
38185
|
}
|
|
38178
|
-
function
|
|
38179
|
-
return
|
|
38186
|
+
function xc(e, t) {
|
|
38187
|
+
return bc(e, () => {
|
|
38180
38188
|
let n = e.textAlign, r = e.textBaseline;
|
|
38181
38189
|
e.textAlign = "center", e.textBaseline = "middle";
|
|
38182
38190
|
try {
|
|
@@ -38195,17 +38203,17 @@ function bc(e, t) {
|
|
|
38195
38203
|
}
|
|
38196
38204
|
//#endregion
|
|
38197
38205
|
//#region packages/core/src/interaction/zoom.ts
|
|
38198
|
-
var
|
|
38199
|
-
function
|
|
38200
|
-
return e * Math.exp(-t *
|
|
38206
|
+
var Sc = .01;
|
|
38207
|
+
function Cc(e, t) {
|
|
38208
|
+
return e * Math.exp(-t * Sc);
|
|
38201
38209
|
}
|
|
38202
|
-
function
|
|
38210
|
+
function wc(e, t, n, r, i) {
|
|
38203
38211
|
let a = n > 0 ? r / n : 1, o = (e + t) * a - t, s = i.maxScroll > 0 ? i.maxScroll : 0;
|
|
38204
38212
|
return o < 0 ? 0 : o > s ? s : o;
|
|
38205
38213
|
}
|
|
38206
38214
|
//#endregion
|
|
38207
38215
|
//#region packages/core/src/interaction/zoomable.ts
|
|
38208
|
-
var
|
|
38216
|
+
var Tc = Object.freeze([
|
|
38209
38217
|
.25,
|
|
38210
38218
|
.33,
|
|
38211
38219
|
.5,
|
|
@@ -38221,22 +38229,22 @@ var wc = Object.freeze([
|
|
|
38221
38229
|
2.5,
|
|
38222
38230
|
3,
|
|
38223
38231
|
4
|
|
38224
|
-
]),
|
|
38225
|
-
function Ec(e) {
|
|
38226
|
-
for (let t of wc) if (t > e + Tc) return t;
|
|
38227
|
-
return wc[wc.length - 1];
|
|
38228
|
-
}
|
|
38232
|
+
]), Ec = .005;
|
|
38229
38233
|
function Dc(e) {
|
|
38230
|
-
for (let t
|
|
38231
|
-
|
|
38232
|
-
|
|
38234
|
+
for (let t of Tc) if (t > e + Ec) return t;
|
|
38235
|
+
return Tc[Tc.length - 1];
|
|
38236
|
+
}
|
|
38237
|
+
function Oc(e) {
|
|
38238
|
+
for (let t = Tc.length - 1; t >= 0; t--) {
|
|
38239
|
+
let n = Tc[t];
|
|
38240
|
+
if (n < e - Ec) return n;
|
|
38233
38241
|
}
|
|
38234
|
-
return
|
|
38242
|
+
return Tc[0];
|
|
38235
38243
|
}
|
|
38236
|
-
function
|
|
38244
|
+
function kc(e, t, n) {
|
|
38237
38245
|
return e < t ? t : e > n ? n : e;
|
|
38238
38246
|
}
|
|
38239
|
-
function
|
|
38247
|
+
function Ac(e, t) {
|
|
38240
38248
|
let { contentWidth: n, contentHeight: r, containerWidth: i, containerHeight: a } = e;
|
|
38241
38249
|
if (n <= 0 || i <= 0) return 0;
|
|
38242
38250
|
let o = i / n;
|
|
@@ -38247,13 +38255,13 @@ function kc(e, t) {
|
|
|
38247
38255
|
}
|
|
38248
38256
|
//#endregion
|
|
38249
38257
|
//#region packages/core/src/interaction/hyperlink.ts
|
|
38250
|
-
var
|
|
38258
|
+
var jc = [
|
|
38251
38259
|
"http",
|
|
38252
38260
|
"https",
|
|
38253
38261
|
"mailto",
|
|
38254
38262
|
"tel"
|
|
38255
38263
|
];
|
|
38256
|
-
function
|
|
38264
|
+
function Mc(e) {
|
|
38257
38265
|
let t = "";
|
|
38258
38266
|
for (let n of e) {
|
|
38259
38267
|
let e = n.codePointAt(0);
|
|
@@ -38262,18 +38270,18 @@ function jc(e) {
|
|
|
38262
38270
|
let n = /^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(t);
|
|
38263
38271
|
return n ? n[1].toLowerCase() : null;
|
|
38264
38272
|
}
|
|
38265
|
-
function
|
|
38273
|
+
function Nc(e, t = jc) {
|
|
38266
38274
|
if (e === "") return null;
|
|
38267
|
-
let n =
|
|
38275
|
+
let n = Mc(e);
|
|
38268
38276
|
return n === null || t.includes(n) ? e : null;
|
|
38269
38277
|
}
|
|
38270
|
-
function
|
|
38271
|
-
let r =
|
|
38278
|
+
function Pc(e, t = jc, n = typeof window < "u" ? window : void 0) {
|
|
38279
|
+
let r = Nc(e, t);
|
|
38272
38280
|
return r === null || !n ? !1 : (n.open(r, "_blank", "noopener,noreferrer"), !0);
|
|
38273
38281
|
}
|
|
38274
38282
|
//#endregion
|
|
38275
38283
|
//#region packages/core/src/text/line-metrics.ts
|
|
38276
|
-
var
|
|
38284
|
+
var Fc = [
|
|
38277
38285
|
[(e) => e.includes("meiryo") || e.includes("メイリオ"), {
|
|
38278
38286
|
asc: 2210 / 2048,
|
|
38279
38287
|
desc: 1059 / 2048
|
|
@@ -38296,22 +38304,22 @@ var Pc = [
|
|
|
38296
38304
|
desc: 501 / 2048
|
|
38297
38305
|
}]
|
|
38298
38306
|
];
|
|
38299
|
-
function
|
|
38307
|
+
function Ic(e, t) {
|
|
38300
38308
|
if (!e) return null;
|
|
38301
38309
|
let n = e.toLowerCase();
|
|
38302
|
-
for (let [e, r] of
|
|
38310
|
+
for (let [e, r] of Fc) if (e(n) && (t || !r.eaOnly)) return r;
|
|
38303
38311
|
return null;
|
|
38304
38312
|
}
|
|
38305
|
-
function
|
|
38306
|
-
let n =
|
|
38313
|
+
function Lc(e, t = !1) {
|
|
38314
|
+
let n = Ic(e, t);
|
|
38307
38315
|
return n === null ? null : n.asc + n.desc;
|
|
38308
38316
|
}
|
|
38309
|
-
function
|
|
38310
|
-
let r =
|
|
38317
|
+
function Rc(e, t, n = !1) {
|
|
38318
|
+
let r = Lc(e, n);
|
|
38311
38319
|
return r === null ? 0 : r * t;
|
|
38312
38320
|
}
|
|
38313
|
-
function
|
|
38314
|
-
let a =
|
|
38321
|
+
function zc(e, t, n, r, i = !1) {
|
|
38322
|
+
let a = Ic(e, i);
|
|
38315
38323
|
if (a === null) return {
|
|
38316
38324
|
ascent: n,
|
|
38317
38325
|
descent: r
|
|
@@ -38327,7 +38335,7 @@ function Rc(e, t, n, r, i = !1) {
|
|
|
38327
38335
|
}
|
|
38328
38336
|
//#endregion
|
|
38329
38337
|
//#region packages/core/src/search/text-index.ts
|
|
38330
|
-
function
|
|
38338
|
+
function Bc(e) {
|
|
38331
38339
|
let t = e.toLowerCase();
|
|
38332
38340
|
if (t.length === e.length) return t;
|
|
38333
38341
|
let n = "";
|
|
@@ -38337,17 +38345,17 @@ function zc(e) {
|
|
|
38337
38345
|
}
|
|
38338
38346
|
return n;
|
|
38339
38347
|
}
|
|
38340
|
-
function
|
|
38348
|
+
function Vc(e) {
|
|
38341
38349
|
let t = Array(e.length), n = 0, r = "";
|
|
38342
38350
|
for (let i = 0; i < e.length; i++) t[i] = n, r += e[i].text, n += e[i].text.length;
|
|
38343
38351
|
return {
|
|
38344
38352
|
text: r,
|
|
38345
|
-
folded:
|
|
38353
|
+
folded: Bc(r),
|
|
38346
38354
|
runStart: t,
|
|
38347
38355
|
runCount: e.length
|
|
38348
38356
|
};
|
|
38349
38357
|
}
|
|
38350
|
-
function
|
|
38358
|
+
function Hc(e, t) {
|
|
38351
38359
|
let { runStart: n } = e, r = 0, i = n.length - 1;
|
|
38352
38360
|
for (; r < i;) {
|
|
38353
38361
|
let e = r + i + 1 >> 1;
|
|
@@ -38355,8 +38363,8 @@ function Vc(e, t) {
|
|
|
38355
38363
|
}
|
|
38356
38364
|
return r;
|
|
38357
38365
|
}
|
|
38358
|
-
function
|
|
38359
|
-
let { runStart: r, runCount: i, text: a } = e, o = [], s =
|
|
38366
|
+
function Uc(e, t, n) {
|
|
38367
|
+
let { runStart: r, runCount: i, text: a } = e, o = [], s = Hc(e, t), c = t;
|
|
38360
38368
|
for (; c < n && s < i;) {
|
|
38361
38369
|
let e = s + 1 < i ? r[s + 1] : a.length, t = Math.min(n, e), l = c - r[s], u = t - r[s];
|
|
38362
38370
|
u > l && o.push({
|
|
@@ -38367,26 +38375,26 @@ function Hc(e, t, n) {
|
|
|
38367
38375
|
}
|
|
38368
38376
|
return o;
|
|
38369
38377
|
}
|
|
38370
|
-
function
|
|
38378
|
+
function Wc(e, t, n = {}) {
|
|
38371
38379
|
if (t.length === 0) return [];
|
|
38372
|
-
let r = n.caseSensitive ?? !1, i = r ? e.text : e.folded, a = r ? t :
|
|
38380
|
+
let r = n.caseSensitive ?? !1, i = r ? e.text : e.folded, a = r ? t : Bc(t), o = [], s = 0, c = 0;
|
|
38373
38381
|
for (;;) {
|
|
38374
38382
|
let t = i.indexOf(a, s);
|
|
38375
38383
|
if (t === -1) break;
|
|
38376
38384
|
o.push({
|
|
38377
38385
|
matchIndex: c,
|
|
38378
|
-
slices:
|
|
38386
|
+
slices: Uc(e, t, t + a.length)
|
|
38379
38387
|
}), c++, s = t + a.length;
|
|
38380
38388
|
}
|
|
38381
38389
|
return o;
|
|
38382
38390
|
}
|
|
38383
38391
|
//#endregion
|
|
38384
38392
|
//#region packages/core/src/search/find-cursor.ts
|
|
38385
|
-
function
|
|
38393
|
+
function Gc(e, t) {
|
|
38386
38394
|
return t <= 0 ? -1 : e < 0 ? 0 : (e + 1) % t;
|
|
38387
38395
|
}
|
|
38388
|
-
function
|
|
38396
|
+
function Kc(e, t) {
|
|
38389
38397
|
return t <= 0 ? -1 : e < 0 ? t - 1 : (e - 1 + t) % t;
|
|
38390
38398
|
}
|
|
38391
38399
|
//#endregion
|
|
38392
|
-
export {
|
|
38400
|
+
export { Ka as $, ks as A, pt as At, ls as B, Pe as Bt, ic as C, Yt as Ct, Ps as D, St as Dt, qs as E, wt as Et, _s as F, Re as Ft, To as G, Ce as Gt, jo as H, Ae as Ht, gs as I, Fe as It, $a as J, be as Jt, wo as K, Se as Kt, hs as L, Ie as Lt, Ds as M, ze as Mt, vs as N, Be as Nt, Ns as O, Ct as Ot, ys as P, He as Pt, Ga as Q, ms as R, Le as Rt, oc as S, Ht as St, Ws as T, It as Tt, ko as U, je as Ut, ss as V, Oe as Vt, Eo as W, Te as Wt, Ja as X, t as Xt, Qa as Y, n as Yt, Ya as Z, yc as _, yr as _t, zc as a, Va as at, $s as b, Xt as bt, Mc as c, Gr as ct, Ac as d, Rr as dt, Wa as et, Dc as f, Mr as ft, xc as g, br as gt, Cc as h, Tr as ht, Wc as i, Ua as it, Hs as j, mt as jt, As as k, ft as kt, Pc as l, Wr as lt, wc as m, wr as mt, Kc as n, za as nt, Rc as o, Ha as ot, Oc as p, Lr as pt, Co as q, ye as qt, Vc as r, Ba as rt, jc as s, Qi as st, Gc as t, qa as tt, kc as u, Nr as ut, bc as v, nn as vt, Ms as w, Wt as wt, Qs as x, $t as xt, tc as y, Qt as yt, us as z, Ue as zt };
|