@chialab/pdfjs-lib 1.0.0-alpha.2 → 1.0.0-alpha.20
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 +15 -7
- package/dist/browser/NodeCanvasFactory-ONRE5YYL.js +58 -0
- package/dist/browser/chunk-5IWODJWD.js +801 -0
- package/dist/browser/chunk-ELOUEWKT.js +1142 -0
- package/dist/browser/chunk-NJUB3B5A.js +1207 -0
- package/dist/browser/index.js +2641 -3053
- package/dist/browser/openjpeg-K2XBCFFN.js +9 -0
- package/dist/browser/qcms_bg-Q7BRLLZG.js +9 -0
- package/dist/browser/worker.js +7307 -6457
- package/dist/index.d.ts +3 -0
- package/dist/lib/AnnotationData.d.ts +8 -8
- package/dist/lib/AnnotationOperatorsList.d.ts +21 -0
- package/dist/lib/CanvasGraphics.d.ts +1 -0
- package/dist/lib/NodeCanvasFactory.d.ts +9 -0
- package/dist/lib/NodeFilterFactory.d.ts +10 -0
- package/dist/lib/Path2D.d.ts +1 -1
- package/dist/lib/StandardFontDataFactory.d.ts +2 -2
- package/dist/lib/Svg.d.ts +143 -0
- package/dist/lib/SvgCanvasContext.d.ts +31 -22
- package/dist/lib/TextLayer.d.ts +12 -5
- package/dist/lib/WasmFactory.d.ts +5 -0
- package/dist/lib/utils.d.ts +29 -3
- package/dist/node/NodeCanvasFactory-YRBSQ5MH.js +8 -0
- package/dist/node/chunk-3XZOTLLE.js +1439 -0
- package/dist/node/chunk-XMKSLA4K.js +1207 -0
- package/dist/node/chunk-ZKUTXCS2.js +801 -0
- package/dist/node/index.js +2659 -3102
- package/dist/node/openjpeg-B2WN24QZ.js +9 -0
- package/dist/node/qcms_bg-T4RSHPOQ.js +9 -0
- package/dist/node/worker.js +7307 -6457
- package/dist/pdf.js/src/display/annotation_layer.d.ts +1 -2
- package/dist/pdf.js/src/display/annotation_storage.d.ts +1 -8
- package/dist/pdf.js/src/display/api.d.ts +38 -72
- package/dist/pdf.js/src/display/api_utils.d.ts +13 -0
- package/dist/pdf.js/src/display/canvas.d.ts +21 -29
- package/dist/pdf.js/src/display/display_utils.d.ts +12 -1
- package/dist/pdf.js/src/display/draw_layer.d.ts +2 -2
- package/dist/pdf.js/src/display/editor/alt_text.d.ts +1 -1
- package/dist/pdf.js/src/display/editor/annotation_editor_layer.d.ts +5 -5
- package/dist/pdf.js/src/display/editor/color_picker.d.ts +1 -1
- package/dist/pdf.js/src/display/editor/draw.d.ts +7 -7
- package/dist/pdf.js/src/display/editor/drawers/freedraw.d.ts +3 -3
- package/dist/pdf.js/src/display/editor/drawers/signaturedraw.d.ts +13 -13
- package/dist/pdf.js/src/display/editor/editor.d.ts +30 -6
- package/dist/pdf.js/src/display/editor/freetext.d.ts +4 -7
- package/dist/pdf.js/src/display/editor/highlight.d.ts +6 -3
- package/dist/pdf.js/src/display/editor/ink.d.ts +1 -0
- package/dist/pdf.js/src/display/editor/signature.d.ts +3 -0
- package/dist/pdf.js/src/display/editor/stamp.d.ts +4 -3
- package/dist/pdf.js/src/display/editor/toolbar.d.ts +4 -2
- package/dist/pdf.js/src/display/editor/tools.d.ts +7 -9
- package/dist/pdf.js/src/display/metadata.d.ts +1 -2
- package/dist/pdf.js/src/display/optional_content_config.d.ts +1 -1
- package/dist/pdf.js/src/display/pattern_helper.d.ts +4 -2
- package/dist/pdf.js/src/display/pdf_objects.d.ts +40 -0
- package/dist/pdf.js/src/display/text_layer.d.ts +9 -9
- package/dist/pdf.js/src/display/touch_manager.d.ts +5 -1
- package/dist/pdf.js/src/display/worker_options.d.ts +2 -2
- package/dist/pdf.js/src/pdf.d.ts +4 -1
- package/dist/pdf.js/src/shared/scripting_utils.d.ts +2 -0
- package/dist/pdf.js/src/shared/util.d.ts +123 -100
- package/dist/pdf.js/web/text_accessibility.d.ts +1 -1
- package/package.json +7 -4
- package/dist/browser/chunk-DYHYQ33L.js +0 -1775
- package/dist/node/chunk-KTTVPO2G.js +0 -1775
- package/dist/pdf.js/src/display/cmap_reader_factory.d.ts +0 -25
- package/dist/pdf.js/src/display/node_utils.d.ts +0 -32
- package/dist/pdf.js/src/display/wasm_factory.d.ts +0 -20
|
@@ -0,0 +1,1207 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__privateAdd,
|
|
3
|
+
__privateMethod
|
|
4
|
+
} from "./chunk-7MW5RQZ5.js";
|
|
5
|
+
|
|
6
|
+
// src/pdf.js/src/shared/util.js
|
|
7
|
+
var isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
|
|
8
|
+
var FONT_IDENTITY_MATRIX = [1e-3, 0, 0, 1e-3, 0, 0];
|
|
9
|
+
var LINE_FACTOR = 1.35;
|
|
10
|
+
var LINE_DESCENT_FACTOR = 0.35;
|
|
11
|
+
var BASELINE_FACTOR = LINE_DESCENT_FACTOR / LINE_FACTOR;
|
|
12
|
+
var RenderingIntentFlag = {
|
|
13
|
+
ANY: 1,
|
|
14
|
+
DISPLAY: 2,
|
|
15
|
+
PRINT: 4,
|
|
16
|
+
SAVE: 8,
|
|
17
|
+
ANNOTATIONS_FORMS: 16,
|
|
18
|
+
ANNOTATIONS_STORAGE: 32,
|
|
19
|
+
ANNOTATIONS_DISABLE: 64,
|
|
20
|
+
IS_EDITING: 128,
|
|
21
|
+
OPLIST: 256
|
|
22
|
+
};
|
|
23
|
+
var AnnotationMode = {
|
|
24
|
+
DISABLE: 0,
|
|
25
|
+
ENABLE: 1,
|
|
26
|
+
ENABLE_FORMS: 2,
|
|
27
|
+
ENABLE_STORAGE: 3
|
|
28
|
+
};
|
|
29
|
+
var AnnotationEditorPrefix = "pdfjs_internal_editor_";
|
|
30
|
+
var AnnotationEditorType = {
|
|
31
|
+
DISABLE: -1,
|
|
32
|
+
NONE: 0,
|
|
33
|
+
FREETEXT: 3,
|
|
34
|
+
HIGHLIGHT: 9,
|
|
35
|
+
STAMP: 13,
|
|
36
|
+
INK: 15,
|
|
37
|
+
SIGNATURE: 101
|
|
38
|
+
};
|
|
39
|
+
var AnnotationEditorParamsType = {
|
|
40
|
+
RESIZE: 1,
|
|
41
|
+
CREATE: 2,
|
|
42
|
+
FREETEXT_SIZE: 11,
|
|
43
|
+
FREETEXT_COLOR: 12,
|
|
44
|
+
FREETEXT_OPACITY: 13,
|
|
45
|
+
INK_COLOR: 21,
|
|
46
|
+
INK_THICKNESS: 22,
|
|
47
|
+
INK_OPACITY: 23,
|
|
48
|
+
HIGHLIGHT_COLOR: 31,
|
|
49
|
+
HIGHLIGHT_DEFAULT_COLOR: 32,
|
|
50
|
+
HIGHLIGHT_THICKNESS: 33,
|
|
51
|
+
HIGHLIGHT_FREE: 34,
|
|
52
|
+
HIGHLIGHT_SHOW_ALL: 35,
|
|
53
|
+
DRAW_STEP: 41
|
|
54
|
+
};
|
|
55
|
+
var PermissionFlag = {
|
|
56
|
+
PRINT: 4,
|
|
57
|
+
MODIFY_CONTENTS: 8,
|
|
58
|
+
COPY: 16,
|
|
59
|
+
MODIFY_ANNOTATIONS: 32,
|
|
60
|
+
FILL_INTERACTIVE_FORMS: 256,
|
|
61
|
+
COPY_FOR_ACCESSIBILITY: 512,
|
|
62
|
+
ASSEMBLE: 1024,
|
|
63
|
+
PRINT_HIGH_QUALITY: 2048
|
|
64
|
+
};
|
|
65
|
+
var TextRenderingMode = {
|
|
66
|
+
FILL: 0,
|
|
67
|
+
STROKE: 1,
|
|
68
|
+
FILL_STROKE: 2,
|
|
69
|
+
INVISIBLE: 3,
|
|
70
|
+
FILL_ADD_TO_PATH: 4,
|
|
71
|
+
STROKE_ADD_TO_PATH: 5,
|
|
72
|
+
FILL_STROKE_ADD_TO_PATH: 6,
|
|
73
|
+
ADD_TO_PATH: 7,
|
|
74
|
+
FILL_STROKE_MASK: 3,
|
|
75
|
+
ADD_TO_PATH_FLAG: 4
|
|
76
|
+
};
|
|
77
|
+
var ImageKind = {
|
|
78
|
+
GRAYSCALE_1BPP: 1,
|
|
79
|
+
RGB_24BPP: 2,
|
|
80
|
+
RGBA_32BPP: 3
|
|
81
|
+
};
|
|
82
|
+
var AnnotationType = {
|
|
83
|
+
TEXT: 1,
|
|
84
|
+
LINK: 2,
|
|
85
|
+
FREETEXT: 3,
|
|
86
|
+
LINE: 4,
|
|
87
|
+
SQUARE: 5,
|
|
88
|
+
CIRCLE: 6,
|
|
89
|
+
POLYGON: 7,
|
|
90
|
+
POLYLINE: 8,
|
|
91
|
+
HIGHLIGHT: 9,
|
|
92
|
+
UNDERLINE: 10,
|
|
93
|
+
SQUIGGLY: 11,
|
|
94
|
+
STRIKEOUT: 12,
|
|
95
|
+
STAMP: 13,
|
|
96
|
+
CARET: 14,
|
|
97
|
+
INK: 15,
|
|
98
|
+
POPUP: 16,
|
|
99
|
+
FILEATTACHMENT: 17,
|
|
100
|
+
SOUND: 18,
|
|
101
|
+
MOVIE: 19,
|
|
102
|
+
WIDGET: 20,
|
|
103
|
+
SCREEN: 21,
|
|
104
|
+
PRINTERMARK: 22,
|
|
105
|
+
TRAPNET: 23,
|
|
106
|
+
WATERMARK: 24,
|
|
107
|
+
THREED: 25,
|
|
108
|
+
REDACT: 26
|
|
109
|
+
};
|
|
110
|
+
var AnnotationReplyType = {
|
|
111
|
+
GROUP: "Group",
|
|
112
|
+
REPLY: "R"
|
|
113
|
+
};
|
|
114
|
+
var AnnotationFlag = {
|
|
115
|
+
INVISIBLE: 1,
|
|
116
|
+
HIDDEN: 2,
|
|
117
|
+
PRINT: 4,
|
|
118
|
+
NOZOOM: 8,
|
|
119
|
+
NOROTATE: 16,
|
|
120
|
+
NOVIEW: 32,
|
|
121
|
+
READONLY: 64,
|
|
122
|
+
LOCKED: 128,
|
|
123
|
+
TOGGLENOVIEW: 256,
|
|
124
|
+
LOCKEDCONTENTS: 512
|
|
125
|
+
};
|
|
126
|
+
var AnnotationFieldFlag = {
|
|
127
|
+
READONLY: 1,
|
|
128
|
+
REQUIRED: 2,
|
|
129
|
+
NOEXPORT: 4,
|
|
130
|
+
MULTILINE: 4096,
|
|
131
|
+
PASSWORD: 8192,
|
|
132
|
+
NOTOGGLETOOFF: 16384,
|
|
133
|
+
RADIO: 32768,
|
|
134
|
+
PUSHBUTTON: 65536,
|
|
135
|
+
COMBO: 131072,
|
|
136
|
+
EDIT: 262144,
|
|
137
|
+
SORT: 524288,
|
|
138
|
+
FILESELECT: 1048576,
|
|
139
|
+
MULTISELECT: 2097152,
|
|
140
|
+
DONOTSPELLCHECK: 4194304,
|
|
141
|
+
DONOTSCROLL: 8388608,
|
|
142
|
+
COMB: 16777216,
|
|
143
|
+
RICHTEXT: 33554432,
|
|
144
|
+
RADIOSINUNISON: 33554432,
|
|
145
|
+
COMMITONSELCHANGE: 67108864
|
|
146
|
+
};
|
|
147
|
+
var AnnotationBorderStyleType = {
|
|
148
|
+
SOLID: 1,
|
|
149
|
+
DASHED: 2,
|
|
150
|
+
BEVELED: 3,
|
|
151
|
+
INSET: 4,
|
|
152
|
+
UNDERLINE: 5
|
|
153
|
+
};
|
|
154
|
+
var AnnotationActionEventType = {
|
|
155
|
+
E: "Mouse Enter",
|
|
156
|
+
X: "Mouse Exit",
|
|
157
|
+
D: "Mouse Down",
|
|
158
|
+
U: "Mouse Up",
|
|
159
|
+
Fo: "Focus",
|
|
160
|
+
Bl: "Blur",
|
|
161
|
+
PO: "PageOpen",
|
|
162
|
+
PC: "PageClose",
|
|
163
|
+
PV: "PageVisible",
|
|
164
|
+
PI: "PageInvisible",
|
|
165
|
+
K: "Keystroke",
|
|
166
|
+
F: "Format",
|
|
167
|
+
V: "Validate",
|
|
168
|
+
C: "Calculate"
|
|
169
|
+
};
|
|
170
|
+
var DocumentActionEventType = {
|
|
171
|
+
WC: "WillClose",
|
|
172
|
+
WS: "WillSave",
|
|
173
|
+
DS: "DidSave",
|
|
174
|
+
WP: "WillPrint",
|
|
175
|
+
DP: "DidPrint"
|
|
176
|
+
};
|
|
177
|
+
var PageActionEventType = {
|
|
178
|
+
O: "PageOpen",
|
|
179
|
+
C: "PageClose"
|
|
180
|
+
};
|
|
181
|
+
var VerbosityLevel = {
|
|
182
|
+
ERRORS: 0,
|
|
183
|
+
WARNINGS: 1,
|
|
184
|
+
INFOS: 5
|
|
185
|
+
};
|
|
186
|
+
var OPS = {
|
|
187
|
+
// Intentionally start from 1 so it is easy to spot bad operators that will be
|
|
188
|
+
// 0's.
|
|
189
|
+
// PLEASE NOTE: We purposely keep any removed operators commented out, since
|
|
190
|
+
// re-numbering the list would risk breaking third-party users.
|
|
191
|
+
dependency: 1,
|
|
192
|
+
setLineWidth: 2,
|
|
193
|
+
setLineCap: 3,
|
|
194
|
+
setLineJoin: 4,
|
|
195
|
+
setMiterLimit: 5,
|
|
196
|
+
setDash: 6,
|
|
197
|
+
setRenderingIntent: 7,
|
|
198
|
+
setFlatness: 8,
|
|
199
|
+
setGState: 9,
|
|
200
|
+
save: 10,
|
|
201
|
+
restore: 11,
|
|
202
|
+
transform: 12,
|
|
203
|
+
moveTo: 13,
|
|
204
|
+
lineTo: 14,
|
|
205
|
+
curveTo: 15,
|
|
206
|
+
curveTo2: 16,
|
|
207
|
+
curveTo3: 17,
|
|
208
|
+
closePath: 18,
|
|
209
|
+
rectangle: 19,
|
|
210
|
+
stroke: 20,
|
|
211
|
+
closeStroke: 21,
|
|
212
|
+
fill: 22,
|
|
213
|
+
eoFill: 23,
|
|
214
|
+
fillStroke: 24,
|
|
215
|
+
eoFillStroke: 25,
|
|
216
|
+
closeFillStroke: 26,
|
|
217
|
+
closeEOFillStroke: 27,
|
|
218
|
+
endPath: 28,
|
|
219
|
+
clip: 29,
|
|
220
|
+
eoClip: 30,
|
|
221
|
+
beginText: 31,
|
|
222
|
+
endText: 32,
|
|
223
|
+
setCharSpacing: 33,
|
|
224
|
+
setWordSpacing: 34,
|
|
225
|
+
setHScale: 35,
|
|
226
|
+
setLeading: 36,
|
|
227
|
+
setFont: 37,
|
|
228
|
+
setTextRenderingMode: 38,
|
|
229
|
+
setTextRise: 39,
|
|
230
|
+
moveText: 40,
|
|
231
|
+
setLeadingMoveText: 41,
|
|
232
|
+
setTextMatrix: 42,
|
|
233
|
+
nextLine: 43,
|
|
234
|
+
showText: 44,
|
|
235
|
+
showSpacedText: 45,
|
|
236
|
+
nextLineShowText: 46,
|
|
237
|
+
nextLineSetSpacingShowText: 47,
|
|
238
|
+
setCharWidth: 48,
|
|
239
|
+
setCharWidthAndBounds: 49,
|
|
240
|
+
setStrokeColorSpace: 50,
|
|
241
|
+
setFillColorSpace: 51,
|
|
242
|
+
setStrokeColor: 52,
|
|
243
|
+
setStrokeColorN: 53,
|
|
244
|
+
setFillColor: 54,
|
|
245
|
+
setFillColorN: 55,
|
|
246
|
+
setStrokeGray: 56,
|
|
247
|
+
setFillGray: 57,
|
|
248
|
+
setStrokeRGBColor: 58,
|
|
249
|
+
setFillRGBColor: 59,
|
|
250
|
+
setStrokeCMYKColor: 60,
|
|
251
|
+
setFillCMYKColor: 61,
|
|
252
|
+
shadingFill: 62,
|
|
253
|
+
beginInlineImage: 63,
|
|
254
|
+
beginImageData: 64,
|
|
255
|
+
endInlineImage: 65,
|
|
256
|
+
paintXObject: 66,
|
|
257
|
+
markPoint: 67,
|
|
258
|
+
markPointProps: 68,
|
|
259
|
+
beginMarkedContent: 69,
|
|
260
|
+
beginMarkedContentProps: 70,
|
|
261
|
+
endMarkedContent: 71,
|
|
262
|
+
beginCompat: 72,
|
|
263
|
+
endCompat: 73,
|
|
264
|
+
paintFormXObjectBegin: 74,
|
|
265
|
+
paintFormXObjectEnd: 75,
|
|
266
|
+
beginGroup: 76,
|
|
267
|
+
endGroup: 77,
|
|
268
|
+
// beginAnnotations: 78,
|
|
269
|
+
// endAnnotations: 79,
|
|
270
|
+
beginAnnotation: 80,
|
|
271
|
+
endAnnotation: 81,
|
|
272
|
+
// paintJpegXObject: 82,
|
|
273
|
+
paintImageMaskXObject: 83,
|
|
274
|
+
paintImageMaskXObjectGroup: 84,
|
|
275
|
+
paintImageXObject: 85,
|
|
276
|
+
paintInlineImageXObject: 86,
|
|
277
|
+
paintInlineImageXObjectGroup: 87,
|
|
278
|
+
paintImageXObjectRepeat: 88,
|
|
279
|
+
paintImageMaskXObjectRepeat: 89,
|
|
280
|
+
paintSolidColorImageMask: 90,
|
|
281
|
+
constructPath: 91,
|
|
282
|
+
setStrokeTransparent: 92,
|
|
283
|
+
setFillTransparent: 93,
|
|
284
|
+
rawFillPath: 94
|
|
285
|
+
};
|
|
286
|
+
var DrawOPS = {
|
|
287
|
+
moveTo: 0,
|
|
288
|
+
lineTo: 1,
|
|
289
|
+
curveTo: 2,
|
|
290
|
+
closePath: 3
|
|
291
|
+
};
|
|
292
|
+
var PasswordResponses = {
|
|
293
|
+
NEED_PASSWORD: 1,
|
|
294
|
+
INCORRECT_PASSWORD: 2
|
|
295
|
+
};
|
|
296
|
+
var verbosity = VerbosityLevel.WARNINGS;
|
|
297
|
+
function setVerbosityLevel(level) {
|
|
298
|
+
if (Number.isInteger(level)) {
|
|
299
|
+
verbosity = level;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
function getVerbosityLevel() {
|
|
303
|
+
return verbosity;
|
|
304
|
+
}
|
|
305
|
+
function info(msg) {
|
|
306
|
+
if (verbosity >= VerbosityLevel.INFOS) {
|
|
307
|
+
console.log(`Info: ${msg}`);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
function warn(msg) {
|
|
311
|
+
if (verbosity >= VerbosityLevel.WARNINGS) {
|
|
312
|
+
console.log(`Warning: ${msg}`);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
function unreachable(msg) {
|
|
316
|
+
throw new Error(msg);
|
|
317
|
+
}
|
|
318
|
+
function assert(cond, msg) {
|
|
319
|
+
if (!cond) {
|
|
320
|
+
unreachable(msg);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
function _isValidProtocol(url) {
|
|
324
|
+
switch (url?.protocol) {
|
|
325
|
+
case "http:":
|
|
326
|
+
case "https:":
|
|
327
|
+
case "ftp:":
|
|
328
|
+
case "mailto:":
|
|
329
|
+
case "tel:":
|
|
330
|
+
return true;
|
|
331
|
+
default:
|
|
332
|
+
return false;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
function createValidAbsoluteUrl(url, baseUrl = null, options = null) {
|
|
336
|
+
if (!url) {
|
|
337
|
+
return null;
|
|
338
|
+
}
|
|
339
|
+
if (options && typeof url === "string") {
|
|
340
|
+
if (options.addDefaultProtocol && url.startsWith("www.")) {
|
|
341
|
+
const dots = url.match(/\./g);
|
|
342
|
+
if (dots?.length >= 2) {
|
|
343
|
+
url = `http://${url}`;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
if (options.tryConvertEncoding) {
|
|
347
|
+
try {
|
|
348
|
+
url = stringToUTF8String(url);
|
|
349
|
+
} catch {
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
const absoluteUrl = baseUrl ? URL.parse(url, baseUrl) : URL.parse(url);
|
|
354
|
+
return _isValidProtocol(absoluteUrl) ? absoluteUrl : null;
|
|
355
|
+
}
|
|
356
|
+
function updateUrlHash(url, hash, allowRel = false) {
|
|
357
|
+
const res = URL.parse(url);
|
|
358
|
+
if (res) {
|
|
359
|
+
res.hash = hash;
|
|
360
|
+
return res.href;
|
|
361
|
+
}
|
|
362
|
+
if (allowRel && createValidAbsoluteUrl(url, "http://example.com")) {
|
|
363
|
+
return url.split("#", 1)[0] + `${hash ? `#${hash}` : ""}`;
|
|
364
|
+
}
|
|
365
|
+
return "";
|
|
366
|
+
}
|
|
367
|
+
function shadow(obj, prop, value, nonSerializable = false) {
|
|
368
|
+
if (false) {
|
|
369
|
+
assert(
|
|
370
|
+
prop in obj,
|
|
371
|
+
`shadow: Property "${prop && prop.toString()}" not found in object.`
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
Object.defineProperty(obj, prop, {
|
|
375
|
+
value,
|
|
376
|
+
enumerable: !nonSerializable,
|
|
377
|
+
configurable: true,
|
|
378
|
+
writable: false
|
|
379
|
+
});
|
|
380
|
+
return value;
|
|
381
|
+
}
|
|
382
|
+
var BaseException = (function BaseExceptionClosure() {
|
|
383
|
+
function BaseException2(message, name) {
|
|
384
|
+
if (false) {
|
|
385
|
+
unreachable("Cannot initialize BaseException.");
|
|
386
|
+
}
|
|
387
|
+
this.message = message;
|
|
388
|
+
this.name = name;
|
|
389
|
+
}
|
|
390
|
+
BaseException2.prototype = new Error();
|
|
391
|
+
BaseException2.constructor = BaseException2;
|
|
392
|
+
return BaseException2;
|
|
393
|
+
})();
|
|
394
|
+
var PasswordException = class extends BaseException {
|
|
395
|
+
constructor(msg, code) {
|
|
396
|
+
super(msg, "PasswordException");
|
|
397
|
+
this.code = code;
|
|
398
|
+
}
|
|
399
|
+
};
|
|
400
|
+
var UnknownErrorException = class extends BaseException {
|
|
401
|
+
constructor(msg, details) {
|
|
402
|
+
super(msg, "UnknownErrorException");
|
|
403
|
+
this.details = details;
|
|
404
|
+
}
|
|
405
|
+
};
|
|
406
|
+
var InvalidPDFException = class extends BaseException {
|
|
407
|
+
constructor(msg) {
|
|
408
|
+
super(msg, "InvalidPDFException");
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
var ResponseException = class extends BaseException {
|
|
412
|
+
constructor(msg, status, missing) {
|
|
413
|
+
super(msg, "ResponseException");
|
|
414
|
+
this.status = status;
|
|
415
|
+
this.missing = missing;
|
|
416
|
+
}
|
|
417
|
+
};
|
|
418
|
+
var FormatError = class extends BaseException {
|
|
419
|
+
constructor(msg) {
|
|
420
|
+
super(msg, "FormatError");
|
|
421
|
+
}
|
|
422
|
+
};
|
|
423
|
+
var AbortException = class extends BaseException {
|
|
424
|
+
constructor(msg) {
|
|
425
|
+
super(msg, "AbortException");
|
|
426
|
+
}
|
|
427
|
+
};
|
|
428
|
+
function bytesToString(bytes) {
|
|
429
|
+
if (typeof bytes !== "object" || bytes?.length === void 0) {
|
|
430
|
+
unreachable("Invalid argument for bytesToString");
|
|
431
|
+
}
|
|
432
|
+
const length = bytes.length;
|
|
433
|
+
const MAX_ARGUMENT_COUNT = 8192;
|
|
434
|
+
if (length < MAX_ARGUMENT_COUNT) {
|
|
435
|
+
return String.fromCharCode.apply(null, bytes);
|
|
436
|
+
}
|
|
437
|
+
const strBuf = [];
|
|
438
|
+
for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
|
|
439
|
+
const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
|
|
440
|
+
const chunk = bytes.subarray(i, chunkEnd);
|
|
441
|
+
strBuf.push(String.fromCharCode.apply(null, chunk));
|
|
442
|
+
}
|
|
443
|
+
return strBuf.join("");
|
|
444
|
+
}
|
|
445
|
+
function stringToBytes(str) {
|
|
446
|
+
if (typeof str !== "string") {
|
|
447
|
+
unreachable("Invalid argument for stringToBytes");
|
|
448
|
+
}
|
|
449
|
+
const length = str.length;
|
|
450
|
+
const bytes = new Uint8Array(length);
|
|
451
|
+
for (let i = 0; i < length; ++i) {
|
|
452
|
+
bytes[i] = str.charCodeAt(i) & 255;
|
|
453
|
+
}
|
|
454
|
+
return bytes;
|
|
455
|
+
}
|
|
456
|
+
function string32(value) {
|
|
457
|
+
if (false) {
|
|
458
|
+
assert(
|
|
459
|
+
typeof value === "number" && Math.abs(value) < 2 ** 32,
|
|
460
|
+
`string32: Unexpected input "${value}".`
|
|
461
|
+
);
|
|
462
|
+
}
|
|
463
|
+
return String.fromCharCode(
|
|
464
|
+
value >> 24 & 255,
|
|
465
|
+
value >> 16 & 255,
|
|
466
|
+
value >> 8 & 255,
|
|
467
|
+
value & 255
|
|
468
|
+
);
|
|
469
|
+
}
|
|
470
|
+
function objectSize(obj) {
|
|
471
|
+
return Object.keys(obj).length;
|
|
472
|
+
}
|
|
473
|
+
function isLittleEndian() {
|
|
474
|
+
const buffer8 = new Uint8Array(4);
|
|
475
|
+
buffer8[0] = 1;
|
|
476
|
+
const view32 = new Uint32Array(buffer8.buffer, 0, 1);
|
|
477
|
+
return view32[0] === 1;
|
|
478
|
+
}
|
|
479
|
+
function isEvalSupported() {
|
|
480
|
+
try {
|
|
481
|
+
new Function("");
|
|
482
|
+
return true;
|
|
483
|
+
} catch {
|
|
484
|
+
return false;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
var FeatureTest = class {
|
|
488
|
+
static get isLittleEndian() {
|
|
489
|
+
return shadow(this, "isLittleEndian", isLittleEndian());
|
|
490
|
+
}
|
|
491
|
+
static get isEvalSupported() {
|
|
492
|
+
return shadow(this, "isEvalSupported", isEvalSupported());
|
|
493
|
+
}
|
|
494
|
+
static get isOffscreenCanvasSupported() {
|
|
495
|
+
return shadow(
|
|
496
|
+
this,
|
|
497
|
+
"isOffscreenCanvasSupported",
|
|
498
|
+
typeof OffscreenCanvas !== "undefined"
|
|
499
|
+
);
|
|
500
|
+
}
|
|
501
|
+
static get isImageDecoderSupported() {
|
|
502
|
+
return shadow(
|
|
503
|
+
this,
|
|
504
|
+
"isImageDecoderSupported",
|
|
505
|
+
typeof ImageDecoder !== "undefined"
|
|
506
|
+
);
|
|
507
|
+
}
|
|
508
|
+
static get platform() {
|
|
509
|
+
const { platform, userAgent } = navigator;
|
|
510
|
+
return shadow(this, "platform", {
|
|
511
|
+
isAndroid: userAgent.includes("Android"),
|
|
512
|
+
isLinux: platform.includes("Linux"),
|
|
513
|
+
isMac: platform.includes("Mac"),
|
|
514
|
+
isWindows: platform.includes("Win"),
|
|
515
|
+
isFirefox: userAgent.includes("Firefox")
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
static get isCSSRoundSupported() {
|
|
519
|
+
return shadow(
|
|
520
|
+
this,
|
|
521
|
+
"isCSSRoundSupported",
|
|
522
|
+
globalThis.CSS?.supports?.("width: round(1.5px, 1px)")
|
|
523
|
+
);
|
|
524
|
+
}
|
|
525
|
+
};
|
|
526
|
+
var hexNumbers = Array.from(
|
|
527
|
+
Array(256).keys(),
|
|
528
|
+
(n) => n.toString(16).padStart(2, "0")
|
|
529
|
+
);
|
|
530
|
+
var _Util_static, getExtremumOnCurve_fn, getExtremum_fn;
|
|
531
|
+
var Util = class {
|
|
532
|
+
static makeHexColor(r, g, b) {
|
|
533
|
+
return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`;
|
|
534
|
+
}
|
|
535
|
+
// Apply a scaling matrix to some min/max values.
|
|
536
|
+
// If a scaling factor is negative then min and max must be
|
|
537
|
+
// swapped.
|
|
538
|
+
static scaleMinMax(transform, minMax) {
|
|
539
|
+
let temp;
|
|
540
|
+
if (transform[0]) {
|
|
541
|
+
if (transform[0] < 0) {
|
|
542
|
+
temp = minMax[0];
|
|
543
|
+
minMax[0] = minMax[2];
|
|
544
|
+
minMax[2] = temp;
|
|
545
|
+
}
|
|
546
|
+
minMax[0] *= transform[0];
|
|
547
|
+
minMax[2] *= transform[0];
|
|
548
|
+
if (transform[3] < 0) {
|
|
549
|
+
temp = minMax[1];
|
|
550
|
+
minMax[1] = minMax[3];
|
|
551
|
+
minMax[3] = temp;
|
|
552
|
+
}
|
|
553
|
+
minMax[1] *= transform[3];
|
|
554
|
+
minMax[3] *= transform[3];
|
|
555
|
+
} else {
|
|
556
|
+
temp = minMax[0];
|
|
557
|
+
minMax[0] = minMax[1];
|
|
558
|
+
minMax[1] = temp;
|
|
559
|
+
temp = minMax[2];
|
|
560
|
+
minMax[2] = minMax[3];
|
|
561
|
+
minMax[3] = temp;
|
|
562
|
+
if (transform[1] < 0) {
|
|
563
|
+
temp = minMax[1];
|
|
564
|
+
minMax[1] = minMax[3];
|
|
565
|
+
minMax[3] = temp;
|
|
566
|
+
}
|
|
567
|
+
minMax[1] *= transform[1];
|
|
568
|
+
minMax[3] *= transform[1];
|
|
569
|
+
if (transform[2] < 0) {
|
|
570
|
+
temp = minMax[0];
|
|
571
|
+
minMax[0] = minMax[2];
|
|
572
|
+
minMax[2] = temp;
|
|
573
|
+
}
|
|
574
|
+
minMax[0] *= transform[2];
|
|
575
|
+
minMax[2] *= transform[2];
|
|
576
|
+
}
|
|
577
|
+
minMax[0] += transform[4];
|
|
578
|
+
minMax[1] += transform[5];
|
|
579
|
+
minMax[2] += transform[4];
|
|
580
|
+
minMax[3] += transform[5];
|
|
581
|
+
}
|
|
582
|
+
// Concatenates two transformation matrices together and returns the result.
|
|
583
|
+
static transform(m1, m2) {
|
|
584
|
+
return [
|
|
585
|
+
m1[0] * m2[0] + m1[2] * m2[1],
|
|
586
|
+
m1[1] * m2[0] + m1[3] * m2[1],
|
|
587
|
+
m1[0] * m2[2] + m1[2] * m2[3],
|
|
588
|
+
m1[1] * m2[2] + m1[3] * m2[3],
|
|
589
|
+
m1[0] * m2[4] + m1[2] * m2[5] + m1[4],
|
|
590
|
+
m1[1] * m2[4] + m1[3] * m2[5] + m1[5]
|
|
591
|
+
];
|
|
592
|
+
}
|
|
593
|
+
// For 2d affine transforms
|
|
594
|
+
static applyTransform(p, m, pos = 0) {
|
|
595
|
+
const p0 = p[pos];
|
|
596
|
+
const p1 = p[pos + 1];
|
|
597
|
+
p[pos] = p0 * m[0] + p1 * m[2] + m[4];
|
|
598
|
+
p[pos + 1] = p0 * m[1] + p1 * m[3] + m[5];
|
|
599
|
+
}
|
|
600
|
+
static applyTransformToBezier(p, transform, pos = 0) {
|
|
601
|
+
const m0 = transform[0];
|
|
602
|
+
const m1 = transform[1];
|
|
603
|
+
const m2 = transform[2];
|
|
604
|
+
const m3 = transform[3];
|
|
605
|
+
const m4 = transform[4];
|
|
606
|
+
const m5 = transform[5];
|
|
607
|
+
for (let i = 0; i < 6; i += 2) {
|
|
608
|
+
const pI = p[pos + i];
|
|
609
|
+
const pI1 = p[pos + i + 1];
|
|
610
|
+
p[pos + i] = pI * m0 + pI1 * m2 + m4;
|
|
611
|
+
p[pos + i + 1] = pI * m1 + pI1 * m3 + m5;
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
static applyInverseTransform(p, m) {
|
|
615
|
+
const p0 = p[0];
|
|
616
|
+
const p1 = p[1];
|
|
617
|
+
const d = m[0] * m[3] - m[1] * m[2];
|
|
618
|
+
p[0] = (p0 * m[3] - p1 * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
|
|
619
|
+
p[1] = (-p0 * m[1] + p1 * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
|
|
620
|
+
}
|
|
621
|
+
// Applies the transform to the rectangle and finds the minimum axially
|
|
622
|
+
// aligned bounding box.
|
|
623
|
+
static axialAlignedBoundingBox(rect, transform, output) {
|
|
624
|
+
const m0 = transform[0];
|
|
625
|
+
const m1 = transform[1];
|
|
626
|
+
const m2 = transform[2];
|
|
627
|
+
const m3 = transform[3];
|
|
628
|
+
const m4 = transform[4];
|
|
629
|
+
const m5 = transform[5];
|
|
630
|
+
const r0 = rect[0];
|
|
631
|
+
const r1 = rect[1];
|
|
632
|
+
const r2 = rect[2];
|
|
633
|
+
const r3 = rect[3];
|
|
634
|
+
let a0 = m0 * r0 + m4;
|
|
635
|
+
let a2 = a0;
|
|
636
|
+
let a1 = m0 * r2 + m4;
|
|
637
|
+
let a3 = a1;
|
|
638
|
+
let b0 = m3 * r1 + m5;
|
|
639
|
+
let b2 = b0;
|
|
640
|
+
let b1 = m3 * r3 + m5;
|
|
641
|
+
let b3 = b1;
|
|
642
|
+
if (m1 !== 0 || m2 !== 0) {
|
|
643
|
+
const m1r0 = m1 * r0;
|
|
644
|
+
const m1r2 = m1 * r2;
|
|
645
|
+
const m2r1 = m2 * r1;
|
|
646
|
+
const m2r3 = m2 * r3;
|
|
647
|
+
a0 += m2r1;
|
|
648
|
+
a3 += m2r1;
|
|
649
|
+
a1 += m2r3;
|
|
650
|
+
a2 += m2r3;
|
|
651
|
+
b0 += m1r0;
|
|
652
|
+
b3 += m1r0;
|
|
653
|
+
b1 += m1r2;
|
|
654
|
+
b2 += m1r2;
|
|
655
|
+
}
|
|
656
|
+
output[0] = Math.min(output[0], a0, a1, a2, a3);
|
|
657
|
+
output[1] = Math.min(output[1], b0, b1, b2, b3);
|
|
658
|
+
output[2] = Math.max(output[2], a0, a1, a2, a3);
|
|
659
|
+
output[3] = Math.max(output[3], b0, b1, b2, b3);
|
|
660
|
+
}
|
|
661
|
+
static inverseTransform(m) {
|
|
662
|
+
const d = m[0] * m[3] - m[1] * m[2];
|
|
663
|
+
return [
|
|
664
|
+
m[3] / d,
|
|
665
|
+
-m[1] / d,
|
|
666
|
+
-m[2] / d,
|
|
667
|
+
m[0] / d,
|
|
668
|
+
(m[2] * m[5] - m[4] * m[3]) / d,
|
|
669
|
+
(m[4] * m[1] - m[5] * m[0]) / d
|
|
670
|
+
];
|
|
671
|
+
}
|
|
672
|
+
// This calculation uses Singular Value Decomposition.
|
|
673
|
+
// The SVD can be represented with formula A = USV. We are interested in the
|
|
674
|
+
// matrix S here because it represents the scale values.
|
|
675
|
+
static singularValueDecompose2dScale(matrix, output) {
|
|
676
|
+
const m0 = matrix[0];
|
|
677
|
+
const m1 = matrix[1];
|
|
678
|
+
const m2 = matrix[2];
|
|
679
|
+
const m3 = matrix[3];
|
|
680
|
+
const a = m0 ** 2 + m1 ** 2;
|
|
681
|
+
const b = m0 * m2 + m1 * m3;
|
|
682
|
+
const c = m2 ** 2 + m3 ** 2;
|
|
683
|
+
const first = (a + c) / 2;
|
|
684
|
+
const second = Math.sqrt(first ** 2 - (a * c - b ** 2));
|
|
685
|
+
output[0] = Math.sqrt(first + second || 1);
|
|
686
|
+
output[1] = Math.sqrt(first - second || 1);
|
|
687
|
+
}
|
|
688
|
+
// Normalize rectangle rect=[x1, y1, x2, y2] so that (x1,y1) < (x2,y2)
|
|
689
|
+
// For coordinate systems whose origin lies in the bottom-left, this
|
|
690
|
+
// means normalization to (BL,TR) ordering. For systems with origin in the
|
|
691
|
+
// top-left, this means (TL,BR) ordering.
|
|
692
|
+
static normalizeRect(rect) {
|
|
693
|
+
const r = rect.slice(0);
|
|
694
|
+
if (rect[0] > rect[2]) {
|
|
695
|
+
r[0] = rect[2];
|
|
696
|
+
r[2] = rect[0];
|
|
697
|
+
}
|
|
698
|
+
if (rect[1] > rect[3]) {
|
|
699
|
+
r[1] = rect[3];
|
|
700
|
+
r[3] = rect[1];
|
|
701
|
+
}
|
|
702
|
+
return r;
|
|
703
|
+
}
|
|
704
|
+
// Returns a rectangle [x1, y1, x2, y2] corresponding to the
|
|
705
|
+
// intersection of rect1 and rect2. If no intersection, returns 'null'
|
|
706
|
+
// The rectangle coordinates of rect1, rect2 should be [x1, y1, x2, y2]
|
|
707
|
+
static intersect(rect1, rect2) {
|
|
708
|
+
const xLow = Math.max(
|
|
709
|
+
Math.min(rect1[0], rect1[2]),
|
|
710
|
+
Math.min(rect2[0], rect2[2])
|
|
711
|
+
);
|
|
712
|
+
const xHigh = Math.min(
|
|
713
|
+
Math.max(rect1[0], rect1[2]),
|
|
714
|
+
Math.max(rect2[0], rect2[2])
|
|
715
|
+
);
|
|
716
|
+
if (xLow > xHigh) {
|
|
717
|
+
return null;
|
|
718
|
+
}
|
|
719
|
+
const yLow = Math.max(
|
|
720
|
+
Math.min(rect1[1], rect1[3]),
|
|
721
|
+
Math.min(rect2[1], rect2[3])
|
|
722
|
+
);
|
|
723
|
+
const yHigh = Math.min(
|
|
724
|
+
Math.max(rect1[1], rect1[3]),
|
|
725
|
+
Math.max(rect2[1], rect2[3])
|
|
726
|
+
);
|
|
727
|
+
if (yLow > yHigh) {
|
|
728
|
+
return null;
|
|
729
|
+
}
|
|
730
|
+
return [xLow, yLow, xHigh, yHigh];
|
|
731
|
+
}
|
|
732
|
+
static pointBoundingBox(x, y, minMax) {
|
|
733
|
+
minMax[0] = Math.min(minMax[0], x);
|
|
734
|
+
minMax[1] = Math.min(minMax[1], y);
|
|
735
|
+
minMax[2] = Math.max(minMax[2], x);
|
|
736
|
+
minMax[3] = Math.max(minMax[3], y);
|
|
737
|
+
}
|
|
738
|
+
static rectBoundingBox(x0, y0, x1, y1, minMax) {
|
|
739
|
+
minMax[0] = Math.min(minMax[0], x0, x1);
|
|
740
|
+
minMax[1] = Math.min(minMax[1], y0, y1);
|
|
741
|
+
minMax[2] = Math.max(minMax[2], x0, x1);
|
|
742
|
+
minMax[3] = Math.max(minMax[3], y0, y1);
|
|
743
|
+
}
|
|
744
|
+
// From https://github.com/adobe-webplatform/Snap.svg/blob/b365287722a72526000ac4bfcf0ce4cac2faa015/src/path.js#L852
|
|
745
|
+
static bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3, minMax) {
|
|
746
|
+
minMax[0] = Math.min(minMax[0], x0, x3);
|
|
747
|
+
minMax[1] = Math.min(minMax[1], y0, y3);
|
|
748
|
+
minMax[2] = Math.max(minMax[2], x0, x3);
|
|
749
|
+
minMax[3] = Math.max(minMax[3], y0, y3);
|
|
750
|
+
__privateMethod(this, _Util_static, getExtremum_fn).call(this, x0, x1, x2, x3, y0, y1, y2, y3, 3 * (-x0 + 3 * (x1 - x2) + x3), 6 * (x0 - 2 * x1 + x2), 3 * (x1 - x0), minMax);
|
|
751
|
+
__privateMethod(this, _Util_static, getExtremum_fn).call(this, x0, x1, x2, x3, y0, y1, y2, y3, 3 * (-y0 + 3 * (y1 - y2) + y3), 6 * (y0 - 2 * y1 + y2), 3 * (y1 - y0), minMax);
|
|
752
|
+
}
|
|
753
|
+
};
|
|
754
|
+
_Util_static = new WeakSet();
|
|
755
|
+
getExtremumOnCurve_fn = function(x0, x1, x2, x3, y0, y1, y2, y3, t, minMax) {
|
|
756
|
+
if (t <= 0 || t >= 1) {
|
|
757
|
+
return;
|
|
758
|
+
}
|
|
759
|
+
const mt = 1 - t;
|
|
760
|
+
const tt = t * t;
|
|
761
|
+
const ttt = tt * t;
|
|
762
|
+
const x = mt * (mt * (mt * x0 + 3 * t * x1) + 3 * tt * x2) + ttt * x3;
|
|
763
|
+
const y = mt * (mt * (mt * y0 + 3 * t * y1) + 3 * tt * y2) + ttt * y3;
|
|
764
|
+
minMax[0] = Math.min(minMax[0], x);
|
|
765
|
+
minMax[1] = Math.min(minMax[1], y);
|
|
766
|
+
minMax[2] = Math.max(minMax[2], x);
|
|
767
|
+
minMax[3] = Math.max(minMax[3], y);
|
|
768
|
+
};
|
|
769
|
+
getExtremum_fn = function(x0, x1, x2, x3, y0, y1, y2, y3, a, b, c, minMax) {
|
|
770
|
+
if (Math.abs(a) < 1e-12) {
|
|
771
|
+
if (Math.abs(b) >= 1e-12) {
|
|
772
|
+
__privateMethod(this, _Util_static, getExtremumOnCurve_fn).call(this, x0, x1, x2, x3, y0, y1, y2, y3, -c / b, minMax);
|
|
773
|
+
}
|
|
774
|
+
return;
|
|
775
|
+
}
|
|
776
|
+
const delta = b ** 2 - 4 * c * a;
|
|
777
|
+
if (delta < 0) {
|
|
778
|
+
return;
|
|
779
|
+
}
|
|
780
|
+
const sqrtDelta = Math.sqrt(delta);
|
|
781
|
+
const a2 = 2 * a;
|
|
782
|
+
__privateMethod(this, _Util_static, getExtremumOnCurve_fn).call(this, x0, x1, x2, x3, y0, y1, y2, y3, (-b + sqrtDelta) / a2, minMax);
|
|
783
|
+
__privateMethod(this, _Util_static, getExtremumOnCurve_fn).call(this, x0, x1, x2, x3, y0, y1, y2, y3, (-b - sqrtDelta) / a2, minMax);
|
|
784
|
+
};
|
|
785
|
+
__privateAdd(Util, _Util_static);
|
|
786
|
+
var PDFStringTranslateTable = [
|
|
787
|
+
0,
|
|
788
|
+
0,
|
|
789
|
+
0,
|
|
790
|
+
0,
|
|
791
|
+
0,
|
|
792
|
+
0,
|
|
793
|
+
0,
|
|
794
|
+
0,
|
|
795
|
+
0,
|
|
796
|
+
0,
|
|
797
|
+
0,
|
|
798
|
+
0,
|
|
799
|
+
0,
|
|
800
|
+
0,
|
|
801
|
+
0,
|
|
802
|
+
0,
|
|
803
|
+
0,
|
|
804
|
+
0,
|
|
805
|
+
0,
|
|
806
|
+
0,
|
|
807
|
+
0,
|
|
808
|
+
0,
|
|
809
|
+
0,
|
|
810
|
+
0,
|
|
811
|
+
728,
|
|
812
|
+
711,
|
|
813
|
+
710,
|
|
814
|
+
729,
|
|
815
|
+
733,
|
|
816
|
+
731,
|
|
817
|
+
730,
|
|
818
|
+
732,
|
|
819
|
+
0,
|
|
820
|
+
0,
|
|
821
|
+
0,
|
|
822
|
+
0,
|
|
823
|
+
0,
|
|
824
|
+
0,
|
|
825
|
+
0,
|
|
826
|
+
0,
|
|
827
|
+
0,
|
|
828
|
+
0,
|
|
829
|
+
0,
|
|
830
|
+
0,
|
|
831
|
+
0,
|
|
832
|
+
0,
|
|
833
|
+
0,
|
|
834
|
+
0,
|
|
835
|
+
0,
|
|
836
|
+
0,
|
|
837
|
+
0,
|
|
838
|
+
0,
|
|
839
|
+
0,
|
|
840
|
+
0,
|
|
841
|
+
0,
|
|
842
|
+
0,
|
|
843
|
+
0,
|
|
844
|
+
0,
|
|
845
|
+
0,
|
|
846
|
+
0,
|
|
847
|
+
0,
|
|
848
|
+
0,
|
|
849
|
+
0,
|
|
850
|
+
0,
|
|
851
|
+
0,
|
|
852
|
+
0,
|
|
853
|
+
0,
|
|
854
|
+
0,
|
|
855
|
+
0,
|
|
856
|
+
0,
|
|
857
|
+
0,
|
|
858
|
+
0,
|
|
859
|
+
0,
|
|
860
|
+
0,
|
|
861
|
+
0,
|
|
862
|
+
0,
|
|
863
|
+
0,
|
|
864
|
+
0,
|
|
865
|
+
0,
|
|
866
|
+
0,
|
|
867
|
+
0,
|
|
868
|
+
0,
|
|
869
|
+
0,
|
|
870
|
+
0,
|
|
871
|
+
0,
|
|
872
|
+
0,
|
|
873
|
+
0,
|
|
874
|
+
0,
|
|
875
|
+
0,
|
|
876
|
+
0,
|
|
877
|
+
0,
|
|
878
|
+
0,
|
|
879
|
+
0,
|
|
880
|
+
0,
|
|
881
|
+
0,
|
|
882
|
+
0,
|
|
883
|
+
0,
|
|
884
|
+
0,
|
|
885
|
+
0,
|
|
886
|
+
0,
|
|
887
|
+
0,
|
|
888
|
+
0,
|
|
889
|
+
0,
|
|
890
|
+
0,
|
|
891
|
+
0,
|
|
892
|
+
0,
|
|
893
|
+
0,
|
|
894
|
+
0,
|
|
895
|
+
0,
|
|
896
|
+
0,
|
|
897
|
+
0,
|
|
898
|
+
0,
|
|
899
|
+
0,
|
|
900
|
+
0,
|
|
901
|
+
0,
|
|
902
|
+
0,
|
|
903
|
+
0,
|
|
904
|
+
0,
|
|
905
|
+
0,
|
|
906
|
+
0,
|
|
907
|
+
0,
|
|
908
|
+
0,
|
|
909
|
+
0,
|
|
910
|
+
0,
|
|
911
|
+
0,
|
|
912
|
+
0,
|
|
913
|
+
0,
|
|
914
|
+
0,
|
|
915
|
+
8226,
|
|
916
|
+
8224,
|
|
917
|
+
8225,
|
|
918
|
+
8230,
|
|
919
|
+
8212,
|
|
920
|
+
8211,
|
|
921
|
+
402,
|
|
922
|
+
8260,
|
|
923
|
+
8249,
|
|
924
|
+
8250,
|
|
925
|
+
8722,
|
|
926
|
+
8240,
|
|
927
|
+
8222,
|
|
928
|
+
8220,
|
|
929
|
+
8221,
|
|
930
|
+
8216,
|
|
931
|
+
8217,
|
|
932
|
+
8218,
|
|
933
|
+
8482,
|
|
934
|
+
64257,
|
|
935
|
+
64258,
|
|
936
|
+
321,
|
|
937
|
+
338,
|
|
938
|
+
352,
|
|
939
|
+
376,
|
|
940
|
+
381,
|
|
941
|
+
305,
|
|
942
|
+
322,
|
|
943
|
+
339,
|
|
944
|
+
353,
|
|
945
|
+
382,
|
|
946
|
+
0,
|
|
947
|
+
8364
|
|
948
|
+
];
|
|
949
|
+
function stringToPDFString(str, keepEscapeSequence = false) {
|
|
950
|
+
if (str[0] >= "\xEF") {
|
|
951
|
+
let encoding;
|
|
952
|
+
if (str[0] === "\xFE" && str[1] === "\xFF") {
|
|
953
|
+
encoding = "utf-16be";
|
|
954
|
+
if (str.length % 2 === 1) {
|
|
955
|
+
str = str.slice(0, -1);
|
|
956
|
+
}
|
|
957
|
+
} else if (str[0] === "\xFF" && str[1] === "\xFE") {
|
|
958
|
+
encoding = "utf-16le";
|
|
959
|
+
if (str.length % 2 === 1) {
|
|
960
|
+
str = str.slice(0, -1);
|
|
961
|
+
}
|
|
962
|
+
} else if (str[0] === "\xEF" && str[1] === "\xBB" && str[2] === "\xBF") {
|
|
963
|
+
encoding = "utf-8";
|
|
964
|
+
}
|
|
965
|
+
if (encoding) {
|
|
966
|
+
try {
|
|
967
|
+
const decoder = new TextDecoder(encoding, { fatal: true });
|
|
968
|
+
const buffer = stringToBytes(str);
|
|
969
|
+
const decoded = decoder.decode(buffer);
|
|
970
|
+
if (keepEscapeSequence || !decoded.includes("\x1B")) {
|
|
971
|
+
return decoded;
|
|
972
|
+
}
|
|
973
|
+
return decoded.replaceAll(/\x1b[^\x1b]*(?:\x1b|$)/g, "");
|
|
974
|
+
} catch (ex) {
|
|
975
|
+
warn(`stringToPDFString: "${ex}".`);
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
const strBuf = [];
|
|
980
|
+
for (let i = 0, ii = str.length; i < ii; i++) {
|
|
981
|
+
const charCode = str.charCodeAt(i);
|
|
982
|
+
if (!keepEscapeSequence && charCode === 27) {
|
|
983
|
+
while (++i < ii && str.charCodeAt(i) !== 27) {
|
|
984
|
+
}
|
|
985
|
+
continue;
|
|
986
|
+
}
|
|
987
|
+
const code = PDFStringTranslateTable[charCode];
|
|
988
|
+
strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
|
|
989
|
+
}
|
|
990
|
+
return strBuf.join("");
|
|
991
|
+
}
|
|
992
|
+
function stringToUTF8String(str) {
|
|
993
|
+
return decodeURIComponent(escape(str));
|
|
994
|
+
}
|
|
995
|
+
function utf8StringToString(str) {
|
|
996
|
+
return unescape(encodeURIComponent(str));
|
|
997
|
+
}
|
|
998
|
+
function isArrayEqual(arr1, arr2) {
|
|
999
|
+
if (arr1.length !== arr2.length) {
|
|
1000
|
+
return false;
|
|
1001
|
+
}
|
|
1002
|
+
for (let i = 0, ii = arr1.length; i < ii; i++) {
|
|
1003
|
+
if (arr1[i] !== arr2[i]) {
|
|
1004
|
+
return false;
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
return true;
|
|
1008
|
+
}
|
|
1009
|
+
function getModificationDate(date = /* @__PURE__ */ new Date()) {
|
|
1010
|
+
const buffer = [
|
|
1011
|
+
date.getUTCFullYear().toString(),
|
|
1012
|
+
(date.getUTCMonth() + 1).toString().padStart(2, "0"),
|
|
1013
|
+
date.getUTCDate().toString().padStart(2, "0"),
|
|
1014
|
+
date.getUTCHours().toString().padStart(2, "0"),
|
|
1015
|
+
date.getUTCMinutes().toString().padStart(2, "0"),
|
|
1016
|
+
date.getUTCSeconds().toString().padStart(2, "0")
|
|
1017
|
+
];
|
|
1018
|
+
return buffer.join("");
|
|
1019
|
+
}
|
|
1020
|
+
var NormalizeRegex = null;
|
|
1021
|
+
var NormalizationMap = null;
|
|
1022
|
+
function normalizeUnicode(str) {
|
|
1023
|
+
if (!NormalizeRegex) {
|
|
1024
|
+
NormalizeRegex = /([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu;
|
|
1025
|
+
NormalizationMap = /* @__PURE__ */ new Map([["\uFB05", "\u017Ft"]]);
|
|
1026
|
+
}
|
|
1027
|
+
return str.replaceAll(
|
|
1028
|
+
NormalizeRegex,
|
|
1029
|
+
(_, p1, p2) => p1 ? p1.normalize("NFKC") : NormalizationMap.get(p2)
|
|
1030
|
+
);
|
|
1031
|
+
}
|
|
1032
|
+
function getUuid() {
|
|
1033
|
+
if (typeof crypto.randomUUID === "function") {
|
|
1034
|
+
return crypto.randomUUID();
|
|
1035
|
+
}
|
|
1036
|
+
const buf = new Uint8Array(32);
|
|
1037
|
+
crypto.getRandomValues(buf);
|
|
1038
|
+
return bytesToString(buf);
|
|
1039
|
+
}
|
|
1040
|
+
var AnnotationPrefix = "pdfjs_internal_id_";
|
|
1041
|
+
function _isValidExplicitDest(validRef, validName, dest) {
|
|
1042
|
+
if (!Array.isArray(dest) || dest.length < 2) {
|
|
1043
|
+
return false;
|
|
1044
|
+
}
|
|
1045
|
+
const [page, zoom, ...args] = dest;
|
|
1046
|
+
if (!validRef(page) && !Number.isInteger(page)) {
|
|
1047
|
+
return false;
|
|
1048
|
+
}
|
|
1049
|
+
if (!validName(zoom)) {
|
|
1050
|
+
return false;
|
|
1051
|
+
}
|
|
1052
|
+
const argsLen = args.length;
|
|
1053
|
+
let allowNull = true;
|
|
1054
|
+
switch (zoom.name) {
|
|
1055
|
+
case "XYZ":
|
|
1056
|
+
if (argsLen < 2 || argsLen > 3) {
|
|
1057
|
+
return false;
|
|
1058
|
+
}
|
|
1059
|
+
break;
|
|
1060
|
+
case "Fit":
|
|
1061
|
+
case "FitB":
|
|
1062
|
+
return argsLen === 0;
|
|
1063
|
+
case "FitH":
|
|
1064
|
+
case "FitBH":
|
|
1065
|
+
case "FitV":
|
|
1066
|
+
case "FitBV":
|
|
1067
|
+
if (argsLen > 1) {
|
|
1068
|
+
return false;
|
|
1069
|
+
}
|
|
1070
|
+
break;
|
|
1071
|
+
case "FitR":
|
|
1072
|
+
if (argsLen !== 4) {
|
|
1073
|
+
return false;
|
|
1074
|
+
}
|
|
1075
|
+
allowNull = false;
|
|
1076
|
+
break;
|
|
1077
|
+
default:
|
|
1078
|
+
return false;
|
|
1079
|
+
}
|
|
1080
|
+
for (const arg of args) {
|
|
1081
|
+
if (typeof arg === "number" || allowNull && arg === null) {
|
|
1082
|
+
continue;
|
|
1083
|
+
}
|
|
1084
|
+
return false;
|
|
1085
|
+
}
|
|
1086
|
+
return true;
|
|
1087
|
+
}
|
|
1088
|
+
function MathClamp(v, min, max) {
|
|
1089
|
+
return Math.min(Math.max(v, min), max);
|
|
1090
|
+
}
|
|
1091
|
+
function toHexUtil(arr) {
|
|
1092
|
+
if (Uint8Array.prototype.toHex) {
|
|
1093
|
+
return arr.toHex();
|
|
1094
|
+
}
|
|
1095
|
+
return Array.from(arr, (num) => hexNumbers[num]).join("");
|
|
1096
|
+
}
|
|
1097
|
+
function toBase64Util(arr) {
|
|
1098
|
+
if (Uint8Array.prototype.toBase64) {
|
|
1099
|
+
return arr.toBase64();
|
|
1100
|
+
}
|
|
1101
|
+
return btoa(bytesToString(arr));
|
|
1102
|
+
}
|
|
1103
|
+
function fromBase64Util(str) {
|
|
1104
|
+
if (Uint8Array.fromBase64) {
|
|
1105
|
+
return Uint8Array.fromBase64(str);
|
|
1106
|
+
}
|
|
1107
|
+
return stringToBytes(atob(str));
|
|
1108
|
+
}
|
|
1109
|
+
if (false) {
|
|
1110
|
+
Promise.try = function(fn, ...args) {
|
|
1111
|
+
return new Promise((resolve) => {
|
|
1112
|
+
resolve(fn(...args));
|
|
1113
|
+
});
|
|
1114
|
+
};
|
|
1115
|
+
}
|
|
1116
|
+
if (typeof Math.sumPrecise !== "function") {
|
|
1117
|
+
Math.sumPrecise = function(numbers) {
|
|
1118
|
+
return numbers.reduce((a, b) => a + b, 0);
|
|
1119
|
+
};
|
|
1120
|
+
}
|
|
1121
|
+
if (false) {
|
|
1122
|
+
AbortSignal.any = function(iterable) {
|
|
1123
|
+
const ac = new AbortController();
|
|
1124
|
+
const { signal } = ac;
|
|
1125
|
+
for (const s of iterable) {
|
|
1126
|
+
if (s.aborted) {
|
|
1127
|
+
ac.abort(s.reason);
|
|
1128
|
+
return signal;
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
for (const s of iterable) {
|
|
1132
|
+
s.addEventListener(
|
|
1133
|
+
"abort",
|
|
1134
|
+
() => {
|
|
1135
|
+
ac.abort(s.reason);
|
|
1136
|
+
},
|
|
1137
|
+
{ signal }
|
|
1138
|
+
// Automatically remove the listener.
|
|
1139
|
+
);
|
|
1140
|
+
}
|
|
1141
|
+
return signal;
|
|
1142
|
+
};
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
export {
|
|
1146
|
+
isNodeJS,
|
|
1147
|
+
FONT_IDENTITY_MATRIX,
|
|
1148
|
+
LINE_FACTOR,
|
|
1149
|
+
LINE_DESCENT_FACTOR,
|
|
1150
|
+
BASELINE_FACTOR,
|
|
1151
|
+
RenderingIntentFlag,
|
|
1152
|
+
AnnotationMode,
|
|
1153
|
+
AnnotationEditorPrefix,
|
|
1154
|
+
AnnotationEditorType,
|
|
1155
|
+
AnnotationEditorParamsType,
|
|
1156
|
+
PermissionFlag,
|
|
1157
|
+
TextRenderingMode,
|
|
1158
|
+
ImageKind,
|
|
1159
|
+
AnnotationType,
|
|
1160
|
+
AnnotationReplyType,
|
|
1161
|
+
AnnotationFlag,
|
|
1162
|
+
AnnotationFieldFlag,
|
|
1163
|
+
AnnotationBorderStyleType,
|
|
1164
|
+
AnnotationActionEventType,
|
|
1165
|
+
DocumentActionEventType,
|
|
1166
|
+
PageActionEventType,
|
|
1167
|
+
VerbosityLevel,
|
|
1168
|
+
OPS,
|
|
1169
|
+
DrawOPS,
|
|
1170
|
+
PasswordResponses,
|
|
1171
|
+
setVerbosityLevel,
|
|
1172
|
+
getVerbosityLevel,
|
|
1173
|
+
info,
|
|
1174
|
+
warn,
|
|
1175
|
+
unreachable,
|
|
1176
|
+
assert,
|
|
1177
|
+
createValidAbsoluteUrl,
|
|
1178
|
+
updateUrlHash,
|
|
1179
|
+
shadow,
|
|
1180
|
+
BaseException,
|
|
1181
|
+
PasswordException,
|
|
1182
|
+
UnknownErrorException,
|
|
1183
|
+
InvalidPDFException,
|
|
1184
|
+
ResponseException,
|
|
1185
|
+
FormatError,
|
|
1186
|
+
AbortException,
|
|
1187
|
+
bytesToString,
|
|
1188
|
+
stringToBytes,
|
|
1189
|
+
string32,
|
|
1190
|
+
objectSize,
|
|
1191
|
+
FeatureTest,
|
|
1192
|
+
hexNumbers,
|
|
1193
|
+
Util,
|
|
1194
|
+
stringToPDFString,
|
|
1195
|
+
stringToUTF8String,
|
|
1196
|
+
utf8StringToString,
|
|
1197
|
+
isArrayEqual,
|
|
1198
|
+
getModificationDate,
|
|
1199
|
+
normalizeUnicode,
|
|
1200
|
+
getUuid,
|
|
1201
|
+
AnnotationPrefix,
|
|
1202
|
+
_isValidExplicitDest,
|
|
1203
|
+
MathClamp,
|
|
1204
|
+
toHexUtil,
|
|
1205
|
+
toBase64Util,
|
|
1206
|
+
fromBase64Util
|
|
1207
|
+
};
|