reamkit 1.32.0 → 1.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -4
- package/dist/esm/core/bidi/algorithm.js +2 -2
- package/dist/esm/core/bidi/char-types.js +1 -1
- package/dist/esm/core/bidi/index.js +3 -3
- package/dist/esm/core/bytes.js +1 -1
- package/dist/esm/core/converter/facade.js +3 -2
- package/dist/esm/core/converter/ream.js +12 -5
- package/dist/esm/core/crypto/asn1.js +2 -2
- package/dist/esm/core/crypto/cms.js +5 -3
- package/dist/esm/core/crypto/index.js +2 -1
- package/dist/esm/core/crypto/offcrypto.js +64 -19
- package/dist/esm/core/crypto/primitives.js +16 -16
- package/dist/esm/core/document-model/index.d.ts +1 -1
- package/dist/esm/core/document-model/types.d.ts +174 -2
- package/dist/esm/core/drawingml/chart-geometry.d.ts +45 -17
- package/dist/esm/core/drawingml/chart-geometry.js +1090 -257
- package/dist/esm/core/drawingml/chart-parser.d.ts +24 -1
- package/dist/esm/core/drawingml/chart-parser.js +334 -41
- package/dist/esm/core/drawingml/chart-text.d.ts +41 -0
- package/dist/esm/core/drawingml/chart-text.js +93 -0
- package/dist/esm/core/drawingml/colors.js +5 -5
- package/dist/esm/core/drawingml/diagram/layout-engine.js +1 -4
- package/dist/esm/core/drawingml/diagram/run.js +2 -1
- package/dist/esm/core/drawingml/preset-geometry.js +4 -6
- package/dist/esm/core/drawingml/shape-render.js +1 -1
- package/dist/esm/core/drawingml/text-warp.js +4 -16
- package/dist/esm/core/drawingml/theme-parser.js +14 -8
- package/dist/esm/core/font/arabic-joining.js +2 -2
- package/dist/esm/core/font/binary-reader.js +2 -0
- package/dist/esm/core/font/font-registry.js +1 -0
- package/dist/esm/core/font/ligatures.js +1 -1
- package/dist/esm/core/font/opentype-layout.js +11 -5
- package/dist/esm/core/font/ttf-build.js +6 -10
- package/dist/esm/core/font/ttf-parser.js +2 -1
- package/dist/esm/core/font/ttf-subset.js +8 -8
- package/dist/esm/core/fonts/families.js +1 -1
- package/dist/esm/core/fonts/remote-fonts.js +4 -4
- package/dist/esm/core/hyphenation/index.js +1 -1
- package/dist/esm/core/images.js +8 -8
- package/dist/esm/core/ir/loss.js +1 -0
- package/dist/esm/core/line-breaker/cjk.js +1 -1
- package/dist/esm/core/line-breaker/index.js +4 -3
- package/dist/esm/core/links.js +1 -1
- package/dist/esm/core/lzw.js +1 -1
- package/dist/esm/core/metafile/blit.js +1 -1
- package/dist/esm/core/metafile/emf.js +5 -7
- package/dist/esm/core/metafile/picture.js +1 -1
- package/dist/esm/core/metafile/symbol-fonts.js +7 -7
- package/dist/esm/core/metafile/wmf.js +5 -7
- package/dist/esm/core/number-format.d.ts +40 -15
- package/dist/esm/core/number-format.js +284 -79
- package/dist/esm/core/numbering/index.js +3 -2
- package/dist/esm/core/ole/cfb.js +4 -4
- package/dist/esm/core/ole/escher-blip.js +1 -1
- package/dist/esm/core/opc/index.js +5 -4
- package/dist/esm/core/opc/package.js +3 -1
- package/dist/esm/core/opc/tag-scan.d.ts +15 -0
- package/dist/esm/core/opc/tag-scan.js +41 -0
- package/dist/esm/core/opc/xml-entities.js +40 -3
- package/dist/esm/core/outline.js +1 -1
- package/dist/esm/core/png-encode.js +3 -3
- package/dist/esm/core/po-helpers.js +1 -1
- package/dist/esm/core/spreadsheet-model/types.d.ts +6 -0
- package/dist/esm/core/style-cascade/index.js +4 -3
- package/dist/esm/core/tiff.js +3 -1
- package/dist/esm/excel/activex-parser.js +1 -1
- package/dist/esm/excel/conditional-format.js +7 -7
- package/dist/esm/excel/formula/functions.js +45 -18
- package/dist/esm/excel/formula/index.js +3 -3
- package/dist/esm/excel/formula/lexer.js +2 -2
- package/dist/esm/excel/formula/parser.js +4 -3
- package/dist/esm/excel/formula/value.js +1 -1
- package/dist/esm/excel/index.js +7 -6
- package/dist/esm/excel/print-model.js +18 -7
- package/dist/esm/excel/printer-settings.js +6 -7
- package/dist/esm/excel/rich-value.js +1 -1
- package/dist/esm/excel/sheet-shape-parser.js +4 -2
- package/dist/esm/excel/sheet-to-flow.js +13 -11
- package/dist/esm/excel/styles-parser.js +5 -3
- package/dist/esm/excel/tint.js +5 -5
- package/dist/esm/excel/vml-drawing.js +3 -3
- package/dist/esm/excel/worksheet-parser.js +5 -5
- package/dist/esm/excel/xls/biff-chart.js +1 -3
- package/dist/esm/excel/xls/biff-reader.js +10 -11
- package/dist/esm/excel/xls/xls-reader.js +1 -1
- package/dist/esm/excel/xlsx-reader.js +56 -9
- package/dist/esm/excel/xlsx-to-pdf.js +1 -1
- package/dist/esm/excel/xlsx-writer.js +2 -2
- package/dist/esm/html/html-writer.js +18 -10
- package/dist/esm/layout/line-paint.js +1 -1
- package/dist/esm/layout/math-layout.js +5 -8
- package/dist/esm/layout/styled-layout.js +104 -32
- package/dist/esm/layout/turned-section.js +2 -2
- package/dist/esm/markdown/markdown-writer.js +59 -8
- package/dist/esm/pdf/encryption.js +9 -9
- package/dist/esm/pdf/icc-profile.js +2 -2
- package/dist/esm/pdf/index.js +3 -2
- package/dist/esm/pdf/objects.js +7 -0
- package/dist/esm/pdf/serialize.js +1 -1
- package/dist/esm/pdf/struct-tree.js +3 -1
- package/dist/esm/pdf/styled-page-emitter.js +23 -15
- package/dist/esm/pdf/styled-page-renderer.js +9 -5
- package/dist/esm/pdf-reader/annot-draw.js +5 -5
- package/dist/esm/pdf-reader/annots.js +3 -1
- package/dist/esm/pdf-reader/ccitt.js +2 -1
- package/dist/esm/pdf-reader/cff-outline.js +1 -4
- package/dist/esm/pdf-reader/content.js +13 -15
- package/dist/esm/pdf-reader/decrypt.js +5 -4
- package/dist/esm/pdf-reader/document.js +6 -2
- package/dist/esm/pdf-reader/encodings.js +1 -1
- package/dist/esm/pdf-reader/flow-build.js +4 -6
- package/dist/esm/pdf-reader/font.js +4 -4
- package/dist/esm/pdf-reader/function.js +8 -7
- package/dist/esm/pdf-reader/icc.js +1 -1
- package/dist/esm/pdf-reader/images.js +1 -1
- package/dist/esm/pdf-reader/jbig2.js +36 -38
- package/dist/esm/pdf-reader/jpeg.js +14 -13
- package/dist/esm/pdf-reader/layout.js +13 -10
- package/dist/esm/pdf-reader/lexer.js +2 -1
- package/dist/esm/pdf-reader/math-rows.js +2 -2
- package/dist/esm/pdf-reader/optional-content.js +1 -1
- package/dist/esm/pdf-reader/page-numbers.js +1 -1
- package/dist/esm/pdf-reader/pattern-tint.js +1 -2
- package/dist/esm/pdf-reader/reader.js +2 -2
- package/dist/esm/pdf-reader/struct-tree.js +1 -1
- package/dist/esm/pdf-reader/tagged.js +3 -2
- package/dist/esm/pdf-reader/text.js +2 -2
- package/dist/esm/pdf-reader/type1-outline.js +1 -3
- package/dist/esm/pptx/embedded-fonts.js +3 -5
- package/dist/esm/pptx/placeholder-cascade.js +1 -1
- package/dist/esm/pptx/ppt/ppt-reader.js +5 -4
- package/dist/esm/pptx/ppt/ppt-text.js +9 -10
- package/dist/esm/pptx/pptx-reader.js +6 -5
- package/dist/esm/pptx/preset-table-styles.js +1 -1
- package/dist/esm/pptx/slide-parser.js +6 -4
- package/dist/esm/pptx/sp-helpers.js +1 -1
- package/dist/esm/pptx/table-style.js +2 -1
- package/dist/esm/svg/svg-writer.js +1 -1
- package/dist/esm/word/doc/doc-reader.js +2 -2
- package/dist/esm/word/doc/doc-text.js +20 -22
- package/dist/esm/word/document-parser.js +27 -22
- package/dist/esm/word/docx-reader.js +15 -10
- package/dist/esm/word/docx-to-pdf.js +6 -6
- package/dist/esm/word/docx-writer.js +10 -6
- package/dist/esm/word/drawing-parser.js +18 -18
- package/dist/esm/word/font-table.js +90 -11
- package/dist/esm/word/index.js +6 -5
- package/dist/esm/word/numbering-parser.js +5 -4
- package/dist/esm/word/omml-parser.js +1 -1
- package/dist/esm/word/paragraph-properties.js +11 -10
- package/dist/esm/word/run-properties.js +4 -4
- package/dist/esm/word/settings-parser.js +2 -1
- package/dist/esm/word/shading.js +1 -1
- package/dist/esm/word/styles-parser.js +5 -4
- package/dist/esm/word/table-parser.js +4 -4
- package/dist/esm/word/theme-fonts.js +1 -1
- package/package.json +10 -4
|
@@ -167,7 +167,7 @@ function drawnResources(file, annot) {
|
|
|
167
167
|
const subtype = file.get(annot, "Subtype");
|
|
168
168
|
if (subtype instanceof PdfName && subtype.value === "FreeText") {
|
|
169
169
|
const text = freeTextContents(file, annot);
|
|
170
|
-
return text === void 0 ? void 0 : new Map([["Font", new Map([[FREE_TEXT_FONT, spelledFace(text)]])]]);
|
|
170
|
+
return text === void 0 ? void 0 : /* @__PURE__ */ new Map([["Font", /* @__PURE__ */ new Map([[FREE_TEXT_FONT, spelledFace(text)]])]]);
|
|
171
171
|
}
|
|
172
172
|
if (!(subtype instanceof PdfName) || subtype.value !== "Widget") return void 0;
|
|
173
173
|
const acro = file.get(file.catalog, "AcroForm");
|
|
@@ -260,7 +260,7 @@ function freeTextContents(file, annot) {
|
|
|
260
260
|
const found = file.get(annot, "Contents");
|
|
261
261
|
const raw = found instanceof PdfHexString ? String.fromCharCode(...found.bytes) : typeof found === "string" ? found : void 0;
|
|
262
262
|
if (raw === void 0) return void 0;
|
|
263
|
-
const text = textString(raw).
|
|
263
|
+
const text = textString(raw).trimEnd();
|
|
264
264
|
return text.length > 0 ? text : void 0;
|
|
265
265
|
}
|
|
266
266
|
/**
|
|
@@ -296,11 +296,11 @@ function spelledFace(text) {
|
|
|
296
296
|
const cp = ch.codePointAt(0) ?? 32;
|
|
297
297
|
differences.push(new PdfName(`uni${cp.toString(16).toUpperCase().padStart(4, "0")}`));
|
|
298
298
|
}
|
|
299
|
-
return new Map([
|
|
299
|
+
return /* @__PURE__ */ new Map([
|
|
300
300
|
["Type", new PdfName("Font")],
|
|
301
301
|
["Subtype", new PdfName("Type1")],
|
|
302
302
|
["BaseFont", new PdfName("Helvetica")],
|
|
303
|
-
["Encoding", new Map([["Differences", differences]])]
|
|
303
|
+
["Encoding", /* @__PURE__ */ new Map([["Differences", differences]])]
|
|
304
304
|
]);
|
|
305
305
|
}
|
|
306
306
|
/** §12.7.4.3 — the field is a multi-line text box (bit 13 of `/Ff`). */
|
|
@@ -331,7 +331,7 @@ function defaultAppearance(file, annot) {
|
|
|
331
331
|
const form = acro instanceof Map ? file.get(acro, "DA") : void 0;
|
|
332
332
|
const da = own ?? (typeof form === "string" ? form : "");
|
|
333
333
|
const tf = /\/([^\s/]+)\s+([\d.]+)\s+Tf/u.exec(da);
|
|
334
|
-
const rgb = /([\d.]+)\s+([\d.]+)\s+([\d.]+)\s+rg/u.exec(da);
|
|
334
|
+
const rgb = /(?<![\d.])([\d.]+)\s+([\d.]+)\s+([\d.]+)\s+rg/u.exec(da);
|
|
335
335
|
const gray = /(^|\s)([\d.]+)\s+g(\s|$)/u.exec(da);
|
|
336
336
|
const color = rgb ? `${num(Number(rgb[1]))} ${num(Number(rgb[2]))} ${num(Number(rgb[3]))}` : gray ? `${num(Number(gray[2]))} ${num(Number(gray[2]))} ${num(Number(gray[2]))}` : "0 0 0";
|
|
337
337
|
return {
|
|
@@ -137,7 +137,9 @@ function typedField(file, annot) {
|
|
|
137
137
|
* field whose value is "Hello World".
|
|
138
138
|
*/
|
|
139
139
|
function withoutVariableText(file, stream) {
|
|
140
|
-
const
|
|
140
|
+
const text = new TextDecoder("latin1").decode(file.streamData(stream));
|
|
141
|
+
const end = text.lastIndexOf("EMC") + 3;
|
|
142
|
+
const stripped = text.slice(0, end).replace(/\/Tx\s+BMC[\s\S]*?EMC/gu, "") + text.slice(end);
|
|
141
143
|
const dict = new Map(stream.dict);
|
|
142
144
|
dict.delete("Filter");
|
|
143
145
|
dict.delete("DecodeParms");
|
|
@@ -164,6 +164,7 @@ function readCode(reader, table) {
|
|
|
164
164
|
return -1;
|
|
165
165
|
}
|
|
166
166
|
var BitReader = class {
|
|
167
|
+
data;
|
|
167
168
|
bytePos = 0;
|
|
168
169
|
bitPos = 0;
|
|
169
170
|
constructor(data) {
|
|
@@ -502,4 +503,4 @@ var WHITE = buildRunTable(WHITE_CODES, SHARED_MAKEUP);
|
|
|
502
503
|
var BLACK = buildRunTable(BLACK_CODES, SHARED_MAKEUP);
|
|
503
504
|
var MODES = new Map(MODE_CODES.map(([bits, m]) => [bits.length << 8 | parseInt(bits, 2), m]));
|
|
504
505
|
//#endregion
|
|
505
|
-
export { decodeCcitt, decodeCcittPlanes };
|
|
506
|
+
export { BLACK_CODES, MODE_CODES, SHARED_MAKEUP, WHITE_CODES, decodeCcitt, decodeCcittPlanes };
|
|
@@ -1022,9 +1022,7 @@ function runGlyph(font, gid, part = false) {
|
|
|
1022
1022
|
stack.length = 0;
|
|
1023
1023
|
break;
|
|
1024
1024
|
}
|
|
1025
|
-
default:
|
|
1026
|
-
stack.length = 0;
|
|
1027
|
-
break;
|
|
1025
|
+
default: stack.length = 0;
|
|
1028
1026
|
}
|
|
1029
1027
|
}
|
|
1030
1028
|
return true;
|
|
@@ -1118,7 +1116,6 @@ function runEscape(op, stack, trans) {
|
|
|
1118
1116
|
stack.push(b, a);
|
|
1119
1117
|
break;
|
|
1120
1118
|
}
|
|
1121
|
-
default: break;
|
|
1122
1119
|
}
|
|
1123
1120
|
}
|
|
1124
1121
|
/**
|
|
@@ -416,11 +416,17 @@ function interpretContent(bytes, fonts, initialCtm = IDENTITY, shadings = /* @__
|
|
|
416
416
|
});
|
|
417
417
|
};
|
|
418
418
|
const showString = (operand) => {
|
|
419
|
-
|
|
419
|
+
const origin = multiply(tm, state.ctm);
|
|
420
|
+
const text = consume(operand);
|
|
421
|
+
emitAt(origin, text, multiply(tm, state.ctm));
|
|
420
422
|
};
|
|
421
423
|
const showArray = (arr) => {
|
|
422
424
|
for (const el of arr) if (typeof el === "number") tm = multiply(translation(-el / 1e3 * state.fontSize * state.hScale, 0), tm);
|
|
423
|
-
else if (typeof el === "string" || el instanceof PdfHexString)
|
|
425
|
+
else if (typeof el === "string" || el instanceof PdfHexString) {
|
|
426
|
+
const origin = multiply(tm, state.ctm);
|
|
427
|
+
const text = consume(el);
|
|
428
|
+
emitAt(origin, text, multiply(tm, state.ctm));
|
|
429
|
+
}
|
|
424
430
|
};
|
|
425
431
|
const exec = (op) => {
|
|
426
432
|
switch (op) {
|
|
@@ -696,10 +702,7 @@ function interpretContent(bytes, fonts, initialCtm = IDENTITY, shadings = /* @__
|
|
|
696
702
|
break;
|
|
697
703
|
}
|
|
698
704
|
case "W":
|
|
699
|
-
case "W*":
|
|
700
|
-
pendingClip = true;
|
|
701
|
-
break;
|
|
702
|
-
default: break;
|
|
705
|
+
case "W*": pendingClip = true;
|
|
703
706
|
}
|
|
704
707
|
};
|
|
705
708
|
for (;;) {
|
|
@@ -741,9 +744,7 @@ function interpretContent(bytes, fonts, initialCtm = IDENTITY, shadings = /* @__
|
|
|
741
744
|
} else exec(tok.value);
|
|
742
745
|
operands = [];
|
|
743
746
|
break;
|
|
744
|
-
default:
|
|
745
|
-
operands = [];
|
|
746
|
-
break;
|
|
747
|
+
default: operands = [];
|
|
747
748
|
}
|
|
748
749
|
}
|
|
749
750
|
return {
|
|
@@ -863,7 +864,7 @@ function toBytes(operand) {
|
|
|
863
864
|
for (let i = 0; i < operand.length; i++) out[i] = operand.charCodeAt(i) & 255;
|
|
864
865
|
return out;
|
|
865
866
|
}
|
|
866
|
-
return new Uint8Array(0);
|
|
867
|
+
return /* @__PURE__ */ new Uint8Array(0);
|
|
867
868
|
}
|
|
868
869
|
function splitCodes(bytes, bytesPerCode) {
|
|
869
870
|
const out = [];
|
|
@@ -897,10 +898,7 @@ function readArray(lexer) {
|
|
|
897
898
|
case "dictOpen":
|
|
898
899
|
out.push(readDict(lexer));
|
|
899
900
|
break;
|
|
900
|
-
case "keyword":
|
|
901
|
-
if (tok.value === "true" || tok.value === "false") out.push(tok.value === "true");
|
|
902
|
-
break;
|
|
903
|
-
default: break;
|
|
901
|
+
case "keyword": if (tok.value === "true" || tok.value === "false") out.push(tok.value === "true");
|
|
904
902
|
}
|
|
905
903
|
}
|
|
906
904
|
return out;
|
|
@@ -1048,4 +1046,4 @@ function inlineLength(dict) {
|
|
|
1048
1046
|
return ((w * comps * bpc + 7) / 8 | 0) * h;
|
|
1049
1047
|
}
|
|
1050
1048
|
//#endregion
|
|
1051
|
-
export { IDENTITY, interpretContent, isRightToLeft, multiply };
|
|
1049
|
+
export { IDENTITY, interpretContent, isRightToLeft, multiply, statesACharacter };
|
|
@@ -41,8 +41,8 @@ var AES_SALT = Uint8Array.from([
|
|
|
41
41
|
108,
|
|
42
42
|
84
|
|
43
43
|
]);
|
|
44
|
-
var ZERO16 = new Uint8Array(16);
|
|
45
|
-
var EMPTY = new Uint8Array(0);
|
|
44
|
+
var ZERO16 = /* @__PURE__ */ new Uint8Array(16);
|
|
45
|
+
var EMPTY = /* @__PURE__ */ new Uint8Array(0);
|
|
46
46
|
/**
|
|
47
47
|
* Build a {@link Decryptor} from the `/Encrypt` dictionary and the file `/ID`
|
|
48
48
|
* (ISO 32000 §7.6.3 / ISO 32000-2 §7.6.4). Derives the file key for the
|
|
@@ -94,11 +94,12 @@ function deriveKeyR6(u, ue, password) {
|
|
|
94
94
|
const validationSalt = u.subarray(32, 40);
|
|
95
95
|
const keySalt = u.subarray(40, 48);
|
|
96
96
|
if (!equal(hash2B(pw, validationSalt, EMPTY), u.subarray(0, 32))) return void 0;
|
|
97
|
-
|
|
97
|
+
const intermediate = hash2B(pw, keySalt, EMPTY);
|
|
98
|
+
return aesCbcDecrypt(intermediate, ZERO16, ue.subarray(0, 32), false);
|
|
98
99
|
}
|
|
99
100
|
function padPassword(password) {
|
|
100
101
|
const raw = strToBytes(password);
|
|
101
|
-
const out = new Uint8Array(32);
|
|
102
|
+
const out = /* @__PURE__ */ new Uint8Array(32);
|
|
102
103
|
const n = Math.min(raw.length, 32);
|
|
103
104
|
out.set(raw.subarray(0, n), 0);
|
|
104
105
|
out.set(PAD.subarray(0, 32 - n), n);
|
|
@@ -24,6 +24,10 @@ var MAX_OBJSTM_N = 2e5;
|
|
|
24
24
|
* object scan recovers files whose xref is broken. Construct via {@link PdfFile.parse}.
|
|
25
25
|
*/
|
|
26
26
|
var PdfFile = class PdfFile {
|
|
27
|
+
buf;
|
|
28
|
+
xref;
|
|
29
|
+
trailer;
|
|
30
|
+
filters;
|
|
27
31
|
cache = /* @__PURE__ */ new Map();
|
|
28
32
|
objStmCache = /* @__PURE__ */ new Map();
|
|
29
33
|
decryptor;
|
|
@@ -265,7 +269,7 @@ var GENERAL_FILTERS = {
|
|
|
265
269
|
RunLengthDecode: runLengthDecode,
|
|
266
270
|
RL: runLengthDecode
|
|
267
271
|
};
|
|
268
|
-
var PASSTHROUGH_FILTERS = new Set([
|
|
272
|
+
var PASSTHROUGH_FILTERS = /* @__PURE__ */ new Set([
|
|
269
273
|
"DCTDecode",
|
|
270
274
|
"DCT",
|
|
271
275
|
"JPXDecode",
|
|
@@ -401,7 +405,7 @@ function inflateStream(stream, unknown, filters = {}) {
|
|
|
401
405
|
if (f.value === "FlateDecode" || f.value === "Fl") try {
|
|
402
406
|
data = unzlibSync(data);
|
|
403
407
|
} catch {
|
|
404
|
-
return new Uint8Array(0);
|
|
408
|
+
return /* @__PURE__ */ new Uint8Array(0);
|
|
405
409
|
}
|
|
406
410
|
else if (!PASSTHROUGH_FILTERS.has(f.value)) {
|
|
407
411
|
const decoded = runFilter(filters[f.value], data);
|
|
@@ -538,7 +538,7 @@ function floatOntoSheet(el, sheetWidth) {
|
|
|
538
538
|
}
|
|
539
539
|
};
|
|
540
540
|
};
|
|
541
|
-
const quarter = (rotation60k) => ((rotation60k ?? 0) +
|
|
541
|
+
const quarter = (rotation60k) => ((rotation60k ?? 0) + 54e5) % 216e5;
|
|
542
542
|
if (el.kind === "image" && el.image.float) {
|
|
543
543
|
const float = onto(el.image.float, el.image.width, el.image.height);
|
|
544
544
|
if (!float) return el;
|
|
@@ -605,8 +605,6 @@ var DEEPEST_MARGIN = .5;
|
|
|
605
605
|
* rest of it.
|
|
606
606
|
*/
|
|
607
607
|
var GUESSED_MARGIN = 1 / 3;
|
|
608
|
-
/** The narrowest measure a sheet's own lines may leave, as a share of the sheet. */
|
|
609
|
-
var NARROWEST_MEASURE = .2;
|
|
610
608
|
/**
|
|
611
609
|
* The lines a sheet's runs stand on — baselines further apart than half the
|
|
612
610
|
* size of the type on them — and how many of them END at the sheet's right
|
|
@@ -660,7 +658,7 @@ var ASCENDER = BASELINE_AT * NATURAL_LINE_EM;
|
|
|
660
658
|
* face's descender instead, bug1337429.pdf's last line did not fit the sheet
|
|
661
659
|
* it was drawn on and went to a second one.
|
|
662
660
|
*/
|
|
663
|
-
var DESCENDER =
|
|
661
|
+
var DESCENDER = .29999999999999993;
|
|
664
662
|
/**
|
|
665
663
|
* How small, against the document's own text, type may be set and still be
|
|
666
664
|
* read as text rather than as a mark the producer left on the sheet.
|
|
@@ -780,7 +778,7 @@ function withMeasuredMargins(section, shown, pageRuns, pageMarks = [], foot = []
|
|
|
780
778
|
const floor = inked.length > 0 ? footTop + textSize * FOOT_CLEAR_EM : Infinity;
|
|
781
779
|
const left = clamp(Math.min(...lefts), width);
|
|
782
780
|
const voters = rights.filter((r) => r.full);
|
|
783
|
-
const farthest = voters.length > 0 && voters.every((r) => r.edged) ? Math.max(width * GUESSED_MARGIN, width *
|
|
781
|
+
const farthest = voters.length > 0 && voters.every((r) => r.edged) ? Math.max(width * GUESSED_MARGIN, width * .8 - left) : width * GUESSED_MARGIN;
|
|
784
782
|
return {
|
|
785
783
|
...section,
|
|
786
784
|
margins: {
|
|
@@ -918,4 +916,4 @@ var RECONSTRUCTION_SHEET = {
|
|
|
918
916
|
defaultParagraphProperties: { widowControl: false }
|
|
919
917
|
};
|
|
920
918
|
//#endregion
|
|
921
|
-
export { ASCENDER, BASELINE_AT, CARRIER_LINE_PT, GUESSED_MARGIN, NATURAL_LINE_EM, buildFlowDoc, dedupeLosses, figureBlock, floatOntoSheet, imageBlock, imageMember, labelMember, membersBox, paragraphBlock, paragraphFromRuns, positionedText, sectionFromPdfPages, sectionOnSheet, shapeBlock, spaceAfter, textSizeOf, tooSmallToRead, vectorMember, withMeasuredMargins };
|
|
919
|
+
export { ASCENDER, BASELINE_AT, CARRIER_LINE_PT, FLOAT_CARRIER, GUESSED_MARGIN, NATURAL_LINE_EM, buildFlowDoc, dedupeLosses, figureBlock, floatOntoSheet, imageBlock, imageMember, labelMember, membersBox, paragraphBlock, paragraphFromRuns, positionedText, sectionFromPdfPages, sectionOnSheet, shapeBlock, spaceAfter, textSizeOf, tooSmallToRead, typesetRuns, typesetting, vectorMember, withMeasuredMargins };
|
|
@@ -149,7 +149,7 @@ function lettersOf(text) {
|
|
|
149
149
|
}
|
|
150
150
|
var LIGATURE = /[\uFB00-\uFB06]/u;
|
|
151
151
|
var LIGATURES = /[\uFB00-\uFB06]/gu;
|
|
152
|
-
var LATIN_LIGATURES = new Map([
|
|
152
|
+
var LATIN_LIGATURES = /* @__PURE__ */ new Map([
|
|
153
153
|
["ff", "ff"],
|
|
154
154
|
["fi", "fi"],
|
|
155
155
|
["fl", "fl"],
|
|
@@ -231,7 +231,7 @@ function coreGlyphOrder(file, fontDict) {
|
|
|
231
231
|
return out;
|
|
232
232
|
}
|
|
233
233
|
/** The core faces whose first glyphs stand in the standard Macintosh order. */
|
|
234
|
-
var CORE_FACES = new Set([
|
|
234
|
+
var CORE_FACES = /* @__PURE__ */ new Set([
|
|
235
235
|
"arial",
|
|
236
236
|
"timesnewroman",
|
|
237
237
|
"couriernew",
|
|
@@ -1047,7 +1047,7 @@ function familyOfFace(baseFont) {
|
|
|
1047
1047
|
const name = plainFace(baseFont);
|
|
1048
1048
|
const cut = /^(.+?)[-,]([^-,]+)$/u.exec(name);
|
|
1049
1049
|
const whole = cut && STYLE_WORDS.test(cut[2]) ? cut[1] : cut ? name.replace(/-/gu, " ") : GLUED_STYLE.exec(name)?.[1] ?? name;
|
|
1050
|
-
return (whole.replace(/(?:PSMT|PS|MT)$/u, "") || whole).replace(/([a-z])([A-Z])/gu, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/gu, "$1 $2").replace(/\bDeja Vu\b/u, "DejaVu").replace(/\s+/gu, " ").trim();
|
|
1050
|
+
return (whole.replace(/(?:PSMT|PS|MT)$/u, "") || whole).replace(/([a-z])([A-Z])/gu, "$1 $2").replace(/(?<![A-Z])([A-Z]+)([A-Z][a-z])/gu, "$1 $2").replace(/\bDeja Vu\b/u, "DejaVu").replace(/\s+/gu, " ").trim();
|
|
1051
1051
|
}
|
|
1052
1052
|
/**
|
|
1053
1053
|
* A face name with what producers write around it taken off: the subset tag
|
|
@@ -1230,4 +1230,4 @@ function asNumber(v, dflt) {
|
|
|
1230
1230
|
return typeof v === "number" ? v : dflt;
|
|
1231
1231
|
}
|
|
1232
1232
|
//#endregion
|
|
1233
|
-
export { buildContentFont, collectFaceFamilies };
|
|
1233
|
+
export { buildContentFont, collectFaceFamilies, familyOfFace };
|
|
@@ -161,12 +161,14 @@ function parseProgram(bytes) {
|
|
|
161
161
|
const tok = lexer.nextToken();
|
|
162
162
|
if (tok.kind === "eof") return depth === 0 ? out : void 0;
|
|
163
163
|
if (tok.kind === "num") out.push(tok.value);
|
|
164
|
-
else if (tok.kind === "keyword")
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
164
|
+
else if (tok.kind === "keyword") {
|
|
165
|
+
if (tok.value === "{") {
|
|
166
|
+
const inner = read(depth + 1);
|
|
167
|
+
if (!inner) return void 0;
|
|
168
|
+
out.push(inner);
|
|
169
|
+
} else if (tok.value === "}") return out;
|
|
170
|
+
else out.push(tok.value);
|
|
171
|
+
}
|
|
170
172
|
}
|
|
171
173
|
};
|
|
172
174
|
const top = read(0);
|
|
@@ -380,7 +382,6 @@ function run(program, stack, depth) {
|
|
|
380
382
|
}
|
|
381
383
|
break;
|
|
382
384
|
}
|
|
383
|
-
default: break;
|
|
384
385
|
}
|
|
385
386
|
}
|
|
386
387
|
}
|
|
@@ -71,7 +71,7 @@ function tagTable(data, view) {
|
|
|
71
71
|
if (count === 0 || count > MAX_TAGS) return void 0;
|
|
72
72
|
const out = /* @__PURE__ */ new Map();
|
|
73
73
|
for (let i = 0; i < count; i++) {
|
|
74
|
-
const at =
|
|
74
|
+
const at = 132 + i * 12;
|
|
75
75
|
if (at + 12 > data.length) break;
|
|
76
76
|
const offset = view.getUint32(at + 4);
|
|
77
77
|
const size = view.getUint32(at + 8);
|
|
@@ -235,7 +235,7 @@ function clippedUnitBox(ctm, clip) {
|
|
|
235
235
|
v1: Math.min(1, Math.max(0, v1))
|
|
236
236
|
};
|
|
237
237
|
if (!(cut.u1 - cut.u0 > CROPS) || !(cut.v1 - cut.v0 > CROPS)) return whole;
|
|
238
|
-
if (cut.u1 - cut.u0 >
|
|
238
|
+
if (cut.u1 - cut.u0 > .99 && cut.v1 - cut.v0 > .99) return whole;
|
|
239
239
|
return cut;
|
|
240
240
|
}
|
|
241
241
|
function matrixOf(file, dict) {
|
|
@@ -333,15 +333,16 @@ var MQDecoder = class {
|
|
|
333
333
|
}
|
|
334
334
|
/** BYTEIN (§E.3.4) — 0xFF is the marker escape, so it feeds a shorter byte. */
|
|
335
335
|
byteIn() {
|
|
336
|
-
if (this.byteAt(this.bp) === 255)
|
|
337
|
-
this.
|
|
338
|
-
|
|
336
|
+
if (this.byteAt(this.bp) === 255) {
|
|
337
|
+
if (this.byteAt(this.bp + 1) > 143) {
|
|
338
|
+
this.c = this.c + 65280 >>> 0;
|
|
339
|
+
this.ct = 8;
|
|
340
|
+
} else {
|
|
341
|
+
this.bp++;
|
|
342
|
+
this.c = this.c + (this.byteAt(this.bp) << 9) >>> 0;
|
|
343
|
+
this.ct = 7;
|
|
344
|
+
}
|
|
339
345
|
} else {
|
|
340
|
-
this.bp++;
|
|
341
|
-
this.c = this.c + (this.byteAt(this.bp) << 9) >>> 0;
|
|
342
|
-
this.ct = 7;
|
|
343
|
-
}
|
|
344
|
-
else {
|
|
345
346
|
this.bp++;
|
|
346
347
|
this.c = this.c + (this.byteAt(this.bp) << 8) >>> 0;
|
|
347
348
|
this.ct = 8;
|
|
@@ -359,17 +360,18 @@ var MQDecoder = class {
|
|
|
359
360
|
const [qe, nmps, nlps, sw] = QE[i] ?? QE[0];
|
|
360
361
|
let d;
|
|
361
362
|
this.a = this.a - qe & 65535;
|
|
362
|
-
if ((this.c >>> 16 & 65535) < qe)
|
|
363
|
-
this.a
|
|
364
|
-
|
|
365
|
-
|
|
363
|
+
if ((this.c >>> 16 & 65535) < qe) {
|
|
364
|
+
if (this.a < qe) {
|
|
365
|
+
this.a = qe;
|
|
366
|
+
d = mps;
|
|
367
|
+
i = nmps;
|
|
368
|
+
} else {
|
|
369
|
+
this.a = qe;
|
|
370
|
+
d = 1 - mps;
|
|
371
|
+
if (sw === 1) mps = 1 - mps;
|
|
372
|
+
i = nlps;
|
|
373
|
+
}
|
|
366
374
|
} else {
|
|
367
|
-
this.a = qe;
|
|
368
|
-
d = 1 - mps;
|
|
369
|
-
if (sw === 1) mps = 1 - mps;
|
|
370
|
-
i = nlps;
|
|
371
|
-
}
|
|
372
|
-
else {
|
|
373
375
|
this.c = this.c - (qe << 16) >>> 0;
|
|
374
376
|
if ((this.a & 32768) !== 0) return mps;
|
|
375
377
|
if (this.a < qe) {
|
|
@@ -474,9 +476,7 @@ function decodeGenericRegion(mq, cx, width, height, template, at, tpgdon, skip)
|
|
|
474
476
|
case 2:
|
|
475
477
|
ctx = px(x - 1, y) << 0 | px(x - 2, y) << 1 | px(x + (a[0]?.x ?? 2), y + (a[0]?.y ?? -1)) << 2 | px(x + 1, y - 1) << 3 | px(x, y - 1) << 4 | px(x - 1, y - 1) << 5 | px(x - 2, y - 1) << 6 | px(x + 1, y - 2) << 7 | px(x, y - 2) << 8 | px(x - 1, y - 2) << 9;
|
|
476
478
|
break;
|
|
477
|
-
default:
|
|
478
|
-
ctx = px(x - 1, y) << 0 | px(x - 2, y) << 1 | px(x - 3, y) << 2 | px(x - 4, y) << 3 | px(x + (a[0]?.x ?? 2), y + (a[0]?.y ?? -1)) << 4 | px(x + 1, y - 1) << 5 | px(x, y - 1) << 6 | px(x - 1, y - 1) << 7 | px(x - 2, y - 1) << 8 | px(x - 3, y - 1) << 9;
|
|
479
|
-
break;
|
|
479
|
+
default: ctx = px(x - 1, y) << 0 | px(x - 2, y) << 1 | px(x - 3, y) << 2 | px(x - 4, y) << 3 | px(x + (a[0]?.x ?? 2), y + (a[0]?.y ?? -1)) << 4 | px(x + 1, y - 1) << 5 | px(x, y - 1) << 6 | px(x - 1, y - 1) << 7 | px(x - 2, y - 1) << 8 | px(x - 3, y - 1) << 9;
|
|
480
480
|
}
|
|
481
481
|
bmp.data[y * width + x] = mq.decode(cx, ctx);
|
|
482
482
|
}
|
|
@@ -669,6 +669,7 @@ function buildHuffTable(lines) {
|
|
|
669
669
|
}
|
|
670
670
|
/** A most-significant-bit-first reader over a segment's data. */
|
|
671
671
|
var BitReader = class {
|
|
672
|
+
d;
|
|
672
673
|
pos = 0;
|
|
673
674
|
bit = 0;
|
|
674
675
|
constructor(d) {
|
|
@@ -1755,6 +1756,7 @@ var OOB = Symbol("OOB");
|
|
|
1755
1756
|
* needs a context set of its own.
|
|
1756
1757
|
*/
|
|
1757
1758
|
var IntDecoder = class {
|
|
1759
|
+
mq;
|
|
1758
1760
|
cx = newContexts(512);
|
|
1759
1761
|
constructor(mq) {
|
|
1760
1762
|
this.mq = mq;
|
|
@@ -1787,6 +1789,8 @@ var IntDecoder = class {
|
|
|
1787
1789
|
};
|
|
1788
1790
|
/** §A.3 — the symbol ID decoder, a fixed-width code down its own context tree. */
|
|
1789
1791
|
var IdDecoder = class {
|
|
1792
|
+
mq;
|
|
1793
|
+
codeLen;
|
|
1790
1794
|
cx;
|
|
1791
1795
|
constructor(mq, codeLen) {
|
|
1792
1796
|
this.mq = mq;
|
|
@@ -1799,14 +1803,6 @@ var IdDecoder = class {
|
|
|
1799
1803
|
return prev - (1 << this.codeLen);
|
|
1800
1804
|
}
|
|
1801
1805
|
};
|
|
1802
|
-
/** How a text region places each instance against the point it names (§6.4.5). */
|
|
1803
|
-
var Corner = /* @__PURE__ */ function(Corner) {
|
|
1804
|
-
Corner[Corner["BottomLeft"] = 0] = "BottomLeft";
|
|
1805
|
-
Corner[Corner["TopLeft"] = 1] = "TopLeft";
|
|
1806
|
-
Corner[Corner["BottomRight"] = 2] = "BottomRight";
|
|
1807
|
-
Corner[Corner["TopRight"] = 3] = "TopRight";
|
|
1808
|
-
return Corner;
|
|
1809
|
-
}(Corner || {});
|
|
1810
1806
|
/**
|
|
1811
1807
|
* §6.4.5 — draw a text region: a run of strips, each holding instances of the
|
|
1812
1808
|
* symbols in `symbols`, placed by running coordinates rather than absolute ones.
|
|
@@ -1875,12 +1871,12 @@ function decodeTextRegion(mq, symbols, p, stripsLog, lent) {
|
|
|
1875
1871
|
if (p.transposed) {
|
|
1876
1872
|
x = tt;
|
|
1877
1873
|
y = curS;
|
|
1878
|
-
if (p.refCorner ===
|
|
1879
|
-
if (p.refCorner ===
|
|
1874
|
+
if (p.refCorner === 0 || p.refCorner === 2) {}
|
|
1875
|
+
if (p.refCorner === 3 || p.refCorner === 2) x = tt - sw + 1;
|
|
1880
1876
|
} else {
|
|
1881
1877
|
x = curS;
|
|
1882
1878
|
y = tt;
|
|
1883
|
-
if (p.refCorner ===
|
|
1879
|
+
if (p.refCorner === 0 || p.refCorner === 2) y = tt - sh + 1;
|
|
1884
1880
|
}
|
|
1885
1881
|
compose(bmp, sym, x, y, p.combOp);
|
|
1886
1882
|
curS += (p.transposed ? sh : sw) - 1;
|
|
@@ -1959,7 +1955,7 @@ function decodeSymbolDictionary(mq, input, newCount, exportCount, template, at,
|
|
|
1959
1955
|
height,
|
|
1960
1956
|
instances,
|
|
1961
1957
|
stripT: 0,
|
|
1962
|
-
refCorner:
|
|
1958
|
+
refCorner: 1,
|
|
1963
1959
|
transposed: false,
|
|
1964
1960
|
combOp: 0,
|
|
1965
1961
|
defPixel: 0,
|
|
@@ -2069,11 +2065,11 @@ function decodeTextRegionHuff(bits, data, symbols, p, stripsLog, t) {
|
|
|
2069
2065
|
if (p.transposed) {
|
|
2070
2066
|
x = tt;
|
|
2071
2067
|
y = curS;
|
|
2072
|
-
if (p.refCorner ===
|
|
2068
|
+
if (p.refCorner === 3 || p.refCorner === 2) x = tt - sw + 1;
|
|
2073
2069
|
} else {
|
|
2074
2070
|
x = curS;
|
|
2075
2071
|
y = tt;
|
|
2076
|
-
if (p.refCorner ===
|
|
2072
|
+
if (p.refCorner === 0 || p.refCorner === 2) y = tt - sh + 1;
|
|
2077
2073
|
}
|
|
2078
2074
|
compose(bmp, sym, x, y, p.combOp);
|
|
2079
2075
|
curS += (p.transposed ? sh : sw) - 1;
|
|
@@ -2114,7 +2110,7 @@ function aggregateSymbolHuff(bits, data, symbols, width, height, codeLen, refine
|
|
|
2114
2110
|
height,
|
|
2115
2111
|
instances: Math.max(1, instances),
|
|
2116
2112
|
stripT: 0,
|
|
2117
|
-
refCorner:
|
|
2113
|
+
refCorner: 1,
|
|
2118
2114
|
transposed: false,
|
|
2119
2115
|
combOp: 0,
|
|
2120
2116
|
defPixel: 0,
|
|
@@ -2307,6 +2303,7 @@ function decodeGrayScale(mq, data, mmr, template, at, width, height, bits, skip)
|
|
|
2307
2303
|
return values;
|
|
2308
2304
|
}
|
|
2309
2305
|
var Reader = class {
|
|
2306
|
+
d;
|
|
2310
2307
|
pos = 0;
|
|
2311
2308
|
constructor(d) {
|
|
2312
2309
|
this.d = d;
|
|
@@ -2462,7 +2459,8 @@ function decodeJbig2(data, globals, width, height) {
|
|
|
2462
2459
|
const flags = r.u8();
|
|
2463
2460
|
page.defPixel = flags >> 2 & 1;
|
|
2464
2461
|
page.defCombOp = flags >> 3 & 3;
|
|
2465
|
-
|
|
2462
|
+
const striping = r.u16();
|
|
2463
|
+
page.striped = (striping & 32768) !== 0;
|
|
2466
2464
|
if (pw > 0 && pw !== 4294967295 && ph > 0 && ph !== 4294967295) {
|
|
2467
2465
|
page.width = Math.min(pw, width);
|
|
2468
2466
|
page.height = Math.min(ph, height);
|
|
@@ -2750,4 +2748,4 @@ function decodeJbig2(data, globals, width, height) {
|
|
|
2750
2748
|
return packed;
|
|
2751
2749
|
}
|
|
2752
2750
|
//#endregion
|
|
2753
|
-
export { decodeJbig2 };
|
|
2751
|
+
export { MQDecoder, decodeGenericRegion, decodeJbig2, decodeRefinement, newContexts, startingContexts, symbolCodeLength };
|
|
@@ -138,7 +138,6 @@ function decode(bytes) {
|
|
|
138
138
|
p = decodeScan(bytes, segEnd, frame, scanComps, dcTables, acTables, quant, restartInterval);
|
|
139
139
|
continue;
|
|
140
140
|
}
|
|
141
|
-
default: break;
|
|
142
141
|
}
|
|
143
142
|
p = segEnd;
|
|
144
143
|
}
|
|
@@ -172,7 +171,7 @@ function readFrame(bytes, p) {
|
|
|
172
171
|
pred: 0,
|
|
173
172
|
blocksPerLine: 0,
|
|
174
173
|
blocksPerCol: 0,
|
|
175
|
-
plane: new Uint8ClampedArray(0),
|
|
174
|
+
plane: /* @__PURE__ */ new Uint8ClampedArray(0),
|
|
176
175
|
stride: 0
|
|
177
176
|
});
|
|
178
177
|
}
|
|
@@ -211,7 +210,7 @@ function readQuantTables(bytes, p, end, into) {
|
|
|
211
210
|
const pq = bytes[p] >> 4;
|
|
212
211
|
const tq = bytes[p] & 15;
|
|
213
212
|
p++;
|
|
214
|
-
const table = new Int32Array(64);
|
|
213
|
+
const table = /* @__PURE__ */ new Int32Array(64);
|
|
215
214
|
for (let i = 0; i < 64; i++) table[ZIGZAG[i]] = pq === 0 ? bytes[p + i] : be16(bytes, p + i * 2);
|
|
216
215
|
p += pq === 0 ? 64 : 128;
|
|
217
216
|
into[tq] = table;
|
|
@@ -235,9 +234,9 @@ function readHuffTables(bytes, p, end, dc, ac) {
|
|
|
235
234
|
}
|
|
236
235
|
/** §F.2.2.3 — the decoding tables, built from BITS and HUFFVAL. */
|
|
237
236
|
function buildHuffTable(counts, values) {
|
|
238
|
-
const maxcode = new Int32Array(18).fill(-1);
|
|
239
|
-
const mincode = new Int32Array(18);
|
|
240
|
-
const valptr = new Int32Array(18);
|
|
237
|
+
const maxcode = (/* @__PURE__ */ new Int32Array(18)).fill(-1);
|
|
238
|
+
const mincode = /* @__PURE__ */ new Int32Array(18);
|
|
239
|
+
const valptr = /* @__PURE__ */ new Int32Array(18);
|
|
241
240
|
let code = 0;
|
|
242
241
|
let k = 0;
|
|
243
242
|
for (let l = 1; l <= 16; l++) {
|
|
@@ -271,10 +270,12 @@ function decodeScan(bytes, start, frame, scan, dcTables, acTables, quant, restar
|
|
|
271
270
|
const nextBit = () => {
|
|
272
271
|
if (bitCount === 0) {
|
|
273
272
|
let b = bytes[at++] ?? 0;
|
|
274
|
-
if (b === 255)
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
273
|
+
if (b === 255) {
|
|
274
|
+
if ((bytes[at] ?? 0) === 0) at++;
|
|
275
|
+
else {
|
|
276
|
+
at--;
|
|
277
|
+
b = 0;
|
|
278
|
+
}
|
|
278
279
|
}
|
|
279
280
|
bitBuf = b;
|
|
280
281
|
bitCount = 8;
|
|
@@ -299,7 +300,7 @@ function decodeScan(bytes, start, frame, scan, dcTables, acTables, quant, restar
|
|
|
299
300
|
for (let i = 0; i < s; i++) v = v << 1 | nextBit();
|
|
300
301
|
return v < 1 << s - 1 ? v - (1 << s) + 1 : v;
|
|
301
302
|
};
|
|
302
|
-
const block = new Int32Array(64);
|
|
303
|
+
const block = /* @__PURE__ */ new Int32Array(64);
|
|
303
304
|
const decodeBlock = (comp, row, col) => {
|
|
304
305
|
block.fill(0);
|
|
305
306
|
const q = quant[comp.tq];
|
|
@@ -352,7 +353,7 @@ function decodeScan(bytes, start, frame, scan, dcTables, acTables, quant, restar
|
|
|
352
353
|
}
|
|
353
354
|
/** §A.3.3 — cos((2x+1)uπ/16) · C(u)/2, precomputed. */
|
|
354
355
|
var COS = (() => {
|
|
355
|
-
const t = new Float32Array(64);
|
|
356
|
+
const t = /* @__PURE__ */ new Float32Array(64);
|
|
356
357
|
for (let u = 0; u < 8; u++) {
|
|
357
358
|
const c = u === 0 ? Math.SQRT1_2 : 1;
|
|
358
359
|
for (let x = 0; x < 8; x++) t[u * 8 + x] = c * Math.cos((2 * x + 1) * u * Math.PI / 16) / 2;
|
|
@@ -361,7 +362,7 @@ var COS = (() => {
|
|
|
361
362
|
})();
|
|
362
363
|
/** The separable 2-D inverse DCT of one block, levelshifted into `out`. */
|
|
363
364
|
function idctBlock(block, out, offset, stride) {
|
|
364
|
-
const rows = new Float32Array(64);
|
|
365
|
+
const rows = /* @__PURE__ */ new Float32Array(64);
|
|
365
366
|
for (let y = 0; y < 8; y++) for (let x = 0; x < 8; x++) {
|
|
366
367
|
let sum = 0;
|
|
367
368
|
for (let u = 0; u < 8; u++) sum += COS[u * 8 + x] * block[y * 8 + u];
|